From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07C67C25B0E for ; Mon, 15 Aug 2022 18:13:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232008AbiHOSNY (ORCPT ); Mon, 15 Aug 2022 14:13:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230136AbiHOSNV (ORCPT ); Mon, 15 Aug 2022 14:13:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9EA822BF6; Mon, 15 Aug 2022 11:13: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 5B75A61277; Mon, 15 Aug 2022 18:13:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57012C433C1; Mon, 15 Aug 2022 18:13:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587199; bh=mJLB57aEqIaz+HV2H36Lja9DKkMfUjQL7wsu/WKcVUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CwfJ7zUd7YqQeP8yAkwlYdbgyleAdX31/CxEqgPPb25T8ibtMY00Gg2O3SGbrM3zF BYWHHD+ghrUP7A1IF7xT7lSSUNmmwJqT3DdiJsbjgBr1cazoioP997vRej3VXUt55g uOic0ORDTWaS25YPUK6cGa9Ad8/2MlgdjaTVaxCo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fangrui Song , Nick Desaulniers , Linus Torvalds , Jens Axboe Subject: [PATCH 5.15 001/779] Makefile: link with -z noexecstack --no-warn-rwx-segments Date: Mon, 15 Aug 2022 19:54:05 +0200 Message-Id: <20220815180337.214556614@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 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: Nick Desaulniers commit 0d362be5b14200b77ecc2127936a5ff82fbffe41 upstream. Users of GNU ld (BFD) from binutils 2.39+ will observe multiple instances of a new warning when linking kernels in the form: ld: warning: vmlinux: missing .note.GNU-stack section implies executable = stack ld: NOTE: This behaviour is deprecated and will be removed in a future ve= rsion of the linker ld: warning: vmlinux has a LOAD segment with RWX permissions Generally, we would like to avoid the stack being executable. Because there could be a need for the stack to be executable, assembler sources have to opt-in to this security feature via explicit creation of the .note.GNU-stack feature (which compilers create by default) or command line flag --noexecstack. Or we can simply tell the linker the production of such sections is irrelevant and to link the stack as --noexecstack. LLVM's LLD linker defaults to -z noexecstack, so this flag isn't strictly necessary when linking with LLD, only BFD, but it doesn't hurt to be explicit here for all linkers IMO. --no-warn-rwx-segments is currently BFD specific and only available in the current latest release, so it's wrapped in an ld-option check. While the kernel makes extensive usage of ELF sections, it doesn't use permissions from ELF segments. Link: https://lore.kernel.org/linux-block/3af4127a-f453-4cf7-f133-a181cce06= f73@kernel.dk/ Link: https://sourceware.org/git/?p=3Dbinutils-gdb.git;a=3Dcommit;h=3Dba951= afb99912da01a6e8434126b8fac7aa75107 Link: https://github.com/llvm/llvm-project/issues/57009 Reported-and-tested-by: Jens Axboe Suggested-by: Fangrui Song Signed-off-by: Nick Desaulniers Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) --- a/Makefile +++ b/Makefile @@ -1078,6 +1078,11 @@ KBUILD_CFLAGS +=3D $(KCFLAGS) KBUILD_LDFLAGS_MODULE +=3D --build-id=3Dsha1 LDFLAGS_vmlinux +=3D --build-id=3Dsha1 =20 +KBUILD_LDFLAGS +=3D -z noexecstack +ifeq ($(CONFIG_LD_IS_BFD),y) +KBUILD_LDFLAGS +=3D $(call ld-option,--no-warn-rwx-segments) +endif + ifeq ($(CONFIG_STRIP_ASM_SYMS),y) LDFLAGS_vmlinux +=3D $(call ld-option, -X,) endif From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D172C00140 for ; Mon, 15 Aug 2022 18:14:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233527AbiHOSOL (ORCPT ); Mon, 15 Aug 2022 14:14:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233159AbiHOSNx (ORCPT ); Mon, 15 Aug 2022 14:13:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2F3B2A42C; Mon, 15 Aug 2022 11:13:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 130C261277; Mon, 15 Aug 2022 18:13:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03BB8C433C1; Mon, 15 Aug 2022 18:13:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587223; bh=9oKqhmwN4AKakxaJwaUN3W6bPQ1UeHS2y21A6FGtcaE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D66IcxOje8FoAp3h2ju2vpaAUC1i+YOgClwwM0f0QzjImUXyKcopyU5xx5qNu8fX/ Cd/ie12/iq3Tk8NXbj7sBoc4Nvv+R5uOP/Tbt7eXzJvIDGrl3r17XlgaNA1tUEQz+E QNfKnO9OP3CzwpkzoK32XROlDrTofx1fycGU9Ot8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fangrui Song , Nick Desaulniers , Linus Torvalds , Jens Axboe Subject: [PATCH 5.15 002/779] x86: link vdso and boot with -z noexecstack --no-warn-rwx-segments Date: Mon, 15 Aug 2022 19:54:06 +0200 Message-Id: <20220815180337.255959747@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nick Desaulniers commit ffcf9c5700e49c0aee42dcba9a12ba21338e8136 upstream. Users of GNU ld (BFD) from binutils 2.39+ will observe multiple instances of a new warning when linking kernels in the form: ld: warning: arch/x86/boot/pmjump.o: missing .note.GNU-stack section impl= ies executable stack ld: NOTE: This behaviour is deprecated and will be removed in a future ve= rsion of the linker ld: warning: arch/x86/boot/compressed/vmlinux has a LOAD segment with RWX= permissions Generally, we would like to avoid the stack being executable. Because there could be a need for the stack to be executable, assembler sources have to opt-in to this security feature via explicit creation of the .note.GNU-stack feature (which compilers create by default) or command line flag --noexecstack. Or we can simply tell the linker the production of such sections is irrelevant and to link the stack as --noexecstack. LLVM's LLD linker defaults to -z noexecstack, so this flag isn't strictly necessary when linking with LLD, only BFD, but it doesn't hurt to be explicit here for all linkers IMO. --no-warn-rwx-segments is currently BFD specific and only available in the current latest release, so it's wrapped in an ld-option check. While the kernel makes extensive usage of ELF sections, it doesn't use permissions from ELF segments. Link: https://lore.kernel.org/linux-block/3af4127a-f453-4cf7-f133-a181cce06= f73@kernel.dk/ Link: https://sourceware.org/git/?p=3Dbinutils-gdb.git;a=3Dcommit;h=3Dba951= afb99912da01a6e8434126b8fac7aa75107 Link: https://github.com/llvm/llvm-project/issues/57009 Reported-and-tested-by: Jens Axboe Suggested-by: Fangrui Song Signed-off-by: Nick Desaulniers Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/x86/boot/Makefile | 2 +- arch/x86/boot/compressed/Makefile | 4 ++++ arch/x86/entry/vdso/Makefile | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) --- a/arch/x86/boot/Makefile +++ b/arch/x86/boot/Makefile @@ -103,7 +103,7 @@ $(obj)/zoffset.h: $(obj)/compressed/vmli AFLAGS_header.o +=3D -I$(objtree)/$(obj) $(obj)/header.o: $(obj)/zoffset.h =20 -LDFLAGS_setup.elf :=3D -m elf_i386 -T +LDFLAGS_setup.elf :=3D -m elf_i386 -z noexecstack -T $(obj)/setup.elf: $(src)/setup.ld $(SETUP_OBJS) FORCE $(call if_changed,ld) =20 --- a/arch/x86/boot/compressed/Makefile +++ b/arch/x86/boot/compressed/Makefile @@ -69,6 +69,10 @@ LDFLAGS_vmlinux :=3D -pie $(call ld-option ifdef CONFIG_LD_ORPHAN_WARN LDFLAGS_vmlinux +=3D --orphan-handling=3Dwarn endif +LDFLAGS_vmlinux +=3D -z noexecstack +ifeq ($(CONFIG_LD_IS_BFD),y) +LDFLAGS_vmlinux +=3D $(call ld-option,--no-warn-rwx-segments) +endif LDFLAGS_vmlinux +=3D -T =20 hostprogs :=3D mkpiggy --- a/arch/x86/entry/vdso/Makefile +++ b/arch/x86/entry/vdso/Makefile @@ -179,7 +179,7 @@ quiet_cmd_vdso =3D VDSO $@ sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@' =20 VDSO_LDFLAGS =3D -shared --hash-style=3Dboth --build-id=3Dsha1 \ - $(call ld-option, --eh-frame-hdr) -Bsymbolic + $(call ld-option, --eh-frame-hdr) -Bsymbolic -z noexecstack GCOV_PROFILE :=3D n =20 quiet_cmd_vdso_and_check =3D VDSO $@ From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56754C00140 for ; Mon, 15 Aug 2022 18:14:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233544AbiHOSOO (ORCPT ); Mon, 15 Aug 2022 14:14:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232924AbiHOSNy (ORCPT ); Mon, 15 Aug 2022 14:13:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74F292A43B; Mon, 15 Aug 2022 11:13: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 EA5DA6127C; Mon, 15 Aug 2022 18:13:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF773C433C1; Mon, 15 Aug 2022 18:13:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587226; bh=i/IqNC9sKyzc2Gi0Ic4dqxmktUixRmto/+KsH9OoTSw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UHcka7j2KCimGnJyHDymlVGr+hDKF70B+2sEn3NupyhP3gNi8ujdlMwc606ccGAdO FgQ2X0++hHkA82/8OLa7J9+mZt56Mu5p3f7LjHAuqVdsVoRV7DR9mYYRl57LPeAdcP bMEDaZTmzAHHA5TUERczHJrmHwPuH/fBAfPjrNKw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust Subject: [PATCH 5.15 003/779] Revert "pNFS: nfs3_set_ds_client should set NFS_CS_NOPING" Date: Mon, 15 Aug 2022 19:54:07 +0200 Message-Id: <20220815180337.298765948@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Trond Myklebust commit 9597152d98840c2517230740952df97cfcc07e2f upstream. This reverts commit c6eb58435b98bd843d3179664a0195ff25adb2c3. If a transport is down, then we want to fail over to other transports if they are listed in the GETDEVICEINFO reply. Fixes: c6eb58435b98 ("pNFS: nfs3_set_ds_client should set NFS_CS_NOPING") Cc: stable@vger.kernel.org # 5.11.x Signed-off-by: Trond Myklebust Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/nfs/nfs3client.c | 1 - 1 file changed, 1 deletion(-) --- a/fs/nfs/nfs3client.c +++ b/fs/nfs/nfs3client.c @@ -108,7 +108,6 @@ struct nfs_client *nfs3_set_ds_client(st if (mds_srv->flags & NFS_MOUNT_NORESVPORT) __set_bit(NFS_CS_NORESVPORT, &cl_init.init_flags); =20 - __set_bit(NFS_CS_NOPING, &cl_init.init_flags); __set_bit(NFS_CS_DS, &cl_init.init_flags); =20 /* Use the MDS nfs_client cl_ipaddr. */ From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65552C25B08 for ; Mon, 15 Aug 2022 18:14:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233577AbiHOSO1 (ORCPT ); Mon, 15 Aug 2022 14:14:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233412AbiHOSN7 (ORCPT ); Mon, 15 Aug 2022 14:13: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 55FE32A702; Mon, 15 Aug 2022 11:13: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 DC4B4B81063; Mon, 15 Aug 2022 18:13:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40E40C433C1; Mon, 15 Aug 2022 18:13:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587229; bh=kyGH0hOwV/DTuyXi7A1qoh1DROR54jDbLKUt9s3fvhY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GTBDhzLBeTpClnvWs16UgO6w4GkdWNqXmak/WNOGQsb4CnUMuCipJdvtUmP4Pdk8j CVOXNJ3T2J6gr0VbqHkADtJJ3YmvB5BcYcDtxw6DewLFws7T8mE4zEDtvbMdVYr0/X djlHjsWRmG4jinwxU6dunmj9sLn6bDRZs+lIOqIg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Himanshu Madhani , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.15 004/779] scsi: Revert "scsi: qla2xxx: Fix disk failure to rediscover" Date: Mon, 15 Aug 2022 19:54:08 +0200 Message-Id: <20220815180337.349120433@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nilesh Javali commit 5bc7b01c513a4a9b4cfe306e8d1720cfcfd3b8a3 upstream. This fixes the regression of NVMe discovery failure during driver load time. This reverts commit 6a45c8e137d4e2c72eecf1ac7cf64f2fdfcead99. Link: https://lore.kernel.org/r/20220713052045.10683-2-njavali@marvell.com Cc: stable@vger.kernel.org Reviewed-by: Himanshu Madhani Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_init.c | 5 ++--- drivers/scsi/qla2xxx/qla_nvme.c | 5 ----- 2 files changed, 2 insertions(+), 8 deletions(-) --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -5749,8 +5749,6 @@ qla2x00_reg_remote_port(scsi_qla_host_t if (atomic_read(&fcport->state) =3D=3D FCS_ONLINE) return; =20 - qla2x00_set_fcport_state(fcport, FCS_ONLINE); - rport_ids.node_name =3D wwn_to_u64(fcport->node_name); rport_ids.port_name =3D wwn_to_u64(fcport->port_name); rport_ids.port_id =3D fcport->d_id.b.domain << 16 | @@ -5858,7 +5856,6 @@ qla2x00_update_fcport(scsi_qla_host_t *v qla2x00_reg_remote_port(vha, fcport); break; case MODE_TARGET: - qla2x00_set_fcport_state(fcport, FCS_ONLINE); if (!vha->vha_tgt.qla_tgt->tgt_stop && !vha->vha_tgt.qla_tgt->tgt_stopped) qlt_fc_port_added(vha, fcport); @@ -5873,6 +5870,8 @@ qla2x00_update_fcport(scsi_qla_host_t *v break; } =20 + qla2x00_set_fcport_state(fcport, FCS_ONLINE); + if (IS_IIDMA_CAPABLE(vha->hw) && vha->hw->flags.gpsc_supported) { if (fcport->id_changed) { fcport->id_changed =3D 0; --- a/drivers/scsi/qla2xxx/qla_nvme.c +++ b/drivers/scsi/qla2xxx/qla_nvme.c @@ -35,11 +35,6 @@ int qla_nvme_register_remote(struct scsi (fcport->nvme_flag & NVME_FLAG_REGISTERED)) return 0; =20 - if (atomic_read(&fcport->state) =3D=3D FCS_ONLINE) - return 0; - - qla2x00_set_fcport_state(fcport, FCS_ONLINE); - fcport->nvme_flag &=3D ~NVME_FLAG_RESETTING; =20 memset(&req, 0, sizeof(struct nvme_fc_port_info)); From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9AD9C25B0E for ; Mon, 15 Aug 2022 18:14:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233638AbiHOSOc (ORCPT ); Mon, 15 Aug 2022 14:14:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233444AbiHOSOB (ORCPT ); Mon, 15 Aug 2022 14:14:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE8AE2A725; Mon, 15 Aug 2022 11:13:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3AD9DB81072; Mon, 15 Aug 2022 18:13:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94B84C433C1; Mon, 15 Aug 2022 18:13:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587233; bh=YiqcZxqXh6b5ciK1fYu6kiA0CLiPRo9JnCP9IWXnUug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YI0Cl5H9VJ6M2kPpT3cdMiwhwgOcYdIiHZNV5RccZp5uOi6fU3OhseWSyEHN8iddq 4kPa+vvBAao+fdAaBMuWDxLJLqdLUAzpsl1q8lSKevZ6PltnHDKEPHDcqoFa9nXQgD U+s5PdajhR78f6na7VqHUzbXPoyloYzs4vBpeyLc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust Subject: [PATCH 5.15 005/779] pNFS/flexfiles: Report RDMA connection errors to the server Date: Mon, 15 Aug 2022 19:54:09 +0200 Message-Id: <20220815180337.392508647@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Trond Myklebust commit 7836d75467e9d214bdf5c693b32721de729a6e38 upstream. The RPC/RDMA driver will return -EPROTO and -ENODEV as connection errors under certain circumstances. Make sure that we handle them and report them to the server. If not, we can end up cycling forever in a LAYOUTGET/LAYOUTRETURN loop. Fixes: a12f996d3413 ("NFSv4/pNFS: Use connections to a DS that are all of t= he same protocol family") Cc: stable@vger.kernel.org # 5.11.x Signed-off-by: Trond Myklebust Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/nfs/flexfilelayout/flexfilelayout.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/fs/nfs/flexfilelayout/flexfilelayout.c +++ b/fs/nfs/flexfilelayout/flexfilelayout.c @@ -1140,6 +1140,8 @@ static int ff_layout_async_handle_error_ case -EIO: case -ETIMEDOUT: case -EPIPE: + case -EPROTO: + case -ENODEV: dprintk("%s DS connection error %d\n", __func__, task->tk_status); nfs4_delete_deviceid(devid->ld, devid->nfs_client, @@ -1245,6 +1247,8 @@ static void ff_layout_io_track_ds_error( case -ENOBUFS: case -EPIPE: case -EPERM: + case -EPROTO: + case -ENODEV: *op_status =3D status =3D NFS4ERR_NXIO; break; case -EACCES: From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A29F2C00140 for ; Mon, 15 Aug 2022 18:14:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233558AbiHOSOq (ORCPT ); Mon, 15 Aug 2022 14:14:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233167AbiHOSOE (ORCPT ); Mon, 15 Aug 2022 14:14:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5974A2A733; Mon, 15 Aug 2022 11:13: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 BDB766126D; Mon, 15 Aug 2022 18:13:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE28AC433C1; Mon, 15 Aug 2022 18:13:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587236; bh=ZijTKWQteD+IeC1G+H3UDJt9gaxBn9cocLeNx6vahE4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MJNWOy+Il0xNfE+qTkArvltRvhqs5tcNtOk01URTRn9ZLFj7ITul/1qF7uYWelpwu ToUa1fY8PzP8TjjQbVbTKBhHotRHxBS3OuY442r5RzXBXivmypHFc+RhUHWxiWh4yD OkPVxFZ3mIXpEkRfHal7q4AWqvGmeSBL+L90AO60= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuck Lever Subject: [PATCH 5.15 006/779] NFSD: Clean up the show_nf_flags() macro Date: Mon, 15 Aug 2022 19:54:10 +0200 Message-Id: <20220815180337.442654455@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chuck Lever commit bb283ca18d1e67c82d22a329c96c9d6036a74790 upstream. The flags are defined using C macros, so TRACE_DEFINE_ENUM is unnecessary. Signed-off-by: Chuck Lever Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/nfsd/trace.h | 6 ------ 1 file changed, 6 deletions(-) --- a/fs/nfsd/trace.h +++ b/fs/nfsd/trace.h @@ -636,12 +636,6 @@ DEFINE_CLID_EVENT(confirmed_r); /* * from fs/nfsd/filecache.h */ -TRACE_DEFINE_ENUM(NFSD_FILE_HASHED); -TRACE_DEFINE_ENUM(NFSD_FILE_PENDING); -TRACE_DEFINE_ENUM(NFSD_FILE_BREAK_READ); -TRACE_DEFINE_ENUM(NFSD_FILE_BREAK_WRITE); -TRACE_DEFINE_ENUM(NFSD_FILE_REFERENCED); - #define show_nf_flags(val) \ __print_flags(val, "|", \ { 1 << NFSD_FILE_HASHED, "HASHED" }, \ From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D1A3C25B0E for ; Mon, 15 Aug 2022 18:14:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233362AbiHOSO4 (ORCPT ); Mon, 15 Aug 2022 14:14:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233357AbiHOSOW (ORCPT ); Mon, 15 Aug 2022 14:14:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8AE52A274; Mon, 15 Aug 2022 11:14: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 976DEB81063; Mon, 15 Aug 2022 18:14:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7E78C433D6; Mon, 15 Aug 2022 18:13:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587239; bh=3PFEAqhuM/Zl2MRWvnSZqeRlyuxtFBRZ7XpXB7oL9q4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xzkmrE0TSMpx5QQedVdi7zo3WmwvCQusxdCBAFa3EZXUg/EMYMb9sWGh61U9Aeuop il+P71qxvI3nbv/i2ytG7Cm5fAC1UN/B1jgz1hJfL67oQJPLghDIrLdHHvOQQpwg3h g+W8LKUlATEhpgj1r9viHgeVupiIqb7hTrh0ynVM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Olga Kornieskaia , Jeff Layton , Chuck Lever Subject: [PATCH 5.15 007/779] nfsd: eliminate the NFSD_FILE_BREAK_* flags Date: Mon, 15 Aug 2022 19:54:11 +0200 Message-Id: <20220815180337.483197827@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jeff Layton commit 23ba98de6dcec665e15c0ca19244379bb0d30932 upstream. We had a report from the spring Bake-a-thon of data corruption in some nfstest_interop tests. Looking at the traces showed the NFS server allowing a v3 WRITE to proceed while a read delegation was still outstanding. Currently, we only set NFSD_FILE_BREAK_* flags if NFSD_MAY_NOT_BREAK_LEASE was set when we call nfsd_file_alloc. NFSD_MAY_NOT_BREAK_LEASE was intended to be set when finding files for COMMIT ops, where we need a writeable filehandle but don't need to break read leases. It doesn't make any sense to consult that flag when allocating a file since the file may be used on subsequent calls where we do want to break the lease (and the usage of it here seems to be reverse from what it should be anyway). Also, after calling nfsd_open_break_lease, we don't want to clear the BREAK_* bits. A lease could end up being set on it later (more than once) and we need to be able to break those leases as well. This means that the NFSD_FILE_BREAK_* flags now just mirror NFSD_MAY_{READ,WRITE} flags, so there's no need for them at all. Just drop those flags and unconditionally call nfsd_open_break_lease every time. Reported-by: Olga Kornieskaia Link: https://bugzilla.redhat.com/show_bug.cgi?id=3D2107360 Fixes: 65294c1f2c5e (nfsd: add a new struct file caching facility to nfsd) Cc: # 5.4.x : bb283ca18d1e NFSD: Clean up the show= _nf_flags() macro Cc: # 5.4.x Signed-off-by: Jeff Layton Signed-off-by: Chuck Lever Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/nfsd/filecache.c | 22 +--------------------- fs/nfsd/filecache.h | 4 +--- fs/nfsd/trace.h | 2 -- 3 files changed, 2 insertions(+), 26 deletions(-) --- a/fs/nfsd/filecache.c +++ b/fs/nfsd/filecache.c @@ -187,12 +187,6 @@ nfsd_file_alloc(struct inode *inode, uns nf->nf_hashval =3D hashval; refcount_set(&nf->nf_ref, 1); nf->nf_may =3D may & NFSD_FILE_MAY_MASK; - if (may & NFSD_MAY_NOT_BREAK_LEASE) { - if (may & NFSD_MAY_WRITE) - __set_bit(NFSD_FILE_BREAK_WRITE, &nf->nf_flags); - if (may & NFSD_MAY_READ) - __set_bit(NFSD_FILE_BREAK_READ, &nf->nf_flags); - } nf->nf_mark =3D NULL; trace_nfsd_file_alloc(nf); } @@ -990,21 +984,7 @@ wait_for_construction: =20 this_cpu_inc(nfsd_file_cache_hits); =20 - if (!(may_flags & NFSD_MAY_NOT_BREAK_LEASE)) { - bool write =3D (may_flags & NFSD_MAY_WRITE); - - if (test_bit(NFSD_FILE_BREAK_READ, &nf->nf_flags) || - (test_bit(NFSD_FILE_BREAK_WRITE, &nf->nf_flags) && write)) { - status =3D nfserrno(nfsd_open_break_lease( - file_inode(nf->nf_file), may_flags)); - if (status =3D=3D nfs_ok) { - clear_bit(NFSD_FILE_BREAK_READ, &nf->nf_flags); - if (write) - clear_bit(NFSD_FILE_BREAK_WRITE, - &nf->nf_flags); - } - } - } + status =3D nfserrno(nfsd_open_break_lease(file_inode(nf->nf_file), may_fl= ags)); out: if (status =3D=3D nfs_ok) { *pnf =3D nf; --- a/fs/nfsd/filecache.h +++ b/fs/nfsd/filecache.h @@ -37,9 +37,7 @@ struct nfsd_file { struct net *nf_net; #define NFSD_FILE_HASHED (0) #define NFSD_FILE_PENDING (1) -#define NFSD_FILE_BREAK_READ (2) -#define NFSD_FILE_BREAK_WRITE (3) -#define NFSD_FILE_REFERENCED (4) +#define NFSD_FILE_REFERENCED (2) unsigned long nf_flags; struct inode *nf_inode; unsigned int nf_hashval; --- a/fs/nfsd/trace.h +++ b/fs/nfsd/trace.h @@ -640,8 +640,6 @@ DEFINE_CLID_EVENT(confirmed_r); __print_flags(val, "|", \ { 1 << NFSD_FILE_HASHED, "HASHED" }, \ { 1 << NFSD_FILE_PENDING, "PENDING" }, \ - { 1 << NFSD_FILE_BREAK_READ, "BREAK_READ" }, \ - { 1 << NFSD_FILE_BREAK_WRITE, "BREAK_WRITE" }, \ { 1 << NFSD_FILE_REFERENCED, "REFERENCED"}) =20 DECLARE_EVENT_CLASS(nfsd_file_class, From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C8A7CC00140 for ; Mon, 15 Aug 2022 18:15:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235254AbiHOSO7 (ORCPT ); Mon, 15 Aug 2022 14:14:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233092AbiHOSOX (ORCPT ); Mon, 15 Aug 2022 14:14:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 491502A940; Mon, 15 Aug 2022 11:14:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B7AC66126D; Mon, 15 Aug 2022 18:14:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5E31C433D6; Mon, 15 Aug 2022 18:14:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587242; bh=OulFKFL7KovR2r6EPGY1gNLGYVPmkKMFn3kUuRZ3tqk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0GArjA4ClM1VUi0xwvcZFeZ8KoxSjY6+2OxumJTGZ79hLSEOMdzg1JZZ3gT0NqHqn gsJ3eEgll+pO9BKFyvCiB2KdZ//No2r465yUg/IA36ctcMUEhmrfYEnqRktnReJV2u m9ePgL1uF7aAZ7BKW7fiTJqmCF7J4r8jhJmLSE58= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Iwai Subject: [PATCH 5.15 008/779] ALSA: usb-audio: Add quirk for Behringer UMC202HD Date: Mon, 15 Aug 2022 19:54:12 +0200 Message-Id: <20220815180337.528098567@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 e086c37f876fd1f551e2b4f9be97d4a1923cd219 upstream. Just like other Behringer models, UMC202HD (USB ID 1397:0507) requires the quirk for the stable streaming, too. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=3D215934 Cc: Link: https://lore.kernel.org/r/20220722143948.29804-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- sound/usb/quirks.c | 2 ++ 1 file changed, 2 insertions(+) --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -1843,6 +1843,8 @@ static const struct usb_audio_quirk_flag QUIRK_FLAG_SHARE_MEDIA_DEVICE | QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x1395, 0x740a, /* Sennheiser DECT */ QUIRK_FLAG_GET_SAMPLE_RATE), + DEVICE_FLG(0x1397, 0x0507, /* Behringer UMC202HD */ + QUIRK_FLAG_PLAYBACK_FIRST | QUIRK_FLAG_GENERIC_IMPLICIT_FB), DEVICE_FLG(0x1397, 0x0508, /* Behringer UMC204HD */ QUIRK_FLAG_PLAYBACK_FIRST | QUIRK_FLAG_GENERIC_IMPLICIT_FB), DEVICE_FLG(0x1397, 0x0509, /* Behringer UMC404HD */ From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD230C00140 for ; Mon, 15 Aug 2022 18:15:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235971AbiHOSPE (ORCPT ); Mon, 15 Aug 2022 14:15:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233396AbiHOSOY (ORCPT ); Mon, 15 Aug 2022 14:14:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F57B2A426; Mon, 15 Aug 2022 11:14: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 C05F461281; Mon, 15 Aug 2022 18:14:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C92C7C433C1; Mon, 15 Aug 2022 18:14:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587245; bh=bIhvwJ0cO3l3RJdTOuGmzssh9wbYGfWA10vvMIuUm+o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JPs3UMnxPZynqcjMDHZeTE3eHptg1ToVNMLgWpTMfRBqWqdk76sUnjROZtQ7+uMth 6R6wB6HMrf8jiB7YpExzxFxk2jSPeKV3G/q+fuCK4uNQMeu/lURyhF0XK6kxYa7++t kjpD4AKZaLlq/+SEUxJk+9pvrAYEdgDO135WOuFc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Takashi Iwai Subject: [PATCH 5.15 009/779] ALSA: bcd2000: Fix a UAF bug on the error path of probing Date: Mon, 15 Aug 2022 19:54:13 +0200 Message-Id: <20220815180337.577966557@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 commit ffb2759df7efbc00187bfd9d1072434a13a54139 upstream. When the driver fails in snd_card_register() at probe time, it will free the 'bcd2k->midi_out_urb' before killing it, which may cause a UAF bug. The following log can reveal it: [ 50.727020] BUG: KASAN: use-after-free in bcd2000_input_complete+0x1f1/0= x2e0 [snd_bcd2000] [ 50.727623] Read of size 8 at addr ffff88810fab0e88 by task swapper/4/0 [ 50.729530] Call Trace: [ 50.732899] bcd2000_input_complete+0x1f1/0x2e0 [snd_bcd2000] Fix this by adding usb_kill_urb() before usb_free_urb(). Fixes: b47a22290d58 ("ALSA: MIDI driver for Behringer BCD2000 USB device") Signed-off-by: Zheyu Ma Cc: Link: https://lore.kernel.org/r/20220715010515.2087925-1-zheyuma97@gmail.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- sound/usb/bcd2000/bcd2000.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/sound/usb/bcd2000/bcd2000.c +++ b/sound/usb/bcd2000/bcd2000.c @@ -348,7 +348,8 @@ static int bcd2000_init_midi(struct bcd2 static void bcd2000_free_usb_related_resources(struct bcd2000 *bcd2k, struct usb_interface *interface) { - /* usb_kill_urb not necessary, urb is aborted automatically */ + usb_kill_urb(bcd2k->midi_out_urb); + usb_kill_urb(bcd2k->midi_in_urb); =20 usb_free_urb(bcd2k->midi_out_urb); usb_free_urb(bcd2k->midi_in_urb); From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E4DEC25B08 for ; Mon, 15 Aug 2022 18:13:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232505AbiHOSNd (ORCPT ); Mon, 15 Aug 2022 14:13:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232120AbiHOSN0 (ORCPT ); Mon, 15 Aug 2022 14:13:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F19FA13E06; Mon, 15 Aug 2022 11:13: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 1753CB8106E; Mon, 15 Aug 2022 18:13:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A203C433C1; Mon, 15 Aug 2022 18:13:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587202; bh=fFfns6JJ81r8M2lqck6bmTm2UrAYKjcdD2sOD+1Um1U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sxrTORMMfiUEZb35WOjPX6xW7k0yyn06h5BGeAa3MMabqp9htUYmLXzCAhxLHTaoE 9vsMqnxfdPmRFUc9qwFG+oTW4TArmd8FoyOIL7z7VDLhzb1RQnJryet4YNLoSEj9s5 ztLVpn7zX6tusS1LOdxnNEGrZsf6JPtLWMUApWrk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tim Crawford , Takashi Iwai Subject: [PATCH 5.15 010/779] ALSA: hda/realtek: Add quirk for Clevo NV45PZ Date: Mon, 15 Aug 2022 19:54:14 +0200 Message-Id: <20220815180337.625559540@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tim Crawford commit be561ffad708f0cee18aee4231f80ffafaf7a419 upstream. Fixes headset detection on Clevo NV45PZ. Signed-off-by: Tim Crawford Cc: Link: https://lore.kernel.org/r/20220731032243.4300-1-tcrawford@system76.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -8992,6 +8992,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MI= C_NO_PRESENCE), SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_N= O_PRESENCE), SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_N= O_PRESENCE), + SND_PCI_QUIRK(0x1558, 0x4041, "Clevo NV4[15]PZ", ALC256_FIXUP_SYSTEM76_MI= C_NO_PRESENCE), SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_N= O_PRESENCE), SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MI= C_NO_PRESENCE), SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_N= O_PRESENCE), From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C264EC25B0E for ; Mon, 15 Aug 2022 18:13:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232764AbiHOSNg (ORCPT ); Mon, 15 Aug 2022 14:13:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232347AbiHOSN1 (ORCPT ); Mon, 15 Aug 2022 14:13:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADE5F2A256; Mon, 15 Aug 2022 11:13: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 3AFB361272; Mon, 15 Aug 2022 18:13:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4060BC433C1; Mon, 15 Aug 2022 18:13:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587205; bh=ulstid4ojWlQHTZ7PLvlo200FTJNlbgUZefZgd4ayE0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TUjLyNSEE+oQ7IleUzF4+T1iS2KmMONH03rHveuA5aYOtX4EpFA+EuNmAae9l4vqF /D0e/wMp78+upgJVbMv7IKjdIOaFpJ1F7a9vmNrGU5RlpYahf7eZG1ntmV3p/XdOUF 12cdBQpBgrVId4PCnsykqhNhBWGTzWQNS+jgRIYs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ivan Hasenkampf , Takashi Iwai Subject: [PATCH 5.15 011/779] ALSA: hda/realtek: Add quirk for HP Spectre x360 15-eb0xxx Date: Mon, 15 Aug 2022 19:54:15 +0200 Message-Id: <20220815180337.675698978@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ivan Hasenkampf commit 24df5428ef9d1ca1edd54eca7eb667110f2dfae3 upstream. Fixes speaker output on HP Spectre x360 15-eb0xxx [ re-sorted in SSID order by tiwai ] Signed-off-by: Ivan Hasenkampf Cc: Link: https://lore.kernel.org/r/20220803164001.290394-1-ivan.hasenkampf@gma= il.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- sound/pci/hda/patch_realtek.c | 2 ++ 1 file changed, 2 insertions(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -8852,6 +8852,8 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GP= IO_AMP_INIT), SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED), SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO= ), + SND_PCI_QUIRK(0x103c, 0x86e7, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_H= P_SPECTRE_X360_EB1), + SND_PCI_QUIRK(0x103c, 0x86e8, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_H= P_SPECTRE_X360_EB1), SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285= _FIXUP_HP_GPIO_AMP_INIT), SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", AL= C285_FIXUP_HP_GPIO_AMP_INIT), SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO= _LED), From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 747BEC25B0E for ; Mon, 15 Aug 2022 18:13:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233033AbiHOSNj (ORCPT ); Mon, 15 Aug 2022 14:13:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232540AbiHOSNb (ORCPT ); Mon, 15 Aug 2022 14:13:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5B6D56333; Mon, 15 Aug 2022 11:13: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 ECF5261272; Mon, 15 Aug 2022 18:13:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 055E3C433D6; Mon, 15 Aug 2022 18:13:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587208; bh=o/WIXOViD9vWqopC59+UoXlSaz8ouCZte8mYCBqVsMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IPHD5O26ISpNJOU3vnkdHINKr2p9DerI7Hx8KiQHy+VoKUXt8qde6qc7QQSx22J3V 1qCms9oqWxLk5EggZBcIB7Np7VkaBrnCpLzKpU76+Sb78K3qLABXtCzDnYrxxqgblX Q0C7c6c8lhWsQYGAShHZawqAmCcbiMv0PP4FZCLg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeongik Cha , Johannes Berg Subject: [PATCH 5.15 012/779] wifi: mac80211_hwsim: fix race condition in pending packet Date: Mon, 15 Aug 2022 19:54:16 +0200 Message-Id: <20220815180337.715947353@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jeongik Cha commit 4ee186fa7e40ae06ebbfbad77e249e3746e14114 upstream. A pending packet uses a cookie as an unique key, but it can be duplicated because it didn't use atomic operators. And also, a pending packet can be null in hwsim_tx_info_frame_received_nl due to race condition with mac80211_hwsim_stop. For this, * Use an atomic type and operator for a cookie * Add a lock around the loop for pending packets Signed-off-by: Jeongik Cha Link: https://lore.kernel.org/r/20220704084354.3556326-1-jeongik@google.com Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/wireless/mac80211_hwsim.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -663,7 +663,7 @@ struct mac80211_hwsim_data { bool ps_poll_pending; struct dentry *debugfs; =20 - uintptr_t pending_cookie; + atomic64_t pending_cookie; struct sk_buff_head pending; /* packets pending */ /* * Only radios in the same group can communicate together (the @@ -1270,7 +1270,7 @@ static void mac80211_hwsim_tx_frame_nl(s int i; struct hwsim_tx_rate tx_attempts[IEEE80211_TX_MAX_RATES]; struct hwsim_tx_rate_flag tx_attempts_flags[IEEE80211_TX_MAX_RATES]; - uintptr_t cookie; + u64 cookie; =20 if (data->ps !=3D PS_DISABLED) hdr->frame_control |=3D cpu_to_le16(IEEE80211_FCTL_PM); @@ -1339,8 +1339,7 @@ static void mac80211_hwsim_tx_frame_nl(s goto nla_put_failure; =20 /* We create a cookie to identify this skb */ - data->pending_cookie++; - cookie =3D data->pending_cookie; + cookie =3D (u64)atomic64_inc_return(&data->pending_cookie); info->rate_driver_data[0] =3D (void *)cookie; if (nla_put_u64_64bit(skb, HWSIM_ATTR_COOKIE, cookie, HWSIM_ATTR_PAD)) goto nla_put_failure; @@ -3582,6 +3581,7 @@ static int hwsim_tx_info_frame_received_ const u8 *src; unsigned int hwsim_flags; int i; + unsigned long flags; bool found =3D false; =20 if (!info->attrs[HWSIM_ATTR_ADDR_TRANSMITTER] || @@ -3609,18 +3609,20 @@ static int hwsim_tx_info_frame_received_ } =20 /* look for the skb matching the cookie passed back from user */ + spin_lock_irqsave(&data2->pending.lock, flags); skb_queue_walk_safe(&data2->pending, skb, tmp) { u64 skb_cookie; =20 txi =3D IEEE80211_SKB_CB(skb); - skb_cookie =3D (u64)(uintptr_t)txi->rate_driver_data[0]; + skb_cookie =3D (u64)txi->rate_driver_data[0]; =20 if (skb_cookie =3D=3D ret_skb_cookie) { - skb_unlink(skb, &data2->pending); + __skb_unlink(skb, &data2->pending); found =3D true; break; } } + spin_unlock_irqrestore(&data2->pending.lock, flags); =20 /* not found */ if (!found) From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A50BC00140 for ; Mon, 15 Aug 2022 18:13:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232949AbiHOSNm (ORCPT ); Mon, 15 Aug 2022 14:13:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232755AbiHOSNf (ORCPT ); Mon, 15 Aug 2022 14:13:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13B0E2A252; Mon, 15 Aug 2022 11:13:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A202EB81063; Mon, 15 Aug 2022 18:13:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0560DC433C1; Mon, 15 Aug 2022 18:13:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587211; bh=QpFvSv5tEOSTMhJicikr1Svf17aM09RphEQgN5rhjmI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HpCXns2zhSMUHfhWEO1OpDjtlNc5xLzbSjL6kXdXVh1A9gN8OF0WzQpNyqGwES36X 1560SEKTkjNYDVFZcdh1lRcd23caYV8paaCxTB+CGRKbge13PXraLKxYxJ6sJaUvSl BTvtDZhp37JH1F7d8OBzZgRjl6zPI+z3Ed2apcCM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Johannes Berg , Jeongik Cha Subject: [PATCH 5.15 013/779] wifi: mac80211_hwsim: add back erroneously removed cast Date: Mon, 15 Aug 2022 19:54:17 +0200 Message-Id: <20220815180337.755768092@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johannes Berg commit 58b6259d820d63c2adf1c7541b54cce5a2ae6073 upstream. The robots report that we're now casting to a differently sized integer, which is correct, and the previous patch had erroneously removed it. Reported-by: kernel test robot Fixes: 4ee186fa7e40 ("wifi: mac80211_hwsim: fix race condition in pending p= acket") Signed-off-by: Johannes Berg Cc: Jeongik Cha Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/wireless/mac80211_hwsim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -3614,7 +3614,7 @@ static int hwsim_tx_info_frame_received_ u64 skb_cookie; =20 txi =3D IEEE80211_SKB_CB(skb); - skb_cookie =3D (u64)txi->rate_driver_data[0]; + skb_cookie =3D (u64)(uintptr_t)txi->rate_driver_data[0]; =20 if (skb_cookie =3D=3D ret_skb_cookie) { __skb_unlink(skb, &data2->pending); From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3887FC00140 for ; Mon, 15 Aug 2022 18:13:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233187AbiHOSNp (ORCPT ); Mon, 15 Aug 2022 14:13:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232924AbiHOSNg (ORCPT ); Mon, 15 Aug 2022 14:13:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 627CA2A266; Mon, 15 Aug 2022 11:13: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 E341761272; Mon, 15 Aug 2022 18:13:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E71F3C433D6; Mon, 15 Aug 2022 18:13:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587214; bh=zc1RvLcu+XQL1Q54eTXjhNuiqHnPdU74uW+In4Il6WE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TrQb+rEXXbcVzz6iPrU9AgjvwXfuizdA+7/7BmKbTP6MSeW9TUbxuOxAvhGqjOwIR wCh3AGljAtoNbzl7RaNRf3VAYFsRilo77dbma4o00e015Gq1DeTxiVoUp6lf/D1ttT L/XLTX0/fQRK5eyIyNjvBImNYXYk80d+qsFtKhZw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg , Jeongik Cha Subject: [PATCH 5.15 014/779] wifi: mac80211_hwsim: use 32-bit skb cookie Date: Mon, 15 Aug 2022 19:54:18 +0200 Message-Id: <20220815180337.798888760@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johannes Berg commit cc5250cdb43d444061412df7fae72d2b4acbdf97 upstream. We won't really have enough skbs to need a 64-bit cookie, and on 32-bit platforms storing the 64-bit cookie into the void *rate_driver_data doesn't work anyway. Switch back to using just a 32-bit cookie and uintptr_t for the type to avoid compiler warnings about all this. Fixes: 4ee186fa7e40 ("wifi: mac80211_hwsim: fix race condition in pending p= acket") Signed-off-by: Johannes Berg Cc: Jeongik Cha Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/wireless/mac80211_hwsim.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -663,7 +663,7 @@ struct mac80211_hwsim_data { bool ps_poll_pending; struct dentry *debugfs; =20 - atomic64_t pending_cookie; + atomic_t pending_cookie; struct sk_buff_head pending; /* packets pending */ /* * Only radios in the same group can communicate together (the @@ -1270,7 +1270,7 @@ static void mac80211_hwsim_tx_frame_nl(s int i; struct hwsim_tx_rate tx_attempts[IEEE80211_TX_MAX_RATES]; struct hwsim_tx_rate_flag tx_attempts_flags[IEEE80211_TX_MAX_RATES]; - u64 cookie; + uintptr_t cookie; =20 if (data->ps !=3D PS_DISABLED) hdr->frame_control |=3D cpu_to_le16(IEEE80211_FCTL_PM); @@ -1339,7 +1339,7 @@ static void mac80211_hwsim_tx_frame_nl(s goto nla_put_failure; =20 /* We create a cookie to identify this skb */ - cookie =3D (u64)atomic64_inc_return(&data->pending_cookie); + cookie =3D atomic_inc_return(&data->pending_cookie); info->rate_driver_data[0] =3D (void *)cookie; if (nla_put_u64_64bit(skb, HWSIM_ATTR_COOKIE, cookie, HWSIM_ATTR_PAD)) goto nla_put_failure; @@ -3611,10 +3611,10 @@ static int hwsim_tx_info_frame_received_ /* look for the skb matching the cookie passed back from user */ spin_lock_irqsave(&data2->pending.lock, flags); skb_queue_walk_safe(&data2->pending, skb, tmp) { - u64 skb_cookie; + uintptr_t skb_cookie; =20 txi =3D IEEE80211_SKB_CB(skb); - skb_cookie =3D (u64)(uintptr_t)txi->rate_driver_data[0]; + skb_cookie =3D (uintptr_t)txi->rate_driver_data[0]; =20 if (skb_cookie =3D=3D ret_skb_cookie) { __skb_unlink(skb, &data2->pending); From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27FE6C00140 for ; Mon, 15 Aug 2022 18:13:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233174AbiHOSNy (ORCPT ); Mon, 15 Aug 2022 14:13:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232991AbiHOSNi (ORCPT ); Mon, 15 Aug 2022 14:13:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 304BE2A268; Mon, 15 Aug 2022 11:13: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 B459B6126D; Mon, 15 Aug 2022 18:13:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA3C6C433C1; Mon, 15 Aug 2022 18:13:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587217; bh=qpyjHBlNmvh5qz8ZjsmPzt6EGeEiWMCvxwoRJDS94vo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tASzAc58/2rfWQMC7gX3klfikvuUygZwc8pYPI5jfu4Q4CA/Q6sbdETNGfGPNFFZp VLpDEkjFsq6YDmO1VWIDvHtE2ylB6OR+pzLKKqm/4ZDCop4+NWEa7heURxhDYYRXgN Up09P9v/Cu84uTwAzcLNWHThYuqJKxyd5T2FJy1o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , "Matthew Wilcox (Oracle)" , Linus Torvalds Subject: [PATCH 5.15 015/779] add barriers to buffer_uptodate and set_buffer_uptodate Date: Mon, 15 Aug 2022 19:54:19 +0200 Message-Id: <20220815180337.838203273@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 d4252071b97d2027d246f6a82cbee4d52f618b47 upstream. Let's have a look at this piece of code in __bread_slow: get_bh(bh); bh->b_end_io =3D end_buffer_read_sync; submit_bh(REQ_OP_READ, 0, bh); wait_on_buffer(bh); if (buffer_uptodate(bh)) return bh; Neither wait_on_buffer nor buffer_uptodate contain any memory barrier. Consequently, if someone calls sb_bread and then reads the buffer data, the read of buffer data may be executed before wait_on_buffer(bh) on architectures with weak memory ordering and it may return invalid data. Fix this bug by adding a memory barrier to set_buffer_uptodate and an acquire barrier to buffer_uptodate (in a similar way as folio_test_uptodate and folio_mark_uptodate). Signed-off-by: Mikulas Patocka Reviewed-by: Matthew Wilcox (Oracle) Cc: stable@vger.kernel.org Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- include/linux/buffer_head.h | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -117,7 +117,6 @@ static __always_inline int test_clear_bu * of the form "mark_buffer_foo()". These are higher-level functions which * do something in addition to setting a b_state bit. */ -BUFFER_FNS(Uptodate, uptodate) BUFFER_FNS(Dirty, dirty) TAS_BUFFER_FNS(Dirty, dirty) BUFFER_FNS(Lock, locked) @@ -135,6 +134,30 @@ BUFFER_FNS(Meta, meta) BUFFER_FNS(Prio, prio) BUFFER_FNS(Defer_Completion, defer_completion) =20 +static __always_inline void set_buffer_uptodate(struct buffer_head *bh) +{ + /* + * make it consistent with folio_mark_uptodate + * pairs with smp_load_acquire in buffer_uptodate + */ + smp_mb__before_atomic(); + set_bit(BH_Uptodate, &bh->b_state); +} + +static __always_inline void clear_buffer_uptodate(struct buffer_head *bh) +{ + clear_bit(BH_Uptodate, &bh->b_state); +} + +static __always_inline int buffer_uptodate(const struct buffer_head *bh) +{ + /* + * make it consistent with folio_test_uptodate + * pairs with smp_mb__before_atomic in set_buffer_uptodate + */ + return (smp_load_acquire(&bh->b_state) & (1UL << BH_Uptodate)) !=3D 0; +} + #define bh_offset(bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK) =20 /* If we *know* page->private refers to buffer_heads */ From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87D75C00140 for ; Mon, 15 Aug 2022 18:14:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233492AbiHOSOE (ORCPT ); Mon, 15 Aug 2022 14:14:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233272AbiHOSNw (ORCPT ); Mon, 15 Aug 2022 14:13:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87DAC2A41B; Mon, 15 Aug 2022 11:13: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 806E7B80F99; Mon, 15 Aug 2022 18:13:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E500EC433D7; Mon, 15 Aug 2022 18:13:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587220; bh=c6GDu3Ar2i8zQtQGfiJEPIXMrVpY6NchdRhIyLfZxAE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p6/QQffIJTFrnRAWCpYbre+TEWYo3gBZV+jeskC2wt6k9MPHmzmZi2ePaF9OToQT6 pEVhEPu6iH0iWUg4gE0KT/8wrwMAFUJ3Tba33n3o23nyKl4DueKI3/Pw/k0gTxVwGx N0NSmFYOgFOdNnPMLcqOaWAwOk/uI/JNRoiqXm0w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Kasiak , Jeff Layton , Chuck Lever Subject: [PATCH 5.15 016/779] lockd: detect and reject lock arguments that overflow Date: Mon, 15 Aug 2022 19:54:20 +0200 Message-Id: <20220815180337.886410440@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jeff Layton commit 6930bcbfb6ceda63e298c6af6d733ecdf6bd4cde upstream. lockd doesn't currently vet the start and length in nlm4 requests like it should, and can end up generating lock requests with arguments that overflow when passed to the filesystem. The NLM4 protocol uses unsigned 64-bit arguments for both start and length, whereas struct file_lock tracks the start and end as loff_t values. By the time we get around to calling nlm4svc_retrieve_args, we've lost the information that would allow us to determine if there was an overflow. Start tracking the actual start and len for NLM4 requests in the nlm_lock. In nlm4svc_retrieve_args, vet these values to ensure they won't cause an overflow, and return NLM4_FBIG if they do. Link: https://bugzilla.linux-nfs.org/show_bug.cgi?id=3D392 Reported-by: Jan Kasiak Signed-off-by: Jeff Layton Signed-off-by: Chuck Lever Cc: # 5.14+ Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/lockd/svc4proc.c | 8 ++++++++ fs/lockd/xdr4.c | 19 ++----------------- include/linux/lockd/xdr.h | 2 ++ 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c index 4f247ab8be61..bf274f23969b 100644 --- a/fs/lockd/svc4proc.c +++ b/fs/lockd/svc4proc.c @@ -32,6 +32,10 @@ nlm4svc_retrieve_args(struct svc_rqst *rqstp, struct nlm= _args *argp, if (!nlmsvc_ops) return nlm_lck_denied_nolocks; =20 + if (lock->lock_start > OFFSET_MAX || + (lock->lock_len && ((lock->lock_len - 1) > (OFFSET_MAX - lock->lock_s= tart)))) + return nlm4_fbig; + /* Obtain host handle */ if (!(host =3D nlmsvc_lookup_host(rqstp, lock->caller, lock->len)) || (argp->monitor && nsm_monitor(host) < 0)) @@ -50,6 +54,10 @@ nlm4svc_retrieve_args(struct svc_rqst *rqstp, struct nlm= _args *argp, /* Set up the missing parts of the file_lock structure */ lock->fl.fl_file =3D file->f_file[mode]; lock->fl.fl_pid =3D current->tgid; + lock->fl.fl_start =3D (loff_t)lock->lock_start; + lock->fl.fl_end =3D lock->lock_len ? + (loff_t)(lock->lock_start + lock->lock_len - 1) : + OFFSET_MAX; lock->fl.fl_lmops =3D &nlmsvc_lock_operations; nlmsvc_locks_init_private(&lock->fl, host, (pid_t)lock->svid); if (!lock->fl.fl_owner) { diff --git a/fs/lockd/xdr4.c b/fs/lockd/xdr4.c index 856267c0864b..712fdfeb8ef0 100644 --- a/fs/lockd/xdr4.c +++ b/fs/lockd/xdr4.c @@ -20,13 +20,6 @@ =20 #include "svcxdr.h" =20 -static inline loff_t -s64_to_loff_t(__s64 offset) -{ - return (loff_t)offset; -} - - static inline s64 loff_t_to_s64(loff_t offset) { @@ -70,8 +63,6 @@ static bool svcxdr_decode_lock(struct xdr_stream *xdr, struct nlm_lock *lock) { struct file_lock *fl =3D &lock->fl; - u64 len, start; - s64 end; =20 if (!svcxdr_decode_string(xdr, &lock->caller, &lock->len)) return false; @@ -81,20 +72,14 @@ svcxdr_decode_lock(struct xdr_stream *xdr, struct nlm_l= ock *lock) return false; if (xdr_stream_decode_u32(xdr, &lock->svid) < 0) return false; - if (xdr_stream_decode_u64(xdr, &start) < 0) + if (xdr_stream_decode_u64(xdr, &lock->lock_start) < 0) return false; - if (xdr_stream_decode_u64(xdr, &len) < 0) + if (xdr_stream_decode_u64(xdr, &lock->lock_len) < 0) return false; =20 locks_init_lock(fl); fl->fl_flags =3D FL_POSIX; fl->fl_type =3D F_RDLCK; - end =3D start + len - 1; - fl->fl_start =3D s64_to_loff_t(start); - if (len =3D=3D 0 || end < 0) - fl->fl_end =3D OFFSET_MAX; - else - fl->fl_end =3D s64_to_loff_t(end); =20 return true; } diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h index 398f70093cd3..67e4a2c5500b 100644 --- a/include/linux/lockd/xdr.h +++ b/include/linux/lockd/xdr.h @@ -41,6 +41,8 @@ struct nlm_lock { struct nfs_fh fh; struct xdr_netobj oh; u32 svid; + u64 lock_start; + u64 lock_len; struct file_lock fl; }; =20 --=20 2.37.1 From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F956C00140 for ; Mon, 15 Aug 2022 18:19:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238925AbiHOST3 (ORCPT ); Mon, 15 Aug 2022 14:19:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233444AbiHOSSY (ORCPT ); Mon, 15 Aug 2022 14:18:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9D642B252; Mon, 15 Aug 2022 11:15: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 87F496129E; Mon, 15 Aug 2022 18:15:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FD4DC433D6; Mon, 15 Aug 2022 18:15:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587357; bh=neXb9KTr9GRL9Tu9sQdl0k7yuZVxlsmpLVStMiQm83g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y0vd2kyIdgqTdKTyO01wPA2cThlg6vl3WVUJvbyJuLcBfyVajOzPTBLU4/+Tjts4d yDNoRhsFfeLJg5T+yIk2wjpqUyljkscILfD697hJJwyXo5a+Wwt03ljAkpc4SJ4spE vTQ5/gkYZQGlEEWgPKQCNJGxiFuFMH9WLLK5YlLI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maximilian Luz , Jiri Kosina Subject: [PATCH 5.15 017/779] HID: hid-input: add Surface Go battery quirk Date: Mon, 15 Aug 2022 19:54:21 +0200 Message-Id: <20220815180337.929205479@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maximilian Luz commit db925d809011c37b246434fdce71209fc2e6c0c2 upstream. Similar to the Surface Go (1), the (Elantech) touchscreen/digitizer in the Surface Go 2 mistakenly reports the battery of the stylus. Instead of over the touchscreen device, battery information is provided via bluetooth and the touchscreen device reports an empty battery. Apply the HID_BATTERY_QUIRK_IGNORE quirk to ignore this battery and prevent the erroneous low battery warnings. Cc: stable@vger.kernel.org Signed-off-by: Maximilian Luz Signed-off-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-input.c | 2 ++ 2 files changed, 3 insertions(+) --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -398,6 +398,7 @@ #define USB_DEVICE_ID_ASUS_UX550VE_TOUCHSCREEN 0x2544 #define USB_DEVICE_ID_ASUS_UX550_TOUCHSCREEN 0x2706 #define I2C_DEVICE_ID_SURFACE_GO_TOUCHSCREEN 0x261A +#define I2C_DEVICE_ID_SURFACE_GO2_TOUCHSCREEN 0x2A1C =20 #define USB_VENDOR_ID_ELECOM 0x056e #define USB_DEVICE_ID_ELECOM_BM084 0x0061 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c @@ -333,6 +333,8 @@ static const struct hid_device_id hid_ba HID_BATTERY_QUIRK_IGNORE }, { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_SURFACE_GO_TOUCHSCREEN= ), HID_BATTERY_QUIRK_IGNORE }, + { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_SURFACE_GO2_TOUCHSCREE= N), + HID_BATTERY_QUIRK_IGNORE }, {} }; From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76CEFC00140 for ; Mon, 15 Aug 2022 18:16:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237907AbiHOSPb (ORCPT ); Mon, 15 Aug 2022 14:15:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233564AbiHOSOx (ORCPT ); Mon, 15 Aug 2022 14:14:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F17962AC68; Mon, 15 Aug 2022 11:14: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 87D0CB81074; Mon, 15 Aug 2022 18:14:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFB2BC433D6; Mon, 15 Aug 2022 18:14:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587252; bh=llpMxHGJXWP5cf7sbBkd+Qs7oAxQTdYK6TfLN8Q4UGc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y0tZAEUnSCkBrSGyVFJz5KsGds3kox0Ge+U/BY+o/EJHpy7fSQdct8oWbO1xjL/O9 67oKGyD7O8nFnByASVT8pqnzsJScpESIIQnlChpuz6EN9TXE5Sf7vDuJhCnnOFD2uW i+Vs4QjJKHV2D4+ufLrlW9QgN+uubsqr2iI5YVxg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ping Cheng , Jason Gerecke , Jiri Kosina Subject: [PATCH 5.15 018/779] HID: wacom: Only report rotation for art pen Date: Mon, 15 Aug 2022 19:54:22 +0200 Message-Id: <20220815180337.971403646@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Cheng commit 7ccced33a0ba39b0103ae1dfbf7f1dffdc0a1bc2 upstream. The generic routine, wacom_wac_pen_event, turns rotation value 90 degree anti-clockwise before posting the events. This non-zero event trggers a non-zero ABS_Z event for non art pen tools. However, HID_DG_TWIST is only supported by art pen. [jkosina@suse.cz: fix build: add missing brace] Cc: stable@vger.kernel.org Signed-off-by: Ping Cheng Reviewed-by: Jason Gerecke Signed-off-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/hid/wacom_wac.c | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -638,9 +638,26 @@ static int wacom_intuos_id_mangle(int to return (tool_id & ~0xFFF) << 4 | (tool_id & 0xFFF); } =20 +static bool wacom_is_art_pen(int tool_id) +{ + bool is_art_pen =3D false; + + switch (tool_id) { + case 0x885: /* Intuos3 Marker Pen */ + case 0x804: /* Intuos4/5 13HD/24HD Marker Pen */ + case 0x10804: /* Intuos4/5 13HD/24HD Art Pen */ + is_art_pen =3D true; + break; + } + return is_art_pen; +} + static int wacom_intuos_get_tool_type(int tool_id) { - int tool_type; + int tool_type =3D BTN_TOOL_PEN; + + if (wacom_is_art_pen(tool_id)) + return tool_type; =20 switch (tool_id) { case 0x812: /* Inking pen */ @@ -655,12 +672,9 @@ static int wacom_intuos_get_tool_type(in case 0x852: case 0x823: /* Intuos3 Grip Pen */ case 0x813: /* Intuos3 Classic Pen */ - case 0x885: /* Intuos3 Marker Pen */ case 0x802: /* Intuos4/5 13HD/24HD General Pen */ - case 0x804: /* Intuos4/5 13HD/24HD Marker Pen */ case 0x8e2: /* IntuosHT2 pen */ case 0x022: - case 0x10804: /* Intuos4/5 13HD/24HD Art Pen */ case 0x10842: /* MobileStudio Pro Pro Pen slim */ case 0x14802: /* Intuos4/5 13HD/24HD Classic Pen */ case 0x16802: /* Cintiq 13HD Pro Pen */ @@ -718,10 +732,6 @@ static int wacom_intuos_get_tool_type(in case 0x10902: /* Intuos4/5 13HD/24HD Airbrush */ tool_type =3D BTN_TOOL_AIRBRUSH; break; - - default: /* Unknown tool */ - tool_type =3D BTN_TOOL_PEN; - break; } return tool_type; } @@ -2323,6 +2333,9 @@ static void wacom_wac_pen_event(struct h } return; case HID_DG_TWIST: + /* don't modify the value if the pen doesn't support the feature */ + if (!wacom_is_art_pen(wacom_wac->id[0])) return; + /* * Userspace expects pen twist to have its zero point when * the buttons/finger is on the tablet's left. HID values From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53D6EC00140 for ; Mon, 15 Aug 2022 18:17:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233412AbiHOSRC (ORCPT ); Mon, 15 Aug 2022 14:17:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232119AbiHOSQI (ORCPT ); Mon, 15 Aug 2022 14:16:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 689BA2AE17; Mon, 15 Aug 2022 11:14: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 E09DE61255; Mon, 15 Aug 2022 18:14:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D33B0C433D7; Mon, 15 Aug 2022 18:14:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587285; bh=W5Ql+ZrwKUzjMRrQdWuGO+zGCPPjlFD1gX3qSuxMdK8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nbg+UbkUPhRC3b8rAHmmETjLwgqiEu5AC6Il1LA7+NV2LPspLmFWSADI7X23zKei3 9/ROyVETys46UgCqcRJd6Tn9rdNrORpOm0Kx41ecXx8bmFbcKlhgydmaBs3OobD7q3 jAdRnmmVaJYZC7Yy2KlOMiRXKJqxRMwsjYz8/gkI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ping Cheng , Jason Gerecke , Jiri Kosina Subject: [PATCH 5.15 019/779] HID: wacom: Dont register pad_input for touch switch Date: Mon, 15 Aug 2022 19:54:23 +0200 Message-Id: <20220815180338.016995948@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Cheng commit d6b675687a4ab4dba684716d97c8c6f81bf10905 upstream. Touch switch state is received through WACOM_PAD_FIELD. However, it is reported by touch_input. Don't register pad_input if no other pad events require the interface. Cc: stable@vger.kernel.org Signed-off-by: Ping Cheng Reviewed-by: Jason Gerecke Signed-off-by: Jiri Kosina Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/hid/wacom_sys.c | 2 +- drivers/hid/wacom_wac.c | 43 +++++++++++++++++++++++++------------------ 2 files changed, 26 insertions(+), 19 deletions(-) --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -2124,7 +2124,7 @@ static int wacom_register_inputs(struct =20 error =3D wacom_setup_pad_input_capabilities(pad_input_dev, wacom_wac); if (error) { - /* no pad in use on this interface */ + /* no pad events using this interface */ input_free_device(pad_input_dev); wacom_wac->pad_input =3D NULL; pad_input_dev =3D NULL; --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -2017,7 +2017,6 @@ static void wacom_wac_pad_usage_mapping( wacom_wac->has_mute_touch_switch =3D true; usage->type =3D EV_SW; usage->code =3D SW_MUTE_DEVICE; - features->device_type |=3D WACOM_DEVICETYPE_PAD; break; case WACOM_HID_WD_TOUCHSTRIP: wacom_map_usage(input, usage, field, EV_ABS, ABS_RX, 0); @@ -2097,6 +2096,30 @@ static void wacom_wac_pad_event(struct h wacom_wac->hid_data.inrange_state |=3D value; } =20 + /* Process touch switch state first since it is reported through touch in= terface, + * which is indepentent of pad interface. In the case when there are no o= ther pad + * events, the pad interface will not even be created. + */ + if ((equivalent_usage =3D=3D WACOM_HID_WD_MUTE_DEVICE) || + (equivalent_usage =3D=3D WACOM_HID_WD_TOUCHONOFF)) { + if (wacom_wac->shared->touch_input) { + bool *is_touch_on =3D &wacom_wac->shared->is_touch_on; + + if (equivalent_usage =3D=3D WACOM_HID_WD_MUTE_DEVICE && value) + *is_touch_on =3D !(*is_touch_on); + else if (equivalent_usage =3D=3D WACOM_HID_WD_TOUCHONOFF) + *is_touch_on =3D value; + + input_report_switch(wacom_wac->shared->touch_input, + SW_MUTE_DEVICE, !(*is_touch_on)); + input_sync(wacom_wac->shared->touch_input); + } + return; + } + + if (!input) + return; + switch (equivalent_usage) { case WACOM_HID_WD_TOUCHRING: /* @@ -2132,22 +2155,6 @@ static void wacom_wac_pad_event(struct h input_event(input, usage->type, usage->code, 0); break; =20 - case WACOM_HID_WD_MUTE_DEVICE: - case WACOM_HID_WD_TOUCHONOFF: - if (wacom_wac->shared->touch_input) { - bool *is_touch_on =3D &wacom_wac->shared->is_touch_on; - - if (equivalent_usage =3D=3D WACOM_HID_WD_MUTE_DEVICE && value) - *is_touch_on =3D !(*is_touch_on); - else if (equivalent_usage =3D=3D WACOM_HID_WD_TOUCHONOFF) - *is_touch_on =3D value; - - input_report_switch(wacom_wac->shared->touch_input, - SW_MUTE_DEVICE, !(*is_touch_on)); - input_sync(wacom_wac->shared->touch_input); - } - break; - case WACOM_HID_WD_MODE_CHANGE: if (wacom_wac->is_direct_mode !=3D value) { wacom_wac->is_direct_mode =3D value; @@ -2808,7 +2815,7 @@ void wacom_wac_event(struct hid_device * /* usage tests must precede field tests */ if (WACOM_BATTERY_USAGE(usage)) wacom_wac_battery_event(hdev, field, usage, value); - else if (WACOM_PAD_FIELD(field) && wacom->wacom_wac.pad_input) + else if (WACOM_PAD_FIELD(field)) wacom_wac_pad_event(hdev, field, usage, value); else if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input) wacom_wac_pen_event(hdev, field, usage, value); From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 354ACC00140 for ; Mon, 15 Aug 2022 18:18:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239052AbiHOSS2 (ORCPT ); Mon, 15 Aug 2022 14:18:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233440AbiHOSRz (ORCPT ); Mon, 15 Aug 2022 14:17:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EA8963D2; Mon, 15 Aug 2022 11:15: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 A45B36126D; Mon, 15 Aug 2022 18:15:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC0BCC43470; Mon, 15 Aug 2022 18:15:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587321; bh=C79IPGE5RKdYaI2Cy2l1oWgppbgDJepX/3dxzUK2F18=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=duwiUXdg8yhSgHjWfaE4eX+hyvR9saVBbin0G+J0ghvdA81upKRDlWguS43wwvGwC XvFCkpzs9tPIeymwAdWnOtiR0GMo9SkoriCkwL8+YUQdDgHPpde/3CiAqggMd7nOdU qwfpy9WwRpe+5ozrCbzYtE7YW2I0QE/E56TE5Fr8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lei Wang , Sean Christopherson , Paolo Bonzini Subject: [PATCH 5.15 020/779] KVM: nVMX: Snapshot pre-VM-Enter BNDCFGS for !nested_run_pending case Date: Mon, 15 Aug 2022 19:54:24 +0200 Message-Id: <20220815180338.063381104@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson commit fa578398a0ba2c079fa1170da21fa5baae0cedb2 upstream. If a nested run isn't pending, snapshot vmcs01.GUEST_BNDCFGS irrespective of whether or not VM_ENTRY_LOAD_BNDCFGS is set in vmcs12. When restoring nested state, e.g. after migration, without a nested run pending, prepare_vmcs02() will propagate nested.vmcs01_guest_bndcfgs to vmcs02, i.e. will load garbage/zeros into vmcs02.GUEST_BNDCFGS. If userspace restores nested state before MSRs, then loading garbage is a non-issue as loading BNDCFGS will also update vmcs02. But if usersepace restores MSRs first, then KVM is responsible for propagating L2's value, which is actually thrown into vmcs01, into vmcs02. Restoring L2 MSRs into vmcs01, i.e. loading all MSRs before nested state is all kinds of bizarre and ideally would not be supported. Sadly, some VMMs do exactly that and rely on KVM to make things work. Note, there's still a lurking SMM bug, as propagating vmcs01.GUEST_BNDFGS to vmcs02 across RSM may corrupt L2's BNDCFGS. But KVM's entire VMX+SMM emulation is flawed as SMI+RSM should not toouch _any_ VMCS when use the "default treatment of SMIs", i.e. when not using an SMI Transfer Monitor. Link: https://lore.kernel.org/all/Yobt1XwOfb5M6Dfa@google.com Fixes: 62cf9bd8118c ("KVM: nVMX: Fix emulation of VM_ENTRY_LOAD_BNDCFGS") Cc: stable@vger.kernel.org Cc: Lei Wang Signed-off-by: Sean Christopherson Message-Id: <20220614215831.3762138-2-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/x86/kvm/vmx/nested.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -3367,7 +3367,8 @@ enum nvmx_vmentry_status nested_vmx_ente if (!(vmcs12->vm_entry_controls & VM_ENTRY_LOAD_DEBUG_CONTROLS)) vmx->nested.vmcs01_debugctl =3D vmcs_read64(GUEST_IA32_DEBUGCTL); if (kvm_mpx_supported() && - !(vmcs12->vm_entry_controls & VM_ENTRY_LOAD_BNDCFGS)) + (!vmx->nested.nested_run_pending || + !(vmcs12->vm_entry_controls & VM_ENTRY_LOAD_BNDCFGS))) vmx->nested.vmcs01_guest_bndcfgs =3D vmcs_read64(GUEST_BNDCFGS); =20 /* From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD8BEC00140 for ; Mon, 15 Aug 2022 18:19:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239946AbiHOSTI (ORCPT ); Mon, 15 Aug 2022 14:19:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239939AbiHOSSP (ORCPT ); Mon, 15 Aug 2022 14:18:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CE932AE00; Mon, 15 Aug 2022 11:15: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 D5A7061255; Mon, 15 Aug 2022 18:15:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D98FCC433B5; Mon, 15 Aug 2022 18:15:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587339; bh=64GOvRkBrhUR5wvwysffJ90hpRPPEctL1mlsIzaZvE0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F4fFIRaaQoK4k2lGfc1jeHO8jAjAEaVbatKgNE6VYRMmuHBYlqVDkTqrp4FagkXuy Ch3gadgF96h5uxdtF45yuSOP8G7Id5PmiGwfPcEBoAhGuxL79PYRpbjQj3BA8j/Dkc NFJCXdXQe39mA1Uyx+UxXWalvobLPVLVOjRl6seg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini Subject: [PATCH 5.15 021/779] KVM: nVMX: Snapshot pre-VM-Enter DEBUGCTL for !nested_run_pending case Date: Mon, 15 Aug 2022 19:54:25 +0200 Message-Id: <20220815180338.114870928@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson commit 764643a6be07445308e492a528197044c801b3ba upstream. If a nested run isn't pending, snapshot vmcs01.GUEST_IA32_DEBUGCTL irrespective of whether or not VM_ENTRY_LOAD_DEBUG_CONTROLS is set in vmcs12. When restoring nested state, e.g. after migration, without a nested run pending, prepare_vmcs02() will propagate nested.vmcs01_debugctl to vmcs02, i.e. will load garbage/zeros into vmcs02.GUEST_IA32_DEBUGCTL. If userspace restores nested state before MSRs, then loading garbage is a non-issue as loading DEBUGCTL will also update vmcs02. But if usersepace restores MSRs first, then KVM is responsible for propagating L2's value, which is actually thrown into vmcs01, into vmcs02. Restoring L2 MSRs into vmcs01, i.e. loading all MSRs before nested state is all kinds of bizarre and ideally would not be supported. Sadly, some VMMs do exactly that and rely on KVM to make things work. Note, there's still a lurking SMM bug, as propagating vmcs01's DEBUGCTL to vmcs02 across RSM may corrupt L2's DEBUGCTL. But KVM's entire VMX+SMM emulation is flawed as SMI+RSM should not toouch _any_ VMCS when use the "default treatment of SMIs", i.e. when not using an SMI Transfer Monitor. Link: https://lore.kernel.org/all/Yobt1XwOfb5M6Dfa@google.com Fixes: 8fcc4b5923af ("kvm: nVMX: Introduce KVM_CAP_NESTED_STATE") Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson Message-Id: <20220614215831.3762138-3-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/x86/kvm/vmx/nested.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -3364,7 +3364,8 @@ enum nvmx_vmentry_status nested_vmx_ente if (likely(!evaluate_pending_interrupts) && kvm_vcpu_apicv_active(vcpu)) evaluate_pending_interrupts |=3D vmx_has_apicv_interrupt(vcpu); =20 - if (!(vmcs12->vm_entry_controls & VM_ENTRY_LOAD_DEBUG_CONTROLS)) + if (!vmx->nested.nested_run_pending || + !(vmcs12->vm_entry_controls & VM_ENTRY_LOAD_DEBUG_CONTROLS)) vmx->nested.vmcs01_debugctl =3D vmcs_read64(GUEST_IA32_DEBUGCTL); if (kvm_mpx_supported() && (!vmx->nested.nested_run_pending || From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA847C00140 for ; Mon, 15 Aug 2022 18:19:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240121AbiHOSTD (ORCPT ); Mon, 15 Aug 2022 14:19:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239940AbiHOSSP (ORCPT ); Mon, 15 Aug 2022 14:18:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3541F2B25B; Mon, 15 Aug 2022 11:15: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 B628A61283; Mon, 15 Aug 2022 18:15:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B234DC433D6; Mon, 15 Aug 2022 18:15:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587342; bh=L+tSva97cuH3Es/g7gFSul9AZ9NvOTMJ95gyvkU2tow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zM8sSxfkGdY+HGXCkrNu09gh36gtHuacJOCqkY3Bnlr1pww/wpw7bWDsMdmQblDyr oAICU90wHtZyd5i7I/63QBK8+gUcshgpBmHZ++iWMdUPRNYbOJFY1kkgIWjWguw4jD fZI2q3kxGx3UpbiGyBe04oyFBDMebr6fqMQdX6D8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , "Maciej S. Szmigiero" , Paolo Bonzini Subject: [PATCH 5.15 022/779] KVM: SVM: Dont BUG if userspace injects an interrupt with GIF=0 Date: Mon, 15 Aug 2022 19:54:26 +0200 Message-Id: <20220815180338.163587480@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maciej S. Szmigiero commit f17c31c48e5cde9895a491d91c424eeeada3e134 upstream. Don't BUG/WARN on interrupt injection due to GIF being cleared, since it's trivial for userspace to force the situation via KVM_SET_VCPU_EVENTS (even if having at least a WARN there would be correct for KVM internally generated injections). kernel BUG at arch/x86/kvm/svm/svm.c:3386! invalid opcode: 0000 [#1] SMP CPU: 15 PID: 926 Comm: smm_test Not tainted 5.17.0-rc3+ #264 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015 RIP: 0010:svm_inject_irq+0xab/0xb0 [kvm_amd] Code: <0f> 0b 0f 1f 00 0f 1f 44 00 00 80 3d ac b3 01 00 00 55 48 89 f5 53 RSP: 0018:ffffc90000b37d88 EFLAGS: 00010246 RAX: 0000000000000000 RBX: ffff88810a234ac0 RCX: 0000000000000006 RDX: 0000000000000000 RSI: ffffc90000b37df7 RDI: ffff88810a234ac0 RBP: ffffc90000b37df7 R08: ffff88810a1fa410 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: ffff888109571000 R14: ffff88810a234ac0 R15: 0000000000000000 FS: 0000000001821380(0000) GS:ffff88846fdc0000(0000) knlGS:0000000000000= 000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f74fc550008 CR3: 000000010a6fe000 CR4: 0000000000350ea0 Call Trace: inject_pending_event+0x2f7/0x4c0 [kvm] kvm_arch_vcpu_ioctl_run+0x791/0x17a0 [kvm] kvm_vcpu_ioctl+0x26d/0x650 [kvm] __x64_sys_ioctl+0x82/0xb0 do_syscall_64+0x3b/0xc0 entry_SYSCALL_64_after_hwframe+0x44/0xae Fixes: 219b65dcf6c0 ("KVM: SVM: Improve nested interrupt injection") Cc: stable@vger.kernel.org Co-developed-by: Sean Christopherson Signed-off-by: Sean Christopherson Signed-off-by: Maciej S. Szmigiero Message-Id: <35426af6e123cbe91ec7ce5132ce72521f02b1b5.1651440202.git.maciej= .szmigiero@oracle.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/x86/kvm/svm/svm.c | 2 -- 1 file changed, 2 deletions(-) --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -3417,8 +3417,6 @@ static void svm_set_irq(struct kvm_vcpu { struct vcpu_svm *svm =3D to_svm(vcpu); =20 - BUG_ON(!(gif_set(svm))); - trace_kvm_inj_virq(vcpu->arch.interrupt.nr); ++vcpu->stat.irq_injections; From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 396A7C00140 for ; Mon, 15 Aug 2022 18:19:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240236AbiHOSTV (ORCPT ); Mon, 15 Aug 2022 14:19:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239594AbiHOSST (ORCPT ); Mon, 15 Aug 2022 14:18: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 B3F822B276; Mon, 15 Aug 2022 11:15: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 6C635B8106E; Mon, 15 Aug 2022 18:15:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5484C433C1; Mon, 15 Aug 2022 18:15:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587345; bh=j5aW/JTwd9qXhbplIdOJKXwEwpf/ethjKxhspY1HJRY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=phyHy5e5v/M2qIJu64zcm0kwh++kslmsi/szd14EPDSyKEnLtPjBjwww0P3R1YAo+ 1JzRyloGckKiakjWYpolAMhpRvdBocQHRrn4Z3/t7nG2txG+Npm8euEgzTAPDQVFkH q3QkE5lilbQeQ3UlMncYk3eDeCi9Cnd+++SEfFso= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nico Boehr , Claudio Imbrenda , Janosch Frank , Christian Borntraeger Subject: [PATCH 5.15 023/779] KVM: s390: pv: dont present the ecall interrupt twice Date: Mon, 15 Aug 2022 19:54:27 +0200 Message-Id: <20220815180338.213784078@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nico Boehr commit c3f0e5fd2d33d80c5a5a8b5e5d2bab2841709cc8 upstream. When the SIGP interpretation facility is present and a VCPU sends an ecall to another VCPU in enabled wait, the sending VCPU receives a 56 intercept (partial execution), so KVM can wake up the receiving CPU. Note that the SIGP interpretation facility will take care of the interrupt delivery and KVM's only job is to wake the receiving VCPU. For PV, the sending VCPU will receive a 108 intercept (pv notify) and should continue like in the non-PV case, i.e. wake the receiving VCPU. For PV and non-PV guests the interrupt delivery will occur through the SIGP interpretation facility on SIE entry when SIE finds the X bit in the status field set. However, in handle_pv_notification(), there was no special handling for SIGP, which leads to interrupt injection being requested by KVM for the next SIE entry. This results in the interrupt being delivered twice: once by the SIGP interpretation facility and once by KVM through the IICTL. Add the necessary special handling in handle_pv_notification(), similar to handle_partial_execution(), which simply wakes the receiving VCPU and leave interrupt delivery to the SIGP interpretation facility. In contrast to external calls, emergency calls are not interpreted but also cause a 108 intercept, which is why we still need to call handle_instruction() for SIGP orders other than ecall. Since kvm_s390_handle_sigp_pei() is now called for all SIGP orders which cause a 108 intercept - even if they are actually handled by handle_instruction() - move the tracepoint in kvm_s390_handle_sigp_pei() to avoid possibly confusing trace messages. Signed-off-by: Nico Boehr Cc: # 5.7 Fixes: da24a0cc58ed ("KVM: s390: protvirt: Instruction emulation") Reviewed-by: Claudio Imbrenda Reviewed-by: Janosch Frank Reviewed-by: Christian Borntraeger Link: https://lore.kernel.org/r/20220718130434.73302-1-nrb@linux.ibm.com Message-Id: <20220718130434.73302-1-nrb@linux.ibm.com> Signed-off-by: Claudio Imbrenda Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/s390/kvm/intercept.c | 15 +++++++++++++++ arch/s390/kvm/sigp.c | 4 ++-- 2 files changed, 17 insertions(+), 2 deletions(-) --- a/arch/s390/kvm/intercept.c +++ b/arch/s390/kvm/intercept.c @@ -523,12 +523,27 @@ static int handle_pv_uvc(struct kvm_vcpu =20 static int handle_pv_notification(struct kvm_vcpu *vcpu) { + int ret; + if (vcpu->arch.sie_block->ipa =3D=3D 0xb210) return handle_pv_spx(vcpu); if (vcpu->arch.sie_block->ipa =3D=3D 0xb220) return handle_pv_sclp(vcpu); if (vcpu->arch.sie_block->ipa =3D=3D 0xb9a4) return handle_pv_uvc(vcpu); + if (vcpu->arch.sie_block->ipa >> 8 =3D=3D 0xae) { + /* + * Besides external call, other SIGP orders also cause a + * 108 (pv notify) intercept. In contrast to external call, + * these orders need to be emulated and hence the appropriate + * place to handle them is in handle_instruction(). + * So first try kvm_s390_handle_sigp_pei() and if that isn't + * successful, go on with handle_instruction(). + */ + ret =3D kvm_s390_handle_sigp_pei(vcpu); + if (!ret) + return ret; + } =20 return handle_instruction(vcpu); } --- a/arch/s390/kvm/sigp.c +++ b/arch/s390/kvm/sigp.c @@ -492,9 +492,9 @@ int kvm_s390_handle_sigp_pei(struct kvm_ struct kvm_vcpu *dest_vcpu; u8 order_code =3D kvm_s390_get_base_disp_rs(vcpu, NULL); =20 - trace_kvm_s390_handle_sigp_pei(vcpu, order_code, cpu_addr); - if (order_code =3D=3D SIGP_EXTERNAL_CALL) { + trace_kvm_s390_handle_sigp_pei(vcpu, order_code, cpu_addr); + dest_vcpu =3D kvm_get_vcpu_by_id(vcpu->kvm, cpu_addr); BUG_ON(dest_vcpu =3D=3D NULL); From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA67DC25B08 for ; Mon, 15 Aug 2022 18:19:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240196AbiHOSTO (ORCPT ); Mon, 15 Aug 2022 14:19:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239596AbiHOSST (ORCPT ); Mon, 15 Aug 2022 14:18:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B63622B600; Mon, 15 Aug 2022 11:15: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 6F6AFB80F99; Mon, 15 Aug 2022 18:15:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ABB4CC433D6; Mon, 15 Aug 2022 18:15:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587348; bh=JmnDMjwkWsvNqz6dp+MmN/LDD/MPsnsmOvEuvPBt5DU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dp+nX2s841eveU3CnSzPsvTvVX9aMsp7jhaCd8H8DvuviS7NIob6QCt7u9UI3T/0Q XTIHfvuwLR5sSYdhceEKaOiAXXRrUHlOlIJHXWzAT2/vl3fWF33waTceFaBmijWGNj XXbNGCTPNzBSIn97j8+2gOLFevy3f8/+DS39+KBg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini Subject: [PATCH 5.15 024/779] KVM: x86: Split kvm_is_valid_cr4() and export only the non-vendor bits Date: Mon, 15 Aug 2022 19:54:28 +0200 Message-Id: <20220815180338.250121372@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson commit c33f6f2228fe8517e38941a508e9f905f99ecba9 upstream. Split the common x86 parts of kvm_is_valid_cr4(), i.e. the reserved bits checks, into a separate helper, __kvm_is_valid_cr4(), and export only the inner helper to vendor code in order to prevent nested VMX from calling back into vmx_is_valid_cr4() via kvm_is_valid_cr4(). On SVM, this is a nop as SVM doesn't place any additional restrictions on CR4. On VMX, this is also currently a nop, but only because nested VMX is missing checks on reserved CR4 bits for nested VM-Enter. That bug will be fixed in a future patch, and could simply use kvm_is_valid_cr4() as-is, but nVMX has _another_ bug where VMXON emulation doesn't enforce VMX's restrictions on CR0/CR4. The cleanest and most intuitive way to fix the VMXON bug is to use nested_host_cr{0,4}_valid(). If the CR4 variant routes through kvm_is_valid_cr4(), using nested_host_cr4_valid() won't do the right thing for the VMXON case as vmx_is_valid_cr4() enforces VMX's restrictions if and only if the vCPU is post-VMXON. Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson Message-Id: <20220607213604.3346000-2-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/x86/kvm/svm/nested.c | 3 ++- arch/x86/kvm/vmx/vmx.c | 4 ++-- arch/x86/kvm/x86.c | 12 +++++++++--- arch/x86/kvm/x86.h | 2 +- 4 files changed, 14 insertions(+), 7 deletions(-) --- a/arch/x86/kvm/svm/nested.c +++ b/arch/x86/kvm/svm/nested.c @@ -275,7 +275,8 @@ static bool nested_vmcb_check_cr3_cr4(st return false; } =20 - if (CC(!kvm_is_valid_cr4(vcpu, save->cr4))) + /* Note, SVM doesn't have any additional restrictions on CR4. */ + if (CC(!__kvm_is_valid_cr4(vcpu, save->cr4))) return false; =20 return true; --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -3213,8 +3213,8 @@ static bool vmx_is_valid_cr4(struct kvm_ { /* * We operate under the default treatment of SMM, so VMX cannot be - * enabled under SMM. Note, whether or not VMXE is allowed at all is - * handled by kvm_is_valid_cr4(). + * enabled under SMM. Note, whether or not VMXE is allowed at all, + * i.e. is a reserved bit, is handled by common x86 code. */ if ((cr4 & X86_CR4_VMXE) && is_smm(vcpu)) return false; --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1031,7 +1031,7 @@ int kvm_emulate_xsetbv(struct kvm_vcpu * } EXPORT_SYMBOL_GPL(kvm_emulate_xsetbv); =20 -bool kvm_is_valid_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) +bool __kvm_is_valid_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) { if (cr4 & cr4_reserved_bits) return false; @@ -1039,9 +1039,15 @@ bool kvm_is_valid_cr4(struct kvm_vcpu *v if (cr4 & vcpu->arch.cr4_guest_rsvd_bits) return false; =20 - return static_call(kvm_x86_is_valid_cr4)(vcpu, cr4); + return true; +} +EXPORT_SYMBOL_GPL(__kvm_is_valid_cr4); + +static bool kvm_is_valid_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) +{ + return __kvm_is_valid_cr4(vcpu, cr4) && + static_call(kvm_x86_is_valid_cr4)(vcpu, cr4); } -EXPORT_SYMBOL_GPL(kvm_is_valid_cr4); =20 void kvm_post_set_cr4(struct kvm_vcpu *vcpu, unsigned long old_cr4, unsign= ed long cr4) { --- a/arch/x86/kvm/x86.h +++ b/arch/x86/kvm/x86.h @@ -448,7 +448,7 @@ static inline void kvm_machine_check(voi void kvm_load_guest_xsave_state(struct kvm_vcpu *vcpu); void kvm_load_host_xsave_state(struct kvm_vcpu *vcpu); int kvm_spec_ctrl_test_value(u64 value); -bool kvm_is_valid_cr4(struct kvm_vcpu *vcpu, unsigned long cr4); +bool __kvm_is_valid_cr4(struct kvm_vcpu *vcpu, unsigned long cr4); int kvm_handle_memory_failure(struct kvm_vcpu *vcpu, int r, struct x86_exception *e); int kvm_handle_invpcid(struct kvm_vcpu *vcpu, unsigned long type, gva_t gv= a); From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 619A6C25B08 for ; Mon, 15 Aug 2022 18:19:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240214AbiHOSTS (ORCPT ); Mon, 15 Aug 2022 14:19:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239842AbiHOSSU (ORCPT ); Mon, 15 Aug 2022 14:18: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 E1CD62B60F; Mon, 15 Aug 2022 11:15: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 814C261255; Mon, 15 Aug 2022 18:15:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B5DEC433D6; Mon, 15 Aug 2022 18:15:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587350; bh=fCPMds9AEPMOFnboHopcJ1hJ4Lz/wfZyAyN3YzGFGGk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qCB+JCJTDdmPlp20BKMtJYpYL/7LpxlNlqQaF6+Hty1wAdLOXi3B6Ni8BCugYC4ta nwbkjRsApapfVk7tHlERDFTiVp/WTL15T5GrFSASAJQl1/Cu3YbGzfX0E/seJ4MxPA j2WtrvHkvY5/S6eSvkUQWc3FneHT6sTVaDtlGHns= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Matlack , Sean Christopherson , Paolo Bonzini Subject: [PATCH 5.15 025/779] KVM: nVMX: Let userspace set nVMX MSR to any _host_ supported value Date: Mon, 15 Aug 2022 19:54:29 +0200 Message-Id: <20220815180338.291845072@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson commit f8ae08f9789ad59d318ea75b570caa454aceda81 upstream. Restrict the nVMX MSRs based on KVM's config, not based on the guest's current config. Using the guest's config to audit the new config prevents userspace from restoring the original config (KVM's config) if at any point in the past the guest's config was restricted in any way. Fixes: 62cc6b9dc61e ("KVM: nVMX: support restore of VMX capability MSRs") Cc: stable@vger.kernel.org Cc: David Matlack Signed-off-by: Sean Christopherson Message-Id: <20220607213604.3346000-6-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/x86/kvm/vmx/nested.c | 70 ++++++++++++++++++++++++-----------------= ----- 1 file changed, 37 insertions(+), 33 deletions(-) --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -1217,7 +1217,7 @@ static int vmx_restore_vmx_basic(struct BIT_ULL(49) | BIT_ULL(54) | BIT_ULL(55) | /* reserved */ BIT_ULL(31) | GENMASK_ULL(47, 45) | GENMASK_ULL(63, 56); - u64 vmx_basic =3D vmx->nested.msrs.basic; + u64 vmx_basic =3D vmcs_config.nested.basic; =20 if (!is_bitwise_subset(vmx_basic, data, feature_and_reserved)) return -EINVAL; @@ -1240,36 +1240,42 @@ static int vmx_restore_vmx_basic(struct return 0; } =20 -static int -vmx_restore_control_msr(struct vcpu_vmx *vmx, u32 msr_index, u64 data) +static void vmx_get_control_msr(struct nested_vmx_msrs *msrs, u32 msr_inde= x, + u32 **low, u32 **high) { - u64 supported; - u32 *lowp, *highp; - switch (msr_index) { case MSR_IA32_VMX_TRUE_PINBASED_CTLS: - lowp =3D &vmx->nested.msrs.pinbased_ctls_low; - highp =3D &vmx->nested.msrs.pinbased_ctls_high; + *low =3D &msrs->pinbased_ctls_low; + *high =3D &msrs->pinbased_ctls_high; break; case MSR_IA32_VMX_TRUE_PROCBASED_CTLS: - lowp =3D &vmx->nested.msrs.procbased_ctls_low; - highp =3D &vmx->nested.msrs.procbased_ctls_high; + *low =3D &msrs->procbased_ctls_low; + *high =3D &msrs->procbased_ctls_high; break; case MSR_IA32_VMX_TRUE_EXIT_CTLS: - lowp =3D &vmx->nested.msrs.exit_ctls_low; - highp =3D &vmx->nested.msrs.exit_ctls_high; + *low =3D &msrs->exit_ctls_low; + *high =3D &msrs->exit_ctls_high; break; case MSR_IA32_VMX_TRUE_ENTRY_CTLS: - lowp =3D &vmx->nested.msrs.entry_ctls_low; - highp =3D &vmx->nested.msrs.entry_ctls_high; + *low =3D &msrs->entry_ctls_low; + *high =3D &msrs->entry_ctls_high; break; case MSR_IA32_VMX_PROCBASED_CTLS2: - lowp =3D &vmx->nested.msrs.secondary_ctls_low; - highp =3D &vmx->nested.msrs.secondary_ctls_high; + *low =3D &msrs->secondary_ctls_low; + *high =3D &msrs->secondary_ctls_high; break; default: BUG(); } +} + +static int +vmx_restore_control_msr(struct vcpu_vmx *vmx, u32 msr_index, u64 data) +{ + u32 *lowp, *highp; + u64 supported; + + vmx_get_control_msr(&vmcs_config.nested, msr_index, &lowp, &highp); =20 supported =3D vmx_control_msr(*lowp, *highp); =20 @@ -1281,6 +1287,7 @@ vmx_restore_control_msr(struct vcpu_vmx if (!is_bitwise_subset(supported, data, GENMASK_ULL(63, 32))) return -EINVAL; =20 + vmx_get_control_msr(&vmx->nested.msrs, msr_index, &lowp, &highp); *lowp =3D data; *highp =3D data >> 32; return 0; @@ -1294,10 +1301,8 @@ static int vmx_restore_vmx_misc(struct v BIT_ULL(28) | BIT_ULL(29) | BIT_ULL(30) | /* reserved */ GENMASK_ULL(13, 9) | BIT_ULL(31); - u64 vmx_misc; - - vmx_misc =3D vmx_control_msr(vmx->nested.msrs.misc_low, - vmx->nested.msrs.misc_high); + u64 vmx_misc =3D vmx_control_msr(vmcs_config.nested.misc_low, + vmcs_config.nested.misc_high); =20 if (!is_bitwise_subset(vmx_misc, data, feature_and_reserved_bits)) return -EINVAL; @@ -1325,10 +1330,8 @@ static int vmx_restore_vmx_misc(struct v =20 static int vmx_restore_vmx_ept_vpid_cap(struct vcpu_vmx *vmx, u64 data) { - u64 vmx_ept_vpid_cap; - - vmx_ept_vpid_cap =3D vmx_control_msr(vmx->nested.msrs.ept_caps, - vmx->nested.msrs.vpid_caps); + u64 vmx_ept_vpid_cap =3D vmx_control_msr(vmcs_config.nested.ept_caps, + vmcs_config.nested.vpid_caps); =20 /* Every bit is either reserved or a feature bit. */ if (!is_bitwise_subset(vmx_ept_vpid_cap, data, -1ULL)) @@ -1339,20 +1342,21 @@ static int vmx_restore_vmx_ept_vpid_cap( return 0; } =20 -static int vmx_restore_fixed0_msr(struct vcpu_vmx *vmx, u32 msr_index, u64= data) +static u64 *vmx_get_fixed0_msr(struct nested_vmx_msrs *msrs, u32 msr_index) { - u64 *msr; - switch (msr_index) { case MSR_IA32_VMX_CR0_FIXED0: - msr =3D &vmx->nested.msrs.cr0_fixed0; - break; + return &msrs->cr0_fixed0; case MSR_IA32_VMX_CR4_FIXED0: - msr =3D &vmx->nested.msrs.cr4_fixed0; - break; + return &msrs->cr4_fixed0; default: BUG(); } +} + +static int vmx_restore_fixed0_msr(struct vcpu_vmx *vmx, u32 msr_index, u64= data) +{ + const u64 *msr =3D vmx_get_fixed0_msr(&vmcs_config.nested, msr_index); =20 /* * 1 bits (which indicates bits which "must-be-1" during VMX operation) @@ -1361,7 +1365,7 @@ static int vmx_restore_fixed0_msr(struct if (!is_bitwise_subset(data, *msr, -1ULL)) return -EINVAL; =20 - *msr =3D data; + *vmx_get_fixed0_msr(&vmx->nested.msrs, msr_index) =3D data; return 0; } =20 @@ -1422,7 +1426,7 @@ int vmx_set_vmx_msr(struct kvm_vcpu *vcp vmx->nested.msrs.vmcs_enum =3D data; return 0; case MSR_IA32_VMX_VMFUNC: - if (data & ~vmx->nested.msrs.vmfunc_controls) + if (data & ~vmcs_config.nested.vmfunc_controls) return -EINVAL; vmx->nested.msrs.vmfunc_controls =3D data; return 0; From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48461C00140 for ; Mon, 15 Aug 2022 18:19:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240247AbiHOST0 (ORCPT ); Mon, 15 Aug 2022 14:19:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239866AbiHOSSW (ORCPT ); Mon, 15 Aug 2022 14:18: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 2CE532B61D; Mon, 15 Aug 2022 11:15:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B79C961299; Mon, 15 Aug 2022 18:15:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4D2AC433D6; Mon, 15 Aug 2022 18:15:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587354; bh=musA/adu+OaoSS9A8oVAYwrN4pp+t9NhjPKiqJJdkMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YSOaPG8zTh7BA0RMx7ErBvDM/9F9cab9E72hKUlNxJ+8k+aLIhlW8rwGKnKkCAnce s80d0lZm8oTSb8VbPXVnVQWbST8ptPW67mo3tmto6FAltuYsE6IYKYOpIQ9l3b7yq1 pJ1QcixQv2LybZxoTCtXGh69YHAgjnHYolEuleYc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini Subject: [PATCH 5.15 026/779] KVM: nVMX: Account for KVM reserved CR4 bits in consistency checks Date: Mon, 15 Aug 2022 19:54:30 +0200 Message-Id: <20220815180338.325363963@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson commit ca58f3aa53d165afe4ab74c755bc2f6d168617ac upstream. Check that the guest (L2) and host (L1) CR4 values that would be loaded by nested VM-Enter and VM-Exit respectively are valid with respect to KVM's (L0 host) allowed CR4 bits. Failure to check KVM reserved bits would allow L1 to load an illegal CR4 (or trigger hardware VM-Fail or failed VM-Entry) by massaging guest CPUID to allow features that are not supported by KVM. Amusingly, KVM itself is an accomplice in its doom, as KVM adjusts L1's MSR_IA32_VMX_CR4_FIXED1 to allow L1 to enable bits for L2 based on L1's CPUID model. Note, although nested_{guest,host}_cr4_valid() are _currently_ used if and only if the vCPU is post-VMXON (nested.vmxon =3D=3D true), that may not be true in the future, e.g. emulating VMXON has a bug where it doesn't check the allowed/required CR0/CR4 bits. Cc: stable@vger.kernel.org Fixes: 3899152ccbf4 ("KVM: nVMX: fix checks on CR{0,4} during virtual VMX o= peration") Signed-off-by: Sean Christopherson Message-Id: <20220607213604.3346000-3-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/x86/kvm/vmx/nested.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/arch/x86/kvm/vmx/nested.h +++ b/arch/x86/kvm/vmx/nested.h @@ -280,7 +280,8 @@ static inline bool nested_cr4_valid(stru u64 fixed0 =3D to_vmx(vcpu)->nested.msrs.cr4_fixed0; u64 fixed1 =3D to_vmx(vcpu)->nested.msrs.cr4_fixed1; =20 - return fixed_bits_valid(val, fixed0, fixed1); + return fixed_bits_valid(val, fixed0, fixed1) && + __kvm_is_valid_cr4(vcpu, val); } =20 /* No difference in the restrictions on guest and host CR4 in VMX operatio= n. */ From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80D99C00140 for ; Mon, 15 Aug 2022 18:39:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238771AbiHOSPi (ORCPT ); Mon, 15 Aug 2022 14:15:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233567AbiHOSOy (ORCPT ); Mon, 15 Aug 2022 14:14:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DD012AC62; Mon, 15 Aug 2022 11:14: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 CA81361283; Mon, 15 Aug 2022 18:14:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D21E1C433D6; Mon, 15 Aug 2022 18:14:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587255; bh=irsJIKL53q/IUaB0vpdqENRJHPJd0EtL0r96d2ea8dI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IsB0q3z7nkoju83T+hSTbO1JCuRvEOJRV/Y1Pp8VnNNEuy3nqJi9suXhBZERc7Ezn sudMh2Ds6/wfmFcCyxK6YOZ5lvtdbhfXJaoYI/jfvzOzH3wTxHunJIAzjmNf7++QT6 9keH2282C6qWeruRH+yR4JtVNgo82sBGHotoRh8k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Li , Sean Christopherson , Paolo Bonzini Subject: [PATCH 5.15 027/779] KVM: nVMX: Inject #UD if VMXON is attempted with incompatible CR0/CR4 Date: Mon, 15 Aug 2022 19:54:31 +0200 Message-Id: <20220815180338.373688419@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson commit c7d855c2aff2d511fd60ee2e356134c4fb394799 upstream. Inject a #UD if L1 attempts VMXON with a CR0 or CR4 that is disallowed per the associated nested VMX MSRs' fixed0/1 settings. KVM cannot rely on hardware to perform the checks, even for the few checks that have higher priority than VM-Exit, as (a) KVM may have forced CR0/CR4 bits in hardware while running the guest, (b) there may incompatible CR0/CR4 bits that have lower priority than VM-Exit, e.g. CR0.NE, and (c) userspace may have further restricted the allowed CR0/CR4 values by manipulating the guest's nested VMX MSRs. Note, despite a very strong desire to throw shade at Jim, commit 70f3aac964ae ("kvm: nVMX: Remove superfluous VMX instruction fault checks") is not to blame for the buggy behavior (though the comment...). That commit only removed the CR0.PE, EFLAGS.VM, and COMPATIBILITY mode checks (though it did erroneously drop the CPL check, but that has already been remedied). KVM may force CR0.PE=3D1, but will do so only when also forcing EFLAGS.VM=3D1 to emulate Real Mode, i.e. hardware will still #UD. Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D216033 Fixes: ec378aeef9df ("KVM: nVMX: Implement VMXON and VMXOFF") Reported-by: Eric Li Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson Message-Id: <20220607213604.3346000-4-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/x86/kvm/vmx/nested.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -4952,20 +4952,25 @@ static int handle_vmon(struct kvm_vcpu * | FEAT_CTL_VMX_ENABLED_OUTSIDE_SMX; =20 /* - * The Intel VMX Instruction Reference lists a bunch of bits that are - * prerequisite to running VMXON, most notably cr4.VMXE must be set to - * 1 (see vmx_is_valid_cr4() for when we allow the guest to set this). - * Otherwise, we should fail with #UD. But most faulting conditions - * have already been checked by hardware, prior to the VM-exit for - * VMXON. We do test guest cr4.VMXE because processor CR4 always has - * that bit set to 1 in non-root mode. + * Note, KVM cannot rely on hardware to perform the CR0/CR4 #UD checks + * that have higher priority than VM-Exit (see Intel SDM's pseudocode + * for VMXON), as KVM must load valid CR0/CR4 values into hardware while + * running the guest, i.e. KVM needs to check the _guest_ values. + * + * Rely on hardware for the other two pre-VM-Exit checks, !VM86 and + * !COMPATIBILITY modes. KVM may run the guest in VM86 to emulate Real + * Mode, but KVM will never take the guest out of those modes. */ - if (!kvm_read_cr4_bits(vcpu, X86_CR4_VMXE)) { + if (!nested_host_cr0_valid(vcpu, kvm_read_cr0(vcpu)) || + !nested_host_cr4_valid(vcpu, kvm_read_cr4(vcpu))) { kvm_queue_exception(vcpu, UD_VECTOR); return 1; } =20 - /* CPL=3D0 must be checked manually. */ + /* + * CPL=3D0 and all other checks that are lower priority than VM-Exit must + * be checked manually. + */ if (vmx_get_cpl(vcpu)) { kvm_inject_gp(vcpu, 0); return 1; From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8CC3C00140 for ; Mon, 15 Aug 2022 18:16:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233304AbiHOSQM (ORCPT ); Mon, 15 Aug 2022 14:16:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233419AbiHOSO6 (ORCPT ); Mon, 15 Aug 2022 14:14:58 -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 58E642A24C; Mon, 15 Aug 2022 11:14: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 DCAEB6129B; Mon, 15 Aug 2022 18:14:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2DE3C433D7; Mon, 15 Aug 2022 18:14:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587258; bh=yOLQpb04Z2qZOjNaMXyuNv0mOFhFVD78+CwPstLEaf4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vY0SdzjnnFdx4wTcpXYfE18ItYMec/YxaSXTX4yhHkyD+7VUlvk9FAWZQOcRuzjUi /niZBfbaf8jbJLJZ0VFHO12W7z47ZUxoV+5mzoBuQIxCi49VS446NuZaXwawbunp5B FV+tsvTO3Ll9wg89lAXXTH6sjKr/TcArrgPkpi9U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+760a73552f47a8cd0fd9@syzkaller.appspotmail.com, Tetsuo Handa , Hou Wenlong , Sean Christopherson , Maxim Levitsky Subject: [PATCH 5.15 028/779] KVM: x86: Mark TSS busy during LTR emulation _after_ all fault checks Date: Mon, 15 Aug 2022 19:54:32 +0200 Message-Id: <20220815180338.422616758@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson commit ec6e4d863258d4bfb36d48d5e3ef68140234d688 upstream. Wait to mark the TSS as busy during LTR emulation until after all fault checks for the LTR have passed. Specifically, don't mark the TSS busy if the new TSS base is non-canonical. Opportunistically drop the one-off !seg_desc.PRESENT check for TR as the only reason for the early check was to avoid marking a !PRESENT TSS as busy, i.e. the common !PRESENT is now done before setting the busy bit. Fixes: e37a75a13cda ("KVM: x86: Emulator ignores LDTR/TR extended base on L= LDT/LTR") Reported-by: syzbot+760a73552f47a8cd0fd9@syzkaller.appspotmail.com Cc: stable@vger.kernel.org Cc: Tetsuo Handa Cc: Hou Wenlong Signed-off-by: Sean Christopherson Reviewed-by: Maxim Levitsky Link: https://lore.kernel.org/r/20220711232750.1092012-2-seanjc@google.com Signed-off-by: Sean Christopherson Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/x86/kvm/emulate.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -1669,16 +1669,6 @@ static int __load_segment_descriptor(str case VCPU_SREG_TR: if (seg_desc.s || (seg_desc.type !=3D 1 && seg_desc.type !=3D 9)) goto exception; - if (!seg_desc.p) { - err_vec =3D NP_VECTOR; - goto exception; - } - old_desc =3D seg_desc; - seg_desc.type |=3D 2; /* busy */ - ret =3D ctxt->ops->cmpxchg_emulated(ctxt, desc_addr, &old_desc, &seg_des= c, - sizeof(seg_desc), &ctxt->exception); - if (ret !=3D X86EMUL_CONTINUE) - return ret; break; case VCPU_SREG_LDTR: if (seg_desc.s || seg_desc.type !=3D 2) @@ -1719,6 +1709,15 @@ static int __load_segment_descriptor(str ((u64)base3 << 32), ctxt)) return emulate_gp(ctxt, 0); } + + if (seg =3D=3D VCPU_SREG_TR) { + old_desc =3D seg_desc; + seg_desc.type |=3D 2; /* busy */ + ret =3D ctxt->ops->cmpxchg_emulated(ctxt, desc_addr, &old_desc, &seg_des= c, + sizeof(seg_desc), &ctxt->exception); + if (ret !=3D X86EMUL_CONTINUE) + return ret; + } load: ctxt->ops->set_segment(ctxt, selector, &seg_desc, base3, seg); if (desc) From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62F72C00140 for ; Mon, 15 Aug 2022 18:16:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233489AbiHOSQS (ORCPT ); Mon, 15 Aug 2022 14:16:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233305AbiHOSPN (ORCPT ); Mon, 15 Aug 2022 14:15:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B909C2A260; Mon, 15 Aug 2022 11:14: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 72FB0B81063; Mon, 15 Aug 2022 18:14:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5568C433D6; Mon, 15 Aug 2022 18:14:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587261; bh=ZBRMvhcIiKrm5eDsdXJMo6O7xO94kPKSQyGEuOrCws4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UbWwYlM0cYBk+ksgFzQgOpt2diiD1AEek1AJ5kXRnbk13aNeaA9n2XQt+qlOeYMUV mC+tH+Trp93+d/Za6jhPorbCDsJO5bvuGA1qvu2VyGKnAbodQxXEL6bIfNRKA8RP+l 32mv+1d4jbpbIX/mnpDHn7LxYjkSEP3wgoVqqmfQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Maxim Levitsky Subject: [PATCH 5.15 029/779] KVM: x86: Set error code to segment selector on LLDT/LTR non-canonical #GP Date: Mon, 15 Aug 2022 19:54:33 +0200 Message-Id: <20220815180338.473423200@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson commit 2626206963ace9e8bf92b6eea5ff78dd674c555c upstream. When injecting a #GP on LLDT/LTR due to a non-canonical LDT/TSS base, set the error code to the selector. Intel SDM's says nothing about the #GP, but AMD's APM explicitly states that both LLDT and LTR set the error code to the selector, not zero. Note, a non-canonical memory operand on LLDT/LTR does generate a #GP(0), but the KVM code in question is specific to the base from the descriptor. Fixes: e37a75a13cda ("KVM: x86: Emulator ignores LDTR/TR extended base on L= LDT/LTR") Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson Reviewed-by: Maxim Levitsky Link: https://lore.kernel.org/r/20220711232750.1092012-3-seanjc@google.com Signed-off-by: Sean Christopherson Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/x86/kvm/emulate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/arch/x86/kvm/emulate.c +++ b/arch/x86/kvm/emulate.c @@ -1706,8 +1706,8 @@ static int __load_segment_descriptor(str if (ret !=3D X86EMUL_CONTINUE) return ret; if (emul_is_noncanonical_address(get_desc_base(&seg_desc) | - ((u64)base3 << 32), ctxt)) - return emulate_gp(ctxt, 0); + ((u64)base3 << 32), ctxt)) + return emulate_gp(ctxt, err_code); } =20 if (seg =3D=3D VCPU_SREG_TR) { From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E390C00140 for ; Mon, 15 Aug 2022 18:16:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233592AbiHOSQW (ORCPT ); Mon, 15 Aug 2022 14:16:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233694AbiHOSPO (ORCPT ); Mon, 15 Aug 2022 14:15:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 323082A403; Mon, 15 Aug 2022 11:14: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 ADD2D6126D; Mon, 15 Aug 2022 18:14:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2E99C433C1; Mon, 15 Aug 2022 18:14:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587264; bh=KbymLyEDXrB6u8TOCJnLlIv9TZMKZR8179uzCYGH6Kc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DKUsJ9DDXdf3Pbs36nQDdLBBgQJZbI/1EjtvulZT5KwwKv8hmG547sQVDfNGEA0CS 4qeNqQQTj9lRI3z/9XX5iTSWowh1qgGj1dM8n6ZLlF5+1+a4sEf4Y1/BIUDHMTNP+L 365q2uNud2dXX6gN6ppcaCLr2s2vSEtusnJPzoQA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vitaly Kuznetsov , Maxim Levitsky , Sean Christopherson Subject: [PATCH 5.15 030/779] KVM: nVMX: Always enable TSC scaling for L2 when it was enabled for L1 Date: Mon, 15 Aug 2022 19:54:34 +0200 Message-Id: <20220815180338.515451628@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vitaly Kuznetsov commit 156b9d76e8822f2956c15029acf2d4b171502f3a upstream. Windows 10/11 guests with Hyper-V role (WSL2) enabled are observed to hang upon boot or shortly after when a non-default TSC frequency was set for L1. The issue is observed on a host where TSC scaling is supported. The problem appears to be that Windows doesn't use TSC scaling for its guests, even when the feature is advertised, and KVM filters SECONDARY_EXEC_TSC_SCALING out when creating L2 controls from L1's VMCS. This leads to L2 running with the default frequency (matching host's) while L1 is running with an altered one. Keep SECONDARY_EXEC_TSC_SCALING in secondary exec controls for L2 when it was set for L1. TSC_MULTIPLIER is already correctly computed and written by prepare_vmcs02(). Signed-off-by: Vitaly Kuznetsov Fixes: d041b5ea93352b ("KVM: nVMX: Enable nested TSC scaling") Cc: stable@vger.kernel.org Reviewed-by: Maxim Levitsky Link: https://lore.kernel.org/r/20220712135009.952805-1-vkuznets@redhat.com Signed-off-by: Sean Christopherson Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/x86/kvm/vmx/nested.c | 1 - 1 file changed, 1 deletion(-) --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -2273,7 +2273,6 @@ static void prepare_vmcs02_early(struct SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY | SECONDARY_EXEC_APIC_REGISTER_VIRT | SECONDARY_EXEC_ENABLE_VMFUNC | - SECONDARY_EXEC_TSC_SCALING | SECONDARY_EXEC_DESC); =20 if (nested_cpu_has(vmcs12, From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D095BC25B08 for ; Mon, 15 Aug 2022 18:16:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236130AbiHOSQ1 (ORCPT ); Mon, 15 Aug 2022 14:16:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233205AbiHOSPQ (ORCPT ); Mon, 15 Aug 2022 14:15:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 297202A27C; Mon, 15 Aug 2022 11:14: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 A031161255; Mon, 15 Aug 2022 18:14:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A422BC433D6; Mon, 15 Aug 2022 18:14:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587267; bh=PPyDFzwUQncLPM39nqqMR/bRyAMH5NCLTbkIJHoDLaM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kUPF/xoz8OVVOmy7c2W4WI2rGDo3ssb5QkVbb3BQ7TbnQ/NmUhWXwkeTI8IpRptI1 MeWgMQ+rQ5fCjn4mL+z4S+BqI8wmYp41kaQTuDFs2mResf/rNMiCcv1SPIsWAz4Orb tgnfQYz7AN4ofFY35H9XkQvHEoCiLGf5mYR4Vqtc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kai Huang , Michael Roth , Sean Christopherson , Paolo Bonzini Subject: [PATCH 5.15 031/779] KVM: x86: Tag kvm_mmu_x86_module_init() with __init Date: Mon, 15 Aug 2022 19:54:35 +0200 Message-Id: <20220815180338.564460037@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson commit 982bae43f11c37b51d2f1961bb25ef7cac3746fa upstream. Mark kvm_mmu_x86_module_init() with __init, the entire reason it exists is to initialize variables when kvm.ko is loaded, i.e. it must never be called after module initialization. Fixes: 1d0e84806047 ("KVM: x86/mmu: Resolve nx_huge_pages when kvm.ko is lo= aded") Cc: stable@vger.kernel.org Reviewed-by: Kai Huang Tested-by: Michael Roth Signed-off-by: Sean Christopherson Message-Id: <20220803224957.1285926-2-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/x86/include/asm/kvm_host.h | 2 +- arch/x86/kvm/mmu/mmu.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -1562,7 +1562,7 @@ static inline int kvm_arch_flush_remote_ return -ENOTSUPP; } =20 -void kvm_mmu_x86_module_init(void); +void __init kvm_mmu_x86_module_init(void); int kvm_mmu_vendor_module_init(void); void kvm_mmu_vendor_module_exit(void); =20 --- a/arch/x86/kvm/mmu/mmu.c +++ b/arch/x86/kvm/mmu/mmu.c @@ -6115,7 +6115,7 @@ static int set_nx_huge_pages(const char * nx_huge_pages needs to be resolved to true/false when kvm.ko is loaded,= as * its default value of -1 is technically undefined behavior for a boolean. */ -void kvm_mmu_x86_module_init(void) +void __init kvm_mmu_x86_module_init(void) { if (nx_huge_pages =3D=3D -1) __set_nx_huge_pages(get_nx_auto_mode()); From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82708C00140 for ; Mon, 15 Aug 2022 18:16:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233714AbiHOSQb (ORCPT ); Mon, 15 Aug 2022 14:16:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233216AbiHOSPR (ORCPT ); Mon, 15 Aug 2022 14:15:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22DDC2A73B; Mon, 15 Aug 2022 11:14: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 B6B776126D; Mon, 15 Aug 2022 18:14:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5FA1C433D6; Mon, 15 Aug 2022 18:14:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587270; bh=1OITRAGOJJ4XFj+CUCDTY5YI0pSF38I7VP8XdWTEDT8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QN+sPilZ0Fddgpqe5FxgppKr9dptwj1rhG4w3qWyRuEsf77r0m8xvzwKzV66bwK+9 /DDF+Y6LxaD3TNaOWxJFEgDZmQZW+GIWtqO4Qu/30KUlm9EXAea6N0vJtsXoIFU8cP 1x/laoZDmBxhYP5W5Ge4ZkRFgVpbgOAHZAGrYOuM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Woodhouse , Paolo Bonzini Subject: [PATCH 5.15 032/779] KVM: x86: do not report preemption if the steal time cache is stale Date: Mon, 15 Aug 2022 19:54:36 +0200 Message-Id: <20220815180338.606865611@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Paolo Bonzini commit c3c28d24d910a746b02f496d190e0e8c6560224b upstream. Commit 7e2175ebd695 ("KVM: x86: Fix recording of guest steal time / preempted status", 2021-11-11) open coded the previous call to kvm_map_gfn, but in doing so it dropped the comparison between the cached guest physical address and the one in the MSR. This cause an incorrect cache hit if the guest modifies the steal time address while the memslots remain the same. This can happen with kexec, in which case the preempted bit is written at the address used by the old kernel instead of the old one. Cc: David Woodhouse Cc: stable@vger.kernel.org Fixes: 7e2175ebd695 ("KVM: x86: Fix recording of guest steal time / preempt= ed status") Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/x86/kvm/x86.c | 2 ++ 1 file changed, 2 insertions(+) --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -4378,6 +4378,7 @@ static void kvm_steal_time_set_preempted struct kvm_steal_time __user *st; struct kvm_memslots *slots; static const u8 preempted =3D KVM_VCPU_PREEMPTED; + gpa_t gpa =3D vcpu->arch.st.msr_val & KVM_STEAL_VALID_BITS; =20 /* * The vCPU can be marked preempted if and only if the VM-Exit was on @@ -4405,6 +4406,7 @@ static void kvm_steal_time_set_preempted slots =3D kvm_memslots(vcpu->kvm); =20 if (unlikely(slots->generation !=3D ghc->generation || + gpa !=3D ghc->gpa || kvm_is_error_hva(ghc->hva) || !ghc->memslot)) return; From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE83EC00140 for ; Mon, 15 Aug 2022 18:16:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239515AbiHOSQj (ORCPT ); Mon, 15 Aug 2022 14:16:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233572AbiHOSPZ (ORCPT ); Mon, 15 Aug 2022 14:15:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B53532AE16; Mon, 15 Aug 2022 11:14: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 6F7BEB8106E; Mon, 15 Aug 2022 18:14:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE1F4C433D7; Mon, 15 Aug 2022 18:14:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587273; bh=AE1AKp4oa0qoGjpBEOHT5TP3oZSgBNWXFJoL9mwS8W0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u1qwhaMxenHdqr5/usJJd07fBFJL0k309Qs65L5VhVvQEL4YFr0YZT2QpYGOyCDM7 wckV91zCbbr3cEgHAvI5oVsHXuujqpd/BmRcI0f0C1Yyiauau0+lyB8lgAQKvlbc4N BeElyomZeSeKNmecfIYWkxCr9axCz+uav+P9sP3o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Young , Xiaoying Yan , David Woodhouse , Paolo Bonzini , "Dr . David Alan Gilbert" Subject: [PATCH 5.15 033/779] KVM: x86: revalidate steal time cache if MSR value changes Date: Mon, 15 Aug 2022 19:54:37 +0200 Message-Id: <20220815180338.649734971@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Paolo Bonzini commit 901d3765fa804ce42812f1d5b1f3de2dfbb26723 upstream. Commit 7e2175ebd695 ("KVM: x86: Fix recording of guest steal time / preempted status", 2021-11-11) open coded the previous call to kvm_map_gfn, but in doing so it dropped the comparison between the cached guest physical address and the one in the MSR. This cause an incorrect cache hit if the guest modifies the steal time address while the memslots remain the same. This can happen with kexec, in which case the steal time data is written at the address used by the old kernel instead of the old one. While at it, rename the variable from gfn to gpa since it is a plain physical address and not a right-shifted one. Reported-by: Dave Young Reported-by: Xiaoying Yan Analyzed-by: Dr. David Alan Gilbert Cc: David Woodhouse Cc: stable@vger.kernel.org Fixes: 7e2175ebd695 ("KVM: x86: Fix recording of guest steal time / preempt= ed status") Signed-off-by: Paolo Bonzini Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/x86/kvm/x86.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -3244,6 +3244,7 @@ static void record_steal_time(struct kvm struct gfn_to_hva_cache *ghc =3D &vcpu->arch.st.cache; struct kvm_steal_time __user *st; struct kvm_memslots *slots; + gpa_t gpa =3D vcpu->arch.st.msr_val & KVM_STEAL_VALID_BITS; u64 steal; u32 version; =20 @@ -3261,13 +3262,12 @@ static void record_steal_time(struct kvm slots =3D kvm_memslots(vcpu->kvm); =20 if (unlikely(slots->generation !=3D ghc->generation || + gpa !=3D ghc->gpa || kvm_is_error_hva(ghc->hva) || !ghc->memslot)) { - gfn_t gfn =3D vcpu->arch.st.msr_val & KVM_STEAL_VALID_BITS; - /* We rely on the fact that it fits in a single page. */ BUILD_BUG_ON((sizeof(*st) - 1) & KVM_STEAL_VALID_BITS); =20 - if (kvm_gfn_to_hva_cache_init(vcpu->kvm, ghc, gfn, sizeof(*st)) || + if (kvm_gfn_to_hva_cache_init(vcpu->kvm, ghc, gpa, sizeof(*st)) || kvm_is_error_hva(ghc->hva) || !ghc->memslot) return; } From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCB9BC25B08 for ; Mon, 15 Aug 2022 18:16:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239341AbiHOSQo (ORCPT ); Mon, 15 Aug 2022 14:16:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233806AbiHOSP1 (ORCPT ); Mon, 15 Aug 2022 14:15:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 512602A947; Mon, 15 Aug 2022 11:14: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 E218061255; Mon, 15 Aug 2022 18:14:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAD69C433C1; Mon, 15 Aug 2022 18:14:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587276; bh=Yr7okvVqXnDFjMSzgjiWDpsS49DA0YngByrlZroVnJU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XbX1j8urCtDuY4Gmp6AMrK1tU/id3P6LpFVgFUAuAvOPgHbCmnrjpIKnHNfyVS7TH dkk1zF+qqZ3abNn0PKTlXxC6hxUWGblSs/FwtILAW18FbtDJe8E6jf5nuaOaCSAUv7 UbY7zMdjFJUbCF7RkdEB39fePdAsHDSVoLvzJdrc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dimitri John Ledkov , Anup Patel , Ron Economos , Palmer Dabbelt , Nathan Chancellor Subject: [PATCH 5.15 034/779] riscv: set default pm_power_off to NULL Date: Mon, 15 Aug 2022 19:54:38 +0200 Message-Id: <20220815180338.699223605@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dimitri John Ledkov commit f2928e224d85e7cc139009ab17cefdfec2df5d11 upstream. Set pm_power_off to NULL like on all other architectures, check if it is set in machine_halt() and machine_power_off() and fallback to default_power_off if no other power driver got registered. This brings riscv architecture inline with all other architectures, and allows to reuse exiting power drivers unmodified. Kernels without legacy SBI v0.1 extensions (CONFIG_RISCV_SBI_V01 is not set), do not set pm_power_off to sbi_shutdown(). There is no support for SBI v0.3 system reset extension either. This prevents using gpio_poweroff on SiFive HiFive Unmatched. Tested on SiFive HiFive unmatched, with a dtb specifying gpio-poweroff node and kernel complied without CONFIG_RISCV_SBI_V01. BugLink: https://bugs.launchpad.net/bugs/1942806 Signed-off-by: Dimitri John Ledkov Reviewed-by: Anup Patel Tested-by: Ron Economos Signed-off-by: Palmer Dabbelt Cc: Nathan Chancellor Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/riscv/kernel/reset.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) --- a/arch/riscv/kernel/reset.c +++ b/arch/riscv/kernel/reset.c @@ -12,7 +12,7 @@ static void default_power_off(void) wait_for_interrupt(); } =20 -void (*pm_power_off)(void) =3D default_power_off; +void (*pm_power_off)(void) =3D NULL; EXPORT_SYMBOL(pm_power_off); =20 void machine_restart(char *cmd) @@ -23,10 +23,16 @@ void machine_restart(char *cmd) =20 void machine_halt(void) { - pm_power_off(); + if (pm_power_off !=3D NULL) + pm_power_off(); + else + default_power_off(); } =20 void machine_power_off(void) { - pm_power_off(); + if (pm_power_off !=3D NULL) + pm_power_off(); + else + default_power_off(); } From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26E12C00140 for ; Mon, 15 Aug 2022 18:16:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239555AbiHOSQs (ORCPT ); Mon, 15 Aug 2022 14:16:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239330AbiHOSQF (ORCPT ); Mon, 15 Aug 2022 14:16:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4D532A415; Mon, 15 Aug 2022 11:14:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 478EBB8106C; Mon, 15 Aug 2022 18:14:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3363C433D6; Mon, 15 Aug 2022 18:14:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587279; bh=ELjryB8FWGLugOIuSJFH96NH9H+/KyRj7dUBAwO2eqs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DzJvkYBMEKynH+034kF2WU92KbavBrKCj86rhVWg2vnX8YFLOdUibp8AXs3TDo3+B L2TrCNbDgrHxPLPeNzSbHxfPrZHBBCxZx/EeQ/54YqM1Inmr80S828Bclqqj4Hgb0r 8iMh2i5AIyxv1UYvUwJh+4GEwUFD4JTTXXp6oPO8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Meng Tang , Takashi Iwai Subject: [PATCH 5.15 035/779] ALSA: hda/conexant: Add quirk for LENOVO 20149 Notebook model Date: Mon, 15 Aug 2022 19:54:39 +0200 Message-Id: <20220815180338.730151362@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Meng Tang commit f83bb2592482fe94c6eea07a8121763c80f36ce5 upstream. There is another LENOVO 20149 (Type1Sku0) Notebook model with CX20590, the device PCI SSID is 17aa:3977, which headphones are not responding, that requires the quirk CXT_PINCFG_LENOVO_NOTEBOOK. Add the corresponding entry to the quirk table. Signed-off-by: Meng Tang Cc: Link: https://lore.kernel.org/r/20220808073406.19460-1-tangmeng@uniontech.c= om Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- sound/pci/hda/patch_conexant.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -222,6 +222,7 @@ enum { CXT_PINCFG_LEMOTE_A1205, CXT_PINCFG_COMPAQ_CQ60, CXT_FIXUP_STEREO_DMIC, + CXT_PINCFG_LENOVO_NOTEBOOK, CXT_FIXUP_INC_MIC_BOOST, CXT_FIXUP_HEADPHONE_MIC_PIN, CXT_FIXUP_HEADPHONE_MIC, @@ -772,6 +773,14 @@ static const struct hda_fixup cxt_fixups .type =3D HDA_FIXUP_FUNC, .v.func =3D cxt_fixup_stereo_dmic, }, + [CXT_PINCFG_LENOVO_NOTEBOOK] =3D { + .type =3D HDA_FIXUP_PINS, + .v.pins =3D (const struct hda_pintbl[]) { + { 0x1a, 0x05d71030 }, + { } + }, + .chain_id =3D CXT_FIXUP_STEREO_DMIC, + }, [CXT_FIXUP_INC_MIC_BOOST] =3D { .type =3D HDA_FIXUP_FUNC, .v.func =3D cxt5066_increase_mic_boost, @@ -971,7 +980,7 @@ static const struct snd_pci_quirk cxt506 SND_PCI_QUIRK(0x17aa, 0x3905, "Lenovo G50-30", CXT_FIXUP_STEREO_DMIC), SND_PCI_QUIRK(0x17aa, 0x390b, "Lenovo G50-80", CXT_FIXUP_STEREO_DMIC), SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC), - SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_FIXUP_STEREO_DMI= C), + SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_PINCFG_LENOVO_NO= TEBOOK), SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo G50-70", CXT_FIXUP_STEREO_DMIC), SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC), SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", CXT_FIXUP_THINKPAD_ACPI), From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E3479C25B0E for ; Mon, 15 Aug 2022 18:16:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239590AbiHOSQw (ORCPT ); Mon, 15 Aug 2022 14:16:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239398AbiHOSQG (ORCPT ); Mon, 15 Aug 2022 14:16:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A9FD2A723; Mon, 15 Aug 2022 11:14: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 BDFD96126D; Mon, 15 Aug 2022 18:14:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B195EC433C1; Mon, 15 Aug 2022 18:14:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587282; bh=5T9sZsUjVjATFoJV6q2ZZ2gMz8QuQmNVK0O3y/brn4g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WHRfaYhpnaJ69Hvd4PpfvhaZpMG8E6lrShVgtSd+w70e+FKJLGzqaStlhErApvdjz LTNcuaSd5JuOL0ADsI86hIG2TtKU9U4vX1st1E2kgD+OBJWoqHQ8q8BpXyDZd+qexD PYLZhbacpEg0gY0B6bJ2QpnzXVKLZ/N5pBPcbWWc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Allen Ballway , Takashi Iwai Subject: [PATCH 5.15 036/779] ALSA: hda/cirrus - support for iMac 12,1 model Date: Mon, 15 Aug 2022 19:54:40 +0200 Message-Id: <20220815180338.776223570@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Allen Ballway commit 74bba640d69914cf832b87f6bbb700e5ba430672 upstream. The 12,1 model requires the same configuration as the 12,2 model to enable headphones but has a different codec SSID. Adds 12,1 SSID for matching quirk. [ re-sorted in SSID order by tiwai ] Signed-off-by: Allen Ballway Cc: Link: https://lore.kernel.org/r/20220810152701.1.I902c2e591bbf8de9acb649d13= 22fa1f291849266@changeid Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- sound/pci/hda/patch_cirrus.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/pci/hda/patch_cirrus.c +++ b/sound/pci/hda/patch_cirrus.c @@ -395,6 +395,7 @@ static const struct snd_pci_quirk cs420x =20 /* codec SSID */ SND_PCI_QUIRK(0x106b, 0x0600, "iMac 14,1", CS420X_IMAC27_122), + SND_PCI_QUIRK(0x106b, 0x0900, "iMac 12,1", CS420X_IMAC27_122), SND_PCI_QUIRK(0x106b, 0x1c00, "MacBookPro 8,1", CS420X_MBP81), SND_PCI_QUIRK(0x106b, 0x2000, "iMac 12,2", CS420X_IMAC27_122), SND_PCI_QUIRK(0x106b, 0x2800, "MacBookPro 10,1", CS420X_MBP101), From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B2DCC25B08 for ; Mon, 15 Aug 2022 18:17:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239760AbiHOSRQ (ORCPT ); Mon, 15 Aug 2022 14:17:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236861AbiHOSQc (ORCPT ); Mon, 15 Aug 2022 14:16:32 -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 5C3252B18B; Mon, 15 Aug 2022 11:14: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 C711AB8106C; Mon, 15 Aug 2022 18:14:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 220EEC433C1; Mon, 15 Aug 2022 18:14:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587288; bh=/ElfKthV5Sor+3wfG2ygrSkzRrxESCBOHdCG6TaPdt0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LHRfFjahh+P+DchwaxdKeRYeKQOcU8cfLWqdsJ57nVLBeeiv0WY90JNEwtg8J4b38 GO983lAPGXib89PCA1PH/4ytRLaVZzIYd9ql8J3KCfpoYiaQHRAuCg1yRCN6nsrqvI XtjjAuBuIK6OtMmVYr91BeLjO7oVxDQ8uEBsTpJ0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Meng Tang , Takashi Iwai Subject: [PATCH 5.15 037/779] ALSA: hda/realtek: Add quirk for another Asus K42JZ model Date: Mon, 15 Aug 2022 19:54:41 +0200 Message-Id: <20220815180338.816453145@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Meng Tang commit f882c4bef9cb914d9f7be171afb10ed26536bfa7 upstream. There is another Asus K42JZ model with the PCI SSID 1043:1313 that requires the quirk ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE. Add the corresponding entry to the quirk table. Signed-off-by: Meng Tang Cc: Link: https://lore.kernel.org/r/20220805074534.20003-1-tangmeng@uniontech.c= om Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- sound/pci/hda/patch_realtek.c | 11 +++++++++++ 1 file changed, 11 insertions(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -6721,6 +6721,7 @@ enum { ALC269_FIXUP_LIMIT_INT_MIC_BOOST, ALC269VB_FIXUP_ASUS_ZENBOOK, ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, + ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE, ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED, ALC269VB_FIXUP_ORDISSIMO_EVE2, ALC283_FIXUP_CHROME_BOOK, @@ -7297,6 +7298,15 @@ static const struct hda_fixup alc269_fix .chained =3D true, .chain_id =3D ALC269VB_FIXUP_ASUS_ZENBOOK, }, + [ALC269VB_FIXUP_ASUS_MIC_NO_PRESENCE] =3D { + .type =3D HDA_FIXUP_PINS, + .v.pins =3D (const struct hda_pintbl[]) { + { 0x18, 0x01a110f0 }, /* use as headset mic */ + { } + }, + .chained =3D true, + .chain_id =3D ALC269_FIXUP_HEADSET_MIC + }, [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] =3D { .type =3D HDA_FIXUP_FUNC, .v.func =3D alc269_fixup_limit_int_mic_boost, @@ -8919,6 +8929,7 @@ static const struct snd_pci_quirk alc269 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_M= IC_NO_PRESENCE), SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC), SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC), + SND_PCI_QUIRK(0x1043, 0x1313, "Asus K42JZ", ALC269VB_FIXUP_ASUS_MIC_NO_PR= ESENCE), SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC), SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_Z= ENBOOK), SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_Z= ENBOOK_UX31A), From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0828C282E7 for ; Mon, 15 Aug 2022 18:17:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239798AbiHOSRZ (ORCPT ); Mon, 15 Aug 2022 14:17:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237698AbiHOSQd (ORCPT ); Mon, 15 Aug 2022 14: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 D4AA82B192; Mon, 15 Aug 2022 11:14: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 5F91B61255; Mon, 15 Aug 2022 18:14:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D0FAC433C1; Mon, 15 Aug 2022 18:14:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587291; bh=blS0VXUuDeGoODmIARLmWCjHHJbjbJG1WxzFTGnnuUM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X/IKbGIURt6CtV7s8I7pFUFIo1jYtOC1NVB+45g4yIWBmFH5h69e60/IupQHeCPzH aNhgHtBs8o+KYjXeDqHub93Vh9d5GtIXNodgOMsMJuwnO8C61NU7MHzATKYsZIa3MR LkSQ6q8Tvf1n/GnAVm4x3zwdbZVKmroFlNb/h+gw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bedant Patnaik , Takashi Iwai Subject: [PATCH 5.15 038/779] ALSA: hda/realtek: Add a quirk for HP OMEN 15 (8786) mute LED Date: Mon, 15 Aug 2022 19:54:42 +0200 Message-Id: <20220815180338.855541272@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bedant Patnaik commit 30267718fe2d4dbea49015b022f6f1fe16ca31ab upstream. Board ID 8786 seems to be another variant of the Omen 15 that needs ALC285_FIXUP_HP_MUTE_LED for working mute LED. Signed-off-by: Bedant Patnaik Cc: Link: https://lore.kernel.org/r/20220809142455.6473-1-bedant.patnaik@gmail.= com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -8879,6 +8879,7 @@ static const struct snd_pci_quirk alc269 ALC285_FIXUP_HP_GPIO_AMP_INIT), SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation", ALC285_FIXUP_HP_GPIO_AMP_INIT), + SND_PCI_QUIRK(0x103c, 0x8786, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED), SND_PCI_QUIRK(0x103c, 0x8787, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED), SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED), SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED), From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 67900C00140 for ; Mon, 15 Aug 2022 18:17:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239307AbiHOSRi (ORCPT ); Mon, 15 Aug 2022 14:17:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239513AbiHOSQj (ORCPT ); Mon, 15 Aug 2022 14:16: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 BDB342A940; Mon, 15 Aug 2022 11:14: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 503B2B80F99; Mon, 15 Aug 2022 18:14:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F6B4C43141; Mon, 15 Aug 2022 18:14:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587296; bh=xiETIeoHQ+5PvRfu22IMJsts+TQDJtrJiMNFQMjmY/o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AiRxlMUloQpRBwzFMaCUZ8f+AG63mFAVlstwRuONmyoxeMr9FRg4wauEyCjqEdrcf BSXxNWFj0N/eRiZxGbkYBHwhLrAjk7Ppvdp+qaPj5sB4FjJkAYV7AQrH4b+6ByaYIh K9d+E0kHaYcxbIJCAIgxQ/5bp77Q5aAw9iv9myFg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Jiri Slaby , Tetsuo Handa Subject: [PATCH 5.15 039/779] tty: vt: initialize unicode screen buffer Date: Mon, 15 Aug 2022 19:54:43 +0200 Message-Id: <20220815180338.892725357@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tetsuo Handa commit af77c56aa35325daa2bc2bed5c2ebf169be61b86 upstream. syzbot reports kernel infoleak at vcs_read() [1], for buffer can be read immediately after resize operation. Initialize buffer using kzalloc(). ---------- #include #include #include #include int main(int argc, char *argv[]) { struct fb_var_screeninfo var =3D { }; const int fb_fd =3D open("/dev/fb0", 3); ioctl(fb_fd, FBIOGET_VSCREENINFO, &var); var.yres =3D 0x21; ioctl(fb_fd, FBIOPUT_VSCREENINFO, &var); return read(open("/dev/vcsu", O_RDONLY), &var, sizeof(var)) =3D=3D -1; } ---------- Link: https://syzkaller.appspot.com/bug?extid=3D31a641689d43387f05d3 [1] Cc: stable Reported-by: syzbot Reviewed-by: Jiri Slaby Signed-off-by: Tetsuo Handa Link: https://lore.kernel.org/r/4ef053cf-e796-fb5e-58b7-3ae58242a4ad@I-love= .SAKURA.ne.jp Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/tty/vt/vt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -344,7 +344,7 @@ static struct uni_screen *vc_uniscr_allo /* allocate everything in one go */ memsize =3D cols * rows * sizeof(char32_t); memsize +=3D rows * sizeof(char32_t *); - p =3D vmalloc(memsize); + p =3D vzalloc(memsize); if (!p) return NULL; From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11F78C25B08 for ; Mon, 15 Aug 2022 18:17:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239885AbiHOSRq (ORCPT ); Mon, 15 Aug 2022 14:17:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239417AbiHOSQ7 (ORCPT ); Mon, 15 Aug 2022 14: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 2A0572B1A4; Mon, 15 Aug 2022 11:15: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 76493B80F99; Mon, 15 Aug 2022 18:15:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9203BC4314F; Mon, 15 Aug 2022 18:14:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587299; bh=e1bcoMHQ8z6gZIrlyNFmAhWYxrybUozV7Q7y76/g4bc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qO/k6c9SPQBCijM86BZdMT9t1FN0XBny0rC4+konVU4XKPIievVA+sGQfRyGsUd4B BQ0Ylh0OIxUG4jwqQXwFK/cNHhHcE2J3o/yzDtLm+NoKdVPxbbXgl6yL0wOVaTeYQr CV459nW37H25X99gS1b73uxEsuQgxSs7pCm0hSMU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Howells , Jeff Layton , Namjae Jeon , stable@kernel.org, Alexander Viro , Steve French , Hyunchul Lee , Chuck Lever , Dave Wysochanski , Linus Torvalds Subject: [PATCH 5.15 040/779] vfs: Check the truncate maximum size in inode_newsize_ok() Date: Mon, 15 Aug 2022 19:54:44 +0200 Message-Id: <20220815180338.945463920@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 commit e2ebff9c57fe4eb104ce4768f6ebcccf76bef849 upstream. If something manages to set the maximum file size to MAX_OFFSET+1, this can cause the xfs and ext4 filesystems at least to become corrupt. Ordinarily, the kernel protects against userspace trying this by checking the value early in the truncate() and ftruncate() system calls calls - but there are at least two places that this check is bypassed: (1) Cachefiles will round up the EOF of the backing file to DIO block size so as to allow DIO on the final block - but this might push the offset negative. It then calls notify_change(), but this inadvertently bypasses the checking. This can be triggered if someone puts an 8EiB-1 file on a server for someone else to try and access by, say, nfs. (2) ksmbd doesn't check the value it is given in set_end_of_file_info() and then calls vfs_truncate() directly - which also bypasses the check. In both cases, it is potentially possible for a network filesystem to cause a disk filesystem to be corrupted: cachefiles in the client's cache filesystem; ksmbd in the server's filesystem. nfsd is okay as it checks the value, but we can then remove this check too. Fix this by adding a check to inode_newsize_ok(), as called from setattr_prepare(), thereby catching the issue as filesystems set up to perform the truncate with minimal opportunity for bypassing the new check. Fixes: 1f08c925e7a3 ("cachefiles: Implement backing file wrangling") Fixes: f44158485826 ("cifsd: add file operations") Signed-off-by: David Howells Reported-by: Jeff Layton Tested-by: Jeff Layton Reviewed-by: Namjae Jeon Cc: stable@kernel.org Acked-by: Alexander Viro cc: Steve French cc: Hyunchul Lee cc: Chuck Lever cc: Dave Wysochanski Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/attr.c | 2 ++ 1 file changed, 2 insertions(+) --- a/fs/attr.c +++ b/fs/attr.c @@ -184,6 +184,8 @@ EXPORT_SYMBOL(setattr_prepare); */ int inode_newsize_ok(const struct inode *inode, loff_t offset) { + if (offset < 0) + return -EINVAL; if (inode->i_size < offset) { unsigned long limit; From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB192C00140 for ; Mon, 15 Aug 2022 18:17:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239918AbiHOSRw (ORCPT ); Mon, 15 Aug 2022 14:17:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233428AbiHOSRC (ORCPT ); Mon, 15 Aug 2022 14:17:02 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 089672B1A2; Mon, 15 Aug 2022 11:15: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 sin.source.kernel.org (Postfix) with ESMTPS id E9454CE125A; Mon, 15 Aug 2022 18:15:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D14D8C433B5; Mon, 15 Aug 2022 18:15:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587302; bh=YZjcdqOmFPhjopOUNUd6Ro9ZvDWfGHcunlWhRcl2aG4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hf0+Ulv/bKQEVdvi9eN+ch+3c38+GFe011EAr7gr109J34j+GGvrTFLeFHewrGP6m 9ZBD4NE604eLYeO4Rc2DVl4XM1WFqnGEV6W0aQ2BW/5ydDBsJL66LZdXIrl2AUem6Y 2v17hZJ4DPhHV4mDWMy1rg639oo/G8shxE1cOhqY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Christian Brauner (Microsoft)" , "Darrick J. Wong" , Yang Xu , Jeff Layton Subject: [PATCH 5.15 041/779] fs: Add missing umask strip in vfs_tmpfile Date: Mon, 15 Aug 2022 19:54:45 +0200 Message-Id: <20220815180338.992610017@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Xu commit ac6800e279a22b28f4fc21439843025a0d5bf03e upstream. All creation paths except for O_TMPFILE handle umask in the vfs directly if the filesystem doesn't support or enable POSIX ACLs. If the filesystem does then umask handling is deferred until posix_acl_create(). Because, O_TMPFILE misses umask handling in the vfs it will not honor umask settings. Fix this by adding the missing umask handling. Link: https://lore.kernel.org/r/1657779088-2242-2-git-send-email-xuyang2018= .jy@fujitsu.com Fixes: 60545d0d4610 ("[O_TMPFILE] it's still short a few helpers, but infra= structure should be OK now...") Cc: # 4.19+ Reported-by: Christian Brauner (Microsoft) Reviewed-by: Darrick J. Wong Reviewed-and-Tested-by: Jeff Layton Acked-by: Christian Brauner (Microsoft) Signed-off-by: Yang Xu Signed-off-by: Christian Brauner (Microsoft) Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/namei.c | 2 ++ 1 file changed, 2 insertions(+) --- a/fs/namei.c +++ b/fs/namei.c @@ -3523,6 +3523,8 @@ struct dentry *vfs_tmpfile(struct user_n child =3D d_alloc(dentry, &slash_name); if (unlikely(!child)) goto out_err; + if (!IS_POSIXACL(dir)) + mode &=3D ~current_umask(); error =3D dir->i_op->tmpfile(mnt_userns, dir, child, mode); if (error) goto out_err; From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7826FC3F6B0 for ; Mon, 15 Aug 2022 18:18:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239136AbiHOSSC (ORCPT ); Mon, 15 Aug 2022 14:18:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233622AbiHOSRF (ORCPT ); Mon, 15 Aug 2022 14:17:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25FD92B1AD; Mon, 15 Aug 2022 11:15: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 C17BAB8106C; Mon, 15 Aug 2022 18:15:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 156B4C433C1; Mon, 15 Aug 2022 18:15:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587305; bh=aEfeu9f1lMXq8ZH7oRYczw5jkBVwbMgOJJdgiuGDQx4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IL9Ki3ltdoku2NGe7E/+CsbSZso1K8GB8gPbYBWF3DjEkLL7ZXzvv2dKvZU10ouUn Bg8vNnv9/AiTd5MXuCqJHSSGisa837mg1hCj13zGTBfSxLXdEpwkZ8EF5IEDO/hhwB 8VSrw/+M4jOCqRuuOp0Rxm3SudEOP6pvJsCxmXn8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Di Shen , "Rafael J. Wysocki" Subject: [PATCH 5.15 042/779] thermal: sysfs: Fix cooling_device_stats_setup() error code path Date: Mon, 15 Aug 2022 19:54:46 +0200 Message-Id: <20220815180339.044488868@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rafael J. Wysocki commit d5a8aa5d7d80d21ab6b266f1bed4194b61746199 upstream. If cooling_device_stats_setup() fails to create the stats object, it must clear the last slot in cooling_device_attr_groups that was initially empty (so as to make it possible to add stats attributes to the cooling device attribute groups). Failing to do so may cause the stats attributes to be created by mistake for a device that doesn't have a stats object, because the slot in question might be populated previously during the registration of another cooling device. Fixes: 8ea229511e06 ("thermal: Add cooling device's statistics in sysfs") Reported-by: Di Shen Tested-by: Di Shen Cc: 4.17+ # 4.17+ Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/thermal/thermal_sysfs.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) --- a/drivers/thermal/thermal_sysfs.c +++ b/drivers/thermal/thermal_sysfs.c @@ -813,12 +813,13 @@ static const struct attribute_group cool =20 static void cooling_device_stats_setup(struct thermal_cooling_device *cdev) { + const struct attribute_group *stats_attr_group =3D NULL; struct cooling_dev_stats *stats; unsigned long states; int var; =20 if (cdev->ops->get_max_state(cdev, &states)) - return; + goto out; =20 states++; /* Total number of states is highest state + 1 */ =20 @@ -828,7 +829,7 @@ static void cooling_device_stats_setup(s =20 stats =3D kzalloc(var, GFP_KERNEL); if (!stats) - return; + goto out; =20 stats->time_in_state =3D (ktime_t *)(stats + 1); stats->trans_table =3D (unsigned int *)(stats->time_in_state + states); @@ -838,9 +839,12 @@ static void cooling_device_stats_setup(s =20 spin_lock_init(&stats->lock); =20 + stats_attr_group =3D &cooling_device_stats_attr_group; + +out: /* Fill the empty slot left in cooling_device_attr_groups */ var =3D ARRAY_SIZE(cooling_device_attr_groups) - 2; - cooling_device_attr_groups[var] =3D &cooling_device_stats_attr_group; + cooling_device_attr_groups[var] =3D stats_attr_group; } =20 static void cooling_device_stats_destroy(struct thermal_cooling_device *cd= ev) From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8029C00140 for ; Mon, 15 Aug 2022 18:18:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233728AbiHOSSE (ORCPT ); Mon, 15 Aug 2022 14:18:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233694AbiHOSRG (ORCPT ); Mon, 15 Aug 2022 14:17:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C5632A95F; Mon, 15 Aug 2022 11:15: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 BF827B81063; Mon, 15 Aug 2022 18:15:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 009FBC433C1; Mon, 15 Aug 2022 18:15:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587308; bh=srz8143zkM9lvsMiZNve4c7EgZK6tCW2Vj7c/1l3Lv4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HEkMdUGwQof6P84e3rCEOWMWlZxg+QwavN4kWSYuF3sR6HeHb4W4JTscF7Z2ro8sF 3Rb4++urJ5MAr4RG/cWqKROOgXlpeYErSKfSdCTkugGhL92VOPLy5Tu4sM66SrENrq d2SWMonwuLahgvXN47MwFQYtp9jE8G7yCK8eik8M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Vetter , Helge Deller Subject: [PATCH 5.15 043/779] fbcon: Fix boundary checks for fbcon=vc:n1-n2 parameters Date: Mon, 15 Aug 2022 19:54:47 +0200 Message-Id: <20220815180339.087555885@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 cad564ca557f8d3bb3b1fa965d9a2b3f6490ec69 upstream. The user may use the fbcon=3Dvc:- option to tell fbcon to take over the given range (n1...n2) of consoles. The value for n1 and n2 needs to be a positive number and up to (MAX_NR_CONSOLES - 1). The given values were not fully checked against those boundaries yet. To fix the issue, convert first_fb_vc and last_fb_vc to unsigned integers and check them against the upper boundary, and make sure that first_fb_vc is smaller than last_fb_vc. Cc: stable@vger.kernel.org # v4.19+ Reviewed-by: Daniel Vetter Signed-off-by: Helge Deller Link: https://patchwork.freedesktop.org/patch/msgid/YpkYRMojilrtZIgM@p100 Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/video/fbdev/core/fbcon.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -115,8 +115,8 @@ static int logo_lines; enums. */ static int logo_shown =3D FBCON_LOGO_CANSHOW; /* console mappings */ -static int first_fb_vc; -static int last_fb_vc =3D MAX_NR_CONSOLES - 1; +static unsigned int first_fb_vc; +static unsigned int last_fb_vc =3D MAX_NR_CONSOLES - 1; static int fbcon_is_default =3D 1;=20 static int primary_device =3D -1; static int fbcon_has_console_bind; @@ -464,10 +464,12 @@ static int __init fb_console_setup(char options +=3D 3; if (*options) first_fb_vc =3D simple_strtoul(options, &options, 10) - 1; - if (first_fb_vc < 0) + if (first_fb_vc >=3D MAX_NR_CONSOLES) first_fb_vc =3D 0; if (*options++ =3D=3D '-') last_fb_vc =3D simple_strtoul(options, &options, 10) - 1; + if (last_fb_vc < first_fb_vc || last_fb_vc >=3D MAX_NR_CONSOLES) + last_fb_vc =3D MAX_NR_CONSOLES - 1; fbcon_is_default =3D 0;=20 continue; } From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9130BC00140 for ; Mon, 15 Aug 2022 18:18:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239668AbiHOSSI (ORCPT ); Mon, 15 Aug 2022 14:18:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239478AbiHOSRP (ORCPT ); Mon, 15 Aug 2022 14:17: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 25B74B7; Mon, 15 Aug 2022 11:15: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 AD47AB8106C; Mon, 15 Aug 2022 18:15:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AC6AC433C1; Mon, 15 Aug 2022 18:15:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587311; bh=d0+uaXnzk2ajdnldlX+pjv1VYjPMK/590gVPt1rVsX0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LtWBUY2jtftIbQcGoXND4Z1xHJSwwPTeyoxqxM4XJnpj/tJwmBNuJS36ixoQWiNWK rU+o6HvTdTliyA9IgnKLuOZ5w2PULI4+1ycW3ihNhUAuanGgQx7nsBo9kBVODyZB8k g1+czifNltXz8FOjvfTtxUTn9HBrqh5Tckgp1XJY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Vetter , Helge Deller Subject: [PATCH 5.15 044/779] fbcon: Fix accelerated fbdev scrolling while logo is still shown Date: Mon, 15 Aug 2022 19:54:48 +0200 Message-Id: <20220815180339.129054379@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 3866cba87dcd0162fb41e9b3b653d0af68fad5ec upstream. There is no need to directly skip over to the SCROLL_REDRAW case while the logo is still shown. When using DRM, this change has no effect because the code will reach the SCROLL_REDRAW case immediately anyway. But if you run an accelerated fbdev driver and have FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION enabled, console scrolling is slowed down by factors so that it feels as if you use a 9600 baud terminal. So, drop those unnecessary checks and speed up fbdev console acceleration during bootup. Cc: stable@vger.kernel.org # v5.10+ Acked-by: Daniel Vetter Signed-off-by: Helge Deller Link: https://patchwork.freedesktop.org/patch/msgid/YpkYxk7wsBPx3po+@p100 Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/video/fbdev/core/fbcon.c | 4 ---- 1 file changed, 4 deletions(-) --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -1706,8 +1706,6 @@ static bool fbcon_scroll(struct vc_data case SM_UP: if (count > vc->vc_rows) /* Maximum realistic size */ count =3D vc->vc_rows; - if (logo_shown >=3D 0) - goto redraw_up; switch (fb_scrollmode(p)) { case SCROLL_MOVE: fbcon_redraw_blit(vc, info, p, t, b - t - count, @@ -1796,8 +1794,6 @@ static bool fbcon_scroll(struct vc_data case SM_DOWN: if (count > vc->vc_rows) /* Maximum realistic size */ count =3D vc->vc_rows; - if (logo_shown >=3D 0) - goto redraw_down; switch (fb_scrollmode(p)) { case SCROLL_MOVE: fbcon_redraw_blit(vc, info, p, b - 1, b - t - count, From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31EF4C00140 for ; Mon, 15 Aug 2022 18:18:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239544AbiHOSSL (ORCPT ); Mon, 15 Aug 2022 14:18:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239768AbiHOSRQ (ORCPT ); Mon, 15 Aug 2022 14:17: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 07F0CB2C; Mon, 15 Aug 2022 11:15: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 5EF9761283; Mon, 15 Aug 2022 18:15:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E749CC433C1; Mon, 15 Aug 2022 18:15:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587314; bh=uPE81RVHTXOJIkDXOeB2I6nlKdQ/clPIsr9AFwx3Y2E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BxF+z61coFn9xWXUMfo003mNy0g5ehUUcxhIDe+IHiXSwiTcrb0lmgRut5zhTUyav BPeWmAOzpwrZF2+zVpOgk5R6aYvdfYF1uiHHW+M1fY82s3QtFl+Bzy+m/538qmTBiB DS2sxGgpOasNdgPdIbBaSj6cKt0lqguQzpOTNRVc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jann Horn , Oleksij Rempel , Lukas Wunner , Oliver Neukum , Jakub Kicinski Subject: [PATCH 5.15 045/779] usbnet: Fix linkwatch use-after-free on disconnect Date: Mon, 15 Aug 2022 19:54:49 +0200 Message-Id: <20220815180339.176315586@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lukas Wunner commit a69e617e533edddf3fa3123149900f36e0a6dc74 upstream. usbnet uses the work usbnet_deferred_kevent() to perform tasks which may sleep. On disconnect, completion of the work was originally awaited in ->ndo_stop(). But in 2003, that was moved to ->disconnect() by historic commit "[PATCH] USB: usbnet, prevent exotic rtnl deadlock": https://git.kernel.org/tglx/history/c/0f138bbfd83c The change was made because back then, the kernel's workqueue implementation did not allow waiting for a single work. One had to wait for completion of *all* work by calling flush_scheduled_work(), and that could deadlock when waiting for usbnet_deferred_kevent() with rtnl_mutex held in ->ndo_stop(). The commit solved one problem but created another: It causes a use-after-free in USB Ethernet drivers aqc111.c, asix_devices.c, ax88179_178a.c, ch9200.c and smsc75xx.c: * If the drivers receive a link change interrupt immediately before disconnect, they raise EVENT_LINK_RESET in their (non-sleepable) ->status() callback and schedule usbnet_deferred_kevent(). * usbnet_deferred_kevent() invokes the driver's ->link_reset() callback, which calls netif_carrier_{on,off}(). * That in turn schedules the work linkwatch_event(). Because usbnet_deferred_kevent() is awaited after unregister_netdev(), netif_carrier_{on,off}() may operate on an unregistered netdev and linkwatch_event() may run after free_netdev(), causing a use-after-free. In 2010, usbnet was changed to only wait for a single instance of usbnet_deferred_kevent() instead of *all* work by commit 23f333a2bfaf ("drivers/net: don't use flush_scheduled_work()"). Unfortunately the commit neglected to move the wait back to ->ndo_stop(). Rectify that omission at long last. Reported-by: Jann Horn Link: https://lore.kernel.org/netdev/CAG48ez0MHBbENX5gCdHAUXZ7h7s20LnepBF-p= a5M=3D7Bi-jZrEA@mail.gmail.com/ Reported-by: Oleksij Rempel Link: https://lore.kernel.org/netdev/20220315113841.GA22337@pengutronix.de/ Signed-off-by: Lukas Wunner Cc: stable@vger.kernel.org Acked-by: Oliver Neukum Link: https://lore.kernel.org/r/d1c87ebe9fc502bffcd1576e238d685ad08321e4.16= 55987888.git.lukas@wunner.de Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/usb/usbnet.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -847,13 +847,11 @@ int usbnet_stop (struct net_device *net) =20 mpn =3D !test_and_clear_bit(EVENT_NO_RUNTIME_PM, &dev->flags); =20 - /* deferred work (task, timer, softirq) must also stop. - * can't flush_scheduled_work() until we drop rtnl (later), - * else workers could deadlock; so make workers a NOP. - */ + /* deferred work (timer, softirq, task) must also stop */ dev->flags =3D 0; del_timer_sync (&dev->delay); tasklet_kill (&dev->bh); + cancel_work_sync(&dev->kevent); if (!pm) usb_autopm_put_interface(dev->intf); =20 @@ -1617,8 +1615,6 @@ void usbnet_disconnect (struct usb_inter net =3D dev->net; unregister_netdev (net); =20 - cancel_work_sync(&dev->kevent); - usb_scuttle_anchored_urbs(&dev->deferred); =20 if (dev->driver_info->unbind) From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7C9AC25B0E for ; Mon, 15 Aug 2022 18:18:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238802AbiHOSSY (ORCPT ); Mon, 15 Aug 2022 14:18:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239614AbiHOSRm (ORCPT ); Mon, 15 Aug 2022 14:17:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E5435FAF; Mon, 15 Aug 2022 11:15:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 88C33B81071; Mon, 15 Aug 2022 18:15:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A67AC433C1; Mon, 15 Aug 2022 18:15:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587318; bh=nWz37meKbo+peJBGyeJLJsBcFELwh28xHN20ySPVPcE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JUOvG7P0BR8lrTWetxrjJpj9bmbo2C70mPXAdkwIn7pyVu37UkJXnyMrgOfgAIc4x 85IvsGgZOxJkEyhpLDbnXprhMxGK7WbMMfnOg9YMXSgORCMT/v59kpjF8GM8QtHKAU J0K287lnJSrIGB2KUzlEunPCtttgtMSZj5Mu5XtA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeff Layton , "Christian Brauner (Microsoft)" , Al Viro , stable@kernel.org Subject: [PATCH 5.15 046/779] fix short copy handling in copy_mc_pipe_to_iter() Date: Mon, 15 Aug 2022 19:54:50 +0200 Message-Id: <20220815180339.215030436@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Al Viro commit c3497fd009ef2c59eea60d21c3ac22de3585ed7d upstream. Unlike other copying operations on ITER_PIPE, copy_mc_to_iter() can result in a short copy. In that case we need to trim the unused buffers, as well as the length of partially filled one - it's not enough to set ->head, ->iov_offset and ->count to reflect how much had we copied. Not hard to fix, fortunately... I'd put a helper (pipe_discard_from(pipe, head)) into pipe_fs_i.h, rather than iov_iter.c - it has nothing to do with iov_iter and having it will allow us to avoid an ugly kludge in fs/splice.c. We could put it into lib/iov_iter.c for now and move it later, but I don't see the point going that way... Cc: stable@kernel.org # 4.19+ Fixes: ca146f6f091e "lib/iov_iter: Fix pipe handling in _copy_to_iter_mcsaf= e()" Reviewed-by: Jeff Layton Reviewed-by: Christian Brauner (Microsoft) Signed-off-by: Al Viro Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- include/linux/pipe_fs_i.h | 9 +++++++++ lib/iov_iter.c | 15 +++++++++++---- 2 files changed, 20 insertions(+), 4 deletions(-) --- a/include/linux/pipe_fs_i.h +++ b/include/linux/pipe_fs_i.h @@ -229,6 +229,15 @@ static inline bool pipe_buf_try_steal(st return buf->ops->try_steal(pipe, buf); } =20 +static inline void pipe_discard_from(struct pipe_inode_info *pipe, + unsigned int old_head) +{ + unsigned int mask =3D pipe->ring_size - 1; + + while (pipe->head > old_head) + pipe_buf_release(pipe, &pipe->bufs[--pipe->head & mask]); +} + /* Differs from PIPE_BUF in that PIPE_SIZE is the length of the actual memory allocation, whereas PIPE_BUF makes atomicity guarantees. */ #define PIPE_SIZE PAGE_SIZE --- a/lib/iov_iter.c +++ b/lib/iov_iter.c @@ -691,6 +691,7 @@ static size_t copy_mc_pipe_to_iter(const struct pipe_inode_info *pipe =3D i->pipe; unsigned int p_mask =3D pipe->ring_size - 1; unsigned int i_head; + unsigned int valid =3D pipe->head; size_t n, off, xfer =3D 0; =20 if (!sanity(i)) @@ -704,11 +705,17 @@ static size_t copy_mc_pipe_to_iter(const rem =3D copy_mc_to_kernel(p + off, addr + xfer, chunk); chunk -=3D rem; kunmap_local(p); - i->head =3D i_head; - i->iov_offset =3D off + chunk; - xfer +=3D chunk; - if (rem) + if (chunk) { + i->head =3D i_head; + i->iov_offset =3D off + chunk; + xfer +=3D chunk; + valid =3D i_head + 1; + } + if (rem) { + pipe->bufs[i_head & p_mask].len -=3D rem; + pipe_discard_from(pipe, valid); break; + } n -=3D chunk; off =3D 0; i_head++; From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0EDAEC00140 for ; Mon, 15 Aug 2022 18:18:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239969AbiHOSSg (ORCPT ); Mon, 15 Aug 2022 14:18:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233476AbiHOSR7 (ORCPT ); Mon, 15 Aug 2022 14:17: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 E6B3612767; Mon, 15 Aug 2022 11:15: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 8424C61272; Mon, 15 Aug 2022 18:15:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B7EDC433C1; Mon, 15 Aug 2022 18:15:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587323; bh=buQXgdihAZQFIjgmqnCjRRerLiW5pM93FNA+Se/f4xY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MeI8fg0HLGNxtHGPrcXZMqYGFglAodFxT000QbAVDWBBE+FR/GpNHh73oiYY2fGSA SAAMUGeq4J/U55aOVTBlnbdZ+EXcorfas7eTzWQ/UAo3TaLBrKbvejNzsVYAxeIW1o rNCAoIVrHVlHWNfWO1B+uDbgLn7P1/ldTVtIR91k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Nguyen , David Rientjes , Peter Gonda , John Allen , Herbert Xu Subject: [PATCH 5.15 047/779] crypto: ccp - Use kzalloc for sev ioctl interfaces to prevent kernel memory leak Date: Mon, 15 Aug 2022 19:54:51 +0200 Message-Id: <20220815180339.263122505@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: John Allen commit 13dc15a3f5fd7f884e4bfa8c011a0ae868df12ae upstream. For some sev ioctl interfaces, input may be passed that is less than or equal to SEV_FW_BLOB_MAX_SIZE, but larger than the data that PSP firmware returns. In this case, kmalloc will allocate memory that is the size of the input rather than the size of the data. Since PSP firmware doesn't fully overwrite the buffer, the sev ioctl interfaces with the issue may return uninitialized slab memory. Currently, all of the ioctl interfaces in the ccp driver are safe, but to prevent future problems, change all ioctl interfaces that allocate memory with kmalloc to use kzalloc and memset the data buffer to zero in sev_ioctl_do_platform_status. Fixes: 38103671aad3 ("crypto: ccp: Use the stack and common buffer for stat= us commands") Fixes: e799035609e15 ("crypto: ccp: Implement SEV_PEK_CSR ioctl command") Fixes: 76a2b524a4b1d ("crypto: ccp: Implement SEV_PDH_CERT_EXPORT ioctl com= mand") Fixes: d6112ea0cb344 ("crypto: ccp - introduce SEV_GET_ID2 command") Cc: stable@vger.kernel.org Reported-by: Andy Nguyen Suggested-by: David Rientjes Suggested-by: Peter Gonda Signed-off-by: John Allen Reviewed-by: Peter Gonda Acked-by: David Rientjes Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/crypto/ccp/sev-dev.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/drivers/crypto/ccp/sev-dev.c +++ b/drivers/crypto/ccp/sev-dev.c @@ -388,6 +388,8 @@ static int sev_ioctl_do_platform_status( struct sev_user_data_status data; int ret; =20 + memset(&data, 0, sizeof(data)); + ret =3D __sev_do_cmd_locked(SEV_CMD_PLATFORM_STATUS, &data, &argp->error); if (ret) return ret; @@ -441,7 +443,7 @@ static int sev_ioctl_do_pek_csr(struct s if (input.length > SEV_FW_BLOB_MAX_SIZE) return -EFAULT; =20 - blob =3D kmalloc(input.length, GFP_KERNEL); + blob =3D kzalloc(input.length, GFP_KERNEL); if (!blob) return -ENOMEM; =20 @@ -665,7 +667,7 @@ static int sev_ioctl_do_get_id2(struct s input_address =3D (void __user *)input.address; =20 if (input.address && input.length) { - id_blob =3D kmalloc(input.length, GFP_KERNEL); + id_blob =3D kzalloc(input.length, GFP_KERNEL); if (!id_blob) return -ENOMEM; =20 @@ -784,14 +786,14 @@ static int sev_ioctl_do_pdh_export(struc if (input.cert_chain_len > SEV_FW_BLOB_MAX_SIZE) return -EFAULT; =20 - pdh_blob =3D kmalloc(input.pdh_cert_len, GFP_KERNEL); + pdh_blob =3D kzalloc(input.pdh_cert_len, GFP_KERNEL); if (!pdh_blob) return -ENOMEM; =20 data.pdh_cert_address =3D __psp_pa(pdh_blob); data.pdh_cert_len =3D input.pdh_cert_len; =20 - cert_blob =3D kmalloc(input.cert_chain_len, GFP_KERNEL); + cert_blob =3D kzalloc(input.cert_chain_len, GFP_KERNEL); if (!cert_blob) { ret =3D -ENOMEM; goto e_free_pdh; From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF608C00140 for ; Mon, 15 Aug 2022 18:18:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239992AbiHOSSk (ORCPT ); Mon, 15 Aug 2022 14:18:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237536AbiHOSSD (ORCPT ); Mon, 15 Aug 2022 14:18:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1424F17E04; Mon, 15 Aug 2022 11:15: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 9D52361297; Mon, 15 Aug 2022 18:15:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83640C433C1; Mon, 15 Aug 2022 18:15:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587327; bh=pqBJ1NWS1RN2vBwc3PaPKuwfdOzMrRfU7YsQ6GivFJc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0pm2LJitC7LbG7Dn98PybIzqqShzGYmIjpG7vYP1KvrJJFGE4Vqdc18knIlgNlJf/ acoFONb9q+W8eDfmdpQbe5c4hGWl9UVEmsJNsubcm68Sn53aNt6ALCaQW87UW+3c3r WgfVVAvGdAehMTdCn6XqyShPWSTSGhhBpb/wdtg4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hongbo Yin , Jiachen Zhang , Tianci Zhang , Miklos Szeredi Subject: [PATCH 5.15 048/779] ovl: drop WARN_ON() dentry is NULL in ovl_encode_fh() Date: Mon, 15 Aug 2022 19:54:52 +0200 Message-Id: <20220815180339.315242744@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiachen Zhang commit dd524b7f317de8d31d638cbfdc7be4cf9b770e42 upstream. Some code paths cannot guarantee the inode have any dentry alias. So WARN_ON() all !dentry may flood the kernel logs. For example, when an overlayfs inode is watched by inotifywait (1), and someone is trying to read the /proc/$(pidof inotifywait)/fdinfo/INOTIFY_FD, at that time if the dentry has been reclaimed by kernel (such as echo 2 > /proc/sys/vm/drop_caches), there will be a WARN_ON(). The printed call stack would be like: ? show_mark_fhandle+0xf0/0xf0 show_mark_fhandle+0x4a/0xf0 ? show_mark_fhandle+0xf0/0xf0 ? seq_vprintf+0x30/0x50 ? seq_printf+0x53/0x70 ? show_mark_fhandle+0xf0/0xf0 inotify_fdinfo+0x70/0x90 show_fdinfo.isra.4+0x53/0x70 seq_show+0x130/0x170 seq_read+0x153/0x440 vfs_read+0x94/0x150 ksys_read+0x5f/0xe0 do_syscall_64+0x59/0x1e0 entry_SYSCALL_64_after_hwframe+0x44/0xa9 So let's drop WARN_ON() to avoid kernel log flooding. Reported-by: Hongbo Yin Signed-off-by: Jiachen Zhang Signed-off-by: Tianci Zhang Fixes: 8ed5eec9d6c4 ("ovl: encode pure upper file handles") Cc: # v4.16 Signed-off-by: Miklos Szeredi Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/overlayfs/export.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/overlayfs/export.c +++ b/fs/overlayfs/export.c @@ -259,7 +259,7 @@ static int ovl_encode_fh(struct inode *i return FILEID_INVALID; =20 dentry =3D d_find_any_alias(inode); - if (WARN_ON(!dentry)) + if (!dentry) return FILEID_INVALID; =20 bytes =3D ovl_dentry_to_fid(ofs, dentry, fid, buflen); From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F5FEC00140 for ; Mon, 15 Aug 2022 18:18:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240015AbiHOSSp (ORCPT ); Mon, 15 Aug 2022 14:18:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239338AbiHOSSE (ORCPT ); Mon, 15 Aug 2022 14:18:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EF1F29CB3; Mon, 15 Aug 2022 11:15: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 6B9C5B8106C; Mon, 15 Aug 2022 18:15:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B08B1C433C1; Mon, 15 Aug 2022 18:15:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587330; bh=7M4uIosGCQ+JVXn5ixS/gPXhPLLzxgVy6nzH25ETjwQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tRa0nHXKGemcUISD3zEAf1+a+FN7Q4793RVnDXT5qNZnh04bznHPEJDkUXzs8D9yA R8DeCYBVU+LitPB8GwUjtSZEfF3hyNLOQqmgjNG4FFBiD5WEv5QPqGc8vrgpMmYjd3 k+g4acfbtYFtuiurEidLbHR4b7q/un0AT9L4oBnE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Helge Deller Subject: [PATCH 5.15 049/779] parisc: Fix device names in /proc/iomem Date: Mon, 15 Aug 2022 19:54:53 +0200 Message-Id: <20220815180339.365686298@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 cab56b51ec0e69128909cef4650e1907248d821b upstream. Fix the output of /proc/iomem to show the real hardware device name including the pa_pathname, e.g. "Merlin 160 Core Centronics [8:16:0]". Up to now only the pa_pathname ("[8:16.0]") was shown. Signed-off-by: Helge Deller Cc: # v4.9+ Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/parisc/kernel/drivers.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) --- a/arch/parisc/kernel/drivers.c +++ b/arch/parisc/kernel/drivers.c @@ -520,7 +520,6 @@ alloc_pa_dev(unsigned long hpa, struct h dev->id.hversion_rev =3D iodc_data[1] & 0x0f; dev->id.sversion =3D ((iodc_data[4] & 0x0f) << 16) | (iodc_data[5] << 8) | iodc_data[6]; - dev->hpa.name =3D parisc_pathname(dev); dev->hpa.start =3D hpa; /* This is awkward. The STI spec says that gfx devices may occupy * 32MB or 64MB. Unfortunately, we don't know how to tell whether @@ -534,10 +533,10 @@ alloc_pa_dev(unsigned long hpa, struct h dev->hpa.end =3D hpa + 0xfff; } dev->hpa.flags =3D IORESOURCE_MEM; - name =3D parisc_hardware_description(&dev->id); - if (name) { - strlcpy(dev->name, name, sizeof(dev->name)); - } + dev->hpa.name =3D dev->name; + name =3D parisc_hardware_description(&dev->id) ? : "unknown"; + snprintf(dev->name, sizeof(dev->name), "%s [%s]", + name, parisc_pathname(dev)); =20 /* Silently fail things like mouse ports which are subsumed within * the keyboard controller From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7AB5EC25B0E for ; Mon, 15 Aug 2022 18:18:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240061AbiHOSSy (ORCPT ); Mon, 15 Aug 2022 14:18:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239691AbiHOSSI (ORCPT ); Mon, 15 Aug 2022 14:18: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 1B08B2AC40; Mon, 15 Aug 2022 11:15:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9C68F61272; Mon, 15 Aug 2022 18:15:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0664C433D6; Mon, 15 Aug 2022 18:15:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587333; bh=Hj2VRfh6l+0bYXZiuS4Jicnepy2jhNUCZaTtPzPVioo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1bq+VyeSrozPC/3b/mj8mZKsXDvrzSiAL92HgCMPi5ln5Ei/QBKo+iE1V2cgBkVcn F3EDqe6rFf45Fqalr4dc4NnIp7od8IEOH66vT6Bao0YxZnm4eM1BnF1omQ9G/rNTEw Dbao8wLxA5HBHu6kO6bDXwCKDtmr96eKrRoeHnwc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Helge Deller , kernel test robot Subject: [PATCH 5.15 050/779] parisc: Drop pa_swapper_pg_lock spinlock Date: Mon, 15 Aug 2022 19:54:54 +0200 Message-Id: <20220815180339.413591609@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 3fbc9a7de0564c55d8a9584c9cd2c9dfe6bd6d43 upstream. This spinlock was dropped with commit b7795074a046 ("parisc: Optimize per-pagetable spinlocks") in kernel v5.12. Remove it to silence a sparse warning. Signed-off-by: Helge Deller Reported-by: kernel test robot Cc: # v5.12+ Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/parisc/kernel/cache.c | 3 --- 1 file changed, 3 deletions(-) --- a/arch/parisc/kernel/cache.c +++ b/arch/parisc/kernel/cache.c @@ -46,9 +46,6 @@ void flush_icache_page_asm(unsigned long */ DEFINE_SPINLOCK(pa_tlb_flush_lock); =20 -/* Swapper page setup lock. */ -DEFINE_SPINLOCK(pa_swapper_pg_lock); - #if defined(CONFIG_64BIT) && defined(CONFIG_SMP) int pa_serialize_tlb_flushes __ro_after_init; #endif From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85621C25B0E for ; Mon, 15 Aug 2022 18:19:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240101AbiHOSS6 (ORCPT ); Mon, 15 Aug 2022 14:18:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239768AbiHOSSP (ORCPT ); Mon, 15 Aug 2022 14:18: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 B0E622AC72; Mon, 15 Aug 2022 11:15: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 73D45B80F99; Mon, 15 Aug 2022 18:15:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B33D7C433C1; Mon, 15 Aug 2022 18:15:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587336; bh=Muz+6devd5UaSOJcMQZ9LRIIl260cRIsDAwDtiF54MI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IEOWEzZL325wHuNsKLTWQ+wJbcFpuwV1RUg3QSBlq1kDbtkLcK5nMXwrvQfHvKZiL dLXaglrG1hMcnPM1OVjeM7TFm6bbEZ6zSly3NcddCVC7tA3D7yAIJzgSdUfySfVo6E fnYnkc1SN+O8kk/ovYjgr8OcJKJbosOgPDp/rgvE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hacash Robot , William Dean , Helge Deller Subject: [PATCH 5.15 051/779] parisc: Check the return value of ioremap() in lba_driver_probe() Date: Mon, 15 Aug 2022 19:54:55 +0200 Message-Id: <20220815180339.461010784@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: William Dean commit cf59f34d7f978d14d6520fd80a78a5ad5cb8abf8 upstream. The function ioremap() in lba_driver_probe() can fail, so its return value should be checked. Fixes: 4bdc0d676a643 ("remove ioremap_nocache and devm_ioremap_nocache") Reported-by: Hacash Robot Signed-off-by: William Dean Signed-off-by: Helge Deller Cc: # v5.6+ Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/parisc/lba_pci.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/drivers/parisc/lba_pci.c +++ b/drivers/parisc/lba_pci.c @@ -1476,9 +1476,13 @@ lba_driver_probe(struct parisc_device *d u32 func_class; void *tmp_obj; char *version; - void __iomem *addr =3D ioremap(dev->hpa.start, 4096); + void __iomem *addr; int max; =20 + addr =3D ioremap(dev->hpa.start, 4096); + if (addr =3D=3D NULL) + return -ENOMEM; + /* Read HW Rev First */ func_class =3D READ_REG32(addr + LBA_FCLASS); From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3AB5EC25B08 for ; Mon, 15 Aug 2022 18:24:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241449AbiHOSYR (ORCPT ); Mon, 15 Aug 2022 14:24:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240177AbiHOSXn (ORCPT ); Mon, 15 Aug 2022 14:23: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 1D4A02E9F4; Mon, 15 Aug 2022 11:17: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 6EACBB81072; Mon, 15 Aug 2022 18:17:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A84E2C433D6; Mon, 15 Aug 2022 18:17:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587466; bh=7pMGTLfm7+yf402Et0WC41HMCYeZJIfscGaDIL9XAwM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nwWhYpjHB3LDlJoPW1OYwI5XnRHRy0PUymWYKjw8pgTDETVLpgH0jeY8HdthP+9U5 77l4F9nrj3c/3w0xEmeudY3ktGOtN+gbEqC4MvJc6pHRo+Y5vwggmDmVrMNrxl3K3v J+DtTquH6xw5MMW9IutKJN+tf1jJuKswx5BYVQeM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Helge Deller Subject: [PATCH 5.15 052/779] parisc: io_pgetevents_time64() needs compat syscall in 32-bit compat mode Date: Mon, 15 Aug 2022 19:54:56 +0200 Message-Id: <20220815180339.493755603@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 6431e92fc827bdd2d28f79150d90415ba9ce0d21 upstream. For all syscalls in 32-bit compat mode on 64-bit kernels the upper 32-bits of the 64-bit registers are zeroed out, so a negative 32-bit signed value will show up as positive 64-bit signed value. This behaviour breaks the io_pgetevents_time64() syscall which expects signed 64-bit values for the "min_nr" and "nr" parameters. Fix this by switching to the compat_sys_io_pgetevents_time64() syscall, which uses "compat_long_t" types for those parameters. Cc: # v5.1+ Signed-off-by: Helge Deller Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/parisc/kernel/syscalls/syscall.tbl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/parisc/kernel/syscalls/syscall.tbl +++ b/arch/parisc/kernel/syscalls/syscall.tbl @@ -413,7 +413,7 @@ 412 32 utimensat_time64 sys_utimensat sys_utimensat 413 32 pselect6_time64 sys_pselect6 compat_sys_pselect6_time64 414 32 ppoll_time64 sys_ppoll compat_sys_ppoll_time64 -416 32 io_pgetevents_time64 sys_io_pgetevents sys_io_pgetevents +416 32 io_pgetevents_time64 sys_io_pgetevents compat_sys_io_pgetevents_t= ime64 417 32 recvmmsg_time64 sys_recvmmsg compat_sys_recvmmsg_time64 418 32 mq_timedsend_time64 sys_mq_timedsend sys_mq_timedsend 419 32 mq_timedreceive_time64 sys_mq_timedreceive sys_mq_timedreceive From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFC91C00140 for ; Mon, 15 Aug 2022 18:19:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240283AbiHOSTg (ORCPT ); Mon, 15 Aug 2022 14:19:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233479AbiHOSSZ (ORCPT ); Mon, 15 Aug 2022 14:18: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 947282B279; Mon, 15 Aug 2022 11:16: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 4E676B8106C; Mon, 15 Aug 2022 18:16:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9093EC433C1; Mon, 15 Aug 2022 18:15:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587360; bh=h2a++vB7rUxdHLPrp5od/YYDptU4FG5vuzzKULCmoS4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EUln6dXNOR3sp6RKvoLLBPcX9/8ufaNcNi7VvniOExxqI/G3x7nKsJV4Fnd92mjz+ OV7x8MhgDJjKcCKb2Ny556rWrwet1B3hh2Vj+YUdGBe7/hBAwIOac3xZoJIud6MxSf DYpsed7RGjuVh513iVe7uNr8EoPx6NA/uJhGdz0U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yipeng Zou , Guo Ren , Palmer Dabbelt Subject: [PATCH 5.15 053/779] riscv:uprobe fix SR_SPIE set/clear handling Date: Mon, 15 Aug 2022 19:54:57 +0200 Message-Id: <20220815180339.528971437@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yipeng Zou commit 3dbe5829408bc1586f75b4667ef60e5aab0209c7 upstream. In riscv the process of uprobe going to clear spie before exec the origin insn,and set spie after that.But When access the page which origin insn has been placed a page fault may happen and irq was disabled in arch_uprobe_pre_xol function,It cause a WARN as follows. There is no need to clear/set spie in arch_uprobe_pre/post/abort_xol. We can just remove it. [ 31.684157] BUG: sleeping function called from invalid context at kernel= /locking/rwsem.c:1488 [ 31.684677] in_atomic(): 0, irqs_disabled(): 1, non_block: 0, pid: 76, n= ame: work [ 31.684929] preempt_count: 0, expected: 0 [ 31.685969] CPU: 2 PID: 76 Comm: work Tainted: G [ 31.686542] Hardware name: riscv-virtio,qemu (DT) [ 31.686797] Call Trace: [ 31.687053] [] dump_backtrace+0x30/0x38 [ 31.687699] [] show_stack+0x40/0x4c [ 31.688141] [] dump_stack_lvl+0x44/0x5c [ 31.688396] [] dump_stack+0x18/0x20 [ 31.688653] [] __might_resched+0x114/0x122 [ 31.688948] [] __might_sleep+0x50/0x7a [ 31.689435] [] down_read+0x30/0x130 [ 31.689728] [] do_page_fault+0x166/x446 [ 31.689997] [] ret_from_exception+0x0/0xc Fixes: 74784081aac8 ("riscv: Add uprobes supported") Signed-off-by: Yipeng Zou Reviewed-by: Guo Ren Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220721065820.245755-1-zouyipeng@huawei.com Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/riscv/kernel/probes/uprobes.c | 6 ------ 1 file changed, 6 deletions(-) --- a/arch/riscv/kernel/probes/uprobes.c +++ b/arch/riscv/kernel/probes/uprobes.c @@ -59,8 +59,6 @@ int arch_uprobe_pre_xol(struct arch_upro =20 instruction_pointer_set(regs, utask->xol_vaddr); =20 - regs->status &=3D ~SR_SPIE; - return 0; } =20 @@ -72,8 +70,6 @@ int arch_uprobe_post_xol(struct arch_upr =20 instruction_pointer_set(regs, utask->vaddr + auprobe->insn_size); =20 - regs->status |=3D SR_SPIE; - return 0; } =20 @@ -111,8 +107,6 @@ void arch_uprobe_abort_xol(struct arch_u * address. */ instruction_pointer_set(regs, utask->vaddr); - - regs->status &=3D ~SR_SPIE; } =20 bool arch_uretprobe_is_alive(struct return_instance *ret, enum rp_check ct= x, From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C042EC00140 for ; Mon, 15 Aug 2022 18:21:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240509AbiHOSVU (ORCPT ); Mon, 15 Aug 2022 14:21:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240054AbiHOSUB (ORCPT ); Mon, 15 Aug 2022 14:20: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 D400A2C11B; Mon, 15 Aug 2022 11:16:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0B5C7B81063; Mon, 15 Aug 2022 18:16:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F7DFC433D7; Mon, 15 Aug 2022 18:16:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587391; bh=hOfkL8bzpuf9W2WYWCtIcFLDb5Zso9JhM0Z5gYPhA08=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KNMVZNCmLfx6t/h3ryEwycZ0IEp/pt83OvBCEe5VVXipEXSbWvtikMTPBlwEaeMnp f0axUTu5x937OJPFI+t0sI3qc4Vcz4Hc++0U9afvboBZEyVBMKIHyGL33RpWnfQBM3 XLf0sqbZarFyexkXQEzJe3pPn3uJeWLSsv3skJ3M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Atul Khare , Conor Dooley , Krzysztof Kozlowski , Palmer Dabbelt Subject: [PATCH 5.15 054/779] dt-bindings: riscv: fix SiFive l2-caches cache-sets Date: Mon, 15 Aug 2022 19:54:58 +0200 Message-Id: <20220815180339.561978875@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 commit b60cf8e59e61133b6c9514ff8d8c8d7049d040ef upstream. Fix device tree schema validation error messages for the SiFive Unmatched: ' cache-sets:0:0: 1024 was expected'. The existing bindings allow for just 1024 cache-sets but the fu740 on Unmatched the has 2048 cache-sets. The ISA itself permits any arbitrary power of two, however this is not supported by dt-schema. The RTL for the IP, to which the number of cache-sets is a tunable parameter, has been released publicly so speculatively adding a small number of "reasonable" values seems unwise also. Instead, as the binding only supports two distinct controllers: add 2048 and explicitly lock it to the fu740's l2 cache while limiting 1024 to the l2 cache on the fu540. Fixes: af951c3a113b ("dt-bindings: riscv: Update l2 cache DT documentation = to add support for SiFive FU740") Reported-by: Atul Khare Signed-off-by: Conor Dooley Reviewed-by: Krzysztof Kozlowski Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220803185359.942928-1-mail@conchuod.ie Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- Documentation/devicetree/bindings/riscv/sifive-l2-cache.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/Documentation/devicetree/bindings/riscv/sifive-l2-cache.yaml +++ b/Documentation/devicetree/bindings/riscv/sifive-l2-cache.yaml @@ -47,7 +47,7 @@ properties: const: 2 =20 cache-sets: - const: 1024 + enum: [1024, 2048] =20 cache-size: const: 2097152 @@ -85,6 +85,8 @@ then: description: | Must contain entries for DirError, DataError and DataFail signals. maxItems: 3 + cache-sets: + const: 1024 =20 else: properties: @@ -92,6 +94,8 @@ else: description: | Must contain entries for DirError, DataError, DataFail, DirFail si= gnals. minItems: 4 + cache-sets: + const: 2048 =20 additionalProperties: false From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2FBBC25B08 for ; Mon, 15 Aug 2022 18:22:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241216AbiHOSWb (ORCPT ); Mon, 15 Aug 2022 14:22:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240957AbiHOSVz (ORCPT ); Mon, 15 Aug 2022 14:21: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 2D3ED2CE0F; Mon, 15 Aug 2022 11:17: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 1B1E7612AC; Mon, 15 Aug 2022 18:17:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1EAC3C433C1; Mon, 15 Aug 2022 18:17:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587424; bh=MDCh/HxD0hAu3zggr42UXO/ZmGAldUo04b2ov0rio/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wtzZaUjQMGH+jaF/vfkdgF48wC4pvf9DZnNbS/4zz4jjKh6p7wag3sDz4CwG/3oTG w1ruVPlu1ri7Zhv7Gw3FJ0G07KG5PUj/j0cHx8xGWBryrMsVOVnbO9z7tttYIpCFfn bbOLz/ERxxkXVCw/9sZ0mU2ip6tdNiJKSnf9vroE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guo Ren , Heiko Stuebner , Atish Patra , Xianting Tian , Palmer Dabbelt Subject: [PATCH 5.15 055/779] RISC-V: kexec: Fixup use of smp_processor_id() in preemptible context Date: Mon, 15 Aug 2022 19:54:59 +0200 Message-Id: <20220815180339.603743474@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 357628e68f5c08ad578a718dc62a0031e06dbe91 upstream. Use __smp_processor_id() to avoid check the preemption context when CONFIG_DEBUG_PREEMPT enabled, as we will enter crash kernel and no return. Without the patch, [ 103.781044] sysrq: Trigger a crash [ 103.784625] Kernel panic - not syncing: sysrq triggered crash [ 103.837634] CPU1: off [ 103.889668] CPU2: off [ 103.933479] CPU3: off [ 103.939424] Starting crashdump kernel... [ 103.943442] BUG: using smp_processor_id() in preemptible [00000000] code= : sh/346 [ 103.950884] caller is debug_smp_processor_id+0x1c/0x26 [ 103.956051] CPU: 0 PID: 346 Comm: sh Kdump: loaded Not tainted 5.10.113-= 00002-gce03f03bf4ec-dirty #149 [ 103.965355] Call Trace: [ 103.967805] [] walk_stackframe+0x0/0xa2 [ 103.973206] [] show_stack+0x32/0x3e [ 103.978258] [] dump_stack_lvl+0x72/0x8e [ 103.983655] [] dump_stack+0x14/0x1c [ 103.988705] [] check_preemption_disabled+0x9e/0xaa [ 103.995057] [] debug_smp_processor_id+0x1c/0x26 [ 104.001150] [] machine_kexec+0x22/0xd0 [ 104.006463] [] __crash_kexec+0x6a/0xa4 [ 104.011774] [] panic+0xfc/0x2b0 [ 104.016480] [] sysrq_reset_seq_param_set+0x0/0x70 [ 104.022745] [] __handle_sysrq+0x8c/0x154 [ 104.028229] [] write_sysrq_trigger+0x5a/0x6a [ 104.034061] [] proc_reg_write+0x58/0xd4 [ 104.039459] [] vfs_write+0x7e/0x254 [ 104.044509] [] ksys_write+0x58/0xbe [ 104.049558] [] sys_write+0xe/0x16 [ 104.054434] [] ret_from_syscall+0x0/0x2 [ 104.067863] Will call new kernel at ecc00000 from hart id 0 [ 104.074939] FDT image at fc5ee000 [ 104.079523] Bye... With the patch we can got clear output, [ 67.740553] sysrq: Trigger a crash [ 67.744166] Kernel panic - not syncing: sysrq triggered crash [ 67.809123] CPU1: off [ 67.865210] CPU2: off [ 67.909075] CPU3: off [ 67.919123] Starting crashdump kernel... [ 67.924900] Will call new kernel at ecc00000 from hart id 0 [ 67.932045] FDT image at fc5ee000 [ 67.935560] Bye... Fixes: 0e105f1d0037 ("riscv: use hart id instead of cpu id on machine_kexec= ") Reviewed-by: Guo Ren Reviewed-by: Heiko Stuebner Reviewed-by: Atish Patra Signed-off-by: Xianting Tian Link: https://lore.kernel.org/r/20220811074150.3020189-2-xianting.tian@linu= x.alibaba.com Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/riscv/kernel/machine_kexec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/kernel/machine_kexec.c b/arch/riscv/kernel/machine_= kexec.c index df8e24559035..86d1b5f9dfb5 100644 --- a/arch/riscv/kernel/machine_kexec.c +++ b/arch/riscv/kernel/machine_kexec.c @@ -171,7 +171,7 @@ machine_kexec(struct kimage *image) struct kimage_arch *internal =3D &image->arch; unsigned long jump_addr =3D (unsigned long) image->start; unsigned long first_ind_entry =3D (unsigned long) &image->head; - unsigned long this_cpu_id =3D smp_processor_id(); + unsigned long this_cpu_id =3D __smp_processor_id(); unsigned long this_hart_id =3D cpuid_to_hartid_map(this_cpu_id); unsigned long fdt_addr =3D internal->fdt_addr; void *control_code_buffer =3D page_address(image->control_code_page); --=20 2.37.1 From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A3A5C00140 for ; Mon, 15 Aug 2022 18:23:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241272AbiHOSXL (ORCPT ); Mon, 15 Aug 2022 14:23:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241114AbiHOSWn (ORCPT ); Mon, 15 Aug 2022 14:22:43 -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 733842D1FA; Mon, 15 Aug 2022 11:17: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 9F8A060010; Mon, 15 Aug 2022 18:17:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA14BC433D6; Mon, 15 Aug 2022 18:17:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587440; bh=eD+jMb7n534/jcdT29lctYRtPAq2NIYdwp89rzXmdf8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KQfApQRW9PMDPJJzrNANQj2kG/zZAlaqNJbGLCRWh5PPLACCZQGDufxI5Ge46WKDy LIoxaFfNJCoqhAPCCulZD7gNDTfOs9V3Xcrju5VuHpBtkzVg6dLyZcJegow2/9uiUe MOLaypzFIcEWQlLWjXLjqCUDRfu7XhjhEinvPpj8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xianting Tian , Palmer Dabbelt , Guo Ren Subject: [PATCH 5.15 056/779] RISC-V: Fixup get incorrect user mode PC for kernel mode regs Date: Mon, 15 Aug 2022 19:55:00 +0200 Message-Id: <20220815180339.655440018@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 59c026c359c30f116fef6ee958e24d04983efbb0 upstream. When use 'echo c > /proc/sysrq-trigger' to trigger kdump, riscv_crash_save_= regs() will be called to save regs for vmcore, we found "epc" value 00ffffffa55374= 00 is not a valid kernel virtual address, but is a user virtual address. Other regs(eg, ra, sp, gp...) are correct kernel virtual address. Actually 0x00ffffffb0dd9400 is the user mode PC of 'PID: 113 Comm: sh', whi= ch is saved in the task's stack. [ 21.201701] CPU: 0 PID: 113 Comm: sh Kdump: loaded Not tainted 5.18.9 #45 [ 21.201979] Hardware name: riscv-virtio,qemu (DT) [ 21.202160] epc : 00ffffffa5537400 ra : ffffffff80088640 sp : ff20000010= 333b90 [ 21.202435] gp : ffffffff810dde38 tp : ff6000000226c200 t0 : ffffffff80= 32be7c [ 21.202707] t1 : 0720072007200720 t2 : 30203a7375746174 s0 : ff20000010= 333cf0 [ 21.202973] s1 : 0000000000000000 a0 : ff20000010333b98 a1 : 0000000000= 000001 [ 21.203243] a2 : 0000000000000010 a3 : 0000000000000000 a4 : 28c8f0aeff= ea4e00 [ 21.203519] a5 : 28c8f0aeffea4e00 a6 : 0000000000000009 a7 : ffffffff80= 35c9b8 [ 21.203794] s2 : ffffffff810df0a8 s3 : ffffffff810df718 s4 : ff20000010= 333b98 [ 21.204062] s5 : 0000000000000000 s6 : 0000000000000007 s7 : ffffffff80= c4a468 [ 21.204331] s8 : 00ffffffef451410 s9 : 0000000000000007 s10: 00aaaaaac0= 510700 [ 21.204606] s11: 0000000000000001 t3 : ff60000001218f00 t4 : ff60000001= 218f00 [ 21.204876] t5 : ff60000001218000 t6 : ff200000103338b8 [ 21.205079] status: 0000000200000020 badaddr: 0000000000000000 cause: 00= 00000000000008 With the incorrect PC, the backtrace showed by crash tool as below, the fir= st stack frame is abnormal, crash> bt PID: 113 TASK: ff60000002269600 CPU: 0 COMMAND: "sh" #0 [ff2000001039bb90] __efistub_.Ldebug_info0 at 00ffffffa5537400 <-- Abno= rmal #1 [ff2000001039bcf0] panic at ffffffff806578ba #2 [ff2000001039bd50] sysrq_reset_seq_param_set at ffffffff8038c030 #3 [ff2000001039bda0] __handle_sysrq at ffffffff8038c5f8 #4 [ff2000001039be00] write_sysrq_trigger at ffffffff8038cad8 #5 [ff2000001039be20] proc_reg_write at ffffffff801b7edc #6 [ff2000001039be40] vfs_write at ffffffff80152ba6 #7 [ff2000001039be80] ksys_write at ffffffff80152ece #8 [ff2000001039bed0] sys_write at ffffffff80152f46 With the patch, we can get current kernel mode PC, the output as below, [ 17.607658] CPU: 0 PID: 113 Comm: sh Kdump: loaded Not tainted 5.18.9 #42 [ 17.607937] Hardware name: riscv-virtio,qemu (DT) [ 17.608150] epc : ffffffff800078f8 ra : ffffffff8008862c sp : ff20000010= 333b90 [ 17.608441] gp : ffffffff810dde38 tp : ff6000000226c200 t0 : ffffffff80= 32be68 [ 17.608741] t1 : 0720072007200720 t2 : 666666666666663c s0 : ff20000010= 333cf0 [ 17.609025] s1 : 0000000000000000 a0 : ff20000010333b98 a1 : 0000000000= 000001 [ 17.609320] a2 : 0000000000000010 a3 : 0000000000000000 a4 : 0000000000= 000000 [ 17.609601] a5 : ff60000001c78000 a6 : 000000000000003c a7 : ffffffff80= 35c9a4 [ 17.609894] s2 : ffffffff810df0a8 s3 : ffffffff810df718 s4 : ff20000010= 333b98 [ 17.610186] s5 : 0000000000000000 s6 : 0000000000000007 s7 : ffffffff80= c4a468 [ 17.610469] s8 : 00ffffffca281410 s9 : 0000000000000007 s10: 00aaaaaab5= bb6700 [ 17.610755] s11: 0000000000000001 t3 : ff60000001218f00 t4 : ff60000001= 218f00 [ 17.611041] t5 : ff60000001218000 t6 : ff20000010333988 [ 17.611255] status: 0000000200000020 badaddr: 0000000000000000 cause: 00= 00000000000008 With the correct PC, the backtrace showed by crash tool as below, crash> bt PID: 113 TASK: ff6000000226c200 CPU: 0 COMMAND: "sh" #0 [ff20000010333b90] riscv_crash_save_regs at ffffffff800078f8 <--- Normal #1 [ff20000010333cf0] panic at ffffffff806578c6 #2 [ff20000010333d50] sysrq_reset_seq_param_set at ffffffff8038c03c #3 [ff20000010333da0] __handle_sysrq at ffffffff8038c604 #4 [ff20000010333e00] write_sysrq_trigger at ffffffff8038cae4 #5 [ff20000010333e20] proc_reg_write at ffffffff801b7ee8 #6 [ff20000010333e40] vfs_write at ffffffff80152bb2 #7 [ff20000010333e80] ksys_write at ffffffff80152eda #8 [ff20000010333ed0] sys_write at ffffffff80152f52 Fixes: e53d28180d4d ("RISC-V: Add kdump support") Co-developed-by: Guo Ren Signed-off-by: Xianting Tian Link: https://lore.kernel.org/r/20220811074150.3020189-3-xianting.tian@linu= x.alibaba.com Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/riscv/kernel/crash_save_regs.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/kernel/crash_save_regs.S b/arch/riscv/kernel/crash_= save_regs.S index 7832fb763aba..b2a1908c0463 100644 --- a/arch/riscv/kernel/crash_save_regs.S +++ b/arch/riscv/kernel/crash_save_regs.S @@ -44,7 +44,7 @@ SYM_CODE_START(riscv_crash_save_regs) REG_S t6, PT_T6(a0) /* x31 */ =20 csrr t1, CSR_STATUS - csrr t2, CSR_EPC + auipc t2, 0x0 csrr t3, CSR_TVAL csrr t4, CSR_CAUSE =20 --=20 2.37.1 From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9423FC00140 for ; Mon, 15 Aug 2022 18:23:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241025AbiHOSXX (ORCPT ); Mon, 15 Aug 2022 14:23:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240900AbiHOSW7 (ORCPT ); Mon, 15 Aug 2022 14:22:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64A652DAB1; Mon, 15 Aug 2022 11:17:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 836316068C; Mon, 15 Aug 2022 18:17:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8559EC433C1; Mon, 15 Aug 2022 18:17:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587442; bh=Rc5Op+0myWs6Q/Jv3mGOh1rKnK6qSxCpqCXzJBr4HGg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WqvFEZZF/XkpaCbxSFP02MSc8g3YPiC0+YOP17Z/KvfXHKlC3ChIZDp6RnX7nzF3A aL0TqA2BgG33SUN687QDYBynGq5Xh4xh+abHxmTgxfMGFQrGaAfJKU7emPNLgm4EO7 AUVtlpVZMuKw8lZ+KUFfQpO80MWqRlqYInup06ms= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xianting Tian , Palmer Dabbelt Subject: [PATCH 5.15 057/779] RISC-V: Fixup schedule out issue in machine_crash_shutdown() Date: Mon, 15 Aug 2022 19:55:01 +0200 Message-Id: <20220815180339.695055218@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 ad943893d5f1d0aeea892bf7b781cf8062b36d58 upstream. Current task of executing crash kexec will be schedule out when panic is triggered by RCU Stall, as it needs to wait rcu completion. It lead to inability to enter the crash system. The implementation of machine_crash_shutdown() is non-standard for RISC-V according to other Arch's implementation(eg, x86, arm64), we need to send IPI to stop secondary harts. [224521.877268] rcu: INFO: rcu_preempt detected stalls on CPUs/tasks: [224521.883471] rcu: 0-...0: (3 GPs behind) idle=3Dcfa/0/0x1 softirq=3D396= 8793/3968793 fqs=3D2495 [224521.891742] (detected by 2, t=3D5255 jiffies, g=3D60855593, q=3D328) [224521.897754] Task dump for CPU 0: [224521.901074] task:swapper/0 state:R running task stack: 0 pid: = 0 ppid: 0 flags:0x00000008 [224521.911090] Call Trace: [224521.913638] [] __schedule+0x208/0x5ea [224521.918957] Kernel panic - not syncing: RCU Stall [224521.923773] bad: scheduling from the idle thread! [224521.928571] CPU: 2 PID: 0 Comm: swapper/2 Kdump: loaded Tainted: G O = 5.10.113-yocto-standard #1 [224521.938658] Call Trace: [224521.941200] [] walk_stackframe+0x0/0xaa [224521.946689] [] show_stack+0x32/0x3e [224521.951830] [] dump_stack_lvl+0x7e/0xa2 [224521.957317] [] dump_stack+0x14/0x1c [224521.962459] [] dequeue_task_idle+0x2c/0x40 [224521.968207] [] __schedule+0x41e/0x5ea [224521.973520] [] schedule+0x34/0xe4 [224521.978487] [] schedule_timeout+0xc6/0x170 [224521.984234] [] wait_for_completion+0x98/0xf2 [224521.990157] [] __wait_rcu_gp+0x148/0x14a [224521.995733] [] synchronize_rcu+0x5c/0x66 [224522.001307] [] rcu_sync_enter+0x54/0xe6 [224522.006795] [] percpu_down_write+0x32/0x11c [224522.012629] [] _cpu_down+0x92/0x21a [224522.017771] [] smp_shutdown_nonboot_cpus+0x90/0x118 [224522.024299] [] machine_crash_shutdown+0x30/0x4a [224522.030483] [] __crash_kexec+0x62/0xa6 [224522.035884] [] panic+0xfa/0x2b6 [224522.040678] [] rcu_sched_clock_irq+0xc26/0xcb8 [224522.046774] [] update_process_times+0x62/0x8a [224522.052785] [] tick_sched_timer+0x9e/0x102 [224522.058533] [] __hrtimer_run_queues+0x16a/0x318 [224522.064716] [] hrtimer_interrupt+0xd4/0x228 [224522.070551] [] riscv_timer_interrupt+0x3c/0x48 [224522.076646] [] handle_percpu_devid_irq+0xb0/0x24c [224522.083004] [] __handle_domain_irq+0xa8/0x122 [224522.089014] [] riscv_intc_irq+0x38/0x60 [224522.094501] [] ret_from_exception+0x0/0xc [224522.100161] [] rcu_eqs_enter.constprop.0+0x8c/0xb8 With the patch, it can enter crash system when RCU Stall occur. Fixes: e53d28180d4d ("RISC-V: Add kdump support") Signed-off-by: Xianting Tian Link: https://lore.kernel.org/r/20220811074150.3020189-4-xianting.tian@linu= x.alibaba.com Cc: stable@vger.kernel.org Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/riscv/kernel/machine_kexec.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/arch/riscv/kernel/machine_kexec.c b/arch/riscv/kernel/machine_= kexec.c index 86d1b5f9dfb5..ee79e6839b86 100644 --- a/arch/riscv/kernel/machine_kexec.c +++ b/arch/riscv/kernel/machine_kexec.c @@ -138,19 +138,37 @@ void machine_shutdown(void) #endif } =20 +/* Override the weak function in kernel/panic.c */ +void crash_smp_send_stop(void) +{ + static int cpus_stopped; + + /* + * This function can be called twice in panic path, but obviously + * we execute this only once. + */ + if (cpus_stopped) + return; + + smp_send_stop(); + cpus_stopped =3D 1; +} + /* * machine_crash_shutdown - Prepare to kexec after a kernel crash * * This function is called by crash_kexec just before machine_kexec - * below and its goal is similar to machine_shutdown, but in case of - * a kernel crash. Since we don't handle such cases yet, this function - * is empty. + * and its goal is to shutdown non-crashing cpus and save registers. */ void machine_crash_shutdown(struct pt_regs *regs) { + local_irq_disable(); + + /* shutdown non-crashing cpus */ + crash_smp_send_stop(); + crash_save_cpu(regs, smp_processor_id()); - machine_shutdown(); pr_info("Starting crashdump kernel...\n"); } =20 --=20 2.37.1 From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5B36C00140 for ; Mon, 15 Aug 2022 18:23:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241397AbiHOSXe (ORCPT ); Mon, 15 Aug 2022 14:23:34 -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 S241164AbiHOSXC (ORCPT ); Mon, 15 Aug 2022 14:23:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 772112DABA; Mon, 15 Aug 2022 11:17:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4CB1C60685; Mon, 15 Aug 2022 18:17:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59AA3C4347C; Mon, 15 Aug 2022 18:17:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587445; bh=AICtVT5BSqME0mJF4xJXxsjnLdJMwqvSiqa4MFAvTH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0WKbnExdnuv9F3x6ANqrOAaLjTnr7NuS9ZMhcgTSLAbhqR2SdVZkD59EbcqxMF3kI QaSz//tJMb524uTNmiah4fGPWMkaDKxlBkgPTg2meWBwt+xlJjtoEzqIW5IiojQStm V22WxL+2P1bkughLySu11oKolAjR3T5eCKgmEjOg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guo Ren , Heiko Stuebner , Xianting Tian , Palmer Dabbelt Subject: [PATCH 5.15 058/779] RISC-V: Add modules to virtual kernel memory layout dump Date: Mon, 15 Aug 2022 19:55:02 +0200 Message-Id: <20220815180339.741245916@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 f9293ad46d8ba9909187a37b7215324420ad4596 upstream. Modules always live before the kernel, MODULES_END is fixed but MODULES_VADDR isn't fixed, it depends on the kernel size. Let's add it to virtual kernel memory layout dump. As MODULES is only defined for CONFIG_64BIT, so we dump it when CONFIG_64BIT=3Dy. eg, MODULES_VADDR - MODULES_END 0xffffffff01133000 - 0xffffffff80000000 Reviewed-by: Guo Ren Reviewed-by: Heiko Stuebner Signed-off-by: Xianting Tian Link: https://lore.kernel.org/r/20220811074150.3020189-5-xianting.tian@linu= x.alibaba.com Cc: stable@vger.kernel.org Fixes: 2bfc6cd81bd1 ("riscv: Move kernel mapping outside of linear mapping") Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/riscv/mm/init.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -100,6 +100,10 @@ static void __init print_vm_layout(void) (unsigned long)VMEMMAP_END); print_mlm("vmalloc", (unsigned long)VMALLOC_START, (unsigned long)VMALLOC_END); +#ifdef CONFIG_64BIT + print_mlm("modules", (unsigned long)MODULES_VADDR, + (unsigned long)MODULES_END); +#endif print_mlm("lowmem", (unsigned long)PAGE_OFFSET, (unsigned long)high_memory); #ifdef CONFIG_64BIT From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 387E7C25B08 for ; Mon, 15 Aug 2022 18:23:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241440AbiHOSXo (ORCPT ); Mon, 15 Aug 2022 14:23:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241190AbiHOSXF (ORCPT ); Mon, 15 Aug 2022 14:23:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D7212E68F; Mon, 15 Aug 2022 11:17: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 DB8756068B; Mon, 15 Aug 2022 18:17:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE4DAC43140; Mon, 15 Aug 2022 18:17:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587449; bh=IhqksPl1KYAQAVAET5nDQDJCIw682MKRVpMsjDjajAk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hfAEZ3dfGRI6de5SThAcQS6iNT1ThMOm2Q/SEby1WDKlMhlrIWN50bJVc8/K9yTk6 l7oRFEOI44uiqnjndnHAAVbFOxs4eZz1nXq3Pc1Hghw9AaTZtShdJfWzZeLJbeG//3 kV1b5NN6TyKFknvph6sdQggmJBFOGxgiBlca5aNU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mathew McBride , Alexandre Belloni Subject: [PATCH 5.15 059/779] rtc: rx8025: fix 12/24 hour mode detection on RX-8035 Date: Mon, 15 Aug 2022 19:55:03 +0200 Message-Id: <20220815180339.777547800@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mathew McBride commit 71af91565052214ad86f288e0d8ffb165f790995 upstream. The 12/24hr flag in the RX-8035 can be found in the hour register, instead of the CTRL1 on the RX-8025. This was overlooked when support for the RX-8035 was added, and was causing read errors when the hour register 'overflowed'. To deal with the relevant register not always being visible in the relevant functions, determine the 12/24 mode at startup and store it in the driver state. Signed-off-by: Mathew McBride Fixes: f120e2e33ac8 ("rtc: rx8025: implement RX-8035 support") Cc: stable@vger.kernel.org Signed-off-by: Alexandre Belloni Link: https://lore.kernel.org/r/20220706074236.24011-1-matt@traverse.com.au Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/rtc/rtc-rx8025.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) --- a/drivers/rtc/rtc-rx8025.c +++ b/drivers/rtc/rtc-rx8025.c @@ -55,6 +55,8 @@ #define RX8025_BIT_CTRL2_XST BIT(5) #define RX8025_BIT_CTRL2_VDET BIT(6) =20 +#define RX8035_BIT_HOUR_1224 BIT(7) + /* Clock precision adjustment */ #define RX8025_ADJ_RESOLUTION 3050 /* in ppb */ #define RX8025_ADJ_DATA_MAX 62 @@ -78,6 +80,7 @@ struct rx8025_data { struct rtc_device *rtc; enum rx_model model; u8 ctrl1; + int is_24; }; =20 static s32 rx8025_read_reg(const struct i2c_client *client, u8 number) @@ -226,7 +229,7 @@ static int rx8025_get_time(struct device =20 dt->tm_sec =3D bcd2bin(date[RX8025_REG_SEC] & 0x7f); dt->tm_min =3D bcd2bin(date[RX8025_REG_MIN] & 0x7f); - if (rx8025->ctrl1 & RX8025_BIT_CTRL1_1224) + if (rx8025->is_24) dt->tm_hour =3D bcd2bin(date[RX8025_REG_HOUR] & 0x3f); else dt->tm_hour =3D bcd2bin(date[RX8025_REG_HOUR] & 0x1f) % 12 @@ -257,7 +260,7 @@ static int rx8025_set_time(struct device */ date[RX8025_REG_SEC] =3D bin2bcd(dt->tm_sec); date[RX8025_REG_MIN] =3D bin2bcd(dt->tm_min); - if (rx8025->ctrl1 & RX8025_BIT_CTRL1_1224) + if (rx8025->is_24) date[RX8025_REG_HOUR] =3D bin2bcd(dt->tm_hour); else date[RX8025_REG_HOUR] =3D (dt->tm_hour >=3D 12 ? 0x20 : 0) @@ -282,6 +285,7 @@ static int rx8025_init_client(struct i2c struct rx8025_data *rx8025 =3D i2c_get_clientdata(client); u8 ctrl[2], ctrl2; int need_clear =3D 0; + int hour_reg; int err; =20 err =3D rx8025_read_regs(client, RX8025_REG_CTRL1, 2, ctrl); @@ -306,6 +310,16 @@ static int rx8025_init_client(struct i2c =20 err =3D rx8025_write_reg(client, RX8025_REG_CTRL2, ctrl2); } + + if (rx8025->model =3D=3D model_rx_8035) { + /* In RX-8035, 12/24 flag is in the hour register */ + hour_reg =3D rx8025_read_reg(client, RX8025_REG_HOUR); + if (hour_reg < 0) + return hour_reg; + rx8025->is_24 =3D (hour_reg & RX8035_BIT_HOUR_1224); + } else { + rx8025->is_24 =3D (ctrl[1] & RX8025_BIT_CTRL1_1224); + } out: return err; } @@ -335,7 +349,7 @@ static int rx8025_read_alarm(struct devi /* Hardware alarms precision is 1 minute! */ t->time.tm_sec =3D 0; t->time.tm_min =3D bcd2bin(ald[0] & 0x7f); - if (rx8025->ctrl1 & RX8025_BIT_CTRL1_1224) + if (rx8025->is_24) t->time.tm_hour =3D bcd2bin(ald[1] & 0x3f); else t->time.tm_hour =3D bcd2bin(ald[1] & 0x1f) % 12 @@ -370,7 +384,7 @@ static int rx8025_set_alarm(struct devic } =20 ald[0] =3D bin2bcd(t->time.tm_min); - if (rx8025->ctrl1 & RX8025_BIT_CTRL1_1224) + if (rx8025->is_24) ald[1] =3D bin2bcd(t->time.tm_hour); else ald[1] =3D (t->time.tm_hour >=3D 12 ? 0x20 : 0) From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 540DAC00140 for ; Mon, 15 Aug 2022 18:23:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241346AbiHOSXr (ORCPT ); Mon, 15 Aug 2022 14:23:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241112AbiHOSXG (ORCPT ); Mon, 15 Aug 2022 14:23:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CAD12E69A; Mon, 15 Aug 2022 11:17: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 A54A5B81063; Mon, 15 Aug 2022 18:17:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0211C433C1; Mon, 15 Aug 2022 18:17:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587452; bh=AlJY+ACG8yNca8rL+K0T0NKrcY/0EA5/g4Bbyoul9Yw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w8o2lnXKD1bWi0gJ1+g+EWauL38QXcloVlcaplIn1LlSWgdJDUJ7M2bInP1rGMmRM GW7VoaLsHCpke6zqhAuN5CfkXX+uNAjCwRJR3nxTLbh1O8Afnl6SilOWTu+fnc7SSJ KsMFzNclrbS8bXL4hbOcA9mDx+RmZQDB2prJPcnE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , =?UTF-8?q?Christian=20K=C3=B6nig?= , Dmitry Osipenko , Daniel Vetter Subject: [PATCH 5.15 060/779] drm/gem: Properly annotate WW context on drm_gem_lock_reservations() error Date: Mon, 15 Aug 2022 19:55:04 +0200 Message-Id: <20220815180339.823514719@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dmitry Osipenko commit 2939deac1fa220bc82b89235f146df1d9b52e876 upstream. Use ww_acquire_fini() in the error code paths. Otherwise lockdep thinks that lock is held when lock's memory is freed after the drm_gem_lock_reservations() error. The ww_acquire_context needs to be annotated as "released", which fixes the noisy "WARNING: held lock freed!" splat of VirtIO-GPU driver with CONFIG_DEBUG_MUTEXES=3Dy and enabled lockde= p. Cc: stable@vger.kernel.org Fixes: 7edc3e3b975b5 ("drm: Add helpers for locking an array of BO reservat= ions.") Reviewed-by: Thomas Hellstr=C3=B6m Reviewed-by: Christian K=C3=B6nig Signed-off-by: Dmitry Osipenko Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20220630200405.1883897-= 2-dmitry.osipenko@collabora.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/drm_gem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c @@ -1224,7 +1224,7 @@ retry: ret =3D dma_resv_lock_slow_interruptible(obj->resv, acquire_ctx); if (ret) { - ww_acquire_done(acquire_ctx); + ww_acquire_fini(acquire_ctx); return ret; } } @@ -1249,7 +1249,7 @@ retry: goto retry; } =20 - ww_acquire_done(acquire_ctx); + ww_acquire_fini(acquire_ctx); return ret; } } From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6DF7C00140 for ; Mon, 15 Aug 2022 18:23:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241495AbiHOSX5 (ORCPT ); Mon, 15 Aug 2022 14:23:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240497AbiHOSXU (ORCPT ); Mon, 15 Aug 2022 14:23:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D32432DAB4; Mon, 15 Aug 2022 11:17: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 9751C60685; Mon, 15 Aug 2022 18:17:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81006C433C1; Mon, 15 Aug 2022 18:17:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587463; bh=FcXVIpsPD1m7e3h1Ko/SBA2xXRf9W5Pg4zZfDjvy3Eg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YmYojfomWWLr33MtZfhxxOnDT55BROJj54w82YMpcqs4A5KT0fPy4Dp7n1Hpveoh+ KZjRvhfjEfB/6oI0pnFaloeI+sJq+wnlhb6KJL/unG6taYY6blwJ/Mx56Lc0GPr7VE DQnXfSn3L1ISKdLPsSmdpIOXtNSMGAdxjYufVsac= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Osipenko , Daniel Vetter Subject: [PATCH 5.15 061/779] drm/shmem-helper: Add missing vunmap on error Date: Mon, 15 Aug 2022 19:55:05 +0200 Message-Id: <20220815180339.865246410@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dmitry Osipenko commit df4aaf015775221dde8a51ee09edb919981f091e upstream. The vmapping of dma-buf may succeed, but DRM SHMEM rejects the IOMEM mapping, and thus, drm_gem_shmem_vmap_locked() should unvmap the IOMEM before erroring out. Cc: stable@vger.kernel.org Fixes: 49a3f51dfeee ("drm/gem: Use struct dma_buf_map in GEM vmap ops and c= onvert GEM backends") Signed-off-by: Dmitry Osipenko Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20220630200058.1883506-= 2-dmitry.osipenko@collabora.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/drm_gem_shmem_helper.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/gpu/drm/drm_gem_shmem_helper.c +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c @@ -275,6 +275,7 @@ static int drm_gem_shmem_vmap_locked(str ret =3D dma_buf_vmap(obj->import_attach->dmabuf, map); if (!ret) { if (WARN_ON(map->is_iomem)) { + dma_buf_vunmap(obj->import_attach->dmabuf, map); ret =3D -EIO; goto err_put_pages; } From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C9BBC00140 for ; Mon, 15 Aug 2022 18:19:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240309AbiHOSTk (ORCPT ); Mon, 15 Aug 2022 14:19:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238887AbiHOSS0 (ORCPT ); Mon, 15 Aug 2022 14:18:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30DC32B633; Mon, 15 Aug 2022 11:16: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 BC3A261299; Mon, 15 Aug 2022 18:16:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4E70C433C1; Mon, 15 Aug 2022 18:16:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587363; bh=4qlNeIHgUazwweJK0KQBHpXgXwP8gTAiqf2xf6WlGYI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NLzZYstLOxwxKmjc1tVEGDYYkHBmAMS++69dL2mVGqsKeIYQGkL1mtCzsJwx7rhCY Qi3nPJ0OPnUIdeHO3QRdKNXXBxEq3jvW/59cZZoLXvFujUub+9AY3Vbd1jjRXgrefK vIjjN7BrXpyoKFd/m963Nw4jPhxR2SmUMvEJvr4c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Phil Elwell , Maxime Ripard Subject: [PATCH 5.15 062/779] drm/vc4: hdmi: Disable audio if dmas property is present but empty Date: Mon, 15 Aug 2022 19:55:06 +0200 Message-Id: <20220815180339.909034261@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Phil Elwell commit db2b927f8668adf3ac765e0921cd2720f5c04172 upstream. The dmas property is used to hold the dmaengine channel used for audio output. Older device trees were missing that property, so if it's not there we disable the audio output entirely. However, some overlays have set an empty value to that property, mostly to workaround the fact that overlays cannot remove a property. Let's add a test for that case and if it's empty, let's disable it as well. Cc: Signed-off-by: Phil Elwell Link: https://lore.kernel.org/r/20220613144800.326124-18-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_hdmi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -1470,12 +1470,12 @@ static int vc4_hdmi_audio_init(struct vc struct device *dev =3D &vc4_hdmi->pdev->dev; struct platform_device *codec_pdev; const __be32 *addr; - int index; + int index, len; int ret; =20 - if (!of_find_property(dev->of_node, "dmas", NULL)) { + if (!of_find_property(dev->of_node, "dmas", &len) || !len) { dev_warn(dev, - "'dmas' DT property is missing, no HDMI audio\n"); + "'dmas' DT property is missing or empty, no HDMI audio\n"); return 0; } From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD481C00140 for ; Mon, 15 Aug 2022 18:19:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231550AbiHOSTn (ORCPT ); Mon, 15 Aug 2022 14:19:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239980AbiHOSSg (ORCPT ); Mon, 15 Aug 2022 14:18: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 1C8EB2A711; Mon, 15 Aug 2022 11:16: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 AF5B161299; Mon, 15 Aug 2022 18:16:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8516BC433D6; Mon, 15 Aug 2022 18:16:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587366; bh=VZdlmM1yI6DDiCaE7reYOZ8qKqKYhTpxSZQNW8mwYrA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=th86to2NUpOUz0mjCLFyqIhLeUTqBo0K/3smbSigPhBpf2AdH7isOHykg5uPRUpiv nOA7nH4hUZrG/nP1s/9VhFrg5w8tiEa6dkyuiYOjXPz5UD2SOP5XX8OhLvqwEJCMNr je3RA71wGNpNzhujbb7wWPku311AJEv2I63H6LRo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Zimmermann , Deepak Rawat , Maarten Lankhorst , Maxime Ripard , linux-hyperv@vger.kernel.org, dri-devel@lists.freedesktop.org, Maxime Ripard , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= Subject: [PATCH 5.15 063/779] drm/hyperv-drm: Include framebuffer and EDID headers Date: Mon, 15 Aug 2022 19:55:07 +0200 Message-Id: <20220815180339.955043910@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thomas Zimmermann commit 009a3a52791f31c57d755a73f6bc66fbdd8bd76c upstream. Fix a number of compile errors by including the correct header files. Examples are shown below. ../drivers/gpu/drm/hyperv/hyperv_drm_modeset.c: In function 'hyperv_blit_= to_vram_rect': ../drivers/gpu/drm/hyperv/hyperv_drm_modeset.c:25:48: error: invalid use = of undefined type 'struct drm_framebuffer' 25 | struct hyperv_drm_device *hv =3D to_hv(fb->dev); | ^~ ../drivers/gpu/drm/hyperv/hyperv_drm_modeset.c: In function 'hyperv_conne= ctor_get_modes': ../drivers/gpu/drm/hyperv/hyperv_drm_modeset.c:59:17: error: implicit dec= laration of function 'drm_add_modes_noedid' [-Werror=3Dimplicit-function-de= claration] 59 | count =3D drm_add_modes_noedid(connector, | ^~~~~~~~~~~~~~~~~~~~ ../drivers/gpu/drm/hyperv/hyperv_drm_modeset.c:62:9: error: implicit decl= aration of function 'drm_set_preferred_mode'; did you mean 'drm_mm_reserve_= node'? [-Werror=3Dimplicit-function-declaration] 62 | drm_set_preferred_mode(connector, hv->preferred_width, | ^~~~~~~~~~~~~~~~~~~~~~ Signed-off-by: Thomas Zimmermann Fixes: 76c56a5affeb ("drm/hyperv: Add DRM driver for hyperv synthetic video= device") Fixes: 720cf96d8fec ("drm: Drop drm_framebuffer.h from drm_crtc.h") Fixes: 255490f9150d ("drm: Drop drm_edid.h from drm_crtc.h") Cc: Deepak Rawat Cc: Thomas Zimmermann Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: linux-hyperv@vger.kernel.org Cc: dri-devel@lists.freedesktop.org Cc: # v5.14+ Acked-by: Maxime Ripard Reviewed-by: Ville Syrj=C3=A4l=C3=A4 Link: https://patchwork.freedesktop.org/patch/msgid/20220622083413.12573-1-= tzimmermann@suse.de Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/hyperv/hyperv_drm_modeset.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/gpu/drm/hyperv/hyperv_drm_modeset.c +++ b/drivers/gpu/drm/hyperv/hyperv_drm_modeset.c @@ -7,9 +7,11 @@ =20 #include #include +#include #include #include #include +#include #include #include #include From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFE69C25B08 for ; Mon, 15 Aug 2022 18:19:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240348AbiHOSTr (ORCPT ); Mon, 15 Aug 2022 14:19:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240000AbiHOSSn (ORCPT ); Mon, 15 Aug 2022 14:18: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 9B6422A401; Mon, 15 Aug 2022 11:16: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 2C1CEB80F99; Mon, 15 Aug 2022 18:16:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A009C433D7; Mon, 15 Aug 2022 18:16:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587368; bh=38z5+1E7HVbT6HeQjqkDPqJFtUVE6OakjVGr/qrHk+k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RTmNk4ZDlfyxb55dL4wrspY6m1ejClBbFsTJP1NsR4HaydsQR92bwLJS2fGtD7EkZ 8aHjraXM55Hj1SHIZne8pp45+8tey1OkwSpHJGSrI1PJOdb46oWiA/40bhCi1qZZ2i 8gFvvv3UPXXZbyrJyGMbL5fftC45leVo6IJ48MFA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Timur Tabi , Karol Herbst , Lyude Paul Subject: [PATCH 5.15 064/779] drm/nouveau: fix another off-by-one in nvbios_addr Date: Mon, 15 Aug 2022 19:55:08 +0200 Message-Id: <20220815180339.999848740@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Timur Tabi commit c441d28945fb113220d48d6c86ebc0b090a2b677 upstream. This check determines whether a given address is part of image 0 or image 1. Image 1 starts at offset image0_size, so that address should be included. Fixes: 4d4e9907ff572 ("drm/nouveau/bios: guard against out-of-bounds access= es to image") Cc: # v4.8+ Signed-off-by: Timur Tabi Reviewed-by: Karol Herbst Signed-off-by: Lyude Paul Link: https://patchwork.freedesktop.org/patch/msgid/20220511163716.3520591-= 1-ttabi@nvidia.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c +++ b/drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c @@ -33,7 +33,7 @@ nvbios_addr(struct nvkm_bios *bios, u32 { u32 p =3D *addr; =20 - if (*addr > bios->image0_size && bios->imaged_addr) { + if (*addr >=3D bios->image0_size && bios->imaged_addr) { *addr -=3D bios->image0_size; *addr +=3D bios->imaged_addr; } From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6672DC25B0E for ; Mon, 15 Aug 2022 18:19:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240045AbiHOSTw (ORCPT ); Mon, 15 Aug 2022 14:19:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239678AbiHOSSr (ORCPT ); Mon, 15 Aug 2022 14:18:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 657B02A40C; Mon, 15 Aug 2022 11:16:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 01C06B81063; Mon, 15 Aug 2022 18:16:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56A02C433C1; Mon, 15 Aug 2022 18:16:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587371; bh=EgecuUMgl7Y7fKygetIR9RQpkX9ejRqs7beDFWaldQk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vJeQIOGzg1JTOwq/QJv09qyK+rm1yownDdt/9HgDgel8VnoSK+Oxi1CYk7EXnocUY MFKLad4KeaG+Y3pp8mssAzlD7MGgpOgxWTmMFiEFGaCNas3fhxGCcVFMYNAbC9tcZf E417pp1sFVFBaHucRe/x+D25guhZUaBYADFtTUF0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lyude Paul , David Airlie , Hans de Goede Subject: [PATCH 5.15 065/779] drm/nouveau: Dont pm_runtime_put_sync(), only pm_runtime_put_autosuspend() Date: Mon, 15 Aug 2022 19:55:09 +0200 Message-Id: <20220815180340.049109167@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lyude Paul commit c96cfaf8fc02d4bb70727dfa7ce7841a3cff9be2 upstream. While trying to fix another issue, it occurred to me that I don't actually think there is any situation where we want pm_runtime_put() in nouveau to be synchronous. In fact, this kind of just seems like it would cause issues where we may unexpectedly block a thread we don't expect to be blocked. So, let's only use pm_runtime_put_autosuspend(). Changes since v1: * Use pm_runtime_put_autosuspend(), not pm_runtime_put() Signed-off-by: Lyude Paul Reviewed-by: David Airlie Fixes: 3a6536c51d5d ("drm/nouveau: Intercept ACPI_VIDEO_NOTIFY_PROBE") Cc: Hans de Goede Cc: # v4.10+ Link: https://patchwork.freedesktop.org/patch/msgid/20220714174234.949259-3= -lyude@redhat.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/nouveau/nouveau_display.c | 2 +- drivers/gpu/drm/nouveau/nouveau_fbcon.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c @@ -518,7 +518,7 @@ nouveau_display_hpd_work(struct work_str =20 pm_runtime_mark_last_busy(drm->dev->dev); noop: - pm_runtime_put_sync(drm->dev->dev); + pm_runtime_put_autosuspend(dev->dev); } =20 #ifdef CONFIG_ACPI --- a/drivers/gpu/drm/nouveau/nouveau_fbcon.c +++ b/drivers/gpu/drm/nouveau/nouveau_fbcon.c @@ -466,7 +466,7 @@ nouveau_fbcon_set_suspend_work(struct wo if (state =3D=3D FBINFO_STATE_RUNNING) { nouveau_fbcon_hotplug_resume(drm->fbcon); pm_runtime_mark_last_busy(drm->dev->dev); - pm_runtime_put_sync(drm->dev->dev); + pm_runtime_put_autosuspend(drm->dev->dev); } } From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3040BC25B08 for ; Mon, 15 Aug 2022 18:20:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239347AbiHOSUD (ORCPT ); Mon, 15 Aug 2022 14:20:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239714AbiHOSSw (ORCPT ); Mon, 15 Aug 2022 14:18:52 -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 AA8DC2AE11; Mon, 15 Aug 2022 11:16:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 325C361290; Mon, 15 Aug 2022 18:16:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 309D7C433D7; Mon, 15 Aug 2022 18:16:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587374; bh=s7UlpMwTs1CItbkC0akguoqCNt4uXYEg3xOEljhn0+8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IC0o/z95LaSIP1STqzsGp873tB/OQWpw8+P/wwQ+Z/gcNZgO7QL4Ec7ILkrGvBEHh DVbUQUeXWyHDjxA+Ld2EgvaFWAHmlviLHX7o6BfEMMe5Fg+GRRmbKm+ZC7uL8AQa+Q 1qiJnxn48IwvhGRLpkQxx+7B6Wxr0Xcjla7mJFao= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lyude Paul , David Airlie Subject: [PATCH 5.15 066/779] drm/nouveau/acpi: Dont print error when we get -EINPROGRESS from pm_runtime Date: Mon, 15 Aug 2022 19:55:10 +0200 Message-Id: <20220815180340.098324985@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lyude Paul commit 53c26181950ddc3c8ace3c0939c89e9c4d8deeb9 upstream. Since this isn't actually a failure. Signed-off-by: Lyude Paul Reviewed-by: David Airlie Fixes: 79e765ad665d ("drm/nouveau/drm/nouveau: Prevent handling ACPI HPD ev= ents too early") Cc: # v4.19+ Link: https://patchwork.freedesktop.org/patch/msgid/20220714174234.949259-2= -lyude@redhat.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/nouveau/nouveau_display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/nouveau/nouveau_display.c +++ b/drivers/gpu/drm/nouveau/nouveau_display.c @@ -540,7 +540,7 @@ nouveau_display_acpi_ntfy(struct notifie * it's own hotplug events. */ pm_runtime_put_autosuspend(drm->dev->dev); - } else if (ret =3D=3D 0) { + } else if (ret =3D=3D 0 || ret =3D=3D -EINPROGRESS) { /* We've started resuming the GPU already, so * it will handle scheduling a full reprobe * itself From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E730FC00140 for ; Mon, 15 Aug 2022 18:20:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240434AbiHOSUG (ORCPT ); Mon, 15 Aug 2022 14:20:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240052AbiHOSSy (ORCPT ); Mon, 15 Aug 2022 14:18:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F8C22BB10; Mon, 15 Aug 2022 11:16:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EBDEE6129E; Mon, 15 Aug 2022 18:16:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6027C43470; Mon, 15 Aug 2022 18:16:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587377; bh=y5dOMvY/vtWmTZ442l2tNq7mMPfl2pLTBxrmgWBug+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WU3oipX0VDGhbYtPg0QcCeq92WgfhEiUN6Wc+MTT4aeyUpWVVeCOVTxlDZc6TWHjw xMlWOi4+So9GXHwumvlezf4V9DBOLnxCAJb+bwYlTaG+nm5xr7vQm4DzHT3eGtSzNJ UQDWUJVFvizvO9YAqrkkTaLySDNJaUd61yxr0S5A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lyude Paul , David Airlie Subject: [PATCH 5.15 067/779] drm/nouveau/kms: Fix failure path for creating DP connectors Date: Mon, 15 Aug 2022 19:55:11 +0200 Message-Id: <20220815180340.137533901@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lyude Paul commit ca0367ca5d9216644b41f86348d6661f8d9e32d8 upstream. It looks like that when we moved nouveau over to using drm_dp_aux_init() and registering it's aux bus during late connector registration, we totally forgot to fix the failure codepath in nouveau_connector_create() - as it still seems to assume that drm_dp_aux_init() can fail (it can't). So, let's fix that and also add a missing check to ensure that we've properly allocated nv_connector->aux.name while we're at it. Signed-off-by: Lyude Paul Reviewed-by: David Airlie Fixes: fd43ad9d47e7 ("drm/nouveau/kms/nv50-: Move AUX adapter reg to connec= tor late register/early unregister") Cc: # v5.14+ Link: https://patchwork.freedesktop.org/patch/msgid/20220526204313.656473-1= -lyude@redhat.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/nouveau/nouveau_connector.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c @@ -1361,13 +1361,11 @@ nouveau_connector_create(struct drm_devi snprintf(aux_name, sizeof(aux_name), "sor-%04x-%04x", dcbe->hasht, dcbe->hashm); nv_connector->aux.name =3D kstrdup(aux_name, GFP_KERNEL); - drm_dp_aux_init(&nv_connector->aux); - if (ret) { - NV_ERROR(drm, "Failed to init AUX adapter for sor-%04x-%04x: %d\n", - dcbe->hasht, dcbe->hashm, ret); + if (!nv_connector->aux.name) { kfree(nv_connector); - return ERR_PTR(ret); + return ERR_PTR(-ENOMEM); } + drm_dp_aux_init(&nv_connector->aux); fallthrough; default: funcs =3D &nouveau_connector_funcs; From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B60CC00140 for ; Mon, 15 Aug 2022 18:20:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239940AbiHOSUU (ORCPT ); Mon, 15 Aug 2022 14:20:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239819AbiHOSS5 (ORCPT ); Mon, 15 Aug 2022 14:18:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC7012BB15; Mon, 15 Aug 2022 11:16:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 64FB7B81063; Mon, 15 Aug 2022 18:16:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD08DC433D6; Mon, 15 Aug 2022 18:16:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587380; bh=lk6E3HO1m9rC2T2mQWrxN4dvmUWts8HkHyFZ9zjhZVE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U+Ib1274h5jvs5GsXXjw59HXOi8rgX7PNXLFtL2icL1rsjvyrWiScbXauQhg+qn7R 55bbJO2GHsPYzl6ofZAH60krJ+UmlHDMVUUsEgVtZvYxCXZvVN/ZQKV6FA7LK0xPlm hnpQEjh+8KcjBm1/jitWVOqz0Ztfe54o3kt+PUz8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Leo Li , Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= Subject: [PATCH 5.15 068/779] drm/amdgpu: Check BOs requested pinning domains against its preferred_domains Date: Mon, 15 Aug 2022 19:55:12 +0200 Message-Id: <20220815180340.188431192@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Leo Li commit f5ba14043621f4afdf3ad5f92ee2d8dbebbe4340 upstream. When pinning a buffer, we should check to see if there are any additional restrictions imposed by bo->preferred_domains. This will prevent the BO from being moved to an invalid domain when pinning. For example, this can happen if the user requests to create a BO in GTT domain for display scanout. amdgpu_dm will allow pinning to either VRAM or GTT domains, since DCN can scanout from either or. However, in amdgpu_bo_pin_restricted(), pinning to VRAM is preferred if there is adequate carveout. This can lead to pinning to VRAM despite the user requesting GTT placement for the BO. v2: Allow the kernel to override the domain, which can happen when exporting a BO to a V4L camera (for example). Signed-off-by: Leo Li Reviewed-by: Alex Deucher Reviewed-by: Christian K=C3=B6nig Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c @@ -912,6 +912,10 @@ int amdgpu_bo_pin_restricted(struct amdg if (WARN_ON_ONCE(min_offset > max_offset)) return -EINVAL; =20 + /* Check domain to be pinned to against preferred domains */ + if (bo->preferred_domains & domain) + domain =3D bo->preferred_domains & domain; + /* A shared bo cannot be migrated to VRAM */ if (bo->tbo.base.import_attach) { if (domain & AMDGPU_GEM_DOMAIN_GTT) From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04C4AC00140 for ; Mon, 15 Aug 2022 18:21:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240094AbiHOSVG (ORCPT ); Mon, 15 Aug 2022 14:21:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240182AbiHOSTM (ORCPT ); Mon, 15 Aug 2022 14:19: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 434532BB28; Mon, 15 Aug 2022 11:16:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 49DB8B8106C; Mon, 15 Aug 2022 18:16:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94C78C433C1; Mon, 15 Aug 2022 18:16:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587383; bh=SH+pC6vT7iDgd9abhCEoZEDCVetOpDBa2PhqZvIrB6Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gdfa/E1TsaydFF6g8GWqIThyqT8hYj+Xyd4Gtft7jcUfFkXDRbREMM3ets+6jMM1e GyrvMavsMb6vV4FF8fw8eWkV1b//hHLMRmXB5CuU/cQUhDYCVVMIO5ZsSJd9OpTFqg mHsM9jMD3BmTpzh8UyJQB07ERvVxqYndgw/WlPso= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , hgoffin@amazon.com, Alex Deucher Subject: [PATCH 5.15 069/779] drm/amdgpu: fix check in fbdev init Date: Mon, 15 Aug 2022 19:55:13 +0200 Message-Id: <20220815180340.239813219@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 The new vkms virtual display code is atomic so there is no need to call drm_helper_disable_unused_functions() when it is enabled. Doing so can result in a segfault. When the driver switched from the old virtual display code to the new atomic virtual display code, it was missed that we enable virtual display unconditionally under SR-IOV so the checks here missed that case. Add the missing check for SR-IOV. There is no equivalent of this patch for Linus' tree because the relevant code no longer exists. This patch is only relevant to kernels 5.15 and 5.16. Fixes: 84ec374bd580 ("drm/amdgpu: create amdgpu_vkms (v4)") Cc: stable@vger.kernel.org # 5.15.x Cc: hgoffin@amazon.com Signed-off-by: Alex Deucher Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c @@ -341,7 +341,8 @@ int amdgpu_fbdev_init(struct amdgpu_devi } =20 /* disable all the possible outputs/crtcs before entering KMS mode */ - if (!amdgpu_device_has_dc_support(adev) && !amdgpu_virtual_display) + if (!amdgpu_device_has_dc_support(adev) && !amdgpu_virtual_display && + !amdgpu_sriov_vf(adev)) drm_helper_disable_unused_functions(adev_to_drm(adev)); =20 drm_fb_helper_initial_config(&rfbdev->helper, bpp_sel); From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3FD34C00140 for ; Mon, 15 Aug 2022 18:21:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240352AbiHOSVK (ORCPT ); Mon, 15 Aug 2022 14:21:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240251AbiHOST1 (ORCPT ); Mon, 15 Aug 2022 14:19:27 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94F922BB3D; Mon, 15 Aug 2022 11:16: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 AFCFACE125C; Mon, 15 Aug 2022 18:16:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBC23C433D7; Mon, 15 Aug 2022 18:16:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587386; bh=YliFvWsr8oWemC+G3mB9eCvhmTIWlPM+9ElUyDZ1OBA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2gjf4K6tT8bKP6eCWiKjBr7DyfGVs+oQMS4KzaCx9gXQ+5L7RPn1kfzskqQ5YhJWl MxdAebUY8rFIDy3E8Dkh0gd48Oth3It9N5Wyzxjc1rIOBLT+G0rtR3FLAkSF5iOmKf TA0Q2rCoQNAeRrOr90sXlWdJI/Zay1XXoKbW6g/g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+f264bffdfbd5614f3bb2@syzkaller.appspotmail.com, Tadeusz Struk , Andrii Nakryiko Subject: [PATCH 5.15 070/779] bpf: Fix KASAN use-after-free Read in compute_effective_progs Date: Mon, 15 Aug 2022 19:55:14 +0200 Message-Id: <20220815180340.281807316@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tadeusz Struk commit 4c46091ee985ae84c60c5e95055d779fcd291d87 upstream. Syzbot found a Use After Free bug in compute_effective_progs(). The reproducer creates a number of BPF links, and causes a fault injected alloc to fail, while calling bpf_link_detach on them. Link detach triggers the link to be freed by bpf_link_free(), which calls __cgroup_bpf_detach() and update_effective_progs(). If the memory allocation in this function fails, the function restores the pointer to the bpf_cgroup_link on the cgroup list, but the memory gets freed just after it returns. After this, every subsequent call to update_effective_progs() causes this already deallocated pointer to be dereferenced in prog_list_length(), and triggers KASAN UAF error. To fix this issue don't preserve the pointer to the prog or link in the list, but remove it and replace it with a dummy prog without shrinking the table. The subsequent call to __cgroup_bpf_detach() or __cgroup_bpf_detach() will correct it. Fixes: af6eea57437a ("bpf: Implement bpf_link-based cgroup BPF program atta= chment") Reported-by: Signed-off-by: Tadeusz Struk Signed-off-by: Andrii Nakryiko Cc: Link: https://syzkaller.appspot.com/bug?id=3D8ebf179a95c2a2670f7cf1ba62429e= c044369db4 Link: https://lore.kernel.org/bpf/20220517180420.87954-1-tadeusz.struk@lina= ro.org Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- kernel/bpf/cgroup.c | 70 ++++++++++++++++++++++++++++++++++++++++++++---= ----- 1 file changed, 60 insertions(+), 10 deletions(-) --- a/kernel/bpf/cgroup.c +++ b/kernel/bpf/cgroup.c @@ -668,6 +668,60 @@ static struct bpf_prog_list *find_detach } =20 /** + * purge_effective_progs() - After compute_effective_progs fails to alloc = new + * cgrp->bpf.inactive table we can recover by + * recomputing the array in place. + * + * @cgrp: The cgroup which descendants to travers + * @prog: A program to detach or NULL + * @link: A link to detach or NULL + * @atype: Type of detach operation + */ +static void purge_effective_progs(struct cgroup *cgrp, struct bpf_prog *pr= og, + struct bpf_cgroup_link *link, + enum cgroup_bpf_attach_type atype) +{ + struct cgroup_subsys_state *css; + struct bpf_prog_array *progs; + struct bpf_prog_list *pl; + struct list_head *head; + struct cgroup *cg; + int pos; + + /* recompute effective prog array in place */ + css_for_each_descendant_pre(css, &cgrp->self) { + struct cgroup *desc =3D container_of(css, struct cgroup, self); + + if (percpu_ref_is_zero(&desc->bpf.refcnt)) + continue; + + /* find position of link or prog in effective progs array */ + for (pos =3D 0, cg =3D desc; cg; cg =3D cgroup_parent(cg)) { + if (pos && !(cg->bpf.flags[atype] & BPF_F_ALLOW_MULTI)) + continue; + + head =3D &cg->bpf.progs[atype]; + list_for_each_entry(pl, head, node) { + if (!prog_list_prog(pl)) + continue; + if (pl->prog =3D=3D prog && pl->link =3D=3D link) + goto found; + pos++; + } + } +found: + BUG_ON(!cg); + progs =3D rcu_dereference_protected( + desc->bpf.effective[atype], + lockdep_is_held(&cgroup_mutex)); + + /* Remove the program from the array */ + WARN_ONCE(bpf_prog_array_delete_safe_at(progs, pos), + "Failed to purge a prog from array at index %d", pos); + } +} + +/** * __cgroup_bpf_detach() - Detach the program or link from a cgroup, and * propagate the change to descendants * @cgrp: The cgroup which descendants to traverse @@ -686,7 +740,6 @@ int __cgroup_bpf_detach(struct cgroup *c struct bpf_prog_list *pl; struct list_head *progs; u32 flags; - int err; =20 atype =3D to_cgroup_bpf_attach_type(type); if (atype < 0) @@ -708,9 +761,12 @@ int __cgroup_bpf_detach(struct cgroup *c pl->prog =3D NULL; pl->link =3D NULL; =20 - err =3D update_effective_progs(cgrp, atype); - if (err) - goto cleanup; + if (update_effective_progs(cgrp, atype)) { + /* if update effective array failed replace the prog with a dummy prog*/ + pl->prog =3D old_prog; + pl->link =3D link; + purge_effective_progs(cgrp, old_prog, link, atype); + } =20 /* now can actually delete it from this cgroup list */ list_del(&pl->node); @@ -722,12 +778,6 @@ int __cgroup_bpf_detach(struct cgroup *c bpf_prog_put(old_prog); static_branch_dec(&cgroup_bpf_enabled_key[atype]); return 0; - -cleanup: - /* restore back prog or link */ - pl->prog =3D old_prog; - pl->link =3D link; - return err; } =20 /* Must be called with cgroup_mutex held to avoid races. */ From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 915B2C00140 for ; Mon, 15 Aug 2022 18:21:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240379AbiHOSVQ (ORCPT ); Mon, 15 Aug 2022 14:21:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240253AbiHOST2 (ORCPT ); Mon, 15 Aug 2022 14:19:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4ABC72C116; Mon, 15 Aug 2022 11:16:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9C10A612AB; Mon, 15 Aug 2022 18:16:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A260DC433D6; Mon, 15 Aug 2022 18:16:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587389; bh=sH5rG9uoPul61dSov+HrwWJVewCXj4uCwxxsQa5AiS0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DkEGoZw6FrAqngiHFsZQs0p/snWq3kEA5oCnEFBJToK7Nz6GPDY7oX+T1rz9CubDN S0zyuZKPiuSIYg7StUhWqPX6k6u4LBOhZwue4faNfdyQnLaQVmRuudBNEBibncURjQ 2MmHgFPH4D0rpBonDU1JOi+nqDfWy/FwgSDao4Pw= 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.15 071/779] btrfs: reject log replay if there is unsupported RO compat flag Date: Mon, 15 Aug 2022 19:55:15 +0200 Message-Id: <20220815180340.317778775@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 dc4d31684974d140250f3ee612c3f0cab13b3146 upstream. [BUG] If we have a btrfs image with dirty log, along with an unsupported RO compatible flag: log_root 30474240 ... compat_flags 0x0 compat_ro_flags 0x40000003 ( FREE_SPACE_TREE | FREE_SPACE_TREE_VALID | unknown flag: 0x40000000 ) Then even if we can only mount it RO, we will still cause metadata update for log replay: BTRFS info (device dm-1): flagging fs with big metadata feature BTRFS info (device dm-1): using free space tree BTRFS info (device dm-1): has skinny extents BTRFS info (device dm-1): start tree-log replay This is definitely against RO compact flag requirement. [CAUSE] RO compact flag only forces us to do RO mount, but we will still do log replay for plain RO mount. Thus this will result us to do log replay and update metadata. This can be very problematic for new RO compat flag, for example older kernel can not understand v2 cache, and if we allow metadata update on RO mount and invalidate/corrupt v2 cache. [FIX] Just reject the mount unless rescue=3Dnologreplay is provided: BTRFS error (device dm-1): cannot replay dirty log with unsupport optiona= l features (0x40000000), try rescue=3Dnologreplay instead We don't want to set rescue=3Dnologreply directly, as this would make the end user to read the old data, and cause confusion. Since the such case is really rare, we're mostly fine to just reject the mount with an error message, which also includes the proper workaround. CC: stable@vger.kernel.org #4.9+ Signed-off-by: Qu Wenruo Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/btrfs/disk-io.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -3557,6 +3557,20 @@ int __cold open_ctree(struct super_block btrfs_err(fs_info, "failed to init dev_replace: %d", ret); goto fail_block_groups; } + /* + * We have unsupported RO compat features, although RO mounted, we + * should not cause any metadata write, including log replay. + * Or we could screw up whatever the new feature requires. + */ + if (unlikely(features && btrfs_super_log_root(disk_super) && + !btrfs_test_opt(fs_info, NOLOGREPLAY))) { + btrfs_err(fs_info, +"cannot replay dirty log with unsupported compat_ro features (0x%llx), try= rescue=3Dnologreplay", + features); + err =3D -EINVAL; + goto fail_alloc; + } + =20 ret =3D btrfs_check_zoned_mode(fs_info); if (ret) { From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34B06C00140 for ; Mon, 15 Aug 2022 18:21:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240618AbiHOSVY (ORCPT ); Mon, 15 Aug 2022 14:21:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240467AbiHOSUM (ORCPT ); Mon, 15 Aug 2022 14:20:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 430712C138; Mon, 15 Aug 2022 11:16: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 61C8A612B1; Mon, 15 Aug 2022 18:16:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69E8EC43141; Mon, 15 Aug 2022 18:16:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587394; bh=/ETDo4V7GPQUwRsVjK5Nh+gt4dXLrxqWmPgcWmO53ls=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XzFX/bgnhFbcUCkUfhymcc0hHFNdS1n3DrU6UV/lBYVKpV88WfDWOrmWJOWqvUFG+ NeSwsThjkhOzI7/6mCZGXZB2tVg02dvABDkGtNtXfkEWDxSXOLUgayN/wuDW2VeOND /DQmHx5Af/RMQst8R4rN8ldysM34F30qS77pa2q8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Olga Kitaina , Amit Kumar Mahapatra , Miquel Raynal Subject: [PATCH 5.15 072/779] mtd: rawnand: arasan: Fix clock rate in NV-DDR Date: Mon, 15 Aug 2022 19:55:16 +0200 Message-Id: <20220815180340.367412598@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Olga Kitaina commit e16eceea863b417fd328588b1be1a79de0bc937f upstream. According to the Arasan NAND controller spec, the flash clock rate for SDR must be <=3D 100 MHz, while for NV-DDR it must be the same as the rate of t= he CLK line for the mode. The driver previously always set 100 MHz for NV-DDR, which would result in incorrect behavior for NV-DDR modes 0-4. The appropriate clock rate can be calculated from the NV-DDR timing parameters as 1/tCK, or for rates measured in picoseconds, 10^12 / nand_nvddr_timings->tCK_min. Fixes: 197b88fecc50 ("mtd: rawnand: arasan: Add new Arasan NAND controller") CC: stable@vger.kernel.org # 5.8+ Signed-off-by: Olga Kitaina Signed-off-by: Amit Kumar Mahapatra Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220628154824.12222-3-amit.kumar-m= ahapatra@xilinx.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/mtd/nand/raw/arasan-nand-controller.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/drivers/mtd/nand/raw/arasan-nand-controller.c +++ b/drivers/mtd/nand/raw/arasan-nand-controller.c @@ -1043,7 +1043,13 @@ static int anfc_setup_interface(struct n DQS_BUFF_SEL_OUT(dqs_mode); } =20 - anand->clk =3D ANFC_XLNX_SDR_DFLT_CORE_CLK; + if (nand_interface_is_sdr(conf)) { + anand->clk =3D ANFC_XLNX_SDR_DFLT_CORE_CLK; + } else { + /* ONFI timings are defined in picoseconds */ + anand->clk =3D div_u64((u64)NSEC_PER_SEC * 1000, + conf->timings.nvddr.tCK_min); + } =20 /* * Due to a hardware bug in the ZynqMP SoC, SDR timing modes 0-1 work From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABF58C00140 for ; Mon, 15 Aug 2022 18:21:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240788AbiHOSVj (ORCPT ); Mon, 15 Aug 2022 14:21:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232271AbiHOSUX (ORCPT ); Mon, 15 Aug 2022 14:20:23 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F21E52AE27; Mon, 15 Aug 2022 11:16:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 44FFACE125B; Mon, 15 Aug 2022 18:16:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A171C433D6; Mon, 15 Aug 2022 18:16:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587397; bh=90TsjMqOUNEM4+jK+tHM4C/XBOy4yWf55oPYVu5rl94=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iTTAmk6fW1n3bnvoLp3QTbd56Sg7hJQwbe/Wj64PQeu2U2n+MbMzUknGvsU9qoyiX tFcP37X1GTp9zktFDdxOteC2hqHOLYt2pJTnOQP2tfs8+zE3Vt2gLHc2LVx3g4bmN1 DipenXouxP53bgosaKE5zP17lEAHAh6K7+wddqp0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Amit Kumar Mahapatra , Miquel Raynal Subject: [PATCH 5.15 073/779] mtd: rawnand: arasan: Update NAND bus clock instead of system clock Date: Mon, 15 Aug 2022 19:55:17 +0200 Message-Id: <20220815180340.420762155@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Amit Kumar Mahapatra commit 7499bfeedb47efc1ee4dc793b92c610d46e6d6a6 upstream. In current implementation the Arasan NAND driver is updating the system clock(i.e., anand->clk) in accordance to the timing modes (i.e., SDR or NVDDR). But as per the Arasan NAND controller spec the flash clock or the NAND bus clock(i.e., nfc->bus_clk), need to be updated instead. This patch keeps the system clock unchanged and updates the NAND bus clock as per the timing modes. Fixes: 197b88fecc50 ("mtd: rawnand: arasan: Add new Arasan NAND controller") CC: stable@vger.kernel.org # 5.8+ Signed-off-by: Amit Kumar Mahapatra Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220628154824.12222-2-amit.kumar-m= ahapatra@xilinx.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/mtd/nand/raw/arasan-nand-controller.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/mtd/nand/raw/arasan-nand-controller.c +++ b/drivers/mtd/nand/raw/arasan-nand-controller.c @@ -347,17 +347,17 @@ static int anfc_select_target(struct nan =20 /* Update clock frequency */ if (nfc->cur_clk !=3D anand->clk) { - clk_disable_unprepare(nfc->controller_clk); - ret =3D clk_set_rate(nfc->controller_clk, anand->clk); + clk_disable_unprepare(nfc->bus_clk); + ret =3D clk_set_rate(nfc->bus_clk, anand->clk); if (ret) { dev_err(nfc->dev, "Failed to change clock rate\n"); return ret; } =20 - ret =3D clk_prepare_enable(nfc->controller_clk); + ret =3D clk_prepare_enable(nfc->bus_clk); if (ret) { dev_err(nfc->dev, - "Failed to re-enable the controller clock\n"); + "Failed to re-enable the bus clock\n"); return ret; } From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2282AC00140 for ; Mon, 15 Aug 2022 18:21:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240746AbiHOSVe (ORCPT ); Mon, 15 Aug 2022 14:21:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233670AbiHOSUY (ORCPT ); Mon, 15 Aug 2022 14:20: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 926DB2A735; Mon, 15 Aug 2022 11:16: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 32C1D612A3; Mon, 15 Aug 2022 18:16:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B01BC43470; Mon, 15 Aug 2022 18:16:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587400; bh=36kaqV//Q65MyMm68X4c+Dpwi17dNDifBxO1QrGo2o8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N0lnTMnKnrchyyRCb1uDQsh1144vgP4dJPIQW2x1sXPXgSP8tUBf2DoKJtfFkS9VO 0zW1rge3BHQllOtJwzLdzi/7WcFtqyWDttyfComR3AxRaXw4pCBG1Hqd80tdSVwANy 6etzfJ48Pv5FDE4YgBFGcWLh7QD4VVr3NvRuTSgE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benjamin Beichler , Richard Weinberger Subject: [PATCH 5.15 074/779] um: Remove straying parenthesis Date: Mon, 15 Aug 2022 19:55:18 +0200 Message-Id: <20220815180340.462895841@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Beichler commit c6496e0a4a90d8149203c16323cff3fa46e422e7 upstream. Commit e3a33af812c6 ("um: fix and optimize xor select template for CONFIG64= and timetravel mode") caused a build regression when CONFIG_XOR_BLOCKS and CONFIG_UML_TIME_TRAVEL= _SUPPORT are selected. Fix it by removing the straying parenthesis. Cc: stable@vger.kernel.org Fixes: e3a33af812c6 ("um: fix and optimize xor select template for CONFIG64= and timetravel mode") Signed-off-by: Benjamin Beichler [rw: Added commit message] Signed-off-by: Richard Weinberger Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/um/include/asm/xor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/um/include/asm/xor.h +++ b/arch/um/include/asm/xor.h @@ -18,7 +18,7 @@ #undef XOR_SELECT_TEMPLATE /* pick an arbitrary one - measuring isn't possible with inf-cpu */ #define XOR_SELECT_TEMPLATE(x) \ - (time_travel_mode =3D=3D TT_MODE_INFCPU ? TT_CPU_INF_XOR_DEFAULT : x)) + (time_travel_mode =3D=3D TT_MODE_INFCPU ? TT_CPU_INF_XOR_DEFAULT : x) #endif =20 #endif From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D669C00140 for ; Mon, 15 Aug 2022 18:21:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240860AbiHOSVp (ORCPT ); Mon, 15 Aug 2022 14:21:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240525AbiHOSUg (ORCPT ); Mon, 15 Aug 2022 14:20:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC5372C649; Mon, 15 Aug 2022 11:16:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 470CD612A8; Mon, 15 Aug 2022 18:16:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E0E6C433D7; Mon, 15 Aug 2022 18:16:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587403; bh=yeoemor4Uw73NOtS6LeNA/ED035gV3a0eFSZ4fQXmWI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SodHEgrPNzSsMgDyLGPqUeRA23ATUSu5nOeGnK0aU0a3c/qB+fKuMHlqSEgeY5Dvf N62X7/8YcS/PMbdpyOysTz/7fZ6OIdBhs3DxeLWr6sJKTVFaAMgzeu8xCRdvrEAjSs thqmLRDj+AHuLKBWmqy364D7IuHtqXQI/Bf5WlTs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johannes Berg , Anton Ivanov , "Jason A. Donenfeld" Subject: [PATCH 5.15 075/779] um: seed rng using host OS rng Date: Mon, 15 Aug 2022 19:55:19 +0200 Message-Id: <20220815180340.499355405@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 commit 0b9ba6135d7f18b82f3d8bebb55ded725ba88e0e upstream. UML generally does not provide access to special CPU instructions like RDRAND, and execution tends to be rather deterministic, with no real hardware interrupts, making good randomness really very hard, if not all together impossible. Not only is this a security eyebrow raiser, but it's also quite annoying when trying to do various pieces of UML-based automation that takes a long time to boot, if ever. Fix this by trivially calling getrandom() in the host and using that seed as "bootloader randomness", which initializes the rng immediately at UML boot. The old behavior can be restored the same way as on any other arch, by way of CONFIG_TRUST_BOOTLOADER_RANDOMNESS=3Dn or random.trust_bootloader=3D0. So seen from that perspective, this just makes UML act like other archs, which is positive in its own right. Additionally, wire up arch_get_random_{int,long}() in the same way, so that reseeds can also make use of the host RNG, controllable by CONFIG_TRUST_CPU_RANDOMNESS and random.trust_cpu, per usual. Cc: stable@vger.kernel.org Acked-by: Johannes Berg Acked-By: Anton Ivanov Signed-off-by: Jason A. Donenfeld Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/um/include/asm/archrandom.h | 30 ++++++++++++++++++++++++++++++ arch/um/include/shared/os.h | 7 +++++++ arch/um/kernel/um_arch.c | 8 ++++++++ arch/um/os-Linux/util.c | 6 ++++++ 4 files changed, 51 insertions(+) create mode 100644 arch/um/include/asm/archrandom.h --- /dev/null +++ b/arch/um/include/asm/archrandom.h @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __ASM_UM_ARCHRANDOM_H__ +#define __ASM_UM_ARCHRANDOM_H__ + +#include + +/* This is from , but better not to #include that in a global header= here. */ +ssize_t os_getrandom(void *buf, size_t len, unsigned int flags); + +static inline bool __must_check arch_get_random_long(unsigned long *v) +{ + return os_getrandom(v, sizeof(*v), 0) =3D=3D sizeof(*v); +} + +static inline bool __must_check arch_get_random_int(unsigned int *v) +{ + return os_getrandom(v, sizeof(*v), 0) =3D=3D sizeof(*v); +} + +static inline bool __must_check arch_get_random_seed_long(unsigned long *v) +{ + return false; +} + +static inline bool __must_check arch_get_random_seed_int(unsigned int *v) +{ + return false; +} + +#endif --- a/arch/um/include/shared/os.h +++ b/arch/um/include/shared/os.h @@ -11,6 +11,12 @@ #include #include #include +/* This is to get size_t */ +#ifndef __UM_HOST__ +#include +#else +#include +#endif =20 #define CATCH_EINTR(expr) while ((errno =3D 0, ((expr) < 0)) && (errno =3D= =3D EINTR)) =20 @@ -252,6 +258,7 @@ extern void stack_protections(unsigned l extern int raw(int fd); extern void setup_machinename(char *machine_out); extern void setup_hostinfo(char *buf, int len); +extern ssize_t os_getrandom(void *buf, size_t len, unsigned int flags); extern void os_dump_core(void) __attribute__ ((noreturn)); extern void um_early_printk(const char *s, unsigned int n); extern void os_fix_helper_signals(void); --- a/arch/um/kernel/um_arch.c +++ b/arch/um/kernel/um_arch.c @@ -16,6 +16,7 @@ #include #include #include +#include =20 #include #include @@ -404,6 +405,8 @@ int __init __weak read_initrd(void) =20 void __init setup_arch(char **cmdline_p) { + u8 rng_seed[32]; + stack_protections((unsigned long) &init_thread_info); setup_physmem(uml_physmem, uml_reserved, physmem_size, highmem); mem_total_pages(physmem_size, iomem_size, highmem); @@ -413,6 +416,11 @@ void __init setup_arch(char **cmdline_p) strlcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); *cmdline_p =3D command_line; setup_hostinfo(host_info, sizeof host_info); + + if (os_getrandom(rng_seed, sizeof(rng_seed), 0) =3D=3D sizeof(rng_seed)) { + add_bootloader_randomness(rng_seed, sizeof(rng_seed)); + memzero_explicit(rng_seed, sizeof(rng_seed)); + } } =20 void __init check_bugs(void) --- a/arch/um/os-Linux/util.c +++ b/arch/um/os-Linux/util.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include =20 @@ -96,6 +97,11 @@ static inline void __attribute__ ((noret exit(127); } =20 +ssize_t os_getrandom(void *buf, size_t len, unsigned int flags) +{ + return getrandom(buf, len, flags); +} + /* * UML helper threads must not handle SIGWINCH/INT/TERM */ From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C380C00140 for ; Mon, 15 Aug 2022 18:21:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231436AbiHOSVw (ORCPT ); Mon, 15 Aug 2022 14:21:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240654AbiHOSUo (ORCPT ); Mon, 15 Aug 2022 14:20: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 429D02C669; Mon, 15 Aug 2022 11:16: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 D950CB8106C; Mon, 15 Aug 2022 18:16:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31FC0C433D6; Mon, 15 Aug 2022 18:16:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587406; bh=Atfdsdi8h9Ub1cnJDu2gkrI2QGWBUcfrKIUIaTCa4Eg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aCg4oG3ST7hmD+wOEyVZ+wfnPBt+4bqWf0Z7Cb0PO3M5tbQN7zqqbk8lC94Jpvt7W gmKibv0Dz3MhtJSmxZAJHYu2zVhcT2swwB9yDX/qEldXeMz6bInfQHxDKB3JgjGzFp N82rhLYAL+/WOa1yXILXPnQ4LbJVNyenyXksJiR8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fawzi Khaber , Jean-Baptiste Maneyrol , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 5.15 076/779] iio: fix iio_format_avail_range() printing for none IIO_VAL_INT Date: Mon, 15 Aug 2022 19:55:20 +0200 Message-Id: <20220815180340.548731211@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Fawzi Khaber commit 5e1f91850365de55ca74945866c002fda8f00331 upstream. iio_format_avail_range() should print range as follow [min, step, max], so the function was previously calling iio_format_list() with length =3D 3, length variable refers to the array size of values not the number of elements. In case of non IIO_VAL_INT values each element has integer part and decimal part. With length =3D 3 this would cause premature end of loop and result in printing only one element. Signed-off-by: Fawzi Khaber Signed-off-by: Jean-Baptiste Maneyrol Fixes: eda20ba1e25e ("iio: core: Consolidate iio_format_avail_{list,range}(= )") Link: https://lore.kernel.org/r/20220718130706.32571-1-jmaneyrol@invensense= .com Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/iio/industrialio-core.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -818,7 +818,23 @@ static ssize_t iio_format_avail_list(cha =20 static ssize_t iio_format_avail_range(char *buf, const int *vals, int type) { - return iio_format_list(buf, vals, type, 3, "[", "]"); + int length; + + /* + * length refers to the array size , not the number of elements. + * The purpose is to print the range [min , step ,max] so length should + * be 3 in case of int, and 6 for other types. + */ + switch (type) { + case IIO_VAL_INT: + length =3D 3; + break; + default: + length =3D 6; + break; + } + + return iio_format_list(buf, vals, type, length, "[", "]"); } =20 static ssize_t iio_read_channel_info_avail(struct device *dev, From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E33DC00140 for ; Mon, 15 Aug 2022 18:21:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240958AbiHOSVz (ORCPT ); Mon, 15 Aug 2022 14:21:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240690AbiHOSUp (ORCPT ); Mon, 15 Aug 2022 14:20:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B6BD2CC81; Mon, 15 Aug 2022 11:16: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 99B60B81071; Mon, 15 Aug 2022 18:16:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12BE2C433D6; Mon, 15 Aug 2022 18:16:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587409; bh=72iw2wQ65KIGB4P3ShPzgBQnjxHwzejp/XEhvwJNXXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mzXa2r1JQ9zY5QJdHinfK+1HXHvKwXiTNVp0hMDhEZz+pF1s9QXU1kQzqWT+sKK6E gkUDayZY/X8BmujoEES6joLt/zMA5bhbPHbFbN5cHSsAtQZYAcS+AONfRl3DQQWwn/ 0MMH5PfTNCt0JKI09M5Oxb7Lkhgzqi0M0AHzNptI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Stable@vger.kernel.org, Jonathan Cameron Subject: [PATCH 5.15 077/779] iio: light: isl29028: Fix the warning in isl29028_remove() Date: Mon, 15 Aug 2022 19:55:21 +0200 Message-Id: <20220815180340.589070925@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 commit 06674fc7c003b9d0aa1d37fef7ab2c24802cc6ad upstream. The driver use the non-managed form of the register function in isl29028_remove(). To keep the release order as mirroring the ordering in probe, the driver should use non-managed form in probe, too. The following log reveals it: [ 32.374955] isl29028 0-0010: remove [ 32.376861] general protection fault, probably for non-canonical address= 0xdffffc0000000006: 0000 [#1] PREEMPT SMP KASAN PTI [ 32.377676] KASAN: null-ptr-deref in range [0x0000000000000030-0x0000000= 000000037] [ 32.379432] RIP: 0010:kernfs_find_and_get_ns+0x28/0xe0 [ 32.385461] Call Trace: [ 32.385807] sysfs_unmerge_group+0x59/0x110 [ 32.386110] dpm_sysfs_remove+0x58/0xc0 [ 32.386391] device_del+0x296/0xe50 [ 32.386959] cdev_device_del+0x1d/0xd0 [ 32.387231] devm_iio_device_unreg+0x27/0xb0 [ 32.387542] devres_release_group+0x319/0x3d0 [ 32.388162] i2c_device_remove+0x93/0x1f0 Fixes: 2db5054ac28d ("staging: iio: isl29028: add runtime power management = support") Signed-off-by: Zheyu Ma Link: https://lore.kernel.org/r/20220717004241.2281028-1-zheyuma97@gmail.com Cc: Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/iio/light/isl29028.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/iio/light/isl29028.c +++ b/drivers/iio/light/isl29028.c @@ -625,7 +625,7 @@ static int isl29028_probe(struct i2c_cli ISL29028_POWER_OFF_DELAY_MS); pm_runtime_use_autosuspend(&client->dev); =20 - ret =3D devm_iio_device_register(indio_dev->dev.parent, indio_dev); + ret =3D iio_device_register(indio_dev); if (ret < 0) { dev_err(&client->dev, "%s(): iio registration failed with error %d\n", From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB7AAC00140 for ; Mon, 15 Aug 2022 18:22:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240182AbiHOSWR (ORCPT ); Mon, 15 Aug 2022 14:22:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240271AbiHOSVJ (ORCPT ); Mon, 15 Aug 2022 14:21:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68BB62CCB4; Mon, 15 Aug 2022 11:16: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 98C52B81076; Mon, 15 Aug 2022 18:16:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7E10C433C1; Mon, 15 Aug 2022 18:16:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587412; bh=a6j4RgwOgiEoI3IwAnr6EUont6HIFzm1Q6gAlMKqAhs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s4oFIyipyGmHmFwVUdvjx5mdnibkRdYmxHiani6iOk3Zw4pUJG2HUYPfLNPfoQHh3 qH3XTVbcPQ9AQKNjgzNRskAAZY9QK8YVUfW9iGMq65VRBC9okumdBKmhDpf2OVgN1T tyraaay7dB8xWBn+T2c5OmrRLJfygtiYl+uyk5hw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Douglas Gilbert , Tony Battersby , "Martin K. Petersen" Subject: [PATCH 5.15 078/779] scsi: sg: Allow waiting for commands to complete on removed device Date: Mon, 15 Aug 2022 19:55:22 +0200 Message-Id: <20220815180340.637103624@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tony Battersby commit 3455607fd7be10b449f5135c00dc306b85dc0d21 upstream. When a SCSI device is removed while in active use, currently sg will immediately return -ENODEV on any attempt to wait for active commands that were sent before the removal. This is problematic for commands that use SG_FLAG_DIRECT_IO since the data buffer may still be in use by the kernel when userspace frees or reuses it after getting ENODEV, leading to corrupted userspace memory (in the case of READ-type commands) or corrupted data being sent to the device (in the case of WRITE-type commands). This has been seen in practice when logging out of a iscsi_tcp session, where the iSCSI driver may still be processing commands after the device has been marked for removal. Change the policy to allow userspace to wait for active sg commands even when the device is being removed. Return -ENODEV only when there are no more responses to read. Link: https://lore.kernel.org/r/5ebea46f-fe83-2d0b-233d-d0dcb362dd0a@cybern= etics.com Cc: Acked-by: Douglas Gilbert Signed-off-by: Tony Battersby Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/sg.c | 53 +++++++++++++++++++++++++++++++++----------------= ---- 1 file changed, 33 insertions(+), 20 deletions(-) --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -191,7 +191,7 @@ static void sg_link_reserve(Sg_fd * sfp, static void sg_unlink_reserve(Sg_fd * sfp, Sg_request * srp); static Sg_fd *sg_add_sfp(Sg_device * sdp); static void sg_remove_sfp(struct kref *); -static Sg_request *sg_get_rq_mark(Sg_fd * sfp, int pack_id); +static Sg_request *sg_get_rq_mark(Sg_fd * sfp, int pack_id, bool *busy); static Sg_request *sg_add_request(Sg_fd * sfp); static int sg_remove_request(Sg_fd * sfp, Sg_request * srp); static Sg_device *sg_get_dev(int dev); @@ -445,6 +445,7 @@ sg_read(struct file *filp, char __user * Sg_fd *sfp; Sg_request *srp; int req_pack_id =3D -1; + bool busy; sg_io_hdr_t *hp; struct sg_header *old_hdr; int retval; @@ -467,20 +468,16 @@ sg_read(struct file *filp, char __user * if (retval) return retval; =20 - srp =3D sg_get_rq_mark(sfp, req_pack_id); + srp =3D sg_get_rq_mark(sfp, req_pack_id, &busy); if (!srp) { /* now wait on packet to arrive */ - if (atomic_read(&sdp->detaching)) - return -ENODEV; if (filp->f_flags & O_NONBLOCK) return -EAGAIN; retval =3D wait_event_interruptible(sfp->read_wait, - (atomic_read(&sdp->detaching) || - (srp =3D sg_get_rq_mark(sfp, req_pack_id)))); - if (atomic_read(&sdp->detaching)) - return -ENODEV; - if (retval) - /* -ERESTARTSYS as signal hit process */ - return retval; + ((srp =3D sg_get_rq_mark(sfp, req_pack_id, &busy)) || + (!busy && atomic_read(&sdp->detaching)))); + if (!srp) + /* signal or detaching */ + return retval ? retval : -ENODEV; } if (srp->header.interface_id !=3D '\0') return sg_new_read(sfp, buf, count, srp); @@ -941,9 +938,7 @@ sg_ioctl_common(struct file *filp, Sg_de if (result < 0) return result; result =3D wait_event_interruptible(sfp->read_wait, - (srp_done(sfp, srp) || atomic_read(&sdp->detaching))); - if (atomic_read(&sdp->detaching)) - return -ENODEV; + srp_done(sfp, srp)); write_lock_irq(&sfp->rq_list_lock); if (srp->done) { srp->done =3D 2; @@ -2056,19 +2051,28 @@ sg_unlink_reserve(Sg_fd * sfp, Sg_reques } =20 static Sg_request * -sg_get_rq_mark(Sg_fd * sfp, int pack_id) +sg_get_rq_mark(Sg_fd * sfp, int pack_id, bool *busy) { Sg_request *resp; unsigned long iflags; =20 + *busy =3D false; write_lock_irqsave(&sfp->rq_list_lock, iflags); list_for_each_entry(resp, &sfp->rq_list, entry) { - /* look for requests that are ready + not SG_IO owned */ - if ((1 =3D=3D resp->done) && (!resp->sg_io_owned) && + /* look for requests that are not SG_IO owned */ + if ((!resp->sg_io_owned) && ((-1 =3D=3D pack_id) || (resp->header.pack_id =3D=3D pack_id))) { - resp->done =3D 2; /* guard against other readers */ - write_unlock_irqrestore(&sfp->rq_list_lock, iflags); - return resp; + switch (resp->done) { + case 0: /* request active */ + *busy =3D true; + break; + case 1: /* request done; response ready to return */ + resp->done =3D 2; /* guard against other readers */ + write_unlock_irqrestore(&sfp->rq_list_lock, iflags); + return resp; + case 2: /* response already being returned */ + break; + } } } write_unlock_irqrestore(&sfp->rq_list_lock, iflags); @@ -2122,6 +2126,15 @@ sg_remove_request(Sg_fd * sfp, Sg_reques res =3D 1; } write_unlock_irqrestore(&sfp->rq_list_lock, iflags); + + /* + * If the device is detaching, wakeup any readers in case we just + * removed the last response, which would leave nothing for them to + * return other than -ENODEV. + */ + if (unlikely(atomic_read(&sfp->parentdp->detaching))) + wake_up_interruptible_all(&sfp->read_wait); + return res; } From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BEB9EC25B08 for ; Mon, 15 Aug 2022 18:22:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240951AbiHOSWY (ORCPT ); Mon, 15 Aug 2022 14:22:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240662AbiHOSVa (ORCPT ); Mon, 15 Aug 2022 14:21:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74C5D2CDF0; Mon, 15 Aug 2022 11:16: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 AE368B81071; Mon, 15 Aug 2022 18:16:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17E56C433D6; Mon, 15 Aug 2022 18:16:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587415; bh=jbvQF9qqbYn9fBWoLePnExj46MkZddOcp2UTWQteFyo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f5tbykd7zc4EyTx5YZTrwd9P7NDbXxpATrjZR1ZD8Os97OFju1iwAy1Rs/o1uANeS CQ5b7hXD0BfkPLl3LZjOYnMsaIF9HFFXVGz0wu+R1M9pYdAyXfzFRpwEyG5pGBHaz8 vTIwLuKEoZtCxwsLR0dwBOi22KwmtT+qdrwESXoU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Himanshu Madhani , Bikash Hazarika , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.15 079/779] scsi: qla2xxx: Fix incorrect display of max frame size Date: Mon, 15 Aug 2022 19:55:23 +0200 Message-Id: <20220815180340.678895685@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bikash Hazarika commit cf3b4fb655796674e605268bd4bfb47a47c8bce6 upstream. Replace display field with the correct field. Link: https://lore.kernel.org/r/20220713052045.10683-3-njavali@marvell.com Fixes: 8777e4314d39 ("scsi: qla2xxx: Migrate NVME N2N handling into state m= achine") Cc: stable@vger.kernel.org Reviewed-by: Himanshu Madhani Signed-off-by: Bikash Hazarika Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_def.h | 1 + drivers/scsi/qla2xxx/qla_gs.c | 9 +++------ drivers/scsi/qla2xxx/qla_init.c | 2 ++ drivers/scsi/qla2xxx/qla_isr.c | 4 +--- 4 files changed, 7 insertions(+), 9 deletions(-) --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -3972,6 +3972,7 @@ struct qla_hw_data { /* SRB cache. */ #define SRB_MIN_REQ 128 mempool_t *srb_mempool; + u8 port_name[WWN_SIZE]; =20 volatile struct { uint32_t mbox_int :1; --- a/drivers/scsi/qla2xxx/qla_gs.c +++ b/drivers/scsi/qla2xxx/qla_gs.c @@ -1595,7 +1595,6 @@ qla2x00_hba_attributes(scsi_qla_host_t * unsigned int callopt) { struct qla_hw_data *ha =3D vha->hw; - struct init_cb_24xx *icb24 =3D (void *)ha->init_cb; struct new_utsname *p_sysid =3D utsname(); struct ct_fdmi_hba_attr *eiter; uint16_t alen; @@ -1757,8 +1756,8 @@ qla2x00_hba_attributes(scsi_qla_host_t * /* MAX CT Payload Length */ eiter =3D entries + size; eiter->type =3D cpu_to_be16(FDMI_HBA_MAXIMUM_CT_PAYLOAD_LENGTH); - eiter->a.max_ct_len =3D cpu_to_be32(le16_to_cpu(IS_FWI2_CAPABLE(ha) ? - icb24->frame_payload_size : ha->init_cb->frame_payload_size)); + eiter->a.max_ct_len =3D cpu_to_be32(ha->frame_payload_size >> 2); + alen =3D sizeof(eiter->a.max_ct_len); alen +=3D FDMI_ATTR_TYPELEN(eiter); eiter->len =3D cpu_to_be16(alen); @@ -1850,7 +1849,6 @@ qla2x00_port_attributes(scsi_qla_host_t unsigned int callopt) { struct qla_hw_data *ha =3D vha->hw; - struct init_cb_24xx *icb24 =3D (void *)ha->init_cb; struct new_utsname *p_sysid =3D utsname(); char *hostname =3D p_sysid ? p_sysid->nodename : fc_host_system_hostname(vha->host); @@ -1902,8 +1900,7 @@ qla2x00_port_attributes(scsi_qla_host_t /* Max frame size. */ eiter =3D entries + size; eiter->type =3D cpu_to_be16(FDMI_PORT_MAX_FRAME_SIZE); - eiter->a.max_frame_size =3D cpu_to_be32(le16_to_cpu(IS_FWI2_CAPABLE(ha) ? - icb24->frame_payload_size : ha->init_cb->frame_payload_size)); + eiter->a.max_frame_size =3D cpu_to_be32(ha->frame_payload_size); alen =3D sizeof(eiter->a.max_frame_size); alen +=3D FDMI_ATTR_TYPELEN(eiter); eiter->len =3D cpu_to_be16(alen); --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -4490,6 +4490,8 @@ qla2x00_init_rings(scsi_qla_host_t *vha) BIT_6) !=3D 0; ql_dbg(ql_dbg_init, vha, 0x00bc, "FA-WWPN Support: %s.\n", (ha->flags.fawwpn_enabled) ? "enabled" : "disabled"); + /* Init_cb will be reused for other command(s). Save a backup copy of p= ort_name */ + memcpy(ha->port_name, ha->init_cb->port_name, WWN_SIZE); } =20 /* ELS pass through payload is limit by frame size. */ --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -1354,9 +1354,7 @@ skip_rio: if (!vha->vp_idx) { if (ha->flags.fawwpn_enabled && (ha->current_topology =3D=3D ISP_CFG_F)) { - void *wwpn =3D ha->init_cb->port_name; - - memcpy(vha->port_name, wwpn, WWN_SIZE); + memcpy(vha->port_name, ha->port_name, WWN_SIZE); fc_host_port_name(vha->host) =3D wwn_to_u64(vha->port_name); ql_dbg(ql_dbg_init + ql_dbg_verbose, From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1063BC00140 for ; Mon, 15 Aug 2022 18:22:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241040AbiHOSW1 (ORCPT ); Mon, 15 Aug 2022 14:22:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240562AbiHOSVW (ORCPT ); Mon, 15 Aug 2022 14:21:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E550B2AE3A; Mon, 15 Aug 2022 11:17: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 B4BC9B8107A; Mon, 15 Aug 2022 18:16:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2DAA6C433D6; Mon, 15 Aug 2022 18:16:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587418; bh=zEedom811/5se5b7aljK1JSNDPwuR5xYRPX2z+nxSlI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AsdWK5ASl90fgOJH4CGjojUfzJ4P+zK9pM/Pz1ZsCEtU+1toAjTQLZ6uy5GjjzAVN 0vSiHA5S5XZdONJlVQFprqgEfG3WEMLwQBjurhrQpUENcgaR4gaxpwpmfC0O9ImEAk WLwnASZhqcg95MkvBAs2RxwA0cq7pqzhUWPKdTOM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Himanshu Madhani , Bikash Hazarika , Quinn Tran , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.15 080/779] scsi: qla2xxx: Zero undefined mailbox IN registers Date: Mon, 15 Aug 2022 19:55:24 +0200 Message-Id: <20220815180340.728980504@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bikash Hazarika commit 6c96a3c7d49593ef15805f5e497601c87695abc9 upstream. While requesting a new mailbox command, driver does not write any data to unused registers. Initialize the unused register value to zero while requesting a new mailbox command to prevent stale entry access by firmware. Link: https://lore.kernel.org/r/20220713052045.10683-4-njavali@marvell.com Cc: stable@vger.kernel.org Reviewed-by: Himanshu Madhani Signed-off-by: Bikash Hazarika Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_mbx.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -238,6 +238,8 @@ qla2x00_mailbox_command(scsi_qla_host_t ql_dbg(ql_dbg_mbx, vha, 0x1112, "mbox[%d]<-0x%04x\n", cnt, *iptr); wrt_reg_word(optr, *iptr); + } else { + wrt_reg_word(optr, 0); } =20 mboxes >>=3D 1; From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3AD7BC25B0E for ; Mon, 15 Aug 2022 18:22:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240253AbiHOSWN (ORCPT ); Mon, 15 Aug 2022 14:22:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240053AbiHOSVG (ORCPT ); Mon, 15 Aug 2022 14:21: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 2F9A62AE3B; Mon, 15 Aug 2022 11:17:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3775C6129E; Mon, 15 Aug 2022 18:17:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D4DBC433C1; Mon, 15 Aug 2022 18:17:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587421; bh=Ts3AiSRmTbJJpcUvBliN/0tGoKx4jocfJ/MIf+n3rEc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HS4Ojk+qlArwKYaSlGzjCQEPk79HPTIHDFz7gX3rsYvHNBBwJKVK/51x5rKfWhjvG 5t4q+BP+0UYBcV/Mmtr03KXByq3eh+Jo+aq/Z+1tylwgwuVPhnYMZTaagyeGiqUTfY On5IVke2VTXCWKHRFqZ59PNIdsEAECZiEjNUBh30= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Srinivas Kandagatla , Vinod Koul Subject: [PATCH 5.15 081/779] soundwire: qcom: Check device status before reading devid Date: Mon, 15 Aug 2022 19:55:25 +0200 Message-Id: <20220815180340.760664473@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Srinivas Kandagatla commit aa1262ca66957183ea1fb32a067e145b995f3744 upstream. As per hardware datasheet its recommended that we check the device status before reading devid assigned by auto-enumeration. Without this patch we see SoundWire devices with invalid enumeration addresses on the bus. Cc: stable@vger.kernel.org Fixes: a6e6581942ca ("soundwire: qcom: add auto enumeration support") Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20220706095644.5852-1-srinivas.kandagatla@l= inaro.org Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/soundwire/qcom.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/soundwire/qcom.c +++ b/drivers/soundwire/qcom.c @@ -451,6 +451,10 @@ static int qcom_swrm_enumerate(struct sd char *buf1 =3D (char *)&val1, *buf2 =3D (char *)&val2; =20 for (i =3D 1; i <=3D SDW_MAX_DEVICES; i++) { + /* do not continue if the status is Not Present */ + if (!ctrl->status[i]) + continue; + /*SCP_Devid5 - Devid 4*/ ctrl->reg_read(ctrl, SWRM_ENUMERATOR_SLAVE_DEV_ID_1(i), &val1); From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5139EC00140 for ; Mon, 15 Aug 2022 18:22:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241236AbiHOSWe (ORCPT ); Mon, 15 Aug 2022 14:22:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241079AbiHOSWE (ORCPT ); Mon, 15 Aug 2022 14:22:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40C052A42A; Mon, 15 Aug 2022 11:17: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 ADCD3B81077; Mon, 15 Aug 2022 18:17:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06C61C433C1; Mon, 15 Aug 2022 18:17:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587427; bh=7cyjgV5neVvXvAMFqPTigQYH2UGTWOf11a0mfS7prpU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ai/7EuNTfVcx3ugiD+eXmzUncAnQstWqS+ryLUKNmB1uB9xSkjE8RAif/jgi5tc8j 21T75j8sFqtmuedbFJzv/PXcg6VEE+VJJ+fixyfNikw6ZrvjWYddwIaBl+Wx/og7se db3ncj0C1UfHU5K1wAomgTnW/0Um9xYIEW6K0YDo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Namjae Jeon , Hyunchul Lee , Steve French , zdi-disclosures@trendmicro.com Subject: [PATCH 5.15 082/779] ksmbd: fix memory leak in smb2_handle_negotiate Date: Mon, 15 Aug 2022 19:55:26 +0200 Message-Id: <20220815180340.793635570@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Namjae Jeon commit aa7253c2393f6dcd6a1468b0792f6da76edad917 upstream. The allocated memory didn't free under an error path in smb2_handle_negotiate(). Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3") Cc: stable@vger.kernel.org Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-17815 Signed-off-by: Namjae Jeon Reviewed-by: Hyunchul Lee Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/ksmbd/smb2pdu.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/fs/ksmbd/smb2pdu.c +++ b/fs/ksmbd/smb2pdu.c @@ -1146,12 +1146,16 @@ int smb2_handle_negotiate(struct ksmbd_w status); rsp->hdr.Status =3D status; rc =3D -EINVAL; + kfree(conn->preauth_info); + conn->preauth_info =3D NULL; goto err_out; } =20 rc =3D init_smb3_11_server(conn); if (rc < 0) { rsp->hdr.Status =3D STATUS_INVALID_PARAMETER; + kfree(conn->preauth_info); + conn->preauth_info =3D NULL; goto err_out; } From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B722C25B08 for ; Mon, 15 Aug 2022 18:22:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241285AbiHOSWp (ORCPT ); Mon, 15 Aug 2022 14:22:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241125AbiHOSWI (ORCPT ); Mon, 15 Aug 2022 14:22: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 062382D1C3; Mon, 15 Aug 2022 11:17: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 A01EC6129D; Mon, 15 Aug 2022 18:17:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8EDCCC433D7; Mon, 15 Aug 2022 18:17:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587431; bh=YZhlPoRzd86oPedLQvzIkaXujpPbVM3alz3dIKtTBCc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GYd/g/JkhLTsPL1vSFz6ds0iytbxENrhUFBnJl4LvOSR7UmnPrpTiovC1fbB1LbSx bXcbNaFxi08wg7X98Ex7AxFecXy3bTKt9/a/fAmzXVC4+qz1VcDIlkoltBalVcwaBf FbrG9SeJs/zLJCsbGSKx0PhgT91FqH2WwLfYlQY4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hyunchul Lee , Namjae Jeon , Steve French , zdi-disclosures@trendmicro.com Subject: [PATCH 5.15 083/779] ksmbd: prevent out of bound read for SMB2_TREE_CONNNECT Date: Mon, 15 Aug 2022 19:55:27 +0200 Message-Id: <20220815180340.834525149@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hyunchul Lee commit 824d4f64c20093275f72fc8101394d75ff6a249e upstream. if Status is not 0 and PathLength is long, smb_strndup_from_utf16 could make out of bound read in smb2_tree_connnect. This bug can lead an oops looking something like: [ 1553.882047] BUG: KASAN: slab-out-of-bounds in smb_strndup_from_utf16+0x4= 69/0x4c0 [ksmbd] [ 1553.882064] Read of size 2 at addr ffff88802c4eda04 by task kworker/0:2/= 42805 ... [ 1553.882095] Call Trace: [ 1553.882098] [ 1553.882101] dump_stack_lvl+0x49/0x5f [ 1553.882107] print_report.cold+0x5e/0x5cf [ 1553.882112] ? smb_strndup_from_utf16+0x469/0x4c0 [ksmbd] [ 1553.882122] kasan_report+0xaa/0x120 [ 1553.882128] ? smb_strndup_from_utf16+0x469/0x4c0 [ksmbd] [ 1553.882139] __asan_report_load_n_noabort+0xf/0x20 [ 1553.882143] smb_strndup_from_utf16+0x469/0x4c0 [ksmbd] [ 1553.882155] ? smb_strtoUTF16+0x3b0/0x3b0 [ksmbd] [ 1553.882166] ? __kmalloc_node+0x185/0x430 [ 1553.882171] smb2_tree_connect+0x140/0xab0 [ksmbd] [ 1553.882185] handle_ksmbd_work+0x30e/0x1020 [ksmbd] [ 1553.882197] process_one_work+0x778/0x11c0 [ 1553.882201] ? _raw_spin_lock_irq+0x8e/0xe0 [ 1553.882206] worker_thread+0x544/0x1180 [ 1553.882209] ? __cpuidle_text_end+0x4/0x4 [ 1553.882214] kthread+0x282/0x320 [ 1553.882218] ? process_one_work+0x11c0/0x11c0 [ 1553.882221] ? kthread_complete_and_exit+0x30/0x30 [ 1553.882225] ret_from_fork+0x1f/0x30 [ 1553.882231] There is no need to check error request validation in server. This check allow invalid requests not to validate message. Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3") Cc: stable@vger.kernel.org Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-17818 Signed-off-by: Hyunchul Lee Acked-by: Namjae Jeon Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/ksmbd/smb2misc.c | 5 ----- 1 file changed, 5 deletions(-) --- a/fs/ksmbd/smb2misc.c +++ b/fs/ksmbd/smb2misc.c @@ -91,11 +91,6 @@ static int smb2_get_data_area_len(unsign *off =3D 0; *len =3D 0; =20 - /* error reqeusts do not have data area */ - if (hdr->Status && hdr->Status !=3D STATUS_MORE_PROCESSING_REQUIRED && - (((struct smb2_err_rsp *)hdr)->StructureSize) =3D=3D SMB2_ERROR_STRUC= TURE_SIZE2_LE) - return ret; - /* * Following commands have data areas so we have to get the location * of the data buffer offset and data buffer length for the particular From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFAD5C25B0E for ; Mon, 15 Aug 2022 18:23:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241258AbiHOSXI (ORCPT ); Mon, 15 Aug 2022 14:23:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241074AbiHOSW2 (ORCPT ); Mon, 15 Aug 2022 14:22:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A23552D1DC; Mon, 15 Aug 2022 11:17: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 7227BB8107D; Mon, 15 Aug 2022 18:17:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D17CCC433D6; Mon, 15 Aug 2022 18:17:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587434; bh=y8D86iaIAcMgG4Ko5STDm+qPGW86hj1iLyKTt2iRk+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p1fGUEJaYagkMPtWHkytfcj7czoqgMxCDxWxK4W+nz1Wyqjbk03DXD1NMj7pN1p3b 89llB0UV9iZNAjc91O290u/dnX0syqmLJUI3RLfZlQe3x8X9USR8bLsrqGjkcCNJ6w VI2rHniYIUomIH91TIcWCjq2pBRzcDVPl1wrR16Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Namjae Jeon , Hyunchul Lee , Steve French , zdi-disclosures@trendmicro.com Subject: [PATCH 5.15 084/779] ksmbd: fix use-after-free bug in smb2_tree_disconect Date: Mon, 15 Aug 2022 19:55:28 +0200 Message-Id: <20220815180340.880995784@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Namjae Jeon commit cf6531d98190fa2cf92a6d8bbc8af0a4740a223c upstream. smb2_tree_disconnect() freed the struct ksmbd_tree_connect, but it left the dangling pointer. It can be accessed again under compound requests. This bug can lead an oops looking something link: [ 1685.468014 ] BUG: KASAN: use-after-free in ksmbd_tree_conn_disconnect+0x= 131/0x160 [ksmbd] [ 1685.468068 ] Read of size 4 at addr ffff888102172180 by task kworker/1:2= /4807 ... [ 1685.468130 ] Call Trace: [ 1685.468132 ] [ 1685.468135 ] dump_stack_lvl+0x49/0x5f [ 1685.468141 ] print_report.cold+0x5e/0x5cf [ 1685.468145 ] ? ksmbd_tree_conn_disconnect+0x131/0x160 [ksmbd] [ 1685.468157 ] kasan_report+0xaa/0x120 [ 1685.468194 ] ? ksmbd_tree_conn_disconnect+0x131/0x160 [ksmbd] [ 1685.468206 ] __asan_report_load4_noabort+0x14/0x20 [ 1685.468210 ] ksmbd_tree_conn_disconnect+0x131/0x160 [ksmbd] [ 1685.468222 ] smb2_tree_disconnect+0x175/0x250 [ksmbd] [ 1685.468235 ] handle_ksmbd_work+0x30e/0x1020 [ksmbd] [ 1685.468247 ] process_one_work+0x778/0x11c0 [ 1685.468251 ] ? _raw_spin_lock_irq+0x8e/0xe0 [ 1685.468289 ] worker_thread+0x544/0x1180 [ 1685.468293 ] ? __cpuidle_text_end+0x4/0x4 [ 1685.468297 ] kthread+0x282/0x320 [ 1685.468301 ] ? process_one_work+0x11c0/0x11c0 [ 1685.468305 ] ? kthread_complete_and_exit+0x30/0x30 [ 1685.468309 ] ret_from_fork+0x1f/0x30 Fixes: e2f34481b24d ("cifsd: add server-side procedures for SMB3") Cc: stable@vger.kernel.org Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-17816 Signed-off-by: Namjae Jeon Reviewed-by: Hyunchul Lee Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/ksmbd/smb2pdu.c | 1 + 1 file changed, 1 insertion(+) --- a/fs/ksmbd/smb2pdu.c +++ b/fs/ksmbd/smb2pdu.c @@ -2044,6 +2044,7 @@ int smb2_tree_disconnect(struct ksmbd_wo =20 ksmbd_close_tree_conn_fds(work); ksmbd_tree_conn_disconnect(sess, tcon); + work->tcon =3D NULL; return 0; } From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56E0DC282E7 for ; Mon, 15 Aug 2022 18:23:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241313AbiHOSXE (ORCPT ); Mon, 15 Aug 2022 14:23:04 -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 S241190AbiHOSWY (ORCPT ); Mon, 15 Aug 2022 14:22:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2B3A2D1D4; Mon, 15 Aug 2022 11:17: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 5A721B81071; Mon, 15 Aug 2022 18:17:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1ECEC433D7; Mon, 15 Aug 2022 18:17:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587437; bh=OAQyXy/GOFj54iggXsaKPN5H0YYyEtjyZS1gECRg3/A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q6XuKC7L8x5Frs8sxGdjW4j0sT5slZ6g4xewzDB2hHW3jYracjIolNRIS+yrbg6EE nDGsqDjXu/tsrgTPzu2KHxU9PEtk2LJy0fhozml4DtFWClZf1I+uCQL7y0uvNUVSbB aTsGJAfqE6IJoXGG+VFitBZp0z6xTjYUS8A7srFM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miklos Szeredi Subject: [PATCH 5.15 085/779] fuse: limit nsec Date: Mon, 15 Aug 2022 19:55:29 +0200 Message-Id: <20220815180340.921319448@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miklos Szeredi commit 47912eaa061a6a81e4aa790591a1874c650733c0 upstream. Limit nanoseconds to 0..999999999. Fixes: d8a5ba45457e ("[PATCH] FUSE - core") Cc: Signed-off-by: Miklos Szeredi Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/fuse/inode.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -181,6 +181,12 @@ void fuse_change_attributes_common(struc inode->i_uid =3D make_kuid(fc->user_ns, attr->uid); inode->i_gid =3D make_kgid(fc->user_ns, attr->gid); inode->i_blocks =3D attr->blocks; + + /* Sanitize nsecs */ + attr->atimensec =3D min_t(u32, attr->atimensec, NSEC_PER_SEC - 1); + attr->mtimensec =3D min_t(u32, attr->mtimensec, NSEC_PER_SEC - 1); + attr->ctimensec =3D min_t(u32, attr->ctimensec, NSEC_PER_SEC - 1); + inode->i_atime.tv_sec =3D attr->atime; inode->i_atime.tv_nsec =3D attr->atimensec; /* mtime from server may be stale due to local buffered write */ From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6EF32C00140 for ; Mon, 15 Aug 2022 18:30:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242638AbiHOS37 (ORCPT ); Mon, 15 Aug 2022 14:29:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242533AbiHOS2y (ORCPT ); Mon, 15 Aug 2022 14:28:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C6B2241; Mon, 15 Aug 2022 11:20: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 9DA2AB8105B; Mon, 15 Aug 2022 18:19:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EDAEBC433C1; Mon, 15 Aug 2022 18:19:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587573; bh=qW6yXE9ud1P1tuP49WumpWs1UmmGtf+87D75l29Nzf0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=waKhJ+qEh5naNgq17V6IxWgbYNIx20gtKk1spk9fbtaIlrK3Ty/Pi+Tfa4RsS11xK pMW/OhqyywsSkLOsGX+v2HBCKHhVAUBFJm2Phz+27rzlvFFNs+veHYw2RIGICaviXm 8gt5SgjyZ3vhnsEpCCZUd41ubct8CPWJcphtyrEk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Christian=20Kohlsch=C3=BCtter?= , Miklos Szeredi Subject: [PATCH 5.15 086/779] fuse: ioctl: translate ENOSYS Date: Mon, 15 Aug 2022 19:55:30 +0200 Message-Id: <20220815180340.960636094@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Miklos Szeredi commit 02c0cab8e7345b06f1c0838df444e2902e4138d3 upstream. Overlayfs may fail to complete updates when a filesystem lacks fileattr/xattr syscall support and responds with an ENOSYS error code, resulting in an unexpected "Function not implemented" error. This bug may occur with FUSE filesystems, such as davfs2. Steps to reproduce: # install davfs2, e.g., apk add davfs2 mkdir /test mkdir /test/lower /test/upper /test/work /test/mnt yes '' | mount -t davfs -o ro http://some-web-dav-server/path \ /test/lower mount -t overlay -o upperdir=3D/test/upper,lowerdir=3D/test/lower \ -o workdir=3D/test/work overlay /test/mnt # when "some-file" exists in the lowerdir, this fails with "Function # not implemented", with dmesg showing "overlayfs: failed to retrieve # lower fileattr (/some-file, err=3D-38)" touch /test/mnt/some-file The underlying cause of this regresion is actually in FUSE, which fails to translate the ENOSYS error code returned by userspace filesystem (which means that the ioctl operation is not supported) to ENOTTY. Reported-by: Christian Kohlsch=C3=BCtter Fixes: 72db82115d2b ("ovl: copy up sync/noatime fileattr flags") Fixes: 59efec7b9039 ("fuse: implement ioctl support") Cc: Signed-off-by: Miklos Szeredi Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/fuse/ioctl.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) --- a/fs/fuse/ioctl.c +++ b/fs/fuse/ioctl.c @@ -9,6 +9,17 @@ #include #include =20 +static ssize_t fuse_send_ioctl(struct fuse_mount *fm, struct fuse_args *ar= gs) +{ + ssize_t ret =3D fuse_simple_request(fm, args); + + /* Translate ENOSYS, which shouldn't be returned from fs */ + if (ret =3D=3D -ENOSYS) + ret =3D -ENOTTY; + + return ret; +} + /* * CUSE servers compiled on 32bit broke on 64bit kernels because the * ABI was defined to be 'struct iovec' which is different on 32bit @@ -259,7 +270,7 @@ long fuse_do_ioctl(struct file *file, un ap.args.out_pages =3D true; ap.args.out_argvar =3D true; =20 - transferred =3D fuse_simple_request(fm, &ap.args); + transferred =3D fuse_send_ioctl(fm, &ap.args); err =3D transferred; if (transferred < 0) goto out; @@ -393,7 +404,7 @@ static int fuse_priv_ioctl(struct inode args.out_args[1].size =3D inarg.out_size; args.out_args[1].value =3D ptr; =20 - err =3D fuse_simple_request(fm, &args); + err =3D fuse_send_ioctl(fm, &args); if (!err) { if (outarg.result < 0) err =3D outarg.result; From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A19DCC00140 for ; Mon, 15 Aug 2022 18:24:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241131AbiHOSYU (ORCPT ); Mon, 15 Aug 2022 14:24:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241453AbiHOSXw (ORCPT ); Mon, 15 Aug 2022 14:23:52 -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 A12982ED44; Mon, 15 Aug 2022 11:17: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 7ABC4B81063; Mon, 15 Aug 2022 18:17:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBB3DC433D6; Mon, 15 Aug 2022 18:17:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587469; bh=k99rQfAN/Lt2RYkkU5H2EoGW+vQy2MUMH4d2va9jXms=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=scDyuHF75ou4xVkK7qUF0Bw7GB5ee9AiUHaTEv2NTK8+Hk+Q5h+fY3HeNGjCKRnBW 8OOXngS47gaORaR1qKzNV4kXZ53vQMoiJiYfO6XJbUcTe3EvltRQGQBb92Iblchhgl 6QFkoTi7h7qN7NgkoCDoDQspiqIH632qzaDmAN8s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yi Guo , Nadav Haklai , Narendra Hadke , =?UTF-8?q?Pali=20Roh=C3=A1r?= Subject: [PATCH 5.15 087/779] serial: mvebu-uart: uart2 error bits clearing Date: Mon, 15 Aug 2022 19:55:31 +0200 Message-Id: <20220815180340.999276684@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Narendra Hadke commit a7209541239e5dd44d981289e5f9059222d40fd1 upstream. For mvebu uart2, error bits are not cleared on buffer read. This causes interrupt loop and system hang. Cc: stable@vger.kernel.org Reviewed-by: Yi Guo Reviewed-by: Nadav Haklai Signed-off-by: Narendra Hadke Signed-off-by: Pali Roh=C3=A1r Link: https://lore.kernel.org/r/20220726091221.12358-1-pali@kernel.org Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/tty/serial/mvebu-uart.c | 11 +++++++++++ 1 file changed, 11 insertions(+) --- a/drivers/tty/serial/mvebu-uart.c +++ b/drivers/tty/serial/mvebu-uart.c @@ -237,6 +237,7 @@ static void mvebu_uart_rx_chars(struct u struct tty_port *tport =3D &port->state->port; unsigned char ch =3D 0; char flag =3D 0; + int ret; =20 do { if (status & STAT_RX_RDY(port)) { @@ -249,6 +250,16 @@ static void mvebu_uart_rx_chars(struct u port->icount.parity++; } =20 + /* + * For UART2, error bits are not cleared on buffer read. + * This causes interrupt loop and system hang. + */ + if (IS_EXTENDED(port) && (status & STAT_BRK_ERR)) { + ret =3D readl(port->membase + UART_STAT); + ret |=3D STAT_BRK_ERR; + writel(ret, port->membase + UART_STAT); + } + if (status & STAT_BRK_DET) { port->icount.brk++; status &=3D ~(STAT_FRM_ERR | STAT_PAR_ERR); From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9912EC00140 for ; Mon, 15 Aug 2022 18:28:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241973AbiHOS2K (ORCPT ); Mon, 15 Aug 2022 14:28:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241848AbiHOSZm (ORCPT ); Mon, 15 Aug 2022 14:25:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0CDD2F648; Mon, 15 Aug 2022 11:18: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 DF66BB81076; Mon, 15 Aug 2022 18:18:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A57AC433C1; Mon, 15 Aug 2022 18:18:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587504; bh=RMT8ytOfZjSu0bN8FyZcF57Fp9VFOBE1H9lsAtGFPlw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AT5FqB4Cwgeq5ez6Md3JgtEOqxGprFRDijvplbcWtg2EfisDfVrNt65oY2QRr4bgO hji2qavSd9tzSGySZSVvNfIwr2lnFGTfVx53EgDAfhevi5f0NW0fRXwYKgDldSOgzm EcgO34kla9+vnwYLwfB7cID4eNQOrmybr8IQRmM8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , Song Liu , Jens Axboe Subject: [PATCH 5.15 088/779] md-raid: destroy the bitmap after destroying the thread Date: Mon, 15 Aug 2022 19:55:32 +0200 Message-Id: <20220815180341.047846128@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 e151db8ecfb019b7da31d076130a794574c89f6f upstream. When we ran the lvm test "shell/integrity-blocksize-3.sh" on a kernel with kasan, we got failure in write_page. The reason for the failure is that md_bitmap_destroy is called before destroying the thread and the thread may be waiting in the function write_page for the bio to complete. When the thread finishes waiting, it executes "if (test_bit(BITMAP_WRITE_ERROR, &bitmap->flags))", which triggers the kasan warning. Note that the commit 48df498daf62 that caused this bug claims that it is neede for md-cluster, you should check md-cluster and possibly find another bugfix for it. BUG: KASAN: use-after-free in write_page+0x18d/0x680 [md_mod] Read of size 8 at addr ffff889162030c78 by task mdX_raid1/5539 CPU: 10 PID: 5539 Comm: mdX_raid1 Not tainted 5.19.0-rc2 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/= 2014 Call Trace: dump_stack_lvl+0x34/0x44 print_report.cold+0x45/0x57a ? __lock_text_start+0x18/0x18 ? write_page+0x18d/0x680 [md_mod] kasan_report+0xa8/0xe0 ? write_page+0x18d/0x680 [md_mod] kasan_check_range+0x13f/0x180 write_page+0x18d/0x680 [md_mod] ? super_sync+0x4d5/0x560 [dm_raid] ? md_bitmap_file_kick+0xa0/0xa0 [md_mod] ? rs_set_dev_and_array_sectors+0x2e0/0x2e0 [dm_raid] ? mutex_trylock+0x120/0x120 ? preempt_count_add+0x6b/0xc0 ? preempt_count_sub+0xf/0xc0 md_update_sb+0x707/0xe40 [md_mod] md_reap_sync_thread+0x1b2/0x4a0 [md_mod] md_check_recovery+0x533/0x960 [md_mod] raid1d+0xc8/0x2a20 [raid1] ? var_wake_function+0xe0/0xe0 ? psi_group_change+0x411/0x500 ? preempt_count_sub+0xf/0xc0 ? _raw_spin_lock_irqsave+0x78/0xc0 ? __lock_text_start+0x18/0x18 ? raid1_end_read_request+0x2a0/0x2a0 [raid1] ? preempt_count_sub+0xf/0xc0 ? _raw_spin_unlock_irqrestore+0x19/0x40 ? del_timer_sync+0xa9/0x100 ? try_to_del_timer_sync+0xc0/0xc0 ? _raw_spin_lock_irqsave+0x78/0xc0 ? __lock_text_start+0x18/0x18 ? __list_del_entry_valid+0x68/0xa0 ? finish_wait+0xa3/0x100 md_thread+0x161/0x260 [md_mod] ? unregister_md_personality+0xa0/0xa0 [md_mod] ? _raw_spin_lock_irqsave+0x78/0xc0 ? prepare_to_wait_event+0x2c0/0x2c0 ? unregister_md_personality+0xa0/0xa0 [md_mod] kthread+0x148/0x180 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x1f/0x30 Allocated by task 5522: kasan_save_stack+0x1e/0x40 __kasan_kmalloc+0x80/0xa0 md_bitmap_create+0xa8/0xe80 [md_mod] md_run+0x777/0x1300 [md_mod] raid_ctr+0x249c/0x4a30 [dm_raid] dm_table_add_target+0x2b0/0x620 [dm_mod] table_load+0x1c8/0x400 [dm_mod] ctl_ioctl+0x29e/0x560 [dm_mod] dm_compat_ctl_ioctl+0x7/0x20 [dm_mod] __do_compat_sys_ioctl+0xfa/0x160 do_syscall_64+0x90/0xc0 entry_SYSCALL_64_after_hwframe+0x46/0xb0 Freed by task 5680: kasan_save_stack+0x1e/0x40 kasan_set_track+0x21/0x40 kasan_set_free_info+0x20/0x40 __kasan_slab_free+0xf7/0x140 kfree+0x80/0x240 md_bitmap_free+0x1c3/0x280 [md_mod] __md_stop+0x21/0x120 [md_mod] md_stop+0x9/0x40 [md_mod] raid_dtr+0x1b/0x40 [dm_raid] dm_table_destroy+0x98/0x1e0 [dm_mod] __dm_destroy+0x199/0x360 [dm_mod] dev_remove+0x10c/0x160 [dm_mod] ctl_ioctl+0x29e/0x560 [dm_mod] dm_compat_ctl_ioctl+0x7/0x20 [dm_mod] __do_compat_sys_ioctl+0xfa/0x160 do_syscall_64+0x90/0xc0 entry_SYSCALL_64_after_hwframe+0x46/0xb0 Signed-off-by: Mikulas Patocka Cc: stable@vger.kernel.org Fixes: 48df498daf62 ("md: move bitmap_destroy to the beginning of __md_stop= ") Signed-off-by: Song Liu Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/md/md.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -6251,11 +6251,11 @@ static void mddev_detach(struct mddev *m static void __md_stop(struct mddev *mddev) { struct md_personality *pers =3D mddev->pers; - md_bitmap_destroy(mddev); mddev_detach(mddev); /* Ensure ->event_work is done */ if (mddev->event_work.func) flush_workqueue(md_misc_wq); + md_bitmap_destroy(mddev); spin_lock(&mddev->lock); mddev->pers =3D NULL; spin_unlock(&mddev->lock); From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C527C282E7 for ; Mon, 15 Aug 2022 18:27:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241579AbiHOS1f (ORCPT ); Mon, 15 Aug 2022 14:27:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242239AbiHOSZ7 (ORCPT ); Mon, 15 Aug 2022 14:25:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 651A82F642; Mon, 15 Aug 2022 11:19: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 BB697B8106C; Mon, 15 Aug 2022 18:19:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A93AC433C1; Mon, 15 Aug 2022 18:18:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587540; bh=+lhjPf1aIoNfkQ9QlkJlaYk3/kkJCrIm1AtLbGHOHTE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uJRGBHCktnSz5wSlqh2tSyh0Hmerq+ZgUCrEIa+STMVqBonY0TSfoXHL7TO+339sm Lj/55DuiKm5QPXaP2vsnMxQxis6orwH7767kTCTLE7HF/ICTrWFc/54tviWBLyRRey CE/K3O02pY0/fEIwDBzmJAVni/s/B+AUufIucPAI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , Song Liu , Jens Axboe Subject: [PATCH 5.15 089/779] md-raid10: fix KASAN warning Date: Mon, 15 Aug 2022 19:55:33 +0200 Message-Id: <20220815180341.087873206@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 d17f744e883b2f8d13cca252d71cfe8ace346f7d upstream. There's a KASAN warning in raid10_remove_disk when running the lvm test lvconvert-raid-reshape.sh. We fix this warning by verifying that the value "number" is valid. BUG: KASAN: slab-out-of-bounds in raid10_remove_disk+0x61/0x2a0 [raid10] Read of size 8 at addr ffff889108f3d300 by task mdX_raid10/124682 CPU: 3 PID: 124682 Comm: mdX_raid10 Not tainted 5.19.0-rc6 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/= 2014 Call Trace: dump_stack_lvl+0x34/0x44 print_report.cold+0x45/0x57a ? __lock_text_start+0x18/0x18 ? raid10_remove_disk+0x61/0x2a0 [raid10] kasan_report+0xa8/0xe0 ? raid10_remove_disk+0x61/0x2a0 [raid10] raid10_remove_disk+0x61/0x2a0 [raid10] Buffer I/O error on dev dm-76, logical block 15344, async page read ? __mutex_unlock_slowpath.constprop.0+0x1e0/0x1e0 remove_and_add_spares+0x367/0x8a0 [md_mod] ? super_written+0x1c0/0x1c0 [md_mod] ? mutex_trylock+0xac/0x120 ? _raw_spin_lock+0x72/0xc0 ? _raw_spin_lock_bh+0xc0/0xc0 md_check_recovery+0x848/0x960 [md_mod] raid10d+0xcf/0x3360 [raid10] ? sched_clock_cpu+0x185/0x1a0 ? rb_erase+0x4d4/0x620 ? var_wake_function+0xe0/0xe0 ? psi_group_change+0x411/0x500 ? preempt_count_sub+0xf/0xc0 ? _raw_spin_lock_irqsave+0x78/0xc0 ? __lock_text_start+0x18/0x18 ? raid10_sync_request+0x36c0/0x36c0 [raid10] ? preempt_count_sub+0xf/0xc0 ? _raw_spin_unlock_irqrestore+0x19/0x40 ? del_timer_sync+0xa9/0x100 ? try_to_del_timer_sync+0xc0/0xc0 ? _raw_spin_lock_irqsave+0x78/0xc0 ? __lock_text_start+0x18/0x18 ? _raw_spin_unlock_irq+0x11/0x24 ? __list_del_entry_valid+0x68/0xa0 ? finish_wait+0xa3/0x100 md_thread+0x161/0x260 [md_mod] ? unregister_md_personality+0xa0/0xa0 [md_mod] ? _raw_spin_lock_irqsave+0x78/0xc0 ? prepare_to_wait_event+0x2c0/0x2c0 ? unregister_md_personality+0xa0/0xa0 [md_mod] kthread+0x148/0x180 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x1f/0x30 Allocated by task 124495: kasan_save_stack+0x1e/0x40 __kasan_kmalloc+0x80/0xa0 setup_conf+0x140/0x5c0 [raid10] raid10_run+0x4cd/0x740 [raid10] md_run+0x6f9/0x1300 [md_mod] raid_ctr+0x2531/0x4ac0 [dm_raid] dm_table_add_target+0x2b0/0x620 [dm_mod] table_load+0x1c8/0x400 [dm_mod] ctl_ioctl+0x29e/0x560 [dm_mod] dm_compat_ctl_ioctl+0x7/0x20 [dm_mod] __do_compat_sys_ioctl+0xfa/0x160 do_syscall_64+0x90/0xc0 entry_SYSCALL_64_after_hwframe+0x46/0xb0 Last potentially related work creation: kasan_save_stack+0x1e/0x40 __kasan_record_aux_stack+0x9e/0xc0 kvfree_call_rcu+0x84/0x480 timerfd_release+0x82/0x140 L __fput+0xfa/0x400 task_work_run+0x80/0xc0 exit_to_user_mode_prepare+0x155/0x160 syscall_exit_to_user_mode+0x12/0x40 do_syscall_64+0x42/0xc0 entry_SYSCALL_64_after_hwframe+0x46/0xb0 Second to last potentially related work creation: kasan_save_stack+0x1e/0x40 __kasan_record_aux_stack+0x9e/0xc0 kvfree_call_rcu+0x84/0x480 timerfd_release+0x82/0x140 __fput+0xfa/0x400 task_work_run+0x80/0xc0 exit_to_user_mode_prepare+0x155/0x160 syscall_exit_to_user_mode+0x12/0x40 do_syscall_64+0x42/0xc0 entry_SYSCALL_64_after_hwframe+0x46/0xb0 The buggy address belongs to the object at ffff889108f3d200 which belongs to the cache kmalloc-256 of size 256 The buggy address is located 0 bytes to the right of 256-byte region [ffff889108f3d200, ffff889108f3d300) The buggy address belongs to the physical page: page:000000007ef2a34c refcount:1 mapcount:0 mapping:0000000000000000 index:= 0x0 pfn:0x1108f3c head:000000007ef2a34c order:2 compound_mapcount:0 compound_pincount:0 flags: 0x4000000000010200(slab|head|zone=3D2) raw: 4000000000010200 0000000000000000 dead000000000001 ffff889100042b40 raw: 0000000000000000 0000000080200020 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: ffff889108f3d200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffff889108f3d280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >ffff889108f3d300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ffff889108f3d380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc ffff889108f3d400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Signed-off-by: Mikulas Patocka Cc: stable@vger.kernel.org Signed-off-by: Song Liu Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/md/raid10.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -2139,9 +2139,12 @@ static int raid10_remove_disk(struct mdd int err =3D 0; int number =3D rdev->raid_disk; struct md_rdev **rdevp; - struct raid10_info *p =3D conf->mirrors + number; + struct raid10_info *p; =20 print_conf(conf); + if (unlikely(number >=3D mddev->raid_disks)) + return 0; + p =3D conf->mirrors + number; if (rdev =3D=3D p->rdev) rdevp =3D &p->rdev; else if (rdev =3D=3D p->replacement) From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2683C00140 for ; Mon, 15 Aug 2022 18:28:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241887AbiHOS17 (ORCPT ); Mon, 15 Aug 2022 14:27:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243113AbiHOS0o (ORCPT ); Mon, 15 Aug 2022 14:26:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4241D3122C; Mon, 15 Aug 2022 11:19: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 DF5C360C07; Mon, 15 Aug 2022 18:19:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2792C433C1; Mon, 15 Aug 2022 18:19:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587553; bh=uwI7jOt3LUj5x/gvUBN4HIO7/wzxiNFPzitTcyPAavQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GN9sS4M59OpeLi4zqhL/bdZpB8oPDB7z8yakGjzO3qZdiHafOif7rVfDYNkwG0fjI Tt5Hxz73tt3cJOI35yaCawvLVRQUxwQaUq+yq8ofA9XJSsPSsKkRzVcNjeJWWs9JnH RVRP2HLVyRShfjE4aI1QRylZlloKeVuBEVj5fMTM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Kara , Theodore Tso Subject: [PATCH 5.15 090/779] mbcache: dont reclaim used entries Date: Mon, 15 Aug 2022 19:55:34 +0200 Message-Id: <20220815180341.138257153@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jan Kara commit 58318914186c157477b978b1739dfe2f1b9dc0fe upstream. Do not reclaim entries that are currently used by somebody from a shrinker. Firstly, these entries are likely useful. Secondly, we will need to keep such entries to protect pending increment of xattr block refcount. CC: stable@vger.kernel.org Fixes: 82939d7999df ("ext4: convert to mbcache2") Signed-off-by: Jan Kara Link: https://lore.kernel.org/r/20220712105436.32204-1-jack@suse.cz Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/mbcache.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) --- a/fs/mbcache.c +++ b/fs/mbcache.c @@ -288,7 +288,7 @@ static unsigned long mb_cache_shrink(str while (nr_to_scan-- && !list_empty(&cache->c_list)) { entry =3D list_first_entry(&cache->c_list, struct mb_cache_entry, e_list); - if (entry->e_referenced) { + if (entry->e_referenced || atomic_read(&entry->e_refcnt) > 2) { entry->e_referenced =3D 0; list_move_tail(&entry->e_list, &cache->c_list); continue; @@ -302,6 +302,14 @@ static unsigned long mb_cache_shrink(str spin_unlock(&cache->c_list_lock); head =3D mb_cache_entry_head(cache, entry->e_key); hlist_bl_lock(head); + /* Now a reliable check if the entry didn't get used... */ + if (atomic_read(&entry->e_refcnt) > 2) { + hlist_bl_unlock(head); + spin_lock(&cache->c_list_lock); + list_add_tail(&entry->e_list, &cache->c_list); + cache->c_entry_count++; + continue; + } if (!hlist_bl_unhashed(&entry->e_hash_list)) { hlist_bl_del_init(&entry->e_hash_list); atomic_dec(&entry->e_refcnt); From nobody Sun Dec 14 03:24:44 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ED2C7C00140 for ; Mon, 15 Aug 2022 18:29:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242611AbiHOS3G (ORCPT ); Mon, 15 Aug 2022 14:29:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243264AbiHOS07 (ORCPT ); Mon, 15 Aug 2022 14:26:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FC7F31355; Mon, 15 Aug 2022 11:19: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 294D16068D; Mon, 15 Aug 2022 18:19:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18258C43145; Mon, 15 Aug 2022 18:19:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587556; bh=nunt+JU2j4MkkLoTkzivF571n8HJ9HbPahxcqNDdBjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RySrJIFL+iHaRyL7Gws9lSNFHo4AisaYKIV3ck0FeJpE8IrQdmM4iGD3D2WK9d+i+ jf+F7MKWVb3MvzQ2nA7vRbec1LQSOLbbGDYnf0qEiyNyejfF5hPtVU52UthIwwjkPn Cv6SzqMTkEMnzL3WgdRm7b5PhqyoGIllGZN/dB+Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Kara , Theodore Tso Subject: [PATCH 5.15 091/779] mbcache: add functions to delete entry if unused Date: Mon, 15 Aug 2022 19:55:35 +0200 Message-Id: <20220815180341.176964164@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jan Kara commit 3dc96bba65f53daa217f0a8f43edad145286a8f5 upstream. Add function mb_cache_entry_delete_or_get() to delete mbcache entry if it is unused and also add a function to wait for entry to become unused - mb_cache_entry_wait_unused(). We do not share code between the two deleting function as one of them will go away soon. CC: stable@vger.kernel.org Fixes: 82939d7999df ("ext4: convert to mbcache2") Signed-off-by: Jan Kara Link: https://lore.kernel.org/r/20220712105436.32204-2-jack@suse.cz Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/mbcache.c | 66 +++++++++++++++++++++++++++++++++++++++++++= +++-- include/linux/mbcache.h | 10 ++++++- 2 files changed, 73 insertions(+), 3 deletions(-) --- a/fs/mbcache.c +++ b/fs/mbcache.c @@ -11,7 +11,7 @@ /* * Mbcache is a simple key-value store. Keys need not be unique, however * key-value pairs are expected to be unique (we use this fact in - * mb_cache_entry_delete()). + * mb_cache_entry_delete_or_get()). * * Ext2 and ext4 use this cache for deduplication of extended attribute bl= ocks. * Ext4 also uses it for deduplication of xattr values stored in inodes. @@ -125,6 +125,19 @@ void __mb_cache_entry_free(struct mb_cac } EXPORT_SYMBOL(__mb_cache_entry_free); =20 +/* + * mb_cache_entry_wait_unused - wait to be the last user of the entry + * + * @entry - entry to work on + * + * Wait to be the last user of the entry. + */ +void mb_cache_entry_wait_unused(struct mb_cache_entry *entry) +{ + wait_var_event(&entry->e_refcnt, atomic_read(&entry->e_refcnt) <=3D 3); +} +EXPORT_SYMBOL(mb_cache_entry_wait_unused); + static struct mb_cache_entry *__entry_find(struct mb_cache *cache, struct mb_cache_entry *entry, u32 key) @@ -217,7 +230,7 @@ out: } EXPORT_SYMBOL(mb_cache_entry_get); =20 -/* mb_cache_entry_delete - remove a cache entry +/* mb_cache_entry_delete - try to remove a cache entry * @cache - cache we work with * @key - key * @value - value @@ -254,6 +267,55 @@ void mb_cache_entry_delete(struct mb_cac } EXPORT_SYMBOL(mb_cache_entry_delete); =20 +/* mb_cache_entry_delete_or_get - remove a cache entry if it has no users + * @cache - cache we work with + * @key - key + * @value - value + * + * Remove entry from cache @cache with key @key and value @value. The remo= val + * happens only if the entry is unused. The function returns NULL in case = the + * entry was successfully removed or there's no entry in cache. Otherwise = the + * function grabs reference of the entry that we failed to delete because = it + * still has users and return it. + */ +struct mb_cache_entry *mb_cache_entry_delete_or_get(struct mb_cache *cache, + u32 key, u64 value) +{ + struct hlist_bl_node *node; + struct hlist_bl_head *head; + struct mb_cache_entry *entry; + + head =3D mb_cache_entry_head(cache, key); + hlist_bl_lock(head); + hlist_bl_for_each_entry(entry, node, head, e_hash_list) { + if (entry->e_key =3D=3D key && entry->e_value =3D=3D value) { + if (atomic_read(&entry->e_refcnt) > 2) { + atomic_inc(&entry->e_refcnt); + hlist_bl_unlock(head); + return entry; + } + /* We keep hash list reference to keep entry alive */ + hlist_bl_del_init(&entry->e_hash_list); + hlist_bl_unlock(head); + spin_lock(&cache->c_list_lock); + if (!list_empty(&entry->e_list)) { + list_del_init(&entry->e_list); + if (!WARN_ONCE(cache->c_entry_count =3D=3D 0, + "mbcache: attempt to decrement c_entry_count past zero")) + cache->c_entry_count--; + atomic_dec(&entry->e_refcnt); + } + spin_unlock(&cache->c_list_lock); + mb_cache_entry_put(cache, entry); + return NULL; + } + } + hlist_bl_unlock(head); + + return NULL; +} +EXPORT_SYMBOL(mb_cache_entry_delete_or_get); + /* mb_cache_entry_touch - cache entry got used * @cache - cache the entry belongs to * @entry - entry that got used --- a/include/linux/mbcache.h +++ b/include/linux/mbcache.h @@ -30,15 +30,23 @@ void mb_cache_destroy(struct mb_cache *c int mb_cache_entry_create(struct mb_cache *cache, gfp_t mask, u32 key, u64 value, bool reusable); void __mb_cache_entry_free(struct mb_cache_entry *entry); +void mb_cache_entry_wait_unused(struct mb_cache_entry *entry); static inline int mb_cache_entry_put(struct mb_cache *cache, struct mb_cache_entry *entry) { - if (!atomic_dec_and_test(&entry->e_refcnt)) + unsigned int cnt =3D atomic_dec_return(&entry->e_refcnt); + + if (cnt > 0) { + if (cnt <=3D 3) + wake_up_var(&entry->e_refcnt); return 0; + } __mb_cache_entry_free(entry); return 1; } =20 +struct mb_cache_entry *mb_cache_entry_delete_or_get(struct mb_cache *cache, + u32 key, u64 value); void mb_cache_entry_delete(struct mb_cache *cache, u32 key, u64 value); struct mb_cache_entry *mb_cache_entry_get(struct mb_cache *cache, u32 key, u64 value); From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03898C00140 for ; Mon, 15 Aug 2022 18:29:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242631AbiHOS3J (ORCPT ); Mon, 15 Aug 2022 14:29:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243274AbiHOS07 (ORCPT ); Mon, 15 Aug 2022 14:26:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5B9F3136E; Mon, 15 Aug 2022 11:19: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 195CEB8106C; Mon, 15 Aug 2022 18:19:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 606DDC433D6; Mon, 15 Aug 2022 18:19:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587559; bh=IXhazyxSf8qFkEWqNpcAf/o+mFmZVPfUW4G5bJNOKQs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KEaw1Fhe/zz55PZdF8ZbGLlpm385Y/DjQTWNisyrbwVp5L+UaFa20x1W/3PYlufO/ oBtzErY7TJTlsI2RqtM7hPxhzd0byZed3k4ttsK6QwywrVteCtbTfNE1pjQ1HExnEK zTFa2aiQv9AY3+rV5weL6LHMWv6VaBNaSdgERQC8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiaomeng Tong , Mauro Carvalho Chehab Subject: [PATCH 5.15 092/779] media: [PATCH] pci: atomisp_cmd: fix three missing checks on list iterator Date: Mon, 15 Aug 2022 19:55:36 +0200 Message-Id: <20220815180341.219607667@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xiaomeng Tong commit 09b204eb9de9fdf07d028c41c4331b5cfeb70dd7 upstream. The three bugs are here: __func__, s3a_buf->s3a_data->exp_id); __func__, md_buf->metadata->exp_id); __func__, dis_buf->dis_data->exp_id); The list iterator 's3a_buf/md_buf/dis_buf' will point to a bogus position containing HEAD if the list is empty or no element is found. This case must be checked before any use of the iterator, otherwise it will lead to a invalid memory access. To fix this bug, add an check. Use a new variable '*_iter' as the list iterator, while use the old variable '*_buf' as a dedicated pointer to point to the found element. Link: https://lore.kernel.org/linux-media/20220414041415.3342-1-xiam0nd.ton= g@gmail.com Cc: stable@vger.kernel.org Fixes: ad85094b293e4 ("Revert "media: staging: atomisp: Remove driver"") Signed-off-by: Xiaomeng Tong Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/staging/media/atomisp/pci/atomisp_cmd.c | 57 +++++++++++++++----= ----- 1 file changed, 36 insertions(+), 21 deletions(-) --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -899,9 +899,9 @@ void atomisp_buf_done(struct atomisp_sub int err; unsigned long irqflags; struct ia_css_frame *frame =3D NULL; - struct atomisp_s3a_buf *s3a_buf =3D NULL, *_s3a_buf_tmp; - struct atomisp_dis_buf *dis_buf =3D NULL, *_dis_buf_tmp; - struct atomisp_metadata_buf *md_buf =3D NULL, *_md_buf_tmp; + struct atomisp_s3a_buf *s3a_buf =3D NULL, *_s3a_buf_tmp, *s3a_iter; + struct atomisp_dis_buf *dis_buf =3D NULL, *_dis_buf_tmp, *dis_iter; + struct atomisp_metadata_buf *md_buf =3D NULL, *_md_buf_tmp, *md_iter; enum atomisp_metadata_type md_type; struct atomisp_device *isp =3D asd->isp; struct v4l2_control ctrl; @@ -940,60 +940,75 @@ void atomisp_buf_done(struct atomisp_sub =20 switch (buf_type) { case IA_CSS_BUFFER_TYPE_3A_STATISTICS: - list_for_each_entry_safe(s3a_buf, _s3a_buf_tmp, + list_for_each_entry_safe(s3a_iter, _s3a_buf_tmp, &asd->s3a_stats_in_css, list) { - if (s3a_buf->s3a_data =3D=3D + if (s3a_iter->s3a_data =3D=3D buffer.css_buffer.data.stats_3a) { - list_del_init(&s3a_buf->list); - list_add_tail(&s3a_buf->list, + list_del_init(&s3a_iter->list); + list_add_tail(&s3a_iter->list, &asd->s3a_stats_ready); + s3a_buf =3D s3a_iter; break; } } =20 asd->s3a_bufs_in_css[css_pipe_id]--; atomisp_3a_stats_ready_event(asd, buffer.css_buffer.exp_id); - dev_dbg(isp->dev, "%s: s3a stat with exp_id %d is ready\n", - __func__, s3a_buf->s3a_data->exp_id); + if (s3a_buf) + dev_dbg(isp->dev, "%s: s3a stat with exp_id %d is ready\n", + __func__, s3a_buf->s3a_data->exp_id); + else + dev_dbg(isp->dev, "%s: s3a stat is ready with no exp_id found\n", + __func__); break; case IA_CSS_BUFFER_TYPE_METADATA: if (error) break; =20 md_type =3D atomisp_get_metadata_type(asd, css_pipe_id); - list_for_each_entry_safe(md_buf, _md_buf_tmp, + list_for_each_entry_safe(md_iter, _md_buf_tmp, &asd->metadata_in_css[md_type], list) { - if (md_buf->metadata =3D=3D + if (md_iter->metadata =3D=3D buffer.css_buffer.data.metadata) { - list_del_init(&md_buf->list); - list_add_tail(&md_buf->list, + list_del_init(&md_iter->list); + list_add_tail(&md_iter->list, &asd->metadata_ready[md_type]); + md_buf =3D md_iter; break; } } asd->metadata_bufs_in_css[stream_id][css_pipe_id]--; atomisp_metadata_ready_event(asd, md_type); - dev_dbg(isp->dev, "%s: metadata with exp_id %d is ready\n", - __func__, md_buf->metadata->exp_id); + if (md_buf) + dev_dbg(isp->dev, "%s: metadata with exp_id %d is ready\n", + __func__, md_buf->metadata->exp_id); + else + dev_dbg(isp->dev, "%s: metadata is ready with no exp_id found\n", + __func__); break; case IA_CSS_BUFFER_TYPE_DIS_STATISTICS: - list_for_each_entry_safe(dis_buf, _dis_buf_tmp, + list_for_each_entry_safe(dis_iter, _dis_buf_tmp, &asd->dis_stats_in_css, list) { - if (dis_buf->dis_data =3D=3D + if (dis_iter->dis_data =3D=3D buffer.css_buffer.data.stats_dvs) { spin_lock_irqsave(&asd->dis_stats_lock, irqflags); - list_del_init(&dis_buf->list); - list_add(&dis_buf->list, &asd->dis_stats); + list_del_init(&dis_iter->list); + list_add(&dis_iter->list, &asd->dis_stats); asd->params.dis_proj_data_valid =3D true; spin_unlock_irqrestore(&asd->dis_stats_lock, irqflags); + dis_buf =3D dis_iter; break; } } asd->dis_bufs_in_css--; - dev_dbg(isp->dev, "%s: dis stat with exp_id %d is ready\n", - __func__, dis_buf->dis_data->exp_id); + if (dis_buf) + dev_dbg(isp->dev, "%s: dis stat with exp_id %d is ready\n", + __func__, dis_buf->dis_data->exp_id); + else + dev_dbg(isp->dev, "%s: dis stat is ready with no exp_id found\n", + __func__); break; case IA_CSS_BUFFER_TYPE_VF_OUTPUT_FRAME: case IA_CSS_BUFFER_TYPE_SEC_VF_OUTPUT_FRAME: From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8E41C00140 for ; Mon, 15 Aug 2022 18:29:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241453AbiHOS3B (ORCPT ); Mon, 15 Aug 2022 14:29:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243242AbiHOS05 (ORCPT ); Mon, 15 Aug 2022 14:26:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F35531367; Mon, 15 Aug 2022 11:19: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 9DAF96077B; Mon, 15 Aug 2022 18:19:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BB0BC433D6; Mon, 15 Aug 2022 18:19:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587563; bh=TV0z72+3mSdWZU9PHTH7EIN3XB5gMzathmY268PHYYk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fgEDjYCRFVp6mvX+OmBpYtFaLqKmW0iRpekGhD2SvM2Z5ezeMk6waAVJfy/UEp85W N+9Ft+0bgW6M1F/VIIP2/zr/NqLDREHJ6as2t0NYKXMXnCtffKcOobvfjJVKmlAR45 XyQ4Df5Nv26d/Ox2mBGVoWHntQG9T4Y6UJu+bi54= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Alexander Lobakin , Andy Shevchenko , Yury Norov Subject: [PATCH 5.15 093/779] ia64, processor: fix -Wincompatible-pointer-types in ia64_get_irr() Date: Mon, 15 Aug 2022 19:55:37 +0200 Message-Id: <20220815180341.260791822@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Lobakin commit e5a16a5c4602c119262f350274021f90465f479d upstream. test_bit(), as any other bitmap op, takes `unsigned long *` as a second argument (pointer to the actual bitmap), as any bitmap itself is an array of unsigned longs. However, the ia64_get_irr() code passes a ref to `u64` as a second argument. This works with the ia64 bitops implementation due to that they have `void *` as the second argument and then cast it later on. This works with the bitmap API itself due to that `unsigned long` has the same size on ia64 as `u64` (`unsigned long long`), but from the compiler PoV those two are different. Define @irr as `unsigned long` to fix that. That implies no functional changes. Has been hidden for 16 years! Fixes: a58786917ce2 ("[IA64] avoid broken SAL_CACHE_FLUSH implementations") Cc: stable@vger.kernel.org # 2.6.16+ Reported-by: kernel test robot Signed-off-by: Alexander Lobakin Reviewed-by: Andy Shevchenko Reviewed-by: Yury Norov Signed-off-by: Yury Norov Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/ia64/include/asm/processor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/ia64/include/asm/processor.h +++ b/arch/ia64/include/asm/processor.h @@ -542,7 +542,7 @@ ia64_get_irr(unsigned int vector) { unsigned int reg =3D vector / 64; unsigned int bit =3D vector % 64; - u64 irr; + unsigned long irr; =20 switch (reg) { case 0: irr =3D ia64_getreg(_IA64_REG_CR_IRR0); break; From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF7CDC00140 for ; Mon, 15 Aug 2022 18:28:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242070AbiHOS2N (ORCPT ); Mon, 15 Aug 2022 14:28:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242797AbiHOS02 (ORCPT ); Mon, 15 Aug 2022 14:26: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 BC00B30F57; Mon, 15 Aug 2022 11:19: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 C8FA360EF7; Mon, 15 Aug 2022 18:19:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0082C433C1; Mon, 15 Aug 2022 18:19:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587566; bh=kydCZxS2HyPc3cC1Mr1++qUBFTk6gJM/dRcmOx+uCNg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kQCsCTjdeo6ItrHUTme42awnbkLjXSlrPQsDwx+Q1WqG+catzsOkKw7fc38RB362a +siTZ19mUgkxOI0CGdDgyfLT0Lwih242GlI7XMqzLY0X/4YHSWZOov7xqLgvMkpXYT NeNU5q5LxmMfIl4kvzXr2lgcW0Dkb5DZNBc9SlRM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Pali=20Roh=C3=A1r?= , Michael Ellerman Subject: [PATCH 5.15 094/779] powerpc/fsl-pci: Fix Class Code of PCIe Root Port Date: Mon, 15 Aug 2022 19:55:38 +0200 Message-Id: <20220815180341.312144139@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pali Roh=C3=A1r commit 0c551abfa004ce154d487d91777bf221c808a64f upstream. By default old pre-3.0 Freescale PCIe controllers reports invalid PCI Class Code 0x0b20 for PCIe Root Port. It can be seen by lspci -b output on P2020 board which has this pre-3.0 controller: $ lspci -bvnn 00:00.0 Power PC [0b20]: Freescale Semiconductor Inc P2020E [1957:0070] (= rev 21) !!! Invalid class 0b20 for header type 01 Capabilities: [4c] Express Root Port (Slot-), MSI 00 Fix this issue by programming correct PCI Class Code 0x0604 for PCIe Root Port to the Freescale specific PCIe register 0x474. With this change lspci -b output is: $ lspci -bvnn 00:00.0 PCI bridge [0604]: Freescale Semiconductor Inc P2020E [1957:0070]= (rev 21) (prog-if 00 [Normal decode]) Capabilities: [4c] Express Root Port (Slot-), MSI 00 Without any "Invalid class" error. So class code was properly reflected into standard (read-only) PCI register 0x08. Same fix is already implemented in U-Boot pcie_fsl.c driver in commit: http://source.denx.de/u-boot/u-boot/-/commit/d18d06ac35229345a0af80977a408c= fbe1d1015b Fix activated by U-Boot stay active also after booting Linux kernel. But boards which use older U-Boot version without that fix are affected and still require this fix. So implement this class code fix also in kernel fsl_pci.c driver. Cc: stable@vger.kernel.org Signed-off-by: Pali Roh=C3=A1r Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220706101043.4867-1-pali@kernel.org Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/powerpc/sysdev/fsl_pci.c | 8 ++++++++ arch/powerpc/sysdev/fsl_pci.h | 1 + 2 files changed, 9 insertions(+) --- a/arch/powerpc/sysdev/fsl_pci.c +++ b/arch/powerpc/sysdev/fsl_pci.c @@ -520,6 +520,7 @@ int fsl_add_bridge(struct platform_devic struct resource rsrc; const int *bus_range; u8 hdr_type, progif; + u32 class_code; struct device_node *dev; struct ccsr_pci __iomem *pci; u16 temp; @@ -593,6 +594,13 @@ int fsl_add_bridge(struct platform_devic PPC_INDIRECT_TYPE_SURPRESS_PRIMARY_BUS; if (fsl_pcie_check_link(hose)) hose->indirect_type |=3D PPC_INDIRECT_TYPE_NO_PCIE_LINK; + /* Fix Class Code to PCI_CLASS_BRIDGE_PCI_NORMAL for pre-3.0 controller = */ + if (in_be32(&pci->block_rev1) < PCIE_IP_REV_3_0) { + early_read_config_dword(hose, 0, 0, PCIE_FSL_CSR_CLASSCODE, &class_code= ); + class_code &=3D 0xff; + class_code |=3D PCI_CLASS_BRIDGE_PCI_NORMAL << 8; + early_write_config_dword(hose, 0, 0, PCIE_FSL_CSR_CLASSCODE, class_code= ); + } } else { /* * Set PBFR(PCI Bus Function Register)[10] =3D 1 to --- a/arch/powerpc/sysdev/fsl_pci.h +++ b/arch/powerpc/sysdev/fsl_pci.h @@ -18,6 +18,7 @@ struct platform_device; =20 #define PCIE_LTSSM 0x0404 /* PCIE Link Training and Status */ #define PCIE_LTSSM_L0 0x16 /* L0 state */ +#define PCIE_FSL_CSR_CLASSCODE 0x474 /* FSL GPEX CSR */ #define PCIE_IP_REV_2_2 0x02080202 /* PCIE IP block version Rev2.2 */ #define PCIE_IP_REV_3_0 0x02080300 /* PCIE IP block version Rev3.0 */ #define PIWAR_EN 0x80000000 /* Enable */ From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 120C3C00140 for ; Mon, 15 Aug 2022 18:29:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242844AbiHOS3x (ORCPT ); Mon, 15 Aug 2022 14:29:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233038AbiHOS2m (ORCPT ); Mon, 15 Aug 2022 14:28:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 897B9C36; Mon, 15 Aug 2022 11:20:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D76E060ABC; Mon, 15 Aug 2022 18:19:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD849C433C1; Mon, 15 Aug 2022 18:19:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587570; bh=3C0nmz2bwUw/YhMXl/4vqecM80SkN232zvqvmAcwXbw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iDCTkh/1/E1uZc/tqou3A6rB2nStNdNkZlbjRl1yaqf7u1HW5kh896eV2bRuN4iTh Z9hzE2CtP/OGQ/feMxVwbS4jkyyOiDN0EXJsx0lzCV5ozoa8Ld7gzQy+AIkRQBW+RM /mwT1P3WmMe/VQjxkKBj3+4JaOB3a5N8e3dAesQk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy , Michael Ellerman Subject: [PATCH 5.15 095/779] powerpc/ptdump: Fix display of RW pages on FSL_BOOK3E Date: Mon, 15 Aug 2022 19:55:39 +0200 Message-Id: <20220815180341.361786474@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe Leroy commit dd8de84b57b02ba9c1fe530a6d916c0853f136bd upstream. On FSL_BOOK3E, _PAGE_RW is defined with two bits, one for user and one for supervisor. As soon as one of the two bits is set, the page has to be display as RW. But the way it is implemented today requires both bits to be set in order to display it as RW. Instead of display RW when _PAGE_RW bits are set and R otherwise, reverse the logic and display R when _PAGE_RW bits are all 0 and RW otherwise. This change has no impact on other platforms as _PAGE_RW is a single bit on all of them. Fixes: 8eb07b187000 ("powerpc/mm: Dump linux pagetables") Cc: stable@vger.kernel.org Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/0c33b96317811edf691e81698aaee8fa45ec3449.16= 56427391.git.christophe.leroy@csgroup.eu Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/powerpc/mm/ptdump/shared.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/arch/powerpc/mm/ptdump/shared.c +++ b/arch/powerpc/mm/ptdump/shared.c @@ -17,9 +17,9 @@ static const struct flag_info flag_array .clear =3D " ", }, { .mask =3D _PAGE_RW, - .val =3D _PAGE_RW, - .set =3D "rw", - .clear =3D "r ", + .val =3D 0, + .set =3D "r ", + .clear =3D "rw", }, { .mask =3D _PAGE_EXEC, .val =3D _PAGE_EXEC, From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6764AC00140 for ; Mon, 15 Aug 2022 18:24:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241297AbiHOSYb (ORCPT ); Mon, 15 Aug 2022 14:24:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241464AbiHOSXz (ORCPT ); Mon, 15 Aug 2022 14:23:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB3D82A95B; Mon, 15 Aug 2022 11:17:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A110EB81074; Mon, 15 Aug 2022 18:17:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CEB9BC433D6; Mon, 15 Aug 2022 18:17:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587472; bh=b09QnvDg7xfHPslMRVg7vHUSCPbJTeYQlqKvtTja7U4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jr8agBlt3qYTcPISecKCW+zo6QRJJP/rWplYocG6j50eP12r033o9YwHdIVQA1u10 I32LhDtIEtDvdM0+I5AtN1GjKj+OfPGaUMpRBwHRx/hnsrQy3zR0fxBf1pIPyuC6Dy zgKL/LQ20KHnD5Ne/6CQ0OHuZ9skD56FfTB3jcw4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Jason A. Donenfeld" , Michael Ellerman Subject: [PATCH 5.15 096/779] powerpc/powernv: Avoid crashing if rng is NULL Date: Mon, 15 Aug 2022 19:55:40 +0200 Message-Id: <20220815180341.411950132@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Ellerman commit 90b5d4fe0b3ba7f589c6723c6bfb559d9e83956a upstream. On a bare-metal Power8 system that doesn't have an "ibm,power-rng", a malicious QEMU and guest that ignore the absence of the KVM_CAP_PPC_HWRNG flag, and calls H_RANDOM anyway, will dereference a NULL pointer. In practice all Power8 machines have an "ibm,power-rng", but let's not rely on that, add a NULL check and early return in powernv_get_random_real_mode(). Fixes: e928e9cb3601 ("KVM: PPC: Book3S HV: Add fast real-mode H_RANDOM impl= ementation.") Cc: stable@vger.kernel.org # v4.1+ Signed-off-by: Jason A. Donenfeld Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220727143219.2684192-1-mpe@ellerman.id.au Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/powerpc/platforms/powernv/rng.c | 2 ++ 1 file changed, 2 insertions(+) --- a/arch/powerpc/platforms/powernv/rng.c +++ b/arch/powerpc/platforms/powernv/rng.c @@ -63,6 +63,8 @@ int powernv_get_random_real_mode(unsigne struct powernv_rng *rng; =20 rng =3D raw_cpu_read(powernv_rng); + if (!rng) + return 0; =20 *v =3D rng_whiten(rng, __raw_rm_readq(rng->regs_real)); From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 547F2C00140 for ; Mon, 15 Aug 2022 18:24:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241354AbiHOSY2 (ORCPT ); Mon, 15 Aug 2022 14:24:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241472AbiHOSX4 (ORCPT ); Mon, 15 Aug 2022 14:23:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29AF12A966; Mon, 15 Aug 2022 11:17: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 1355D60A09; Mon, 15 Aug 2022 18:17:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 058E1C433C1; Mon, 15 Aug 2022 18:17:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587475; bh=Lqg3nI9/1ih2ZrfoyJ2//n6sYA5V80dfGjDkV4M2hvM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RWkD7WJ2JtfjqqSSN4/FmW+qv8TKNNdNZ92vwAin7B5N1RLgIVeOvuwGlslyyowfq 9p9hELs/OqrfWTzmVh97PBByfm+A09huoZlOgN8ATgvfW8lfByis0HRJZB2X73Qcrl i0cuu3MyzdkLhe42j2ViUftelN0hv4IWuwpI8D9Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Huacai Chen , Thomas Bogendoerfer Subject: [PATCH 5.15 097/779] MIPS: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK Date: Mon, 15 Aug 2022 19:55:41 +0200 Message-Id: <20220815180341.453544044@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Huacai Chen commit e1a534f5d074db45ae5cbac41d8912b98e96a006 upstream. When CONFIG_CPUMASK_OFFSTACK and CONFIG_DEBUG_PER_CPU_MAPS is selected, cpu_max_bits_warn() generates a runtime warning similar as below while we show /proc/cpuinfo. Fix this by using nr_cpu_ids (the runtime limit) instead of NR_CPUS to iterate CPUs. [ 3.052463] ------------[ cut here ]------------ [ 3.059679] WARNING: CPU: 3 PID: 1 at include/linux/cpumask.h:108 show_c= puinfo+0x5e8/0x5f0 [ 3.070072] Modules linked in: efivarfs autofs4 [ 3.076257] CPU: 0 PID: 1 Comm: systemd Not tainted 5.19-rc5+ #1052 [ 3.084034] Hardware name: Loongson Loongson-3A4000-7A1000-1w-V0.1-CRB/L= oongson-LS3A4000-7A1000-1w-EVB-V1.21, BIOS Loongson-UDK2018-V2.0.04082-beta= 7 04/27 [ 3.099465] Stack : 9000000100157b08 9000000000f18530 9000000000cf846c 9= 000000100154000 [ 3.109127] 9000000100157a50 0000000000000000 9000000100157a58 9= 000000000ef7430 [ 3.118774] 90000001001578e8 0000000000000040 0000000000000020 f= fffffffffffffff [ 3.128412] 0000000000aaaaaa 1ab25f00eec96a37 900000010021de80 9= 00000000101c890 [ 3.138056] 0000000000000000 0000000000000000 0000000000000000 0= 000000000aaaaaa [ 3.147711] ffff8000339dc220 0000000000000001 0000000006ab4000 0= 000000000000000 [ 3.157364] 900000000101c998 0000000000000004 9000000000ef7430 0= 000000000000000 [ 3.167012] 0000000000000009 000000000000006c 0000000000000000 0= 000000000000000 [ 3.176641] 9000000000d3de08 9000000001639390 90000000002086d8 0= 0007ffff0080286 [ 3.186260] 00000000000000b0 0000000000000004 0000000000000000 0= 000000000071c1c [ 3.195868] ... [ 3.199917] Call Trace: [ 3.203941] [<98000000002086d8>] show_stack+0x38/0x14c [ 3.210666] [<9800000000cf846c>] dump_stack_lvl+0x60/0x88 [ 3.217625] [<980000000023d268>] __warn+0xd0/0x100 [ 3.223958] [<9800000000cf3c90>] warn_slowpath_fmt+0x7c/0xcc [ 3.231150] [<9800000000210220>] show_cpuinfo+0x5e8/0x5f0 [ 3.238080] [<98000000004f578c>] seq_read_iter+0x354/0x4b4 [ 3.245098] [<98000000004c2e90>] new_sync_read+0x17c/0x1c4 [ 3.252114] [<98000000004c5174>] vfs_read+0x138/0x1d0 [ 3.258694] [<98000000004c55f8>] ksys_read+0x70/0x100 [ 3.265265] [<9800000000cfde9c>] do_syscall+0x7c/0x94 [ 3.271820] [<9800000000202fe4>] handle_syscall+0xc4/0x160 [ 3.281824] ---[ end trace 8b484262b4b8c24c ]--- Cc: stable@vger.kernel.org Signed-off-by: Huacai Chen Signed-off-by: Thomas Bogendoerfer Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/mips/kernel/proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/mips/kernel/proc.c +++ b/arch/mips/kernel/proc.c @@ -172,7 +172,7 @@ static void *c_start(struct seq_file *m, { unsigned long i =3D *pos; =20 - return i < NR_CPUS ? (void *) (i + 1) : NULL; + return i < nr_cpu_ids ? (void *) (i + 1) : NULL; } =20 static void *c_next(struct seq_file *m, void *v, loff_t *pos) From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0094C00140 for ; Mon, 15 Aug 2022 18:24:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241415AbiHOSYs (ORCPT ); Mon, 15 Aug 2022 14:24:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241110AbiHOSYL (ORCPT ); Mon, 15 Aug 2022 14:24:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47C10289; Mon, 15 Aug 2022 11:18: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 E33E0B81076; Mon, 15 Aug 2022 18:17:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FAA2C433D6; Mon, 15 Aug 2022 18:17:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587478; bh=6sY9YRn6wguJ+Z+1FTPMgE8c3m56gA/NJozdYF5tdmE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2LTwV+HV696NxlwouGeOI7VpHeGVyO6XjoOqfUGjFW0z3y3gN5xYUBgDE8pLUD8Bw /unzjHx93tvHgcyazuUJ7dMe/RlfKB4qoxDsDV1rm3tWrVOyydFjRsLEqLQsWmLBeH npb9yvjH/bYBzxBcqrulJVWDKUsxm+/B1abiSgiE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mathieu Poirier , Mike Leach , Leo Yan , Suzuki K Poulose Subject: [PATCH 5.15 098/779] coresight: Clear the connection field properly Date: Mon, 15 Aug 2022 19:55:42 +0200 Message-Id: <20220815180341.502686992@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Suzuki K Poulose commit 2af89ebacf299b7fba5f3087d35e8a286ec33706 upstream. coresight devices track their connections (output connections) and hold a reference to the fwnode. When a device goes away, we walk through the devices on the coresight bus and make sure that the references are dropped. This happens both ways: a) For all output connections from the device, drop the reference to the target device via coresight_release_platform_data() b) Iterate over all the devices on the coresight bus and drop the reference to fwnode if *this* device is the target of the output connection, via coresight_remove_conns()->coresight_remove_match(). However, the coresight_remove_match() doesn't clear the fwnode field, after dropping the reference, this causes use-after-free and additional refcount drops on the fwnode. e.g., if we have two devices, A and B, with a connection, A -> B. If we remove B first, B would clear the reference on B, from A via coresight_remove_match(). But when A is removed, it still has a connection with fwnode still pointing to B. Thus it tries to drops the reference in coresight_release_platform_data(), raising the bells like : [ 91.990153] ------------[ cut here ]------------ [ 91.990163] refcount_t: addition on 0; use-after-free. [ 91.990212] WARNING: CPU: 0 PID: 461 at lib/refcount.c:25 refcount_warn_= saturate+0xa0/0x144 [ 91.990260] Modules linked in: coresight_funnel coresight_replicator cor= esight_etm4x(-) crct10dif_ce coresight ip_tables x_tables ipv6 [last unloaded: coresight_c= pu_debug] [ 91.990398] CPU: 0 PID: 461 Comm: rmmod Tainted: G W T 5.19= .0-rc2+ #53 [ 91.990418] Hardware name: ARM LTD ARM Juno Development Platform/ARM Jun= o Development Platform, BIOS EDK II Feb 1 2019 [ 91.990434] pstate: 600000c5 (nZCv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE= =3D--) [ 91.990454] pc : refcount_warn_saturate+0xa0/0x144 [ 91.990476] lr : refcount_warn_saturate+0xa0/0x144 [ 91.990496] sp : ffff80000c843640 [ 91.990509] x29: ffff80000c843640 x28: ffff800009957c28 x27: ffff80000c8= 439a8 [ 91.990560] x26: ffff00097eff1990 x25: ffff8000092b6ad8 x24: ffff00097ef= f19a8 [ 91.990610] x23: ffff80000c8439a8 x22: 0000000000000000 x21: ffff80000c8= 439c2 [ 91.990659] x20: 0000000000000000 x19: ffff00097eff1a10 x18: ffff80000ab= 99c40 [ 91.990708] x17: 0000000000000000 x16: 0000000000000000 x15: ffff80000ab= f6fa0 [ 91.990756] x14: 000000000000001d x13: 0a2e656572662d72 x12: 657466612d6= 57375 [ 91.990805] x11: 203b30206e6f206e x10: 6f69746964646120 x9 : ffff8000081= aba28 [ 91.990854] x8 : 206e6f206e6f6974 x7 : 69646461203a745f x6 : 746e756f636= 66572 [ 91.990903] x5 : ffff00097648ec58 x4 : 0000000000000000 x3 : 00000000000= 00027 [ 91.990952] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff0008026= 0ba00 [ 91.991000] Call trace: [ 91.991012] refcount_warn_saturate+0xa0/0x144 [ 91.991034] kobject_get+0xac/0xb0 [ 91.991055] of_node_get+0x2c/0x40 [ 91.991076] of_fwnode_get+0x40/0x60 [ 91.991094] fwnode_handle_get+0x3c/0x60 [ 91.991116] fwnode_get_nth_parent+0xf4/0x110 [ 91.991137] fwnode_full_name_string+0x48/0xc0 [ 91.991158] device_node_string+0x41c/0x530 [ 91.991178] pointer+0x320/0x3ec [ 91.991198] vsnprintf+0x23c/0x750 [ 91.991217] vprintk_store+0x104/0x4b0 [ 91.991238] vprintk_emit+0x8c/0x360 [ 91.991257] vprintk_default+0x44/0x50 [ 91.991276] vprintk+0xcc/0xf0 [ 91.991295] _printk+0x68/0x90 [ 91.991315] of_node_release+0x13c/0x14c [ 91.991334] kobject_put+0x98/0x114 [ 91.991354] of_node_put+0x24/0x34 [ 91.991372] of_fwnode_put+0x40/0x5c [ 91.991390] fwnode_handle_put+0x38/0x50 [ 91.991411] coresight_release_platform_data+0x74/0xb0 [coresight] [ 91.991472] coresight_unregister+0x64/0xcc [coresight] [ 91.991525] etm4_remove_dev+0x64/0x78 [coresight_etm4x] [ 91.991563] etm4_remove_amba+0x1c/0x2c [coresight_etm4x] [ 91.991598] amba_remove+0x3c/0x19c Reproducible by: (Build all coresight components as modules): #!/bin/sh while true do for m in tmc stm cpu_debug etm4x replicator funnel do modprobe coresight_${m} done for m in tmc stm cpu_debug etm4x replicator funnel do rmmode coresight_${m} done done Cc: stable@vger.kernel.org Cc: Mathieu Poirier Cc: Mike Leach Cc: Leo Yan Signed-off-by: Suzuki K Poulose Fixes: 37ea1ffddffa ("coresight: Use fwnode handle instead of device names") Link: https://lore.kernel.org/r/20220614214024.3005275-1-suzuki.poulose@arm= .com Signed-off-by: Mathieu Poirier Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/hwtracing/coresight/coresight-core.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/hwtracing/coresight/coresight-core.c +++ b/drivers/hwtracing/coresight/coresight-core.c @@ -1427,6 +1427,7 @@ static int coresight_remove_match(struct * platform data. */ fwnode_handle_put(conn->child_fwnode); + conn->child_fwnode =3D NULL; /* No need to continue */ break; } From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64832C25B08 for ; Mon, 15 Aug 2022 18:25:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241651AbiHOSZC (ORCPT ); Mon, 15 Aug 2022 14:25:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240383AbiHOSYR (ORCPT ); Mon, 15 Aug 2022 14:24:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 854191036; Mon, 15 Aug 2022 11:18:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9A90160690; Mon, 15 Aug 2022 18:18:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74EB0C433C1; Mon, 15 Aug 2022 18:18:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587482; bh=FU1YbE1E2NkvVleTcRnvyZW61eUHNYJXk19HtY0RX9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PSiGu9bjtU5QsVX29MGql6L7ePOj24bxBu1szZKRkLUIK3asH98L/U6OAxXwYPjOI Gpi8z6T5HqKig4FvGYcCIla/9c4G4isiLYo21m2szcyXxDJiBYKQnucj6HkbeWJ+v2 w/tqy2KHLijlaCeCy/bZZ4WweJrNXT7RJKxtUlmQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jack Pham , Linyu Yuan Subject: [PATCH 5.15 099/779] usb: typec: ucsi: Acknowledge the GET_ERROR_STATUS command completion Date: Mon, 15 Aug 2022 19:55:43 +0200 Message-Id: <20220815180341.534233954@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Linyu Yuan commit a7dc438b5e446afcd1b3b6651da28271400722f2 upstream. We found PPM will not send any notification after it report error status and OPM issue GET_ERROR_STATUS command to read the details about error. According UCSI spec, PPM may clear the Error Status Data after the OPM has acknowledged the command completion. This change add operation to acknowledge the command completion from PPM. Fixes: bdc62f2bae8f (usb: typec: ucsi: Simplified registration and I/O API) Cc: # 5.10 Signed-off-by: Jack Pham Signed-off-by: Linyu Yuan Link: https://lore.kernel.org/r/1658817949-4632-1-git-send-email-quic_linyy= uan@quicinc.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/usb/typec/ucsi/ucsi.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/usb/typec/ucsi/ucsi.c +++ b/drivers/usb/typec/ucsi/ucsi.c @@ -76,6 +76,10 @@ static int ucsi_read_error(struct ucsi * if (ret) return ret; =20 + ret =3D ucsi_acknowledge_command(ucsi); + if (ret) + return ret; + switch (error) { case UCSI_ERROR_INCOMPATIBLE_PARTNER: return -EOPNOTSUPP; From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30BE7C00140 for ; Mon, 15 Aug 2022 18:25:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231857AbiHOSZT (ORCPT ); Mon, 15 Aug 2022 14:25:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241164AbiHOSYo (ORCPT ); Mon, 15 Aug 2022 14:24:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C5F05FC2; Mon, 15 Aug 2022 11:18: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 B38F6B80F99; Mon, 15 Aug 2022 18:18:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04E43C433D6; Mon, 15 Aug 2022 18:18:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587485; bh=fhXmri8Qjp0EzDtGXhrJdIiFlwZJ7xvylvHa/3A9hao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jw2qSFe5+3Pwiw5DLj7S2Px01dBYgJhafcI6oAb8GKwd5lQ2RPRelxv5Cf1J8PHu/ ucBnd92L5E6WXprwK/CHHXlKwkp+ocTOkULoCIHXomnd7Ol1Dwf3HMPt8IMlklOCqU RYAQVVCfVGXI0olgFlDSuBzrMRiuxOzy06wV9W4I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , Alan Stern , Weitao Wang Subject: [PATCH 5.15 100/779] USB: HCD: Fix URB giveback issue in tasklet function Date: Mon, 15 Aug 2022 19:55:44 +0200 Message-Id: <20220815180341.576168483@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Weitao Wang commit 26c6c2f8a907c9e3a2f24990552a4d77235791e6 upstream. Usb core introduce the mechanism of giveback of URB in tasklet context to reduce hardware interrupt handling time. On some test situation(such as FIO with 4KB block size), when tasklet callback function called to giveback URB, interrupt handler add URB node to the bh->head list also. If check bh->head list again after finish all URB giveback of local_list, then it may introduce a "dynamic balance" between giveback URB and add URB to bh->head list. This tasklet callback function may not exit for a long time, which will cause other tasklet function calls to be delayed. Some real-time applications(such as KB and Mouse) will see noticeable lag. In order to prevent the tasklet function from occupying the cpu for a long time at a time, new URBS will not be added to the local_list even though the bh->head list is not empty. But also need to ensure the left URB giveback to be processed in time, so add a member high_prio for structure giveback_urb_bh to prioritize tasklet and schelule this tasklet again if bh->head list is not empty. At the same time, we are able to prioritize tasklet through structure member high_prio. So, replace the local high_prio_bh variable with this structure member in usb_hcd_giveback_urb. Fixes: 94dfd7edfd5c ("USB: HCD: support giveback of URB in tasklet context") Cc: stable Reviewed-by: Alan Stern Signed-off-by: Weitao Wang Link: https://lore.kernel.org/r/20220726074918.5114-1-WeitaoWang-oc@zhaoxin= .com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/usb/core/hcd.c | 26 +++++++++++++++----------- include/linux/usb/hcd.h | 1 + 2 files changed, 16 insertions(+), 11 deletions(-) --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c @@ -1691,7 +1691,6 @@ static void usb_giveback_urb_bh(struct t =20 spin_lock_irq(&bh->lock); bh->running =3D true; - restart: list_replace_init(&bh->head, &local_list); spin_unlock_irq(&bh->lock); =20 @@ -1705,10 +1704,17 @@ static void usb_giveback_urb_bh(struct t bh->completing_ep =3D NULL; } =20 - /* check if there are new URBs to giveback */ + /* + * giveback new URBs next time to prevent this function + * from not exiting for a long time. + */ spin_lock_irq(&bh->lock); - if (!list_empty(&bh->head)) - goto restart; + if (!list_empty(&bh->head)) { + if (bh->high_prio) + tasklet_hi_schedule(&bh->bh); + else + tasklet_schedule(&bh->bh); + } bh->running =3D false; spin_unlock_irq(&bh->lock); } @@ -1737,7 +1743,7 @@ static void usb_giveback_urb_bh(struct t void usb_hcd_giveback_urb(struct usb_hcd *hcd, struct urb *urb, int status) { struct giveback_urb_bh *bh; - bool running, high_prio_bh; + bool running; =20 /* pass status to tasklet via unlinked */ if (likely(!urb->unlinked)) @@ -1748,13 +1754,10 @@ void usb_hcd_giveback_urb(struct usb_hcd return; } =20 - if (usb_pipeisoc(urb->pipe) || usb_pipeint(urb->pipe)) { + if (usb_pipeisoc(urb->pipe) || usb_pipeint(urb->pipe)) bh =3D &hcd->high_prio_bh; - high_prio_bh =3D true; - } else { + else bh =3D &hcd->low_prio_bh; - high_prio_bh =3D false; - } =20 spin_lock(&bh->lock); list_add_tail(&urb->urb_list, &bh->head); @@ -1763,7 +1766,7 @@ void usb_hcd_giveback_urb(struct usb_hcd =20 if (running) ; - else if (high_prio_bh) + else if (bh->high_prio) tasklet_hi_schedule(&bh->bh); else tasklet_schedule(&bh->bh); @@ -2959,6 +2962,7 @@ int usb_add_hcd(struct usb_hcd *hcd, =20 /* initialize tasklets */ init_giveback_urb_bh(&hcd->high_prio_bh); + hcd->high_prio_bh.high_prio =3D true; init_giveback_urb_bh(&hcd->low_prio_bh); =20 /* enable irqs just before we start the controller, --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h @@ -66,6 +66,7 @@ =20 struct giveback_urb_bh { bool running; + bool high_prio; spinlock_t lock; struct list_head head; struct tasklet_struct bh; From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3171DC25B0E for ; Mon, 15 Aug 2022 18:24:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241610AbiHOSYx (ORCPT ); Mon, 15 Aug 2022 14:24:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241500AbiHOSYO (ORCPT ); Mon, 15 Aug 2022 14:24:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17A7A2ED5E; Mon, 15 Aug 2022 11:18: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 2BF7860BEC; Mon, 15 Aug 2022 18:18:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FA4DC433C1; Mon, 15 Aug 2022 18:18:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587488; bh=/nlk2RNgiWALLZkduIiOCkuWAgi6PpoVPN4WKKCrp3M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nQb1rObpwCdKlgQkw/GDQ2B2XhisIiad1oyMLyjscLsgkxb9Ok3taIBVs1OGXnnqG Ccoca+RRFxwInWeox4dZLRE0W8wtwqJNZ7SjtBvU5Rcs0ysuzXT4X/IDs0k7Ji3zE7 BN0Mm3uA3OBGFkioGc/nwxHPh1bAvPheXNLEwV4Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ryuta NAKANISHI , Kunihiko Hayashi , Arnd Bergmann Subject: [PATCH 5.15 101/779] ARM: dts: uniphier: Fix USB interrupts for PXs2 SoC Date: Mon, 15 Aug 2022 19:55:45 +0200 Message-Id: <20220815180341.624480520@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kunihiko Hayashi commit 9b0dc7abb5cc43a2dbf90690c3c6011dcadc574d upstream. An interrupt for USB device are shared with USB host. Set interrupt-names property to common "dwc_usb3" instead of "host" and "peripheral". Cc: stable@vger.kernel.org Fixes: 45be1573ad19 ("ARM: dts: uniphier: Add USB3 controller nodes") Reported-by: Ryuta NAKANISHI Signed-off-by: Kunihiko Hayashi Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm/boot/dts/uniphier-pxs2.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/arch/arm/boot/dts/uniphier-pxs2.dtsi +++ b/arch/arm/boot/dts/uniphier-pxs2.dtsi @@ -597,8 +597,8 @@ compatible =3D "socionext,uniphier-dwc3", "snps,dwc3"; status =3D "disabled"; reg =3D <0x65a00000 0xcd00>; - interrupt-names =3D "host", "peripheral"; - interrupts =3D <0 134 4>, <0 135 4>; + interrupt-names =3D "dwc_usb3"; + interrupts =3D <0 134 4>; pinctrl-names =3D "default"; pinctrl-0 =3D <&pinctrl_usb0>, <&pinctrl_usb2>; clock-names =3D "ref", "bus_early", "suspend"; @@ -693,8 +693,8 @@ compatible =3D "socionext,uniphier-dwc3", "snps,dwc3"; status =3D "disabled"; reg =3D <0x65c00000 0xcd00>; - interrupt-names =3D "host", "peripheral"; - interrupts =3D <0 137 4>, <0 138 4>; + interrupt-names =3D "dwc_usb3"; + interrupts =3D <0 137 4>; pinctrl-names =3D "default"; pinctrl-0 =3D <&pinctrl_usb1>, <&pinctrl_usb3>; clock-names =3D "ref", "bus_early", "suspend"; From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2F90C00140 for ; Mon, 15 Aug 2022 18:28:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242306AbiHOS2d (ORCPT ); Mon, 15 Aug 2022 14:28:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241163AbiHOSZK (ORCPT ); Mon, 15 Aug 2022 14:25:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9031A2F38A; Mon, 15 Aug 2022 11:18: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 7757D60ACE; Mon, 15 Aug 2022 18:18:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 628D6C433D6; Mon, 15 Aug 2022 18:18:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587491; bh=rkWXU3TEa6CIXUl/UnvFRmLkzh9CC0lIVI2ALWVyQsY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K4TiO8HdxwMsrtUoJJSzuaEXreQcT6CleW9r/52CouYnEc4fgTYCrygUoYifA7wU8 eat/9MlPnu+g+xNus/IAbJwsF+B7tbzLIh+1UQ/Bmaxb/n+CARfSTL2ByjLL+lm6oX JEAV07NUMBqAb/4lEc7J13v24prkI7ytGJpURtGs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ryuta NAKANISHI , Kunihiko Hayashi , Arnd Bergmann Subject: [PATCH 5.15 102/779] arm64: dts: uniphier: Fix USB interrupts for PXs3 SoC Date: Mon, 15 Aug 2022 19:55:46 +0200 Message-Id: <20220815180341.665060321@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kunihiko Hayashi commit fe17b91a7777df140d0f1433991da67ba658796c upstream. An interrupt for USB device are shared with USB host. Set interrupt-names property to common "dwc_usb3" instead of "host" and "peripheral". Cc: stable@vger.kernel.org Fixes: d7b9beb830d7 ("arm64: dts: uniphier: Add USB3 controller nodes") Reported-by: Ryuta NAKANISHI Signed-off-by: Kunihiko Hayashi Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm64/boot/dts/socionext/uniphier-pxs3.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/arch/arm64/boot/dts/socionext/uniphier-pxs3.dtsi +++ b/arch/arm64/boot/dts/socionext/uniphier-pxs3.dtsi @@ -599,8 +599,8 @@ compatible =3D "socionext,uniphier-dwc3", "snps,dwc3"; status =3D "disabled"; reg =3D <0x65a00000 0xcd00>; - interrupt-names =3D "host", "peripheral"; - interrupts =3D <0 134 4>, <0 135 4>; + interrupt-names =3D "dwc_usb3"; + interrupts =3D <0 134 4>; pinctrl-names =3D "default"; pinctrl-0 =3D <&pinctrl_usb0>, <&pinctrl_usb2>; clock-names =3D "ref", "bus_early", "suspend"; @@ -701,8 +701,8 @@ compatible =3D "socionext,uniphier-dwc3", "snps,dwc3"; status =3D "disabled"; reg =3D <0x65c00000 0xcd00>; - interrupt-names =3D "host", "peripheral"; - interrupts =3D <0 137 4>, <0 138 4>; + interrupt-names =3D "dwc_usb3"; + interrupts =3D <0 137 4>; pinctrl-names =3D "default"; pinctrl-0 =3D <&pinctrl_usb1>, <&pinctrl_usb3>; clock-names =3D "ref", "bus_early", "suspend"; From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 384B8C00140 for ; Mon, 15 Aug 2022 18:27:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241671AbiHOS1k (ORCPT ); Mon, 15 Aug 2022 14:27:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232750AbiHOSZN (ORCPT ); Mon, 15 Aug 2022 14:25:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F31CA17074; Mon, 15 Aug 2022 11:18: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 6FA5FB81071; Mon, 15 Aug 2022 18:18:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A701DC433C1; Mon, 15 Aug 2022 18:18:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587495; bh=WKhP9fvoBVbhKnnC/6M6Uk1riJbubN2caMGm8tF5IXM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QrEUD9NnhVGgkGHETC1s8wBGCPJBGEjInSl//wsBsdYeNTOpJRLPdqU/KW9/nNAxk OASP8tTZromsw3XUdZoeWYhy/iQFx55lIaxK7Wk2e4MlevL5fG2YOLQfojj8kN6zIC bZ9oL39nEZi9HtGcWQGfWNgLUcGHxw+2ORdKKFMI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern , syzbot+b0de012ceb1e2a97891b@syzkaller.appspotmail.com Subject: [PATCH 5.15 103/779] USB: gadget: Fix use-after-free Read in usb_udc_uevent() Date: Mon, 15 Aug 2022 19:55:47 +0200 Message-Id: <20220815180341.711918032@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alan Stern commit 2191c00855b03aa59c20e698be713d952d51fc18 upstream. The syzbot fuzzer found a race between uevent callbacks and gadget driver unregistration that can cause a use-after-free bug: Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --------------------------------------------------------------- BUG: KASAN: use-after-free in usb_udc_uevent+0x11f/0x130 drivers/usb/gadget/udc/core.c:1732 Read of size 8 at addr ffff888078ce2050 by task udevd/2968 CPU: 1 PID: 2968 Comm: udevd Not tainted 5.19.0-rc4-next-20220628-syzkaller= #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Goo= gle 06/29/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:317 [inline] print_report.cold+0x2ba/0x719 mm/kasan/report.c:433 kasan_report+0xbe/0x1f0 mm/kasan/report.c:495 usb_udc_uevent+0x11f/0x130 drivers/usb/gadget/udc/core.c:1732 dev_uevent+0x290/0x770 drivers/base/core.c:2424 --------------------------------------------------------------- The bug occurs because usb_udc_uevent() dereferences udc->driver but does so without acquiring the udc_lock mutex, which protects this field. If the gadget driver is unbound from the udc concurrently with uevent processing, the driver structure may be accessed after it has been deallocated. To prevent the race, we make sure that the routine holds the mutex around the racing accesses. Link: CC: stable@vger.kernel.org # fc274c1e9973 Reported-and-tested-by: syzbot+b0de012ceb1e2a97891b@syzkaller.appspotmail.c= om Signed-off-by: Alan Stern Link: https://lore.kernel.org/r/YtlrnhHyrHsSky9m@rowland.harvard.edu Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/udc/core.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) --- a/drivers/usb/gadget/udc/core.c +++ b/drivers/usb/gadget/udc/core.c @@ -1739,13 +1739,14 @@ static int usb_udc_uevent(struct device return ret; } =20 - if (udc->driver) { + mutex_lock(&udc_lock); + if (udc->driver) ret =3D add_uevent_var(env, "USB_UDC_DRIVER=3D%s", udc->driver->function); - if (ret) { - dev_err(dev, "failed to add uevent USB_UDC_DRIVER\n"); - return ret; - } + mutex_unlock(&udc_lock); + if (ret) { + dev_err(dev, "failed to add uevent USB_UDC_DRIVER\n"); + return ret; } =20 return 0; From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19BBFC00140 for ; Mon, 15 Aug 2022 18:25:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240464AbiHOSZY (ORCPT ); Mon, 15 Aug 2022 14:25:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241516AbiHOSY6 (ORCPT ); Mon, 15 Aug 2022 14:24: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 9DB5513E90; Mon, 15 Aug 2022 11:18: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 C7951B81072; Mon, 15 Aug 2022 18:18:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D4CCFC433C1; Mon, 15 Aug 2022 18:18:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587498; bh=ZM6vYaCVQmYjmggAgwDup8mSvZXzP1AWtKqfz4xpgts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k74eGyHkPH1gi5sq8Qq2qRtqs3tYJgguVEo2LacNwnBg4v10tOlIv69IIv8tKs07h pOVe5uBFSsUC+qh/vbdJU5LNicNNdfDV0vNWXXFv7/Ys8B52XbsE/IKoDM+1KvPqyf 1b0qLUk8hjg82JRdbUBeqNylcJQ+QrT0iQfJmRwk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , Michael Grzeschik Subject: [PATCH 5.15 104/779] usb: dwc3: gadget: refactor dwc3_repare_one_trb Date: Mon, 15 Aug 2022 19:55:48 +0200 Message-Id: <20220815180341.762158140@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Grzeschik commit 23385cec5f354794dadced7f28c31da7ae3eb54c upstream. The function __dwc3_prepare_one_trb has many parameters. Since it is only used in dwc3_prepare_one_trb there is no point in keeping the function. We merge both functions and get rid of the big list of parameters. Fixes: 40d829fb2ec6 ("usb: dwc3: gadget: Correct ISOC DATA PIDs for short p= ackets") Cc: stable Signed-off-by: Michael Grzeschik Link: https://lore.kernel.org/r/20220704141812.1532306-2-m.grzeschik@pengut= ronix.de Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/usb/dwc3/gadget.c | 92 ++++++++++++++++++++---------------------= ----- 1 file changed, 40 insertions(+), 52 deletions(-) --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1169,17 +1169,49 @@ static u32 dwc3_calc_trbs_left(struct dw return trbs_left; } =20 -static void __dwc3_prepare_one_trb(struct dwc3_ep *dep, struct dwc3_trb *t= rb, - dma_addr_t dma, unsigned int length, unsigned int chain, - unsigned int node, unsigned int stream_id, - unsigned int short_not_ok, unsigned int no_interrupt, - unsigned int is_last, bool must_interrupt) +/** + * dwc3_prepare_one_trb - setup one TRB from one request + * @dep: endpoint for which this request is prepared + * @req: dwc3_request pointer + * @trb_length: buffer size of the TRB + * @chain: should this TRB be chained to the next? + * @node: only for isochronous endpoints. First TRB needs different type. + * @use_bounce_buffer: set to use bounce buffer + * @must_interrupt: set to interrupt on TRB completion + */ +static void dwc3_prepare_one_trb(struct dwc3_ep *dep, + struct dwc3_request *req, unsigned int trb_length, + unsigned int chain, unsigned int node, bool use_bounce_buffer, + bool must_interrupt) { + struct dwc3_trb *trb; + dma_addr_t dma; + unsigned int stream_id =3D req->request.stream_id; + unsigned int short_not_ok =3D req->request.short_not_ok; + unsigned int no_interrupt =3D req->request.no_interrupt; + unsigned int is_last =3D req->request.is_last; struct dwc3 *dwc =3D dep->dwc; struct usb_gadget *gadget =3D dwc->gadget; enum usb_device_speed speed =3D gadget->speed; =20 - trb->size =3D DWC3_TRB_SIZE_LENGTH(length); + if (use_bounce_buffer) + dma =3D dep->dwc->bounce_addr; + else if (req->request.num_sgs > 0) + dma =3D sg_dma_address(req->start_sg); + else + dma =3D req->request.dma; + + trb =3D &dep->trb_pool[dep->trb_enqueue]; + + if (!req->trb) { + dwc3_gadget_move_started_request(req); + req->trb =3D trb; + req->trb_dma =3D dwc3_trb_dma_offset(dep, trb); + } + + req->num_trbs++; + + trb->size =3D DWC3_TRB_SIZE_LENGTH(trb_length); trb->bpl =3D lower_32_bits(dma); trb->bph =3D upper_32_bits(dma); =20 @@ -1219,10 +1251,10 @@ static void __dwc3_prepare_one_trb(struc unsigned int mult =3D 2; unsigned int maxp =3D usb_endpoint_maxp(ep->desc); =20 - if (length <=3D (2 * maxp)) + if (trb_length <=3D (2 * maxp)) mult--; =20 - if (length <=3D maxp) + if (trb_length <=3D maxp) mult--; =20 trb->size |=3D DWC3_TRB_SIZE_PCM1(mult); @@ -1291,50 +1323,6 @@ static void __dwc3_prepare_one_trb(struc trace_dwc3_prepare_trb(dep, trb); } =20 -/** - * dwc3_prepare_one_trb - setup one TRB from one request - * @dep: endpoint for which this request is prepared - * @req: dwc3_request pointer - * @trb_length: buffer size of the TRB - * @chain: should this TRB be chained to the next? - * @node: only for isochronous endpoints. First TRB needs different type. - * @use_bounce_buffer: set to use bounce buffer - * @must_interrupt: set to interrupt on TRB completion - */ -static void dwc3_prepare_one_trb(struct dwc3_ep *dep, - struct dwc3_request *req, unsigned int trb_length, - unsigned int chain, unsigned int node, bool use_bounce_buffer, - bool must_interrupt) -{ - struct dwc3_trb *trb; - dma_addr_t dma; - unsigned int stream_id =3D req->request.stream_id; - unsigned int short_not_ok =3D req->request.short_not_ok; - unsigned int no_interrupt =3D req->request.no_interrupt; - unsigned int is_last =3D req->request.is_last; - - if (use_bounce_buffer) - dma =3D dep->dwc->bounce_addr; - else if (req->request.num_sgs > 0) - dma =3D sg_dma_address(req->start_sg); - else - dma =3D req->request.dma; - - trb =3D &dep->trb_pool[dep->trb_enqueue]; - - if (!req->trb) { - dwc3_gadget_move_started_request(req); - req->trb =3D trb; - req->trb_dma =3D dwc3_trb_dma_offset(dep, trb); - } - - req->num_trbs++; - - __dwc3_prepare_one_trb(dep, trb, dma, trb_length, chain, node, - stream_id, short_not_ok, no_interrupt, is_last, - must_interrupt); -} - static bool dwc3_needs_extra_trb(struct dwc3_ep *dep, struct dwc3_request = *req) { unsigned int maxp =3D usb_endpoint_maxp(dep->endpoint.desc); From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62618C00140 for ; Mon, 15 Aug 2022 18:25:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241697AbiHOSZa (ORCPT ); Mon, 15 Aug 2022 14:25:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240476AbiHOSY7 (ORCPT ); Mon, 15 Aug 2022 14:24: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 E12E02F01C; Mon, 15 Aug 2022 11:18: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 4832F6068D; Mon, 15 Aug 2022 18:18:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39D16C433D6; Mon, 15 Aug 2022 18:18:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587501; bh=x2i5Ts8YzBr9qGHwch9dGyICGNpTc4V6+o6yggRv1oQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JoMka8wAHRkl0euyu6QuH9U2F/uNGOlJ0r6FRcleSRXOMtY8lrkjsMXfb2vlLXb0J oh8Fq+2R2ke3WFuA+aLgvQpEEo0sSjQ8mn0ve84tkCNrSnXvJ4pnP4d/KeOg5U0qmp 4p/ZVSMLiyHsQRIacUu6fxjTfG8sQ4I42lubiJJc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , Michael Grzeschik Subject: [PATCH 5.15 105/779] usb: dwc3: gadget: fix high speed multiplier setting Date: Mon, 15 Aug 2022 19:55:49 +0200 Message-Id: <20220815180341.812914884@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Grzeschik commit 8affe37c525d800a2628c4ecfaed13b77dc5634a upstream. For High-Speed Transfers the prepare_one_trb function is calculating the multiplier setting for the trb based on the length parameter of the trb currently prepared. This assumption is wrong. For trbs with a sg list, the length of the actual request has to be taken instead. Fixes: 40d829fb2ec6 ("usb: dwc3: gadget: Correct ISOC DATA PIDs for short p= ackets") Cc: stable Signed-off-by: Michael Grzeschik Link: https://lore.kernel.org/r/20220704141812.1532306-3-m.grzeschik@pengut= ronix.de Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/usb/dwc3/gadget.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1251,10 +1251,10 @@ static void dwc3_prepare_one_trb(struct unsigned int mult =3D 2; unsigned int maxp =3D usb_endpoint_maxp(ep->desc); =20 - if (trb_length <=3D (2 * maxp)) + if (req->request.length <=3D (2 * maxp)) mult--; =20 - if (trb_length <=3D maxp) + if (req->request.length <=3D maxp) mult--; =20 trb->size |=3D DWC3_TRB_SIZE_PCM1(mult); From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 365DAC3F6B0 for ; Mon, 15 Aug 2022 18:27:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241551AbiHOS1a (ORCPT ); Mon, 15 Aug 2022 14:27:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241963AbiHOSZq (ORCPT ); Mon, 15 Aug 2022 14:25:46 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 735072B193; Mon, 15 Aug 2022 11:18: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 sin.source.kernel.org (Postfix) with ESMTPS id 8CB10CE125C; Mon, 15 Aug 2022 18:18:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7569FC433C1; Mon, 15 Aug 2022 18:18:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587507; bh=MTPNmHz9GGC+2k+8p97JNSJcsEQhKpEKHIE/J6vWr4c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ugCTuwydAET275RyQ96EZRyyNdx23RztM/+Agp51+AfQ1BdN28BlNE7NEoYG4WC4W qwID3vQRkMX8exrJE161GQ6mu2prpE3n0Z/kKDgPv6mkyh95pDfM/37OMFPG3XbZsA TVTit87cpSXOvCqllvjXUxY+qbQ4wAudNRjLcTS4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thadeu Lima de Souza Cascardo , Pablo Neira Ayuso Subject: [PATCH 5.15 106/779] netfilter: nf_tables: do not allow SET_ID to refer to another table Date: Mon, 15 Aug 2022 19:55:50 +0200 Message-Id: <20220815180341.851846272@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Thadeu Lima de Souza Cascardo commit 470ee20e069a6d05ae549f7d0ef2bdbcee6a81b2 upstream. When doing lookups for sets on the same batch by using its ID, a set from a different table can be used. Then, when the table is removed, a reference to the set may be kept after the set is freed, leading to a potential use-after-free. When looking for sets by ID, use the table that was used for the lookup by name, and only return sets belonging to that same table. This fixes CVE-2022-2586, also reported as ZDI-CAN-17470. Reported-by: Team Orca of Sea Security (@seasecresponse) Fixes: 958bee14d071 ("netfilter: nf_tables: use new transaction infrastruct= ure to handle sets") Signed-off-by: Thadeu Lima de Souza Cascardo Cc: Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- net/netfilter/nf_tables_api.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -3745,6 +3745,7 @@ static struct nft_set *nft_set_lookup_by } =20 static struct nft_set *nft_set_lookup_byid(const struct net *net, + const struct nft_table *table, const struct nlattr *nla, u8 genmask) { struct nftables_pernet *nft_net =3D nft_pernet(net); @@ -3756,6 +3757,7 @@ static struct nft_set *nft_set_lookup_by struct nft_set *set =3D nft_trans_set(trans); =20 if (id =3D=3D nft_trans_set_id(trans) && + set->table =3D=3D table && nft_active_genmask(set, genmask)) return set; } @@ -3776,7 +3778,7 @@ struct nft_set *nft_set_lookup_global(co if (!nla_set_id) return set; =20 - set =3D nft_set_lookup_byid(net, nla_set_id, genmask); + set =3D nft_set_lookup_byid(net, table, nla_set_id, genmask); } return set; } From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17E39C00140 for ; Mon, 15 Aug 2022 18:28:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242208AbiHOS2Y (ORCPT ); Mon, 15 Aug 2022 14:28:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242010AbiHOSZs (ORCPT ); Mon, 15 Aug 2022 14:25:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 391672BEA; Mon, 15 Aug 2022 11:18:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 74A76B81063; Mon, 15 Aug 2022 18:18:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0B3AC433C1; Mon, 15 Aug 2022 18:18:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587511; bh=SSdxrt6SaLn3uYwefwPyPC+2wEBxa+Rwk3ncl4tY+FE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IiK1fLZLKr6cL8FE8zKDHx2NMSJIrQiY/mxQnb3ffRbLvwW8IFFomWfEmVN8g0hSQ ZIfsh9bx5GweVXBybcll8o8xAloUANgBKu5bD+DkjS8FJh4DKIT1+U0ATweVA4jD19 YWSZI5Su0CJHw9jzOesXAE4Y8+ksAwDg5zqDF2Uw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thadeu Lima de Souza Cascardo , Pablo Neira Ayuso Subject: [PATCH 5.15 107/779] netfilter: nf_tables: do not allow CHAIN_ID to refer to another table Date: Mon, 15 Aug 2022 19:55:51 +0200 Message-Id: <20220815180341.897318476@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Thadeu Lima de Souza Cascardo commit 95f466d22364a33d183509629d0879885b4f547e upstream. When doing lookups for chains on the same batch by using its ID, a chain from a different table can be used. If a rule is added to a table but refers to a chain in a different table, it will be linked to the chain in table2, but would have expressions referring to objects in table1. Then, when table1 is removed, the rule will not be removed as its linked to a chain in table2. When expressions in the rule are processed or removed, that will lead to a use-after-free. When looking for chains by ID, use the table that was used for the lookup by name, and only return chains belonging to that same table. Fixes: 837830a4b439 ("netfilter: nf_tables: add NFTA_RULE_CHAIN_ID attribut= e") Signed-off-by: Thadeu Lima de Souza Cascardo Cc: Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- net/netfilter/nf_tables_api.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -2377,6 +2377,7 @@ err: } =20 static struct nft_chain *nft_chain_lookup_byid(const struct net *net, + const struct nft_table *table, const struct nlattr *nla) { struct nftables_pernet *nft_net =3D nft_pernet(net); @@ -2387,6 +2388,7 @@ static struct nft_chain *nft_chain_looku struct nft_chain *chain =3D trans->ctx.chain; =20 if (trans->msg_type =3D=3D NFT_MSG_NEWCHAIN && + chain->table =3D=3D table && id =3D=3D nft_trans_chain_id(trans)) return chain; } @@ -3320,7 +3322,7 @@ static int nf_tables_newrule(struct sk_b return -EOPNOTSUPP; =20 } else if (nla[NFTA_RULE_CHAIN_ID]) { - chain =3D nft_chain_lookup_byid(net, nla[NFTA_RULE_CHAIN_ID]); + chain =3D nft_chain_lookup_byid(net, table, nla[NFTA_RULE_CHAIN_ID]); if (IS_ERR(chain)) { NL_SET_BAD_ATTR(extack, nla[NFTA_RULE_CHAIN_ID]); return PTR_ERR(chain); @@ -9451,7 +9453,7 @@ static int nft_verdict_init(const struct tb[NFTA_VERDICT_CHAIN], genmask); } else if (tb[NFTA_VERDICT_CHAIN_ID]) { - chain =3D nft_chain_lookup_byid(ctx->net, + chain =3D nft_chain_lookup_byid(ctx->net, ctx->table, tb[NFTA_VERDICT_CHAIN_ID]); if (IS_ERR(chain)) return PTR_ERR(chain); From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E010AC25B08 for ; Mon, 15 Aug 2022 18:27:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241472AbiHOS1Z (ORCPT ); Mon, 15 Aug 2022 14:27:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232797AbiHOSZM (ORCPT ); Mon, 15 Aug 2022 14:25: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 5322A1571B; Mon, 15 Aug 2022 11:18: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 D1C1DB81077; Mon, 15 Aug 2022 18:18:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3880C433D6; Mon, 15 Aug 2022 18:18:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587514; bh=NjQPoxHwTrsneS3IuPBx0bmFi8CQW1N40CwpddqCxyc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bqgmv8RT5HhjzNKben5k4PRl0O3LY6oQMnGaWKDh0MdHRlamoqFlYT2A572SaTRwy MAYxxvjwgumpHH7dt0J4cd+jGGGtToD2iMzsySR7pxPBvwg1R+gCNWW34Xk8MzFJoo IywLfFQCK+L1XgSgdu0eh3urPKWpZakKSKF+6fSk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thadeu Lima de Souza Cascardo , Pablo Neira Ayuso Subject: [PATCH 5.15 108/779] netfilter: nf_tables: do not allow RULE_ID to refer to another chain Date: Mon, 15 Aug 2022 19:55:52 +0200 Message-Id: <20220815180341.942721612@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Thadeu Lima de Souza Cascardo commit 36d5b2913219ac853908b0f1c664345e04313856 upstream. When doing lookups for rules on the same batch by using its ID, a rule from a different chain can be used. If a rule is added to a chain but tries to be positioned next to a rule from a different chain, it will be linked to chain2, but the use counter on chain1 would be the one to be incremented. When looking for rules by ID, use the chain that was used for the lookup by name. The chain used in the context copied to the transaction needs to match that same chain. That way, struct nft_rule does not need to get enlarged with another member. Fixes: 1a94e38d254b ("netfilter: nf_tables: add NFTA_RULE_ID attribute") Fixes: 75dd48e2e420 ("netfilter: nf_tables: Support RULE_ID reference in ne= w rule") Signed-off-by: Thadeu Lima de Souza Cascardo Cc: Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- net/netfilter/nf_tables_api.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -3276,6 +3276,7 @@ static int nft_table_validate(struct net } =20 static struct nft_rule *nft_rule_lookup_byid(const struct net *net, + const struct nft_chain *chain, const struct nlattr *nla); =20 #define NFT_RULE_MAXEXPRS 128 @@ -3364,7 +3365,7 @@ static int nf_tables_newrule(struct sk_b return PTR_ERR(old_rule); } } else if (nla[NFTA_RULE_POSITION_ID]) { - old_rule =3D nft_rule_lookup_byid(net, nla[NFTA_RULE_POSITION_ID]); + old_rule =3D nft_rule_lookup_byid(net, chain, nla[NFTA_RULE_POSITION_ID= ]); if (IS_ERR(old_rule)) { NL_SET_BAD_ATTR(extack, nla[NFTA_RULE_POSITION_ID]); return PTR_ERR(old_rule); @@ -3509,6 +3510,7 @@ err_release_expr: } =20 static struct nft_rule *nft_rule_lookup_byid(const struct net *net, + const struct nft_chain *chain, const struct nlattr *nla) { struct nftables_pernet *nft_net =3D nft_pernet(net); @@ -3519,6 +3521,7 @@ static struct nft_rule *nft_rule_lookup_ struct nft_rule *rule =3D nft_trans_rule(trans); =20 if (trans->msg_type =3D=3D NFT_MSG_NEWRULE && + trans->ctx.chain =3D=3D chain && id =3D=3D nft_trans_rule_id(trans)) return rule; } @@ -3568,7 +3571,7 @@ static int nf_tables_delrule(struct sk_b =20 err =3D nft_delrule(&ctx, rule); } else if (nla[NFTA_RULE_ID]) { - rule =3D nft_rule_lookup_byid(net, nla[NFTA_RULE_ID]); + rule =3D nft_rule_lookup_byid(net, chain, nla[NFTA_RULE_ID]); if (IS_ERR(rule)) { NL_SET_BAD_ATTR(extack, nla[NFTA_RULE_ID]); return PTR_ERR(rule); From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 891F3C00140 for ; Mon, 15 Aug 2022 18:28:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242375AbiHOS2h (ORCPT ); Mon, 15 Aug 2022 14:28:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242131AbiHOSZz (ORCPT ); Mon, 15 Aug 2022 14:25:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BAA02F664; Mon, 15 Aug 2022 11:19: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 6F88F6068B; Mon, 15 Aug 2022 18:18:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64B27C433D6; Mon, 15 Aug 2022 18:18:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587517; bh=1nyJF6tS4IDL2t+3hw/6H7P10fs3MNbMX922x6MthPw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=drS5MyEBryUcRSH9sKlDXT030OiwP4Bkmr1K2LAYqpHv1Xwl+0+jLDWol6B4ra+oi PeddlfWBeiplnwTEEjm5U0jaVLCbD2cyUUwBxqdpputZ7vGamuRgVy9jGoB/+UGrF5 zh7Oq436VeKu9C1QBXE5MyF2yCGinlWqAJyr9qjs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, mingi cho , Florian Westphal , Pablo Neira Ayuso Subject: [PATCH 5.15 109/779] netfilter: nf_tables: fix null deref due to zeroed list head Date: Mon, 15 Aug 2022 19:55:53 +0200 Message-Id: <20220815180341.982021377@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Westphal commit 580077855a40741cf511766129702d97ff02f4d9 upstream. In nf_tables_updtable, if nf_tables_table_enable returns an error, nft_trans_destroy is called to free the transaction object. nft_trans_destroy() calls list_del(), but the transaction was never placed on a list -- the list head is all zeroes, this results in a null dereference: BUG: KASAN: null-ptr-deref in nft_trans_destroy+0x26/0x59 Call Trace: nft_trans_destroy+0x26/0x59 nf_tables_newtable+0x4bc/0x9bc [..] Its sane to assume that nft_trans_destroy() can be called on the transaction object returned by nft_trans_alloc(), so make sure the list head is initialised. Fixes: 55dd6f93076b ("netfilter: nf_tables: use new transaction infrastruct= ure to handle table") Reported-by: mingi cho Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- net/netfilter/nf_tables_api.c | 1 + 1 file changed, 1 insertion(+) --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -153,6 +153,7 @@ static struct nft_trans *nft_trans_alloc if (trans =3D=3D NULL) return NULL; =20 + INIT_LIST_HEAD(&trans->list); trans->msg_type =3D msg_type; trans->ctx =3D *ctx; From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18DB6C00140 for ; Mon, 15 Aug 2022 18:28:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241929AbiHOS2D (ORCPT ); Mon, 15 Aug 2022 14:28:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242318AbiHOS0C (ORCPT ); Mon, 15 Aug 2022 14:26:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F8902F67F; Mon, 15 Aug 2022 11:19: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 67252B80F99; Mon, 15 Aug 2022 18:18:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D80DC433C1; Mon, 15 Aug 2022 18:18:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587521; bh=ktZ+YUfLo8CeU345XT9G1M7j/YCZnhlTFnxaB4h9gXE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RAYr4bsoBwILyJNoD/k3wk4EMnxa9EuVw9OKrYXkJkKvAQBJfp+z4YqqHUtbAH1YF yfUvnlm1/gan7Kypa6iqj2B9Qt87F9Z33/F5sKMZIXknh/j4oCyXBI/zZohc4evKpd 6Sf8TXcM+v/XzNfc99OtOH4IafBroV6/crJ6fEQc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ben Segall , Shakeel Butt , Alexander Viro , Linus Torvalds , Eric Dumazet , Roman Penyaev , Jason Baron , Khazhismel Kumykov , Heiher , stable@kernel.org, Andrew Morton Subject: [PATCH 5.15 110/779] epoll: autoremove wakers even more aggressively Date: Mon, 15 Aug 2022 19:55:54 +0200 Message-Id: <20220815180342.032766610@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Segall commit a16ceb13961068f7209e34d7984f8e42d2c06159 upstream. If a process is killed or otherwise exits while having active network connections and many threads waiting on epoll_wait, the threads will all be woken immediately, but not removed from ep->wq. Then when network traffic scans ep->wq in wake_up, every wakeup attempt will fail, and will not remove the entries from the list. This means that the cost of the wakeup attempt is far higher than usual, does not decrease, and this also competes with the dying threads trying to actually make progress and remove themselves from the wq. Handle this by removing visited epoll wq entries unconditionally, rather than only when the wakeup succeeds - the structure of ep_poll means that the only potential loss is the timed_out->eavail heuristic, which now can race and result in a redundant ep_send_events attempt. (But only when incoming data and a timeout actually race, not on every timeout) Shakeel added: : We are seeing this issue in production with real workloads and it has : caused hard lockups. Particularly network heavy workloads with a lot : of threads in epoll_wait() can easily trigger this issue if they get : killed (oom-killed in our case). Link: https://lkml.kernel.org/r/xm26fsjotqda.fsf@google.com Signed-off-by: Ben Segall Tested-by: Shakeel Butt Cc: Alexander Viro Cc: Linus Torvalds Cc: Shakeel Butt Cc: Eric Dumazet Cc: Roman Penyaev Cc: Jason Baron Cc: Khazhismel Kumykov Cc: Heiher Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/eventpoll.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) --- a/fs/eventpoll.c +++ b/fs/eventpoll.c @@ -1740,6 +1740,21 @@ static struct timespec64 *ep_timeout_to_ return to; } =20 +/* + * autoremove_wake_function, but remove even on failure to wake up, becaus= e we + * know that default_wake_function/ttwu will only fail if the thread is al= ready + * woken, and in that case the ep_poll loop will remove the entry anyways,= not + * try to reuse it. + */ +static int ep_autoremove_wake_function(struct wait_queue_entry *wq_entry, + unsigned int mode, int sync, void *key) +{ + int ret =3D default_wake_function(wq_entry, mode, sync, key); + + list_del_init(&wq_entry->entry); + return ret; +} + /** * ep_poll - Retrieves ready events, and delivers them to the caller-suppl= ied * event buffer. @@ -1821,8 +1836,15 @@ static int ep_poll(struct eventpoll *ep, * normal wakeup path no need to call __remove_wait_queue() * explicitly, thus ep->lock is not taken, which halts the * event delivery. + * + * In fact, we now use an even more aggressive function that + * unconditionally removes, because we don't reuse the wait + * entry between loop iterations. This lets us also avoid the + * performance issue if a process is killed, causing all of its + * threads to wake up without being removed normally. */ init_wait(&wait); + wait.func =3D ep_autoremove_wake_function; =20 write_lock_irq(&ep->lock); /* From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E7E5C25B08 for ; Mon, 15 Aug 2022 18:28:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230131AbiHOS2k (ORCPT ); Mon, 15 Aug 2022 14:28:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242310AbiHOS0C (ORCPT ); Mon, 15 Aug 2022 14:26:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD5C72FFC2; Mon, 15 Aug 2022 11:19: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 E21D56068D; Mon, 15 Aug 2022 18:18:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D311CC433D6; Mon, 15 Aug 2022 18:18:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587524; bh=8ShKdM//abOJwn9BoY7nE11m3+dm8Ihcu8SgmPluy/Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XqJuHXABsKlnadmlBaRn4K5/pv0h9PDTRcoVJYFhvTTxkEO1j3ZKpvCenNHQfDpxR ZfYoeF9myyRS5Hv5zo9lOr+B9BD6aZOGknqVRo59bSguQX4gMzQXsvSHTxeey14f+X qy/UT8+nVD1Tm2dgWV+MQElV1vyj7k0QFqFcoJdM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wyes Karny , Dave Hansen , Zhang Rui , Sasha Levin Subject: [PATCH 5.15 111/779] x86: Handle idle=nomwait cmdline properly for x86_idle Date: Mon, 15 Aug 2022 19:55:55 +0200 Message-Id: <20220815180342.083451003@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wyes Karny [ Upstream commit 8bcedb4ce04750e1ccc9a6b6433387f6a9166a56 ] When kernel is booted with idle=3Dnomwait do not use MWAIT as the default idle state. If the user boots the kernel with idle=3Dnomwait, it is a clear direction to not use mwait as the default idle state. However, the current code does not take this into consideration while selecting the default idle state on x86. Fix it by checking for the idle=3Dnomwait boot option in prefer_mwait_c1_over_halt(). Also update the documentation around idle=3Dnomwait appropriately. [ dhansen: tweak commit message ] Signed-off-by: Wyes Karny Signed-off-by: Dave Hansen Tested-by: Zhang Rui Link: https://lkml.kernel.org/r/fdc2dc2d0a1bc21c2f53d989ea2d2ee3ccbc0dbe.16= 54538381.git-series.wyes.karny@amd.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- Documentation/admin-guide/pm/cpuidle.rst | 15 +++++++++------ arch/x86/kernel/process.c | 9 ++++++--- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Documentation/admin-guide/pm/cpuidle.rst b/Documentation/admin= -guide/pm/cpuidle.rst index aec2cd2aaea7..19754beb5a4e 100644 --- a/Documentation/admin-guide/pm/cpuidle.rst +++ b/Documentation/admin-guide/pm/cpuidle.rst @@ -612,8 +612,8 @@ the ``menu`` governor to be used on the systems that us= e the ``ladder`` governor by default this way, for example. =20 The other kernel command line parameters controlling CPU idle time managem= ent -described below are only relevant for the *x86* architecture and some of -them affect Intel processors only. +described below are only relevant for the *x86* architecture and references +to ``intel_idle`` affect Intel processors only. =20 The *x86* architecture support code recognizes three kernel command line options related to CPU idle time management: ``idle=3Dpoll``, ``idle=3Dhal= t``, @@ -635,10 +635,13 @@ idle, so it very well may hurt single-thread computat= ions performance as well as energy-efficiency. Thus using it for performance reasons may not be a goo= d idea at all.] =20 -The ``idle=3Dnomwait`` option disables the ``intel_idle`` driver and causes -``acpi_idle`` to be used (as long as all of the information needed by it is -there in the system's ACPI tables), but it is not allowed to use the -``MWAIT`` instruction of the CPUs to ask the hardware to enter idle states. +The ``idle=3Dnomwait`` option prevents the use of ``MWAIT`` instruction of +the CPU to enter idle states. When this option is used, the ``acpi_idle`` +driver will use the ``HLT`` instruction instead of ``MWAIT``. On systems +running Intel processors, this option disables the ``intel_idle`` driver +and forces the use of the ``acpi_idle`` driver instead. Note that in either +case, ``acpi_idle`` driver will function only if all the information needed +by it is in the system's ACPI tables. =20 In addition to the architecture-level kernel command line options affectin= g CPU idle time management, there are parameters affecting individual ``CPUIdle`` diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index 8d9d72fc27a2..707376453525 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c @@ -805,6 +805,10 @@ static void amd_e400_idle(void) */ static int prefer_mwait_c1_over_halt(const struct cpuinfo_x86 *c) { + /* User has disallowed the use of MWAIT. Fallback to HALT */ + if (boot_option_idle_override =3D=3D IDLE_NOMWAIT) + return 0; + if (c->x86_vendor !=3D X86_VENDOR_INTEL) return 0; =20 @@ -913,9 +917,8 @@ static int __init idle_setup(char *str) } else if (!strcmp(str, "nomwait")) { /* * If the boot option of "idle=3Dnomwait" is added, - * it means that mwait will be disabled for CPU C2/C3 - * states. In such case it won't touch the variable - * of boot_option_idle_override. + * it means that mwait will be disabled for CPU C1/C2/C3 + * states. */ boot_option_idle_override =3D IDLE_NOMWAIT; } else --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91542C00140 for ; Mon, 15 Aug 2022 18:27:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241705AbiHOS1q (ORCPT ); Mon, 15 Aug 2022 14:27:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242456AbiHOS0J (ORCPT ); Mon, 15 Aug 2022 14:26:09 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E24142FFDD; Mon, 15 Aug 2022 11:19: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 sin.source.kernel.org (Postfix) with ESMTPS id 3B73BCE125A; Mon, 15 Aug 2022 18:18:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09517C433C1; Mon, 15 Aug 2022 18:18:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587527; bh=zn7mZIOUKopCQiK6wEEUIfGvCikAD5V+7KAuofMwnWA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cu8+jNVCy0/EWo30Czx35oDLJyIJfctfe4PNKrqGiQ2GZx4kPtEHyh0boxjH4vilS qNEEbeVRelndfHvbX0zQ7rCq6n+QzuVvcVqkok/RHDK/riQ3YpE/if1srnQ+m9nzfH dLSp6DnojCubWtC+1eOCxKwncMB939KF3L3Dqv5Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Rutland , Catalin Marinas , Ingo Molnar , "Peter Zijlstra (Intel)" , Thomas Gleixner , Will Deacon , Sasha Levin Subject: [PATCH 5.15 112/779] arch: make TRACE_IRQFLAGS_NMI_SUPPORT generic Date: Mon, 15 Aug 2022 19:55:56 +0200 Message-Id: <20220815180342.129998677@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mark Rutland [ Upstream commit 4510bffb4d0246cdcc1f14c7367c026b807a862d ] On most architectures, IRQ flag tracing is disabled in NMI context, and architectures need to define and select TRACE_IRQFLAGS_NMI_SUPPORT in order to enable this. Commit: 859d069ee1ddd878 ("lockdep: Prepare for NMI IRQ state tracking") Permitted IRQ flag tracing in NMI context, allowing lockdep to work in NMI context where an architecture had suitable entry logic. At the time, most architectures did not have such suitable entry logic, and this broke lockdep on such architectures. Thus, this was partially disabled in commit: ed00495333ccc80f ("locking/lockdep: Fix TRACE_IRQFLAGS vs. NMIs") ... with architectures needing to select TRACE_IRQFLAGS_NMI_SUPPORT to enable IRQ flag tracing in NMI context. Currently TRACE_IRQFLAGS_NMI_SUPPORT is defined under arch/x86/Kconfig.debug. Move it to arch/Kconfig so architectures can select it without having to provide their own definition. Since the regular TRACE_IRQFLAGS_SUPPORT is selected by arch/x86/Kconfig, the select of TRACE_IRQFLAGS_NMI_SUPPORT is moved there too. There should be no functional change as a result of this patch. Signed-off-by: Mark Rutland Cc: Catalin Marinas Cc: Ingo Molnar Cc: Peter Zijlstra (Intel) Cc: Thomas Gleixner Cc: Will Deacon Link: https://lore.kernel.org/r/20220511131733.4074499-2-mark.rutland@arm.c= om Signed-off-by: Will Deacon Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/Kconfig | 3 +++ arch/x86/Kconfig | 1 + arch/x86/Kconfig.debug | 3 --- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/Kconfig b/arch/Kconfig index 191589f26b1a..5987363b41c2 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -200,6 +200,9 @@ config HAVE_NMI config TRACE_IRQFLAGS_SUPPORT bool =20 +config TRACE_IRQFLAGS_NMI_SUPPORT + bool + # # An arch should select this if it provides all these things: # diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index fe6981a38795..57f5e881791a 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -260,6 +260,7 @@ config X86 select SYSCTL_EXCEPTION_TRACE select THREAD_INFO_IN_TASK select TRACE_IRQFLAGS_SUPPORT + select TRACE_IRQFLAGS_NMI_SUPPORT select USER_STACKTRACE_SUPPORT select VIRT_TO_BUS select HAVE_ARCH_KCSAN if X86_64 diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug index d3a6f74a94bd..d4d6db4dde22 100644 --- a/arch/x86/Kconfig.debug +++ b/arch/x86/Kconfig.debug @@ -1,8 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 =20 -config TRACE_IRQFLAGS_NMI_SUPPORT - def_bool y - config EARLY_PRINTK_USB bool =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C892C00140 for ; Mon, 15 Aug 2022 18:27:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241819AbiHOS1v (ORCPT ); Mon, 15 Aug 2022 14:27:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242757AbiHOS00 (ORCPT ); Mon, 15 Aug 2022 14:26:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 257A930F46; Mon, 15 Aug 2022 11:19: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 164A7B81077; Mon, 15 Aug 2022 18:18:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1DF83C433D7; Mon, 15 Aug 2022 18:18:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587530; bh=1sPZN9zAK9b0nXMwsiefYVa2gH9pSAB6Wy3GSLMBpQU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fgTSBiVjqM3IYcQghKckCVYJzYKeM4fxsIcbqTOaamSMIDHCKvtcsxHuRa+6mrnUt umkYMwxF20KrD7vZ5I3jqaHuRJCQdpEpS+PJiJiChmCN/LiwQxKv339X/KEgnRM8PR DnXiygkuiXJXnjCJ0ykpS+JXrTxk4Ev05xPY8gwc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Francis Laniel , Will Deacon , Sasha Levin Subject: [PATCH 5.15 113/779] arm64: Do not forget syscall when starting a new thread. Date: Mon, 15 Aug 2022 19:55:57 +0200 Message-Id: <20220815180342.160664688@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Francis Laniel [ Upstream commit de6921856f99c11d3986c6702d851e1328d4f7f6 ] Enable tracing of the execve*() system calls with the syscalls:sys_exit_execve tracepoint by removing the call to forget_syscall() when starting a new thread and preserving the value of regs->syscallno across exec. Signed-off-by: Francis Laniel Link: https://lore.kernel.org/r/20220608162447.666494-2-flaniel@linux.micro= soft.com Signed-off-by: Will Deacon Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm64/include/asm/processor.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/pr= ocessor.h index 5e73d7f7d1e7..d9bf3d12a2b8 100644 --- a/arch/arm64/include/asm/processor.h +++ b/arch/arm64/include/asm/processor.h @@ -204,8 +204,9 @@ void tls_preserve_current_state(void); =20 static inline void start_thread_common(struct pt_regs *regs, unsigned long= pc) { + s32 previous_syscall =3D regs->syscallno; memset(regs, 0, sizeof(*regs)); - forget_syscall(regs); + regs->syscallno =3D previous_syscall; regs->pc =3D pc; =20 if (system_uses_irq_prio_masking()) --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0712C25B08 for ; Mon, 15 Aug 2022 18:28:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242477AbiHOS2s (ORCPT ); Mon, 15 Aug 2022 14:28:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242801AbiHOS02 (ORCPT ); Mon, 15 Aug 2022 14:26:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 841DE2AE14; Mon, 15 Aug 2022 11:19: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 A970F6069E; Mon, 15 Aug 2022 18:18:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB1B4C433D6; Mon, 15 Aug 2022 18:18:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587534; bh=UsJ1W9RjJSWVKtc1ccZK/Q+wChESlZoqtnuUpz+5rhc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NSLPKZzdxW+FAWW2j7+XQoRcikG5D9mdzgfXYqvi2pY9gSftXrheJszgKWv6YUplh mQSn3x5zk59ugIhV56nMauxG9fFg6nx/STvkrPV/91/xD740jbsTN9qtXTtu8Qmpx1 XWvet6jJvi2INBX8eB7V+1R8Mut3pdQSorNyLtLs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, hewenliang , Haibin Zhang , Catalin Marinas , Will Deacon , Sasha Levin Subject: [PATCH 5.15 114/779] arm64: fix oops in concurrently setting insn_emulation sysctls Date: Mon, 15 Aug 2022 19:55:58 +0200 Message-Id: <20220815180342.196857372@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: haibinzhang (=E5=BC=A0=E6=B5=B7=E6=96=8C) [ Upstream commit af483947d472eccb79e42059276c4deed76f99a6 ] emulation_proc_handler() changes table->data for proc_dointvec_minmax and can generate the following Oops if called concurrently with itself: | Unable to handle kernel NULL pointer dereference at virtual address 0000= 000000000010 | Internal error: Oops: 96000006 [#1] SMP | Call trace: | update_insn_emulation_mode+0xc0/0x148 | emulation_proc_handler+0x64/0xb8 | proc_sys_call_handler+0x9c/0xf8 | proc_sys_write+0x18/0x20 | __vfs_write+0x20/0x48 | vfs_write+0xe4/0x1d0 | ksys_write+0x70/0xf8 | __arm64_sys_write+0x20/0x28 | el0_svc_common.constprop.0+0x7c/0x1c0 | el0_svc_handler+0x2c/0xa0 | el0_svc+0x8/0x200 To fix this issue, keep the table->data as &insn->current_mode and use container_of() to retrieve the insn pointer. Another mutex is used to protect against the current_mode update but not for retrieving insn_emulation as table->data is no longer changing. Co-developed-by: hewenliang Signed-off-by: hewenliang Signed-off-by: Haibin Zhang Reviewed-by: Catalin Marinas Link: https://lore.kernel.org/r/20220128090324.2727688-1-hewenliang4@huawei= .com Link: https://lore.kernel.org/r/9A004C03-250B-46C5-BF39-782D7551B00E@tencen= t.com Signed-off-by: Will Deacon Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm64/kernel/armv8_deprecated.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/arm64/kernel/armv8_deprecated.c b/arch/arm64/kernel/armv8= _deprecated.c index 0e86e8b9cedd..c5da9d1e954a 100644 --- a/arch/arm64/kernel/armv8_deprecated.c +++ b/arch/arm64/kernel/armv8_deprecated.c @@ -59,6 +59,7 @@ struct insn_emulation { static LIST_HEAD(insn_emulation); static int nr_insn_emulated __initdata; static DEFINE_RAW_SPINLOCK(insn_emulation_lock); +static DEFINE_MUTEX(insn_emulation_mutex); =20 static void register_emulation_hooks(struct insn_emulation_ops *ops) { @@ -207,10 +208,10 @@ static int emulation_proc_handler(struct ctl_table *t= able, int write, loff_t *ppos) { int ret =3D 0; - struct insn_emulation *insn =3D (struct insn_emulation *) table->data; + struct insn_emulation *insn =3D container_of(table->data, struct insn_emu= lation, current_mode); enum insn_emulation_mode prev_mode =3D insn->current_mode; =20 - table->data =3D &insn->current_mode; + mutex_lock(&insn_emulation_mutex); ret =3D proc_dointvec_minmax(table, write, buffer, lenp, ppos); =20 if (ret || !write || prev_mode =3D=3D insn->current_mode) @@ -223,7 +224,7 @@ static int emulation_proc_handler(struct ctl_table *tab= le, int write, update_insn_emulation_mode(insn, INSN_UNDEF); } ret: - table->data =3D insn; + mutex_unlock(&insn_emulation_mutex); return ret; } =20 @@ -247,7 +248,7 @@ static void __init register_insn_emulation_sysctl(void) sysctl->maxlen =3D sizeof(int); =20 sysctl->procname =3D insn->ops->name; - sysctl->data =3D insn; + sysctl->data =3D &insn->current_mode; sysctl->extra1 =3D &insn->min; sysctl->extra2 =3D &insn->max; sysctl->proc_handler =3D emulation_proc_handler; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8E87C00140 for ; Mon, 15 Aug 2022 18:28:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242284AbiHOS23 (ORCPT ); Mon, 15 Aug 2022 14:28:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242854AbiHOS0c (ORCPT ); Mon, 15 Aug 2022 14:26:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B697729CB8; Mon, 15 Aug 2022 11:19:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CA6D060ED3; Mon, 15 Aug 2022 18:18:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCEBCC433C1; Mon, 15 Aug 2022 18:18:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587537; bh=ZxWz0hJH7CGyQ5XHjdFME7AxasqVLcjVOdfkOBfdryI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UXpIh+U57DFlflcS/nwmKp5DRLmNxxd+PZjiqeOjMCHxNDArLHMqRkWfV4p1aO6No DPrIaabi8I92v+S48d68k7dkAYbLATUPsq1+ACu0ESJBnCm+pj6j1dfPsd4IkXWsVW goL9G/nWuAM1A/6QbxXwHW/iuW5ytikzYTO+6WrI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Catalin Marinas , Will Deacon , Vincenzo Frascino , Andrey Konovalov , Peter Collingbourne , Sasha Levin Subject: [PATCH 5.15 115/779] arm64: kasan: Revert "arm64: mte: reset the page tag in page->flags" Date: Mon, 15 Aug 2022 19:55:59 +0200 Message-Id: <20220815180342.246608756@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Catalin Marinas [ Upstream commit 20794545c14692094a882d2221c251c4573e6adf ] This reverts commit e5b8d9218951e59df986f627ec93569a0d22149b. Pages mapped in user-space with PROT_MTE have the allocation tags either zeroed or copied/restored to some user values. In order for the kernel to access such pages via page_address(), resetting the tag in page->flags was necessary. This tag resetting was deferred to set_pte_at() -> mte_sync_page_tags() but it can race with another CPU reading the flags (via page_to_virt()): P0 (mte_sync_page_tags): P1 (memcpy from virt_to_page): Rflags!=3D0xff Wflags=3D0xff DMB (doesn't help) Wtags=3D0 Rtags=3D0 // fault Since now the post_alloc_hook() function resets the page->flags tag when unpoisoning is skipped for user pages (including the __GFP_ZEROTAGS case), revert the arm64 commit calling page_kasan_tag_reset(). Signed-off-by: Catalin Marinas Cc: Will Deacon Cc: Vincenzo Frascino Cc: Andrey Konovalov Cc: Peter Collingbourne Reviewed-by: Vincenzo Frascino Acked-by: Andrey Konovalov Link: https://lore.kernel.org/r/20220610152141.2148929-5-catalin.marinas@ar= m.com Signed-off-by: Will Deacon Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm64/kernel/hibernate.c | 5 ----- arch/arm64/kernel/mte.c | 9 --------- arch/arm64/mm/copypage.c | 9 --------- arch/arm64/mm/mteswap.c | 9 --------- 4 files changed, 32 deletions(-) diff --git a/arch/arm64/kernel/hibernate.c b/arch/arm64/kernel/hibernate.c index 46a0b4d6e251..db93ce2b0113 100644 --- a/arch/arm64/kernel/hibernate.c +++ b/arch/arm64/kernel/hibernate.c @@ -326,11 +326,6 @@ static void swsusp_mte_restore_tags(void) unsigned long pfn =3D xa_state.xa_index; struct page *page =3D pfn_to_online_page(pfn); =20 - /* - * It is not required to invoke page_kasan_tag_reset(page) - * at this point since the tags stored in page->flags are - * already restored. - */ mte_restore_page_tags(page_address(page), tags); =20 mte_free_tag_storage(tags); diff --git a/arch/arm64/kernel/mte.c b/arch/arm64/kernel/mte.c index 7c1c82c8115c..10207e3e5ae2 100644 --- a/arch/arm64/kernel/mte.c +++ b/arch/arm64/kernel/mte.c @@ -44,15 +44,6 @@ static void mte_sync_page_tags(struct page *page, pte_t = old_pte, if (!pte_is_tagged) return; =20 - page_kasan_tag_reset(page); - /* - * We need smp_wmb() in between setting the flags and clearing the - * tags because if another thread reads page->flags and builds a - * tagged address out of it, there is an actual dependency to the - * memory access, but on the current thread we do not guarantee that - * the new page->flags are visible before the tags were updated. - */ - smp_wmb(); mte_clear_page_tags(page_address(page)); } =20 diff --git a/arch/arm64/mm/copypage.c b/arch/arm64/mm/copypage.c index 0dea80bf6de4..24913271e898 100644 --- a/arch/arm64/mm/copypage.c +++ b/arch/arm64/mm/copypage.c @@ -23,15 +23,6 @@ void copy_highpage(struct page *to, struct page *from) =20 if (system_supports_mte() && test_bit(PG_mte_tagged, &from->flags)) { set_bit(PG_mte_tagged, &to->flags); - page_kasan_tag_reset(to); - /* - * We need smp_wmb() in between setting the flags and clearing the - * tags because if another thread reads page->flags and builds a - * tagged address out of it, there is an actual dependency to the - * memory access, but on the current thread we do not guarantee that - * the new page->flags are visible before the tags were updated. - */ - smp_wmb(); mte_copy_page_tags(kto, kfrom); } } diff --git a/arch/arm64/mm/mteswap.c b/arch/arm64/mm/mteswap.c index 7c4ef56265ee..c52c1847079c 100644 --- a/arch/arm64/mm/mteswap.c +++ b/arch/arm64/mm/mteswap.c @@ -53,15 +53,6 @@ bool mte_restore_tags(swp_entry_t entry, struct page *pa= ge) if (!tags) return false; =20 - page_kasan_tag_reset(page); - /* - * We need smp_wmb() in between setting the flags and clearing the - * tags because if another thread reads page->flags and builds a - * tagged address out of it, there is an actual dependency to the - * memory access, but on the current thread we do not guarantee that - * the new page->flags are visible before the tags were updated. - */ - smp_wmb(); mte_restore_page_tags(page_address(page), tags); =20 return true; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B8B4FC00140 for ; Mon, 15 Aug 2022 18:28:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242135AbiHOS2U (ORCPT ); Mon, 15 Aug 2022 14:28:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242978AbiHOS0h (ORCPT ); Mon, 15 Aug 2022 14:26:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57DE931208; Mon, 15 Aug 2022 11:19: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 2DA3760BFE; Mon, 15 Aug 2022 18:19:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3563EC433D6; Mon, 15 Aug 2022 18:19:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587543; bh=//pzvalXiDFERDVTn7mkwh9A1vGWIPKab/JROE8rypI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gIqrV5xwbpGpqc+MOiS2EtmPnGLJmTHid/Nltegrk4k2VG6lHOu3fyHoCDZCwGUEg ysbJFYybsbGUoFKOcHdGvjLMsGwBMx0/XyLwNaZwl76vg87IZNZWErCxFVKSQMwmlW LIbskwTmYNJd4Mgimf4TPg5i97rlQU/kOfGz4CIU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+d273f7d7f58afd93be48@syzkaller.appspotmail.com, Jan Kara , Sasha Levin Subject: [PATCH 5.15 116/779] ext2: Add more validity checks for inode counts Date: Mon, 15 Aug 2022 19:56:00 +0200 Message-Id: <20220815180342.279871800@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jan Kara [ Upstream commit fa78f336937240d1bc598db817d638086060e7e9 ] Add checks verifying number of inodes stored in the superblock matches the number computed from number of inodes per group. Also verify we have at least one block worth of inodes per group. This prevents crashes on corrupted filesystems. Reported-by: syzbot+d273f7d7f58afd93be48@syzkaller.appspotmail.com Signed-off-by: Jan Kara Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/ext2/super.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 3d21279fe2cb..fd855574ef09 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c @@ -1058,9 +1058,10 @@ static int ext2_fill_super(struct super_block *sb, v= oid *data, int silent) sbi->s_frags_per_group); goto failed_mount; } - if (sbi->s_inodes_per_group > sb->s_blocksize * 8) { + if (sbi->s_inodes_per_group < sbi->s_inodes_per_block || + sbi->s_inodes_per_group > sb->s_blocksize * 8) { ext2_msg(sb, KERN_ERR, - "error: #inodes per group too big: %lu", + "error: invalid #inodes per group: %lu", sbi->s_inodes_per_group); goto failed_mount; } @@ -1070,6 +1071,13 @@ static int ext2_fill_super(struct super_block *sb, v= oid *data, int silent) sbi->s_groups_count =3D ((le32_to_cpu(es->s_blocks_count) - le32_to_cpu(es->s_first_data_block) - 1) / EXT2_BLOCKS_PER_GROUP(sb)) + 1; + if ((u64)sbi->s_groups_count * sbi->s_inodes_per_group !=3D + le32_to_cpu(es->s_inodes_count)) { + ext2_msg(sb, KERN_ERR, "error: invalid #inodes: %u vs computed %llu", + le32_to_cpu(es->s_inodes_count), + (u64)sbi->s_groups_count * sbi->s_inodes_per_group); + goto failed_mount; + } db_count =3D (sbi->s_groups_count + EXT2_DESC_PER_BLOCK(sb) - 1) / EXT2_DESC_PER_BLOCK(sb); sbi->s_group_desc =3D kmalloc_array(db_count, --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D96B6C00140 for ; Mon, 15 Aug 2022 18:28:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233098AbiHOS2n (ORCPT ); Mon, 15 Aug 2022 14:28:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242512AbiHOS0N (ORCPT ); Mon, 15 Aug 2022 14:26: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 1D3402FFE1; Mon, 15 Aug 2022 11:19: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 4A78AB81071; Mon, 15 Aug 2022 18:19:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 610A3C433B5; Mon, 15 Aug 2022 18:19:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587547; bh=ov6AMHNfT9QpwZvT+nvTOObX98Q/TemcAvrEM/XXVeU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uIoJKn4gmS+GWI3ad0kuVnyhZgPDTuAcm+BsKqIH2EeBbbD0G71OJaRAiYdjKBa1t qqEwwiGGs5qk5xEgd5TDMBrw3C9Z6RhRMk40ezjlA0jcNgsUeBYx6XUvjPyAVhq6nD Ee/SxKO+80xJot+7H3CGL8Wph0QwjgfLXetMGmWY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tim Chen , Peter Zijlstra , Chen Yu , Yicong Yang , Mohini Narkhede , K Prateek Nayak , Sasha Levin Subject: [PATCH 5.15 117/779] sched/fair: Introduce SIS_UTIL to search idle CPU based on sum of util_avg Date: Mon, 15 Aug 2022 19:56:01 +0200 Message-Id: <20220815180342.324858589@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 [ Upstream commit 70fb5ccf2ebb09a0c8ebba775041567812d45f86 ] [Problem Statement] select_idle_cpu() might spend too much time searching for an idle CPU, when the system is overloaded. The following histogram is the time spent in select_idle_cpu(), when running 224 instances of netperf on a system with 112 CPUs per LLC domain: @usecs: [0] 533 | = | [1] 5495 | = | [2, 4) 12008 | = | [4, 8) 239252 | = | [8, 16) 4041924 |@@@@@@@@@@@@@@ = | [16, 32) 12357398 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ = | [32, 64) 14820255 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@= @@@| [64, 128) 13047682 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ = | [128, 256) 8235013 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@ = | [256, 512) 4507667 |@@@@@@@@@@@@@@@ = | [512, 1K) 2600472 |@@@@@@@@@ = | [1K, 2K) 927912 |@@@ = | [2K, 4K) 218720 | = | [4K, 8K) 98161 | = | [8K, 16K) 37722 | = | [16K, 32K) 6715 | = | [32K, 64K) 477 | = | [64K, 128K) 7 | = | netperf latency usecs: =3D=3D=3D=3D=3D=3D=3D case load Lat_99th std% TCP_RR thread-224 257.39 ( 0.21) The time spent in select_idle_cpu() is visible to netperf and might have a = negative impact. [Symptom analysis] The patch [1] from Mel Gorman has been applied to track the efficiency of select_idle_sibling. Copy the indicators here: SIS Search Efficiency(se_eff%): A ratio expressed as a percentage of runqueues scanned versus idle CPUs found. A 100% efficiency indicates that the target, prev or recent CPU of a task was idle at wakeup. The lower the efficiency, the more runqueues were scanned before an idle CPU was found. SIS Domain Search Efficiency(dom_eff%): Similar, except only for the slower SIS patch. SIS Fast Success Rate(fast_rate%): Percentage of SIS that used target, prev or recent CPUs. SIS Success rate(success_rate%): Percentage of scans that found an idle CPU. The test is based on Aubrey's schedtests tool, including netperf, hackbench, schbench and tbench. Test on vanilla kernel: schedstat_parse.py -f netperf_vanilla.log case load se_eff% dom_eff% fast_rate% success_rate% TCP_RR 28 threads 99.978 18.535 99.995 100.000 TCP_RR 56 threads 99.397 5.671 99.964 100.000 TCP_RR 84 threads 21.721 6.818 73.632 100.000 TCP_RR 112 threads 12.500 5.533 59.000 100.000 TCP_RR 140 threads 8.524 4.535 49.020 100.000 TCP_RR 168 threads 6.438 3.945 40.309 99.999 TCP_RR 196 threads 5.397 3.718 32.320 99.982 TCP_RR 224 threads 4.874 3.661 25.775 99.767 UDP_RR 28 threads 99.988 17.704 99.997 100.000 UDP_RR 56 threads 99.528 5.977 99.970 100.000 UDP_RR 84 threads 24.219 6.992 76.479 100.000 UDP_RR 112 threads 13.907 5.706 62.538 100.000 UDP_RR 140 threads 9.408 4.699 52.519 100.000 UDP_RR 168 threads 7.095 4.077 44.352 100.000 UDP_RR 196 threads 5.757 3.775 35.764 99.991 UDP_RR 224 threads 5.124 3.704 28.748 99.860 schedstat_parse.py -f schbench_vanilla.log (each group has 28 tasks) case load se_eff% dom_eff% fast_rate% success_rate% normal 1 mthread 99.152 6.400 99.941 100.000 normal 2 mthreads 97.844 4.003 99.908 100.000 normal 3 mthreads 96.395 2.118 99.917 99.998 normal 4 mthreads 55.288 1.451 98.615 99.804 normal 5 mthreads 7.004 1.870 45.597 61.036 normal 6 mthreads 3.354 1.346 20.777 34.230 normal 7 mthreads 2.183 1.028 11.257 21.055 normal 8 mthreads 1.653 0.825 7.849 15.549 schedstat_parse.py -f hackbench_vanilla.log (each group has 28 tasks) case load se_eff% dom_eff% fast_rate% success_rate% process-pipe 1 group 99.991 7.692 99.999 10= 0.000 process-pipe 2 groups 99.934 4.615 99.997 10= 0.000 process-pipe 3 groups 99.597 3.198 99.987 10= 0.000 process-pipe 4 groups 98.378 2.464 99.958 10= 0.000 process-pipe 5 groups 27.474 3.653 89.811 9= 9.800 process-pipe 6 groups 20.201 4.098 82.763 9= 9.570 process-pipe 7 groups 16.423 4.156 77.398 9= 9.316 process-pipe 8 groups 13.165 3.920 72.232 9= 8.828 process-sockets 1 group 99.977 5.882 99.999 = 100.000 process-sockets 2 groups 99.927 5.505 99.996 = 100.000 process-sockets 3 groups 99.397 3.250 99.980 = 100.000 process-sockets 4 groups 79.680 4.258 98.864 = 99.998 process-sockets 5 groups 7.673 2.503 63.659 = 92.115 process-sockets 6 groups 4.642 1.584 58.946 = 88.048 process-sockets 7 groups 3.493 1.379 49.816 = 81.164 process-sockets 8 groups 3.015 1.407 40.845 = 75.500 threads-pipe 1 group 99.997 0.000 100.000 10= 0.000 threads-pipe 2 groups 99.894 2.932 99.997 10= 0.000 threads-pipe 3 groups 99.611 4.117 99.983 10= 0.000 threads-pipe 4 groups 97.703 2.624 99.937 10= 0.000 threads-pipe 5 groups 22.919 3.623 87.150 9= 9.764 threads-pipe 6 groups 18.016 4.038 80.491 9= 9.557 threads-pipe 7 groups 14.663 3.991 75.239 9= 9.247 threads-pipe 8 groups 12.242 3.808 70.651 9= 8.644 threads-sockets 1 group 99.990 6.667 99.999 = 100.000 threads-sockets 2 groups 99.940 5.114 99.997 = 100.000 threads-sockets 3 groups 99.469 4.115 99.977 = 100.000 threads-sockets 4 groups 87.528 4.038 99.400 = 100.000 threads-sockets 5 groups 6.942 2.398 59.244 = 88.337 threads-sockets 6 groups 4.359 1.954 49.448 = 87.860 threads-sockets 7 groups 2.845 1.345 41.198 = 77.102 threads-sockets 8 groups 2.871 1.404 38.512 = 74.312 schedstat_parse.py -f tbench_vanilla.log case load se_eff% dom_eff% fast_rate% success_rate% loopback 28 threads 99.976 18.369 99.995 100.000 loopback 56 threads 99.222 7.799 99.934 100.000 loopback 84 threads 19.723 6.819 70.215 100.000 loopback 112 threads 11.283 5.371 55.371 99.999 loopback 140 threads 0.000 0.000 0.000 0.000 loopback 168 threads 0.000 0.000 0.000 0.000 loopback 196 threads 0.000 0.000 0.000 0.000 loopback 224 threads 0.000 0.000 0.000 0.000 According to the test above, if the system becomes busy, the SIS Search Efficiency(se_eff%) drops significantly. Although some benchmarks would finally find an idle CPU(success_rate% =3D 100%), it is doubtful whether it is worth it to search the whole LLC domain. [Proposal] It would be ideal to have a crystal ball to answer this question: How many CPUs must a wakeup path walk down, before it can find an idle CPU? Many potential metrics could be used to predict the number. One candidate is the sum of util_avg in this LLC domain. The benefit of choosing util_avg is that it is a metric of accumulated historic activity, which seems to be smoother than instantaneous metrics (such as rq->nr_running). Besides, choosing the sum of util_avg would help predict the load of the LLC domain more precisely, because SIS_PROP uses one CPU's idle time to estimate the total LLC domain idle time. In summary, the lower the util_avg is, the more select_idle_cpu() should scan for idle CPU, and vice versa. When the sum of util_avg in this LLC domain hits 85% or above, the scan stops. The reason to choose 85% as the threshold is that this is the imbalance_pct(117) when a LLC sched group is overloaded. Introduce the quadratic function: y =3D SCHED_CAPACITY_SCALE - p * x^2 and y'=3D y / SCHED_CAPACITY_SCALE x is the ratio of sum_util compared to the CPU capacity: x =3D sum_util / (llc_weight * SCHED_CAPACITY_SCALE) y' is the ratio of CPUs to be scanned in the LLC domain, and the number of CPUs to scan is calculated by: nr_scan =3D llc_weight * y' Choosing quadratic function is because: [1] Compared to the linear function, it scans more aggressively when the sum_util is low. [2] Compared to the exponential function, it is easier to calculate. [3] It seems that there is no accurate mapping between the sum of util_avg and the number of CPUs to be scanned. Use heuristic scan for now. For a platform with 112 CPUs per LLC, the number of CPUs to scan is: sum_util% 0 5 15 25 35 45 55 65 75 85 86 ... scan_nr 112 111 108 102 93 81 65 47 25 1 0 ... For a platform with 16 CPUs per LLC, the number of CPUs to scan is: sum_util% 0 5 15 25 35 45 55 65 75 85 86 ... scan_nr 16 15 15 14 13 11 9 6 3 0 0 ... Furthermore, to minimize the overhead of calculating the metrics in select_idle_cpu(), borrow the statistics from periodic load balance. As mentioned by Abel, on a platform with 112 CPUs per LLC, the sum_util calculated by periodic load balance after 112 ms would decay to about 0.5 * 0.5 * 0.5 * 0.7 =3D 8.75%, thus bringing a delay in reflecting the latest utilization. But it is a trade-off. Checking the util_avg in newidle load balance would be more frequent, but it brings overhead - multiple CPUs write/read the per-LLC shared variable and introduces cache contention. Tim also mentioned that, it is allowed to be non-optimal in terms of scheduling for the short-term variations, but if there is a long-term trend in the load behavior, the scheduler can adjust for that. When SIS_UTIL is enabled, the select_idle_cpu() uses the nr_scan calculated by SIS_UTIL instead of the one from SIS_PROP. As Peter and Mel suggested, SIS_UTIL should be enabled by default. This patch is based on the util_avg, which is very sensitive to the CPU frequency invariance. There is an issue that, when the max frequency has been clamp, the util_avg would decay insanely fast when the CPU is idle. Commit addca285120b ("cpufreq: intel_pstate: Handle no_tur= bo in frequency invariance") could be used to mitigate this symptom, by adjust= ing the arch_max_freq_ratio when turbo is disabled. But this issue is still not thoroughly fixed, because the current code is unaware of the user-speci= fied max CPU frequency. [Test result] netperf and tbench were launched with 25% 50% 75% 100% 125% 150% 175% 200% of CPU number respectively. Hackbench and schbench were launched by 1, 2 ,4, 8 groups. Each test lasts for 100 seconds and repeats 3 times. The following is the benchmark result comparison between baseline:vanilla v5.19-rc1 and compare:patched kernel. Positive compare% indicates better performance. Each netperf test is a: netperf -4 -H 127.0.1 -t TCP/UDP_RR -c -C -l 100 netperf.throughput =3D=3D=3D=3D=3D=3D=3D case load baseline(std%) compare%( std%) TCP_RR 28 threads 1.00 ( 0.34) -0.16 ( 0.40) TCP_RR 56 threads 1.00 ( 0.19) -0.02 ( 0.20) TCP_RR 84 threads 1.00 ( 0.39) -0.47 ( 0.40) TCP_RR 112 threads 1.00 ( 0.21) -0.66 ( 0.22) TCP_RR 140 threads 1.00 ( 0.19) -0.69 ( 0.19) TCP_RR 168 threads 1.00 ( 0.18) -0.48 ( 0.18) TCP_RR 196 threads 1.00 ( 0.16) +194.70 ( 16.43) TCP_RR 224 threads 1.00 ( 0.16) +197.30 ( 7.85) UDP_RR 28 threads 1.00 ( 0.37) +0.35 ( 0.33) UDP_RR 56 threads 1.00 ( 11.18) -0.32 ( 0.21) UDP_RR 84 threads 1.00 ( 1.46) -0.98 ( 0.32) UDP_RR 112 threads 1.00 ( 28.85) -2.48 ( 19.61) UDP_RR 140 threads 1.00 ( 0.70) -0.71 ( 14.04) UDP_RR 168 threads 1.00 ( 14.33) -0.26 ( 11.16) UDP_RR 196 threads 1.00 ( 12.92) +186.92 ( 20.93) UDP_RR 224 threads 1.00 ( 11.74) +196.79 ( 18.62) Take the 224 threads as an example, the SIS search metrics changes are illustrated below: vanilla patched 4544492 +237.5% 15338634 sched_debug.cpu.sis_domain_se= arch.avg 38539 +39686.8% 15333634 sched_debug.cpu.sis_failed.avg 128300000 -87.9% 15551326 sched_debug.cpu.sis_scanned.a= vg 5842896 +162.7% 15347978 sched_debug.cpu.sis_search.avg There is -87.9% less CPU scans after patched, which indicates lower overhea= d. Besides, with this patch applied, there is -13% less rq lock contention in perf-profile.calltrace.cycles-pp._raw_spin_lock.raw_spin_rq_lock_nested .try_to_wake_up.default_wake_function.woken_wake_function. This might help explain the performance improvement - Because this patch al= lows the waking task to remain on the previous CPU, rather than grabbing other C= PUs' lock. Each hackbench test is a: hackbench -g $job --process/threads --pipe/sockets -l 1000000 -s 100 hackbench.throughput =3D=3D=3D=3D=3D=3D=3D=3D=3D case load baseline(std%) compare%( std%) process-pipe 1 group 1.00 ( 1.29) +0.57 ( 0.47) process-pipe 2 groups 1.00 ( 0.27) +0.77 ( 0.81) process-pipe 4 groups 1.00 ( 0.26) +1.17 ( 0.02) process-pipe 8 groups 1.00 ( 0.15) -4.79 ( 0.02) process-sockets 1 group 1.00 ( 0.63) -0.92 ( 0.13) process-sockets 2 groups 1.00 ( 0.03) -0.83 ( 0.14) process-sockets 4 groups 1.00 ( 0.40) +5.20 ( 0.26) process-sockets 8 groups 1.00 ( 0.04) +3.52 ( 0.03) threads-pipe 1 group 1.00 ( 1.28) +0.07 ( 0.14) threads-pipe 2 groups 1.00 ( 0.22) -0.49 ( 0.74) threads-pipe 4 groups 1.00 ( 0.05) +1.88 ( 0.13) threads-pipe 8 groups 1.00 ( 0.09) -4.90 ( 0.06) threads-sockets 1 group 1.00 ( 0.25) -0.70 ( 0.53) threads-sockets 2 groups 1.00 ( 0.10) -0.63 ( 0.26) threads-sockets 4 groups 1.00 ( 0.19) +11.92 ( 0.24) threads-sockets 8 groups 1.00 ( 0.08) +4.31 ( 0.11) Each tbench test is a: tbench -t 100 $job 127.0.0.1 tbench.throughput =3D=3D=3D=3D=3D=3D case load baseline(std%) compare%( std%) loopback 28 threads 1.00 ( 0.06) -0.14 ( 0.09) loopback 56 threads 1.00 ( 0.03) -0.04 ( 0.17) loopback 84 threads 1.00 ( 0.05) +0.36 ( 0.13) loopback 112 threads 1.00 ( 0.03) +0.51 ( 0.03) loopback 140 threads 1.00 ( 0.02) -1.67 ( 0.19) loopback 168 threads 1.00 ( 0.38) +1.27 ( 0.27) loopback 196 threads 1.00 ( 0.11) +1.34 ( 0.17) loopback 224 threads 1.00 ( 0.11) +1.67 ( 0.22) Each schbench test is a: schbench -m $job -t 28 -r 100 -s 30000 -c 30000 schbench.latency_90%_us =3D=3D=3D=3D=3D=3D=3D=3D case load baseline(std%) compare%( std%) normal 1 mthread 1.00 ( 31.22) -7.36 ( 20.25)* normal 2 mthreads 1.00 ( 2.45) -0.48 ( 1.79) normal 4 mthreads 1.00 ( 1.69) +0.45 ( 0.64) normal 8 mthreads 1.00 ( 5.47) +9.81 ( 14.28) *Consider the Standard Deviation, this -7.36% regression might not be valid. Also, a OLTP workload with a commercial RDBMS has been tested, and there is no significant change. There were concerns that unbalanced tasks among CPUs would cause problems. For example, suppose the LLC domain is composed of 8 CPUs, and 7 tasks are bound to CPU0~CPU6, while CPU7 is idle: CPU0 CPU1 CPU2 CPU3 CPU4 CPU5 CPU6 CPU7 util_avg 1024 1024 1024 1024 1024 1024 1024 0 Since the util_avg ratio is 87.5%( =3D 7/8 ), which is higher than 85%, select_idle_cpu() will not scan, thus CPU7 is undetected during scan. But according to Mel, it is unlikely the CPU7 will be idle all the time because CPU7 could pull some tasks via CPU_NEWLY_IDLE. lkp(kernel test robot) has reported a regression on stress-ng.sock on a very busy system. According to the sched_debug statistics, it might be caus= ed by SIS_UTIL terminates the scan and chooses a previous CPU earlier, and this might introduce more context switch, especially involuntary preemption, whi= ch impacts a busy stress-ng. This regression has shown that, not all benchmarks in every scenario benefit from idle CPU scan limit, and it needs further investigation. Besides, there is slight regression in hackbench's 16 groups case when the LLC domain has 16 CPUs. Prateek mentioned that we should scan aggressively in an LLC domain with 16 CPUs. Because the cost to search for an idle one among 16 CPUs is negligible. The current patch aims to propose a generic solution and only considers the util_avg. Something like the below could be applied on top of the current patch to fulfill the requirement: if (llc_weight <=3D 16) nr_scan =3D nr_scan * 32 / llc_weight; For LLC domain with 16 CPUs, the nr_scan will be expanded to 2 times large. The smaller the CPU number this LLC domain has, the larger nr_scan will be expanded. This needs further investigation. There is also ongoing work[2] from Abel to filter out the busy CPUs during wakeup, to further speed up the idle CPU scan. And it could be a following-= up optimization on top of this change. Suggested-by: Tim Chen Suggested-by: Peter Zijlstra Signed-off-by: Chen Yu Signed-off-by: Peter Zijlstra (Intel) Tested-by: Yicong Yang Tested-by: Mohini Narkhede Tested-by: K Prateek Nayak Link: https://lore.kernel.org/r/20220612163428.849378-1-yu.c.chen@intel.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- include/linux/sched/topology.h | 1 + kernel/sched/fair.c | 87 ++++++++++++++++++++++++++++++++++ kernel/sched/features.h | 3 +- 3 files changed, 90 insertions(+), 1 deletion(-) diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h index 8f0f778b7c91..63a04a65e310 100644 --- a/include/linux/sched/topology.h +++ b/include/linux/sched/topology.h @@ -74,6 +74,7 @@ struct sched_domain_shared { atomic_t ref; atomic_t nr_busy_cpus; int has_idle_cores; + int nr_idle_scan; }; =20 struct sched_domain { diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index fcbacc35d2b9..a853e4e9e3c3 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6280,6 +6280,7 @@ static int select_idle_cpu(struct task_struct *p, str= uct sched_domain *sd, bool { struct cpumask *cpus =3D this_cpu_cpumask_var_ptr(select_idle_mask); int i, cpu, idle_cpu =3D -1, nr =3D INT_MAX; + struct sched_domain_shared *sd_share; struct rq *this_rq =3D this_rq(); int this =3D smp_processor_id(); struct sched_domain *this_sd; @@ -6319,6 +6320,17 @@ static int select_idle_cpu(struct task_struct *p, st= ruct sched_domain *sd, bool time =3D cpu_clock(this); } =20 + if (sched_feat(SIS_UTIL)) { + sd_share =3D rcu_dereference(per_cpu(sd_llc_shared, target)); + if (sd_share) { + /* because !--nr is the condition to stop scan */ + nr =3D READ_ONCE(sd_share->nr_idle_scan) + 1; + /* overloaded LLC is unlikely to have idle cpu/core */ + if (nr =3D=3D 1) + return -1; + } + } + for_each_cpu_wrap(cpu, cpus, target + 1) { if (has_idle_core) { i =3D select_idle_core(p, cpu, cpus, &idle_cpu); @@ -9166,6 +9178,77 @@ find_idlest_group(struct sched_domain *sd, struct ta= sk_struct *p, int this_cpu) return idlest; } =20 +static void update_idle_cpu_scan(struct lb_env *env, + unsigned long sum_util) +{ + struct sched_domain_shared *sd_share; + int llc_weight, pct; + u64 x, y, tmp; + /* + * Update the number of CPUs to scan in LLC domain, which could + * be used as a hint in select_idle_cpu(). The update of sd_share + * could be expensive because it is within a shared cache line. + * So the write of this hint only occurs during periodic load + * balancing, rather than CPU_NEWLY_IDLE, because the latter + * can fire way more frequently than the former. + */ + if (!sched_feat(SIS_UTIL) || env->idle =3D=3D CPU_NEWLY_IDLE) + return; + + llc_weight =3D per_cpu(sd_llc_size, env->dst_cpu); + if (env->sd->span_weight !=3D llc_weight) + return; + + sd_share =3D rcu_dereference(per_cpu(sd_llc_shared, env->dst_cpu)); + if (!sd_share) + return; + + /* + * The number of CPUs to search drops as sum_util increases, when + * sum_util hits 85% or above, the scan stops. + * The reason to choose 85% as the threshold is because this is the + * imbalance_pct(117) when a LLC sched group is overloaded. + * + * let y =3D SCHED_CAPACITY_SCALE - p * x^2 [1] + * and y'=3D y / SCHED_CAPACITY_SCALE + * + * x is the ratio of sum_util compared to the CPU capacity: + * x =3D sum_util / (llc_weight * SCHED_CAPACITY_SCALE) + * y' is the ratio of CPUs to be scanned in the LLC domain, + * and the number of CPUs to scan is calculated by: + * + * nr_scan =3D llc_weight * y' [2] + * + * When x hits the threshold of overloaded, AKA, when + * x =3D 100 / pct, y drops to 0. According to [1], + * p should be SCHED_CAPACITY_SCALE * pct^2 / 10000 + * + * Scale x by SCHED_CAPACITY_SCALE: + * x' =3D sum_util / llc_weight; [3] + * + * and finally [1] becomes: + * y =3D SCHED_CAPACITY_SCALE - + * x'^2 * pct^2 / (10000 * SCHED_CAPACITY_SCALE) [4] + * + */ + /* equation [3] */ + x =3D sum_util; + do_div(x, llc_weight); + + /* equation [4] */ + pct =3D env->sd->imbalance_pct; + tmp =3D x * x * pct * pct; + do_div(tmp, 10000 * SCHED_CAPACITY_SCALE); + tmp =3D min_t(long, tmp, SCHED_CAPACITY_SCALE); + y =3D SCHED_CAPACITY_SCALE - tmp; + + /* equation [2] */ + y *=3D llc_weight; + do_div(y, SCHED_CAPACITY_SCALE); + if ((int)y !=3D sd_share->nr_idle_scan) + WRITE_ONCE(sd_share->nr_idle_scan, (int)y); +} + /** * update_sd_lb_stats - Update sched_domain's statistics for load balancin= g. * @env: The load balancing environment. @@ -9178,6 +9261,7 @@ static inline void update_sd_lb_stats(struct lb_env *= env, struct sd_lb_stats *sd struct sched_group *sg =3D env->sd->groups; struct sg_lb_stats *local =3D &sds->local_stat; struct sg_lb_stats tmp_sgs; + unsigned long sum_util =3D 0; int sg_status =3D 0; =20 do { @@ -9210,6 +9294,7 @@ static inline void update_sd_lb_stats(struct lb_env *= env, struct sd_lb_stats *sd sds->total_load +=3D sgs->group_load; sds->total_capacity +=3D sgs->group_capacity; =20 + sum_util +=3D sgs->group_util; sg =3D sg->next; } while (sg !=3D env->sd->groups); =20 @@ -9235,6 +9320,8 @@ static inline void update_sd_lb_stats(struct lb_env *= env, struct sd_lb_stats *sd WRITE_ONCE(rd->overutilized, SG_OVERUTILIZED); trace_sched_overutilized_tp(rd, SG_OVERUTILIZED); } + + update_idle_cpu_scan(env, sum_util); } =20 #define NUMA_IMBALANCE_MIN 2 diff --git a/kernel/sched/features.h b/kernel/sched/features.h index 7f8dace0964c..c4947c1b5edb 100644 --- a/kernel/sched/features.h +++ b/kernel/sched/features.h @@ -55,7 +55,8 @@ SCHED_FEAT(TTWU_QUEUE, true) /* * When doing wakeups, attempt to limit superfluous scans of the LLC domai= n. */ -SCHED_FEAT(SIS_PROP, true) +SCHED_FEAT(SIS_PROP, false) +SCHED_FEAT(SIS_UTIL, true) =20 /* * Issue a WARN when we do multiple update_rq_clock() calls --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 356ABC00140 for ; Mon, 15 Aug 2022 18:28:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242530AbiHOS2y (ORCPT ); Mon, 15 Aug 2022 14:28:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242579AbiHOS0Q (ORCPT ); Mon, 15 Aug 2022 14:26:16 -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 C34B72AE13; Mon, 15 Aug 2022 11:19: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 6CB56B81076; Mon, 15 Aug 2022 18:19:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4342C433D7; Mon, 15 Aug 2022 18:19:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587550; bh=Gw7ty+G5lbAAotKSMNZhOw0+vgFQSF/mhHY+Ujdz0gE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DZIaHxJNcjyEgl/zV2R0cPus8+lht+3uBRV//Ng2Bck3Uq7OpdpajlBa168dmJeVT JjRywi1FxmM1ax8foiJIoZdnjSnvSji+OPASRTW9oqun2/6JEZd0rRiDeOmk0tFkO4 rQyU8RMDWSC309bL/UCw6AqsXdAwBd+sqbBI7fQw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Antonio Borneo , Marc Zyngier , Sasha Levin Subject: [PATCH 5.15 118/779] genirq: Dont return error on missing optional irq_request_resources() Date: Mon, 15 Aug 2022 19:56:02 +0200 Message-Id: <20220815180342.371126246@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Antonio Borneo [ Upstream commit 95001b756467ecc9f5973eb5e74e97699d9bbdf1 ] Function irq_chip::irq_request_resources() is reported as optional in the declaration of struct irq_chip. If the parent irq_chip does not implement it, we should ignore it and return. Don't return error if the functions is missing. Signed-off-by: Antonio Borneo Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20220512160544.13561-1-antonio.borneo@foss.= st.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- kernel/irq/chip.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index a98bcfc4be7b..f3920374f71c 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c @@ -1516,7 +1516,8 @@ int irq_chip_request_resources_parent(struct irq_data= *data) if (data->chip->irq_request_resources) return data->chip->irq_request_resources(data); =20 - return -ENOSYS; + /* no error on missing optional irq_chip::irq_request_resources */ + return 0; } EXPORT_SYMBOL_GPL(irq_chip_request_resources_parent); =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71512C25B0E for ; Mon, 15 Aug 2022 18:32:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241716AbiHOScd (ORCPT ); Mon, 15 Aug 2022 14:32:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39054 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243615AbiHOSb3 (ORCPT ); Mon, 15 Aug 2022 14:31: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 51B2F32EF5; Mon, 15 Aug 2022 11:21: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 54427606A1; Mon, 15 Aug 2022 18:21:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EE5EC433C1; Mon, 15 Aug 2022 18:21:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587678; bh=wDVeU0NrJ+0WBjSj7dJSjcsNF5d0IKAhPrVBHSPgEOI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D4wzzPQIB9BfjKsknydDagAQqC83d4mg2zgNdZno9hll4YuUrV75mq42ize/nfDKr NLTaDGuTyD9aT5K8YzDL0rybgOaQd/WWABbnvXaQDf0tWkCtJivI2Acu3d8QkH/QOn IcEqfDT2RiRdJ8o8SQEYLK2tU7PrsZdQTFMvhOfU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Samuel Holland , Marc Zyngier , Sasha Levin Subject: [PATCH 5.15 119/779] irqchip/mips-gic: Only register IPI domain when SMP is enabled Date: Mon, 15 Aug 2022 19:56:03 +0200 Message-Id: <20220815180342.402607749@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Samuel Holland [ Upstream commit 8190cc572981f2f13b6ffc26c7cfa7899e5d3ccc ] The MIPS GIC irqchip driver may be selected in a uniprocessor configuration, but it unconditionally registers an IPI domain. Limit the part of the driver dealing with IPIs to only be compiled when GENERIC_IRQ_IPI is enabled, which corresponds to an SMP configuration. Reported-by: kernel test robot Signed-off-by: Samuel Holland Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20220701200056.46555-2-samuel@sholland.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/irqchip/Kconfig | 3 +- drivers/irqchip/irq-mips-gic.c | 80 +++++++++++++++++++++++----------- 2 files changed, 56 insertions(+), 27 deletions(-) diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig index aca7b595c4c7..8f9c52873338 100644 --- a/drivers/irqchip/Kconfig +++ b/drivers/irqchip/Kconfig @@ -304,7 +304,8 @@ config KEYSTONE_IRQ =20 config MIPS_GIC bool - select GENERIC_IRQ_IPI + select GENERIC_IRQ_IPI if SMP + select IRQ_DOMAIN_HIERARCHY select MIPS_CM =20 config INGENIC_IRQ diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c index 54c7092cc61d..f03f47ffea1e 100644 --- a/drivers/irqchip/irq-mips-gic.c +++ b/drivers/irqchip/irq-mips-gic.c @@ -51,13 +51,15 @@ static DEFINE_PER_CPU_READ_MOSTLY(unsigned long[GIC_MAX= _LONGS], pcpu_masks); =20 static DEFINE_SPINLOCK(gic_lock); static struct irq_domain *gic_irq_domain; -static struct irq_domain *gic_ipi_domain; static int gic_shared_intrs; static unsigned int gic_cpu_pin; static unsigned int timer_cpu_pin; static struct irq_chip gic_level_irq_controller, gic_edge_irq_controller; + +#ifdef CONFIG_GENERIC_IRQ_IPI static DECLARE_BITMAP(ipi_resrv, GIC_MAX_INTRS); static DECLARE_BITMAP(ipi_available, GIC_MAX_INTRS); +#endif /* CONFIG_GENERIC_IRQ_IPI */ =20 static struct gic_all_vpes_chip_data { u32 map; @@ -460,9 +462,11 @@ static int gic_irq_domain_map(struct irq_domain *d, un= signed int virq, u32 map; =20 if (hwirq >=3D GIC_SHARED_HWIRQ_BASE) { +#ifdef CONFIG_GENERIC_IRQ_IPI /* verify that shared irqs don't conflict with an IPI irq */ if (test_bit(GIC_HWIRQ_TO_SHARED(hwirq), ipi_resrv)) return -EBUSY; +#endif /* CONFIG_GENERIC_IRQ_IPI */ =20 err =3D irq_domain_set_hwirq_and_chip(d, virq, hwirq, &gic_level_irq_controller, @@ -551,6 +555,8 @@ static const struct irq_domain_ops gic_irq_domain_ops = =3D { .map =3D gic_irq_domain_map, }; =20 +#ifdef CONFIG_GENERIC_IRQ_IPI + static int gic_ipi_domain_xlate(struct irq_domain *d, struct device_node *= ctrlr, const u32 *intspec, unsigned int intsize, irq_hw_number_t *out_hwirq, @@ -654,6 +660,48 @@ static const struct irq_domain_ops gic_ipi_domain_ops = =3D { .match =3D gic_ipi_domain_match, }; =20 +static int gic_register_ipi_domain(struct device_node *node) +{ + struct irq_domain *gic_ipi_domain; + unsigned int v[2], num_ipis; + + gic_ipi_domain =3D irq_domain_add_hierarchy(gic_irq_domain, + IRQ_DOMAIN_FLAG_IPI_PER_CPU, + GIC_NUM_LOCAL_INTRS + gic_shared_intrs, + node, &gic_ipi_domain_ops, NULL); + if (!gic_ipi_domain) { + pr_err("Failed to add IPI domain"); + return -ENXIO; + } + + irq_domain_update_bus_token(gic_ipi_domain, DOMAIN_BUS_IPI); + + if (node && + !of_property_read_u32_array(node, "mti,reserved-ipi-vectors", v, 2)) { + bitmap_set(ipi_resrv, v[0], v[1]); + } else { + /* + * Reserve 2 interrupts per possible CPU/VP for use as IPIs, + * meeting the requirements of arch/mips SMP. + */ + num_ipis =3D 2 * num_possible_cpus(); + bitmap_set(ipi_resrv, gic_shared_intrs - num_ipis, num_ipis); + } + + bitmap_copy(ipi_available, ipi_resrv, GIC_MAX_INTRS); + + return 0; +} + +#else /* !CONFIG_GENERIC_IRQ_IPI */ + +static inline int gic_register_ipi_domain(struct device_node *node) +{ + return 0; +} + +#endif /* !CONFIG_GENERIC_IRQ_IPI */ + static int gic_cpu_startup(unsigned int cpu) { /* Enable or disable EIC */ @@ -672,11 +720,12 @@ static int gic_cpu_startup(unsigned int cpu) static int __init gic_of_init(struct device_node *node, struct device_node *parent) { - unsigned int cpu_vec, i, gicconfig, v[2], num_ipis; + unsigned int cpu_vec, i, gicconfig; unsigned long reserved; phys_addr_t gic_base; struct resource res; size_t gic_len; + int ret; =20 /* Find the first available CPU vector. */ i =3D 0; @@ -765,30 +814,9 @@ static int __init gic_of_init(struct device_node *node, return -ENXIO; } =20 - gic_ipi_domain =3D irq_domain_add_hierarchy(gic_irq_domain, - IRQ_DOMAIN_FLAG_IPI_PER_CPU, - GIC_NUM_LOCAL_INTRS + gic_shared_intrs, - node, &gic_ipi_domain_ops, NULL); - if (!gic_ipi_domain) { - pr_err("Failed to add IPI domain"); - return -ENXIO; - } - - irq_domain_update_bus_token(gic_ipi_domain, DOMAIN_BUS_IPI); - - if (node && - !of_property_read_u32_array(node, "mti,reserved-ipi-vectors", v, 2)) { - bitmap_set(ipi_resrv, v[0], v[1]); - } else { - /* - * Reserve 2 interrupts per possible CPU/VP for use as IPIs, - * meeting the requirements of arch/mips SMP. - */ - num_ipis =3D 2 * num_possible_cpus(); - bitmap_set(ipi_resrv, gic_shared_intrs - num_ipis, num_ipis); - } - - bitmap_copy(ipi_available, ipi_resrv, GIC_MAX_INTRS); + ret =3D gic_register_ipi_domain(node); + if (ret) + return ret; =20 board_bind_eic_interrupt =3D &gic_bind_eic_interrupt; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A18FC00140 for ; Mon, 15 Aug 2022 18:28:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242110AbiHOS2Q (ORCPT ); Mon, 15 Aug 2022 14:28:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243063AbiHOS0l (ORCPT ); Mon, 15 Aug 2022 14:26: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 121433122A; Mon, 15 Aug 2022 11:19: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 D76CCB81071; Mon, 15 Aug 2022 18:19:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A2CAC433C1; Mon, 15 Aug 2022 18:19:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587576; bh=D8GDK5X2petZO9FBuzzcie9LQ7EsKqqF49b3DRKH8HM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TJeWaYLAIAQ6SX5SgUbbZ7/HSTsPiYPziY/vXr9/oWOIzkC4whnRj2zlK48od8GRd vIaIVwIS21CboXMXcQntRyQNJubLKLyr3ajQ0XJdOLcJut0CwHelmBYrLTZdM6BNtn KxlyK/03A61pOtHceaZrFIJO0a8lpFO7j9hv5wcw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Samuel Holland , Marc Zyngier , Sasha Levin Subject: [PATCH 5.15 120/779] genirq: GENERIC_IRQ_IPI depends on SMP Date: Mon, 15 Aug 2022 19:56:04 +0200 Message-Id: <20220815180342.442547927@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Samuel Holland [ Upstream commit 0f5209fee90b4544c58b4278d944425292789967 ] The generic IPI code depends on the IRQ affinity mask being allocated and initialized. This will not be the case if SMP is disabled. Fix up the remaining driver that selected GENERIC_IRQ_IPI in a non-SMP config. Reported-by: kernel test robot Signed-off-by: Samuel Holland Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20220701200056.46555-3-samuel@sholland.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/irqchip/Kconfig | 2 +- kernel/irq/Kconfig | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig index 8f9c52873338..ae1b9f59abc5 100644 --- a/drivers/irqchip/Kconfig +++ b/drivers/irqchip/Kconfig @@ -171,7 +171,7 @@ config MADERA_IRQ config IRQ_MIPS_CPU bool select GENERIC_IRQ_CHIP - select GENERIC_IRQ_IPI if SYS_SUPPORTS_MULTITHREADING + select GENERIC_IRQ_IPI if SMP && SYS_SUPPORTS_MULTITHREADING select IRQ_DOMAIN select GENERIC_IRQ_EFFECTIVE_AFF_MASK =20 diff --git a/kernel/irq/Kconfig b/kernel/irq/Kconfig index fbc54c2a7f23..00d58588ea95 100644 --- a/kernel/irq/Kconfig +++ b/kernel/irq/Kconfig @@ -82,6 +82,7 @@ config IRQ_FASTEOI_HIERARCHY_HANDLERS # Generic IRQ IPI support config GENERIC_IRQ_IPI bool + depends on SMP select IRQ_DOMAIN_HIERARCHY =20 # Generic MSI interrupt support --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 277E4C25B0E for ; Mon, 15 Aug 2022 18:29:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231657AbiHOS3l (ORCPT ); Mon, 15 Aug 2022 14:29:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242346AbiHOS2g (ORCPT ); Mon, 15 Aug 2022 14:28:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97F8431345; Mon, 15 Aug 2022 11:20: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 1AC1CB81072; Mon, 15 Aug 2022 18:20:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F2ABC433C1; Mon, 15 Aug 2022 18:20:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587611; bh=tlYfuCCunAyT5uz5g0QWhNMt3m8wdPVPvDnImF6KnSk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SltsdwsejnaVtzJKf55Dk30/+nVC7RoMsVI3vhJ+X6c+wfU8OwuWW5FXNYnef5zs9 JnFhPdcK1WCCpYF1OIlIwUiJquBbZAe1mixagD9ueDVk4bOUH/3K3qDZmt0S80tXKF uVMZC30lelfGpjtdH75z822KrfGxFphpRfYT0YDc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Keeping , "Peter Zijlstra (Intel)" , "Steven Rostedt (Google)" , Sasha Levin Subject: [PATCH 5.15 121/779] sched/core: Always flush pending blk_plug Date: Mon, 15 Aug 2022 19:56:05 +0200 Message-Id: <20220815180342.483177069@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: John Keeping [ Upstream commit 401e4963bf45c800e3e9ea0d3a0289d738005fd4 ] With CONFIG_PREEMPT_RT, it is possible to hit a deadlock between two normal priority tasks (SCHED_OTHER, nice level zero): INFO: task kworker/u8:0:8 blocked for more than 491 seconds. Not tainted 5.15.49-rt46 #1 "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. task:kworker/u8:0 state:D stack: 0 pid: 8 ppid: 2 flags:0x000= 00000 Workqueue: writeback wb_workfn (flush-7:0) [] (__schedule) from [] (schedule+0xdc/0x134) [] (schedule) from [] (rt_mutex_slowlock_block.constpr= op.0+0xb8/0x174) [] (rt_mutex_slowlock_block.constprop.0) from [] +(rt_mutex_slowlock.constprop.0+0xac/0x174) [] (rt_mutex_slowlock.constprop.0) from [] (fat_write_= inode+0x34/0x54) [] (fat_write_inode) from [] (__writeback_single_inode= +0x354/0x3ec) [] (__writeback_single_inode) from [] (writeback_sb_in= odes+0x250/0x45c) [] (writeback_sb_inodes) from [] (__writeback_inodes_w= b+0x7c/0xb8) [] (__writeback_inodes_wb) from [] (wb_writeback+0x2c8= /0x2e4) [] (wb_writeback) from [] (wb_workfn+0x1a4/0x3e4) [] (wb_workfn) from [] (process_one_work+0x1fc/0x32c) [] (process_one_work) from [] (worker_thread+0x22c/0x2= d8) [] (worker_thread) from [] (kthread+0x16c/0x178) [] (kthread) from [] (ret_from_fork+0x14/0x38) Exception stack(0xc10e3fb0 to 0xc10e3ff8) 3fa0: 00000000 00000000 00000000 00000= 000 3fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000= 000 3fe0: 00000000 00000000 00000000 00000000 00000013 00000000 INFO: task tar:2083 blocked for more than 491 seconds. Not tainted 5.15.49-rt46 #1 "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. task:tar state:D stack: 0 pid: 2083 ppid: 2082 flags:0x000= 00000 [] (__schedule) from [] (schedule+0xdc/0x134) [] (schedule) from [] (io_schedule+0x14/0x24) [] (io_schedule) from [] (bit_wait_io+0xc/0x30) [] (bit_wait_io) from [] (__wait_on_bit_lock+0x54/0xa8) [] (__wait_on_bit_lock) from [] (out_of_line_wait_on_b= it_lock+0x84/0xb0) [] (out_of_line_wait_on_bit_lock) from [] (fat_mirror_= bhs+0xa0/0x144) [] (fat_mirror_bhs) from [] (fat_alloc_clusters+0x138/= 0x2a4) [] (fat_alloc_clusters) from [] (fat_alloc_new_dir+0x3= 4/0x250) [] (fat_alloc_new_dir) from [] (vfat_mkdir+0x58/0x148) [] (vfat_mkdir) from [] (vfs_mkdir+0x68/0x98) [] (vfs_mkdir) from [] (do_mkdirat+0xb0/0xec) [] (do_mkdirat) from [] (ret_fast_syscall+0x0/0x1c) Exception stack(0xc2e1bfa8 to 0xc2e1bff0) bfa0: 01ee42f0 01ee4208 01ee42f0 000041ed 00000000 00004= 000 bfc0: 01ee42f0 01ee4208 00000000 00000027 01ee4302 00000004 000dcb00 01ee4= 190 bfe0: 000dc368 bed11924 0006d4b0 b6ebddfc Here the kworker is waiting on msdos_sb_info::s_lock which is held by tar which is in turn waiting for a buffer which is locked waiting to be flushed, but this operation is plugged in the kworker. The lock is a normal struct mutex, so tsk_is_pi_blocked() will always return false on !RT and thus the behaviour changes for RT. It seems that the intent here is to skip blk_flush_plug() in the case where a non-preemptible lock (such as a spinlock) has been converted to a rtmutex on RT, which is the case covered by the SM_RTLOCK_WAIT schedule flag. But sched_submit_work() is only called from schedule() which is never called in this scenario, so the check can simply be deleted. Looking at the history of the -rt patchset, in fact this change was present from v5.9.1-rt20 until being dropped in v5.13-rt1 as it was part of a larger patch [1] most of which was replaced by commit b4bfa3fcfe3b ("sched/core: Rework the __schedule() preempt argument"). As described in [1]: The schedule process must distinguish between blocking on a regular sleeping lock (rwsem and mutex) and a RT-only sleeping lock (spinlock and rwlock): - rwsem and mutex must flush block requests (blk_schedule_flush_plug()) even if blocked on a lock. This can not deadlock because this also happens for non-RT. There should be a warning if the scheduling point is within a RCU read section. - spinlock and rwlock must not flush block requests. This will deadlock if the callback attempts to acquire a lock which is already acquired. Similarly to being preempted, there should be no warning if the scheduling point is within a RCU read section. and with the tsk_is_pi_blocked() in the scheduler path, we hit the first issue. [1] https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git/t= ree/patches/0022-locking-rtmutex-Use-custom-scheduling-function-for-s.patch= ?h=3Dlinux-5.10.y-rt-patches Signed-off-by: John Keeping Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Steven Rostedt (Google) Link: https://lkml.kernel.org/r/20220708162702.1758865-1-john@metanate.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- include/linux/sched/rt.h | 8 -------- kernel/sched/core.c | 8 ++++++-- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/include/linux/sched/rt.h b/include/linux/sched/rt.h index e5af028c08b4..994c25640e15 100644 --- a/include/linux/sched/rt.h +++ b/include/linux/sched/rt.h @@ -39,20 +39,12 @@ static inline struct task_struct *rt_mutex_get_top_task= (struct task_struct *p) } extern void rt_mutex_setprio(struct task_struct *p, struct task_struct *pi= _task); extern void rt_mutex_adjust_pi(struct task_struct *p); -static inline bool tsk_is_pi_blocked(struct task_struct *tsk) -{ - return tsk->pi_blocked_on !=3D NULL; -} #else static inline struct task_struct *rt_mutex_get_top_task(struct task_struct= *task) { return NULL; } # define rt_mutex_adjust_pi(p) do { } while (0) -static inline bool tsk_is_pi_blocked(struct task_struct *tsk) -{ - return false; -} #endif =20 extern void normalize_rt_tasks(void); diff --git a/kernel/sched/core.c b/kernel/sched/core.c index b89ca5c83143..012c037da58a 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -6379,8 +6379,12 @@ static inline void sched_submit_work(struct task_str= uct *tsk) preempt_enable_no_resched(); } =20 - if (tsk_is_pi_blocked(tsk)) - return; + /* + * spinlock and rwlock must not flush block requests. This will + * deadlock if the callback attempts to acquire a lock which is + * already acquired. + */ + SCHED_WARN_ON(current->__state & TASK_RTLOCK_WAIT); =20 /* * If we are going to sleep and we have plugged IO queued, --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80F84C00140 for ; Mon, 15 Aug 2022 18:31:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242966AbiHOSbp (ORCPT ); Mon, 15 Aug 2022 14:31:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243063AbiHOSai (ORCPT ); Mon, 15 Aug 2022 14:30: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 412072AE0C; Mon, 15 Aug 2022 11:20: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 2405560693; Mon, 15 Aug 2022 18:20:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F3B0C433C1; Mon, 15 Aug 2022 18:20:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587645; bh=UkgRBGRGiND0e5vjUxLk3kZH+BsEyc38Jo903maH+RY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1cN178jiQzkJJXwStn8VggaggE0IOSQE1nnVtRtoAVZ7+kUiYGHJJ4lWTcdCxDl5x R6sEFMucHGgsHw8i28l7W25Y60B2Q0jC3/P56ue32BfJEZB3F4EdJUzVaal6T3FwBw M5QBhgMKp7iyOSOnQL+zSiqE45fEEfR13abspHz4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hacash Robot , William Dean , Marc Zyngier , Sasha Levin Subject: [PATCH 5.15 122/779] irqchip/mips-gic: Check the return value of ioremap() in gic_of_init() Date: Mon, 15 Aug 2022 19:56:06 +0200 Message-Id: <20220815180342.526837221@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: William Dean [ Upstream commit 71349cc85e5930dce78ed87084dee098eba24b59 ] The function ioremap() in gic_of_init() can fail, so its return value should be checked. Reported-by: Hacash Robot Signed-off-by: William Dean Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20220723100128.2964304-1-williamsukatube@16= 3.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/irqchip/irq-mips-gic.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/irqchip/irq-mips-gic.c b/drivers/irqchip/irq-mips-gic.c index f03f47ffea1e..d815285f1efe 100644 --- a/drivers/irqchip/irq-mips-gic.c +++ b/drivers/irqchip/irq-mips-gic.c @@ -767,6 +767,10 @@ static int __init gic_of_init(struct device_node *node, } =20 mips_gic_base =3D ioremap(gic_base, gic_len); + if (!mips_gic_base) { + pr_err("Failed to ioremap gic_base\n"); + return -ENOMEM; + } =20 gicconfig =3D read_gic_config(); gic_shared_intrs =3D gicconfig & GIC_CONFIG_NUMINTERRUPTS; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 59AD5C25B08 for ; Mon, 15 Aug 2022 18:32:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243183AbiHOScC (ORCPT ); Mon, 15 Aug 2022 14:32:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243431AbiHOSbF (ORCPT ); Mon, 15 Aug 2022 14:31: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 0DFA932B94; Mon, 15 Aug 2022 11:21:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BB1D4B81071; Mon, 15 Aug 2022 18:21:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28F9EC433C1; Mon, 15 Aug 2022 18:20:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587660; bh=fIyATlflZQYS902OJM0Ronnev54d2XGnLkNgc18G4cI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nv/1slKaPFNxEe5pe+6ykg1uEEKY47E0fJAn/iXMsjLbqKGRJyTkDzT04aT5sxkEF ARRc8taT6XTFNu+JiRG3sRKVtPTpHCMLxOtJmnBiLn3/6rJ0Ey2exoobwIirtej3WZ hqxeer+dV4uZRbpoLd5MCAcdnFrnX4K+5bJvDylY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bruno Goncalves , Juri Lelli , Thomas Gleixner , Daniel Bristot de Oliveira , Valentin Schneider , Sasha Levin Subject: [PATCH 5.15 123/779] wait: Fix __wait_event_hrtimeout for RT/DL tasks Date: Mon, 15 Aug 2022 19:56:07 +0200 Message-Id: <20220815180342.557600521@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Juri Lelli [ Upstream commit cceeeb6a6d02e7b9a74ddd27a3225013b34174aa ] Changes to hrtimer mode (potentially made by __hrtimer_init_sleeper on PREEMPT_RT) are not visible to hrtimer_start_range_ns, thus not accounted for by hrtimer_start_expires call paths. In particular, __wait_event_hrtimeout suffers from this problem as we have, for example: fs/aio.c::read_events wait_event_interruptible_hrtimeout __wait_event_hrtimeout hrtimer_init_sleeper_on_stack <- this might "mode |=3D HRTIMER_MODE_H= ARD" on RT if task runs at RT/DL priority hrtimer_start_range_ns WARN_ON_ONCE(!(mode & HRTIMER_MODE_HARD) ^ !timer->is_hard) fires since the latter doesn't see the change of mode done by init_sleeper Fix it by making __wait_event_hrtimeout call hrtimer_sleeper_start_expires, which is aware of the special RT/DL case, instead of hrtimer_start_range_ns. Reported-by: Bruno Goncalves Signed-off-by: Juri Lelli Signed-off-by: Thomas Gleixner Reviewed-by: Daniel Bristot de Oliveira Reviewed-by: Valentin Schneider Link: https://lore.kernel.org/r/20220627095051.42470-1-juri.lelli@redhat.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- include/linux/wait.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/include/linux/wait.h b/include/linux/wait.h index d22cf2985b8f..21044562aab7 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h @@ -544,10 +544,11 @@ do { \ \ hrtimer_init_sleeper_on_stack(&__t, CLOCK_MONOTONIC, \ HRTIMER_MODE_REL); \ - if ((timeout) !=3D KTIME_MAX) \ - hrtimer_start_range_ns(&__t.timer, timeout, \ - current->timer_slack_ns, \ - HRTIMER_MODE_REL); \ + if ((timeout) !=3D KTIME_MAX) { \ + hrtimer_set_expires_range_ns(&__t.timer, timeout, \ + current->timer_slack_ns); \ + hrtimer_sleeper_start_expires(&__t, HRTIMER_MODE_REL); \ + } \ \ __ret =3D ___wait_event(wq_head, condition, state, 0, 0, \ if (!__t.task) { \ --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CFB7C00140 for ; Mon, 15 Aug 2022 18:32:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243111AbiHOScn (ORCPT ); Mon, 15 Aug 2022 14:32:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242777AbiHOSbj (ORCPT ); Mon, 15 Aug 2022 14:31:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 154CC3340C; Mon, 15 Aug 2022 11:21: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 F310360EC3; Mon, 15 Aug 2022 18:21:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 057DCC433C1; Mon, 15 Aug 2022 18:21:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587663; bh=iErS5oo2Oc5DNTVd9UDyKVUFsYmh4vo+LGU2SJ245lM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e8r8btG9yun4q5J65aGqVb6PrpHIYnp5rwVvl3R0KtOVNKcm1X0mvazrNENQzB8rL 8SAj4NzJz0Y0WlIgjYkVAqYG1Dw5yXLmqjAPQuiZE0i8+eTILS4S+ZyWG6YPi9D0Bg FgxtLZ0CMG89UojafNupyUREHi/ZCfCwajx80U14= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Stein , Shawn Guo , Sasha Levin Subject: [PATCH 5.15 124/779] ARM: dts: imx6ul: add missing properties for sram Date: Mon, 15 Aug 2022 19:56:08 +0200 Message-Id: <20220815180342.598609620@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Stein [ Upstream commit 5655699cf5cff9f4c4ee703792156bdd05d1addf ] All 3 properties are required by sram.yaml. Fixes the dtbs_check warning: sram@900000: '#address-cells' is a required property sram@900000: '#size-cells' is a required property sram@900000: 'ranges' is a required property Signed-off-by: Alexander Stein Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm/boot/dts/imx6ul.dtsi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/boot/dts/imx6ul.dtsi b/arch/arm/boot/dts/imx6ul.dtsi index afeec01f6522..1d435a46fc5c 100644 --- a/arch/arm/boot/dts/imx6ul.dtsi +++ b/arch/arm/boot/dts/imx6ul.dtsi @@ -149,6 +149,9 @@ soc { ocram: sram@900000 { compatible =3D "mmio-sram"; reg =3D <0x00900000 0x20000>; + ranges =3D <0 0x00900000 0x20000>; + #address-cells =3D <1>; + #size-cells =3D <1>; }; =20 intc: interrupt-controller@a01000 { --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90A40C00140 for ; Mon, 15 Aug 2022 18:32:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243538AbiHOScv (ORCPT ); Mon, 15 Aug 2022 14:32:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39524 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243087AbiHOSby (ORCPT ); Mon, 15 Aug 2022 14:31:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 359D533415; Mon, 15 Aug 2022 11:21: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 0F6DF60ED3; Mon, 15 Aug 2022 18:21:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F38FCC433D6; Mon, 15 Aug 2022 18:21:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587666; bh=i2jhH5/szEKqI2jW51v3Ub9wFARlUPzzK8ZZbQhSzOU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2gj7j/7UosS3fzNvpQPnrcD4K9PJc1UQ/sd4umlVRdpieSjOPw1jANODU3xBSVOXH A0y/SaMH8f0RWTsf0c1G/mBKGlmLSKwpQ/d2uXTcg/pPWy+N14kdgb3QnFAFxl78v8 xbkhiMG9cNosRuvmp+T85V0bwRvHH65VGLdSoVLs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Stein , Shawn Guo , Sasha Levin Subject: [PATCH 5.15 125/779] ARM: dts: imx6ul: change operating-points to uint32-matrix Date: Mon, 15 Aug 2022 19:56:09 +0200 Message-Id: <20220815180342.629882893@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Stein [ Upstream commit edb67843983bbdf61b4c8c3c50618003d38bb4ae ] operating-points is a uint32-matrix as per opp-v1.yaml. Change it accordingly. While at it, change fsl,soc-operating-points as well, although there is no bindings file (yet). But they should have the same format. Fixes the dt_binding_check warning: cpu@0: operating-points:0: [696000, 1275000, 528000, 1175000, 396000, 1025000, 198000, 950000] is too long cpu@0: operating-points:0: Additional items are not allowed (528000, 1175000, 396000, 1025000, 198000, 950000 were unexpected) Signed-off-by: Alexander Stein Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm/boot/dts/imx6ul.dtsi | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/arch/arm/boot/dts/imx6ul.dtsi b/arch/arm/boot/dts/imx6ul.dtsi index 1d435a46fc5c..2fcbd9d91521 100644 --- a/arch/arm/boot/dts/imx6ul.dtsi +++ b/arch/arm/boot/dts/imx6ul.dtsi @@ -64,20 +64,18 @@ cpu0: cpu@0 { clock-frequency =3D <696000000>; clock-latency =3D <61036>; /* two CLK32 periods */ #cooling-cells =3D <2>; - operating-points =3D < + operating-points =3D /* kHz uV */ - 696000 1275000 - 528000 1175000 - 396000 1025000 - 198000 950000 - >; - fsl,soc-operating-points =3D < + <696000 1275000>, + <528000 1175000>, + <396000 1025000>, + <198000 950000>; + fsl,soc-operating-points =3D /* KHz uV */ - 696000 1275000 - 528000 1175000 - 396000 1175000 - 198000 1175000 - >; + <696000 1275000>, + <528000 1175000>, + <396000 1175000>, + <198000 1175000>; clocks =3D <&clks IMX6UL_CLK_ARM>, <&clks IMX6UL_CLK_PLL2_BUS>, <&clks IMX6UL_CLK_PLL2_PFD2>, --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8653C00140 for ; Mon, 15 Aug 2022 18:32:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243274AbiHOScO (ORCPT ); Mon, 15 Aug 2022 14:32:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243545AbiHOSbU (ORCPT ); Mon, 15 Aug 2022 14:31: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 66E0A32EC2; Mon, 15 Aug 2022 11:21: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 0CDFE60F18; Mon, 15 Aug 2022 18:21:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 17830C433B5; Mon, 15 Aug 2022 18:21:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587669; bh=H9BOwCrBvhJ2D/pmVP5DNxKN0ES8c7NcKffve4+d2QI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dZcv8hqfgDmaewGrfF2tGih9nVzgPttP15iILozV9yiP6IzFfpasR5x60naWz5Qy0 KUp+nFgKVxGkLKlmvtvCGMpz3Sz8mlZDwNvVtaQ/BsChUeHmUPb9FpK25MnDKzed79 o34dyJprl3ZFRw/m8xaDJa0PYdnciEIcn866H+wU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Stein , Shawn Guo , Sasha Levin Subject: [PATCH 5.15 126/779] ARM: dts: imx6ul: fix keypad compatible Date: Mon, 15 Aug 2022 19:56:10 +0200 Message-Id: <20220815180342.675018411@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Stein [ Upstream commit 7d15e0c9a515494af2e3199741cdac7002928a0e ] According to binding, the compatible shall only contain imx6ul and imx21 compatibles. Fixes the dt_binding_check warning: keypad@20b8000: compatible: 'oneOf' conditional failed, one must be fixed: ['fsl,imx6ul-kpp', 'fsl,imx6q-kpp', 'fsl,imx21-kpp'] is too long Additional items are not allowed ('fsl,imx6q-kpp', 'fsl,imx21-kpp' were unexpected) Additional items are not allowed ('fsl,imx21-kpp' was unexpected) 'fsl,imx21-kpp' was expected Signed-off-by: Alexander Stein Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm/boot/dts/imx6ul.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/imx6ul.dtsi b/arch/arm/boot/dts/imx6ul.dtsi index 2fcbd9d91521..df8b4ad62418 100644 --- a/arch/arm/boot/dts/imx6ul.dtsi +++ b/arch/arm/boot/dts/imx6ul.dtsi @@ -544,7 +544,7 @@ fec2: ethernet@20b4000 { }; =20 kpp: keypad@20b8000 { - compatible =3D "fsl,imx6ul-kpp", "fsl,imx6q-kpp", "fsl,imx21-kpp"; + compatible =3D "fsl,imx6ul-kpp", "fsl,imx21-kpp"; reg =3D <0x020b8000 0x4000>; interrupts =3D ; clocks =3D <&clks IMX6UL_CLK_KPP>; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5AAD0C25B0E for ; Mon, 15 Aug 2022 18:33:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243561AbiHOSdG (ORCPT ); Mon, 15 Aug 2022 14:33:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243394AbiHOScZ (ORCPT ); Mon, 15 Aug 2022 14:32:25 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4372B33A25; Mon, 15 Aug 2022 11:21: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 sin.source.kernel.org (Postfix) with ESMTPS id 56B7BCE125A; Mon, 15 Aug 2022 18:21:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09FF4C433D6; Mon, 15 Aug 2022 18:21:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587672; bh=EixTL5yY3x6DpFjd9mtu7FvtvO6e++FT6rEJn0V1IyI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XjK5sAvKkWmjJ+xSE4qQJcD96rE+XfjGfruWOcJuHEzP3KkKJQmdRSUX8bk5NEjwV af/xFN3ol+qsJG7LzTUCG386oGbPmNxskUiB9eDVm9Lerf6PmRACwwBg6CrPqE3vwD MCtCz3fsqJFtA2T//q2ZDlQ1AEZIaPXNG0kJp4rM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Stein , Shawn Guo , Sasha Levin Subject: [PATCH 5.15 127/779] ARM: dts: imx6ul: fix csi node compatible Date: Mon, 15 Aug 2022 19:56:11 +0200 Message-Id: <20220815180342.715745402@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Stein [ Upstream commit e0aca931a2c7c29c88ebf37f9c3cd045e083483d ] "fsl,imx6ul-csi" was never listed as compatible to "fsl,imx7-csi", neither in yaml bindings, nor previous txt binding. Remove the imx7 part. Fixes the dt schema check warning: csi@21c4000: compatible: 'oneOf' conditional failed, one must be fixed: ['fsl,imx6ul-csi', 'fsl,imx7-csi'] is too long Additional items are not allowed ('fsl,imx7-csi' was unexpected) 'fsl,imx8mm-csi' was expected Signed-off-by: Alexander Stein Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm/boot/dts/imx6ul.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/imx6ul.dtsi b/arch/arm/boot/dts/imx6ul.dtsi index df8b4ad62418..367657a9a99f 100644 --- a/arch/arm/boot/dts/imx6ul.dtsi +++ b/arch/arm/boot/dts/imx6ul.dtsi @@ -999,7 +999,7 @@ cpu_speed_grade: speed-grade@10 { }; =20 csi: csi@21c4000 { - compatible =3D "fsl,imx6ul-csi", "fsl,imx7-csi"; + compatible =3D "fsl,imx6ul-csi"; reg =3D <0x021c4000 0x4000>; interrupts =3D ; clocks =3D <&clks IMX6UL_CLK_CSI>; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FB54C25B0E for ; Mon, 15 Aug 2022 18:32:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232171AbiHOSc2 (ORCPT ); Mon, 15 Aug 2022 14:32:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243607AbiHOSb2 (ORCPT ); Mon, 15 Aug 2022 14:31:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0965932EE5; Mon, 15 Aug 2022 11:21: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 05C82B81071; Mon, 15 Aug 2022 18:21:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34819C433C1; Mon, 15 Aug 2022 18:21:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587675; bh=kOSR+0U1mUJKjfVnIM3iHP1kjHk8W/lX2Xo52qIYRy8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ezCuUfnGSdUZPkxDyOTN02I4HRHIUyJRYmn8PXnvSNX6jq8GYszY/lGdWnCpSFy8Z N3gJ7041Q7cApUVVNp6WGjbYXrGPXVP4o2JIqlaWPDd0+jpKs697nkkm1MoyHex+ll gVs0PrJHxGNvjdtrPEZqg+iwbOC3IojyTJ94hN7E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Stein , Shawn Guo , Sasha Levin Subject: [PATCH 5.15 128/779] ARM: dts: imx6ul: fix lcdif node compatible Date: Mon, 15 Aug 2022 19:56:12 +0200 Message-Id: <20220815180342.764311906@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Stein [ Upstream commit 1a884d17ca324531634cce82e9f64c0302bdf7de ] In yaml binding "fsl,imx6ul-lcdif" is listed as compatible to imx6sx-lcdif, but not imx28-lcdif. Change the list accordingly. Fixes the dt_binding_check warning: lcdif@21c8000: compatible: 'oneOf' conditional failed, one must be fixed: ['fsl,imx6ul-lcdif', 'fsl,imx28-lcdif'] is too long Additional items are not allowed ('fsl,imx28-lcdif' was unexpected) 'fsl,imx6ul-lcdif' is not one of ['fsl,imx23-lcdif', 'fsl,imx28-lcdif', 'fsl,imx6sx-lcdif'] 'fsl,imx6sx-lcdif' was expected Signed-off-by: Alexander Stein Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm/boot/dts/imx6ul.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/imx6ul.dtsi b/arch/arm/boot/dts/imx6ul.dtsi index 367657a9a99f..bc6548058d8c 100644 --- a/arch/arm/boot/dts/imx6ul.dtsi +++ b/arch/arm/boot/dts/imx6ul.dtsi @@ -1008,7 +1008,7 @@ csi: csi@21c4000 { }; =20 lcdif: lcdif@21c8000 { - compatible =3D "fsl,imx6ul-lcdif", "fsl,imx28-lcdif"; + compatible =3D "fsl,imx6ul-lcdif", "fsl,imx6sx-lcdif"; reg =3D <0x021c8000 0x4000>; interrupts =3D ; clocks =3D <&clks IMX6UL_CLK_LCDIF_PIX>, --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 344A6C00140 for ; Mon, 15 Aug 2022 18:30:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242216AbiHOSaS (ORCPT ); Mon, 15 Aug 2022 14:30:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242010AbiHOS3i (ORCPT ); Mon, 15 Aug 2022 14:29:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7289155B9; Mon, 15 Aug 2022 11:20: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 7DBC06069E; Mon, 15 Aug 2022 18:19:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72A6FC433D6; Mon, 15 Aug 2022 18:19:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587579; bh=HopU/MPTRkH9+3zqqnsjOGCkMfvViXYpGAFABHbxMj4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JYjyXr0uvvb8GjSO/b+ehJSDO4TvLfFrxU3IZuKHIHA1i3DEpd/6Y9T2AcyAp/vJb vpkPyBoJb+WcuUVHjVRDeCtcawTuFgbb4Kttd5aq24w1Kby3fpX1kBKUzBT3XMxKbG OIbQP9lNQDebUzVMALrtP1+PVrvPLJktY1L9YOVY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Stein , Shawn Guo , Sasha Levin Subject: [PATCH 5.15 129/779] ARM: dts: imx6ul: fix qspi node compatible Date: Mon, 15 Aug 2022 19:56:13 +0200 Message-Id: <20220815180342.794570561@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Stein [ Upstream commit 0c6cf86e1ab433b2d421880fdd9c6e954f404948 ] imx6ul is not compatible to imx6sx, both have different erratas. Fixes the dt_binding_check warning: spi@21e0000: compatible: 'oneOf' conditional failed, one must be fixed: ['fsl,imx6ul-qspi', 'fsl,imx6sx-qspi'] is too long Additional items are not allowed ('fsl,imx6sx-qspi' was unexpected) 'fsl,imx6ul-qspi' is not one of ['fsl,ls1043a-qspi'] 'fsl,imx6ul-qspi' is not one of ['fsl,imx8mq-qspi'] 'fsl,ls1021a-qspi' was expected 'fsl,imx7d-qspi' was expected Signed-off-by: Alexander Stein Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm/boot/dts/imx6ul.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/imx6ul.dtsi b/arch/arm/boot/dts/imx6ul.dtsi index bc6548058d8c..eca8bf89ab88 100644 --- a/arch/arm/boot/dts/imx6ul.dtsi +++ b/arch/arm/boot/dts/imx6ul.dtsi @@ -1029,7 +1029,7 @@ pxp: pxp@21cc000 { qspi: spi@21e0000 { #address-cells =3D <1>; #size-cells =3D <0>; - compatible =3D "fsl,imx6ul-qspi", "fsl,imx6sx-qspi"; + compatible =3D "fsl,imx6ul-qspi"; reg =3D <0x021e0000 0x4000>, <0x60000000 0x10000000>; reg-names =3D "QuadSPI", "QuadSPI-memory"; interrupts =3D ; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0CDAC00140 for ; Mon, 15 Aug 2022 18:29:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242552AbiHOS25 (ORCPT ); Mon, 15 Aug 2022 14:28:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243226AbiHOS0z (ORCPT ); Mon, 15 Aug 2022 14:26: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 A001F31357; Mon, 15 Aug 2022 11:19: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 9A5D760693; Mon, 15 Aug 2022 18:19:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A062C433D6; Mon, 15 Aug 2022 18:19:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587584; bh=K/KUtU0j7Kj8RpFry1u6nMfAVmLLdvjWCKsi+FXo7YE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KudgVx3iZsWyfIj0avVQKrz8AzWKCUcxxkYjjbyz2M72i40A3w3L0pUsTXXCuK06r 638opknncM/qhfJzVVgb/tctwST2YZ2x/P2VbGTZLvKsSoSJK+ntKzpwvKLqaXAW2Z WzFkIzZ/5Fi6sMXsIeoo35HzILZ3Q/krUtYAXnfU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christian Lamparter , Florian Fainelli , Sasha Levin Subject: [PATCH 5.15 130/779] ARM: dts: BCM5301X: Add DT for Meraki MR26 Date: Mon, 15 Aug 2022 19:56:14 +0200 Message-Id: <20220815180342.833125072@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christian Lamparter [ Upstream commit 935327a73553001f8d81375c76985d05f604507f ] Meraki MR26 is an EOL wireless access point featuring a PoE ethernet port and two dual-band 3x3 MIMO 802.11n radios and 1x1 dual-band WIFI dedicated to scanning. Thank you Amir for the unit and PSU. Hardware info: SOC : Broadcom BCM53015A1KFEBG (dual-core Cortex-A9 CPU at 800 MHz) RAM : SK Hynix Inc. H5TQ1G63EFR, 1 GBit DDR3 SDRAM =3D 128 MiB NAND : Spansion S34ML01G100TF100, 1 GBit SLC NAND Flash =3D 128 MiB ETH : 1 GBit Ethernet Port - PoE (TPS23754 PoE Interface) WIFI0 : Broadcom BCM43431KMLG, BCM43431 802.11 abgn (3x3:3) WIFI1 : Broadcom BCM43431KMLG, BCM43431 802.11 abgn (3x3:3) WIFI2 : Broadcom BCM43428 "Air Marshal" 802.11 abgn (1x1:1) BUTTON: One reset key behind a small hole next to the Ethernet Port LEDS : One amber (fault), one white (indicator) LED, separate RGB-LED MISC : Atmel AT24C64 8KiB EEPROM i2c : Ti INA219 26V, 12-bit, i2c output current/voltage/power monitor SERIAL: WARNING: The serial port needs a TTL/RS-232 3V3 level converter! The Serial setting is 115200-8-N-1. The board has a populated right angle 1x4 0.1" pinheader. The pinout is: VCC (next to J3, has the pin 1 indicator), RX, TX, GND. Odd stuff: - uboot does not support lzma compression, but gzip'd uImage/DTB work. - uboot claims to support FIT, but fails to pass the DTB to the kernel. Appending the dtb after the kernel image works. - RGB-controller is supported through an external userspace program. - The ubi partition contains a "board-config" volume. It stores the MAC Address (0x66 in binary) and Serial No. (0x7c alpha-numerical). - SoC's temperature sensor always reports that it is on fire. This causes the system to immediately shutdown! Looking at reported "418 degree Celsius" suggests that this sensor is not working. WIFI: b43 is able to initialize all three WIFIs @ 802.11bg. | b43-phy0: Broadcom 43431 WLAN found (core revision 29) | bcma-pci-bridge 0000:01:00.0: bus1: Switched to core: 0x812 | b43-phy0: Found PHY: Analog 9, Type 7 (HT), Revision 1 | b43-phy0: Found Radio: Manuf 0x17F, ID 0x2059, Revision 0, Version 1 | b43-phy0 warning: 5 GHz band is unsupported on this PHY | b43-phy1: Broadcom 43431 WLAN found (core revision 29) | bcma-pci-bridge 0001:01:00.0: bus2: Switched to core: 0x812 | b43-phy1: Found PHY: Analog 9, Type 7 (HT), Revision 1 | b43-phy1: Found Radio: Manuf 0x17F, ID 0x2059, Revision 0, Version 1 | b43-phy1 warning: 5 GHz band is unsupported on this PHY | b43-phy2: Broadcom 43228 WLAN found (core revision 30) | bcma-pci-bridge 0002:01:00.0: bus3: Switched to core: 0x812 | b43-phy2: Found PHY: Analog 9, Type 4 (N), Revision 16 | b43-phy2: Found Radio: Manuf 0x17F, ID 0x2057, Revision 9, Version 1 | Broadcom 43xx driver loaded [ Features: NL ] Signed-off-by: Christian Lamparter Signed-off-by: Florian Fainelli Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm/boot/dts/Makefile | 1 + arch/arm/boot/dts/bcm53015-meraki-mr26.dts | 166 +++++++++++++++++++++ 2 files changed, 167 insertions(+) create mode 100644 arch/arm/boot/dts/bcm53015-meraki-mr26.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 27ca1ca6e827..7a72fc636a7a 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -127,6 +127,7 @@ dtb-$(CONFIG_ARCH_BCM_5301X) +=3D \ bcm47094-luxul-xwr-3150-v1.dtb \ bcm47094-netgear-r8500.dtb \ bcm47094-phicomm-k3.dtb \ + bcm53015-meraki-mr26.dtb \ bcm53016-meraki-mr32.dtb \ bcm94708.dtb \ bcm94709.dtb \ diff --git a/arch/arm/boot/dts/bcm53015-meraki-mr26.dts b/arch/arm/boot/dts= /bcm53015-meraki-mr26.dts new file mode 100644 index 000000000000..14f58033efeb --- /dev/null +++ b/arch/arm/boot/dts/bcm53015-meraki-mr26.dts @@ -0,0 +1,166 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +/* + * Broadcom BCM470X / BCM5301X ARM platform code. + * DTS for Meraki MR26 / Codename: Venom + * + * Copyright (C) 2022 Christian Lamparter + */ + +/dts-v1/; + +#include "bcm4708.dtsi" +#include "bcm5301x-nand-cs0-bch8.dtsi" +#include + +/ { + compatible =3D "meraki,mr26", "brcm,bcm53015", "brcm,bcm4708"; + model =3D "Meraki MR26"; + + memory@0 { + reg =3D <0x00000000 0x08000000>; + device_type =3D "memory"; + }; + + leds { + compatible =3D "gpio-leds"; + + led-0 { + function =3D LED_FUNCTION_FAULT; + color =3D ; + gpios =3D <&chipcommon 13 GPIO_ACTIVE_HIGH>; + panic-indicator; + }; + led-1 { + function =3D LED_FUNCTION_INDICATOR; + color =3D ; + gpios =3D <&chipcommon 12 GPIO_ACTIVE_HIGH>; + }; + }; + + keys { + compatible =3D "gpio-keys"; + #address-cells =3D <1>; + #size-cells =3D <0>; + + key-restart { + label =3D "Reset"; + linux,code =3D ; + gpios =3D <&chipcommon 11 GPIO_ACTIVE_LOW>; + }; + }; +}; + +&uart0 { + clock-frequency =3D <50000000>; + /delete-property/ clocks; +}; + +&uart1 { + status =3D "disabled"; +}; + +&gmac0 { + status =3D "okay"; +}; + +&gmac1 { + status =3D "disabled"; +}; +&gmac2 { + status =3D "disabled"; +}; +&gmac3 { + status =3D "disabled"; +}; + +&nandcs { + nand-ecc-algo =3D "hw"; + + partitions { + compatible =3D "fixed-partitions"; + #address-cells =3D <0x1>; + #size-cells =3D <0x1>; + + partition@0 { + label =3D "u-boot"; + reg =3D <0x0 0x200000>; + read-only; + }; + + partition@200000 { + label =3D "u-boot-env"; + reg =3D <0x200000 0x200000>; + /* empty */ + }; + + partition@400000 { + label =3D "u-boot-backup"; + reg =3D <0x400000 0x200000>; + /* empty */ + }; + + partition@600000 { + label =3D "u-boot-env-backup"; + reg =3D <0x600000 0x200000>; + /* empty */ + }; + + partition@800000 { + label =3D "ubi"; + reg =3D <0x800000 0x7780000>; + }; + }; +}; + +&srab { + status =3D "okay"; + + ports { + port@0 { + reg =3D <0>; + label =3D "poe"; + }; + + port@5 { + reg =3D <5>; + label =3D "cpu"; + ethernet =3D <&gmac0>; + + fixed-link { + speed =3D <1000>; + duplex-full; + }; + }; + }; +}; + +&i2c0 { + status =3D "okay"; + + pinctrl-names =3D "default"; + pinctrl-0 =3D <&pinmux_i2c>; + + clock-frequency =3D <100000>; + + ina219@40 { + compatible =3D "ti,ina219"; /* PoE power */ + reg =3D <0x40>; + shunt-resistor =3D <60000>; /* =3D 60 mOhms */ + }; + + eeprom@56 { + compatible =3D "atmel,24c64"; + reg =3D <0x56>; + pagesize =3D <32>; + read-only; + #address-cells =3D <1>; + #size-cells =3D <1>; + + /* it's empty */ + }; +}; + +&thermal { + status =3D "disabled"; + /* does not work, reads 418 degree Celsius */ +}; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 519E9C25B0E for ; Mon, 15 Aug 2022 18:27:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240523AbiHOS1Q (ORCPT ); Mon, 15 Aug 2022 14:27:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243199AbiHOS0w (ORCPT ); Mon, 15 Aug 2022 14:26:52 -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 E6C2C31219; Mon, 15 Aug 2022 11:19: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 5229FB81071; Mon, 15 Aug 2022 18:19:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B37EC433C1; Mon, 15 Aug 2022 18:19:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587587; bh=WLBCrM/2MNW4QA9FhDNcKjSDCznDM6dNFAbB2HXEapw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rsBAsY8sQQlSXG+GEPlwiJWr/iYYCIb8sgE5PwbR+B1K00A3XG3w1dM4sEAK8N8PM jqkZ/Cxj0aIEeAJJZ+BX52CHhwYIh/AEj3QBoi/dgJYzOIl0NHJpUEAfRW0+WUXIM+ IZm8a2Qh7lsdneLRc+EafmXu35ZSmqgorwegZnJI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Walleij , Sasha Levin Subject: [PATCH 5.15 131/779] ARM: dts: ux500: Fix Codina accelerometer mounting matrix Date: Mon, 15 Aug 2022 19:56:15 +0200 Message-Id: <20220815180342.880530678@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Linus Walleij [ Upstream commit 0b2152e428ab91533a02888ff24e52e788dc4637 ] This was fixed wrong so fix it again. Now verified by using iio-sensor-proxy monitor-sensor test program. Link: https://lore.kernel.org/r/20220611204249.472250-1-linus.walleij@linar= o.org Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm/boot/dts/ste-ux500-samsung-codina.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/ste-ux500-samsung-codina.dts b/arch/arm/boot= /dts/ste-ux500-samsung-codina.dts index 952606e607ed..ce62ba877da1 100644 --- a/arch/arm/boot/dts/ste-ux500-samsung-codina.dts +++ b/arch/arm/boot/dts/ste-ux500-samsung-codina.dts @@ -544,8 +544,8 @@ lisd3dh@19 { reg =3D <0x19>; vdd-supply =3D <&ab8500_ldo_aux1_reg>; // 3V vddio-supply =3D <&ab8500_ldo_aux2_reg>; // 1.8V - mount-matrix =3D "0", "-1", "0", - "1", "0", "0", + mount-matrix =3D "0", "1", "0", + "-1", "0", "0", "0", "0", "1"; }; }; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A91E1C00140 for ; Mon, 15 Aug 2022 18:29:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241724AbiHOS3O (ORCPT ); Mon, 15 Aug 2022 14:29:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243315AbiHOS1D (ORCPT ); Mon, 15 Aug 2022 14:27: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 C96EF3137F; Mon, 15 Aug 2022 11:19: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 A4CB260ED3; Mon, 15 Aug 2022 18:19:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 932B1C433B5; Mon, 15 Aug 2022 18:19:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587590; bh=FhVTNG+2NCgm7ZoRqLg5i5RITzfyGFyyrNjWQjlN2ug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VFYaK9clyBIIN/3lW/hVWjRujgVefdtzxQ7rRDDA15nVve7fC9oHevS//6AWRWpL8 9jKVVTB4AFP6dq1jf5NSvMcTRVXWxSo4/HSndrzJKQG8DYNTo5LxiH6ZxgD0/FntOV Z54s0ce6Lv4+Dl5dTjXa4O5jvlEudEOZmmhAZAts= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Walleij , Sasha Levin Subject: [PATCH 5.15 132/779] ARM: dts: ux500: Fix Gavini accelerometer mounting matrix Date: Mon, 15 Aug 2022 19:56:16 +0200 Message-Id: <20220815180342.914492856@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Linus Walleij [ Upstream commit e24c75f02a81d6ddac0072cbd7a03e799c19d558 ] This was fixed wrong so fix it. Now verified by using iio-sensor-proxy monitor-sensor test program. Link: https://lore.kernel.org/r/20220611205138.491513-1-linus.walleij@linar= o.org Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm/boot/dts/ste-ux500-samsung-gavini.dts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/boot/dts/ste-ux500-samsung-gavini.dts b/arch/arm/boot= /dts/ste-ux500-samsung-gavini.dts index fabc390ccb0c..6c9e812ef03f 100644 --- a/arch/arm/boot/dts/ste-ux500-samsung-gavini.dts +++ b/arch/arm/boot/dts/ste-ux500-samsung-gavini.dts @@ -502,8 +502,8 @@ i2c-gate { accelerometer@18 { compatible =3D "bosch,bma222e"; reg =3D <0x18>; - mount-matrix =3D "0", "1", "0", - "-1", "0", "0", + mount-matrix =3D "0", "-1", "0", + "1", "0", "0", "0", "0", "1"; vddio-supply =3D <&ab8500_ldo_aux2_reg>; // 1.8V vdd-supply =3D <&ab8500_ldo_aux1_reg>; // 3V --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFA91C00140 for ; Mon, 15 Aug 2022 18:29:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242717AbiHOS3Y (ORCPT ); Mon, 15 Aug 2022 14:29:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241375AbiHOS1S (ORCPT ); Mon, 15 Aug 2022 14:27: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 8584832046; Mon, 15 Aug 2022 11:20: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 60A58B81076; Mon, 15 Aug 2022 18:19:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE90EC433D6; Mon, 15 Aug 2022 18:19:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587593; bh=Shks8rDUt6fwvZCiVNN+z/KX40yACmnhgAaxaywLQ9Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jBswlEHJsq0eFf67LZO0LC2+9OK0a25/G+9Rtxv8QjyI0YCnkuIE8khGhnCrFh5iS sKcBQbVjvs0pTXTwgPfKkK3l9zmuzhBm9v2HCJCDOSAfuurYcQTVcmQrrsS0N8MTFJ xWRnGqkH2V5Tuo1U80Ora+YUuZhTUqOUEcFi44Qw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Guo Mengqi , Mark Brown , Sasha Levin Subject: [PATCH 5.15 133/779] spi: synquacer: Add missing clk_disable_unprepare() Date: Mon, 15 Aug 2022 19:56:17 +0200 Message-Id: <20220815180342.963400297@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Guo Mengqi [ Upstream commit 917e43de2a56d9b82576f1cc94748261f1988458 ] Add missing clk_disable_unprepare() in synquacer_spi_resume(). Reported-by: Hulk Robot Signed-off-by: Guo Mengqi Link: https://lore.kernel.org/r/20220624005614.49434-1-guomengqi3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/spi/spi-synquacer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/spi/spi-synquacer.c b/drivers/spi/spi-synquacer.c index ea706d9629cb..47cbe73137c2 100644 --- a/drivers/spi/spi-synquacer.c +++ b/drivers/spi/spi-synquacer.c @@ -783,6 +783,7 @@ static int __maybe_unused synquacer_spi_resume(struct d= evice *dev) =20 ret =3D synquacer_spi_enable(master); if (ret) { + clk_disable_unprepare(sspi->clk); dev_err(dev, "failed to enable spi (%d)\n", ret); return ret; } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 250E5C3F6B0 for ; Mon, 15 Aug 2022 18:44:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240804AbiHOSoR (ORCPT ); Mon, 15 Aug 2022 14:44:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243826AbiHOSl1 (ORCPT ); Mon, 15 Aug 2022 14:41:27 -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 265F02ED5B; Mon, 15 Aug 2022 11:25: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 55CABB8107A; Mon, 15 Aug 2022 18:19:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C044BC433D6; Mon, 15 Aug 2022 18:19:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587596; bh=uY13mo9qtASTnrLurEscpXAMDs4UVUh1xoWThPdMtxw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gwZLWYBxruN8ur6qACvYnc5dH0JrLZDC4WggTXVTKEb8Ia0oHtjCMnu7m9Tb4yhvz Vevw3duh7IPuOsGPdHEyQh69tvYqnIa0Mn0v+6ARhB/fnzbdZ+s3GVy6T9o45neERU kAnSE5O5xiMReI2RiHje94X4E41oQsIef04k0nb4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Tony Lindgren , Sasha Levin Subject: [PATCH 5.15 134/779] ARM: OMAP2+: display: Fix refcount leak bug Date: Mon, 15 Aug 2022 19:56:18 +0200 Message-Id: <20220815180343.008593274@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 50b87a32a79bca6e275918a711fb8cc55e16d739 ] In omapdss_init_fbdev(), of_find_node_by_name() will return a node pointer with refcount incremented. We should use of_node_put() when it is not used anymore. Signed-off-by: Liang He Message-Id: <20220617145803.4050918-1-windhl@126.com> Signed-off-by: Tony Lindgren Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm/mach-omap2/display.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c index 21413a9b7b6c..eb09a25e3b45 100644 --- a/arch/arm/mach-omap2/display.c +++ b/arch/arm/mach-omap2/display.c @@ -211,6 +211,7 @@ static int __init omapdss_init_fbdev(void) node =3D of_find_node_by_name(NULL, "omap4_padconf_global"); if (node) omap4_dsi_mux_syscon =3D syscon_node_to_regmap(node); + of_node_put(node); =20 return 0; } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 358C5C00140 for ; Mon, 15 Aug 2022 18:29:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242741AbiHOS33 (ORCPT ); Mon, 15 Aug 2022 14:29:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241863AbiHOS1z (ORCPT ); Mon, 15 Aug 2022 14:27: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 31F7232063; Mon, 15 Aug 2022 11:20: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 BEA8B60F25; Mon, 15 Aug 2022 18:19:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0307C433D6; Mon, 15 Aug 2022 18:19:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587599; bh=3RnyWp/lAIMu5h7J9loyAZyYyPtqH0Qubt7OGV3anYQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Az1AY4i7JeAkJ3k90IteFKfsmcDpI6BcIBopSRifPIGoa1pgeijH8HOFdQzcB6q+q RMHGu6f2PTi8mUddR0VYCHyWBC4UXYvllN+45w87NPzb6h757XqnAHkVEJZr+7EGnV QrMfQjglg2bZZfG2OlxyiiQQENaOKHys3SZrOwqY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Tony Lindgren , Sasha Levin Subject: [PATCH 5.15 135/779] ARM: OMAP2+: pdata-quirks: Fix refcount leak bug Date: Mon, 15 Aug 2022 19:56:19 +0200 Message-Id: <20220815180343.060665985@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 5cdbab96bab314c6f2f5e4e8b8a019181328bf5f ] In pdata_quirks_init_clocks(), the loop contains of_find_node_by_name() but without corresponding of_node_put(). Signed-off-by: Liang He Message-Id: <20220618020603.4055792-1-windhl@126.com> Signed-off-by: Tony Lindgren Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm/mach-omap2/pdata-quirks.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata= -quirks.c index 765809b214e7..bf50acd6b8a3 100644 --- a/arch/arm/mach-omap2/pdata-quirks.c +++ b/arch/arm/mach-omap2/pdata-quirks.c @@ -587,6 +587,8 @@ pdata_quirks_init_clocks(const struct of_device_id *oma= p_dt_match_table) =20 of_platform_populate(np, omap_dt_match_table, omap_auxdata_lookup, NULL); + + of_node_put(np); } } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AE974C00140 for ; Mon, 15 Aug 2022 18:29:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242677AbiHOS3S (ORCPT ); Mon, 15 Aug 2022 14:29:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230048AbiHOS1M (ORCPT ); Mon, 15 Aug 2022 14:27:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB09E31DEE; Mon, 15 Aug 2022 11:20:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AF4DCB81071; Mon, 15 Aug 2022 18:20:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBBD3C433D6; Mon, 15 Aug 2022 18:20:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587602; bh=ejPkYE+QF/MzjN6IdgvCaZYHYtVR1hmg8AO+nCLXFmA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cUkIgfKDonV5g9Z0j6kBcG2g7U8rjKlcl+vgJImReQSNtphtJUaOkgCoC3Br43pNX H4Fi6zgcKB5HgrcQPpb5FQzEQroOO7jGF3LtgTX+/yG4qubTF8Beryp3Jm8P4amhhx Cn66kKb/tPfO5EQ46JYCHQumyRPVrc28XILlveAA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.15 136/779] ACPI: EC: Remove duplicate ThinkPad X1 Carbon 6th entry from DMI quirks Date: Mon, 15 Aug 2022 19:56:20 +0200 Message-Id: <20220815180343.109754084@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 0dd6db359e5f206cbf1dd1fd40dd211588cd2725 ] Somehow the "ThinkPad X1 Carbon 6th" entry ended up twice in the struct dmi_system_id acpi_ec_no_wakeup[] array. Remove one of the entries. Signed-off-by: Hans de Goede Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/acpi/ec.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 9b859ff976e8..d41fa0f3a1ac 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -2167,13 +2167,6 @@ static const struct dmi_system_id acpi_ec_no_wakeup[= ] =3D { DMI_MATCH(DMI_PRODUCT_FAMILY, "Thinkpad X1 Carbon 6th"), }, }, - { - .ident =3D "ThinkPad X1 Carbon 6th", - .matches =3D { - DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), - DMI_MATCH(DMI_PRODUCT_FAMILY, "ThinkPad X1 Carbon 6th"), - }, - }, { .ident =3D "ThinkPad X1 Yoga 3rd", .matches =3D { --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82FB3C00140 for ; Mon, 15 Aug 2022 18:29:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241850AbiHOS3V (ORCPT ); Mon, 15 Aug 2022 14:29:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241302AbiHOS1S (ORCPT ); Mon, 15 Aug 2022 14:27: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 1510F2BB0D; Mon, 15 Aug 2022 11:20:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AA64960693; Mon, 15 Aug 2022 18:20:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B88CAC433C1; Mon, 15 Aug 2022 18:20:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587605; bh=JxwoENAkh+D8ymBdXXqqpkMgjDStBHqU1llUYXf+xV0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2H+wF6uSLMfhX2Fj7BAqY7fvnEjzQhuNy2Qq6qoNGADXh9kHfnA7ByWZ5g5IzXNDh HxogbaFqlQabRxubBR3Z40iIRsL9bdiUst5yqz1TNNSlUKXCeXIHxvy8fI5JYaQe8U z1QrpOUFo1Le2c8INu/HAeD8HBj/G9zc7bKCCBIk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Daniel Drake , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.15 137/779] ACPI: EC: Drop the EC_FLAGS_IGNORE_DSDT_GPE quirk Date: Mon, 15 Aug 2022 19:56:21 +0200 Message-Id: <20220815180343.151863632@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 f7090e0ef360d674f08a22fab90e4e209fb1f658 ] It seems that these quirks are no longer necessary since commit 69b957c26b32 ("ACPI: EC: Fix possible issues related to EC initialization order"), which has fixed this in a generic manner. There are 3 commits adding DMI entries with this quirk (adding multiple DMI entries per commit). 2/3 commits are from before the generic fix. Which leaves commit 6306f0431914 ("ACPI: EC: Make more Asus laptops use ECDT _GPE"), which was committed way after the generic fix. But this was just due to slow upstreaming of it. This commit stems from Endless from 15 Aug 2017 (committed upstream 20 May 2021): https://github.com/endlessm/linux/pull/288 The current code should work fine without this: 1. The EC_FLAGS_IGNORE_DSDT_GPE flag is only checked in ec_parse_device(), like this: if (boot_ec && boot_ec_is_ecdt && EC_FLAGS_IGNORE_DSDT_GPE) { ec->gpe =3D boot_ec->gpe; } else { /* parse GPE */ } 2. ec_parse_device() is only called from acpi_ec_add() and acpi_ec_dsdt_probe() 3. acpi_ec_dsdt_probe() starts with: if (boot_ec) return; so it only calls ec_parse_device() when boot_ec =3D=3D NULL, meaning th= at the quirk never triggers for this call. So only the call in acpi_ec_add() matters. 4. acpi_ec_add() does the following after the ec_parse_device() call: if (boot_ec && ec->command_addr =3D=3D boot_ec->command_addr && ec->data_addr =3D=3D boot_ec->data_addr && !EC_FLAGS_TRUST_DSDT_GPE) { /* * Trust PNP0C09 namespace location rather than * ECDT ID. But trust ECDT GPE rather than _GPE * because of ASUS quirks, so do not change * boot_ec->gpe to ec->gpe. */ boot_ec->handle =3D ec->handle; acpi_handle_debug(ec->handle, "duplicated.\n"); acpi_ec_free(ec); ec =3D boot_ec; } The quirk only matters if boot_ec !=3D NULL and EC_FLAGS_TRUST_DSDT_GPE is never set at the same time as EC_FLAGS_IGNORE_DSDT_GPE. That means that if the addresses match we always enter this if block and then only the ec->handle part of the data stored in ec by ec_parse_device() is used and the rest is thrown away, after which ec is made to point to boot_ec, at which point ec->gpe =3D=3D boot_ec->gpe, so the same result as with the quirk set, independent of the value of the quirk. Also note the comment in this block which indicates that the gpe result from ec_parse_device() is deliberately not taken to deal with buggy Asus laptops and all DMI quirks setting EC_FLAGS_IGNORE_DSDT_GPE are for Asus laptops. Based on the above I believe that unless on some quirked laptops the ECDT and DSDT EC addresses do not match we can drop the quirk. I've checked dmesg output to ensure the ECDT and DSDT EC addresses match for quirked models using https://linux-hardware.org hw-probe reports. I've been able to confirm that the addresses match for the following models this way: GL702VMK, X505BA, X505BP, X550VXK, X580VD. Whereas for the following models I could find any dmesg output: FX502VD, FX502VE, X542BA, X542BP. Note the models without dmesg all were submitted in patches with a batch of models and other models from the same batch checkout ok. This, combined with that all the code adding the quirks was written before the generic fix makes me believe that it is safe to remove this quirk now. Signed-off-by: Hans de Goede Reviewed-by: Daniel Drake Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/acpi/ec.c | 75 ++++++----------------------------------------- 1 file changed, 9 insertions(+), 66 deletions(-) diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index d41fa0f3a1ac..4e583a8cb562 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -183,7 +183,6 @@ static struct workqueue_struct *ec_wq; static struct workqueue_struct *ec_query_wq; =20 static int EC_FLAGS_CORRECT_ECDT; /* Needs ECDT port address correction */ -static int EC_FLAGS_IGNORE_DSDT_GPE; /* Needs ECDT GPE as correction setti= ng */ static int EC_FLAGS_TRUST_DSDT_GPE; /* Needs DSDT GPE as correction settin= g */ static int EC_FLAGS_CLEAR_ON_RESUME; /* Needs acpi_ec_clear() on boot/resu= me */ =20 @@ -1392,24 +1391,16 @@ ec_parse_device(acpi_handle handle, u32 Level, void= *context, void **retval) if (ec->data_addr =3D=3D 0 || ec->command_addr =3D=3D 0) return AE_OK; =20 - if (boot_ec && boot_ec_is_ecdt && EC_FLAGS_IGNORE_DSDT_GPE) { - /* - * Always inherit the GPE number setting from the ECDT - * EC. - */ - ec->gpe =3D boot_ec->gpe; - } else { - /* Get GPE bit assignment (EC events). */ - /* TODO: Add support for _GPE returning a package */ - status =3D acpi_evaluate_integer(handle, "_GPE", NULL, &tmp); - if (ACPI_SUCCESS(status)) - ec->gpe =3D tmp; + /* Get GPE bit assignment (EC events). */ + /* TODO: Add support for _GPE returning a package */ + status =3D acpi_evaluate_integer(handle, "_GPE", NULL, &tmp); + if (ACPI_SUCCESS(status)) + ec->gpe =3D tmp; + /* + * Errors are non-fatal, allowing for ACPI Reduced Hardware + * platforms which use GpioInt instead of GPE. + */ =20 - /* - * Errors are non-fatal, allowing for ACPI Reduced Hardware - * platforms which use GpioInt instead of GPE. - */ - } /* Use the global lock for all EC transactions? */ tmp =3D 0; acpi_evaluate_integer(handle, "_GLK", NULL, &tmp); @@ -1847,60 +1838,12 @@ static int ec_honor_dsdt_gpe(const struct dmi_syste= m_id *id) return 0; } =20 -/* - * Some DSDTs contain wrong GPE setting. - * Asus FX502VD/VE, GL702VMK, X550VXK, X580VD - * https://bugzilla.kernel.org/show_bug.cgi?id=3D195651 - */ -static int ec_honor_ecdt_gpe(const struct dmi_system_id *id) -{ - pr_debug("Detected system needing ignore DSDT GPE setting.\n"); - EC_FLAGS_IGNORE_DSDT_GPE =3D 1; - return 0; -} - static const struct dmi_system_id ec_dmi_table[] __initconst =3D { { ec_correct_ecdt, "MSI MS-171F", { DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star"), DMI_MATCH(DMI_PRODUCT_NAME, "MS-171F"),}, NULL}, { - ec_honor_ecdt_gpe, "ASUS FX502VD", { - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_MATCH(DMI_PRODUCT_NAME, "FX502VD"),}, NULL}, - { - ec_honor_ecdt_gpe, "ASUS FX502VE", { - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_MATCH(DMI_PRODUCT_NAME, "FX502VE"),}, NULL}, - { - ec_honor_ecdt_gpe, "ASUS GL702VMK", { - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_MATCH(DMI_PRODUCT_NAME, "GL702VMK"),}, NULL}, - { - ec_honor_ecdt_gpe, "ASUSTeK COMPUTER INC. X505BA", { - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_MATCH(DMI_PRODUCT_NAME, "X505BA"),}, NULL}, - { - ec_honor_ecdt_gpe, "ASUSTeK COMPUTER INC. X505BP", { - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_MATCH(DMI_PRODUCT_NAME, "X505BP"),}, NULL}, - { - ec_honor_ecdt_gpe, "ASUSTeK COMPUTER INC. X542BA", { - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_MATCH(DMI_PRODUCT_NAME, "X542BA"),}, NULL}, - { - ec_honor_ecdt_gpe, "ASUSTeK COMPUTER INC. X542BP", { - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_MATCH(DMI_PRODUCT_NAME, "X542BP"),}, NULL}, - { - ec_honor_ecdt_gpe, "ASUS X550VXK", { - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_MATCH(DMI_PRODUCT_NAME, "X550VXK"),}, NULL}, - { - ec_honor_ecdt_gpe, "ASUS X580VD", { - DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), - DMI_MATCH(DMI_PRODUCT_NAME, "X580VD"),}, NULL}, - { /* https://bugzilla.kernel.org/show_bug.cgi?id=3D209989 */ ec_honor_dsdt_gpe, "HP Pavilion Gaming Laptop 15-cx0xxx", { DMI_MATCH(DMI_SYS_VENDOR, "HP"), --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B82C5C00140 for ; Mon, 15 Aug 2022 18:31:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243626AbiHOSbc (ORCPT ); Mon, 15 Aug 2022 14:31:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242447AbiHOSa3 (ORCPT ); Mon, 15 Aug 2022 14:30: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 E65DD32076; Mon, 15 Aug 2022 11:20: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 B522460EBB; Mon, 15 Aug 2022 18:20:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 924E6C433D6; Mon, 15 Aug 2022 18:20:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587608; bh=K5ZHDwywZf6sEzoMUCgypmRbTxPVUltpevV5pX0h7J4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t2FIJkFjsddiKY5U+cBMrhoWp4zXic/841t7MHu0jfOG8s3+rrp189tz/5uO66i3C nmT6xuBEn+VPt5aknYGu/whZWpRtK+TP+OD/MbLJ1KZo4Sega/1bYtoYurbNYKigbn H7M4tQn3uNJANUjyDVq9bMhjaJedqLZFZA88Wkk0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manyi Li , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.15 138/779] ACPI: PM: save NVS memory for Lenovo G40-45 Date: Mon, 15 Aug 2022 19:56:22 +0200 Message-Id: <20220815180343.201002882@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Manyi Li [ Upstream commit 4b7ef7b05afcde44142225c184bf43a0cd9e2178 ] [821d6f0359b0614792ab8e2fb93b503e25a65079] is to make machines produced from 2012 to now not saving NVS region to accelerate S3. But, Lenovo G40-45, a platform released in 2015, still needs NVS memory saving during S3. A quirk is introduced for this platform. Signed-off-by: Manyi Li Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/acpi/sleep.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 07515139141e..d7194047d256 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -361,6 +361,14 @@ static const struct dmi_system_id acpisleep_dmi_table[= ] __initconst =3D { DMI_MATCH(DMI_PRODUCT_NAME, "80E3"), }, }, + { + .callback =3D init_nvs_save_s3, + .ident =3D "Lenovo G40-45", + .matches =3D { + DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), + DMI_MATCH(DMI_PRODUCT_NAME, "80E1"), + }, + }, /* * ThinkPad X1 Tablet(2016) cannot do suspend-to-idle using * the Low Power S0 Idle firmware interface (see --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA15FC00140 for ; Mon, 15 Aug 2022 18:29:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242522AbiHOS3p (ORCPT ); Mon, 15 Aug 2022 14:29:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242438AbiHOS2m (ORCPT ); Mon, 15 Aug 2022 14:28: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 1CBCFB9E; Mon, 15 Aug 2022 11:20: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 BCF1660EF0; Mon, 15 Aug 2022 18:20:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FB46C433D7; Mon, 15 Aug 2022 18:20:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587615; bh=h/3vNwF2fZo2vYAizALpNh0m0PgJAAUekHj5HiG8gUI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K0fCkzWN+Z6VPjSjvCp3sMiwOxA9O2teIDZitw8MQ1bn+SXoN1aBlGZBWkWptDcxz NQXBu/tHisYCn7sjW2PL0QEvQY4aB71L/h1CyOvnbrufaOZrVzkGhxDdMOF+TUx32Y z95Dq7vbmH3yXnQFv4qo8qtvAIauXdnOINwL3sj4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, huhai , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.15 139/779] ACPI: LPSS: Fix missing check in register_device_clock() Date: Mon, 15 Aug 2022 19:56:23 +0200 Message-Id: <20220815180343.249574416@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: huhai [ Upstream commit b4f1f61ed5928b1128e60e38d0dffa16966f06dc ] register_device_clock() misses a check for platform_device_register_simple(= ). Add a check to fix it. Signed-off-by: huhai Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/acpi/acpi_lpss.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c index 30b1f511c2af..f609f9d62efd 100644 --- a/drivers/acpi/acpi_lpss.c +++ b/drivers/acpi/acpi_lpss.c @@ -403,6 +403,9 @@ static int register_device_clock(struct acpi_device *ad= ev, if (!lpss_clk_dev) lpt_register_clock_device(); =20 + if (IS_ERR(lpss_clk_dev)) + return PTR_ERR(lpss_clk_dev); + clk_data =3D platform_get_drvdata(lpss_clk_dev); if (!clk_data) return -ENODEV; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D993C00140 for ; Mon, 15 Aug 2022 18:31:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243021AbiHOSbr (ORCPT ); Mon, 15 Aug 2022 14:31:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243074AbiHOSaj (ORCPT ); Mon, 15 Aug 2022 14:30: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 75C532C135; Mon, 15 Aug 2022 11:20: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 7FAEB60ED3; Mon, 15 Aug 2022 18:20:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AC98C433C1; Mon, 15 Aug 2022 18:20:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587617; bh=N2/qNlfn1NrRpb3l/ZqIDoo9ANS0WmXcev3dBXNe8Vk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qq3HotghUgYPURxWXmxak9B/mNeNSLcb/rXqz+HwjJ0ME1PfTd8NCX47g5diGXSiF XSDCcF2eM+7Znwqr0iqjks3WCGZIxwnQW1jzAUQQ9z2PTg+KldoUaCa4LDwhvWFPJ+ lxwpSRv7qKJX9rG4hYG6rldFeKd/9IyYRYe0a3Ts= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manivannan Sadhasivam , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 140/779] ARM: dts: qcom: sdx55: Fix the IRQ trigger type for UART Date: Mon, 15 Aug 2022 19:56:24 +0200 Message-Id: <20220815180343.299410608@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Manivannan Sadhasivam [ Upstream commit ae500b351ab0006d933d804a2b7507fe1e98cecc ] The trigger type should be LEVEL_HIGH. So fix it! Signed-off-by: Manivannan Sadhasivam Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220530080842.37024-2-manivannan.sadhasiva= m@linaro.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm/boot/dts/qcom-sdx55.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/qcom-sdx55.dtsi b/arch/arm/boot/dts/qcom-sdx= 55.dtsi index b5b784c5c65e..0e76d03087fe 100644 --- a/arch/arm/boot/dts/qcom-sdx55.dtsi +++ b/arch/arm/boot/dts/qcom-sdx55.dtsi @@ -205,7 +205,7 @@ gcc: clock-controller@100000 { blsp1_uart3: serial@831000 { compatible =3D "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm"; reg =3D <0x00831000 0x200>; - interrupts =3D ; + interrupts =3D ; clocks =3D <&gcc 30>, <&gcc 9>; clock-names =3D "core", "iface"; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1530EC00140 for ; Mon, 15 Aug 2022 18:30:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242950AbiHOSaW (ORCPT ); Mon, 15 Aug 2022 14:30:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242148AbiHOS3i (ORCPT ); Mon, 15 Aug 2022 14:29: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 55D2EB4AD; Mon, 15 Aug 2022 11:20: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 C66B5B81074; Mon, 15 Aug 2022 18:20:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB3A7C433D6; Mon, 15 Aug 2022 18:20:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587621; bh=meU/262F3qzi4iV+Hx8Xe4mEqCplycf9UmRCcP/BRvo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t4eggISGOxGputkWrDUgMU9SkNaNKI0FV+rlYHgOoKhov25s4DtA4EBYZnnVr0ilQ jLbtyyqyVfNcXlE/3w9JNiNF/m+tknOdOe5Yq6hoHoSbaGPfSo4EoK7PPaJ8gwcg0u VR3rnhQZu+AJ//evfm+hyK1p/Av0D3iRla5fkBg4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Marko , Krzysztof Kozlowski , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 141/779] arm64: dts: qcom: ipq8074: fix NAND node name Date: Mon, 15 Aug 2022 19:56:25 +0200 Message-Id: <20220815180343.348378209@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Robert Marko [ Upstream commit b39961659ffc3c3a9e3d0d43b0476547b5f35d49 ] Per schema it should be nand-controller@79b0000 instead of nand@79b0000. Fix it to match nand-controller.yaml requirements. Signed-off-by: Robert Marko Reviewed-by: Krzysztof Kozlowski Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220621120642.518575-1-robimarko@gmail.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm64/boot/dts/qcom/ipq8074.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/qcom/ipq8074.dtsi b/arch/arm64/boot/dts/qc= om/ipq8074.dtsi index fea415302408..6b9ac0550490 100644 --- a/arch/arm64/boot/dts/qcom/ipq8074.dtsi +++ b/arch/arm64/boot/dts/qcom/ipq8074.dtsi @@ -437,7 +437,7 @@ qpic_bam: dma-controller@7984000 { status =3D "disabled"; }; =20 - qpic_nand: nand@79b0000 { + qpic_nand: nand-controller@79b0000 { compatible =3D "qcom,ipq8074-nand"; reg =3D <0x079b0000 0x10000>; #address-cells =3D <1>; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DAF9BC00140 for ; Mon, 15 Aug 2022 18:31:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243097AbiHOSbz (ORCPT ); Mon, 15 Aug 2022 14:31:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243255AbiHOSav (ORCPT ); Mon, 15 Aug 2022 14:30:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6448D326D4; Mon, 15 Aug 2022 11:20:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D489460EDB; Mon, 15 Aug 2022 18:20:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D34D3C433C1; Mon, 15 Aug 2022 18:20:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587624; bh=CRl5thBS3ZKwFT58v02G+ypacOiiUGNgiHmYuAwki8E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2apRIq6YkfNxUKSvAGHuE5SiQ45nixp4yNw1udgrLqyBqe7vxrpmFCSguvsBnSjB6 FvYmr1IjDIEJHN+UTaf85Mz30BOhJbpT5CsNCuiWJybJVWup0XmbaFabijVAnDkcA4 FXONcWY/Xvt/YK+icdl4YNizmR8K8a2H3f2bNGTk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Samuel Holland , Jernej Skrabec , Sasha Levin Subject: [PATCH 5.15 142/779] arm64: dts: allwinner: a64: orangepi-win: Fix LED node name Date: Mon, 15 Aug 2022 19:56:26 +0200 Message-Id: <20220815180343.394709586@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Samuel Holland [ Upstream commit b8eb2df19fbf97aa1e950cf491232c2e3bef8357 ] "status" does not match any pattern in the gpio-leds binding. Rename the node to the preferred pattern. This fixes a `make dtbs_check` error. Signed-off-by: Samuel Holland Reviewed-by: Jernej Skrabec Signed-off-by: Jernej Skrabec Link: https://lore.kernel.org/r/20220702132816.46456-1-samuel@sholland.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts b/ar= ch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts index 097a5511523a..09eee653d5ca 100644 --- a/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts +++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-orangepi-win.dts @@ -40,7 +40,7 @@ hdmi_con_in: endpoint { leds { compatible =3D "gpio-leds"; =20 - status { + led-0 { label =3D "orangepi:green:status"; gpios =3D <&pio 7 11 GPIO_ACTIVE_HIGH>; /* PH11 */ }; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1BBFC25B0E for ; Mon, 15 Aug 2022 18:39:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243007AbiHOSaf (ORCPT ); Mon, 15 Aug 2022 14:30:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242509AbiHOS3n (ORCPT ); Mon, 15 Aug 2022 14:29:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 011951402C; Mon, 15 Aug 2022 11:20:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 77DA9B8105B; Mon, 15 Aug 2022 18:20:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C661AC433C1; Mon, 15 Aug 2022 18:20:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587627; bh=hwBSpc7erig/674qMUa5THYn7tKXm6QBe24djanajcU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DMiW5vGi7uxeK5HFFsOQ3JYHTi2Bfy6RANb5qWQ5K6YYo8ohP93TXaytp5YqUR2GS aIiW234WMJXKYer0+RFn8p9IHy8aM6rkeZDa3setAsWGfK0x2gNlW6yeUbqHfpbJXq 2ab5XCsDu5+ml0pxl79i+iI4TYFBcj351yc/yHgg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Geert Uytterhoeven , Sasha Levin Subject: [PATCH 5.15 143/779] ARM: shmobile: rcar-gen2: Increase refcount for new reference Date: Mon, 15 Aug 2022 19:56:27 +0200 Message-Id: <20220815180343.440869413@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 75a185fb92e58ccd3670258d8d3b826bd2fa6d29 ] In rcar_gen2_regulator_quirk(), for_each_matching_node_and_match() will automatically increase and decrease the refcount. However, we should call of_node_get() for the new reference created in 'quirk->np'. Besides, we also should call of_node_put() before the 'quirk' being freed. Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220701121804.234223-1-windhl@126.com Signed-off-by: Geert Uytterhoeven Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c b/arch/arm/= mach-shmobile/regulator-quirk-rcar-gen2.c index 09ef73b99dd8..ba44cec5e59a 100644 --- a/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c +++ b/arch/arm/mach-shmobile/regulator-quirk-rcar-gen2.c @@ -125,6 +125,7 @@ static int regulator_quirk_notify(struct notifier_block= *nb, =20 list_for_each_entry_safe(pos, tmp, &quirk_list, list) { list_del(&pos->list); + of_node_put(pos->np); kfree(pos); } =20 @@ -174,11 +175,12 @@ static int __init rcar_gen2_regulator_quirk(void) memcpy(&quirk->i2c_msg, id->data, sizeof(quirk->i2c_msg)); =20 quirk->id =3D id; - quirk->np =3D np; + quirk->np =3D of_node_get(np); quirk->i2c_msg.addr =3D addr; =20 ret =3D of_irq_parse_one(np, 0, argsa); if (ret) { /* Skip invalid entry and continue */ + of_node_put(np); kfree(quirk); continue; } @@ -225,6 +227,7 @@ static int __init rcar_gen2_regulator_quirk(void) err_mem: list_for_each_entry_safe(pos, tmp, &quirk_list, list) { list_del(&pos->list); + of_node_put(pos->np); kfree(pos); } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C38DFC00140 for ; Mon, 15 Aug 2022 18:32:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243226AbiHOScE (ORCPT ); Mon, 15 Aug 2022 14:32:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243447AbiHOSbH (ORCPT ); Mon, 15 Aug 2022 14:31:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E169F32B8E; Mon, 15 Aug 2022 11:21: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 6E3D6B8107B; Mon, 15 Aug 2022 18:20:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D14D2C433C1; Mon, 15 Aug 2022 18:20:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587630; bh=gQm1GOy4uLgvoCwWW/Up8QpHprwb0rVnwltmn9hY3LI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AnBDxwHYd16wqdSz+iMu4LM8Aw4CfsJmjX2F4MAJZsUFxbnpEqqvlb+tAqK1Qm3PZ E3zPUbj5QA3pxplwz8IIZOAkw+x8DJvi8ml06c2UIENOAVVMTke7iAfRV0YD6mwTDz NDW3X8TjGLbGJThv2cAv2LkLnIRlPG8rMwfc8jps= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zeal Robot , Lv Ruyi , Thierry Reding , Sasha Levin Subject: [PATCH 5.15 144/779] firmware: tegra: Fix error check return value of debugfs_create_file() Date: Mon, 15 Aug 2022 19:56:28 +0200 Message-Id: <20220815180343.485758274@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 afcdb8e55c91c6ff0700ab272fd0f74e899ab884 ] If an error occurs, debugfs_create_file() will return ERR_PTR(-ERROR), so use IS_ERR() to check it. Reported-by: Zeal Robot Signed-off-by: Lv Ruyi Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/firmware/tegra/bpmp-debugfs.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/firmware/tegra/bpmp-debugfs.c b/drivers/firmware/tegra= /bpmp-debugfs.c index 3e9fa4b54358..1ed881a567d5 100644 --- a/drivers/firmware/tegra/bpmp-debugfs.c +++ b/drivers/firmware/tegra/bpmp-debugfs.c @@ -465,7 +465,7 @@ static int bpmp_populate_debugfs_inband(struct tegra_bp= mp *bpmp, mode |=3D attrs & DEBUGFS_S_IWUSR ? 0200 : 0; dentry =3D debugfs_create_file(name, mode, parent, bpmp, &bpmp_debug_fops); - if (!dentry) { + if (IS_ERR(dentry)) { err =3D -ENOMEM; goto out; } @@ -716,7 +716,7 @@ static int bpmp_populate_dir(struct tegra_bpmp *bpmp, s= truct seqbuf *seqbuf, =20 if (t & DEBUGFS_S_ISDIR) { dentry =3D debugfs_create_dir(name, parent); - if (!dentry) + if (IS_ERR(dentry)) return -ENOMEM; err =3D bpmp_populate_dir(bpmp, seqbuf, dentry, depth+1); if (err < 0) @@ -729,7 +729,7 @@ static int bpmp_populate_dir(struct tegra_bpmp *bpmp, s= truct seqbuf *seqbuf, dentry =3D debugfs_create_file(name, mode, parent, bpmp, &debugfs_fops); - if (!dentry) + if (IS_ERR(dentry)) return -ENOMEM; } } @@ -779,11 +779,11 @@ int tegra_bpmp_init_debugfs(struct tegra_bpmp *bpmp) return 0; =20 root =3D debugfs_create_dir("bpmp", NULL); - if (!root) + if (IS_ERR(root)) return -ENOMEM; =20 bpmp->debugfs_mirror =3D debugfs_create_dir("debug", root); - if (!bpmp->debugfs_mirror) { + if (IS_ERR(bpmp->debugfs_mirror)) { err =3D -ENOMEM; goto out; } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A01A7C25B08 for ; Mon, 15 Aug 2022 18:33:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242001AbiHOSdA (ORCPT ); Mon, 15 Aug 2022 14:33:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243293AbiHOScO (ORCPT ); Mon, 15 Aug 2022 14:32:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C26033424; Mon, 15 Aug 2022 11:21:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 76385B8107E; Mon, 15 Aug 2022 18:20:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA934C433C1; Mon, 15 Aug 2022 18:20:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587633; bh=fJlX3h+MOj3Xfe/dl4vL1uJNZJFo+EAzH1jy8cqdO+U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YXILqoJvs43UJcfrInA9w0qPXgZugcbtaM4WF6aELFbEGVQ6bLBL5G2rB/abBFM4a 2oLJOSKBHg9IJ6qdSeKX2tSpzR2bEa06GJhlvFVIcpUTHJfBnnvHb5XT31GMVk2aih 1uPaIHwmaJHoG5Olsn+qqirrGTatX63NF6a/0Y7g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Armin Wolf , =?UTF-8?q?Pali=20Roh=C3=A1r?= , Guenter Roeck , Sasha Levin Subject: [PATCH 5.15 145/779] hwmon: (dell-smm) Add Dell XPS 13 7390 to fan control whitelist Date: Mon, 15 Aug 2022 19:56:29 +0200 Message-Id: <20220815180343.518187007@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Armin Wolf [ Upstream commit 385e5f57053ff293282fea84c1c27186d53f66e1 ] A user reported that the program dell-bios-fan-control worked on his Dell XPS 13 7390 to switch off automatic fan control. Since it uses the same mechanism as the dell_smm_hwmon module, add this model to the fan control whitelist. Compile-tested only. Signed-off-by: Armin Wolf Acked-by: Pali Roh=C3=A1r Link: https://lore.kernel.org/r/20220612041806.11367-1-W_Armin@gmx.de Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/hwmon/dell-smm-hwmon.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/hwmon/dell-smm-hwmon.c b/drivers/hwmon/dell-smm-hwmon.c index 9cb1c3588038..597cbb4391bd 100644 --- a/drivers/hwmon/dell-smm-hwmon.c +++ b/drivers/hwmon/dell-smm-hwmon.c @@ -1198,6 +1198,14 @@ static const struct dmi_system_id i8k_whitelist_fan_= control[] __initconst =3D { }, .driver_data =3D (void *)&i8k_fan_control_data[I8K_FAN_34A3_35A3], }, + { + .ident =3D "Dell XPS 13 7390", + .matches =3D { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "XPS 13 7390"), + }, + .driver_data =3D (void *)&i8k_fan_control_data[I8K_FAN_34A3_35A3], + }, { } }; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7D0DC3F6B0 for ; Mon, 15 Aug 2022 18:39:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232488AbiHOSb1 (ORCPT ); Mon, 15 Aug 2022 14:31:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242913AbiHOSaR (ORCPT ); Mon, 15 Aug 2022 14:30:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56047F5B1; Mon, 15 Aug 2022 11:20:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 037CBB81072; Mon, 15 Aug 2022 18:20:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63C81C433C1; Mon, 15 Aug 2022 18:20:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587636; bh=4pNbcfBY7sSXixtKDEXaS8TRXL9OvdOoDNaQXO+z7ao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OCdt8kkcSM0oIq91A2XsJCtjegCbHdXznNsTauq72ClB3Q63mf/d0eK9LlIpi3lf1 giN4uEKejcVJWqoS5C9Fj7imcRw9W/D2JWw1w28P3kZxC1v2NKYHfkQPplSrN+Mvq4 Trs1CxY0tDUrjI9TBoWFpobplfsMj2XUuJKVbqVc= 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?= , Guenter Roeck , Sasha Levin Subject: [PATCH 5.15 146/779] hwmon: (sht15) Fix wrong assumptions in device remove callback Date: Mon, 15 Aug 2022 19:56:30 +0200 Message-Id: <20220815180343.568855910@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Uwe Kleine-K=C3=B6nig [ Upstream commit 7d4edccc9bbfe1dcdff641343f7b0c6763fbe774 ] Taking a lock at the beginning of .remove() doesn't prevent new readers. With the existing approach it can happen, that a read occurs just when the lock was taken blocking the reader until the lock is released at the end of the remove callback which then accessed *data that is already freed then. To actually fix this problem the hwmon core needs some adaption. Until this is implemented take the optimistic approach of assuming that all readers are gone after hwmon_device_unregister() and sysfs_remove_group() as most other drivers do. (And once the core implements that, taking the lock would deadlock.) So drop the lock, move the reset to after device unregistration to keep the device in a workable state until it's deregistered. Also add a error message in case the reset fails and return 0 anyhow. (Returning an error code, doesn't stop the platform device unregistration and only results in a little helpful error message before the devm cleanup handlers are called.) Signed-off-by: Uwe Kleine-K=C3=B6nig Link: https://lore.kernel.org/r/20220725194344.150098-1-u.kleine-koenig@pen= gutronix.de Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/hwmon/sht15.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/hwmon/sht15.c b/drivers/hwmon/sht15.c index 7f4a63959730..ae4d14257a11 100644 --- a/drivers/hwmon/sht15.c +++ b/drivers/hwmon/sht15.c @@ -1020,25 +1020,20 @@ static int sht15_probe(struct platform_device *pdev) static int sht15_remove(struct platform_device *pdev) { struct sht15_data *data =3D platform_get_drvdata(pdev); + int ret; =20 - /* - * Make sure any reads from the device are done and - * prevent new ones beginning - */ - mutex_lock(&data->read_lock); - if (sht15_soft_reset(data)) { - mutex_unlock(&data->read_lock); - return -EFAULT; - } hwmon_device_unregister(data->hwmon_dev); sysfs_remove_group(&pdev->dev.kobj, &sht15_attr_group); + + ret =3D sht15_soft_reset(data); + if (ret) + dev_err(&pdev->dev, "Failed to reset device (%pe)\n", ERR_PTR(ret)); + if (!IS_ERR(data->reg)) { regulator_unregister_notifier(data->reg, &data->nb); regulator_disable(data->reg); } =20 - mutex_unlock(&data->read_lock); - return 0; } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0C5FC28B2B for ; Mon, 15 Aug 2022 18:31:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242861AbiHOSbl (ORCPT ); Mon, 15 Aug 2022 14:31:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242801AbiHOSa3 (ORCPT ); Mon, 15 Aug 2022 14:30: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 7375F3207A; Mon, 15 Aug 2022 11:20: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 3C2C46069E; Mon, 15 Aug 2022 18:20:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F8A3C433C1; Mon, 15 Aug 2022 18:20:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587639; bh=duFYzGOIIixBva0Q9jgqi225EbafyGawSTxEWc9V+Ds=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SRS5UzI1Fs5uMkq+9W+XEL5/8dmzRiGue6yT/SWPFXA2Vr023GWmZuFXnLm21+OCv oJMuEI2Lt0wcd6Zk9DZda137hYEk5pbMSqThTNk+aFI1tCACdd6uLdLk/YHyEbn5mS qLLbYybyh8h1r27pRDkTnzIWx9WuSXQFyMEC2roc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Tetsuo Handa , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.15 147/779] PM: hibernate: defer device probing when resuming from hibernation Date: Mon, 15 Aug 2022 19:56:31 +0200 Message-Id: <20220815180343.607408603@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 8386c414e27caba8501119948e9551e52b527f59 ] syzbot is reporting hung task at misc_open() [1], for there is a race window of AB-BA deadlock which involves probe_count variable. Currently wait_for_device_probe() from snapshot_open() from misc_open() can sleep forever with misc_mtx held if probe_count cannot become 0. When a device is probed by hub_event() work function, probe_count is incremented before the probe function starts, and probe_count is decremented after the probe function completed. There are three cases that can prevent probe_count from dropping to 0. (a) A device being probed stopped responding (i.e. broken/malicious hardware). (b) A process emulating a USB device using /dev/raw-gadget interface stopped responding for some reason. (c) New device probe requests keeps coming in before existing device probe requests complete. The phenomenon syzbot is reporting is (b). A process which is holding system_transition_mutex and misc_mtx is waiting for probe_count to become 0 inside wait_for_device_probe(), but the probe function which is called from hub_event() work function is waiting for the processes which are blocked at mutex_lock(&misc_mtx) to respond via /dev/raw-gadget interface. This patch mitigates (b) by deferring wait_for_device_probe() from snapshot_open() to snapshot_write() and snapshot_ioctl(). Please note that the possibility of (b) remains as long as any thread which is emulating a USB device via /dev/raw-gadget interface can be blocked by uninterruptible blocking operations (e.g. mutex_lock()). Please also note that (a) and (c) are not addressed. Regarding (c), we should change the code to wait for only one device which contains the image for resuming from hibernation. I don't know how to address (a), for use of timeout for wait_for_device_probe() might result in loss of user data in the image. Maybe we should require the userland to wait for the image device before opening /dev/snapshot interface. Link: https://syzkaller.appspot.com/bug?extid=3D358c9ab4c93da7b7238c [1] Reported-by: syzbot Signed-off-by: Tetsuo Handa Tested-by: syzbot Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- kernel/power/user.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/kernel/power/user.c b/kernel/power/user.c index 740723bb3885..13cca2e2c2bc 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c @@ -26,6 +26,7 @@ =20 #include "power.h" =20 +static bool need_wait; =20 static struct snapshot_data { struct snapshot_handle handle; @@ -78,7 +79,7 @@ static int snapshot_open(struct inode *inode, struct file= *filp) * Resuming. We may need to wait for the image device to * appear. */ - wait_for_device_probe(); + need_wait =3D true; =20 data->swap =3D -1; data->mode =3D O_WRONLY; @@ -168,6 +169,11 @@ static ssize_t snapshot_write(struct file *filp, const= char __user *buf, ssize_t res; loff_t pg_offp =3D *offp & ~PAGE_MASK; =20 + if (need_wait) { + wait_for_device_probe(); + need_wait =3D false; + } + lock_system_sleep(); =20 data =3D filp->private_data; @@ -244,6 +250,11 @@ static long snapshot_ioctl(struct file *filp, unsigned= int cmd, loff_t size; sector_t offset; =20 + if (need_wait) { + wait_for_device_probe(); + need_wait =3D false; + } + if (_IOC_TYPE(cmd) !=3D SNAPSHOT_IOC_MAGIC) return -ENOTTY; if (_IOC_NR(cmd) > SNAPSHOT_IOC_MAXNR) --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7CACC28B2C for ; Mon, 15 Aug 2022 18:31:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242239AbiHOSbh (ORCPT ); Mon, 15 Aug 2022 14:31:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242848AbiHOSaa (ORCPT ); Mon, 15 Aug 2022 14:30: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 CF8FA2A728; Mon, 15 Aug 2022 11:20: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 312126068D; Mon, 15 Aug 2022 18:20:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37601C433C1; Mon, 15 Aug 2022 18:20:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587642; bh=6CRLhn7oCpLe3R4QHpr0/0MYXVi1LdC9PER/71MjKW4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y9GUuTrgkjDlfmiU1v8il9U2Yppm/voxFmAX+KXH6NcRCvOV7a6lPAwTzf0Z3cGYc myT0qdAIqnFObbXz/iZCwLe2duvMe2nZaYU5XaKTAhHHFu2umNf47dS3cW6s2wPy3i eQRQHJPX8M98yoWDAE0mszv0Xye5NV7m9dW/BzzY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiu Jianfeng , Paul Moore , Sasha Levin Subject: [PATCH 5.15 148/779] selinux: fix memleak in security_read_state_kernel() Date: Mon, 15 Aug 2022 19:56:32 +0200 Message-Id: <20220815180343.640854417@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xiu Jianfeng [ Upstream commit 73de1befcc53a7c68b0c5e76b9b5ac41c517760f ] In this function, it directly returns the result of __security_read_policy without freeing the allocated memory in *data, cause memory leak issue, so free the memory if __security_read_policy failed. Signed-off-by: Xiu Jianfeng [PM: subject line tweak] Signed-off-by: Paul Moore Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- security/selinux/ss/services.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index c4931bf6f92a..e8035e4876df 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c @@ -4045,6 +4045,7 @@ int security_read_policy(struct selinux_state *state, int security_read_state_kernel(struct selinux_state *state, void **data, size_t *len) { + int err; struct selinux_policy *policy; =20 policy =3D rcu_dereference_protected( @@ -4057,5 +4058,11 @@ int security_read_state_kernel(struct selinux_state = *state, if (!*data) return -ENOMEM; =20 - return __security_read_policy(policy, *data, len); + err =3D __security_read_policy(policy, *data, len); + if (err) { + vfree(*data); + *data =3D NULL; + *len =3D 0; + } + return err; } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B5A0C00140 for ; Mon, 15 Aug 2022 18:32:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243251AbiHOScI (ORCPT ); Mon, 15 Aug 2022 14:32:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243483AbiHOSbN (ORCPT ); Mon, 15 Aug 2022 14:31:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77E9432D81; Mon, 15 Aug 2022 11:21: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 CE83EB8105B; Mon, 15 Aug 2022 18:20:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36EB0C433D6; Mon, 15 Aug 2022 18:20:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587648; bh=VJCmYCac8+0GtJU2jX1P9L9/IdytulRpy/aYEWsiEso=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1S3JwEsJaH5ZCS8UzOBt14Q015LN18ciXY40KMajlTOLMwceN0S93o/dJpiN8eVaQ XB2+08VXwyueNBJ8rTj4WmtQ5Xm6X99ka4uvK6BlD0fWF9YIvrFvTojfwicVX6P9vh 74LgyZy1yGKlnQMdRu2YDk7dRRuEYc3ID5VyM1SU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiu Jianfeng , Paul Moore , Sasha Levin Subject: [PATCH 5.15 149/779] selinux: Add boundary check in put_entry() Date: Mon, 15 Aug 2022 19:56:33 +0200 Message-Id: <20220815180343.681170622@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xiu Jianfeng [ Upstream commit 15ec76fb29be31df2bccb30fc09875274cba2776 ] Just like next_entry(), boundary check is necessary to prevent memory out-of-bound access. Signed-off-by: Xiu Jianfeng Signed-off-by: Paul Moore Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- security/selinux/ss/policydb.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/security/selinux/ss/policydb.h b/security/selinux/ss/policydb.h index c24d4e1063ea..ffc4e7bad205 100644 --- a/security/selinux/ss/policydb.h +++ b/security/selinux/ss/policydb.h @@ -370,6 +370,8 @@ static inline int put_entry(const void *buf, size_t byt= es, int num, struct polic { size_t len =3D bytes * num; =20 + if (len > fp->len) + return -EINVAL; memcpy(fp->data, buf, len); fp->data +=3D len; fp->len -=3D len; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3ED7AC00140 for ; Mon, 15 Aug 2022 18:31:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243063AbiHOSbx (ORCPT ); Mon, 15 Aug 2022 14:31:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243184AbiHOSaq (ORCPT ); Mon, 15 Aug 2022 14:30:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 621252A735; Mon, 15 Aug 2022 11:20:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 30D93606A1; Mon, 15 Aug 2022 18:20:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 337A0C433C1; Mon, 15 Aug 2022 18:20:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587651; bh=i9A+xun9VuVjc3Fum4H2HyppQpm3IGo9flBEQMDQayY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IlMnuSatIWu7y7Qph/y76aRlGgp+8GZzx2icwfP4bTDsLDABKLuTxTHI0xhJPV8Hl 5P4j//pzwHhYyw4zoISwmUQWx+QUq9pYIUunE6oh/KeA/WYp+JbCqHdYo7+QCX/eTS LFA2iUvXlFETtOIyeU3eu1QEzU54mIWQiz5D7tls= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , kasan-dev@googlegroups.com, Kees Cook , Sasha Levin Subject: [PATCH 5.15 150/779] kasan: test: Silence GCC 12 warnings Date: Mon, 15 Aug 2022 19:56:34 +0200 Message-Id: <20220815180343.721810104@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kees Cook [ Upstream commit aaf50b1969d7933a51ea421b11432a7fb90974e3 ] GCC 12 continues to get smarter about array accesses. The KASAN tests are expecting to explicitly test out-of-bounds conditions at run-time, so hide the variable from GCC, to avoid warnings like: ../lib/test_kasan.c: In function 'ksize_uaf': ../lib/test_kasan.c:790:61: warning: array subscript 120 is outside array b= ounds of 'void[120]' [-Warray-bounds] 790 | KUNIT_EXPECT_KASAN_FAIL(test, ((volatile char *)ptr)[size]); | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~ ../lib/test_kasan.c:97:9: note: in definition of macro 'KUNIT_EXPECT_KASAN_= FAIL' 97 | expression; \ | ^~~~~~~~~~ Cc: Andrey Ryabinin Cc: Alexander Potapenko Cc: Andrey Konovalov Cc: Dmitry Vyukov Cc: Vincenzo Frascino Cc: kasan-dev@googlegroups.com Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20220608214024.1068451-1-keescook@chromium.= org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- lib/test_kasan.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/test_kasan.c b/lib/test_kasan.c index 8835e0784578..89f444cabd4a 100644 --- a/lib/test_kasan.c +++ b/lib/test_kasan.c @@ -125,6 +125,7 @@ static void kmalloc_oob_right(struct kunit *test) ptr =3D kmalloc(size, GFP_KERNEL); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); =20 + OPTIMIZER_HIDE_VAR(ptr); /* * An unaligned access past the requested kmalloc size. * Only generic KASAN can precisely detect these. @@ -153,6 +154,7 @@ static void kmalloc_oob_left(struct kunit *test) ptr =3D kmalloc(size, GFP_KERNEL); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); =20 + OPTIMIZER_HIDE_VAR(ptr); KUNIT_EXPECT_KASAN_FAIL(test, *ptr =3D *(ptr - 1)); kfree(ptr); } @@ -165,6 +167,7 @@ static void kmalloc_node_oob_right(struct kunit *test) ptr =3D kmalloc_node(size, GFP_KERNEL, 0); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); =20 + OPTIMIZER_HIDE_VAR(ptr); KUNIT_EXPECT_KASAN_FAIL(test, ptr[0] =3D ptr[size]); kfree(ptr); } @@ -185,6 +188,7 @@ static void kmalloc_pagealloc_oob_right(struct kunit *t= est) ptr =3D kmalloc(size, GFP_KERNEL); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); =20 + OPTIMIZER_HIDE_VAR(ptr); KUNIT_EXPECT_KASAN_FAIL(test, ptr[size + OOB_TAG_OFF] =3D 0); =20 kfree(ptr); @@ -265,6 +269,7 @@ static void kmalloc_large_oob_right(struct kunit *test) ptr =3D kmalloc(size, GFP_KERNEL); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); =20 + OPTIMIZER_HIDE_VAR(ptr); KUNIT_EXPECT_KASAN_FAIL(test, ptr[size] =3D 0); kfree(ptr); } @@ -404,6 +409,8 @@ static void kmalloc_oob_16(struct kunit *test) ptr2 =3D kmalloc(sizeof(*ptr2), GFP_KERNEL); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr2); =20 + OPTIMIZER_HIDE_VAR(ptr1); + OPTIMIZER_HIDE_VAR(ptr2); KUNIT_EXPECT_KASAN_FAIL(test, *ptr1 =3D *ptr2); kfree(ptr1); kfree(ptr2); @@ -712,6 +719,8 @@ static void ksize_unpoisons_memory(struct kunit *test) KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); real_size =3D ksize(ptr); =20 + OPTIMIZER_HIDE_VAR(ptr); + /* This access shouldn't trigger a KASAN report. */ ptr[size] =3D 'x'; =20 @@ -734,6 +743,7 @@ static void ksize_uaf(struct kunit *test) KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); kfree(ptr); =20 + OPTIMIZER_HIDE_VAR(ptr); KUNIT_EXPECT_KASAN_FAIL(test, ksize(ptr)); KUNIT_EXPECT_KASAN_FAIL(test, ((volatile char *)ptr)[0]); KUNIT_EXPECT_KASAN_FAIL(test, ((volatile char *)ptr)[size]); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B96CEC00140 for ; Mon, 15 Aug 2022 18:32:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243324AbiHOScR (ORCPT ); Mon, 15 Aug 2022 14:32:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243573AbiHOSbX (ORCPT ); Mon, 15 Aug 2022 14:31:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EBB332ED5; Mon, 15 Aug 2022 11:21: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 466EE6068D; Mon, 15 Aug 2022 18:20:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47543C433C1; Mon, 15 Aug 2022 18:20:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587654; bh=YtcresAn+qp2Ji3gQYzaNCoxUrbqceUer7l0kgvznWs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nGKMMeaY4FsOTfOg7ewxLex7NmwiLwdN7VGgXBx2t8K9w2oEdkiEfArgfFU1IumHR +rJZ2AL4648RvtTK7mnyXyWugFt+OGLdVh4o1RMAISCwJPepAiFIw/7sAiYljp1RSa UnLsHWEG4NtPd76nSL1IE+oWfc3w2c5iquA5VaCE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, xinhui pan , =?UTF-8?q?Christian=20K=C3=B6nig?= , Felix Kuehling , Alex Deucher , Sasha Levin Subject: [PATCH 5.15 151/779] drm/amdgpu: Remove one duplicated ef removal Date: Mon, 15 Aug 2022 19:56:35 +0200 Message-Id: <20220815180343.768993912@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: xinhui pan [ Upstream commit e1aadbab445b06e072013a1365fd0cf2aa25e843 ] That has been done in BO release notify. Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/2074 Signed-off-by: xinhui pan Acked-by: Christian K=C3=B6nig Reviewed-by: Felix Kuehling Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu= /drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c index 21c02f817a84..c904269b3e14 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c @@ -1318,16 +1318,10 @@ void amdgpu_amdkfd_gpuvm_destroy_cb(struct amdgpu_d= evice *adev, struct amdgpu_vm *vm) { struct amdkfd_process_info *process_info =3D vm->process_info; - struct amdgpu_bo *pd =3D vm->root.bo; =20 if (!process_info) return; =20 - /* Release eviction fence from PD */ - amdgpu_bo_reserve(pd, false); - amdgpu_bo_fence(pd, NULL, false); - amdgpu_bo_unreserve(pd); - /* Update process info */ mutex_lock(&process_info->lock); process_info->n_vms--; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78F2AC00140 for ; Mon, 15 Aug 2022 18:32:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243145AbiHOSb6 (ORCPT ); Mon, 15 Aug 2022 14:31:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243360AbiHOSa6 (ORCPT ); Mon, 15 Aug 2022 14:30:58 -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 B2843326DD; Mon, 15 Aug 2022 11:20: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 2292660EBB; Mon, 15 Aug 2022 18:20:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2785FC433C1; Mon, 15 Aug 2022 18:20:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587657; bh=ai9n7In6AvAmJCXp8dgLUdN/R33ZQxYkQ1xdEtuRzyY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p+F1Fuhm/fJTHMZTq9GhjLziD/CUAFsRdado6P1qgTeqJPNlWD+WktccTOyIBnHnT b7sJl+5K5vEDBNeNtDjhNPXaE/Qs0+pUniFAD6TdwqZuJCaONthIQyzNTP2LNLCFGw a+W8gvhYxa3y3YD+Rx2rexokXPxl7XeM1hX+UjSE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sudip Mukherjee , Michael Ellerman , Sasha Levin Subject: [PATCH 5.15 152/779] powerpc/64s: Disable stack variable initialisation for prom_init Date: Mon, 15 Aug 2022 19:56:36 +0200 Message-Id: <20220815180343.809087800@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Ellerman [ Upstream commit be640317a1d0b9cf42fedb2debc2887a7cfa38de ] With GCC 12 allmodconfig prom_init fails to build: Error: External symbol 'memset' referenced from prom_init.c make[2]: *** [arch/powerpc/kernel/Makefile:204: arch/powerpc/kernel/prom_= init_check] Error 1 The allmodconfig build enables KASAN, so all calls to memset in prom_init should be converted to __memset by the #ifdefs in asm/string.h, because prom_init must use the non-KASAN instrumented versions. The build failure happens because there's a call to memset that hasn't been caught by the pre-processor and converted to __memset. Typically that's because it's a memset generated by the compiler itself, and that is the case here. With GCC 12, allmodconfig enables CONFIG_INIT_STACK_ALL_PATTERN, which causes the compiler to emit memset calls to initialise on-stack variables with a pattern. Because prom_init is non-user-facing boot-time only code, as a workaround just disable stack variable initialisation to unbreak the build. Reported-by: Sudip Mukherjee Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220718134418.354114-1-mpe@ellerman.id.au Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/powerpc/kernel/Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile index b1b23b4d56ba..ed91d5b9ffc6 100644 --- a/arch/powerpc/kernel/Makefile +++ b/arch/powerpc/kernel/Makefile @@ -20,6 +20,7 @@ CFLAGS_prom.o +=3D $(DISABLE_LATENT_ENTROPY_PLUGIN) CFLAGS_prom_init.o +=3D -fno-stack-protector CFLAGS_prom_init.o +=3D -DDISABLE_BRANCH_PROFILING CFLAGS_prom_init.o +=3D -ffreestanding +CFLAGS_prom_init.o +=3D $(call cc-option, -ftrivial-auto-var-init=3Duninit= ialized) =20 ifdef CONFIG_FUNCTION_TRACER # Do not trace early boot code --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 111B5C00140 for ; Mon, 15 Aug 2022 18:37:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242647AbiHOShm (ORCPT ); Mon, 15 Aug 2022 14:37:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244017AbiHOSgS (ORCPT ); Mon, 15 Aug 2022 14:36: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 9C6AB3C15B; Mon, 15 Aug 2022 11:23: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 87F0EB81071; Mon, 15 Aug 2022 18:23:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5398C433C1; Mon, 15 Aug 2022 18:23:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587786; bh=PYfW4qUNcV0ql8wYHgPWd/Nrk4am9nAFnFvDd23OFxw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rYQJGFI4InGsrqLZLWkkVEauqo4Q8hCXIcQatIxMq7xbCqH411lcuxyB4dSZ1pmqa bWhd99veAqatGPeV7OwGHqLcn3PlxJvgX4pdGumY/Q6gHJYK5AeifwSwff1z9WLI4J mGHW9JOGce+Bsh0QMubx8vUwSXExKhgJgiwvNBD0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Biju Das , Geert Uytterhoeven , Mark Brown , Sasha Levin Subject: [PATCH 5.15 153/779] spi: spi-rspi: Fix PIO fallback on RZ platforms Date: Mon, 15 Aug 2022 19:56:37 +0200 Message-Id: <20220815180343.858223258@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 b620aa3a7be346f04ae7789b165937615c6ee8d3 ] RSPI IP on RZ/{A, G2L} SoC's has the same signal for both interrupt and DMA transfer request. Setting DMARS register for DMA transfer makes the signal to work as a DMA transfer request signal and subsequent interrupt requests to the interrupt controller are masked. PIO fallback does not work as interrupt signal is disabled. This patch fixes this issue by re-enabling the interrupts by calling dmaengine_synchronize(). Signed-off-by: Biju Das Reviewed-by: Geert Uytterhoeven Link: https://lore.kernel.org/r/20220721143449.879257-1-biju.das.jz@bp.rene= sas.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/spi/spi-rspi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/spi/spi-rspi.c b/drivers/spi/spi-rspi.c index d575c935e9f0..f634a405382c 100644 --- a/drivers/spi/spi-rspi.c +++ b/drivers/spi/spi-rspi.c @@ -612,6 +612,10 @@ static int rspi_dma_transfer(struct rspi_data *rspi, s= truct sg_table *tx, rspi->dma_callbacked, HZ); if (ret > 0 && rspi->dma_callbacked) { ret =3D 0; + if (tx) + dmaengine_synchronize(rspi->ctlr->dma_tx); + if (rx) + dmaengine_synchronize(rspi->ctlr->dma_rx); } else { if (!ret) { dev_err(&rspi->ctlr->dev, "DMA timeout\n"); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B96AC282E7 for ; Mon, 15 Aug 2022 18:32:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243014AbiHOScf (ORCPT ); Mon, 15 Aug 2022 14:32:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242033AbiHOSbg (ORCPT ); Mon, 15 Aug 2022 14:31: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 E01FF33404; Mon, 15 Aug 2022 11:21: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 36273B8107B; Mon, 15 Aug 2022 18:21:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71CE7C433D6; Mon, 15 Aug 2022 18:21:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587681; bh=2ovyApPiME4/c5U9s2pafwbgUslndUbYq4uX2bqjewE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LrR4XVEA9skn3QTNc5IdLITZA0lcfASO4RknZnveyimGUyFpCZfQGaMjHV+fLQIen FnEDLPLEF/ilR89zPlJi530fnSzasGT1gSeVjInmrEf6PdT2VgYiYr5GHX+8V6/Vak GY9Bb2b+QedSoS0rClkk7DLN08iVO+zuJ5o92THU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.15 154/779] netfilter: nf_tables: add rescheduling points during loop detection walks Date: Mon, 15 Aug 2022 19:56:38 +0200 Message-Id: <20220815180343.899696572@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Westphal [ Upstream commit 81ea010667417ef3f218dfd99b69769fe66c2b67 ] Add explicit rescheduling points during ruleset walk. Switching to a faster algorithm is possible but this is a much smaller change, suitable for nf tree. Link: https://bugzilla.netfilter.org/show_bug.cgi?id=3D1460 Signed-off-by: Florian Westphal Acked-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- net/netfilter/nf_tables_api.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 13d14fcc2371..3d52a08bd560 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -3248,6 +3248,8 @@ int nft_chain_validate(const struct nft_ctx *ctx, con= st struct nft_chain *chain) if (err < 0) return err; } + + cond_resched(); } =20 return 0; @@ -9225,9 +9227,13 @@ static int nf_tables_check_loops(const struct nft_ct= x *ctx, break; } } + + cond_resched(); } =20 list_for_each_entry(set, &ctx->table->sets, list) { + cond_resched(); + if (!nft_is_active_next(ctx->net, set)) continue; if (!(set->flags & NFT_SET_MAP) || --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD6CBC00140 for ; Mon, 15 Aug 2022 18:34:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243544AbiHOSe1 (ORCPT ); Mon, 15 Aug 2022 14:34:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243634AbiHOSdy (ORCPT ); Mon, 15 Aug 2022 14:33: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 06BA637FA6; Mon, 15 Aug 2022 11:22: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 D6B1FB81074; Mon, 15 Aug 2022 18:21:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A727C433D7; Mon, 15 Aug 2022 18:21:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587716; bh=lC1PDtOD4kVcf3eDjo4yBR1rOPmdYM1OQZgn1WPyCNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c1NFdBa2RxBSDr/Tvdt5maO47mjS0+noafwBOEzuKD/zZvTE/VaaEKIl0Km4S+juG LJFca0mthf5VbD3VHou0y7cpM6eUni7+h5ngPfBMvp3XccNvK4/e9rKLOL47GFR88h kUq4tPluTCNuYmDS/qtRL43wM+Yb2hgOwbBWUfAs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guenter Roeck , "Russell King (Oracle)" , Sasha Levin Subject: [PATCH 5.15 155/779] ARM: findbit: fix overflowing offset Date: Mon, 15 Aug 2022 19:56:39 +0200 Message-Id: <20220815180343.948725163@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Russell King (Oracle) [ Upstream commit ec85bd369fd2bfaed6f45dd678706429d4f75b48 ] When offset is larger than the size of the bit array, we should not attempt to access the array as we can perform an access beyond the end of the array. Fix this by changing the pre-condition. Using "cmp r2, r1; bhs ..." covers us for the size =3D=3D 0 case, since this will always take the branch when r1 is zero, irrespective of the value of r2. This means we can fix this bug without adding any additional code! Tested-by: Guenter Roeck Signed-off-by: Russell King (Oracle) Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm/lib/findbit.S | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S index b5e8b9ae4c7d..7fd3600db8ef 100644 --- a/arch/arm/lib/findbit.S +++ b/arch/arm/lib/findbit.S @@ -40,8 +40,8 @@ ENDPROC(_find_first_zero_bit_le) * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int = offset) */ ENTRY(_find_next_zero_bit_le) - teq r1, #0 - beq 3b + cmp r2, r1 + bhs 3b ands ip, r2, #7 beq 1b @ If new byte, goto old routine ARM( ldrb r3, [r0, r2, lsr #3] ) @@ -81,8 +81,8 @@ ENDPROC(_find_first_bit_le) * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int = offset) */ ENTRY(_find_next_bit_le) - teq r1, #0 - beq 3b + cmp r2, r1 + bhs 3b ands ip, r2, #7 beq 1b @ If new byte, goto old routine ARM( ldrb r3, [r0, r2, lsr #3] ) @@ -115,8 +115,8 @@ ENTRY(_find_first_zero_bit_be) ENDPROC(_find_first_zero_bit_be) =20 ENTRY(_find_next_zero_bit_be) - teq r1, #0 - beq 3b + cmp r2, r1 + bhs 3b ands ip, r2, #7 beq 1b @ If new byte, goto old routine eor r3, r2, #0x18 @ big endian byte ordering @@ -149,8 +149,8 @@ ENTRY(_find_first_bit_be) ENDPROC(_find_first_bit_be) =20 ENTRY(_find_next_bit_be) - teq r1, #0 - beq 3b + cmp r2, r1 + bhs 3b ands ip, r2, #7 beq 1b @ If new byte, goto old routine eor r3, r2, #0x18 @ big endian byte ordering --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D28A4C3F6B0 for ; Mon, 15 Aug 2022 18:36:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243685AbiHOSgz (ORCPT ); Mon, 15 Aug 2022 14:36:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243570AbiHOSfW (ORCPT ); Mon, 15 Aug 2022 14:35:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C50E23A4BE; Mon, 15 Aug 2022 11:22: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 65D93B8105B; Mon, 15 Aug 2022 18:22:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADD51C43140; Mon, 15 Aug 2022 18:22:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587752; bh=YhgF2yt0u3VyqWuFgGE9+OCvXB5d0Chiy9PsctpcyxA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eDL9j2tg0WHyjnAKEdsXu0gnI9FI64NHoW9gHABLU1cDipaP1hJf8F8JclFVbp4z3 278vnu8M+8yYO1k1wrEVyncE8v2nGqz3Xpw4lyDUueqi0sP/PlkTtieJY6ZMFEyh5D NcxdGgGdORm1Aiml7XkC1pR6rEzvNNRzJKr0Cwdc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Martin Blumenstingl , Neil Armstrong , Sasha Levin Subject: [PATCH 5.15 156/779] meson-mx-socinfo: Fix refcount leak in meson_mx_socinfo_init Date: Mon, 15 Aug 2022 19:56:40 +0200 Message-Id: <20220815180344.000701974@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit a2106f38077e78afcb4bf98fdda3e162118cfb3d ] of_find_matching_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: 5e68c0fc8df8 ("soc: amlogic: Add Meson6/Meson8/Meson8b/Meson8m2 SoC = Information driver") Signed-off-by: Miaoqian Lin Reviewed-by: Martin Blumenstingl Signed-off-by: Neil Armstrong Link: https://lore.kernel.org/r/20220524065729.33689-1-linmq006@gmail.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/soc/amlogic/meson-mx-socinfo.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/soc/amlogic/meson-mx-socinfo.c b/drivers/soc/amlogic/m= eson-mx-socinfo.c index 78f0f1aeca57..92125dd65f33 100644 --- a/drivers/soc/amlogic/meson-mx-socinfo.c +++ b/drivers/soc/amlogic/meson-mx-socinfo.c @@ -126,6 +126,7 @@ static int __init meson_mx_socinfo_init(void) np =3D of_find_matching_node(NULL, meson_mx_socinfo_analog_top_ids); if (np) { analog_top_regmap =3D syscon_node_to_regmap(np); + of_node_put(np); if (IS_ERR(analog_top_regmap)) return PTR_ERR(analog_top_regmap); =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F139C00140 for ; Mon, 15 Aug 2022 18:37:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240641AbiHOShW (ORCPT ); Mon, 15 Aug 2022 14:37:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243857AbiHOSf6 (ORCPT ); Mon, 15 Aug 2022 14:35:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE1D33AE78; Mon, 15 Aug 2022 11:22: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 D0E93B81074; Mon, 15 Aug 2022 18:22:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D09FC433D7; Mon, 15 Aug 2022 18:22:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587767; bh=UCWNQNT584JtiLG0+ImmAyVLHfbA2TmlLvAAdCnNLXs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k1iXfEerWJTZhdqVGDnFiSAW954B9NRAdL1Vslu1UgAv6Bm95gJuASE6yQCOGi1Z4 vZEKI5kbvxoPdKrcA0WcT/N4G7p3jVPEU7+ANzBQQMEQ3pqw5fEC0Og2CNMfdQsnpt PTvyOVMetV6+ia950IBGNlO4wHCxxeTWe1sRy8Ss= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Sasha Levin Subject: [PATCH 5.15 157/779] arm64: dts: renesas: beacon: Fix regulator node names Date: Mon, 15 Aug 2022 19:56:41 +0200 Message-Id: <20220815180344.052086982@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 7512af9f78dedea7e04225f665dad6750df7d095 ] Currently there are two nodes named "regulator_camera". This causes the former to be overwritten by the latter. Fix this by renaming them to unique names, using the preferred hyphen instead of an underscore. While at it, update the name of the audio regulator (which was added in the same commit) to use a hyphen. Fixes: a1d8a344f1ca0709 ("arm64: dts: renesas: Introduce r8a774a1-beacon-rz= g2m-kit") Signed-off-by: Geert Uytterhoeven Link: https://lore.kernel.org/r/a9ac82bdf108162487289d091c53a9b3de393f13.16= 52263918.git.geert+renesas@glider.be Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm64/boot/dts/renesas/beacon-renesom-baseboard.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm64/boot/dts/renesas/beacon-renesom-baseboard.dtsi b/ar= ch/arm64/boot/dts/renesas/beacon-renesom-baseboard.dtsi index 2692cc64bff6..48e0c0494f6a 100644 --- a/arch/arm64/boot/dts/renesas/beacon-renesom-baseboard.dtsi +++ b/arch/arm64/boot/dts/renesas/beacon-renesom-baseboard.dtsi @@ -146,7 +146,7 @@ rgb_panel: endpoint { }; }; =20 - reg_audio: regulator_audio { + reg_audio: regulator-audio { compatible =3D "regulator-fixed"; regulator-name =3D "audio-1.8V"; regulator-min-microvolt =3D <1800000>; @@ -174,7 +174,7 @@ reg_lcd_reset: regulator-lcd-reset { vin-supply =3D <®_lcd>; }; =20 - reg_cam0: regulator_camera { + reg_cam0: regulator-cam0 { compatible =3D "regulator-fixed"; regulator-name =3D "reg_cam0"; regulator-min-microvolt =3D <1800000>; @@ -183,7 +183,7 @@ reg_cam0: regulator_camera { enable-active-high; }; =20 - reg_cam1: regulator_camera { + reg_cam1: regulator-cam1 { compatible =3D "regulator-fixed"; regulator-name =3D "reg_cam1"; regulator-min-microvolt =3D <1800000>; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69D75C00140 for ; Mon, 15 Aug 2022 18:37:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242613AbiHOSh2 (ORCPT ); Mon, 15 Aug 2022 14:37:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243881AbiHOSgB (ORCPT ); Mon, 15 Aug 2022 14:36:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 213D43B94C; Mon, 15 Aug 2022 11:22: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 08D41B8106E; Mon, 15 Aug 2022 18:22:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4EE55C433C1; Mon, 15 Aug 2022 18:22:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587770; bh=trG8oyJvYdJGnFL4oAnns9pnq+hwSnbarSZgSlzOSAQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=09wmNw6r1FqpYceGf+LN+hxQ2DzF0wgBSJxF4ARhfbpL2wij911t/rQjiK4220c0F vY4F/S4n3ZQlwOugIZfxo1CiVuW/L23iWgh70M+RJVENrPJSmRP2twgH7BMFki/8GJ xokTlcaxHmv8Fo50hJxocFYzCq/ydAg6ALlB5IWk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Mark Brown , Sasha Levin Subject: [PATCH 5.15 158/779] spi: spi-altera-dfl: Fix an error handling path Date: Mon, 15 Aug 2022 19:56:42 +0200 Message-Id: <20220815180344.099776694@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET [ Upstream commit 8e3ca32f46994e74b7f43c57731150b2aedb2630 ] The spi_alloc_master() call is not undone in all error handling paths. Moreover, there is no .remove function to release the allocated memory. In order to fix both this issues, switch to devm_spi_alloc_master(). This allows further simplification of the probe. Fixes: ba2fc167e944 ("spi: altera: Add DFL bus driver for Altera API Contro= ller") Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/0607bb59f4073f86abe5c585d35245aef0b045c6.16= 53805901.git.christophe.jaillet@wanadoo.fr Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/spi/spi-altera-dfl.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/spi/spi-altera-dfl.c b/drivers/spi/spi-altera-dfl.c index ca40923258af..596e181ae136 100644 --- a/drivers/spi/spi-altera-dfl.c +++ b/drivers/spi/spi-altera-dfl.c @@ -128,9 +128,9 @@ static int dfl_spi_altera_probe(struct dfl_device *dfl_= dev) struct spi_master *master; struct altera_spi *hw; void __iomem *base; - int err =3D -ENODEV; + int err; =20 - master =3D spi_alloc_master(dev, sizeof(struct altera_spi)); + master =3D devm_spi_alloc_master(dev, sizeof(struct altera_spi)); if (!master) return -ENOMEM; =20 @@ -159,10 +159,9 @@ static int dfl_spi_altera_probe(struct dfl_device *dfl= _dev) altera_spi_init_master(master); =20 err =3D devm_spi_register_master(dev, master); - if (err) { - dev_err(dev, "%s failed to register spi master %d\n", __func__, err); - goto exit; - } + if (err) + return dev_err_probe(dev, err, "%s failed to register spi master\n", + __func__); =20 if (dfl_dev->revision =3D=3D FME_FEATURE_REV_MAX10_SPI_N5010) strscpy(board_info.modalias, "m10-n5010", SPI_NAME_SIZE); @@ -179,9 +178,6 @@ static int dfl_spi_altera_probe(struct dfl_device *dfl_= dev) } =20 return 0; -exit: - spi_master_put(master); - return err; } =20 static const struct dfl_device_id dfl_spi_altera_ids[] =3D { --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B611C00140 for ; Mon, 15 Aug 2022 18:37:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243182AbiHOShb (ORCPT ); Mon, 15 Aug 2022 14:37:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243898AbiHOSgC (ORCPT ); Mon, 15 Aug 2022 14:36: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 96F2F3B960; Mon, 15 Aug 2022 11:22: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 2029DB80F99; Mon, 15 Aug 2022 18:22:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E422C433C1; Mon, 15 Aug 2022 18:22:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587773; bh=4za+avW1T/NnoFjLu6YyZVhW3X3P6uxrYzP7gGEKha0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O3uShlJNexBGSpRt1BD8sqKfWIkQwVmzN2sfDzvCf0oVADWeGcsXIeTiFw8btRSMR M1nhzsBf81vXlq2KBO5oKck/Cf4v2yZDs7Fg6Uo6Km4CyWcyvGBfKtOJ3KMpBtJftf p1ZXcmuIUMEm5OTVX4tKmgpxVBqD8/9bFEphxN+s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Florian Fainelli , Sasha Levin Subject: [PATCH 5.15 159/779] ARM: bcm: Fix refcount leak in bcm_kona_smc_init Date: Mon, 15 Aug 2022 19:56:43 +0200 Message-Id: <20220815180344.152497709@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit cb23389a2458c2e4bfd6c86a513cbbe1c4d35e76 ] of_find_matching_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: b8eb35fd594a ("ARM: bcm281xx: Add L2 cache enable code") Signed-off-by: Miaoqian Lin Signed-off-by: Florian Fainelli Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm/mach-bcm/bcm_kona_smc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-bcm/bcm_kona_smc.c b/arch/arm/mach-bcm/bcm_kona_= smc.c index 43829e49ad93..347bfb7f03e2 100644 --- a/arch/arm/mach-bcm/bcm_kona_smc.c +++ b/arch/arm/mach-bcm/bcm_kona_smc.c @@ -52,6 +52,7 @@ int __init bcm_kona_smc_init(void) return -ENODEV; =20 prop_val =3D of_get_address(node, 0, &prop_size, NULL); + of_node_put(node); if (!prop_val) return -EINVAL; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2361C00140 for ; Mon, 15 Aug 2022 18:37:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242796AbiHOShi (ORCPT ); Mon, 15 Aug 2022 14:37:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243951AbiHOSgJ (ORCPT ); Mon, 15 Aug 2022 14:36: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 11F0A2CDD6; Mon, 15 Aug 2022 11:22: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 860326068D; Mon, 15 Aug 2022 18:22:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78B05C433D6; Mon, 15 Aug 2022 18:22:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587776; bh=v4Z1h7wfywCJHIbiHuBe6xaT4pkVjjYSygQnkWebSFs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YDHPG5MgcdWU78/EEkAlD8Bo5NKl6/N/MBpolbSDCMtHtOJQm6+DYyDy+irtzuRrw tEnGxbOccwYPYjNKoYKUmUMZ/iJZMUkYG7wvl2c09XgKyBWAPX137DrOUncaEBmBpR PJy5VZNw6rG8pFtZtMGhhMTBsHyGn2jUgyNUPcPc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Guilherme G. Piccoli" , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.15 160/779] ACPI: processor/idle: Annotate more functions to live in cpuidle section Date: Mon, 15 Aug 2022 19:56:44 +0200 Message-Id: <20220815180344.182433607@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Guilherme G. Piccoli [ Upstream commit 409dfdcaffb266acfc1f33529a26b1443c9332d4 ] Commit 6727ad9e206c ("nmi_backtrace: generate one-line reports for idle cpu= s") introduced a new text section called cpuidle; with that, we have a mechanism to add idling functions in such section and skip them from nmi_backtrace output, since they're useless and potentially flooding for such report. Happens that inlining might cause some real idle functions to end-up outside of such section; this is currently the case of ACPI processor_idle driver; the functions acpi_idle_enter_* do inline acpi_idle_do_entry(), hence they stay out of the cpuidle section. Fix that by marking such functions to also live in the cpuidle section. Fixes: 6727ad9e206c ("nmi_backtrace: generate one-line reports for idle cpu= s") Signed-off-by: Guilherme G. Piccoli Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/acpi/processor_idle.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index aedcb92491f2..dc880dad2ade 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -604,7 +604,7 @@ static DEFINE_RAW_SPINLOCK(c3_lock); * @cx: Target state context * @index: index of target state */ -static int acpi_idle_enter_bm(struct cpuidle_driver *drv, +static int __cpuidle acpi_idle_enter_bm(struct cpuidle_driver *drv, struct acpi_processor *pr, struct acpi_processor_cx *cx, int index) @@ -661,7 +661,7 @@ static int acpi_idle_enter_bm(struct cpuidle_driver *dr= v, return index; } =20 -static int acpi_idle_enter(struct cpuidle_device *dev, +static int __cpuidle acpi_idle_enter(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index) { struct acpi_processor_cx *cx =3D per_cpu(acpi_cstate[index], dev->cpu); @@ -690,7 +690,7 @@ static int acpi_idle_enter(struct cpuidle_device *dev, return index; } =20 -static int acpi_idle_enter_s2idle(struct cpuidle_device *dev, +static int __cpuidle acpi_idle_enter_s2idle(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index) { struct acpi_processor_cx *cx =3D per_cpu(acpi_cstate[index], dev->cpu); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CBE2C00140 for ; Mon, 15 Aug 2022 18:39:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240609AbiHOSjs (ORCPT ); Mon, 15 Aug 2022 14:39:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243970AbiHOSgN (ORCPT ); Mon, 15 Aug 2022 14:36: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 EC5553C141; Mon, 15 Aug 2022 11:23: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 BC0BD606A1; Mon, 15 Aug 2022 18:23:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1260C433D6; Mon, 15 Aug 2022 18:22:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587780; bh=lwen1EgOL0WIJxndcyGGj6vv0zvik1mBKliZtD3eSSU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lqAMFYrLTS21/vaNGcd0+jCwJfFBl6rS7MZotvBO81kz5bGmMxQxovKgNTpIjgezA O6j6TGUu2e6XM4jWxT+D75J92wgO4VzJGSpU7tnrRv2OhYIouv6D5jrBSl3/D4nn9y VAfq7SiHdX3n81cOPwS0WdZZAbENbKudJ+tq6EZA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marcel Ziswiler , Shawn Guo , Sasha Levin Subject: [PATCH 5.15 161/779] ARM: dts: imx7d-colibri-emmc: add cpu1 supply Date: Mon, 15 Aug 2022 19:56:45 +0200 Message-Id: <20220815180344.217106397@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marcel Ziswiler [ Upstream commit ba28db60d34271e8a3cf4d7158d71607e8b1e57f ] Each cpu-core is supposed to list its supply separately, add supply for cpu1. Fixes: 2d7401f8632f ("ARM: dts: imx7d: Add cpu1 supply") Signed-off-by: Marcel Ziswiler Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm/boot/dts/imx7d-colibri-emmc.dtsi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/boot/dts/imx7d-colibri-emmc.dtsi b/arch/arm/boot/dts/= imx7d-colibri-emmc.dtsi index af39e5370fa1..045e4413d339 100644 --- a/arch/arm/boot/dts/imx7d-colibri-emmc.dtsi +++ b/arch/arm/boot/dts/imx7d-colibri-emmc.dtsi @@ -13,6 +13,10 @@ memory@80000000 { }; }; =20 +&cpu1 { + cpu-supply =3D <®_DCDC2>; +}; + &gpio6 { gpio-line-names =3D "", "", --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9025AC25B08 for ; Mon, 15 Aug 2022 18:37:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243229AbiHOShu (ORCPT ); Mon, 15 Aug 2022 14:37:50 -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 S244067AbiHOSgY (ORCPT ); Mon, 15 Aug 2022 14:36:24 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C100E2B19D; Mon, 15 Aug 2022 11:23: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 sin.source.kernel.org (Postfix) with ESMTPS id B216DCE125A; Mon, 15 Aug 2022 18:23:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C08D3C433D6; Mon, 15 Aug 2022 18:23:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587783; bh=9P7MEiVBGsWVET67F5QBV0U1bVBX8kpT0aqZ6IbsjDI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=blQBIIKuSWwIi1g11qALRxnd7LoPW1i1QGdiePUwHUTUzyxqZhWbJ16FpRxZHwfan yMXv2Nq1KP9eeAOblf8L9mIMxNaCHMZZFZE4PJS5gjr3kfPDF5TxtxRigmwpbLkyww ykxg8zg1STaWdT7OwvBkyiFDnJDiihUIEeFjtT64= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Renesas Vietnam via Yoshihiro Shimoda , Geert Uytterhoeven , Sasha Levin Subject: [PATCH 5.15 162/779] soc: renesas: r8a779a0-sysc: Fix A2DP1 and A2CV[2357] PDR values Date: Mon, 15 Aug 2022 19:56:46 +0200 Message-Id: <20220815180344.251302582@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 bccceabb92ce8eb78bbf2de08308e2cc2761a2e5 ] The PDR values for the A2DP1 and A2CV[2357] power areas on R-Car V3U are incorrect (copied-and-pasted from A2DP0 and A2CV[0146]). Fix them. Reported-by: Renesas Vietnam via Yoshihiro Shimoda Fixes: 1b4298f000064cc2 ("soc: renesas: r8a779a0-sysc: Add r8a779a0 support= ") Signed-off-by: Geert Uytterhoeven Link: https://lore.kernel.org/r/87bc2e70ba4082970cf8c65871beae4be3503189.16= 54696188.git.geert+renesas@glider.be Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/soc/renesas/r8a779a0-sysc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/soc/renesas/r8a779a0-sysc.c b/drivers/soc/renesas/r8a7= 79a0-sysc.c index 7410b9fa9846..7e1aba9abce2 100644 --- a/drivers/soc/renesas/r8a779a0-sysc.c +++ b/drivers/soc/renesas/r8a779a0-sysc.c @@ -83,11 +83,11 @@ static struct r8a779a0_sysc_area r8a779a0_areas[] __ini= tdata =3D { { "a2cv6", R8A779A0_PD_A2CV6, R8A779A0_PD_A3IR }, { "a2cn2", R8A779A0_PD_A2CN2, R8A779A0_PD_A3IR }, { "a2imp23", R8A779A0_PD_A2IMP23, R8A779A0_PD_A3IR }, - { "a2dp1", R8A779A0_PD_A2DP0, R8A779A0_PD_A3IR }, - { "a2cv2", R8A779A0_PD_A2CV0, R8A779A0_PD_A3IR }, - { "a2cv3", R8A779A0_PD_A2CV1, R8A779A0_PD_A3IR }, - { "a2cv5", R8A779A0_PD_A2CV4, R8A779A0_PD_A3IR }, - { "a2cv7", R8A779A0_PD_A2CV6, R8A779A0_PD_A3IR }, + { "a2dp1", R8A779A0_PD_A2DP1, R8A779A0_PD_A3IR }, + { "a2cv2", R8A779A0_PD_A2CV2, R8A779A0_PD_A3IR }, + { "a2cv3", R8A779A0_PD_A2CV3, R8A779A0_PD_A3IR }, + { "a2cv5", R8A779A0_PD_A2CV5, R8A779A0_PD_A3IR }, + { "a2cv7", R8A779A0_PD_A2CV7, R8A779A0_PD_A3IR }, { "a2cn1", R8A779A0_PD_A2CN1, R8A779A0_PD_A3IR }, { "a1cnn0", R8A779A0_PD_A1CNN0, R8A779A0_PD_A2CN0 }, { "a1cnn2", R8A779A0_PD_A1CNN2, R8A779A0_PD_A2CN2 }, --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDCCAC00140 for ; Mon, 15 Aug 2022 18:32:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243483AbiHOSci (ORCPT ); Mon, 15 Aug 2022 14:32:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242426AbiHOSbi (ORCPT ); Mon, 15 Aug 2022 14:31: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 56DA43340D; Mon, 15 Aug 2022 11:21: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 B085A60BE9; Mon, 15 Aug 2022 18:21:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75EF6C433C1; Mon, 15 Aug 2022 18:21:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587685; bh=GvM3E+AZZX7lYhFn5NiVlC4zztilrefSRbhsRU5CcIM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kxdR84Ookw3ZBT8NAk/2sUiYH9U2A6rTCsZ+1qDNtDRVM2oE6FvK+OlfuPMS3X/zo 6/1yOMhxjwG/Shn7JZo/xDBzDVpTru5Sy7fUeYiWJe1X3Lb2hjPAAukFSORGKB25oM Q1bvAZ0pN/h+dAbVAFm9Df08oF0oTzzDGWDpQGa0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiang Chen , John Garry , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.15 163/779] scsi: hisi_sas: Use managed PCI functions Date: Mon, 15 Aug 2022 19:56:47 +0200 Message-Id: <20220815180344.291473149@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 4f6094f1663e2ed26a940f1842cdaa15c1dd649a ] Use managed PCI functions such as pcim_enable_device() and pcim_iomap_regions() to simplify exception handling code. Link: https://lore.kernel.org/r/1629799260-120116-2-git-send-email-john.gar= ry@huawei.com Signed-off-by: Xiang Chen Signed-off-by: John Garry Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c b/drivers/scsi/hisi_sas= /hisi_sas_v3_hw.c index 15c7451fb30f..fa22cb712be5 100644 --- a/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +++ b/drivers/scsi/hisi_sas/hisi_sas_v3_hw.c @@ -518,6 +518,8 @@ struct hisi_sas_err_record_v3 { #define CHNL_INT_STS_INT2_MSK BIT(3) #define CHNL_WIDTH 4 =20 +#define BAR_NO_V3_HW 5 + enum { DSM_FUNC_ERR_HANDLE_MSI =3D 0, }; @@ -4740,15 +4742,15 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struc= t pci_device_id *id) struct sas_ha_struct *sha; int rc, phy_nr, port_nr, i; =20 - rc =3D pci_enable_device(pdev); + rc =3D pcim_enable_device(pdev); if (rc) goto err_out; =20 pci_set_master(pdev); =20 - rc =3D pci_request_regions(pdev, DRV_NAME); + rc =3D pcim_iomap_regions(pdev, 1 << BAR_NO_V3_HW, DRV_NAME); if (rc) - goto err_out_disable_device; + goto err_out; =20 rc =3D dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); if (rc) @@ -4756,20 +4758,20 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struc= t pci_device_id *id) if (rc) { dev_err(dev, "No usable DMA addressing method\n"); rc =3D -ENODEV; - goto err_out_regions; + goto err_out; } =20 shost =3D hisi_sas_shost_alloc_pci(pdev); if (!shost) { rc =3D -ENOMEM; - goto err_out_regions; + goto err_out; } =20 sha =3D SHOST_TO_SAS_HA(shost); hisi_hba =3D shost_priv(shost); dev_set_drvdata(dev, sha); =20 - hisi_hba->regs =3D pcim_iomap(pdev, 5, 0); + hisi_hba->regs =3D pcim_iomap_table(pdev)[BAR_NO_V3_HW]; if (!hisi_hba->regs) { dev_err(dev, "cannot map register\n"); rc =3D -ENOMEM; @@ -4861,10 +4863,6 @@ hisi_sas_v3_probe(struct pci_dev *pdev, const struct= pci_device_id *id) err_out_ha: hisi_sas_free(hisi_hba); scsi_host_put(shost); -err_out_regions: - pci_release_regions(pdev); -err_out_disable_device: - pci_disable_device(pdev); err_out: return rc; } @@ -4901,8 +4899,6 @@ static void hisi_sas_v3_remove(struct pci_dev *pdev) sas_remove_host(sha->core.shost); =20 hisi_sas_v3_destroy_irqs(pdev, hisi_hba); - pci_release_regions(pdev); - pci_disable_device(pdev); hisi_sas_free(hisi_hba); debugfs_exit_v3_hw(hisi_hba); scsi_host_put(shost); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5ED0C25B08 for ; Mon, 15 Aug 2022 18:33:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231665AbiHOSdh (ORCPT ); Mon, 15 Aug 2022 14:33:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242509AbiHOSdB (ORCPT ); Mon, 15 Aug 2022 14:33:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6AD9357C8; Mon, 15 Aug 2022 11:21: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 BE21460EBB; Mon, 15 Aug 2022 18:21:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC313C433C1; Mon, 15 Aug 2022 18:21:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587688; bh=qPM3hivwiyH/84iQwMJ7ypF9tf8CVifjS41QNQiOQD8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1NEGbYZP2Wnx0e4OQY7IqIN8vKkxBUtV7WaYp9rLo293Z569zgI5b+3ZBX7znYlee dVGN91X+2BBALQpLyUnyMbvsZwsczMcFJm785+lioivsLHkUGiyrNCaXUW6V/Qw2yy N3hVz0G2XK+N9xdlfgRIf9mJU2WvC1VT9bAZl5hg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Puranjay Mohan , Rob Herring , Jonathan Cameron , Sasha Levin Subject: [PATCH 5.15 164/779] dt-bindings: iio: accel: Add DT binding doc for ADXL355 Date: Mon, 15 Aug 2022 19:56:48 +0200 Message-Id: <20220815180344.333074112@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Puranjay Mohan [ Upstream commit bf43a71a0a7f396434f6460b46e33eb00752f78d ] Add devicetree binding document for ADXL355, a 3-Axis MEMS Accelerometer. Signed-off-by: Puranjay Mohan Reviewed-by: Rob Herring Link: https://lore.kernel.org/r/20210811073027.124619-2-puranjay12@gmail.com Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- .../bindings/iio/accel/adi,adxl355.yaml | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/accel/adi,adxl355= .yaml diff --git a/Documentation/devicetree/bindings/iio/accel/adi,adxl355.yaml b= /Documentation/devicetree/bindings/iio/accel/adi,adxl355.yaml new file mode 100644 index 000000000000..ba54d6998f2e --- /dev/null +++ b/Documentation/devicetree/bindings/iio/accel/adi,adxl355.yaml @@ -0,0 +1,88 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/accel/adi,adxl355.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Analog Devices ADXL355 3-Axis, Low noise MEMS Accelerometer + +maintainers: + - Puranjay Mohan + +description: | + Analog Devices ADXL355 3-Axis, Low noise MEMS Accelerometer that supports + both I2C & SPI interfaces + https://www.analog.com/en/products/adxl355.html + +properties: + compatible: + enum: + - adi,adxl355 + + reg: + maxItems: 1 + + interrupts: + minItems: 1 + maxItems: 3 + description: | + Type for DRDY should be IRQ_TYPE_EDGE_RISING. + Three configurable interrupt lines exist. + + interrupt-names: + description: Specify which interrupt line is in use. + items: + enum: + - INT1 + - INT2 + - DRDY + minItems: 1 + maxItems: 3 + + vdd-supply: + description: Regulator that provides power to the sensor + + vddio-supply: + description: Regulator that provides power to the bus + + spi-max-frequency: true + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + #include + #include + i2c { + #address-cells =3D <1>; + #size-cells =3D <0>; + + /* Example for a I2C device node */ + accelerometer@1d { + compatible =3D "adi,adxl355"; + reg =3D <0x1d>; + interrupt-parent =3D <&gpio>; + interrupts =3D <25 IRQ_TYPE_EDGE_RISING>; + interrupt-names =3D "DRDY"; + }; + }; + - | + #include + #include + spi { + #address-cells =3D <1>; + #size-cells =3D <0>; + + accelerometer@0 { + compatible =3D "adi,adxl355"; + reg =3D <0>; + spi-max-frequency =3D <1000000>; + interrupt-parent =3D <&gpio>; + interrupts =3D <25 IRQ_TYPE_EDGE_RISING>; + interrupt-names =3D "DRDY"; + }; + }; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D3EEC3F6B0 for ; Mon, 15 Aug 2022 18:33:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243423AbiHOSdM (ORCPT ); Mon, 15 Aug 2022 14:33:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232274AbiHOScZ (ORCPT ); Mon, 15 Aug 2022 14:32: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 A1EA333A27; Mon, 15 Aug 2022 11:21:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B2F9360F1D; Mon, 15 Aug 2022 18:21:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD930C433C1; Mon, 15 Aug 2022 18:21:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587691; bh=S0URyn00AsjmOCVSf0xzz3DBx1yha/NWx8pddDfWzRs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ElkqmxlXEHZZ/P0Y5szVgTBU7lH2dYoiI0NGVHDxSbNvrXNnrv/G18ESNBzLKMwhs mn5CWSuCguy1jquzXpG1Rf5T9CDAN5smFA0YiK9vpLaoc1Qbgz1NLWPESpG2jHGvia CsCIhdalkh4xrUKwr4SykaOFSvRzhlLP4CKu12NM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Martin Blumenstingl , Neil Armstrong , Sasha Levin Subject: [PATCH 5.15 165/779] soc: amlogic: Fix refcount leak in meson-secure-pwrc.c Date: Mon, 15 Aug 2022 19:56:49 +0200 Message-Id: <20220815180344.375939543@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit d18529a4c12f66d83daac78045ea54063bd43257 ] In meson_secure_pwrc_probe(), there is a refcount leak in one fail path. Signed-off-by: Liang He Acked-by: Martin Blumenstingl Fixes: b3dde5013e13 ("soc: amlogic: Add support for Secure power domains co= ntroller") Reviewed-by: Neil Armstrong Signed-off-by: Neil Armstrong Link: https://lore.kernel.org/r/20220616144915.3988071-1-windhl@126.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/soc/amlogic/meson-secure-pwrc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/soc/amlogic/meson-secure-pwrc.c b/drivers/soc/amlogic/= meson-secure-pwrc.c index 59bd195fa9c9..2eeea5e1b3b7 100644 --- a/drivers/soc/amlogic/meson-secure-pwrc.c +++ b/drivers/soc/amlogic/meson-secure-pwrc.c @@ -139,8 +139,10 @@ static int meson_secure_pwrc_probe(struct platform_dev= ice *pdev) } =20 pwrc =3D devm_kzalloc(&pdev->dev, sizeof(*pwrc), GFP_KERNEL); - if (!pwrc) + if (!pwrc) { + of_node_put(sm_np); return -ENOMEM; + } =20 pwrc->fw =3D meson_sm_get(sm_np); of_node_put(sm_np); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB88CC00140 for ; Mon, 15 Aug 2022 18:33:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243594AbiHOSdO (ORCPT ); Mon, 15 Aug 2022 14:33:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243419AbiHOSc1 (ORCPT ); Mon, 15 Aug 2022 14:32:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D5CB33A3B; Mon, 15 Aug 2022 11:21: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 D663F60EF0; Mon, 15 Aug 2022 18:21:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E851EC433D6; Mon, 15 Aug 2022 18:21:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587694; bh=S2ObVKAk2Czmdwa90vDdbeK7xcB/HLGSbOYkdyJRyPs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GamRk8ksFtHBWDKJ1l35/pmBLHrEltief518zVJo1ULUfotoe8fSOG4FyfG/IsrRy B/Jjrhqi0FAPThfLttjeqpJs0Ct3l9qyZYxo84E+E6T1CgRUazfznfvUc+/6AI/Z9o vHRKfYgkaLKJ6AFPabz/lA9ak/DmN73ZmmcLp+v0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Sasha Levin Subject: [PATCH 5.15 166/779] arm64: dts: renesas: Fix thermal-sensors on single-zone sensors Date: Mon, 15 Aug 2022 19:56:50 +0200 Message-Id: <20220815180344.417750555@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Geert Uytterhoeven [ Upstream commit 62e8a53431145e06e503b71625a34eaa87b72b2c ] "make dtbs_check": arch/arm64/boot/dts/renesas/r8a774c0-cat874.dtb: thermal-zones: cpu-the= rmal:thermal-sensors: [[74], [0]] is too long arch/arm64/boot/dts/renesas/r8a774c0-ek874.dtb: thermal-zones: cpu-ther= mal:thermal-sensors: [[79], [0]] is too long arch/arm64/boot/dts/renesas/r8a774c0-ek874-idk-2121wr.dtb: thermal-zone= s: cpu-thermal:thermal-sensors: [[82], [0]] is too long arch/arm64/boot/dts/renesas/r8a774c0-ek874-mipi-2.1.dtb: thermal-zones:= cpu-thermal:thermal-sensors: [[87], [0]] is too long arch/arm64/boot/dts/renesas/r8a77990-ebisu.dtb: thermal-zones: cpu-ther= mal:thermal-sensors: [[105], [0]] is too long From schema: Documentation/devicetree/bindings/thermal/thermal-zones.y= aml Indeed, the thermal sensors on R-Car E3 and RZ/G2E support only a single zone, hence #thermal-sensor-cells =3D <0>. Fix this by dropping the bogus zero cell from the thermal sensor specifiers. Fixes: 8fa7d18f9ee2dc20 ("arm64: dts: renesas: r8a77990: Create thermal zon= e to support IPA") Fixes: 8438bfda9d768157 ("arm64: dts: renesas: r8a774c0: Create thermal zon= e to support IPA") Signed-off-by: Geert Uytterhoeven Reviewed-by: Niklas S=C3=B6derlund Link: https://lore.kernel.org/r/28b812fdd1fc3698311fac984ab8b91d3d655c1c.16= 55301684.git.geert+renesas@glider.be Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm64/boot/dts/renesas/r8a774c0.dtsi | 2 +- arch/arm64/boot/dts/renesas/r8a77990.dtsi | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/renesas/r8a774c0.dtsi b/arch/arm64/boot/dt= s/renesas/r8a774c0.dtsi index d597772c4c37..9eb08be3b98e 100644 --- a/arch/arm64/boot/dts/renesas/r8a774c0.dtsi +++ b/arch/arm64/boot/dts/renesas/r8a774c0.dtsi @@ -1953,7 +1953,7 @@ thermal-zones { cpu-thermal { polling-delay-passive =3D <250>; polling-delay =3D <0>; - thermal-sensors =3D <&thermal 0>; + thermal-sensors =3D <&thermal>; sustainable-power =3D <717>; =20 cooling-maps { diff --git a/arch/arm64/boot/dts/renesas/r8a77990.dtsi b/arch/arm64/boot/dt= s/renesas/r8a77990.dtsi index 0ea300a8147d..9e616b0f04d4 100644 --- a/arch/arm64/boot/dts/renesas/r8a77990.dtsi +++ b/arch/arm64/boot/dts/renesas/r8a77990.dtsi @@ -2102,7 +2102,7 @@ thermal-zones { cpu-thermal { polling-delay-passive =3D <250>; polling-delay =3D <0>; - thermal-sensors =3D <&thermal 0>; + thermal-sensors =3D <&thermal>; sustainable-power =3D <717>; =20 cooling-maps { --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B7F9C00140 for ; Mon, 15 Aug 2022 18:33:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243545AbiHOSd1 (ORCPT ); Mon, 15 Aug 2022 14:33:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243219AbiHOSc4 (ORCPT ); Mon, 15 Aug 2022 14:32: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 71D2E33E37; Mon, 15 Aug 2022 11:21: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 2ABAE60BE9; Mon, 15 Aug 2022 18:21:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05DC8C433C1; Mon, 15 Aug 2022 18:21:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587697; bh=r8VC5k8yCnxrmhJJjc40MMt9lv8g2qFUnZotxUDIYhk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LzmJXVjeNWbCu0SuAShLhr9x248fRklJTVXiBlpa2sPplXjUPv7ljUVKRGyKPL9EK NLmG2EYBml2ilfgSjTZkIa9PVxlXJprkFPgoeaPP+Tm0rMX1a4jngBWwinfcmmUzp2 B0HJUmBKDasGTl1qEQ4tP4ow2JfelcK0iOnL4rXA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Borislav Petkov , Sasha Levin Subject: [PATCH 5.15 167/779] x86/pmem: Fix platform-device leak in error path Date: Mon, 15 Aug 2022 19:56:51 +0200 Message-Id: <20220815180344.455772383@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 [ Upstream commit 229e73d46994f15314f58b2d39bf952111d89193 ] Make sure to free the platform device in the unlikely event that registration fails. Fixes: 7a67832c7e44 ("libnvdimm, e820: make CONFIG_X86_PMEM_LEGACY a trista= te option") Signed-off-by: Johan Hovold Signed-off-by: Borislav Petkov Link: https://lore.kernel.org/r/20220620140723.9810-1-johan@kernel.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/x86/kernel/pmem.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/pmem.c b/arch/x86/kernel/pmem.c index 6b07faaa1579..23154d24b117 100644 --- a/arch/x86/kernel/pmem.c +++ b/arch/x86/kernel/pmem.c @@ -27,6 +27,11 @@ static __init int register_e820_pmem(void) * simply here to trigger the module to load on demand. */ pdev =3D platform_device_alloc("e820_pmem", -1); - return platform_device_add(pdev); + + rc =3D platform_device_add(pdev); + if (rc) + platform_device_put(pdev); + + return rc; } device_initcall(register_e820_pmem); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86E26C00140 for ; Mon, 15 Aug 2022 18:33:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243399AbiHOSdf (ORCPT ); Mon, 15 Aug 2022 14:33:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243293AbiHOSdC (ORCPT ); Mon, 15 Aug 2022 14:33:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EE57357C6; Mon, 15 Aug 2022 11:21: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 2CB0C60F18; Mon, 15 Aug 2022 18:21:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30A2DC433C1; Mon, 15 Aug 2022 18:21:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587700; bh=mBoLFm9NwPRE3ZpSE3rj81+UytlL97KQIUPsRFMbypc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WLrjSHkmKNlRiG0Is1eSN/39OoWCK6DqMT+1S/S4L16Nqk1D8JStmCC4D8PUCpx// iEX4uDWPdKdlAR9zRuz/cSIirXurF6L6QA70lNjIsNRChj79D+1Lf0FpEBGwC/zKhQ GDCLJzTnYERl60wFtJBG6arC7FJ6Jx28o6VToMBM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Sasha Levin Subject: [PATCH 5.15 168/779] ARM: dts: ast2500-evb: fix board compatible Date: Mon, 15 Aug 2022 19:56:52 +0200 Message-Id: <20220815180344.487161305@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 30b276fca5c0644f3cb17bceb1bd6a626c670184 ] The AST2500 EVB board should have dedicated compatible. Fixes: 02440622656d ("arm/dst: Add Aspeed ast2500 device tree") Signed-off-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220529104928.79636-4-krzysztof.kozlowski@= linaro.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm/boot/dts/aspeed-ast2500-evb.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/aspeed-ast2500-evb.dts b/arch/arm/boot/dts/a= speed-ast2500-evb.dts index 1d24b394ea4c..a497dd135491 100644 --- a/arch/arm/boot/dts/aspeed-ast2500-evb.dts +++ b/arch/arm/boot/dts/aspeed-ast2500-evb.dts @@ -5,7 +5,7 @@ =20 / { model =3D "AST2500 EVB"; - compatible =3D "aspeed,ast2500"; + compatible =3D "aspeed,ast2500-evb", "aspeed,ast2500"; =20 aliases { serial4 =3D &uart5; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7C3CC00140 for ; Mon, 15 Aug 2022 18:34:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243622AbiHOSeD (ORCPT ); Mon, 15 Aug 2022 14:34:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243556AbiHOSd2 (ORCPT ); Mon, 15 Aug 2022 14:33:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1A1B371AE; Mon, 15 Aug 2022 11:21: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 20A2D6068D; Mon, 15 Aug 2022 18:21:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25E40C433D7; Mon, 15 Aug 2022 18:21:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587703; bh=PvEgT27PxhUo4qWQYi1aKmUFsTOeY/X7J4jMRxHhYQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KzdJezG5RnVFzZuek6xRL46USfsKf0TuCa9kouCUHyCzCHDQ+T7Ks1QyqvtfqVvNW uldEdqdt3KQACxFEIyBNg6Uxdy5CfNeA1Qx9pFJj4+abdUIyWXWnpFe+BGmEzY20pT s0yXMKMPqb3vSYqJPd9z4NlBvR33G4PzIY1EmW8Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Sasha Levin Subject: [PATCH 5.15 169/779] ARM: dts: ast2600-evb: fix board compatible Date: Mon, 15 Aug 2022 19:56:53 +0200 Message-Id: <20220815180344.527133854@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 aa5e06208500a0db41473caebdee5a2e81d5a277 ] The AST2600 EVB board should have dedicated compatible. Fixes: 2ca5646b5c2f ("ARM: dts: aspeed: Add AST2600 and EVB") Signed-off-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220529104928.79636-5-krzysztof.kozlowski@= linaro.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm/boot/dts/aspeed-ast2600-evb.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/aspeed-ast2600-evb.dts b/arch/arm/boot/dts/a= speed-ast2600-evb.dts index 788448cdd6b3..b8e55bf167aa 100644 --- a/arch/arm/boot/dts/aspeed-ast2600-evb.dts +++ b/arch/arm/boot/dts/aspeed-ast2600-evb.dts @@ -8,7 +8,7 @@ =20 / { model =3D "AST2600 EVB"; - compatible =3D "aspeed,ast2600"; + compatible =3D "aspeed,ast2600-evb-a1", "aspeed,ast2600"; =20 aliases { serial4 =3D &uart5; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 686F7C25B08 for ; Mon, 15 Aug 2022 18:34:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243661AbiHOSeS (ORCPT ); Mon, 15 Aug 2022 14:34:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243447AbiHOSdq (ORCPT ); Mon, 15 Aug 2022 14:33:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC45737F89; Mon, 15 Aug 2022 11:21: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 E7C8BB81077; Mon, 15 Aug 2022 18:21:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39671C433D6; Mon, 15 Aug 2022 18:21:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587706; bh=jztBd4sZFkZnnNSyY7Gg8qvaMjbW9hiYtsi5arzlBw8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S2dma+NFo9i8g/R723tyEYRz9Qc+1QreFaghzsgP/4/Wb8lAgws5r3sGxUt+qCEtO z6O9SdQC4+BP2vc3z6LVQUBfqVYGD/8LNZbs1M2Uim3Bs2Vw7rTdeSaQOiSCQq+cfm 16peJip5eGYVZkLP9C2DOgoPDZ5Bcq7e4XMayhts= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Sasha Levin Subject: [PATCH 5.15 170/779] ARM: dts: ast2600-evb-a1: fix board compatible Date: Mon, 15 Aug 2022 19:56:54 +0200 Message-Id: <20220815180344.576488181@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 33c39140cc298e0d4e36083cb9a665a837773a60 ] The AST2600 EVB A1 board should have dedicated compatible. Fixes: a72955180372 ("ARM: dts: aspeed: ast2600evb: Add dts file for A1 and= A0") Signed-off-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220529104928.79636-6-krzysztof.kozlowski@= linaro.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm/boot/dts/aspeed-ast2600-evb-a1.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/aspeed-ast2600-evb-a1.dts b/arch/arm/boot/dt= s/aspeed-ast2600-evb-a1.dts index dd7148060c4a..d0a5c2ff0fec 100644 --- a/arch/arm/boot/dts/aspeed-ast2600-evb-a1.dts +++ b/arch/arm/boot/dts/aspeed-ast2600-evb-a1.dts @@ -5,6 +5,7 @@ =20 / { model =3D "AST2600 A1 EVB"; + compatible =3D "aspeed,ast2600-evb-a1", "aspeed,ast2600"; =20 /delete-node/regulator-vcc-sdhci0; /delete-node/regulator-vcc-sdhci1; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0888AC25B0E for ; Mon, 15 Aug 2022 18:34:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243640AbiHOSd6 (ORCPT ); Mon, 15 Aug 2022 14:33:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243219AbiHOSd1 (ORCPT ); Mon, 15 Aug 2022 14:33:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF86D3719F; Mon, 15 Aug 2022 11:21: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 905A160693; Mon, 15 Aug 2022 18:21:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E48EC433D6; Mon, 15 Aug 2022 18:21:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587710; bh=fS200tmG1/qu40YRV2CzAxh546mfr79e1vNI/1oiZX8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c2kWeJ1mr3W6kEo0S48+4ltOAuhOSDQebeYpH7bzRINPuTl7+7UoIlPumjPUR2OOW SH/7NsQG4uBLOffZV/jD0qblSyFCm1j1vdM3xQ1286MaUAsYSt8vFpQohQX2MjBShI 4yBG1moSjY2TeI01frPCVdWLbEKpPB3VQ0cQx1nU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "=?UTF-8?q?N=C3=ADcolas=20F . =20R . =20A . =20Prado?=" , AngeloGioacchino Del Regno , Matthias Brugger , Sasha Levin Subject: [PATCH 5.15 171/779] arm64: dts: mt8192: Fix idle-states nodes naming scheme Date: Mon, 15 Aug 2022 19:56:55 +0200 Message-Id: <20220815180344.607206440@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: N=C3=ADcolas F. R. A. Prado [ Upstream commit 399e23ad51caaf62400a531c9268ad3c453c3d76 ] Tweak the name of the idle-states subnodes so that they follow the binding pattern, getting rid of dtbs_check warnings. Only the usage of "-" in the name was necessary, but "off" was also exchanged for "sleep" since that seems to be a more common wording in other dts files. Fixes: 9260918d3a4f ("arm64: dts: mt8192: Add cpu-idle-states") Signed-off-by: N=C3=ADcolas F. R. A. Prado Reviewed-by: AngeloGioacchino Del Regno Link: https://lore.kernel.org/r/20220617233150.2466344-2-nfraprado@collabor= a.com Signed-off-by: Matthias Brugger Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm64/boot/dts/mediatek/mt8192.dtsi | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/arch/arm64/boot/dts/mediatek/mt8192.dtsi b/arch/arm64/boot/dts= /mediatek/mt8192.dtsi index cb1e46d2c1ba..a57ac5163acc 100644 --- a/arch/arm64/boot/dts/mediatek/mt8192.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8192.dtsi @@ -39,7 +39,7 @@ cpu0: cpu@0 { reg =3D <0x000>; enable-method =3D "psci"; clock-frequency =3D <1701000000>; - cpu-idle-states =3D <&cpuoff_l &clusteroff_l>; + cpu-idle-states =3D <&cpu_sleep_l &cluster_sleep_l>; next-level-cache =3D <&l2_0>; capacity-dmips-mhz =3D <530>; }; @@ -50,7 +50,7 @@ cpu1: cpu@100 { reg =3D <0x100>; enable-method =3D "psci"; clock-frequency =3D <1701000000>; - cpu-idle-states =3D <&cpuoff_l &clusteroff_l>; + cpu-idle-states =3D <&cpu_sleep_l &cluster_sleep_l>; next-level-cache =3D <&l2_0>; capacity-dmips-mhz =3D <530>; }; @@ -61,7 +61,7 @@ cpu2: cpu@200 { reg =3D <0x200>; enable-method =3D "psci"; clock-frequency =3D <1701000000>; - cpu-idle-states =3D <&cpuoff_l &clusteroff_l>; + cpu-idle-states =3D <&cpu_sleep_l &cluster_sleep_l>; next-level-cache =3D <&l2_0>; capacity-dmips-mhz =3D <530>; }; @@ -72,7 +72,7 @@ cpu3: cpu@300 { reg =3D <0x300>; enable-method =3D "psci"; clock-frequency =3D <1701000000>; - cpu-idle-states =3D <&cpuoff_l &clusteroff_l>; + cpu-idle-states =3D <&cpu_sleep_l &cluster_sleep_l>; next-level-cache =3D <&l2_0>; capacity-dmips-mhz =3D <530>; }; @@ -83,7 +83,7 @@ cpu4: cpu@400 { reg =3D <0x400>; enable-method =3D "psci"; clock-frequency =3D <2171000000>; - cpu-idle-states =3D <&cpuoff_b &clusteroff_b>; + cpu-idle-states =3D <&cpu_sleep_b &cluster_sleep_b>; next-level-cache =3D <&l2_1>; capacity-dmips-mhz =3D <1024>; }; @@ -94,7 +94,7 @@ cpu5: cpu@500 { reg =3D <0x500>; enable-method =3D "psci"; clock-frequency =3D <2171000000>; - cpu-idle-states =3D <&cpuoff_b &clusteroff_b>; + cpu-idle-states =3D <&cpu_sleep_b &cluster_sleep_b>; next-level-cache =3D <&l2_1>; capacity-dmips-mhz =3D <1024>; }; @@ -105,7 +105,7 @@ cpu6: cpu@600 { reg =3D <0x600>; enable-method =3D "psci"; clock-frequency =3D <2171000000>; - cpu-idle-states =3D <&cpuoff_b &clusteroff_b>; + cpu-idle-states =3D <&cpu_sleep_b &cluster_sleep_b>; next-level-cache =3D <&l2_1>; capacity-dmips-mhz =3D <1024>; }; @@ -116,7 +116,7 @@ cpu7: cpu@700 { reg =3D <0x700>; enable-method =3D "psci"; clock-frequency =3D <2171000000>; - cpu-idle-states =3D <&cpuoff_b &clusteroff_b>; + cpu-idle-states =3D <&cpu_sleep_b &cluster_sleep_b>; next-level-cache =3D <&l2_1>; capacity-dmips-mhz =3D <1024>; }; @@ -169,7 +169,7 @@ l3_0: l3-cache { =20 idle-states { entry-method =3D "arm,psci"; - cpuoff_l: cpuoff_l { + cpu_sleep_l: cpu-sleep-l { compatible =3D "arm,idle-state"; arm,psci-suspend-param =3D <0x00010001>; local-timer-stop; @@ -177,7 +177,7 @@ cpuoff_l: cpuoff_l { exit-latency-us =3D <140>; min-residency-us =3D <780>; }; - cpuoff_b: cpuoff_b { + cpu_sleep_b: cpu-sleep-b { compatible =3D "arm,idle-state"; arm,psci-suspend-param =3D <0x00010001>; local-timer-stop; @@ -185,7 +185,7 @@ cpuoff_b: cpuoff_b { exit-latency-us =3D <145>; min-residency-us =3D <720>; }; - clusteroff_l: clusteroff_l { + cluster_sleep_l: cluster-sleep-l { compatible =3D "arm,idle-state"; arm,psci-suspend-param =3D <0x01010002>; local-timer-stop; @@ -193,7 +193,7 @@ clusteroff_l: clusteroff_l { exit-latency-us =3D <155>; min-residency-us =3D <860>; }; - clusteroff_b: clusteroff_b { + cluster_sleep_b: cluster-sleep-b { compatible =3D "arm,idle-state"; arm,psci-suspend-param =3D <0x01010002>; local-timer-stop; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2FFEEC00140 for ; Mon, 15 Aug 2022 18:34:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243650AbiHOSeG (ORCPT ); Mon, 15 Aug 2022 14:34:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243384AbiHOSda (ORCPT ); Mon, 15 Aug 2022 14:33: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 DE24437F81; Mon, 15 Aug 2022 11:21:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E9CED60F1D; Mon, 15 Aug 2022 18:21:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAC0BC433C1; Mon, 15 Aug 2022 18:21:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587713; bh=ERQwP8uKDUfGNJbBFJ0TAgA9TP/S/fhReXq7rTHMIb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oAdHwRHJpfFXM69Kl30MLWUB+Rqa7hVt26ecAakelUkoZS6ZSuWCyTZcIq56qQaA3 qGKi2oN+CAMl7JxiHQHBDt7OcZAot3PTFS0LSCPHboe2GL0Ey7jsTMACZlp8cI1lrM mkpUC4qpN6qlfFgTixWEA3j8Y0mVVEDIF/+ObDyU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "=?UTF-8?q?N=C3=ADcolas=20F . =20R . =20A . =20Prado?=" , AngeloGioacchino Del Regno , Matthias Brugger , Sasha Levin Subject: [PATCH 5.15 172/779] arm64: dts: mt8192: Fix idle-states entry-method Date: Mon, 15 Aug 2022 19:56:56 +0200 Message-Id: <20220815180344.637976650@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: N=C3=ADcolas F. R. A. Prado [ Upstream commit 2e599740f7e423ee89fb027896cb2635dd43784f ] The entry-method property of the idle-states node should be "psci" as described in the idle-states binding, since this is already the value of enable-method in the CPU nodes. Fix it to get rid of a dtbs_check warning. Fixes: 9260918d3a4f ("arm64: dts: mt8192: Add cpu-idle-states") Signed-off-by: N=C3=ADcolas F. R. A. Prado Reviewed-by: AngeloGioacchino Del Regno Link: https://lore.kernel.org/r/20220617233150.2466344-3-nfraprado@collabor= a.com Signed-off-by: Matthias Brugger Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm64/boot/dts/mediatek/mt8192.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/mediatek/mt8192.dtsi b/arch/arm64/boot/dts= /mediatek/mt8192.dtsi index a57ac5163acc..d1e63527b387 100644 --- a/arch/arm64/boot/dts/mediatek/mt8192.dtsi +++ b/arch/arm64/boot/dts/mediatek/mt8192.dtsi @@ -168,7 +168,7 @@ l3_0: l3-cache { }; =20 idle-states { - entry-method =3D "arm,psci"; + entry-method =3D "psci"; cpu_sleep_l: cpu-sleep-l { compatible =3D "arm,idle-state"; arm,psci-suspend-param =3D <0x00010001>; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD497C3F6B0 for ; Mon, 15 Aug 2022 18:35:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243597AbiHOSfB (ORCPT ); Mon, 15 Aug 2022 14:35:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243664AbiHOSeX (ORCPT ); Mon, 15 Aug 2022 14:34:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89D8939B8F; Mon, 15 Aug 2022 11:22: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 73DBCB81076; Mon, 15 Aug 2022 18:22:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE581C433C1; Mon, 15 Aug 2022 18:21:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587720; bh=02E383OmiWKM+HADAt3wDI/gk5J/EAdAFr+Z9nMZh6o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rSiTsycRwJ8vnlQGP2P5qe6GWgawa5uk0qEsgl81sSWpk1a+FN8k67Mc5IkBhnAeE huPDwlM7oI5kUGUAMqE2nYOev7BhAw3FL2RxnHeE6WRI4Fv/44wvupi2Mg9s6w3Nyn 5sHR3h/ZzYqvDZnqINFY4WpnEhwb5yqx2MaehGSA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Rutland , Catalin Marinas , Ingo Molnar , "Peter Zijlstra (Intel)" , Thomas Gleixner , Will Deacon , Sasha Levin Subject: [PATCH 5.15 173/779] arm64: select TRACE_IRQFLAGS_NMI_SUPPORT Date: Mon, 15 Aug 2022 19:56:57 +0200 Message-Id: <20220815180344.683632812@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mark Rutland [ Upstream commit 3381da254fab37ba08c4b7c4f19b4ee28b1a27ec ] Due to an oversight, on arm64 lockdep IRQ state tracking doesn't work as intended in NMI context. This demonstrably results in bogus warnings from lockdep, and in theory could mask a variety of issues. On arm64, we've consistently tracked IRQ flag state for NMIs (and saved/restored the state of the interrupted context) since commit: f0cd5ac1e4c53cb6 ("arm64: entry: fix NMI {user, kernel}->kernel transitio= ns") That commit fixed most lockdep issues with NMI by virtue of the save/restore of the lockdep state of the interrupted context. However, for lockdep IRQ state tracking to consistently take effect in NMI context it has been necessary to select TRACE_IRQFLAGS_NMI_SUPPORT since commit: ed00495333ccc80f ("locking/lockdep: Fix TRACE_IRQFLAGS vs. NMIs") As arm64 does not select TRACE_IRQFLAGS_NMI_SUPPORT, this means that the lockdep state can be stale in NMI context, and some uses of that state can consume stale data. When an NMI is taken arm64 entry code will call arm64_enter_nmi(). This will enter NMI context via __nmi_enter() before calling lockdep_hardirqs_off() to inform lockdep that IRQs have been masked. Where TRACE_IRQFLAGS_NMI_SUPPORT is not selected, lockdep_hardirqs_off() will not update lockdep state if called in NMI context. Thus if IRQs were enabled in the original context, lockdep will continue to believe that IRQs are enabled despite the call to lockdep_hardirqs_off(). However, the lockdep_assert_*() checks do take effect in NMI context, and will consume the stale lockdep state. If an NMI is taken from a context which had IRQs enabled, and during the handling of the NMI something calls lockdep_assert_irqs_disabled(), this will result in a spurious warning based upon the stale lockdep state. This can be seen when using perf with GICv3 pseudo-NMIs. Within the perf NMI handler we may attempt a uaccess to record the userspace callchain, and is this faults the el1_abort() call in the nested context will call exit_to_kernel_mode() when returning, which has a lockdep_assert_irqs_disabled() assertion: | # ./perf record -a -g sh | ------------[ cut here ]------------ | WARNING: CPU: 0 PID: 164 at arch/arm64/kernel/entry-common.c:73 exit_to_k= ernel_mode+0x118/0x1ac | Modules linked in: | CPU: 0 PID: 164 Comm: perf Not tainted 5.18.0-rc5 #1 | Hardware name: linux,dummy-virt (DT) | pstate: 004003c5 (nzcv DAIF +PAN -UAO -TCO -DIT -SSBS BTYPE=3D--) | pc : exit_to_kernel_mode+0x118/0x1ac | lr : el1_abort+0x80/0xbc | sp : ffff8000080039f0 | pmr_save: 000000f0 | x29: ffff8000080039f0 x28: ffff6831054e4980 x27: ffff683103adb400 | x26: 0000000000000000 x25: 0000000000000001 x24: 0000000000000001 | x23: 00000000804000c5 x22: 00000000000000c0 x21: 0000000000000001 | x20: ffffbd51e635ec44 x19: ffff800008003a60 x18: 0000000000000000 | x17: ffffaadf98d23000 x16: ffff800008004000 x15: 0000ffffd14f25c0 | x14: 0000000000000000 x13: 00000000000018eb x12: 0000000000000040 | x11: 000000000000001e x10: 000000002b820020 x9 : 0000000100110000 | x8 : 000000000045cac0 x7 : 0000ffffd14f25c0 x6 : ffffbd51e639b000 | x5 : 00000000000003e5 x4 : ffffbd51e58543b0 x3 : 0000000000000001 | x2 : ffffaadf98d23000 x1 : ffff6831054e4980 x0 : 0000000100110000 | Call trace: | exit_to_kernel_mode+0x118/0x1ac | el1_abort+0x80/0xbc | el1h_64_sync_handler+0xa4/0xd0 | el1h_64_sync+0x74/0x78 | __arch_copy_from_user+0xa4/0x230 | get_perf_callchain+0x134/0x1e4 | perf_callchain+0x7c/0xa0 | perf_prepare_sample+0x414/0x660 | perf_event_output_forward+0x80/0x180 | __perf_event_overflow+0x70/0x13c | perf_event_overflow+0x1c/0x30 | armv8pmu_handle_irq+0xe8/0x160 | armpmu_dispatch_irq+0x2c/0x70 | handle_percpu_devid_fasteoi_nmi+0x7c/0xbc | generic_handle_domain_nmi+0x3c/0x60 | gic_handle_irq+0x1dc/0x310 | call_on_irq_stack+0x2c/0x54 | do_interrupt_handler+0x80/0x94 | el1_interrupt+0xb0/0xe4 | el1h_64_irq_handler+0x18/0x24 | el1h_64_irq+0x74/0x78 | lockdep_hardirqs_off+0x50/0x120 | trace_hardirqs_off+0x38/0x214 | _raw_spin_lock_irq+0x98/0xa0 | pipe_read+0x1f8/0x404 | new_sync_read+0x140/0x150 | vfs_read+0x190/0x1dc | ksys_read+0xdc/0xfc | __arm64_sys_read+0x20/0x30 | invoke_syscall+0x48/0x114 | el0_svc_common.constprop.0+0x158/0x17c | do_el0_svc+0x28/0x90 | el0_svc+0x60/0x150 | el0t_64_sync_handler+0xa4/0x130 | el0t_64_sync+0x19c/0x1a0 | irq event stamp: 483 | hardirqs last enabled at (483): [] _raw_spin_unlock_ir= qrestore+0xa4/0xb0 | hardirqs last disabled at (482): [] _raw_spin_lock_irqs= ave+0xb0/0xb4 | softirqs last enabled at (468): [] put_cpu_fpsimd_cont= ext+0x28/0x70 | softirqs last disabled at (466): [] get_cpu_fpsimd_cont= ext+0x0/0x5c | ---[ end trace 0000000000000000 ]--- Note that as lockdep_assert_irqs_disabled() uses WARN_ON_ONCE(), and this uses a BRK, the warning is logged with the real PSTATE at the time of the warning, which clearly has DAIF.I set, meaning IRQs (and pseudo-NMIs) were definitely masked and the warning is spurious. Fix this by selecting TRACE_IRQFLAGS_NMI_SUPPORT such that the existing entry tracking takes effect, as we had originally intended when the arm64 entry code was fixed for transitions to/from NMI. Arguably the lockdep_assert_*() functions should have the same NMI checks as the rest of the code to prevent spurious warnings when TRACE_IRQFLAGS_NMI_SUPPORT is not selected, but the real fix for any architecture is to explicitly handle the transitions to/from NMI in the entry code. Fixes: f0cd5ac1e4c5 ("arm64: entry: fix NMI {user, kernel}->kernel transiti= ons") Signed-off-by: Mark Rutland Cc: Catalin Marinas Cc: Ingo Molnar Cc: Peter Zijlstra (Intel) Cc: Thomas Gleixner Cc: Will Deacon Link: https://lore.kernel.org/r/20220511131733.4074499-3-mark.rutland@arm.c= om Signed-off-by: Will Deacon Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm64/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 8b6f090e0364..69e7e293f72e 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -220,6 +220,7 @@ config ARM64 select THREAD_INFO_IN_TASK select HAVE_ARCH_USERFAULTFD_MINOR if USERFAULTFD select TRACE_IRQFLAGS_SUPPORT + select TRACE_IRQFLAGS_NMI_SUPPORT help ARM 64-bit (AArch64) Linux support. =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2A67C00140 for ; Mon, 15 Aug 2022 18:34:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243673AbiHOSef (ORCPT ); Mon, 15 Aug 2022 14:34:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243645AbiHOSeD (ORCPT ); Mon, 15 Aug 2022 14:34: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 A4C9137FB7; Mon, 15 Aug 2022 11:22: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 68B9A60BE9; Mon, 15 Aug 2022 18:22:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CD18C433C1; Mon, 15 Aug 2022 18:22:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587723; bh=xkDeGgrBP1lMuy0ZuJSezWTUfVMP7+8pc66PNFfSDzY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZlLbJGjh2+3AHsEfDFQtkLkEqZNVTG5UfFnleNjrFTTdloXxxDqo8rMjWzyjQpSNL Dq4XGKsMTHNOqFPCyfLdPlt6JbIcb4ggNb6Rmy2kRcrZ6xchrbc51zJkefUhiTsMPv zhfGlknewTwM10aOIUoc9nU4LE6rTTSjXPUtnKG4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexandru Elisei , Will Deacon , Sasha Levin Subject: [PATCH 5.15 174/779] arm64: cpufeature: Allow different PMU versions in ID_DFR0_EL1 Date: Mon, 15 Aug 2022 19:56:58 +0200 Message-Id: <20220815180344.722563582@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 506506cad3947b942425b119ffa2b06715d5d804 ] Commit b20d1ba3cf4b ("arm64: cpufeature: allow for version discrepancy in PMU implementations") made it possible to run Linux on a machine with PMUs with different versions without tainting the kernel. The patch relaxed the restriction only for the ID_AA64DFR0_EL1.PMUVer field, and missed doing the same for ID_DFR0_EL1.PerfMon , which also reports the PMU version, but for the AArch32 state. For example, with Linux running on two clusters with different PMU versions, the kernel is tainted when bringing up secondaries with the following message: [ 0.097027] smp: Bringing up secondary CPUs ... [..] [ 0.142805] Detected PIPT I-cache on CPU4 [ 0.142805] CPU features: SANITY CHECK: Unexpected variation in SYS_ID_D= FR0_EL1. Boot CPU: 0x00000004011088, CPU4: 0x00000005011088 [ 0.143555] CPU features: Unsupported CPU feature variation detected. [ 0.143702] GICv3: CPU4: found redistributor 10000 region 0:0x000000002f= 180000 [ 0.143702] GICv3: CPU4: using allocated LPI pending table @0x0000000880= 0d0000 [ 0.144888] CPU4: Booted secondary processor 0x0000010000 [0x410fd0f0] The boot CPU implements FEAT_PMUv3p1 (ID_DFR0_EL1.PerfMon, bits 27:24, is 0b0100), but CPU4, part of the other cluster, implements FEAT_PMUv3p4 (ID_DFR0_EL1.PerfMon =3D 0b0101). Treat the PerfMon field as FTR_NONSTRICT and FTR_EXACT to pass the sanity check and to match how PMUVer is treated for the 64bit ID register. Fixes: b20d1ba3cf4b ("arm64: cpufeature: allow for version discrepancy in P= MU implementations") Signed-off-by: Alexandru Elisei Link: https://lore.kernel.org/r/20220617111332.203061-1-alexandru.elisei@ar= m.com Signed-off-by: Will Deacon Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm64/kernel/cpufeature.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index e71c9cfb46e8..474aa55c2f68 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -536,7 +536,7 @@ static const struct arm64_ftr_bits ftr_id_pfr2[] =3D { =20 static const struct arm64_ftr_bits ftr_id_dfr0[] =3D { /* [31:28] TraceFilt */ - S_ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_DFR0_PERFMON_= SHIFT, 4, 0xf), + S_ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_EXACT, ID_DFR0_PERFMON_SH= IFT, 4, 0), ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_DFR0_MPROFDBG_S= HIFT, 4, 0), ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_DFR0_MMAPTRC_SH= IFT, 4, 0), ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_DFR0_COPTRC_SHI= FT, 4, 0), --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A583C00140 for ; Mon, 15 Aug 2022 18:34:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242517AbiHOSes (ORCPT ); Mon, 15 Aug 2022 14:34:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243660AbiHOSeR (ORCPT ); Mon, 15 Aug 2022 14:34:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C0C639B81; Mon, 15 Aug 2022 11:22: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 2111CB80F99; Mon, 15 Aug 2022 18:22:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F709C433C1; Mon, 15 Aug 2022 18:22:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587726; bh=8K7a4B/rMAB9jXSrY6O6bL252uaeUFiBy4iV2O9dGKQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zooY/NqwTHwzRpokSGU0egnKIRlHH+il3lcyxq4Y8k+mD3b+0JQq7LXxID/HLOfV7 BmK7DULEWBqJrTjqzGj7KPem5LbzvptYVNK7HP9HFcJL6qbGTlT+s7ie1o2rRAUj2V 5xEEFXP678ypbAHo+83KvTHFYmVctq0RiIEzZfJc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Peter Zijlstra (Intel)" , Sasha Levin Subject: [PATCH 5.15 175/779] locking/lockdep: Fix lockdep_init_map_*() confusion Date: Mon, 15 Aug 2022 19:56:59 +0200 Message-Id: <20220815180344.762135625@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peter Zijlstra [ Upstream commit eae6d58d67d9739be5f7ae2dbead1d0ef6528243 ] Commit dfd5e3f5fe27 ("locking/lockdep: Mark local_lock_t") added yet another lockdep_init_map_*() variant, but forgot to update all the existing users of the most complicated version. This could lead to a loss of lock_type and hence an incorrect report. Given the relative rarity of both local_lock and these annotations, this is unlikely to happen in practise, still, best fix things. Fixes: dfd5e3f5fe27 ("locking/lockdep: Mark local_lock_t") Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/YqyEDtoan20K0CVD@worktop.programming.kicks-= ass.net Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- include/linux/lockdep.h | 30 +++++++++++++++++------------- kernel/locking/lockdep.c | 7 ++++--- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 9fe165beb0f9..aa0ecfc6cdb4 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h @@ -192,7 +192,7 @@ static inline void lockdep_init_map_waits(struct lockdep_map *lock, const char *name, struct lock_class_key *key, int subclass, u8 inner, u8 outer) { - lockdep_init_map_type(lock, name, key, subclass, inner, LD_WAIT_INV, LD_L= OCK_NORMAL); + lockdep_init_map_type(lock, name, key, subclass, inner, outer, LD_LOCK_NO= RMAL); } =20 static inline void @@ -215,24 +215,28 @@ static inline void lockdep_init_map(struct lockdep_ma= p *lock, const char *name, * or they are too narrow (they suffer from a false class-split): */ #define lockdep_set_class(lock, key) \ - lockdep_init_map_waits(&(lock)->dep_map, #key, key, 0, \ - (lock)->dep_map.wait_type_inner, \ - (lock)->dep_map.wait_type_outer) + lockdep_init_map_type(&(lock)->dep_map, #key, key, 0, \ + (lock)->dep_map.wait_type_inner, \ + (lock)->dep_map.wait_type_outer, \ + (lock)->dep_map.lock_type) =20 #define lockdep_set_class_and_name(lock, key, name) \ - lockdep_init_map_waits(&(lock)->dep_map, name, key, 0, \ - (lock)->dep_map.wait_type_inner, \ - (lock)->dep_map.wait_type_outer) + lockdep_init_map_type(&(lock)->dep_map, name, key, 0, \ + (lock)->dep_map.wait_type_inner, \ + (lock)->dep_map.wait_type_outer, \ + (lock)->dep_map.lock_type) =20 #define lockdep_set_class_and_subclass(lock, key, sub) \ - lockdep_init_map_waits(&(lock)->dep_map, #key, key, sub,\ - (lock)->dep_map.wait_type_inner, \ - (lock)->dep_map.wait_type_outer) + lockdep_init_map_type(&(lock)->dep_map, #key, key, sub, \ + (lock)->dep_map.wait_type_inner, \ + (lock)->dep_map.wait_type_outer, \ + (lock)->dep_map.lock_type) =20 #define lockdep_set_subclass(lock, sub) \ - lockdep_init_map_waits(&(lock)->dep_map, #lock, (lock)->dep_map.key, sub,\ - (lock)->dep_map.wait_type_inner, \ - (lock)->dep_map.wait_type_outer) + lockdep_init_map_type(&(lock)->dep_map, #lock, (lock)->dep_map.key, sub,\ + (lock)->dep_map.wait_type_inner, \ + (lock)->dep_map.wait_type_outer, \ + (lock)->dep_map.lock_type) =20 #define lockdep_set_novalidate_class(lock) \ lockdep_set_class_and_name(lock, &__lockdep_no_validate__, #lock) diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index a30702b847ba..120bbdacd58b 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -5202,9 +5202,10 @@ __lock_set_class(struct lockdep_map *lock, const cha= r *name, return 0; } =20 - lockdep_init_map_waits(lock, name, key, 0, - lock->wait_type_inner, - lock->wait_type_outer); + lockdep_init_map_type(lock, name, key, 0, + lock->wait_type_inner, + lock->wait_type_outer, + lock->lock_type); class =3D register_lock_class(lock, subclass, 0); hlock->class_idx =3D class - lock_classes; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EEF4DC25B08 for ; Mon, 15 Aug 2022 18:34:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232696AbiHOSex (ORCPT ); Mon, 15 Aug 2022 14:34:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243208AbiHOSeW (ORCPT ); Mon, 15 Aug 2022 14:34: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 A2D6D2AE3A; Mon, 15 Aug 2022 11:22: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 76719B8107D; Mon, 15 Aug 2022 18:22:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A90F5C433D6; Mon, 15 Aug 2022 18:22:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587730; bh=httprFRWS2IWljd7AHDAQs1mveoWNaulkMZGUEXjL2g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NHKsSNBsO1XSrz0eKeEsh+ugaGclulvPZaMtLlCcgo7N6KVj1VzzNQT2X984qAs/2 JrcqxZ78hGM9QlaHe9qS1I/2Cvex1MPXUwHuUK77jOF0VYBBVdg3q2GMaiOV1oB8Cr qDBzJriZxEc9Cw0HTh0l4Gw2JQ94+nOau0TpUXaE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alex Elder , Matthias Kaehlcke , Stephen Boyd , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 176/779] arm64: dts: qcom: sc7180: Remove ipa_fw_mem node on trogdor Date: Mon, 15 Aug 2022 19:57:00 +0200 Message-Id: <20220815180344.801087363@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stephen Boyd [ Upstream commit e60414644cf3a703e10ed4429c15263095945ffe ] We don't use this carveout on trogdor boards, and having it defined in the sc7180 SoC file causes an overlap message to be printed at boot. OF: reserved mem: OVERLAP DETECTED! memory@86000000 (0x0000000086000000--0x000000008ec00000) overlaps with mem= ory@8b700000 (0x000000008b700000--0x000000008b710000) Delete the node in the trogdor dtsi file to fix the overlap problem and remove the error message. Cc: Alex Elder Cc: Matthias Kaehlcke Fixes: 310b266655a3 ("arm64: dts: qcom: sc7180: define ipa_fw_mem node") Signed-off-by: Stephen Boyd Reviewed-by: Alex Elder Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220517193307.3034602-1-swboyd@chromium.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi b/arch/arm64/boot= /dts/qcom/sc7180-trogdor.dtsi index 70c88c37de32..a9d36ac6cb90 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor.dtsi @@ -42,6 +42,7 @@ charger-crit { */ =20 /delete-node/ &hyp_mem; +/delete-node/ &ipa_fw_mem; /delete-node/ &xbl_mem; /delete-node/ &aop_mem; /delete-node/ &sec_apps_mem; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7722C00140 for ; Mon, 15 Aug 2022 18:35:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243224AbiHOSfJ (ORCPT ); Mon, 15 Aug 2022 14:35:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243532AbiHOSeY (ORCPT ); Mon, 15 Aug 2022 14:34: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 2FC312CCA0; Mon, 15 Aug 2022 11:22: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 9B4D8B8105B; Mon, 15 Aug 2022 18:22:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2C77C433C1; Mon, 15 Aug 2022 18:22:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587733; bh=ZADaNa64nCvQs7O60nGPkeGkYO17owC8vXFL0IFB5uI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t6mvgv11DQUQXKDc0OP6/k5wG6tGDlbr9EdS78zUwp0SRUWCFa4padJ57Z+CbD5k/ Z86urBPURah3M+HTxwYw0+5aV5F0GwRbrwq4bKWq6g/BqPzHsXf5la5MCT7P9KTx9h 31PCqLXF+22N5kIhKw1axHj42TGHoa/2Evw3xP+Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Walle , Arnd Bergmann , Shawn Guo , Sasha Levin Subject: [PATCH 5.15 177/779] soc: fsl: guts: machine variable might be unset Date: Mon, 15 Aug 2022 19:57:01 +0200 Message-Id: <20220815180344.837217230@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Walle [ Upstream commit ab3f045774f704c4e7b6a878102f4e9d4ae7bc74 ] If both the model and the compatible properties are missing, then machine will not be set. Initialize it with NULL. Fixes: 34c1c21e94ac ("soc: fsl: fix section mismatch build warnings") Signed-off-by: Michael Walle Acked-by: Arnd Bergmann Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/soc/fsl/guts.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soc/fsl/guts.c b/drivers/soc/fsl/guts.c index 75eabfb916cb..0b2c7fdbaa5b 100644 --- a/drivers/soc/fsl/guts.c +++ b/drivers/soc/fsl/guts.c @@ -141,7 +141,7 @@ static int fsl_guts_probe(struct platform_device *pdev) struct device *dev =3D &pdev->dev; struct resource *res; const struct fsl_soc_die_attr *soc_die; - const char *machine; + const char *machine =3D NULL; u32 svr; =20 /* Initialize guts */ --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96177C00140 for ; Mon, 15 Aug 2022 18:35:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243714AbiHOSfZ (ORCPT ); Mon, 15 Aug 2022 14:35:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243404AbiHOSek (ORCPT ); Mon, 15 Aug 2022 14:34: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 3251539BAA; Mon, 15 Aug 2022 11:22: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 AB697B81074; Mon, 15 Aug 2022 18:22:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AF5DC433D6; Mon, 15 Aug 2022 18:22:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587736; bh=I0s1FfCSKS4Q7n/lumfgFGstKL5ewoslGKP/jBS5Qv4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0S9NbEnfYepc6g2a/LwxPQdY8GXKp+nLO7EHYi2YAzrlkT/6t+3M+OV4xAiDNXDHd aTjGtNgJpZrq6nob2vmHaFw2jwwOMXWLSA4pCvL75Tw8J+AtgsdqJU1wDxCbrmgVPP wZmqBu01YzJ35b8zBt9x/d/1ZR+xjyIFz8YfSE/8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Keith Busch , Damien Le Moal , Christoph Hellwig , Johannes Thumshirn , Jens Axboe , Sasha Levin Subject: [PATCH 5.15 178/779] block: fix infinite loop for invalid zone append Date: Mon, 15 Aug 2022 19:57:02 +0200 Message-Id: <20220815180344.875920711@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Keith Busch [ Upstream commit b82d9fa257cb3725c49d94d2aeafc4677c34448a ] Returning 0 early from __bio_iov_append_get_pages() for the max_append_sectors warning just creates an infinite loop since 0 means success, and the bio will never fill from the unadvancing iov_iter. We could turn the return into an error value, but it will already be turned into an error value later on, so just remove the warning. Clearly no one ever hit it anyway. Fixes: 0512a75b98f84 ("block: Introduce REQ_OP_ZONE_APPEND") Signed-off-by: Keith Busch Reviewed-by: Damien Le Moal Reviewed-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn Link: https://lore.kernel.org/r/20220610195830.3574005-2-kbusch@fb.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- block/bio.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/block/bio.c b/block/bio.c index b8a8bfba714f..b117765d58c0 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1141,9 +1141,6 @@ static int __bio_iov_append_get_pages(struct bio *bio= , struct iov_iter *iter) size_t offset; int ret =3D 0; =20 - if (WARN_ON_ONCE(!max_append_sectors)) - return 0; - /* * Move page array up in the allocated memory for the bio vecs as far as * possible so that we can start filling biovecs from the beginning --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89F6FC00140 for ; Mon, 15 Aug 2022 18:35:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243681AbiHOSfa (ORCPT ); Mon, 15 Aug 2022 14:35:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243453AbiHOSeq (ORCPT ); Mon, 15 Aug 2022 14:34:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 966CB39BBD; Mon, 15 Aug 2022 11:22: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 18B86B81062; Mon, 15 Aug 2022 18:22:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65805C433C1; Mon, 15 Aug 2022 18:22:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587739; bh=CMovCprZ5em9db8CogLOUydohomPphAegq0bOUxOIkI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ytuABXSJ2dSc/85NA/wmh9/ZwvTaiwwCwM9yyovJD/clX+3ysbFq9SK5zx3DF+sWk avmlea/T6Z1vJQcvNbUKkxRTlfANP2mjk9nthxo+MFvKHfN+NL5oAEipO9yCe6p5nV Sj3ie/g4ABe4IQb9o8q1oTGuvD8DQTRCFhJ8gq4Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 179/779] ARM: dts: qcom: mdm9615: add missing PMIC GPIO reg Date: Mon, 15 Aug 2022 19:57:03 +0200 Message-Id: <20220815180344.914794691@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 dc590cdc31f636ea15658f1206c3e380a53fb78e ] 'reg' property is required in SSBI children: qcom-mdm9615-wp8548-mangoh-green.dtb: gpio@150: 'reg' is a required prope= rty Fixes: 2c5e596524e7 ("ARM: dts: Add MDM9615 dtsi") Signed-off-by: Krzysztof Kozlowski Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220507194913.261121-11-krzysztof.kozlowsk= i@linaro.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm/boot/dts/qcom-mdm9615.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/qcom-mdm9615.dtsi b/arch/arm/boot/dts/qcom-m= dm9615.dtsi index dda2ceec6591..ad9b52d53ef9 100644 --- a/arch/arm/boot/dts/qcom-mdm9615.dtsi +++ b/arch/arm/boot/dts/qcom-mdm9615.dtsi @@ -324,6 +324,7 @@ rtc@11d { =20 pmicgpio: gpio@150 { compatible =3D "qcom,pm8018-gpio", "qcom,ssbi-gpio"; + reg =3D <0x150>; interrupt-controller; #interrupt-cells =3D <2>; gpio-controller; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA54EC25B08 for ; Mon, 15 Aug 2022 18:37:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243749AbiHOShF (ORCPT ); Mon, 15 Aug 2022 14:37:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243521AbiHOSev (ORCPT ); Mon, 15 Aug 2022 14:34:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 924D52C13F; Mon, 15 Aug 2022 11:22:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 28F48B80F99; Mon, 15 Aug 2022 18:22:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78ACFC433C1; Mon, 15 Aug 2022 18:22:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587743; bh=ApGZls245OFaL4bZDd2zk1ckQldFOthVbDmUJI6iQH0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BqxyQpKY/jpqzS6PLkPKx+Yc+cBJqmnN4jS2PBuQHlPklWqi/shj28Zz8IzhBeTgi SGnZ/Fg4FVpXKmZ6FIsqwFo44SFm0pibuxZs3n1lowbZcMw/e2VleinOWoCHd6gAXY QGtLx1XHt3xqrLgwajEHAwNyKI03puUzz45nar74= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Laurent Pinchart , Tony Lindgren , Sasha Levin Subject: [PATCH 5.15 180/779] ARM: OMAP2+: Fix refcount leak in omapdss_init_of Date: Mon, 15 Aug 2022 19:57:04 +0200 Message-Id: <20220815180344.949179655@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 9705db1eff38d6b9114121f9e253746199b759c9 ] omapdss_find_dss_of_node() calls of_find_compatible_node() to get device node. of_find_compatible_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when done. Add missing of_node_put() in later error path and normal path. Fixes: e0c827aca0730 ("drm/omap: Populate DSS children in omapdss driver") Signed-off-by: Miaoqian Lin Message-Id: <20220601044858.3352-1-linmq006@gmail.com> Reviewed-by: Laurent Pinchart Signed-off-by: Tony Lindgren Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm/mach-omap2/display.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c index eb09a25e3b45..8d829f3dafe7 100644 --- a/arch/arm/mach-omap2/display.c +++ b/arch/arm/mach-omap2/display.c @@ -260,11 +260,13 @@ static int __init omapdss_init_of(void) =20 if (!pdev) { pr_err("Unable to find DSS platform device\n"); + of_node_put(node); return -ENODEV; } =20 r =3D of_platform_populate(node, NULL, NULL, &pdev->dev); put_device(&pdev->dev); + of_node_put(node); if (r) { pr_err("Unable to populate DSS submodule devices\n"); return r; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 412A5C25B08 for ; Mon, 15 Aug 2022 18:37:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243798AbiHOShN (ORCPT ); Mon, 15 Aug 2022 14:37:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243692AbiHOSez (ORCPT ); Mon, 15 Aug 2022 14:34:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C2643A491; Mon, 15 Aug 2022 11:22: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 6646D60C07; Mon, 15 Aug 2022 18:22:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DFB8C433D6; Mon, 15 Aug 2022 18:22:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587745; bh=omZ20BVuFxL1W05Lz9Iqe5y6+N9MFAhSKFKp3+JoWnQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PAFdRmqWxsiMu9jH4TyOs+HzDd/qfUs7bcKNUGKA/HBv6t7SlBRzXMPdvzaw1FgpA a5pHQ8G6uayYxRAmnTAzBJt+8Q9ysup48PvXGaV4e1u+o6wX8bmIgoS/ODUyDdHmox KcM9za54LdIYaeSwr0Xu9BZfUOQRLIuOZACK8yYE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Tony Lindgren , Sasha Levin Subject: [PATCH 5.15 181/779] ARM: OMAP2+: Fix refcount leak in omap3xxx_prm_late_init Date: Mon, 15 Aug 2022 19:57:05 +0200 Message-Id: <20220815180344.999225266@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 942228fbf5d4901112178b93d41225be7c0dd9de ] of_find_matching_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: 1e037794f7f0 ("ARM: OMAP3+: PRM: register interrupt information from= DT") Signed-off-by: Miaoqian Lin Message-Id: <20220526073724.21169-1-linmq006@gmail.com> Signed-off-by: Tony Lindgren Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm/mach-omap2/prm3xxx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-omap2/prm3xxx.c b/arch/arm/mach-omap2/prm3xxx.c index 1b442b128569..63e73e9b82bc 100644 --- a/arch/arm/mach-omap2/prm3xxx.c +++ b/arch/arm/mach-omap2/prm3xxx.c @@ -708,6 +708,7 @@ static int omap3xxx_prm_late_init(void) } =20 irq_num =3D of_irq_get(np, 0); + of_node_put(np); if (irq_num =3D=3D -EPROBE_DEFER) return irq_num; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 311B7C28B2B for ; Mon, 15 Aug 2022 18:36:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243404AbiHOSgp (ORCPT ); Mon, 15 Aug 2022 14:36:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243312AbiHOSfL (ORCPT ); Mon, 15 Aug 2022 14:35:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E2F03A4A4; Mon, 15 Aug 2022 11:22:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 90E4260EBB; Mon, 15 Aug 2022 18:22:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8556CC433C1; Mon, 15 Aug 2022 18:22:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587749; bh=Km8RrzmovlTI3oUchLg5juXi+oKbcPGQGN846oCF/cw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AWBwndAIkPP5ChyG8rgyWTk+NIKwBktjGSQ+KxjynIMBCNX8zM7cbQ02giiZqOO25 TK+FqvWLKIgzOBZhp1aRS5ndaSeDO1cPtIvCUSRIWVRIrIh4fXmQ5qyN/Q8KO+s6+0 P4jknauNfIEtm1iibPzGKspZivTQN/am9D4fPA0Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konrad Dybcio , Marijn Suijten , Dmitry Baryshkov , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 182/779] arm64: dts: qcom: sdm630: disable GPU by default Date: Mon, 15 Aug 2022 19:57:06 +0200 Message-Id: <20220815180345.029679847@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dmitry Baryshkov [ Upstream commit 1c047919763b4548381d1ab3320af1df66ab83df ] The SoC's device tree file disables gpucc and adreno's SMMU by default. So let's disable the GPU too. Moreover it looks like SMMU might be not usable without additional patches (which means that GPU is unusable too). No board uses GPU at this moment. Fixes: 5cf69dcbec8b ("arm64: dts: qcom: sdm630: Add Adreno 508 GPU configur= ation") Reviewed-by: Konrad Dybcio Reviewed-by: Marijn Suijten Signed-off-by: Dmitry Baryshkov Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220521202708.1509308-4-dmitry.baryshkov@l= inaro.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm64/boot/dts/qcom/sdm630.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sdm630.dtsi b/arch/arm64/boot/dts/qco= m/sdm630.dtsi index a8724fd60645..18957e452bb7 100644 --- a/arch/arm64/boot/dts/qcom/sdm630.dtsi +++ b/arch/arm64/boot/dts/qcom/sdm630.dtsi @@ -1046,6 +1046,8 @@ adreno_gpu: gpu@5000000 { =20 operating-points-v2 =3D <&gpu_sdm630_opp_table>; =20 + status =3D "disabled"; + gpu_sdm630_opp_table: opp-table { compatible =3D "operating-points-v2"; opp-775000000 { --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4D47C282E7 for ; Mon, 15 Aug 2022 18:36:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243654AbiHOSgs (ORCPT ); Mon, 15 Aug 2022 14:36:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243662AbiHOSf2 (ORCPT ); Mon, 15 Aug 2022 14:35: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 2861D3AB19; Mon, 15 Aug 2022 11:22: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 CCC6760BE9; Mon, 15 Aug 2022 18:22:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BEF3EC433C1; Mon, 15 Aug 2022 18:22:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587755; bh=AFx2L2Vg/+Ac1j1sPC/ykhDrfnYkuDVZ02dRFPGF0Es=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=beTal38kbLP0lXy8ol6zCKhjAoLaghP54aEDisfPRVDFPdSeEcAICVzCNDSqmAZGB xIdh9FxsePjQtxSK0bm80z27+I4wPyHyt4Tcq9fCxwagHwEfHM8WB0L51SMzVMTUrX SnkAQ5Y7wcJZ1BOQBY+RVJLX4Omw0iLLM+pmYuyg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konrad Dybcio , Marijn Suijten , Dmitry Baryshkov , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 183/779] arm64: dts: qcom: sdm630: fix the qusb2phy ref clock Date: Mon, 15 Aug 2022 19:57:07 +0200 Message-Id: <20220815180345.077546510@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dmitry Baryshkov [ Upstream commit 924bbd8dd60e094344711c3526a5b308d71dc008 ] According to the downstram DT file, the qusb2phy ref clock should be GCC_RX0_USB2_CLKREF_CLK, not GCC_RX1_USB2_CLKREF_CLK. Fixes: c65a4ed2ea8b ("arm64: dts: qcom: sdm630: Add USB configuration") Cc: Konrad Dybcio Reviewed-by: Konrad Dybcio Reviewed-by: Marijn Suijten Signed-off-by: Dmitry Baryshkov Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220521202708.1509308-5-dmitry.baryshkov@l= inaro.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm64/boot/dts/qcom/sdm630.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/qcom/sdm630.dtsi b/arch/arm64/boot/dts/qco= m/sdm630.dtsi index 18957e452bb7..dca66b8c166c 100644 --- a/arch/arm64/boot/dts/qcom/sdm630.dtsi +++ b/arch/arm64/boot/dts/qcom/sdm630.dtsi @@ -1253,7 +1253,7 @@ qusb2phy: phy@c012000 { #phy-cells =3D <0>; =20 clocks =3D <&gcc GCC_USB_PHY_CFG_AHB2PHY_CLK>, - <&gcc GCC_RX1_USB2_CLKREF_CLK>; + <&gcc GCC_RX0_USB2_CLKREF_CLK>; clock-names =3D "cfg_ahb", "ref"; =20 resets =3D <&gcc GCC_QUSB2PHY_PRIM_BCR>; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D40BEC00140 for ; Mon, 15 Aug 2022 18:37:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243758AbiHOShI (ORCPT ); Mon, 15 Aug 2022 14:37:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243787AbiHOSfq (ORCPT ); Mon, 15 Aug 2022 14:35:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 071C32CE2B; Mon, 15 Aug 2022 11:22: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 9C354B80F99; Mon, 15 Aug 2022 18:22:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CFC6FC43149; Mon, 15 Aug 2022 18:22:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587758; bh=DFtHf9Vx/V4Ci2AIcFn+vfGjpCKmCPJC8oqDEtLSqq4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I0qn6kLRqt7hM1rmaOT8dOTNUFlCIsL/mOU1OpVbpGPGY5awe44JNm/jPMvYKyX0T hqdEEFTJw0fBrfQn2Scus7Ufgx4fktdOw0bfor+v042Mqv42b83dXqFc3Jj7rDfoum jkAmkJYZriYQKOWAzaQOzZjsrh2oSGX1MUGdaPCU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marijn Suijten , Dmitry Baryshkov , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 184/779] arm64: dts: qcom: sdm630: fix gpus interconnect path Date: Mon, 15 Aug 2022 19:57:08 +0200 Message-Id: <20220815180345.132439453@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dmitry Baryshkov [ Upstream commit 3cd1c4f41d64a40ea6bc4575ae28e37542123d77 ] ICC path for the GPU incorrectly states <&gnoc 1 &bimc 5>, which is a path from SLAVE_GNOC_BIMC to SLAVE_EBI. According to the downstream kernel sources, the GPU uses MASTER_OXILI here, which is equivalent to <&bimc 1 ...>. While we are at it, use defined names instead of the numbers for this interconnect path. Fixes: 5cf69dcbec8b ("arm64: dts: qcom: sdm630: Add Adreno 508 GPU configur= ation") Reported-by: Marijn Suijten Reviewed-by: Marijn Suijten Signed-off-by: Dmitry Baryshkov Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220521202708.1509308-8-dmitry.baryshkov@l= inaro.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm64/boot/dts/qcom/sdm630.dtsi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/qcom/sdm630.dtsi b/arch/arm64/boot/dts/qco= m/sdm630.dtsi index dca66b8c166c..952bb133914f 100644 --- a/arch/arm64/boot/dts/qcom/sdm630.dtsi +++ b/arch/arm64/boot/dts/qcom/sdm630.dtsi @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -1041,7 +1042,7 @@ adreno_gpu: gpu@5000000 { nvmem-cells =3D <&gpu_speed_bin>; nvmem-cell-names =3D "speed_bin"; =20 - interconnects =3D <&gnoc 1 &bimc 5>; + interconnects =3D <&bimc MASTER_OXILI &bimc SLAVE_EBI>; interconnect-names =3D "gfx-mem"; =20 operating-points-v2 =3D <&gpu_sdm630_opp_table>; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 449DDC00140 for ; Mon, 15 Aug 2022 18:37:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243785AbiHOShK (ORCPT ); Mon, 15 Aug 2022 14:37:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243773AbiHOSfo (ORCPT ); Mon, 15 Aug 2022 14:35:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18D063AB39; Mon, 15 Aug 2022 11:22: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 B0E1CB8106E; Mon, 15 Aug 2022 18:22:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1EE54C433D6; Mon, 15 Aug 2022 18:22:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587761; bh=VJV6nzNAwjW/fBxrsQcuKWfGia0JOTCAUO88EJIXB8Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oZIQJPHHsTC9E7woAchYVVXFmayf/eaQC3bJCyFMXxPVFSfvKRu/8eIgWM5+mlXvI 7vCE9lhqb+dDIVrCWdkRS4zNbzvXiM4qEER8FoUjDXaQd9TsJiPNAW+3sVslIt7ncI eKqvR6Gg4EE8BvMYV+b95OrfdRj/et6H7JQk0k+o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Konrad Dybcio , Dmitry Baryshkov , Marijn Suijten , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 185/779] arm64: dts: qcom: sdm636-sony-xperia-ganges-mermaid: correct sdc2 pinconf Date: Mon, 15 Aug 2022 19:57:09 +0200 Message-Id: <20220815180345.183651763@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dmitry Baryshkov [ Upstream commit 3a04cec9cba393abfe70fc62e523f381c9baec2e ] Fix the device tree node in the &sdc2_state_on override. The sdm630 uses 'clk' rather than 'pinconf-clk'. Fixes: 4c1d849ec047 ("arm64: dts: qcom: sdm630-xperia: Retire sdm630-sony-x= peria-ganges.dtsi") Reviewed-by: Konrad Dybcio Signed-off-by: Dmitry Baryshkov Reviewed-by: Marijn Suijten Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220521202708.1509308-9-dmitry.baryshkov@l= inaro.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm64/boot/dts/qcom/sdm636-sony-xperia-ganges-mermaid.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/qcom/sdm636-sony-xperia-ganges-mermaid.dts= b/arch/arm64/boot/dts/qcom/sdm636-sony-xperia-ganges-mermaid.dts index bba1c2bce213..0afe9eee025e 100644 --- a/arch/arm64/boot/dts/qcom/sdm636-sony-xperia-ganges-mermaid.dts +++ b/arch/arm64/boot/dts/qcom/sdm636-sony-xperia-ganges-mermaid.dts @@ -18,7 +18,7 @@ / { }; =20 &sdc2_state_on { - pinconf-clk { + clk { drive-strength =3D <14>; }; }; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B2DBC00140 for ; Mon, 15 Aug 2022 18:37:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243706AbiHOShA (ORCPT ); Mon, 15 Aug 2022 14:37:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243821AbiHOSfy (ORCPT ); Mon, 15 Aug 2022 14:35: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 ABA103AE5C; Mon, 15 Aug 2022 11:22: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 F192EB8107E; Mon, 15 Aug 2022 18:22:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31201C433C1; Mon, 15 Aug 2022 18:22:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587764; bh=14BO3jFRo9LTUBo+dV5YyJ4Ptn7JKSUmnCiFGI1LRj8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KGJfoLC1Nt9/jXcYDvjXIoOVZ25H2EK8OrSyOgQ6Ld9t+L8Th1Gyv4m0Lfx6lZ9F3 n9ejdrNxv0RkpidNp+Xnj8GTxhOt9qJSgBtZ4Y2eis1rrygXNpk4t+INOROkiiB2h3 oOXEqaimZgK82BJW9eUyJSLKl8XFqH3vjorAMEDQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Michal Simek , Sasha Levin Subject: [PATCH 5.15 186/779] cpufreq: zynq: Fix refcount leak in zynq_get_revision Date: Mon, 15 Aug 2022 19:57:10 +0200 Message-Id: <20220815180345.220794309@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit d1ff2559cef0f6f8d97fba6337b28adb10689e16 ] of_find_compatible_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when done. Add missing of_node_put() to avoid refcount leak. Fixes: 00f7dc636366 ("ARM: zynq: Add support for SOC_BUS") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220605082807.21526-1-linmq006@gmail.com Signed-off-by: Michal Simek Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm/mach-zynq/common.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/mach-zynq/common.c b/arch/arm/mach-zynq/common.c index e1ca6a5732d2..15e8a321a713 100644 --- a/arch/arm/mach-zynq/common.c +++ b/arch/arm/mach-zynq/common.c @@ -77,6 +77,7 @@ static int __init zynq_get_revision(void) } =20 zynq_devcfg_base =3D of_iomap(np, 0); + of_node_put(np); if (!zynq_devcfg_base) { pr_err("%s: Unable to map I/O memory\n", __func__); return -1; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DEE8DC00140 for ; Mon, 15 Aug 2022 18:43:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243347AbiHOSnt (ORCPT ); Mon, 15 Aug 2022 14:43:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243746AbiHOSlV (ORCPT ); Mon, 15 Aug 2022 14:41: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 0D0EE3F321; Mon, 15 Aug 2022 11:24: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 ADD4FB8107D; Mon, 15 Aug 2022 18:24:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F36FEC433C1; Mon, 15 Aug 2022 18:24:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587893; bh=+g4G3oT1kbUpJNzmT4Ho/D7lCja7yauDPgdHOvtnxbg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FSVH54mX/4Gibzi7JTvltjZMF83768h0lYsyaXRCjN+glj0dtrhmqbivP+OoyNRFK Z37vdlHizTCtlK4NcKyS90HSDxI2dgrVxPd3iTzG5bgFE+6dcnAQB9f+c3BLtIzhnn sKsM2pkJLQqYNlY0qjdUtylJcdZo0FuRD/smI6go= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephan Gerhold , Mark Brown , Sasha Levin Subject: [PATCH 5.15 187/779] regulator: qcom_smd: Fix pm8916_pldo range Date: Mon, 15 Aug 2022 19:57:11 +0200 Message-Id: <20220815180345.252710227@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stephan Gerhold [ Upstream commit e8977917e116d1571dacb8e9864474551c1c12bd ] The PM8916 device specification [1] documents a programmable range of 1.75V to 3.337V with 12.5mV steps for the PMOS LDOs in PM8916. This range is also used when controlling the regulator directly using the qcom_spmi-regulator driver ("ult_pldo" there). However, for some reason the qcom_smd-regulator driver allows a much larger range for the same hardware component. This could be simply a typo, since the start of the range is essentially just missing a '1'. In practice this does not cause any major problems, since the driver just sends the actual voltage to the RPM firmware instead of making use of the incorrect voltage selector. Still, having the wrong range there is confusing and prevents the regulator core from validating requests correctly. [1]: https://developer.qualcomm.com/download/sd410/pm8916pm8916-1-power-man= agement-ic-device-specification.pdf Fixes: 57d6567680ed ("regulator: qcom-smd: Add PM8916 support") Signed-off-by: Stephan Gerhold Link: https://lore.kernel.org/r/20220623094614.1410180-2-stephan.gerhold@ke= rnkonzept.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/regulator/qcom_smd-regulator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/regulator/qcom_smd-regulator.c b/drivers/regulator/qco= m_smd-regulator.c index eb974b9c0b19..2fe13c765eff 100644 --- a/drivers/regulator/qcom_smd-regulator.c +++ b/drivers/regulator/qcom_smd-regulator.c @@ -357,10 +357,10 @@ static const struct regulator_desc pm8941_switch =3D { =20 static const struct regulator_desc pm8916_pldo =3D { .linear_ranges =3D (struct linear_range[]) { - REGULATOR_LINEAR_RANGE(750000, 0, 208, 12500), + REGULATOR_LINEAR_RANGE(1750000, 0, 127, 12500), }, .n_linear_ranges =3D 1, - .n_voltages =3D 209, + .n_voltages =3D 128, .ops =3D &rpm_smps_ldo_ops, }; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ADBA2C00140 for ; Mon, 15 Aug 2022 18:37:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243362AbiHOShr (ORCPT ); Mon, 15 Aug 2022 14:37:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244054AbiHOSgX (ORCPT ); Mon, 15 Aug 2022 14:36: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 73FC02D1D4; Mon, 15 Aug 2022 11:23: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 AE1DAB81062; Mon, 15 Aug 2022 18:23:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAF3BC433D6; Mon, 15 Aug 2022 18:23:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587789; bh=xF4ZESeti/WorROBW8Be43lu84T42KyEAFY2zI+iyTs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vM2jt4fNenvvSdtgRJcGhk9LLpCD1b6c8jjEjgumrptnyXiqaXezU/0PHgY4O4ARO WCxNRa9l6YKu9+86dgK573EXoSO4V7zKp/BEAw4wO52tdnfQFewEhV2VaLpwY7eHLy y4X/d6cYWOOauz0OH/vTCQ/aYwP48ZA454zXFMiU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tony Luck , Omar Avelar , Dan Williams , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.15 188/779] ACPI: APEI: Fix _EINJ vs EFI_MEMORY_SP Date: Mon, 15 Aug 2022 19:57:12 +0200 Message-Id: <20220815180345.290854764@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Williams [ Upstream commit b13a3e5fd40b7d1b394c5ecbb5eb301a4c38e7b2 ] When a platform marks a memory range as "special purpose" it is not onlined as System RAM by default. However, it is still suitable for error injection. Add IORES_DESC_SOFT_RESERVED to einj_error_inject() as a permissible memory type in the sanity checking of the arguments to _EINJ. Fixes: 262b45ae3ab4 ("x86/efi: EFI soft reservation to E820 enumeration") Reviewed-by: Tony Luck Reported-by: Omar Avelar Signed-off-by: Dan Williams Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/acpi/apei/einj.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c index 2882450c443e..2e0ab898cce3 100644 --- a/drivers/acpi/apei/einj.c +++ b/drivers/acpi/apei/einj.c @@ -544,6 +544,8 @@ static int einj_error_inject(u32 type, u32 flags, u64 p= aram1, u64 param2, ((region_intersects(base_addr, size, IORESOURCE_SYSTEM_RAM, IORES_DES= C_NONE) !=3D REGION_INTERSECTS) && (region_intersects(base_addr, size, IORESOURCE_MEM, IORES_DESC_PERSI= STENT_MEMORY) + !=3D REGION_INTERSECTS) && + (region_intersects(base_addr, size, IORESOURCE_MEM, IORES_DESC_SOFT_= RESERVED) !=3D REGION_INTERSECTS))) return -EINVAL; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0EDFC25B08 for ; Mon, 15 Aug 2022 18:39:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242271AbiHOSja (ORCPT ); Mon, 15 Aug 2022 14:39:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242071AbiHOSiq (ORCPT ); Mon, 15 Aug 2022 14:38:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DAEC2E69C; Mon, 15 Aug 2022 11:23: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 6CB46B81076; Mon, 15 Aug 2022 18:23:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FFCBC433C1; Mon, 15 Aug 2022 18:23:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587824; bh=yDgY5W1PnCPm4orjU4IIcbM58OJihAcMZtViHJqbfQ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0KepEXYhVF+WW3qF0b7Zhcb3NLtr3UP/tgYq+WQKh6KDKgyYwaHFgbRfi4qYfF8PS 1SZSDc5wTwuqgbCulPi0gYH6oe92eQB/sAp+z/cLFU+IDZoMWNgEPeceZboTRIZdAH AIuSlRvfCnU7gZK1JytGTa6G4jd8at8h7HWik2DE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luca Weiss , Krzysztof Kozlowski , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 189/779] ARM: dts: qcom-msm8974: fix irq type on blsp2_uart1 Date: Mon, 15 Aug 2022 19:57:13 +0200 Message-Id: <20220815180345.333091971@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 ab1489017aa7a9f02e24bee73cf9ec8079cd3909 ] IRQ_TYPE_NONE is invalid, so use the correct interrupt type. Signed-off-by: Luca Weiss Fixes: b05f82b152c9 ("ARM: dts: qcom: msm8974: Add blsp2_uart7 for bluetoot= h on sirius") Reviewed-by: Krzysztof Kozlowski Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220522083618.17894-1-luca@z3ntu.xyz Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm/boot/dts/qcom-msm8974.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/qcom-msm8974.dtsi b/arch/arm/boot/dts/qcom-m= sm8974.dtsi index 2b01bc29ddf2..05d51839d40a 100644 --- a/arch/arm/boot/dts/qcom-msm8974.dtsi +++ b/arch/arm/boot/dts/qcom-msm8974.dtsi @@ -718,7 +718,7 @@ blsp1_uart2: serial@f991e000 { blsp2_uart7: serial@f995d000 { compatible =3D "qcom,msm-uartdm-v1.4", "qcom,msm-uartdm"; reg =3D <0xf995d000 0x1000>; - interrupts =3D ; + interrupts =3D ; clocks =3D <&gcc GCC_BLSP2_UART1_APPS_CLK>, <&gcc GCC_BLSP2_AHB_CLK>; clock-names =3D "core", "iface"; status =3D "disabled"; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D539C25B0E for ; Mon, 15 Aug 2022 18:43:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242877AbiHOSnF (ORCPT ); Mon, 15 Aug 2022 14:43:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242672AbiHOSkl (ORCPT ); Mon, 15 Aug 2022 14:40:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DCFB53DF37; Mon, 15 Aug 2022 11:24: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 C1438B81081; Mon, 15 Aug 2022 18:24:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1DC8C433C1; Mon, 15 Aug 2022 18:24:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587859; bh=qFtJTFkGXlUimLZQdQpb9oM5fPuVizHi3ChcOSFqcV4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tcqHxI6ZThfVvjmcfOOBgJYNsmt37p/Ep1eGvGhBHX8+uXQEQQlU2unToLDvFuATm X699PT2PfzfJh7dRXBWkNTq76NQ53ghJxG6BKrTJOuZ9B2NscMe61B6+0v0+gaVorv /sP0hTzveRwVvxwQr8BR0h84Dp8cRX+Gll9fUXGM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Brian Masney , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 190/779] soc: qcom: ocmem: Fix refcount leak in of_get_ocmem Date: Mon, 15 Aug 2022 19:57:14 +0200 Message-Id: <20220815180345.372294228@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 92a563fcf14b3093226fb36f12e9b5cf630c5a5d ] of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. of_node_put() will check NULL pointer. Fixes: 88c1e9404f1d ("soc: qcom: add OCMEM driver") Signed-off-by: Miaoqian Lin Reviewed-by: Brian Masney Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220602042430.1114-1-linmq006@gmail.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/soc/qcom/ocmem.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/soc/qcom/ocmem.c b/drivers/soc/qcom/ocmem.c index 85f82e195ef8..1dfdd0b9ba24 100644 --- a/drivers/soc/qcom/ocmem.c +++ b/drivers/soc/qcom/ocmem.c @@ -194,14 +194,17 @@ struct ocmem *of_get_ocmem(struct device *dev) devnode =3D of_parse_phandle(dev->of_node, "sram", 0); if (!devnode || !devnode->parent) { dev_err(dev, "Cannot look up sram phandle\n"); + of_node_put(devnode); return ERR_PTR(-ENODEV); } =20 pdev =3D of_find_device_by_node(devnode->parent); if (!pdev) { dev_err(dev, "Cannot find device node %s\n", devnode->name); + of_node_put(devnode); return ERR_PTR(-EPROBE_DEFER); } + of_node_put(devnode); =20 ocmem =3D platform_get_drvdata(pdev); if (!ocmem) { --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48776C00140 for ; Mon, 15 Aug 2022 18:43:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243205AbiHOSn2 (ORCPT ); Mon, 15 Aug 2022 14:43:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243407AbiHOSk7 (ORCPT ); Mon, 15 Aug 2022 14:40: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 E393A3ED53; Mon, 15 Aug 2022 11:24: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 227C8B8107D; Mon, 15 Aug 2022 18:24:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FC03C433D7; Mon, 15 Aug 2022 18:24:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587874; bh=+71B/xPyFSD04nyum0BVG7RUBcf5hzJg6Y5VERD+m2k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=01lXly8A2LksSkgcEHPb4urPXLojuUfGToRzo3X7ukzSiw8mRhKe5JMZO8YMKZLgK H3aemthWan458BvFLkFAn7/xGYVb2tC2N9s6X4lH+dPi8qyO+xCM7wn7yPnfFvCwk1 OM0yRGzNq142yhvr+ZYf+wXudkKR34MXuPa3JIZA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 191/779] soc: qcom: aoss: Fix refcount leak in qmp_cooling_devices_register Date: Mon, 15 Aug 2022 19:57:15 +0200 Message-Id: <20220815180345.413523594@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit e6e0951414a314e7db3e9e24fd924b3e15515288 ] Every iteration of for_each_available_child_of_node() decrements the reference count of the previous node. When breaking early from a for_each_available_child_of_node() loop, we need to explicitly call of_node_put() on the child node. Add missing of_node_put() to avoid refcount leak. Fixes: 05589b30b21a ("soc: qcom: Extend AOSS QMP driver to support resource= s that are used to wake up the SoC.") Signed-off-by: Miaoqian Lin Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220606064252.42595-1-linmq006@gmail.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/soc/qcom/qcom_aoss.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/soc/qcom/qcom_aoss.c b/drivers/soc/qcom/qcom_aoss.c index 8583c1e558ae..3973accdc982 100644 --- a/drivers/soc/qcom/qcom_aoss.c +++ b/drivers/soc/qcom/qcom_aoss.c @@ -499,8 +499,10 @@ static int qmp_cooling_devices_register(struct qmp *qm= p) continue; ret =3D qmp_cooling_device_add(qmp, &qmp->cooling_devs[count++], child); - if (ret) + if (ret) { + of_node_put(child); goto unroll; + } } =20 if (!count) --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFA90C00140 for ; Mon, 15 Aug 2022 18:43:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239675AbiHOSnd (ORCPT ); Mon, 15 Aug 2022 14:43:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243454AbiHOSlG (ORCPT ); Mon, 15 Aug 2022 14:41:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB4813ED5D; Mon, 15 Aug 2022 11:24: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 BAFB260FB1; Mon, 15 Aug 2022 18:24:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0C42C433C1; Mon, 15 Aug 2022 18:24:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587878; bh=16N7gqoDhgtgU26/uFo+Xnm3wcLCzPvXEWtJM8/2n9s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yj5BWUEkA256LUWIbUUtCq/VUMRO6mWXssiBUlHGHUlPLMdYjbLQtxJ9XOIw87/de 6QOK9dlWG530s2AtrJQ6v1F7Vz+nPQaGDx6/nSHW2GuNNxSxjLrCEE+nxx+5E5AK47 Umtupk8OWsdgE440zgdeknZm/7qWd9t65/r3t1pk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 192/779] ARM: dts: qcom: pm8841: add required thermal-sensor-cells Date: Mon, 15 Aug 2022 19:57:16 +0200 Message-Id: <20220815180345.462671614@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 e2759fa0676c9a32bbddb9aff955b54bb35066ad ] The PM8841 temperature sensor has to define thermal-sensor-cells. Fixes: dab8134ca072 ("ARM: dts: qcom: Add PM8841 functions device nodes") Signed-off-by: Krzysztof Kozlowski Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220608112702.80873-2-krzysztof.kozlowski@= linaro.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm/boot/dts/qcom-pm8841.dtsi | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/boot/dts/qcom-pm8841.dtsi b/arch/arm/boot/dts/qcom-pm= 8841.dtsi index 2fd59c440903..c73e5b149ac5 100644 --- a/arch/arm/boot/dts/qcom-pm8841.dtsi +++ b/arch/arm/boot/dts/qcom-pm8841.dtsi @@ -25,6 +25,7 @@ temp-alarm@2400 { compatible =3D "qcom,spmi-temp-alarm"; reg =3D <0x2400>; interrupts =3D <4 0x24 0 IRQ_TYPE_EDGE_RISING>; + #thermal-sensor-cells =3D <0>; }; }; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A748DC00140 for ; Mon, 15 Aug 2022 18:43:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232002AbiHOSni (ORCPT ); Mon, 15 Aug 2022 14:43:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243519AbiHOSlN (ORCPT ); Mon, 15 Aug 2022 14:41: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 ABF573ED71; Mon, 15 Aug 2022 11:24: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 652A3B81071; Mon, 15 Aug 2022 18:24:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1865C433C1; Mon, 15 Aug 2022 18:24:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587881; bh=mxljtDHMst5iwqEorc0AT/oDFsf1xLqdqqSlxIcDaPk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tsXzkP+2Xf587toiRb5IavBEVUKIslYFv7K7gUyxbgeqSO0pXunAdMCZ9hgH65SLb YhAqRnPGRqrYg7AXtXe88j6+9opUlpKG2YUhJtwaAaZ5+G4D8R96H6jg8vp+ki1+Ra X6JVYAAIoUxX8Ol57Kn57SM7w5goxAo8wy8j9lY4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Yang Yingliang , John Garry , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.15 193/779] bus: hisi_lpc: fix missing platform_device_put() in hisi_lpc_acpi_probe() Date: Mon, 15 Aug 2022 19:57:17 +0200 Message-Id: <20220815180345.516784895@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 54872fea6a5ac967ec2272aea525d1438ac6735a ] In error case in hisi_lpc_acpi_probe() after calling platform_device_add(), hisi_lpc_acpi_remove() can't release the failed 'pdev', so it will be leak, call platform_device_put() to fix this problem. I'v constructed this error case and tested this patch on D05 board. Fixes: 99c0228d6ff1 ("HISI LPC: Re-Add ACPI child enumeration support") Reported-by: Hulk Robot Signed-off-by: Yang Yingliang Acked-by: John Garry Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/bus/hisi_lpc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/bus/hisi_lpc.c b/drivers/bus/hisi_lpc.c index 378f5d62a991..e7eaa8784fee 100644 --- a/drivers/bus/hisi_lpc.c +++ b/drivers/bus/hisi_lpc.c @@ -503,13 +503,13 @@ static int hisi_lpc_acpi_probe(struct device *hostdev) { struct acpi_device *adev =3D ACPI_COMPANION(hostdev); struct acpi_device *child; + struct platform_device *pdev; int ret; =20 /* Only consider the children of the host */ list_for_each_entry(child, &adev->children, node) { const char *hid =3D acpi_device_hid(child); const struct hisi_lpc_acpi_cell *cell; - struct platform_device *pdev; const struct resource *res; bool found =3D false; int num_res; @@ -571,22 +571,24 @@ static int hisi_lpc_acpi_probe(struct device *hostdev) =20 ret =3D platform_device_add_resources(pdev, res, num_res); if (ret) - goto fail; + goto fail_put_device; =20 ret =3D platform_device_add_data(pdev, cell->pdata, cell->pdata_size); if (ret) - goto fail; + goto fail_put_device; =20 ret =3D platform_device_add(pdev); if (ret) - goto fail; + goto fail_put_device; =20 acpi_device_set_enumerated(child); } =20 return 0; =20 +fail_put_device: + platform_device_put(pdev); fail: hisi_lpc_acpi_remove(hostdev); return ret; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E771C00140 for ; Mon, 15 Aug 2022 18:43:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243340AbiHOSnr (ORCPT ); Mon, 15 Aug 2022 14:43:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243548AbiHOSlP (ORCPT ); Mon, 15 Aug 2022 14:41:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD54B20F; Mon, 15 Aug 2022 11:24: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 9542FB81082; Mon, 15 Aug 2022 18:24:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6209C433D6; Mon, 15 Aug 2022 18:24:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587884; bh=8e8cLGBEfOgW7SXzthoRIC0+pNV2OH/E5k8Ju7+lsF4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d6p55P+yZKrFjxjb2YmLEUgzIBuHqYqwy0oVSw3Rr502bCfl4SJy4hh6l1A5DlBHR reo38AOTE/vVVBLyQfByrdMrT83Noj1WAdIfDQQP3QWD0bCwljvG1nynHCqFsRWBvN ShQIQmNZlxmoKSrAwk0X7c+j1qb+oYKmwHybNfe8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy , Xiu Jianfeng , "GONG, Ruiqi" , Kees Cook , Sasha Levin , GONG@vger.kernel.org Subject: [PATCH 5.15 194/779] stack: Declare {randomize_,}kstack_offset to fix Sparse warnings Date: Mon, 15 Aug 2022 19:57:18 +0200 Message-Id: <20220815180345.564511077@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: GONG, Ruiqi [ Upstream commit 375561bd6195a31bf4c109732bd538cb97a941f4 ] Fix the following Sparse warnings that got noticed when the PPC-dev patchwork was checking another patch (see the link below): init/main.c:862:1: warning: symbol 'randomize_kstack_offset' was not declar= ed. Should it be static? init/main.c:864:1: warning: symbol 'kstack_offset' was not declared. Should= it be static? Which in fact are triggered on all architectures that have HAVE_ARCH_RANDOMIZE_KSTACK_OFFSET support (for instances x86, arm64 etc). Link: https://lore.kernel.org/lkml/e7b0d68b-914d-7283-827c-101988923929@hua= wei.com/T/#m49b2d4490121445ce4bf7653500aba59eefcb67f Cc: Christophe Leroy Cc: Xiu Jianfeng Signed-off-by: GONG, Ruiqi Reviewed-by: Christophe Leroy Fixes: 39218ff4c625 ("stack: Optionally randomize kernel stack offset each = syscall") Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20220629060423.2515693-1-gongruiqi1@huawei.= com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- init/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/init/main.c b/init/main.c index cf79b5a766cb..649d9e4201a8 100644 --- a/init/main.c +++ b/init/main.c @@ -100,6 +100,7 @@ #include #include #include +#include #include =20 #include --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4EF8C00140 for ; Mon, 15 Aug 2022 18:43:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243294AbiHOSnn (ORCPT ); Mon, 15 Aug 2022 14:43:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243575AbiHOSlP (ORCPT ); Mon, 15 Aug 2022 14:41:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A58302ED5C; Mon, 15 Aug 2022 11:24: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 09EBA60FB8; Mon, 15 Aug 2022 18:24:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09CFFC433D6; Mon, 15 Aug 2022 18:24:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587887; bh=lJ6yWdOYTSwDorEM6lVgpgfm9KNuX8QvSpIRLKKt5tI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HID9Pvp994UzCkEQyZkTmj20pouSUqs3KQkmm9piE8Q5SztsC49sZG6OsqZzVf82S 7uk2jMXKtx91LD7cv2iWJ7izYSpPbgldA44cNhvl9KdkVeApn4AQQzNSv74Gna2rPk QX28wsrLixlLUAwcA31qGr2j82WJMoHos6rzPLyk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sireesh Kodali , Krzysztof Kozlowski , Stephan Gerhold , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 195/779] arm64: dts: qcom: msm8916: Fix typo in pronto remoteproc node Date: Mon, 15 Aug 2022 19:57:19 +0200 Message-Id: <20220815180345.614725077@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sireesh Kodali [ Upstream commit 5458d6f2827cd30218570f266b8d238417461f2f ] The smem-state properties for the pronto node were incorrectly labelled, reading `qcom,state*` rather than `qcom,smem-state*`. Fix that, allowing the stop state to be used. Fixes: 88106096cbf8 ("ARM: dts: msm8916: Add and enable wcnss node") Signed-off-by: Sireesh Kodali Reviewed-by: Krzysztof Kozlowski Reviewed-by: Stephan Gerhold Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220526141740.15834-3-sireeshkodali1@gmail= .com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm64/boot/dts/qcom/msm8916.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/msm8916.dtsi b/arch/arm64/boot/dts/qc= om/msm8916.dtsi index 8b2724272464..19e201f52b16 100644 --- a/arch/arm64/boot/dts/qcom/msm8916.dtsi +++ b/arch/arm64/boot/dts/qcom/msm8916.dtsi @@ -1747,8 +1747,8 @@ pronto: remoteproc@a21b000 { <&rpmpd MSM8916_VDDMX>; power-domain-names =3D "cx", "mx"; =20 - qcom,state =3D <&wcnss_smp2p_out 0>; - qcom,state-names =3D "stop"; + qcom,smem-states =3D <&wcnss_smp2p_out 0>; + qcom,smem-state-names =3D "stop"; =20 pinctrl-names =3D "default"; pinctrl-0 =3D <&wcnss_pin_a>; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B64C8C3F6B0 for ; Mon, 15 Aug 2022 18:43:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243363AbiHOSn4 (ORCPT ); Mon, 15 Aug 2022 14:43:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243739AbiHOSlV (ORCPT ); Mon, 15 Aug 2022 14:41: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 218A33F310; Mon, 15 Aug 2022 11:24: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 B5F06B8107B; Mon, 15 Aug 2022 18:24:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0376AC433C1; Mon, 15 Aug 2022 18:24:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587890; bh=fTJ+GKFxExYByx+UhcUuaJl58FpKrzPcfiV0L275q5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E7uuJ6R1UAJILWjtIoz1QAlHuUq8LlkoQHjG4EKb1l166TmzBaEfyhiX+CvByuRdn p2HP8Z6QzpQy5pDhm3LwrLLJplcgmzfWkgBJYXGNCepVl7RLxCc3NgIoU3a/rPcFQo hgH1Zwvan5WRI2IFqgNVF49ZLs+5czhvxR9IqGts= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shuai Xue , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.15 196/779] ACPI: APEI: explicit init of HEST and GHES in apci_init() Date: Mon, 15 Aug 2022 19:57:20 +0200 Message-Id: <20220815180345.647265939@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shuai Xue [ Upstream commit dc4e8c07e9e2f69387579c49caca26ba239f7270 ] >From commit e147133a42cb ("ACPI / APEI: Make hest.c manage the estatus memory pool") was merged, ghes_init() relies on acpi_hest_init() to manage the estatus memory pool. On the other hand, ghes_init() relies on sdei_init() to detect the SDEI version and (un)register events. The dependencies are as follows: ghes_init() =3D> acpi_hest_init() =3D> acpi_bus_init() =3D> acpi_init() ghes_init() =3D> sdei_init() HEST is not PCI-specific and initcall ordering is implicit and not well-defined within a level. Based on above, remove acpi_hest_init() from acpi_pci_root_init() and convert ghes_init() and sdei_init() from initcalls to explicit calls in the following order: acpi_hest_init() ghes_init() sdei_init() Signed-off-by: Shuai Xue Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/acpi/apei/ghes.c | 19 ++++++++----------- drivers/acpi/bus.c | 2 ++ drivers/acpi/pci_root.c | 3 --- drivers/firmware/Kconfig | 1 + drivers/firmware/arm_sdei.c | 13 ++----------- include/acpi/apei.h | 4 +++- include/linux/arm_sdei.h | 2 ++ 7 files changed, 18 insertions(+), 26 deletions(-) diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c index 0c8330ed1ffd..06b0184fa912 100644 --- a/drivers/acpi/apei/ghes.c +++ b/drivers/acpi/apei/ghes.c @@ -1457,33 +1457,35 @@ static struct platform_driver ghes_platform_driver = =3D { .remove =3D ghes_remove, }; =20 -static int __init ghes_init(void) +void __init ghes_init(void) { int rc; =20 + sdei_init(); + if (acpi_disabled) - return -ENODEV; + return; =20 switch (hest_disable) { case HEST_NOT_FOUND: - return -ENODEV; + return; case HEST_DISABLED: pr_info(GHES_PFX "HEST is not enabled!\n"); - return -EINVAL; + return; default: break; } =20 if (ghes_disable) { pr_info(GHES_PFX "GHES is not enabled!\n"); - return -EINVAL; + return; } =20 ghes_nmi_init_cxt(); =20 rc =3D platform_driver_register(&ghes_platform_driver); if (rc) - goto err; + return; =20 rc =3D apei_osc_setup(); if (rc =3D=3D 0 && osc_sb_apei_support_acked) @@ -1494,9 +1496,4 @@ static int __init ghes_init(void) pr_info(GHES_PFX "APEI firmware first mode is enabled by APEI bit.\n"); else pr_info(GHES_PFX "Failed to enable APEI firmware first mode.\n"); - - return 0; -err: - return rc; } -device_initcall(ghes_init); diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index 3500744e6862..fc9bb06d5411 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -1340,6 +1340,8 @@ static int __init acpi_init(void) =20 pci_mmcfg_late_init(); acpi_iort_init(); + acpi_hest_init(); + ghes_init(); acpi_scan_init(); acpi_ec_init(); acpi_debugfs_init(); diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index d7deedf3548e..223aa010dd8d 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -22,8 +22,6 @@ #include #include #include -#include /* for acpi_hest_init() */ - #include "internal.h" =20 #define ACPI_PCI_ROOT_CLASS "pci_bridge" @@ -938,7 +936,6 @@ struct pci_bus *acpi_pci_root_create(struct acpi_pci_ro= ot *root, =20 void __init acpi_pci_root_init(void) { - acpi_hest_init(); if (acpi_pci_disabled) return; =20 diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig index cda7d7162cbb..97ce31e667fc 100644 --- a/drivers/firmware/Kconfig +++ b/drivers/firmware/Kconfig @@ -40,6 +40,7 @@ config ARM_SCPI_POWER_DOMAIN config ARM_SDE_INTERFACE bool "ARM Software Delegated Exception Interface (SDEI)" depends on ARM64 + depends on ACPI_APEI_GHES help The Software Delegated Exception Interface (SDEI) is an ARM standard for registering callbacks from the platform firmware diff --git a/drivers/firmware/arm_sdei.c b/drivers/firmware/arm_sdei.c index a7e762c352f9..1e1a51510e83 100644 --- a/drivers/firmware/arm_sdei.c +++ b/drivers/firmware/arm_sdei.c @@ -1059,14 +1059,14 @@ static bool __init sdei_present_acpi(void) return true; } =20 -static int __init sdei_init(void) +void __init sdei_init(void) { struct platform_device *pdev; int ret; =20 ret =3D platform_driver_register(&sdei_driver); if (ret || !sdei_present_acpi()) - return ret; + return; =20 pdev =3D platform_device_register_simple(sdei_driver.driver.name, 0, NULL, 0); @@ -1076,17 +1076,8 @@ static int __init sdei_init(void) pr_info("Failed to register ACPI:SDEI platform device %d\n", ret); } - - return ret; } =20 -/* - * On an ACPI system SDEI needs to be ready before HEST:GHES tries to regi= ster - * its events. ACPI is initialised from a subsys_initcall(), GHES is initi= alised - * by device_initcall(). We want to be called in the middle. - */ -subsys_initcall_sync(sdei_init); - int sdei_event_handler(struct pt_regs *regs, struct sdei_registered_event *arg) { diff --git a/include/acpi/apei.h b/include/acpi/apei.h index 680f80960c3d..a6ac2e8b72da 100644 --- a/include/acpi/apei.h +++ b/include/acpi/apei.h @@ -27,14 +27,16 @@ extern int hest_disable; extern int erst_disable; #ifdef CONFIG_ACPI_APEI_GHES extern bool ghes_disable; +void __init ghes_init(void); #else #define ghes_disable 1 +static inline void ghes_init(void) { } #endif =20 #ifdef CONFIG_ACPI_APEI void __init acpi_hest_init(void); #else -static inline void acpi_hest_init(void) { return; } +static inline void acpi_hest_init(void) { } #endif =20 typedef int (*apei_hest_func_t)(struct acpi_hest_header *hest_hdr, void *d= ata); diff --git a/include/linux/arm_sdei.h b/include/linux/arm_sdei.h index 0a241c5c911d..14dc461b0e82 100644 --- a/include/linux/arm_sdei.h +++ b/include/linux/arm_sdei.h @@ -46,9 +46,11 @@ int sdei_unregister_ghes(struct ghes *ghes); /* For use by arch code when CPU hotplug notifiers are not appropriate. */ int sdei_mask_local_cpu(void); int sdei_unmask_local_cpu(void); +void __init sdei_init(void); #else static inline int sdei_mask_local_cpu(void) { return 0; } static inline int sdei_unmask_local_cpu(void) { return 0; } +static inline void sdei_init(void) { } #endif /* CONFIG_ARM_SDE_INTERFACE */ =20 =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64B3EC00140 for ; Mon, 15 Aug 2022 18:38:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232043AbiHOSiA (ORCPT ); Mon, 15 Aug 2022 14:38:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243575AbiHOSgq (ORCPT ); Mon, 15 Aug 2022 14:36:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFC732DA92; Mon, 15 Aug 2022 11:23: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 0961E6068D; Mon, 15 Aug 2022 18:23:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03EB8C433C1; Mon, 15 Aug 2022 18:23:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587792; bh=jhB3BcC4WMae6aGnSw8cXRASOVkW/NucMwW8lJkgSus=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CM3qRwLO9h9THO7BvI5+T7d28id8iR+JV/LPBweL0M/ZZgsrfxt9ylY4XSDxQNdN/ CpVmEYsfNaHLt6lFSRVLkzvWLxKLkhqkssE8lO7czx0wrxCcbZvucmG1hBOn+x0V+y V5Sc2DcgaG5pKtqsUUg8taTEGL501b/GoE/kbZFk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Len Baker , Jonathan Cameron , Sasha Levin Subject: [PATCH 5.15 197/779] drivers/iio: Remove all strcpy() uses Date: Mon, 15 Aug 2022 19:57:21 +0200 Message-Id: <20220815180345.695878214@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Baker [ Upstream commit d722f1e06fbc53eb369b39646945c1fa92068e74 ] strcpy() performs no bounds checking on the destination buffer. This could result in linear overflows beyond the end of the buffer, leading to all kinds of misbehaviors. So, remove all the uses and add devm_kstrdup() or devm_kasprintf() instead. Also, modify the "for" loop conditions to clarify the access to the st->orientation.rotation buffer. This patch is an effort to clean up the proliferation of str*() functions in the kernel and a previous step in the path to remove the strcpy function from the kernel entirely [1]. [1] https://github.com/KSPP/linux/issues/88 Signed-off-by: Len Baker Link: https://lore.kernel.org/r/20210815174204.126593-1-len.baker@gmx.com Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/iio/imu/inv_mpu6050/inv_mpu_magn.c | 36 +++++++++++++--------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_magn.c b/drivers/iio/imu/i= nv_mpu6050/inv_mpu_magn.c index f282e9cc34c5..6aee6c989485 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_magn.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_magn.c @@ -261,6 +261,7 @@ int inv_mpu_magn_set_rate(const struct inv_mpu6050_stat= e *st, int fifo_rate) */ int inv_mpu_magn_set_orient(struct inv_mpu6050_state *st) { + struct device *dev =3D regmap_get_device(st->map); const char *orient; char *str; int i; @@ -279,22 +280,27 @@ int inv_mpu_magn_set_orient(struct inv_mpu6050_state = *st) st->magn_orient.rotation[4] =3D st->orientation.rotation[1]; st->magn_orient.rotation[5] =3D st->orientation.rotation[2]; /* z <- -z */ - for (i =3D 0; i < 3; ++i) { - orient =3D st->orientation.rotation[6 + i]; - /* use length + 2 for adding minus sign if needed */ - str =3D devm_kzalloc(regmap_get_device(st->map), - strlen(orient) + 2, GFP_KERNEL); - if (str =3D=3D NULL) + for (i =3D 6; i < 9; ++i) { + orient =3D st->orientation.rotation[i]; + + /* + * The value is negated according to one of the following + * rules: + * + * 1) Drop leading minus. + * 2) Leave 0 as is. + * 3) Add leading minus. + */ + if (orient[0] =3D=3D '-') + str =3D devm_kstrdup(dev, orient + 1, GFP_KERNEL); + else if (!strcmp(orient, "0")) + str =3D devm_kstrdup(dev, orient, GFP_KERNEL); + else + str =3D devm_kasprintf(dev, GFP_KERNEL, "-%s", orient); + if (!str) return -ENOMEM; - if (strcmp(orient, "0") =3D=3D 0) { - strcpy(str, orient); - } else if (orient[0] =3D=3D '-') { - strcpy(str, &orient[1]); - } else { - str[0] =3D '-'; - strcpy(&str[1], orient); - } - st->magn_orient.rotation[6 + i] =3D str; + + st->magn_orient.rotation[i] =3D str; } break; default: --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2D58C00140 for ; Mon, 15 Aug 2022 18:38:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243243AbiHOSiI (ORCPT ); Mon, 15 Aug 2022 14:38:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243610AbiHOSgr (ORCPT ); Mon, 15 Aug 2022 14:36:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CC8F3C8CB; Mon, 15 Aug 2022 11:23: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 B0650B8106E; Mon, 15 Aug 2022 18:23:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16CA0C433D7; Mon, 15 Aug 2022 18:23:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587795; bh=Hb2R0SkT5uiniydQNAyBxRHeGOY/ofRQ3SDcxSmhPw8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tv09AXFUOgQXfqtoZ3srZff9Lp6Bk+LR50m6XnhQwVM6J9U1sZWBgUa6LImFztfii 3MHBOUKEIamqO51+WxJnUpAZUVkD8TENRiasZ2e8xKhaGAZyKggQnCy0OlDmF2zcTC 7nBI5+lWqlx5JZkzYTfA3IgqLUGyeUMekJei/gjE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Auger , Jin Liu , Jean-Philippe Brucker , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.15 198/779] ACPI: VIOT: Fix ACS setup Date: Mon, 15 Aug 2022 19:57:22 +0200 Message-Id: <20220815180345.736578716@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Auger [ Upstream commit 3dcb861dbc6ab101838a1548b1efddd00ca3c3ec ] Currently acpi_viot_init() gets called after the pci device has been scanned and pci_enable_acs() has been called. So pci_request_acs() fails to be taken into account leading to wrong single iommu group topologies when dealing with multi-function root ports for instance. We cannot simply move the acpi_viot_init() earlier, similarly as the IORT init because the VIOT parsing relies on the pci scan. However we can detect VIOT is present earlier and in such a case, request ACS. Introduce a new acpi_viot_early_init() routine that allows to call pci_request_acs() before the scan. While at it, guard the call to pci_request_acs() with #ifdef CONFIG_PCI. Fixes: 3cf485540e7b ("ACPI: Add driver for the VIOT table") Signed-off-by: Eric Auger Reported-by: Jin Liu Reviewed-by: Jean-Philippe Brucker Tested-by: Jean-Philippe Brucker Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/acpi/bus.c | 1 + drivers/acpi/viot.c | 26 ++++++++++++++++++++------ include/linux/acpi_viot.h | 2 ++ 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index fc9bb06d5411..7774b603a796 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -1340,6 +1340,7 @@ static int __init acpi_init(void) =20 pci_mmcfg_late_init(); acpi_iort_init(); + acpi_viot_early_init(); acpi_hest_init(); ghes_init(); acpi_scan_init(); diff --git a/drivers/acpi/viot.c b/drivers/acpi/viot.c index d2256326c73a..647f11cf165d 100644 --- a/drivers/acpi/viot.c +++ b/drivers/acpi/viot.c @@ -248,6 +248,26 @@ static int __init viot_parse_node(const struct acpi_vi= ot_header *hdr) return ret; } =20 +/** + * acpi_viot_early_init - Test the presence of VIOT and enable ACS + * + * If the VIOT does exist, ACS must be enabled. This cannot be + * done in acpi_viot_init() which is called after the bus scan + */ +void __init acpi_viot_early_init(void) +{ +#ifdef CONFIG_PCI + acpi_status status; + struct acpi_table_header *hdr; + + status =3D acpi_get_table(ACPI_SIG_VIOT, 0, &hdr); + if (ACPI_FAILURE(status)) + return; + pci_request_acs(); + acpi_put_table(hdr); +#endif +} + /** * acpi_viot_init - Parse the VIOT table * @@ -319,12 +339,6 @@ static int viot_pci_dev_iommu_init(struct pci_dev *pde= v, u16 dev_id, void *data) epid =3D ((domain_nr - ep->segment_start) << 16) + dev_id - ep->bdf_start + ep->endpoint_id; =20 - /* - * If we found a PCI range managed by the viommu, we're - * the one that has to request ACS. - */ - pci_request_acs(); - return viot_dev_iommu_init(&pdev->dev, ep->viommu, epid); } diff --git a/include/linux/acpi_viot.h b/include/linux/acpi_viot.h index 1eb8ee5b0e5f..a5a122431563 100644 --- a/include/linux/acpi_viot.h +++ b/include/linux/acpi_viot.h @@ -6,9 +6,11 @@ #include =20 #ifdef CONFIG_ACPI_VIOT +void __init acpi_viot_early_init(void); void __init acpi_viot_init(void); int viot_iommu_configure(struct device *dev); #else +static inline void acpi_viot_early_init(void) {} static inline void acpi_viot_init(void) {} static inline int viot_iommu_configure(struct device *dev) { --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97360C25B0E for ; Mon, 15 Aug 2022 18:38:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243550AbiHOSiY (ORCPT ); Mon, 15 Aug 2022 14:38:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243775AbiHOShJ (ORCPT ); Mon, 15 Aug 2022 14:37: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 BE2622DAAC; Mon, 15 Aug 2022 11:23: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 2BC16606A1; Mon, 15 Aug 2022 18:23:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B32BC433D6; Mon, 15 Aug 2022 18:23:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587798; bh=n9VQORGWzPhc/kcOX70pgDknOoffLZq6lASHL1R9My4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nmcgc8fbYghOrUEei5nogD4aMqmPis1IxlyEzBdwm4iqN+AjRm7qsgpz5Gv5r/nhV 7dnTfZmmlqtQfn7OEzLCge4i/+Atd/7amvAlwJ27+8CRMGKishlO287c6SAOwDE1z/ L/BqwFYxU3Ovhkf269jSgqn2MXaqyCJYOePGT3Jg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marijn Suijten , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 199/779] arm64: dts: qcom: sm6125: Move sdc2 pinctrl from seine-pdx201 to sm6125 Date: Mon, 15 Aug 2022 19:57:23 +0200 Message-Id: <20220815180345.778148429@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marijn Suijten [ Upstream commit 6990640a93ba4e76dd62ca3ea1082a7354db09d7 ] Both the sdc2-on and sdc2-off pinctrl nodes are used by the sdhci@4784000 node in sm6125.dtsi. Surprisingly sdc2-off is defined in sm6125, yet its sdc2-on counterpart is only defined in board-specific DT for the Sony Seine PDX201 board/device resulting in an "undefined label &sdc2_state_on" error if sm6125.dtsi were included elsewhere. This sm6125 base dtsi should not rely on externally defined labels; the properties referencing it should then also be written externally. Since the sdc2-on pin configuration is board-independent just like sdc2-off, move it from seine-pdx201.dts into sm6125.dtsi. The SDCard-detect pin (gpio98) is however board-specific, and remains as an overwrite in seine-pdx201.dts for both the on and off state. As a drive-by cleanup, reorder bias- and drive-strength properties. Fixes: cff4bbaf2a2d ("arm64: dts: qcom: Add support for SM6125") Fixes: 82e1783890b7 ("arm64: dts: qcom: sm6125: Add support for Sony Xperia= 10II") Signed-off-by: Marijn Suijten Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220508100336.127176-1-marijn.suijten@soma= inline.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- .../qcom/sm6125-sony-xperia-seine-pdx201.dts | 34 +++++-------------- arch/arm64/boot/dts/qcom/sm6125.dtsi | 24 +++++++++++-- 2 files changed, 30 insertions(+), 28 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts b= /arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts index 58b6b2742d3f..d4f0a15b763d 100644 --- a/arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts +++ b/arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts @@ -91,8 +91,16 @@ &hsusb_phy1 { &sdc2_state_off { sd-cd { pins =3D "gpio98"; + drive-strength =3D <2>; bias-disable; + }; +}; + +&sdc2_state_on { + sd-cd { + pins =3D "gpio98"; drive-strength =3D <2>; + bias-pull-up; }; }; =20 @@ -102,32 +110,6 @@ &sdhc_1 { =20 &tlmm { gpio-reserved-ranges =3D <22 2>, <28 6>; - - sdc2_state_on: sdc2-on { - clk { - pins =3D "sdc2_clk"; - bias-disable; - drive-strength =3D <16>; - }; - - cmd { - pins =3D "sdc2_cmd"; - bias-pull-up; - drive-strength =3D <10>; - }; - - data { - pins =3D "sdc2_data"; - bias-pull-up; - drive-strength =3D <10>; - }; - - sd-cd { - pins =3D "gpio98"; - bias-pull-up; - drive-strength =3D <2>; - }; - }; }; =20 &usb3 { diff --git a/arch/arm64/boot/dts/qcom/sm6125.dtsi b/arch/arm64/boot/dts/qco= m/sm6125.dtsi index 9f476e3d0720..cc16c05a2856 100644 --- a/arch/arm64/boot/dts/qcom/sm6125.dtsi +++ b/arch/arm64/boot/dts/qcom/sm6125.dtsi @@ -339,20 +339,40 @@ tlmm: pinctrl@500000 { sdc2_state_off: sdc2-off { clk { pins =3D "sdc2_clk"; - bias-disable; drive-strength =3D <2>; + bias-disable; }; =20 cmd { pins =3D "sdc2_cmd"; + drive-strength =3D <2>; bias-pull-up; + }; + + data { + pins =3D "sdc2_data"; drive-strength =3D <2>; + bias-pull-up; + }; + }; + + sdc2_state_on: sdc2-on { + clk { + pins =3D "sdc2_clk"; + drive-strength =3D <16>; + bias-disable; + }; + + cmd { + pins =3D "sdc2_cmd"; + drive-strength =3D <10>; + bias-pull-up; }; =20 data { pins =3D "sdc2_data"; + drive-strength =3D <10>; bias-pull-up; - drive-strength =3D <2>; }; }; }; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11287C00140 for ; Mon, 15 Aug 2022 18:38:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242096AbiHOSi1 (ORCPT ); Mon, 15 Aug 2022 14:38:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242598AbiHOSh1 (ORCPT ); Mon, 15 Aug 2022 14:37:27 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 464AF3C169; Mon, 15 Aug 2022 11:23: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 sin.source.kernel.org (Postfix) with ESMTPS id 4E545CE125A; Mon, 15 Aug 2022 18:23:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 516C4C433D6; Mon, 15 Aug 2022 18:23:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587801; bh=C3xbpJwAhnfKr/XlAqjzC9iNEjHpgSubprfOeAsxVoo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PS3s2d+rNHJrLg8RX0yn2lGxPTcFuHlskEIwfrwC8BTDEmhh+YeksWPI80bCJVYl9 eeCWinAy4Tp1Umf1q35GBINTD0ogkseYjAtyu9uTQrTBRsW7B4yUFtQVksXZBkv5ll 6T1Qho28bNZmsIfqr//hrQBLUnJMdmKXnXhFpwh4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marijn Suijten , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 200/779] arm64: dts: qcom: sm6125: Append -state suffix to pinctrl nodes Date: Mon, 15 Aug 2022 19:57:24 +0200 Message-Id: <20220815180345.821257007@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marijn Suijten [ Upstream commit cbfb5668aece448877fa7826cde81c9d06f4a4ac ] According to qcom,sm6125-pinctrl.yaml all nodes inside the tlmm must be suffixed by -state: qcom/sm6125-sony-xperia-seine-pdx201.dtb: pinctrl@500000: 'sdc2-off', '= sdc2-on' do not match any of the regexes: '-state$', 'pinctrl-[0-9]+' The label names have been updated to match, going from sdc2_state_X to sdc2_X_state. Fixes: cff4bbaf2a2d ("arm64: dts: qcom: Add support for SM6125") Fixes: 82e1783890b7 ("arm64: dts: qcom: sm6125: Add support for Sony Xperia= 10II") Signed-off-by: Marijn Suijten Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220508100336.127176-2-marijn.suijten@soma= inline.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- .../boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts | 4 ++-- arch/arm64/boot/dts/qcom/sm6125.dtsi | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts b= /arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts index d4f0a15b763d..47f8e5397ebb 100644 --- a/arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts +++ b/arch/arm64/boot/dts/qcom/sm6125-sony-xperia-seine-pdx201.dts @@ -88,7 +88,7 @@ &hsusb_phy1 { status =3D "okay"; }; =20 -&sdc2_state_off { +&sdc2_off_state { sd-cd { pins =3D "gpio98"; drive-strength =3D <2>; @@ -96,7 +96,7 @@ sd-cd { }; }; =20 -&sdc2_state_on { +&sdc2_on_state { sd-cd { pins =3D "gpio98"; drive-strength =3D <2>; diff --git a/arch/arm64/boot/dts/qcom/sm6125.dtsi b/arch/arm64/boot/dts/qco= m/sm6125.dtsi index cc16c05a2856..f89af5e35112 100644 --- a/arch/arm64/boot/dts/qcom/sm6125.dtsi +++ b/arch/arm64/boot/dts/qcom/sm6125.dtsi @@ -336,7 +336,7 @@ tlmm: pinctrl@500000 { interrupt-controller; #interrupt-cells =3D <2>; =20 - sdc2_state_off: sdc2-off { + sdc2_off_state: sdc2-off-state { clk { pins =3D "sdc2_clk"; drive-strength =3D <2>; @@ -356,7 +356,7 @@ data { }; }; =20 - sdc2_state_on: sdc2-on { + sdc2_on_state: sdc2-on-state { clk { pins =3D "sdc2_clk"; drive-strength =3D <16>; @@ -437,8 +437,8 @@ sdhc_2: sdhci@4784000 { <&xo_board>; clock-names =3D "iface", "core", "xo"; =20 - pinctrl-0 =3D <&sdc2_state_on>; - pinctrl-1 =3D <&sdc2_state_off>; + pinctrl-0 =3D <&sdc2_on_state>; + pinctrl-1 =3D <&sdc2_off_state>; pinctrl-names =3D "default", "sleep"; =20 bus-width =3D <4>; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65C2CC00140 for ; Mon, 15 Aug 2022 18:38:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243073AbiHOSib (ORCPT ); Mon, 15 Aug 2022 14:38:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243082AbiHOSha (ORCPT ); Mon, 15 Aug 2022 14:37:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0FE03C8C6; Mon, 15 Aug 2022 11:23:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CEE3DB81062; Mon, 15 Aug 2022 18:23:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40272C433B5; Mon, 15 Aug 2022 18:23:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587804; bh=iRpCryBKLWzjAZ24ANVmak3VRdOUk2Rm7xuw6ycNr2c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KpqqYnrik3uMISDL/cbAvfFvQU17XumLuTDM27xedt4AIasF+YNXLcnZFQfVtie4G YRwoVg9mpvZEE/DeAYrgsk8Tb12CK5a1eSxir/pNJAkvZUR2a49HRxC+4qh5M6xcw2 JCk8xn+MH0Fu+JAsuxdVdgtpAGQzyJmaP7GEvt2Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Dmitry Baryshkov , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 201/779] arm64: dts: qcom: sm8250: add missing PCIe PHY clock-cells Date: Mon, 15 Aug 2022 19:57:25 +0200 Message-Id: <20220815180345.865218328@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 [ Upstream commit d9fd162ce764c227fcfd4242f6c1639895a9481f ] Add the missing '#clock-cells' properties to the PCIe QMP PHY nodes. Signed-off-by: Johan Hovold Fixes: e53bdfc00977 ("arm64: dts: qcom: sm8250: Add PCIe support") Reviewed-by: Dmitry Baryshkov Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220705114032.22787-3-johan+linaro@kernel.= org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm64/boot/dts/qcom/sm8250.dtsi | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sm8250.dtsi b/arch/arm64/boot/dts/qco= m/sm8250.dtsi index 2786e2c8e565..b710bca45648 100644 --- a/arch/arm64/boot/dts/qcom/sm8250.dtsi +++ b/arch/arm64/boot/dts/qcom/sm8250.dtsi @@ -1472,6 +1472,8 @@ pcie0_lane: lanes@1c06200 { clock-names =3D "pipe0"; =20 #phy-cells =3D <0>; + + #clock-cells =3D <0>; clock-output-names =3D "pcie_0_pipe_clk"; }; }; @@ -1578,6 +1580,8 @@ pcie1_lane: lanes@1c0e200 { clock-names =3D "pipe0"; =20 #phy-cells =3D <0>; + + #clock-cells =3D <0>; clock-output-names =3D "pcie_1_pipe_clk"; }; }; @@ -1684,6 +1688,8 @@ pcie2_lane: lanes@1c16200 { clock-names =3D "pipe0"; =20 #phy-cells =3D <0>; + + #clock-cells =3D <0>; clock-output-names =3D "pcie_2_pipe_clk"; }; }; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9156C00140 for ; Mon, 15 Aug 2022 18:38:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241982AbiHOSio (ORCPT ); Mon, 15 Aug 2022 14:38:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242832AbiHOShs (ORCPT ); Mon, 15 Aug 2022 14:37:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BEA12DA93; Mon, 15 Aug 2022 11:23: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 2C022B81076; Mon, 15 Aug 2022 18:23:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DD4EC433C1; Mon, 15 Aug 2022 18:23:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587807; bh=N2RdsRIrM6WRIGT5nWpuL/jnQ9CZ60x4iAu8Qb1OEYE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DZX14rMm2Lvc85SBgJcmMutbbvUKM4cXGEsPjNmO+lsNHL7adLS3QkQF54A81q/+Y FHtTg/dP/EkKkDIA/UIhDlBBWtfmFKuffyQ6W2Rnjr+eMGa9pHazhwKcEsX0hAqjUV LymdsbgnsruXqBi7aQCFkyOcs4hANcYlJtQ05m1E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, INAGAKI Hiroshi , Nick Hainke , Matthias Brugger , Sasha Levin Subject: [PATCH 5.15 202/779] arm64: dts: mt7622: fix BPI-R64 WPS button Date: Mon, 15 Aug 2022 19:57:26 +0200 Message-Id: <20220815180345.915947932@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nick Hainke [ Upstream commit c98e6e683632386a3bd284acda4342e68aec4c41 ] The bananapi R64 (BPI-R64) experiences wrong WPS button signals. In OpenWrt pushing the WPS button while powering on the device will set it to recovery mode. Currently, this also happens without any user interaction. In particular, the wrong signals appear while booting the device or restarting it, e.g. after doing a system upgrade. If the device is in recovery mode the user needs to manually power cycle or restart it. The official BPI-R64 sources set the WPS button to GPIO_ACTIVE_LOW in the device tree. This setting seems to suppress the unwanted WPS button press signals. So this commit changes the button from GPIO_ACTIVE_HIGH to GPIO_ACTIVE_LOW. The official BPI-R64 sources can be found on https://github.com/BPI-SINOVOIP/BPI-R64-openwrt Fixes: 0b6286dd96c0 ("arm64: dts: mt7622: add bananapi BPI-R64 board") Suggested-by: INAGAKI Hiroshi Signed-off-by: Nick Hainke Link: https://lore.kernel.org/r/20220630111746.4098-1-vincent@systemli.org Signed-off-by: Matthias Brugger Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts b/arc= h/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts index 2f77dc40b9b8..6b99d903b479 100644 --- a/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts +++ b/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dts @@ -49,7 +49,7 @@ factory { wps { label =3D "wps"; linux,code =3D ; - gpios =3D <&pio 102 GPIO_ACTIVE_HIGH>; + gpios =3D <&pio 102 GPIO_ACTIVE_LOW>; }; }; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E70E0C25B0E for ; Mon, 15 Aug 2022 18:38:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243190AbiHOSiy (ORCPT ); Mon, 15 Aug 2022 14:38:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241862AbiHOSiP (ORCPT ); Mon, 15 Aug 2022 14:38: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 128933CBCA; Mon, 15 Aug 2022 11:23: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 32D52B81077; Mon, 15 Aug 2022 18:23:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8666CC433C1; Mon, 15 Aug 2022 18:23:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587810; bh=RxOBuLdbcvJUhR8pRPb57+gIPLNBhGcRnrqEWp92T+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rfRsiCuieif9ZxvVnUKKkJyQPctyPTO8RVYgWg5Bx4qzbL1L2HOleKLjG6tnqVoUk AbKnPw2bZBEC97JSY8hR9tffHOmL7yS9EjFRQuNqmPcpMJdooHLLGGyW2hkcuIN5jT GX/qaFPZJhMG94tn1HnC7FZma7nVns9n5LqXRwPc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thierry Reding , Sasha Levin Subject: [PATCH 5.15 203/779] arm64: tegra: Fixup SYSRAM references Date: Mon, 15 Aug 2022 19:57:27 +0200 Message-Id: <20220815180345.957114549@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 7fa307524a4d721d4a04523018509882c5414e72 ] The json-schema bindings for SRAM expect the nodes to be called "sram" rather than "sysram" or "shmem". Furthermore, place the brackets around the SYSRAM references such that a two-element array is created rather than a two-element array nested in a single-element array. This is not relevant for device tree itself, but allows the nodes to be properly validated against json-schema bindings. Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm64/boot/dts/nvidia/tegra186.dtsi | 2 +- arch/arm64/boot/dts/nvidia/tegra194.dtsi | 2 +- arch/arm64/boot/dts/nvidia/tegra234.dtsi | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/arm64/boot/dts/nvidia/tegra186.dtsi b/arch/arm64/boot/dts= /nvidia/tegra186.dtsi index 062e87e89331..8354512d7b1c 100644 --- a/arch/arm64/boot/dts/nvidia/tegra186.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra186.dtsi @@ -1635,7 +1635,7 @@ bpmp: bpmp { iommus =3D <&smmu TEGRA186_SID_BPMP>; mboxes =3D <&hsp_top0 TEGRA_HSP_MBOX_TYPE_DB TEGRA_HSP_DB_MASTER_BPMP>; - shmem =3D <&cpu_bpmp_tx &cpu_bpmp_rx>; + shmem =3D <&cpu_bpmp_tx>, <&cpu_bpmp_rx>; #clock-cells =3D <1>; #reset-cells =3D <1>; #power-domain-cells =3D <1>; diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts= /nvidia/tegra194.dtsi index 510d2974470c..a56fb83839a4 100644 --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi @@ -2267,7 +2267,7 @@ bpmp: bpmp { compatible =3D "nvidia,tegra186-bpmp"; mboxes =3D <&hsp_top0 TEGRA_HSP_MBOX_TYPE_DB TEGRA_HSP_DB_MASTER_BPMP>; - shmem =3D <&cpu_bpmp_tx &cpu_bpmp_rx>; + shmem =3D <&cpu_bpmp_tx>, <&cpu_bpmp_rx>; #clock-cells =3D <1>; #reset-cells =3D <1>; #power-domain-cells =3D <1>; diff --git a/arch/arm64/boot/dts/nvidia/tegra234.dtsi b/arch/arm64/boot/dts= /nvidia/tegra234.dtsi index f0efb3a62804..28961ed31d87 100644 --- a/arch/arm64/boot/dts/nvidia/tegra234.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra234.dtsi @@ -122,20 +122,20 @@ gic: interrupt-controller@f400000 { }; }; =20 - sysram@40000000 { + sram@40000000 { compatible =3D "nvidia,tegra234-sysram", "mmio-sram"; reg =3D <0x0 0x40000000 0x0 0x50000>; #address-cells =3D <1>; #size-cells =3D <1>; ranges =3D <0x0 0x0 0x40000000 0x50000>; =20 - cpu_bpmp_tx: shmem@4e000 { + cpu_bpmp_tx: sram@4e000 { reg =3D <0x4e000 0x1000>; label =3D "cpu-bpmp-tx"; pool; }; =20 - cpu_bpmp_rx: shmem@4f000 { + cpu_bpmp_rx: sram@4f000 { reg =3D <0x4f000 0x1000>; label =3D "cpu-bpmp-rx"; pool; @@ -146,7 +146,7 @@ bpmp: bpmp { compatible =3D "nvidia,tegra234-bpmp", "nvidia,tegra186-bpmp"; mboxes =3D <&hsp_top0 TEGRA_HSP_MBOX_TYPE_DB TEGRA_HSP_DB_MASTER_BPMP>; - shmem =3D <&cpu_bpmp_tx &cpu_bpmp_rx>; + shmem =3D <&cpu_bpmp_tx>, <&cpu_bpmp_rx>; #clock-cells =3D <1>; #reset-cells =3D <1>; #power-domain-cells =3D <1>; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 581C3C25B0E for ; Mon, 15 Aug 2022 18:39:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241637AbiHOSjB (ORCPT ); Mon, 15 Aug 2022 14:39:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243263AbiHOSiR (ORCPT ); Mon, 15 Aug 2022 14:38:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE6F52DABE; Mon, 15 Aug 2022 11:23: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 3385EB81082; Mon, 15 Aug 2022 18:23:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A639C433D7; Mon, 15 Aug 2022 18:23:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587814; bh=SxZDZwIpgLGEujOcYVEoKFphC/vj+7vaHu72hXjkwFQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ucAIf/SKr14xjHW+Nw2D/GN7r4Bay8Bcj4J7l7N76W1DcTZDJqfy93jNaWkExoQQc fOPj40H1B52LMDU0gsDgJOspnO9EK/ZKKIZgfTz6k3YosFqDK363S4EsOW/htRnub9 pasrGzqsPMThgmlelnbT6NwSwrP9HDKBr6GqwUrQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikko Perttunen , Thierry Reding , Sasha Levin Subject: [PATCH 5.15 204/779] arm64: tegra: Update Tegra234 BPMP channel addresses Date: Mon, 15 Aug 2022 19:57:28 +0200 Message-Id: <20220815180346.000100318@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mikko Perttunen [ Upstream commit 98094be152d34f8014ca67fbdc210e5261c4b09d ] On final Tegra234 systems, shared memory for communication with BPMP is located at offset 0x70000 in SYSRAM. Signed-off-by: Mikko Perttunen Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm64/boot/dts/nvidia/tegra234.dtsi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/arm64/boot/dts/nvidia/tegra234.dtsi b/arch/arm64/boot/dts= /nvidia/tegra234.dtsi index 28961ed31d87..144a7eb699a7 100644 --- a/arch/arm64/boot/dts/nvidia/tegra234.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra234.dtsi @@ -124,19 +124,19 @@ gic: interrupt-controller@f400000 { =20 sram@40000000 { compatible =3D "nvidia,tegra234-sysram", "mmio-sram"; - reg =3D <0x0 0x40000000 0x0 0x50000>; + reg =3D <0x0 0x40000000 0x0 0x80000>; #address-cells =3D <1>; #size-cells =3D <1>; - ranges =3D <0x0 0x0 0x40000000 0x50000>; + ranges =3D <0x0 0x0 0x40000000 0x80000>; =20 - cpu_bpmp_tx: sram@4e000 { - reg =3D <0x4e000 0x1000>; + cpu_bpmp_tx: sram@70000 { + reg =3D <0x70000 0x1000>; label =3D "cpu-bpmp-tx"; pool; }; =20 - cpu_bpmp_rx: sram@4f000 { - reg =3D <0x4f000 0x1000>; + cpu_bpmp_rx: sram@71000 { + reg =3D <0x71000 0x1000>; label =3D "cpu-bpmp-rx"; pool; }; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DED75C00140 for ; Mon, 15 Aug 2022 18:39:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242407AbiHOSjI (ORCPT ); Mon, 15 Aug 2022 14:39:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243531AbiHOSiX (ORCPT ); Mon, 15 Aug 2022 14:38: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 2C5D43C8FA; Mon, 15 Aug 2022 11:23: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 9C83CB81062; Mon, 15 Aug 2022 18:23:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B22A8C43470; Mon, 15 Aug 2022 18:23:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587817; bh=Kuj2M50v7Es9mL0wqjafMAdtgSOCl8NrfZFfG2xdwaw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lhluwB92tWLvpwfm7XHdHZ2rq/no9z8wA1i5ICXrKqiwhgSL2ICrLlp7EISW1XGRk L2bz0eApZdzI8lfPy2SUq/wD2krtrng6GF8xuM8KWSHEMCluCkhndtc0VlUR45x5QT DeshPXzI0w6ZmRlepAEpU+Cny9c4SDqHjltjCVx0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikko Perttunen , Yousaf Kaukab , Thierry Reding , Sasha Levin Subject: [PATCH 5.15 205/779] arm64: tegra: Mark BPMP channels as no-memory-wc Date: Mon, 15 Aug 2022 19:57:29 +0200 Message-Id: <20220815180346.035505502@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mikko Perttunen [ Upstream commit 61192a9d8a6367ae1b8234876941b037910a2459 ] The Tegra SYSRAM contains regions access to which is restricted to certain hardware blocks on the system, and speculative accesses to those will cause issues. Patch 'misc: sram: Only map reserved areas in Tegra SYSRAM' attempted to resolve this by only mapping the regions specified in the device tree on the assumption that there are no such restricted areas within the 64K-aligned area of memory that contains the memory we wish to map. Turns out this assumption is wrong, as there are such areas above the 4K pages described in the device trees. As such, we need to use the bigger hammer that is no-memory-wc, which causes the memory to be mapped as Device memory to which speculative accesses are disallowed. As such, the previous patch in the series, 'firmware: tegra: bpmp: do only aligned access to IPC memory area', is required with this patch to make the BPMP driver only issue aligned memory accesses as those are also required with Device memory. Fixes: fec29bf04994 ("misc: sram: Only map reserved areas in Tegra SYSRAM") Signed-off-by: Mikko Perttunen Reviewed-by: Yousaf Kaukab Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm64/boot/dts/nvidia/tegra186.dtsi | 1 + arch/arm64/boot/dts/nvidia/tegra194.dtsi | 1 + arch/arm64/boot/dts/nvidia/tegra234.dtsi | 1 + 3 files changed, 3 insertions(+) diff --git a/arch/arm64/boot/dts/nvidia/tegra186.dtsi b/arch/arm64/boot/dts= /nvidia/tegra186.dtsi index 8354512d7b1c..5b0bc9aa1a42 100644 --- a/arch/arm64/boot/dts/nvidia/tegra186.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra186.dtsi @@ -1583,6 +1583,7 @@ sram@30000000 { #address-cells =3D <1>; #size-cells =3D <1>; ranges =3D <0x0 0x0 0x30000000 0x50000>; + no-memory-wc; =20 cpu_bpmp_tx: sram@4e000 { reg =3D <0x4e000 0x1000>; diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts= /nvidia/tegra194.dtsi index a56fb83839a4..ca71b71d801a 100644 --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi @@ -2249,6 +2249,7 @@ sram@40000000 { #address-cells =3D <1>; #size-cells =3D <1>; ranges =3D <0x0 0x0 0x40000000 0x50000>; + no-memory-wc; =20 cpu_bpmp_tx: sram@4e000 { reg =3D <0x4e000 0x1000>; diff --git a/arch/arm64/boot/dts/nvidia/tegra234.dtsi b/arch/arm64/boot/dts= /nvidia/tegra234.dtsi index 144a7eb699a7..2b4784572220 100644 --- a/arch/arm64/boot/dts/nvidia/tegra234.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra234.dtsi @@ -128,6 +128,7 @@ sram@40000000 { #address-cells =3D <1>; #size-cells =3D <1>; ranges =3D <0x0 0x0 0x40000000 0x80000>; + no-memory-wc; =20 cpu_bpmp_tx: sram@70000 { reg =3D <0x70000 0x1000>; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB5A6C00140 for ; Mon, 15 Aug 2022 18:39:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242890AbiHOSjR (ORCPT ); Mon, 15 Aug 2022 14:39:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242120AbiHOSiZ (ORCPT ); Mon, 15 Aug 2022 14:38:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 060663CBFF; Mon, 15 Aug 2022 11:23: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 313FA60C07; Mon, 15 Aug 2022 18:23:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A9B2C433D6; Mon, 15 Aug 2022 18:23:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587820; bh=7yTsgTxRPiTe1CNGAyg1LU8nwoKF2gMiyP+86hKk4o4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EzC3ARo5Mbqhtxd4BelbW2+SFbV/GxYkdRudOUDJGVPfwFpvzcTcrID9Wvzy0FYKJ SNZTp1L6xC04akHkxJSDm7WBmXFeDMSWkaYPOyP8TYDhgOxP4fS8jzAXy01EFnjbaR tVSKLhdWFhHw8GfKZ68Jm7SfJ2I3qyNwrcAe6Zxo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Tam=C3=A1s=20Sz=C5=B1cs?= , Thierry Reding , Sasha Levin Subject: [PATCH 5.15 206/779] arm64: tegra: Fix SDMMC1 CD on P2888 Date: Mon, 15 Aug 2022 19:57:30 +0200 Message-Id: <20220815180346.082702041@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tam=C3=A1s Sz=C5=B1cs [ Upstream commit b415bb7c976f1d595ed752001c0938f702645dab ] Hook SDMMC1 CD up with CVM GPIO02 (SOC_GPIO11) used for card detection on J4 (uSD socket) on the carrier. Fixes: ef633bfc21e9 ("arm64: tegra: Enable card detect for SD card on P2888= ") Signed-off-by: Tam=C3=A1s Sz=C5=B1cs Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi b/arch/arm64/bo= ot/dts/nvidia/tegra194-p2888.dtsi index c4058ee36fec..1a444705517f 100644 --- a/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra194-p2888.dtsi @@ -75,7 +75,7 @@ eeprom@50 { =20 /* SDMMC1 (SD/MMC) */ mmc@3400000 { - cd-gpios =3D <&gpio TEGRA194_MAIN_GPIO(A, 0) GPIO_ACTIVE_LOW>; + cd-gpios =3D <&gpio TEGRA194_MAIN_GPIO(G, 7) GPIO_ACTIVE_LOW>; }; =20 /* SDMMC4 (eMMC) */ --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5B07C00140 for ; Mon, 15 Aug 2022 18:39:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241755AbiHOSj4 (ORCPT ); Mon, 15 Aug 2022 14:39:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240890AbiHOSix (ORCPT ); Mon, 15 Aug 2022 14:38:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A472F3D59A; Mon, 15 Aug 2022 11:23: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 0ABE76068D; Mon, 15 Aug 2022 18:23:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED809C433D7; Mon, 15 Aug 2022 18:23:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587827; bh=wxOLwuRbTjTq7t+voomz6BH+XUZah3K8GfdHFh66MGg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OKsFY2nAIKyAjvpZQYAJusxO5dHlBEoQML3cQsgDNgjoiyMG1D+aCkEFHJ+qXU/o+ 91EY07tirtpcvXkC9Ge4oP/3uTHe/vtzFcKiTIl7LOg67i1sW7Rp9Vp74hcLsfQuBw PrikwKwKtAsaoDVCcbXUvo1gWrKlagQvGyf7iFgk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liu Jinbao , Gao Xiang , Sasha Levin Subject: [PATCH 5.15 207/779] erofs: avoid consecutive detection for Highmem memory Date: Mon, 15 Aug 2022 19:57:31 +0200 Message-Id: <20220815180346.123733950@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Gao Xiang [ Upstream commit 448b5a1548d87c246c3d0c3df8480d3c6eb6c11a ] Currently, vmap()s are avoided if physical addresses are consecutive for decompressed buffers. I observed that is very common for 4KiB pclusters since the numbers of decompressed pages are almost 2 or 3. However, such detection doesn't work for Highmem pages on 32-bit machines, let's fix it now. Reported-by: Liu Jinbao Fixes: 7fc45dbc938a ("staging: erofs: introduce generic decompression backe= nd") Link: https://lore.kernel.org/r/20220708101001.21242-1-hsiangkao@linux.alib= aba.com Signed-off-by: Gao Xiang Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/erofs/decompressor.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/fs/erofs/decompressor.c b/fs/erofs/decompressor.c index ad3f31380e6b..8193c14bb111 100644 --- a/fs/erofs/decompressor.c +++ b/fs/erofs/decompressor.c @@ -93,14 +93,18 @@ static int z_erofs_lz4_prepare_destpages(struct z_erofs= _decompress_req *rq, =20 if (page) { __clear_bit(j, bounced); - if (kaddr) { - if (kaddr + PAGE_SIZE =3D=3D page_address(page)) + if (!PageHighMem(page)) { + if (!i) { + kaddr =3D page_address(page); + continue; + } + if (kaddr && + kaddr + PAGE_SIZE =3D=3D page_address(page)) { kaddr +=3D PAGE_SIZE; - else - kaddr =3D NULL; - } else if (!i) { - kaddr =3D page_address(page); + continue; + } } + kaddr =3D NULL; continue; } kaddr =3D NULL; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56299C00140 for ; Mon, 15 Aug 2022 18:40:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240164AbiHOSkY (ORCPT ); Mon, 15 Aug 2022 14:40:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243151AbiHOSjR (ORCPT ); Mon, 15 Aug 2022 14:39:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0098B3D5B4; Mon, 15 Aug 2022 11:23: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 B2A7DB81063; Mon, 15 Aug 2022 18:23:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23579C433C1; Mon, 15 Aug 2022 18:23:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587830; bh=HrjeGzSjUbhYge2bysfUgm0Vx0JRUCCCtMSjLG4PpmA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kIgIJX1RxbxcEOkP2plsL1hNBI7c8tf6sPPUbhIapSIDKAHfqQkLtyuYW13L2aar3 cNHeTOsdRKCGrszD2bnF0Mtc4Vep2lZD3W+7ao9whYxw3OdnFZg+sK1eQufDQ1XDDs y++lHPdZOFiYn+JsJ8ibe86mQqmSyOIq6mjZ33D8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yi Zhang , Ming Lei , Christoph Hellwig , Jens Axboe , Sasha Levin Subject: [PATCH 5.15 208/779] blk-mq: dont create hctx debugfs dir until q->debugfs_dir is created Date: Mon, 15 Aug 2022 19:57:32 +0200 Message-Id: <20220815180346.163032797@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Lei [ Upstream commit f3ec5d11554778c24ac8915e847223ed71d104fc ] blk_mq_debugfs_register_hctx() can be called by blk_mq_update_nr_hw_queues when gendisk isn't added yet, such as nvme tcp. Fixes the warning of 'debugfs: Directory 'hctx0' with parent '/' already pr= esent!' which can be observed reliably when running blktests nvme/005. Fixes: 6cfc0081b046 ("blk-mq: no need to check return value of debugfs_crea= te functions") Reported-by: Yi Zhang Signed-off-by: Ming Lei Tested-by: Yi Zhang Reviewed-by: Christoph Hellwig Link: https://lore.kernel.org/r/20220711090808.259682-1-ming.lei@redhat.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- block/blk-mq-debugfs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/block/blk-mq-debugfs.c b/block/blk-mq-debugfs.c index 3b38d15723de..7023257a133d 100644 --- a/block/blk-mq-debugfs.c +++ b/block/blk-mq-debugfs.c @@ -879,6 +879,9 @@ void blk_mq_debugfs_register_hctx(struct request_queue = *q, char name[20]; int i; =20 + if (!q->debugfs_dir) + return; + snprintf(name, sizeof(name), "hctx%u", hctx->queue_num); hctx->debugfs_dir =3D debugfs_create_dir(name, q->debugfs_dir); =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A9A0C25B0E for ; Mon, 15 Aug 2022 18:40:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242049AbiHOSkQ (ORCPT ); Mon, 15 Aug 2022 14:40:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240822AbiHOSjO (ORCPT ); Mon, 15 Aug 2022 14:39:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B9B82ED4B; Mon, 15 Aug 2022 11:23: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 43F5360FA3; Mon, 15 Aug 2022 18:23:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E031C433C1; Mon, 15 Aug 2022 18:23:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587833; bh=G2wKVs2hxomJLfCHleVjEq03UftGpFfhnCPiTRRTtEU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jk5ECl1GYkZOgqQqeAqUb3Y+A5s5NgKRVcOvfHU0oRwQOGGcBnPiDMscXTqmbYBHP rDVJWxHC+gWLm0oeqcdAyJTcwcqDAcsAFFcVcHu8a5+BlS/XJp94wcGBZlc2Vjz76w zlhmg0+sbnEu30z44lXQ2mTUEOeW73dO6UNGLMas= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yang Yingliang , Conor Dooley , Mark Brown , Sasha Levin Subject: [PATCH 5.15 209/779] spi: Fix simplification of devm_spi_register_controller Date: Mon, 15 Aug 2022 19:57:33 +0200 Message-Id: <20220815180346.204631619@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 43cc5a0afe4184a7fafe1eba32b5a11bb69c9ce0 ] This reverts commit 59ebbe40fb51 ("spi: simplify devm_spi_register_controller"). If devm_add_action() fails in devm_add_action_or_reset(), devm_spi_unregister() will be called, it decreases the refcount of 'ctlr->dev' to 0, then it will cause uaf in the drivers that calling spi_put_controller() in error path. Fixes: 59ebbe40fb51 ("spi: simplify devm_spi_register_controller") Signed-off-by: Yang Yingliang Reviewed-by: Conor Dooley Link: https://lore.kernel.org/r/20220712135504.1055688-1-yangyingliang@huaw= ei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/spi/spi.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index d0bbf8f9414d..556d65af5e23 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -2949,9 +2949,9 @@ int spi_register_controller(struct spi_controller *ct= lr) } EXPORT_SYMBOL_GPL(spi_register_controller); =20 -static void devm_spi_unregister(void *ctlr) +static void devm_spi_unregister(struct device *dev, void *res) { - spi_unregister_controller(ctlr); + spi_unregister_controller(*(struct spi_controller **)res); } =20 /** @@ -2970,13 +2970,22 @@ static void devm_spi_unregister(void *ctlr) int devm_spi_register_controller(struct device *dev, struct spi_controller *ctlr) { + struct spi_controller **ptr; int ret; =20 + ptr =3D devres_alloc(devm_spi_unregister, sizeof(*ptr), GFP_KERNEL); + if (!ptr) + return -ENOMEM; + ret =3D spi_register_controller(ctlr); - if (ret) - return ret; + if (!ret) { + *ptr =3D ctlr; + devres_add(dev, ptr); + } else { + devres_free(ptr); + } =20 - return devm_add_action_or_reset(dev, devm_spi_unregister, ctlr); + return ret; } EXPORT_SYMBOL_GPL(devm_spi_register_controller); =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9D9EC00140 for ; Mon, 15 Aug 2022 18:42:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238419AbiHOSkc (ORCPT ); Mon, 15 Aug 2022 14:40:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242853AbiHOSj3 (ORCPT ); Mon, 15 Aug 2022 14:39:29 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5CAFE2E9DA; Mon, 15 Aug 2022 11:24: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 7927DCE125D; Mon, 15 Aug 2022 18:23:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59E83C433D6; Mon, 15 Aug 2022 18:23:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587836; bh=aYfBpaDeef5Znhw5Y3gET+gcNL4/+NCrvZDXnC7zbfs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FWyf6+E1YidnHic1n8UjkaiIiMXPqt/2/X4iyhwLCjb0G2y+vgil2LRcqv7CCXDF7 hYjiiih/kOJxUT9ot+MUqj00mqzjfPj64pu6qAPVaDvErm7HCxYlox/2RI9r/6a0G+ YLsHtkdIZH7wOFHj36HEZMNTn4ve37/8SfJM9PdU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yang Yingliang , Mark Brown , Sasha Levin Subject: [PATCH 5.15 210/779] spi: tegra20-slink: fix UAF in tegra_slink_remove() Date: Mon, 15 Aug 2022 19:57:34 +0200 Message-Id: <20220815180346.251985427@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 7e9984d183bb1e99e766c5c2b950ff21f7f7b6c0 ] After calling spi_unregister_master(), the refcount of master will be decrease to 0, and it will be freed in spi_controller_release(), the device data also will be freed, so it will lead a UAF when using 'tspi'. To fix this, get the master before unregister and put it when finish using it. Fixes: 26c863418221 ("spi: tegra20-slink: Don't use resource-managed spi_re= gister helper") Signed-off-by: Yang Yingliang Link: https://lore.kernel.org/r/20220713094024.1508869-1-yangyingliang@huaw= ei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/spi/spi-tegra20-slink.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slin= k.c index 3b44ca455049..cf61bf302a05 100644 --- a/drivers/spi/spi-tegra20-slink.c +++ b/drivers/spi/spi-tegra20-slink.c @@ -1130,7 +1130,7 @@ static int tegra_slink_probe(struct platform_device *= pdev) =20 static int tegra_slink_remove(struct platform_device *pdev) { - struct spi_master *master =3D platform_get_drvdata(pdev); + struct spi_master *master =3D spi_master_get(platform_get_drvdata(pdev)); struct tegra_slink_data *tspi =3D spi_master_get_devdata(master); =20 spi_unregister_master(master); @@ -1145,6 +1145,7 @@ static int tegra_slink_remove(struct platform_device = *pdev) if (tspi->rx_dma_chan) tegra_slink_deinit_dma_param(tspi, true); =20 + spi_master_put(master); return 0; } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A9E4C00140 for ; Mon, 15 Aug 2022 18:42:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240174AbiHOSmU (ORCPT ); Mon, 15 Aug 2022 14:42:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243064AbiHOSj3 (ORCPT ); Mon, 15 Aug 2022 14:39: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 852D83DBCF; Mon, 15 Aug 2022 11:24: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 9A5AD60693; Mon, 15 Aug 2022 18:24:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AEFBC433D6; Mon, 15 Aug 2022 18:23:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587840; bh=IKW68nveAglgeNnym+vgT6nzaVOyqVoVUfARrjdeb+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1Abq/V9/gEqDVehcVkBivKpMyA5ZcCY49bVGoK29XyjEebku34YDPl6rgovDMRUYh nsnbfEvDMRgHh75ln1Gh8Tpv+jmIPU51pO2yBytnFNderNUT+PvEUVCVkDkwlSW0eJ tkCmAiI/VEqWv1Eu+5v1TtR/2KedMXPElQEzvjPs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Walleij , Guenter Roeck , Sasha Levin Subject: [PATCH 5.15 211/779] hwmon: (drivetemp) Add module alias Date: Mon, 15 Aug 2022 19:57:35 +0200 Message-Id: <20220815180346.291262633@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Linus Walleij [ Upstream commit 5918036cfa8ded7aa8094db70295011ce2275447 ] Adding a MODULE_ALIAS() to drivetemp will make the driver easier for modprobe to autoprobe. Signed-off-by: Linus Walleij Link: https://lore.kernel.org/r/20220712214624.1845158-1-linus.walleij@lina= ro.org Fixes: 5b46903d8bf3 ("hwmon: Driver for disk and solid state drives with te= mperature sensors") Signed-off-by: Guenter Roeck Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/hwmon/drivetemp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/hwmon/drivetemp.c b/drivers/hwmon/drivetemp.c index 1eb37106a220..5bac2b0fc7bb 100644 --- a/drivers/hwmon/drivetemp.c +++ b/drivers/hwmon/drivetemp.c @@ -621,3 +621,4 @@ module_exit(drivetemp_exit); MODULE_AUTHOR("Guenter Roeck "); MODULE_DESCRIPTION("Hard drive temperature monitor"); MODULE_LICENSE("GPL"); +MODULE_ALIAS("platform:drivetemp"); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABC97C25B0E for ; Mon, 15 Aug 2022 18:42:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240964AbiHOSm1 (ORCPT ); Mon, 15 Aug 2022 14:42:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242116AbiHOSjf (ORCPT ); Mon, 15 Aug 2022 14:39:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2C9B2E9CB; Mon, 15 Aug 2022 11:24: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 8843BB8107D; Mon, 15 Aug 2022 18:24:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CDE04C433C1; Mon, 15 Aug 2022 18:24:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587843; bh=+SaP3gmWf4f5WaHNpSY5rM3TjSJ1M5UNAjKxCjepiPk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cEw0bJEhjjCGrPPdASUhHpUlB5ujJJGChLbngfmUnSvtVMGGLKcW/dy/uDMKPV2J6 6wQFeIGbgbPDB/dGrcYMGtw20UMul7xJHS6FL3jQ5jnxSzMvzmdydK7n8862u+aGnq B451uL+Pp8pjFM9aNWdoTNhWNNK7B1cpADhDae6w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Junichi Nomura , Mike Snitzer , Mike Christie , Li Zefan , Chaitanya Kulkarni , Bart Van Assche , Jens Axboe , Sasha Levin Subject: [PATCH 5.15 212/779] blktrace: Trace remapped requests correctly Date: Mon, 15 Aug 2022 19:57:36 +0200 Message-Id: <20220815180346.333152873@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bart Van Assche [ Upstream commit 22c80aac882f712897b88b7ea8f5a74ea19019df ] Trace the remapped operation and its flags instead of only the data direction of remapped operations. This issue was detected by analyzing the warnings reported by sparse related to the new blk_opf_t type. Reviewed-by: Jun'ichi Nomura Cc: Mike Snitzer Cc: Mike Christie Cc: Li Zefan Cc: Chaitanya Kulkarni Fixes: 1b9a9ab78b0a ("blktrace: use op accessors") Signed-off-by: Bart Van Assche Link: https://lore.kernel.org/r/20220714180729.1065367-11-bvanassche@acm.org Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- kernel/trace/blktrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index c42ff77eb6cc..eaa98e2b468f 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -1058,7 +1058,7 @@ static void blk_add_trace_rq_remap(void *ignore, stru= ct request *rq, dev_t dev, r.sector_from =3D cpu_to_be64(from); =20 __blk_add_trace(bt, blk_rq_pos(rq), blk_rq_bytes(rq), - rq_data_dir(rq), 0, BLK_TA_REMAP, 0, + req_op(rq), rq->cmd_flags, BLK_TA_REMAP, 0, sizeof(r), &r, blk_trace_request_get_cgid(rq)); rcu_read_unlock(); } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FAA6C3F6B0 for ; Mon, 15 Aug 2022 18:42:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241813AbiHOSmc (ORCPT ); Mon, 15 Aug 2022 14:42:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240650AbiHOSjs (ORCPT ); Mon, 15 Aug 2022 14:39: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 D26262E693; Mon, 15 Aug 2022 11:24: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 0F0C960F23; Mon, 15 Aug 2022 18:24:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0540BC433C1; Mon, 15 Aug 2022 18:24:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587846; bh=fRAAddhRsAHDwptBTq1uHqpI89s3n65ppRpfsul8gAQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yBjuSUx/c9QI5hhGh43fWq503vQ5wRh5PydkZp6+WTnfHFCt2HWVFvfzv0bOhYEWH 7Memzk8QwfwPBAAtDaeSWrfcEI24fCOxeXn/NDqeMAMKgETv0VsYW5jSIfw80P+rYw ETpek1tZIZAFL4ld8qjDziTj+dEn3MeJvRnb0Hz0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hsin-Yi Wang , AngeloGioacchino Del Regno , Ulf Hansson , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.15 213/779] PM: domains: Ensure genpd_debugfs_dir exists before remove Date: Mon, 15 Aug 2022 19:57:37 +0200 Message-Id: <20220815180346.383118585@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hsin-Yi Wang [ Upstream commit 37101d3c719386040ded735a5ec06974f1d94d1f ] Both genpd_debug_add() and genpd_debug_remove() may be called indirectly by other drivers while genpd_debugfs_dir is not yet set. For example, drivers can call pm_genpd_init() in probe or pm_genpd_init() in probe fail/cleanup path: pm_genpd_init() --> genpd_debug_add() pm_genpd_remove() --> genpd_remove() --> genpd_debug_remove() At this time, genpd_debug_init() may not yet be called. genpd_debug_add() checks that if genpd_debugfs_dir is NULL, it will return directly. Make sure this is also checked in pm_genpd_remove(), otherwise components under debugfs root which has the same name as other components under pm_genpd may be accidentally removed, since NULL represents debugfs root. Fixes: 718072ceb211 ("PM: domains: create debugfs nodes when adding power d= omains") Signed-off-by: Hsin-Yi Wang Reviewed-by: Greg Kroah-Hartman Reviewed-by: AngeloGioacchino Del Regno Reviewed-by: Ulf Hansson Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/base/power/domain.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 0f2e42f36851..7f3d21e6fdfb 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -219,6 +219,9 @@ static void genpd_debug_remove(struct generic_pm_domain= *genpd) { struct dentry *d; =20 + if (!genpd_debugfs_dir) + return; + d =3D debugfs_lookup(genpd->name, genpd_debugfs_dir); debugfs_remove(d); } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88B7CC3F6B0 for ; Mon, 15 Aug 2022 18:42:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242397AbiHOSmq (ORCPT ); Mon, 15 Aug 2022 14:42:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241863AbiHOSkN (ORCPT ); Mon, 15 Aug 2022 14:40:13 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 563FE2E9FA; Mon, 15 Aug 2022 11:24: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 sin.source.kernel.org (Postfix) with ESMTPS id 5895CCE125E; Mon, 15 Aug 2022 18:24:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47CDFC433C1; Mon, 15 Aug 2022 18:24:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587849; bh=OjOARvY0YcFokuRRucf5klFfZD/HS+kNlouZPw8ybEM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TlUFLSDG4+xMGWeFWXYB/mbc5LFpcHuzlOu0FOLk8TTOidgSILQRPa3mQAcGZzks9 WBDj9yNtwoOp+8h9htB9YQxkviXZHLib1wglo5AwVOuNEK/yU5OApA+zcbsLIbsqB3 2G3dQ0bmj1fLsAT91i2FF8WQK5U1LPR5Jgok+oZI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , Mike Snitzer , Sasha Levin Subject: [PATCH 5.15 214/779] dm writecache: return void from functions Date: Mon, 15 Aug 2022 19:57:38 +0200 Message-Id: <20220815180346.415943074@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 9bc0c92e4b82adb017026dbb2aa816b1ac2bef31 ] The functions writecache_map_remap_origin and writecache_bio_copy_ssd only return a single value, thus they can be made to return void. This helps simplify the following IO accounting changes. Signed-off-by: Mikulas Patocka Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/md/dm-writecache.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c index 18320444fb0a..e3d0a9bb27b5 100644 --- a/drivers/md/dm-writecache.c +++ b/drivers/md/dm-writecache.c @@ -1328,8 +1328,8 @@ enum wc_map_op { WC_MAP_ERROR, }; =20 -static enum wc_map_op writecache_map_remap_origin(struct dm_writecache *wc= , struct bio *bio, - struct wc_entry *e) +static void writecache_map_remap_origin(struct dm_writecache *wc, struct b= io *bio, + struct wc_entry *e) { if (e) { sector_t next_boundary =3D @@ -1337,8 +1337,6 @@ static enum wc_map_op writecache_map_remap_origin(str= uct dm_writecache *wc, stru if (next_boundary < bio->bi_iter.bi_size >> SECTOR_SHIFT) dm_accept_partial_bio(bio, next_boundary); } - - return WC_MAP_REMAP_ORIGIN; } =20 static enum wc_map_op writecache_map_read(struct dm_writecache *wc, struct= bio *bio) @@ -1365,14 +1363,15 @@ static enum wc_map_op writecache_map_read(struct dm= _writecache *wc, struct bio * map_op =3D WC_MAP_REMAP; } } else { - map_op =3D writecache_map_remap_origin(wc, bio, e); + writecache_map_remap_origin(wc, bio, e); + map_op =3D WC_MAP_REMAP_ORIGIN; } =20 return map_op; } =20 -static enum wc_map_op writecache_bio_copy_ssd(struct dm_writecache *wc, st= ruct bio *bio, - struct wc_entry *e, bool search_used) +static void writecache_bio_copy_ssd(struct dm_writecache *wc, struct bio *= bio, + struct wc_entry *e, bool search_used) { unsigned bio_size =3D wc->block_size; sector_t start_cache_sec =3D cache_sector(wc, e); @@ -1418,8 +1417,6 @@ static enum wc_map_op writecache_bio_copy_ssd(struct = dm_writecache *wc, struct b } else { writecache_schedule_autocommit(wc); } - - return WC_MAP_REMAP; } =20 static enum wc_map_op writecache_map_write(struct dm_writecache *wc, struc= t bio *bio) @@ -1457,7 +1454,8 @@ static enum wc_map_op writecache_map_write(struct dm_= writecache *wc, struct bio direct_write: wc->stats.writes_around++; e =3D writecache_find_entry(wc, bio->bi_iter.bi_sector, WFE_RETURN_FOL= LOWING); - return writecache_map_remap_origin(wc, bio, e); + writecache_map_remap_origin(wc, bio, e); + return WC_MAP_REMAP_ORIGIN; } wc->stats.writes_blocked_on_freelist++; writecache_wait_on_freelist(wc); @@ -1468,10 +1466,12 @@ static enum wc_map_op writecache_map_write(struct d= m_writecache *wc, struct bio wc->uncommitted_blocks++; wc->stats.writes_allocate++; bio_copy: - if (WC_MODE_PMEM(wc)) + if (WC_MODE_PMEM(wc)) { bio_copy_block(wc, bio, memory_data(wc, e)); - else - return writecache_bio_copy_ssd(wc, bio, e, search_used); + } else { + writecache_bio_copy_ssd(wc, bio, e, search_used); + return WC_MAP_REMAP; + } } while (bio->bi_iter.bi_size); =20 if (unlikely(bio->bi_opf & REQ_FUA || wc->uncommitted_blocks >=3D wc->aut= ocommit_blocks)) --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7A67C00140 for ; Mon, 15 Aug 2022 18:42:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242623AbiHOSmv (ORCPT ); Mon, 15 Aug 2022 14:42:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242019AbiHOSkP (ORCPT ); Mon, 15 Aug 2022 14:40:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCBCA2E6AE; Mon, 15 Aug 2022 11:24: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 9EC0560FA3; Mon, 15 Aug 2022 18:24:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B90EC433D6; Mon, 15 Aug 2022 18:24:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587853; bh=fMnFgYb+bYaDSGvOdBhrx5oW0FvbsyErxXYJwlmU99o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PlTSO8p3LRwkLmHdXmtMmEMmRvmSqkEhTOVXlRAFjVivP6Tsc9lCyc39JhuQ96BDF TJf0mml10ydhCXgGCkWDdpbkJTJGTR4vZn2gtXMR5XHs6L9FDwh+87SRgT6y44WrXq DFe+K/m2eItCKUwAWTipzdAS5DRnrINARzhF/Zrs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yu Kuai , Mikulas Patocka , Mike Snitzer , Sasha Levin Subject: [PATCH 5.15 215/779] dm writecache: count number of blocks read, not number of read bios Date: Mon, 15 Aug 2022 19:57:39 +0200 Message-Id: <20220815180346.465007955@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 2c6e755b49d273243431f5f1184654e71221fc78 ] Change dm-writecache, so that it counts the number of blocks read instead of the number of read bios. Bios can be split and requeued using the dm_accept_partial_bio function, so counting bios caused inaccurate results. Fixes: e3a35d03407c ("dm writecache: add event counters") Reported-by: Yu Kuai Signed-off-by: Mikulas Patocka Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- Documentation/admin-guide/device-mapper/writecache.rst | 4 ++-- drivers/md/dm-writecache.c | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Documentation/admin-guide/device-mapper/writecache.rst b/Docum= entation/admin-guide/device-mapper/writecache.rst index 10429779a91a..7bead3b52690 100644 --- a/Documentation/admin-guide/device-mapper/writecache.rst +++ b/Documentation/admin-guide/device-mapper/writecache.rst @@ -78,8 +78,8 @@ Status: 2. the number of blocks 3. the number of free blocks 4. the number of blocks under writeback -5. the number of read requests -6. the number of read requests that hit the cache +5. the number of read blocks +6. the number of read blocks that hit the cache 7. the number of write requests 8. the number of write requests that hit uncommitted block 9. the number of write requests that hit committed block diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c index e3d0a9bb27b5..9d6b7b706a65 100644 --- a/drivers/md/dm-writecache.c +++ b/drivers/md/dm-writecache.c @@ -1364,6 +1364,7 @@ static enum wc_map_op writecache_map_read(struct dm_w= ritecache *wc, struct bio * } } else { writecache_map_remap_origin(wc, bio, e); + wc->stats.reads +=3D (bio->bi_iter.bi_size - wc->block_size) >> wc->bloc= k_size_bits; map_op =3D WC_MAP_REMAP_ORIGIN; } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4D78C25B08 for ; Mon, 15 Aug 2022 18:43:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233281AbiHOSm6 (ORCPT ); Mon, 15 Aug 2022 14:42:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242581AbiHOSkj (ORCPT ); Mon, 15 Aug 2022 14:40:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4EDC3DBF5; Mon, 15 Aug 2022 11:24: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 6BBF5B80F99; Mon, 15 Aug 2022 18:24:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B52A3C433C1; Mon, 15 Aug 2022 18:24:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587856; bh=puVQCDxV+dBSjrwYCK79NSsZDZj3njSZ6AHPcdAQAN0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DLafvVNoDlYR1fWQxNjtkKqBS11EtuLGB3CsZV8od0yIqL5CeWAcHA+vwEpyTTOkl zWePwcU4mLI7zHCrm5YzfFKWiASCCvdmNKBXVYZgoJdxh0YEqH4q1l7JvfmWWl6jRc g9zlDgr2k8gZT9GaxecYYirJynNWyhsDjtBBhgLY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yu Kuai , Mikulas Patocka , Mike Snitzer , Sasha Levin Subject: [PATCH 5.15 216/779] dm writecache: count number of blocks written, not number of write bios Date: Mon, 15 Aug 2022 19:57:40 +0200 Message-Id: <20220815180346.504719896@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 b2676e1482af89714af6988ce5d31a84692e2530 ] Change dm-writecache, so that it counts the number of blocks written instead of the number of write bios. Bios can be split and requeued using the dm_accept_partial_bio function, so counting bios caused inaccurate results. Fixes: e3a35d03407c ("dm writecache: add event counters") Reported-by: Yu Kuai Signed-off-by: Mikulas Patocka Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- .../admin-guide/device-mapper/writecache.rst | 10 +++++----- drivers/md/dm-writecache.c | 12 +++++++++--- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Documentation/admin-guide/device-mapper/writecache.rst b/Docum= entation/admin-guide/device-mapper/writecache.rst index 7bead3b52690..6c9a2c74df8a 100644 --- a/Documentation/admin-guide/device-mapper/writecache.rst +++ b/Documentation/admin-guide/device-mapper/writecache.rst @@ -80,11 +80,11 @@ Status: 4. the number of blocks under writeback 5. the number of read blocks 6. the number of read blocks that hit the cache -7. the number of write requests -8. the number of write requests that hit uncommitted block -9. the number of write requests that hit committed block -10. the number of write requests that bypass the cache -11. the number of write requests that are allocated in the cache +7. the number of write blocks +8. the number of write blocks that hit uncommitted block +9. the number of write blocks that hit committed block +10. the number of write blocks that bypass the cache +11. the number of write blocks that are allocated in the cache 12. the number of write requests that are blocked on the freelist 13. the number of flush requests 14. the number of discard requests diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c index 9d6b7b706a65..c90408eb9c3a 100644 --- a/drivers/md/dm-writecache.c +++ b/drivers/md/dm-writecache.c @@ -1412,6 +1412,9 @@ static void writecache_bio_copy_ssd(struct dm_writeca= che *wc, struct bio *bio, bio->bi_iter.bi_sector =3D start_cache_sec; dm_accept_partial_bio(bio, bio_size >> SECTOR_SHIFT); =20 + wc->stats.writes +=3D bio->bi_iter.bi_size >> wc->block_size_bits; + wc->stats.writes_allocate +=3D (bio->bi_iter.bi_size - wc->block_size) >>= wc->block_size_bits; + if (unlikely(wc->uncommitted_blocks >=3D wc->autocommit_blocks)) { wc->uncommitted_blocks =3D 0; queue_work(wc->writeback_wq, &wc->flush_work); @@ -1427,9 +1430,10 @@ static enum wc_map_op writecache_map_write(struct dm= _writecache *wc, struct bio do { bool found_entry =3D false; bool search_used =3D false; - wc->stats.writes++; - if (writecache_has_error(wc)) + if (writecache_has_error(wc)) { + wc->stats.writes +=3D bio->bi_iter.bi_size >> wc->block_size_bits; return WC_MAP_ERROR; + } e =3D writecache_find_entry(wc, bio->bi_iter.bi_sector, 0); if (e) { if (!writecache_entry_is_committed(wc, e)) { @@ -1453,9 +1457,10 @@ static enum wc_map_op writecache_map_write(struct dm= _writecache *wc, struct bio if (unlikely(!e)) { if (!WC_MODE_PMEM(wc) && !found_entry) { direct_write: - wc->stats.writes_around++; e =3D writecache_find_entry(wc, bio->bi_iter.bi_sector, WFE_RETURN_FOL= LOWING); writecache_map_remap_origin(wc, bio, e); + wc->stats.writes_around +=3D bio->bi_iter.bi_size >> wc->block_size_bi= ts; + wc->stats.writes +=3D bio->bi_iter.bi_size >> wc->block_size_bits; return WC_MAP_REMAP_ORIGIN; } wc->stats.writes_blocked_on_freelist++; @@ -1469,6 +1474,7 @@ static enum wc_map_op writecache_map_write(struct dm_= writecache *wc, struct bio bio_copy: if (WC_MODE_PMEM(wc)) { bio_copy_block(wc, bio, memory_data(wc, e)); + wc->stats.writes++; } else { writecache_bio_copy_ssd(wc, bio, e, search_used); return WC_MAP_REMAP; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF874C00140 for ; Mon, 15 Aug 2022 18:45:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243375AbiHOSpa (ORCPT ); Mon, 15 Aug 2022 14:45:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242904AbiHOSkp (ORCPT ); Mon, 15 Aug 2022 14:40:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 491DB2A95B; Mon, 15 Aug 2022 11:24: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 AD52CB8107D; Mon, 15 Aug 2022 18:24:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07AE0C433C1; Mon, 15 Aug 2022 18:24:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587862; bh=JDDcoCnPxmg7DVjWNm1DOZfDcTV9TzDW0XJCx77XjG8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ehlw5uGwbk2OSlgsYO/otzFCrJY2Orf6p5s7Sbe8/w6julEKP2Gr1Vxq0ufgUV9tc s5gV+ntPPsKLl00ulvJ8KLjLNdnJyW2zW2H86j0UwYVQxOgQCZU+G75aDaWJHpj0rF Sskil0C5tXtl9e1LwQs+Y31cTEjDZIhYl66Wtpss= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , Mike Snitzer , Sasha Levin Subject: [PATCH 5.15 217/779] dm writecache: count number of blocks discarded, not number of discard bios Date: Mon, 15 Aug 2022 19:57:41 +0200 Message-Id: <20220815180346.549831036@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 2ee73ef60db4d79b9f9b8cd501e8188b5179449f ] Change dm-writecache, so that it counts the number of blocks discarded instead of the number of discard bios. Make it consistent with the read and write statistics counters that were changed to count the number of blocks instead of bios. Fixes: e3a35d03407c ("dm writecache: add event counters") Signed-off-by: Mikulas Patocka Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- Documentation/admin-guide/device-mapper/writecache.rst | 2 +- drivers/md/dm-writecache.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Documentation/admin-guide/device-mapper/writecache.rst b/Docum= entation/admin-guide/device-mapper/writecache.rst index 6c9a2c74df8a..724e028d1858 100644 --- a/Documentation/admin-guide/device-mapper/writecache.rst +++ b/Documentation/admin-guide/device-mapper/writecache.rst @@ -87,7 +87,7 @@ Status: 11. the number of write blocks that are allocated in the cache 12. the number of write requests that are blocked on the freelist 13. the number of flush requests -14. the number of discard requests +14. the number of discarded blocks =20 Messages: flush diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c index c90408eb9c3a..c3e59d8af76f 100644 --- a/drivers/md/dm-writecache.c +++ b/drivers/md/dm-writecache.c @@ -1513,7 +1513,7 @@ static enum wc_map_op writecache_map_flush(struct dm_= writecache *wc, struct bio =20 static enum wc_map_op writecache_map_discard(struct dm_writecache *wc, str= uct bio *bio) { - wc->stats.discards++; + wc->stats.discards +=3D bio->bi_iter.bi_size >> wc->block_size_bits; =20 if (writecache_has_error(wc)) return WC_MAP_ERROR; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B393C00140 for ; Mon, 15 Aug 2022 18:43:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233128AbiHOSnN (ORCPT ); Mon, 15 Aug 2022 14:43:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243161AbiHOSks (ORCPT ); Mon, 15 Aug 2022 14:40:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 072493E744; Mon, 15 Aug 2022 11:24: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 EF82060FB9; Mon, 15 Aug 2022 18:24:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05C16C433C1; Mon, 15 Aug 2022 18:24:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587865; bh=rO6j8LMjktGpC8KRSmNNYA45x/kxmmEIE5Y/UjH+cug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oX8Pr4p/R1yipBvu2Nx/SB60huTemDmwoFr3FYw/hAMc8chTGG/UqymWvnnH3Z2Cu 4i7SlUw0i78B3MB5QtxlwHy0ZOXLU4eDotuquBEaf0P6J7OvUoB6SV2/sntobP/nbc fdjGd/Ol+xFjSLY/a0cOxw0WahA3BQ5hnrzIkcw0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Mark Brown , Sasha Levin Subject: [PATCH 5.15 218/779] regulator: of: Fix refcount leak bug in of_get_regulation_constraints() Date: Mon, 15 Aug 2022 19:57:42 +0200 Message-Id: <20220815180346.599459531@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 66efb665cd5ad69b27dca8571bf89fc6b9c628a4 ] We should call the of_node_put() for the reference returned by of_get_child_by_name() which has increased the refcount. Fixes: 40e20d68bb3f ("regulator: of: Add support for parsing regulator_stat= e for suspend state") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220715111027.391032-1-windhl@126.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/regulator/of_regulator.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regula= tor.c index f54d4f176882..e12b681c72e5 100644 --- a/drivers/regulator/of_regulator.c +++ b/drivers/regulator/of_regulator.c @@ -264,8 +264,12 @@ static int of_get_regulation_constraints(struct device= *dev, } =20 suspend_np =3D of_get_child_by_name(np, regulator_states[i]); - if (!suspend_np || !suspend_state) + if (!suspend_np) continue; + if (!suspend_state) { + of_node_put(suspend_np); + continue; + } =20 if (!of_property_read_u32(suspend_np, "regulator-mode", &pval)) { --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00F1EC00140 for ; Mon, 15 Aug 2022 18:43:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243092AbiHOSnW (ORCPT ); Mon, 15 Aug 2022 14:43:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243325AbiHOSkx (ORCPT ); Mon, 15 Aug 2022 14:40:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 581EA3E75F; Mon, 15 Aug 2022 11:24:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2DC2060FA3; Mon, 15 Aug 2022 18:24:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2066BC433D6; Mon, 15 Aug 2022 18:24:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587868; bh=Mei2d44J0/RO22DhR7EknmdjG/9sEnl/BDe4HjxvePE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A8umyuLD1cZtkcxURXrm8NRaOebggSz0nSqb5yGhlzkrcTLiaaklnifr/xJthpRGK A3g4WLsc/lmiinlyZ7pthxDRHeTEfLxJzkgDLy0D6Fvwzyphf504ggajv7E0wCMFud z34ET9uy3NYE4m9Rj85Ia/VA/zif+co72LUCbNMA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Konrad Dybcio , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 219/779] soc: qcom: Make QCOM_RPMPD depend on PM Date: Mon, 15 Aug 2022 19:57:43 +0200 Message-Id: <20220815180346.638498019@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 a6232f2aa99ce470799992e99e0012945bb5308f ] QCOM_RPMPD requires PM_GENERIC_DOMAINS/_OF, which in turns requires CONFIG_PM. I forgot about the latter in my earlier patch (it's still in -next as of the time of committing, hence no Fixes: tag). Fix it. Reported-by: kernel test robot Signed-off-by: Konrad Dybcio Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220707212158.32684-1-konrad.dybcio@somain= line.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/soc/qcom/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig index 79b568f82a1c..499718e131d7 100644 --- a/drivers/soc/qcom/Kconfig +++ b/drivers/soc/qcom/Kconfig @@ -129,6 +129,7 @@ config QCOM_RPMHPD =20 config QCOM_RPMPD tristate "Qualcomm RPM Power domain driver" + depends on PM depends on QCOM_SMD_RPM help QCOM RPM Power domain driver to support power-domains with --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1A8EAC00140 for ; Mon, 15 Aug 2022 18:43:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243132AbiHOSn0 (ORCPT ); Mon, 15 Aug 2022 14:43:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243358AbiHOSk5 (ORCPT ); Mon, 15 Aug 2022 14:40:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9C2B3E77A; Mon, 15 Aug 2022 11:24:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1DA0CB81071; Mon, 15 Aug 2022 18:24:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BE0AC433D6; Mon, 15 Aug 2022 18:24:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587871; bh=yGN0rlFHZPBbz93yRF9VvwXubDhIbKp6WMlgSzU41AA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h8EXbuIaFDwu6DyCvdW2umMkPNDyVWVIsoG7Dd5jxz6roGcKTyXcngfsH8pDYX/sR u6wtDPOa117Sl/mHWzf0wG1HRclKpLwnUCxHGhklzdCzWn9BUU8NNV9XuKOiO8mr6Z YQPqeWozoAgCJj5nfBr6dl4sHteO9sAi2aLEPJiQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sumit Garg , Daniel Thompson , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 220/779] arm64: dts: qcom: qcs404: Fix incorrect USB2 PHYs assignment Date: Mon, 15 Aug 2022 19:57:44 +0200 Message-Id: <20220815180346.681624078@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sumit Garg [ Upstream commit 58577966a42fc0b660b5e2c7c9e5a2241363ea83 ] Currently the DT for QCS404 SoC has setup for 2 USB2 PHYs with one each assigned to USB3 controller and USB2 controller. This assignment is incorrect which only works by luck: as when each USB HCI comes up it configures the *other* controllers PHY which is enough to make them happy. If, for any reason, we were to disable one of the controllers then both would stop working. This was a difficult inconsistency to be caught which was found while trying to enable USB support in u-boot. So with all the required drivers ported to u-boot, I couldn't get the same USB storage device enumerated in u-boot which was being enumerated fine by the kernel. The root cause of the problem came out to be that I wasn't enabling USB2 PHY: "usb2_phy_prim" in u-boot. Then I realised that via simply disabling the same USB2 PHY currently assigned to USB2 host controller in the kernel disabled enumeration for USB3 host controller as well. So fix this inconsistency by correctly assigning USB2 PHYs. Fixes: 9375e7d719b3 ("arm64: dts: qcom: qcs404: Add USB devices and PHYs") Signed-off-by: Sumit Garg Reviewed-by: Daniel Thompson Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220711083038.1518529-1-sumit.garg@linaro.= org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm64/boot/dts/qcom/qcs404.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/qcom/qcs404.dtsi b/arch/arm64/boot/dts/qco= m/qcs404.dtsi index ca5be1647980..18cc8e3bc93a 100644 --- a/arch/arm64/boot/dts/qcom/qcs404.dtsi +++ b/arch/arm64/boot/dts/qcom/qcs404.dtsi @@ -548,7 +548,7 @@ dwc3@7580000 { compatible =3D "snps,dwc3"; reg =3D <0x07580000 0xcd00>; interrupts =3D ; - phys =3D <&usb2_phy_sec>, <&usb3_phy>; + phys =3D <&usb2_phy_prim>, <&usb3_phy>; phy-names =3D "usb2-phy", "usb3-phy"; snps,has-lpm-erratum; snps,hird-threshold =3D /bits/ 8 <0x10>; @@ -577,7 +577,7 @@ dwc3@78c0000 { compatible =3D "snps,dwc3"; reg =3D <0x078c0000 0xcc00>; interrupts =3D ; - phys =3D <&usb2_phy_prim>; + phys =3D <&usb2_phy_sec>; phy-names =3D "usb2-phy"; snps,has-lpm-erratum; snps,hird-threshold =3D /bits/ 8 <0x10>; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B6A8C25B08 for ; Mon, 15 Aug 2022 18:48:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239939AbiHOSsM (ORCPT ); Mon, 15 Aug 2022 14:48:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242868AbiHOSnF (ORCPT ); Mon, 15 Aug 2022 14:43: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 4A21C2A7; Mon, 15 Aug 2022 11:26: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 DC47760FC4; Mon, 15 Aug 2022 18:26:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D41C1C433C1; Mon, 15 Aug 2022 18:26:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587996; bh=2U69VoSm4UpXK3h1vY5AEo5exNg8mkLjEbQ48eUiu1I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pa53CDpHF4y0KZvcvBKS+S8q1HS4WJwn2MQkXTqhImIiNsP8q4L2Y2IGgzUJbI7/T d8snWy6KL2TV6WamgXq100KhCw4aAU6pVxwu/UN41h6LaBCwoE/zrVkBYroaHpHvuy sBhjgbepsB66PcuqEcU7XEBvvCICcpgtfX9OGS24= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xu Qiang , Marc Zyngier , Sasha Levin Subject: [PATCH 5.15 221/779] irqdomain: Report irq number for NOMAP domains Date: Mon, 15 Aug 2022 19:57:45 +0200 Message-Id: <20220815180346.730050414@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xu Qiang [ Upstream commit 6f194c99f466147148cc08452718b46664112548 ] When using a NOMAP domain, __irq_resolve_mapping() doesn't store the Linux IRQ number at the address optionally provided by the caller. While this isn't a huge deal (the returned value is guaranteed to the hwirq that was passed as a parameter), let's honour the letter of the API by writing the expected value. Fixes: d22558dd0a6c (=E2=80=9Cirqdomain: Introduce irq_resolve_mapping()=E2= =80=9D) Signed-off-by: Xu Qiang [maz: commit message] Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20220719063641.56541-2-xuqiang36@huawei.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- kernel/irq/irqdomain.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index 4d8fc65cf38f..035e3038c4de 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -910,6 +910,8 @@ struct irq_desc *__irq_resolve_mapping(struct irq_domai= n *domain, data =3D irq_domain_get_irq_data(domain, hwirq); if (data && data->hwirq =3D=3D hwirq) desc =3D irq_data_to_desc(data); + if (irq && desc) + *irq =3D hwirq; } =20 return desc; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD8FBC25B0E for ; Mon, 15 Aug 2022 18:44:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243393AbiHOSoB (ORCPT ); Mon, 15 Aug 2022 14:44:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243768AbiHOSlW (ORCPT ); Mon, 15 Aug 2022 14:41: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 747A73F32C; Mon, 15 Aug 2022 11:24: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 D416F60693; Mon, 15 Aug 2022 18:24:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90F9BC43148; Mon, 15 Aug 2022 18:24:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587896; bh=++qsWt1DL6oWKd3JaboveuwvHLNQYA78aUrwPZqxMDE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YLgQLB3Bbor2v/DS4MBcANxKVK9SE+0mo/ZvmY3Z3nhYpTTxIE4Nij/ohxbmH/QEZ KU8K0EVk6X6kqq5V9h+kQLG5rJs3WAVyxFG9VPAdclwaPoruWGsFTGbJBRDtoGudA4 EiZaDghlegUOyva9M/fUrdEgovHoXTzap5NoXhYg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Will Deacon , Mark Rutland , Alexey Budankov , linux-arm-kernel@lists.infradead.org, German Gomez , Anshuman Khandual , Suzuki K Poulose , Sasha Levin Subject: [PATCH 5.15 222/779] drivers/perf: arm_spe: Fix consistency of SYS_PMSCR_EL1.CX Date: Mon, 15 Aug 2022 19:57:46 +0200 Message-Id: <20220815180346.770386700@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Anshuman Khandual [ Upstream commit 92f2b8bafa3d6e89c750e9d301a8b7ab76aaa8b6 ] The arm_spe_pmu driver will enable SYS_PMSCR_EL1.CX in order to add CONTEXT packets into the traces, if the owner of the perf event runs with required capabilities i.e CAP_PERFMON or CAP_SYS_ADMIN via perfmon_capable() helper. The value of this bit is computed in the arm_spe_event_to_pmscr() function but the check for capabilities happens in the pmu event init callback i.e arm_spe_pmu_event_init(). This suggests that the value of the CX bit should remain consistent for the duration of the perf session. However, the function arm_spe_event_to_pmscr() may be called later during the event start callback i.e arm_spe_pmu_start() when the "current" process is not the owner of the perf session, hence the CX bit setting is currently not consistent. One way to fix this, is by caching the required value of the CX bit during the initialization of the PMU event, so that it remains consistent for the duration of the session. It uses currently unused 'event->hw.flags' element to cache perfmon_capable() value, which can be referred during event start callback to compute SYS_PMSCR_EL1.CX. This ensures consistent availability of context packets in the trace as per event owner capabilities. Drop BIT(SYS_PMSCR_EL1_CX_SHIFT) check in arm_spe_pmu_event_init(), because now CX bit cannot be set in arm_spe_event_to_pmscr() with perfmon_capable() disabled. Cc: Will Deacon Cc: Mark Rutland Cc: Alexey Budankov Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Fixes: d5d9696b0380 ("drivers/perf: Add support for ARMv8.2 Statistical Pro= filing Extension") Reported-by: German Gomez Signed-off-by: Anshuman Khandual Reviewed-by: Suzuki K Poulose Link: https://lore.kernel.org/r/20220714061302.2715102-1-anshuman.khandual@= arm.com Signed-off-by: Will Deacon Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/perf/arm_spe_pmu.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/perf/arm_spe_pmu.c b/drivers/perf/arm_spe_pmu.c index d44bcc29d99c..cd5945e17fdf 100644 --- a/drivers/perf/arm_spe_pmu.c +++ b/drivers/perf/arm_spe_pmu.c @@ -39,6 +39,24 @@ #include #include =20 +/* + * Cache if the event is allowed to trace Context information. + * This allows us to perform the check, i.e, perfmon_capable(), + * in the context of the event owner, once, during the event_init(). + */ +#define SPE_PMU_HW_FLAGS_CX BIT(0) + +static void set_spe_event_has_cx(struct perf_event *event) +{ + if (IS_ENABLED(CONFIG_PID_IN_CONTEXTIDR) && perfmon_capable()) + event->hw.flags |=3D SPE_PMU_HW_FLAGS_CX; +} + +static bool get_spe_event_has_cx(struct perf_event *event) +{ + return !!(event->hw.flags & SPE_PMU_HW_FLAGS_CX); +} + #define ARM_SPE_BUF_PAD_BYTE 0 =20 struct arm_spe_pmu_buf { @@ -272,7 +290,7 @@ static u64 arm_spe_event_to_pmscr(struct perf_event *ev= ent) if (!attr->exclude_kernel) reg |=3D BIT(SYS_PMSCR_EL1_E1SPE_SHIFT); =20 - if (IS_ENABLED(CONFIG_PID_IN_CONTEXTIDR) && perfmon_capable()) + if (get_spe_event_has_cx(event)) reg |=3D BIT(SYS_PMSCR_EL1_CX_SHIFT); =20 return reg; @@ -709,10 +727,10 @@ static int arm_spe_pmu_event_init(struct perf_event *= event) !(spe_pmu->features & SPE_PMU_FEAT_FILT_LAT)) return -EOPNOTSUPP; =20 + set_spe_event_has_cx(event); reg =3D arm_spe_event_to_pmscr(event); if (!perfmon_capable() && (reg & (BIT(SYS_PMSCR_EL1_PA_SHIFT) | - BIT(SYS_PMSCR_EL1_CX_SHIFT) | BIT(SYS_PMSCR_EL1_PCT_SHIFT)))) return -EACCES; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F355BC00140 for ; Mon, 15 Aug 2022 18:45:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243712AbiHOSpF (ORCPT ); Mon, 15 Aug 2022 14:45:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243984AbiHOSly (ORCPT ); Mon, 15 Aug 2022 14:41: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 A0F0214034; Mon, 15 Aug 2022 11:25: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 38516B80F99; Mon, 15 Aug 2022 18:25:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DCCFC433D6; Mon, 15 Aug 2022 18:25:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587930; bh=s6CJ4TFZhq4FG5YuAUbFukvtI+B1pVtjjTT/cJDupI0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=imnqTEgseG+oyWmBc6RjpH//e/MBWimR/xAIUVRo6O+GgOpYwd+5YEu0fcI7WcX3c zGwYHaYvhujfIFoLW2VxByyP+U8bWtr6nO1JXb5rvLrFOWA5XTokvu6paBMShBwc0o ybxg4A9hltY4U5zX219RsGFhZsbw5ikGLz/IjFOk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicolas Saenz Julienne , "Peter Zijlstra (Intel)" , Valentin Schneider , Phil Auld , Sasha Levin Subject: [PATCH 5.15 223/779] nohz/full, sched/rt: Fix missed tick-reenabling bug in dequeue_task_rt() Date: Mon, 15 Aug 2022 19:57:47 +0200 Message-Id: <20220815180346.813633877@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Saenz Julienne [ Upstream commit 5c66d1b9b30f737fcef85a0b75bfe0590e16b62a ] dequeue_task_rt() only decrements 'rt_rq->rt_nr_running' after having called sched_update_tick_dependency() preventing it from re-enabling the tick on systems that no longer have pending SCHED_RT tasks but have multiple runnable SCHED_OTHER tasks: dequeue_task_rt() dequeue_rt_entity() dequeue_rt_stack() dequeue_top_rt_rq() sub_nr_running() // decrements rq->nr_running sched_update_tick_dependency() sched_can_stop_tick() // checks rq->rt.rt_nr_running, ... __dequeue_rt_entity() dec_rt_tasks() // decrements rq->rt.rt_nr_running ... Every other scheduler class performs the operation in the opposite order, and sched_update_tick_dependency() expects the values to be updated as such. So avoid the misbehaviour by inverting the order in which the above operations are performed in the RT scheduler. Fixes: 76d92ac305f2 ("sched: Migrate sched to use new tick dependency mask = model") Signed-off-by: Nicolas Saenz Julienne Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Valentin Schneider Reviewed-by: Phil Auld Link: https://lore.kernel.org/r/20220628092259.330171-1-nsaenzju@redhat.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- kernel/sched/rt.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 8007d087a57f..f75dcd3537b8 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -444,7 +444,7 @@ static inline void rt_queue_push_tasks(struct rq *rq) #endif /* CONFIG_SMP */ =20 static void enqueue_top_rt_rq(struct rt_rq *rt_rq); -static void dequeue_top_rt_rq(struct rt_rq *rt_rq); +static void dequeue_top_rt_rq(struct rt_rq *rt_rq, unsigned int count); =20 static inline int on_rt_rq(struct sched_rt_entity *rt_se) { @@ -565,7 +565,7 @@ static void sched_rt_rq_dequeue(struct rt_rq *rt_rq) rt_se =3D rt_rq->tg->rt_se[cpu]; =20 if (!rt_se) { - dequeue_top_rt_rq(rt_rq); + dequeue_top_rt_rq(rt_rq, rt_rq->rt_nr_running); /* Kick cpufreq (see the comment in kernel/sched/sched.h). */ cpufreq_update_util(rq_of_rt_rq(rt_rq), 0); } @@ -651,7 +651,7 @@ static inline void sched_rt_rq_enqueue(struct rt_rq *rt= _rq) =20 static inline void sched_rt_rq_dequeue(struct rt_rq *rt_rq) { - dequeue_top_rt_rq(rt_rq); + dequeue_top_rt_rq(rt_rq, rt_rq->rt_nr_running); } =20 static inline int rt_rq_throttled(struct rt_rq *rt_rq) @@ -1051,7 +1051,7 @@ static void update_curr_rt(struct rq *rq) } =20 static void -dequeue_top_rt_rq(struct rt_rq *rt_rq) +dequeue_top_rt_rq(struct rt_rq *rt_rq, unsigned int count) { struct rq *rq =3D rq_of_rt_rq(rt_rq); =20 @@ -1062,7 +1062,7 @@ dequeue_top_rt_rq(struct rt_rq *rt_rq) =20 BUG_ON(!rq->nr_running); =20 - sub_nr_running(rq, rt_rq->rt_nr_running); + sub_nr_running(rq, count); rt_rq->rt_queued =3D 0; =20 } @@ -1342,18 +1342,21 @@ static void __dequeue_rt_entity(struct sched_rt_ent= ity *rt_se, unsigned int flag static void dequeue_rt_stack(struct sched_rt_entity *rt_se, unsigned int f= lags) { struct sched_rt_entity *back =3D NULL; + unsigned int rt_nr_running; =20 for_each_sched_rt_entity(rt_se) { rt_se->back =3D back; back =3D rt_se; } =20 - dequeue_top_rt_rq(rt_rq_of_se(back)); + rt_nr_running =3D rt_rq_of_se(back)->rt_nr_running; =20 for (rt_se =3D back; rt_se; rt_se =3D rt_se->back) { if (on_rt_rq(rt_se)) __dequeue_rt_entity(rt_se, flags); } + + dequeue_top_rt_rq(rt_rq_of_se(back), rt_nr_running); } =20 static void enqueue_rt_entity(struct sched_rt_entity *rt_se, unsigned int = flags) --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ACFAFC25B0E for ; Mon, 15 Aug 2022 18:47:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243801AbiHOSrR (ORCPT ); Mon, 15 Aug 2022 14:47:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244139AbiHOSmP (ORCPT ); Mon, 15 Aug 2022 14:42:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 333722B266; Mon, 15 Aug 2022 11:26: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 C8DFCB81071; Mon, 15 Aug 2022 18:26:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C6D2C433D6; Mon, 15 Aug 2022 18:26:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587962; bh=LGF9dF+fKB1PZkg6wP0g76Gr6e1+9+y03v69kg/R34Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZzT+CStbnhzlDib3mDZ+dP2TSVFqE2nBo6KI/8wBN4QzsA6oliE021LbsBnuAhirJ NznBHHX9jD3eRen/jU6Fn7nUxy8/xuiDk9muU40nrpWfHHDvUuOpp/JLEwPT4IRcw4 TI/nE/4fbs0KqLS3vcX+5Rzdu+m2uS7V9K7l02Qk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephane Eranian , "Peter Zijlstra (Intel)" , Sasha Levin Subject: [PATCH 5.15 224/779] x86/extable: Fix ex_handler_msr() print condition Date: Mon, 15 Aug 2022 19:57:48 +0200 Message-Id: <20220815180346.862423820@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peter Zijlstra [ Upstream commit a1a5482a2c6e38a3ebed32e571625c56a8cc41a6 ] On Fri, Jun 17, 2022 at 02:08:52PM +0300, Stephane Eranian wrote: > Some changes to the way invalid MSR accesses are reported by the > kernel is causing some problems with messages printed on the > console. > > We have seen several cases of ex_handler_msr() printing invalid MSR > accesses once but the callstack multiple times causing confusion on > the console. > The problem here is that another earlier commit (5.13): > > a358f40600b3 ("once: implement DO_ONCE_LITE for non-fast-path "do once" f= unctionality") > > Modifies all the pr_*_once() calls to always return true claiming > that no caller is ever checking the return value of the functions. > > This is why we are seeing the callstack printed without the > associated printk() msg. Extract the ONCE_IF(cond) part into __ONCE_LTE_IF() and use that to implement DO_ONCE_LITE_IF() and fix the extable code. Fixes: a358f40600b3 ("once: implement DO_ONCE_LITE for non-fast-path "do on= ce" functionality") Reported-by: Stephane Eranian Signed-off-by: Peter Zijlstra (Intel) Tested-by: Stephane Eranian Link: https://lkml.kernel.org/r/YqyVFsbviKjVGGZ9@worktop.programming.kicks-= ass.net Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/x86/mm/extable.c | 16 +++++++++------- include/linux/once_lite.h | 20 ++++++++++++++++---- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/arch/x86/mm/extable.c b/arch/x86/mm/extable.c index 13d838e6030b..a9c7efd4b794 100644 --- a/arch/x86/mm/extable.c +++ b/arch/x86/mm/extable.c @@ -86,16 +86,18 @@ static bool ex_handler_copy(const struct exception_tabl= e_entry *fixup, static bool ex_handler_msr(const struct exception_table_entry *fixup, struct pt_regs *regs, bool wrmsr, bool safe, int reg) { - if (!safe && wrmsr && - pr_warn_once("unchecked MSR access error: WRMSR to 0x%x (tried to wri= te 0x%08x%08x) at rIP: 0x%lx (%pS)\n", - (unsigned int)regs->cx, (unsigned int)regs->dx, - (unsigned int)regs->ax, regs->ip, (void *)regs->ip)) + if (__ONCE_LITE_IF(!safe && wrmsr)) { + pr_warn("unchecked MSR access error: WRMSR to 0x%x (tried to write 0x%08= x%08x) at rIP: 0x%lx (%pS)\n", + (unsigned int)regs->cx, (unsigned int)regs->dx, + (unsigned int)regs->ax, regs->ip, (void *)regs->ip); show_stack_regs(regs); + } =20 - if (!safe && !wrmsr && - pr_warn_once("unchecked MSR access error: RDMSR from 0x%x at rIP: 0x%= lx (%pS)\n", - (unsigned int)regs->cx, regs->ip, (void *)regs->ip)) + if (__ONCE_LITE_IF(!safe && !wrmsr)) { + pr_warn("unchecked MSR access error: RDMSR from 0x%x at rIP: 0x%lx (%pS)= \n", + (unsigned int)regs->cx, regs->ip, (void *)regs->ip); show_stack_regs(regs); + } =20 if (!wrmsr) { /* Pretend that the read succeeded and returned 0. */ diff --git a/include/linux/once_lite.h b/include/linux/once_lite.h index 861e606b820f..b7bce4983638 100644 --- a/include/linux/once_lite.h +++ b/include/linux/once_lite.h @@ -9,15 +9,27 @@ */ #define DO_ONCE_LITE(func, ...) \ DO_ONCE_LITE_IF(true, func, ##__VA_ARGS__) -#define DO_ONCE_LITE_IF(condition, func, ...) \ + +#define __ONCE_LITE_IF(condition) \ ({ \ static bool __section(".data.once") __already_done; \ - bool __ret_do_once =3D !!(condition); \ + bool __ret_cond =3D !!(condition); \ + bool __ret_once =3D false; \ \ - if (unlikely(__ret_do_once && !__already_done)) { \ + if (unlikely(__ret_cond && !__already_done)) { \ __already_done =3D true; \ - func(__VA_ARGS__); \ + __ret_once =3D true; \ } \ + unlikely(__ret_once); \ + }) + +#define DO_ONCE_LITE_IF(condition, func, ...) \ + ({ \ + bool __ret_do_once =3D !!(condition); \ + \ + if (__ONCE_LITE_IF(__ret_do_once)) \ + func(__VA_ARGS__); \ + \ unlikely(__ret_do_once); \ }) =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33D3AC00140 for ; Mon, 15 Aug 2022 18:47:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243882AbiHOSrn (ORCPT ); Mon, 15 Aug 2022 14:47:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240850AbiHOSmW (ORCPT ); Mon, 15 Aug 2022 14:42:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAFF02B279; Mon, 15 Aug 2022 11:26:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5829B60FA2; Mon, 15 Aug 2022 18:26:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 551FCC433D6; Mon, 15 Aug 2022 18:26:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587977; bh=mIIcZD7vR4zKBVHFqkA/lsn+TUQR5ZqSZ69Po6wYodE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i10N7R3TIcOlBAT2P/ipgZmLMKxQ5mDp2O3tFfR4AKGIEDrL8dYKV1FdbRAXR7IG0 IINmeHVvay35c5uOWcMl5CcUdLCF+nyuCF2yuVfMiFbHpkzSJHbCSqIhtKwFqZ8wc1 KX8R3JWsLqoMIBdaYwB4M09kaWhd8UL/SqAd5prE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, YiFei Zhu , Kees Cook , Sasha Levin Subject: [PATCH 5.15 225/779] selftests/seccomp: Fix compile warning when CC=clang Date: Mon, 15 Aug 2022 19:57:49 +0200 Message-Id: <20220815180346.911867097@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: YiFei Zhu [ Upstream commit 3ce4b78f73e8e00fb86bad67ee7f6fe12019707e ] clang has -Wconstant-conversion by default, and the constant 0xAAAAAAAAA (9 As) being converted to an int, which is generally 32 bits, results in the compile warning: clang -Wl,-no-as-needed -Wall -isystem ../../../../usr/include/ -lpthrea= d seccomp_bpf.c -lcap -o seccomp_bpf seccomp_bpf.c:812:67: warning: implicit conversion from 'long' to 'int' c= hanges value from 45812984490 to -1431655766 [-Wconstant-conversion] int kill =3D kill_how =3D=3D KILL_PROCESS ? SECCOMP_RET_KILL_PROC= ESS : 0xAAAAAAAAA; ~~~~ = ^~~~~~~~~~~ 1 warning generated. -1431655766 is the expected truncation, 0xAAAAAAAA (8 As), so use this directly in the code to avoid the warning. Fixes: 3932fcecd962 ("selftests/seccomp: Add test for unknown SECCOMP_RET k= ill behavior") Signed-off-by: YiFei Zhu Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20220526223407.1686936-1-zhuyifei@google.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- tools/testing/selftests/seccomp/seccomp_bpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/seccomp/seccomp_bpf.c b/tools/testing/= selftests/seccomp/seccomp_bpf.c index 34ebd1fe5eed..ac340a9c0918 100644 --- a/tools/testing/selftests/seccomp/seccomp_bpf.c +++ b/tools/testing/selftests/seccomp/seccomp_bpf.c @@ -802,7 +802,7 @@ void kill_thread_or_group(struct __test_metadata *_meta= data, .len =3D (unsigned short)ARRAY_SIZE(filter_thread), .filter =3D filter_thread, }; - int kill =3D kill_how =3D=3D KILL_PROCESS ? SECCOMP_RET_KILL_PROCESS : 0x= AAAAAAAAA; + int kill =3D kill_how =3D=3D KILL_PROCESS ? SECCOMP_RET_KILL_PROCESS : 0x= AAAAAAAA; struct sock_filter filter_process[] =3D { BPF_STMT(BPF_LD|BPF_W|BPF_ABS, offsetof(struct seccomp_data, nr)), --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6109DC00140 for ; Mon, 15 Aug 2022 18:47:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229587AbiHOSrr (ORCPT ); Mon, 15 Aug 2022 14:47:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242007AbiHOSmg (ORCPT ); Mon, 15 Aug 2022 14:42:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B30E42B617; Mon, 15 Aug 2022 11:26: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 71987B8107B; Mon, 15 Aug 2022 18:26:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71D4AC433D6; Mon, 15 Aug 2022 18:26:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587981; bh=2KW1HM963k7v+bwEDDz4Yh4oQrYctMijf1hKLtDHh9Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zkk2c62TsBuX0e7aNqkr/lBWgKvRXc61NpsG0zABn98R+w8iG4WHVB3Kbc4CAu7be aGeuJmOlRq++jvhNf/KWVUS7UvRVe0Te0uOnnB0uqSQ8pOZqafdOXjU5hDR/PxTeYl y7JUtkw9rwlinjnE3khkmdwFbz5uqxPvoE5YwhCc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Markus Mayer , Florian Fainelli , Sumeet Pawnikar , =?UTF-8?q?Alejandro=20Gonz=C3=A1lez?= , Daniel Lezcano , Sasha Levin Subject: [PATCH 5.15 226/779] thermal/tools/tmon: Include pthread and time headers in tmon.h Date: Mon, 15 Aug 2022 19:57:50 +0200 Message-Id: <20220815180346.956872187@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Markus Mayer [ Upstream commit 0cf51bfe999524377fbb71becb583b4ca6d07cfc ] Include sys/time.h and pthread.h in tmon.h, so that types "pthread_mutex_t" and "struct timeval tv" are known when tmon.h references them. Without these headers, compiling tmon against musl-libc will fail with these errors: In file included from sysfs.c:31:0: tmon.h:47:8: error: unknown type name 'pthread_mutex_t' extern pthread_mutex_t input_lock; ^~~~~~~~~~~~~~~ make[3]: *** [: sysfs.o] Error 1 make[3]: *** Waiting for unfinished jobs.... In file included from tui.c:31:0: tmon.h:54:17: error: field 'tv' has incomplete type struct timeval tv; ^~ make[3]: *** [: tui.o] Error 1 make[2]: *** [Makefile:83: tmon] Error 2 Signed-off-by: Markus Mayer Acked-by: Florian Fainelli Reviewed-by: Sumeet Pawnikar Acked-by: Alejandro Gonz=C3=A1lez Tested-by: Alejandro Gonz=C3=A1lez Fixes: 94f69966faf8 ("tools/thermal: Introduce tmon, a tool for thermal su= bsystem") Link: https://lore.kernel.org/r/20220718031040.44714-1-f.fainelli@gmail.com Signed-off-by: Daniel Lezcano Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- tools/thermal/tmon/tmon.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/thermal/tmon/tmon.h b/tools/thermal/tmon/tmon.h index c9066ec104dd..44d16d778f04 100644 --- a/tools/thermal/tmon/tmon.h +++ b/tools/thermal/tmon/tmon.h @@ -27,6 +27,9 @@ #define NR_LINES_TZDATA 1 #define TMON_LOG_FILE "/var/tmp/tmon.log" =20 +#include +#include + extern unsigned long ticktime; extern double time_elapsed; extern unsigned long target_temp_user; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 923D8C00140 for ; Mon, 15 Aug 2022 18:47:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243905AbiHOSrt (ORCPT ); Mon, 15 Aug 2022 14:47:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242039AbiHOSmg (ORCPT ); Mon, 15 Aug 2022 14:42:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEF4F2B62E; Mon, 15 Aug 2022 11:26:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 63AAEB8107B; Mon, 15 Aug 2022 18:26:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4425C433D6; Mon, 15 Aug 2022 18:26:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587984; bh=QHdUGgQf2J57RM/QS1DJ+baT8eAIsJdSK29InXdY5X0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uv7jK/glguqTyJJR3pTqlDm8iFLBOSj1Z7lp/XCFX1vE1pFchMHGHmau3WrLGHD3H r/FMry3AmwrNMQ8B6tqI20+Tp497Sikk44xWzOKSkP0vJFKS6OUqkNI/er7dK1xyfW KcNhhE//LaXOI635UYhqeW2izaH+wH1TZvz9QbtY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mike Snitzer , Sasha Levin Subject: [PATCH 5.15 227/779] dm: return early from dm_pr_call() if DM device is suspended Date: Mon, 15 Aug 2022 19:57:51 +0200 Message-Id: <20220815180346.997801237@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Snitzer [ Upstream commit e120a5f1e78fab6223544e425015f393d90d6f0d ] Otherwise PR ops may be issued while the broader DM device is being reconfigured, etc. Fixes: 9c72bad1f31a ("dm: call PR reserve/unreserve on each underlying devi= ce") Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/md/dm.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 36449422e7e0..41d2e1285c07 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -2911,6 +2911,11 @@ static int dm_call_pr(struct block_device *bdev, ite= rate_devices_callout_fn fn, goto out; ti =3D dm_table_get_target(table, 0); =20 + if (dm_suspended_md(md)) { + ret =3D -EAGAIN; + goto out; + } + ret =3D -EINVAL; if (!ti->type->iterate_devices) goto out; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A910EC00140 for ; Mon, 15 Aug 2022 18:47:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233702AbiHOSr6 (ORCPT ); Mon, 15 Aug 2022 14:47:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242444AbiHOSmq (ORCPT ); Mon, 15 Aug 2022 14:42:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F287B2B634; Mon, 15 Aug 2022 11:26: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 8F21460FA2; Mon, 15 Aug 2022 18:26:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8DA21C433C1; Mon, 15 Aug 2022 18:26:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587987; bh=vrIzN52GEEHh/T0R5cqvOZOYcnv5hQLjIKksDxnlmEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uFT4n5HIyD1iEfXfdW7qihANasROOk9E2lZIaV0fxDawrn5DH2XLHQ3RF61050N0X AMrKqUoBRRl4ZpriIJSlaXdhvD9dC3iKTRjJOivUjjqbyfTN4q+gkmm+V/nw+XJqrS YfsL4qiIrTMpnz+XE3XWuI2T9vHV0v5AOtFbzOlI= 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?= , Emil Renner Berthing , Thierry Reding , Sasha Levin Subject: [PATCH 5.15 228/779] pwm: sifive: Simplify offset calculation for PWMCMP registers Date: Mon, 15 Aug 2022 19:57:52 +0200 Message-Id: <20220815180347.042370561@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Uwe Kleine-K=C3=B6nig [ Upstream commit 20550a61880fc55e68a0d290ad195b74729c0e7b ] Instead of explicitly using PWM_SIFIVE_PWMCMP0 + pwm->hwpwm * PWM_SIFIVE_SIZE_PWMCMP for each access to one of the PWMCMP registers, introduce a macro that takes the hwpwm id as parameter. For the register definition using a plain 4 instead of the cpp constant PWM_SIFIVE_SIZE_PWMCMP is easier to read, so define the offset macro without the constant. The latter can then be dropped as there are no users left. Signed-off-by: Uwe Kleine-K=C3=B6nig Tested-by: Emil Renner Berthing Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/pwm/pwm-sifive.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/pwm/pwm-sifive.c b/drivers/pwm/pwm-sifive.c index 253c4a17d255..a55f7345dc87 100644 --- a/drivers/pwm/pwm-sifive.c +++ b/drivers/pwm/pwm-sifive.c @@ -23,7 +23,7 @@ #define PWM_SIFIVE_PWMCFG 0x0 #define PWM_SIFIVE_PWMCOUNT 0x8 #define PWM_SIFIVE_PWMS 0x10 -#define PWM_SIFIVE_PWMCMP0 0x20 +#define PWM_SIFIVE_PWMCMP(i) (0x20 + 4 * (i)) =20 /* PWMCFG fields */ #define PWM_SIFIVE_PWMCFG_SCALE GENMASK(3, 0) @@ -36,8 +36,6 @@ #define PWM_SIFIVE_PWMCFG_GANG BIT(24) #define PWM_SIFIVE_PWMCFG_IP BIT(28) =20 -/* PWM_SIFIVE_SIZE_PWMCMP is used to calculate offset for pwmcmpX register= s */ -#define PWM_SIFIVE_SIZE_PWMCMP 4 #define PWM_SIFIVE_CMPWIDTH 16 #define PWM_SIFIVE_DEFAULT_PERIOD 10000000 =20 @@ -112,8 +110,7 @@ static void pwm_sifive_get_state(struct pwm_chip *chip,= struct pwm_device *pwm, struct pwm_sifive_ddata *ddata =3D pwm_sifive_chip_to_ddata(chip); u32 duty, val; =20 - duty =3D readl(ddata->regs + PWM_SIFIVE_PWMCMP0 + - pwm->hwpwm * PWM_SIFIVE_SIZE_PWMCMP); + duty =3D readl(ddata->regs + PWM_SIFIVE_PWMCMP(pwm->hwpwm)); =20 state->enabled =3D duty > 0; =20 @@ -194,8 +191,7 @@ static int pwm_sifive_apply(struct pwm_chip *chip, stru= ct pwm_device *pwm, pwm_sifive_update_clock(ddata, clk_get_rate(ddata->clk)); } =20 - writel(frac, ddata->regs + PWM_SIFIVE_PWMCMP0 + - pwm->hwpwm * PWM_SIFIVE_SIZE_PWMCMP); + writel(frac, ddata->regs + PWM_SIFIVE_PWMCMP(pwm->hwpwm)); =20 if (state->enabled !=3D enabled) pwm_sifive_enable(chip, state->enabled); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E568C00140 for ; Mon, 15 Aug 2022 18:48:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243958AbiHOSsI (ORCPT ); Mon, 15 Aug 2022 14:48:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242674AbiHOSm4 (ORCPT ); Mon, 15 Aug 2022 14:42: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 9FBAA2AE13; Mon, 15 Aug 2022 11:26: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 5DDB4B8107A; Mon, 15 Aug 2022 18:26:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6F85C433D7; Mon, 15 Aug 2022 18:26:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587990; bh=aeRuvv4n+RQx3rdfldF9GjNSj+5s1DQan1L3wad8ZI0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CdciEexMDv/p15jJBSIbcD2e8WyVHBEARv4NuMwlJCtQgkkuChN/b1zk/i0cBYAOI UNA6SFCYZ/6A9LMuXwmZxVUo0o4Bf+vbbQ2bbz7cKFJ4tKjVQ638WPcomklc61x91M +PjoccPDhFsrahQuNBJ7B0fLDOsZxgl1yuoqletU= 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?= , Emil Renner Berthing , Thierry Reding , Sasha Levin Subject: [PATCH 5.15 229/779] pwm: sifive: Ensure the clk is enabled exactly once per running PWM Date: Mon, 15 Aug 2022 19:57:53 +0200 Message-Id: <20220815180347.084421171@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Uwe Kleine-K=C3=B6nig [ Upstream commit ace41d7564e655c39f709a78c035188a460c7cbd ] .apply() assumes the clk to be for a given PWM iff the PWM is enabled. So make sure this is the case when .probe() completes. And in .remove() disable the according number of times. This fixes a clk enable/disable imbalance, if some PWMs are already running at probe time. Fixes: 9e37a53eb051 (pwm: sifive: Add a driver for SiFive SoC PWM) Signed-off-by: Uwe Kleine-K=C3=B6nig Tested-by: Emil Renner Berthing Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/pwm/pwm-sifive.c | 46 ++++++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 9 deletions(-) diff --git a/drivers/pwm/pwm-sifive.c b/drivers/pwm/pwm-sifive.c index a55f7345dc87..3936fda53366 100644 --- a/drivers/pwm/pwm-sifive.c +++ b/drivers/pwm/pwm-sifive.c @@ -229,6 +229,8 @@ static int pwm_sifive_probe(struct platform_device *pde= v) struct pwm_sifive_ddata *ddata; struct pwm_chip *chip; int ret; + u32 val; + unsigned int enabled_pwms =3D 0, enabled_clks =3D 1; =20 ddata =3D devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL); if (!ddata) @@ -255,6 +257,33 @@ static int pwm_sifive_probe(struct platform_device *pd= ev) return ret; } =20 + val =3D readl(ddata->regs + PWM_SIFIVE_PWMCFG); + if (val & PWM_SIFIVE_PWMCFG_EN_ALWAYS) { + unsigned int i; + + for (i =3D 0; i < chip->npwm; ++i) { + val =3D readl(ddata->regs + PWM_SIFIVE_PWMCMP(i)); + if (val > 0) + ++enabled_pwms; + } + } + + /* The clk should be on once for each running PWM. */ + if (enabled_pwms) { + while (enabled_clks < enabled_pwms) { + /* This is not expected to fail as the clk is already on */ + ret =3D clk_enable(ddata->clk); + if (unlikely(ret)) { + dev_err_probe(dev, ret, "Failed to enable clk\n"); + goto disable_clk; + } + ++enabled_clks; + } + } else { + clk_disable(ddata->clk); + enabled_clks =3D 0; + } + /* Watch for changes to underlying clock frequency */ ddata->notifier.notifier_call =3D pwm_sifive_clock_notifier; ret =3D clk_notifier_register(ddata->clk, &ddata->notifier); @@ -277,7 +306,11 @@ static int pwm_sifive_probe(struct platform_device *pd= ev) unregister_clk: clk_notifier_unregister(ddata->clk, &ddata->notifier); disable_clk: - clk_disable_unprepare(ddata->clk); + while (enabled_clks) { + clk_disable(ddata->clk); + --enabled_clks; + } + clk_unprepare(ddata->clk); =20 return ret; } @@ -285,21 +318,16 @@ static int pwm_sifive_probe(struct platform_device *p= dev) static int pwm_sifive_remove(struct platform_device *dev) { struct pwm_sifive_ddata *ddata =3D platform_get_drvdata(dev); - bool is_enabled =3D false; struct pwm_device *pwm; int ch; =20 for (ch =3D 0; ch < ddata->chip.npwm; ch++) { pwm =3D &ddata->chip.pwms[ch]; - if (pwm->state.enabled) { - is_enabled =3D true; - break; - } + if (pwm->state.enabled) + clk_disable(ddata->clk); } - if (is_enabled) - clk_disable(ddata->clk); =20 - clk_disable_unprepare(ddata->clk); + clk_unprepare(ddata->clk); pwmchip_remove(&ddata->chip); clk_notifier_unregister(ddata->clk, &ddata->notifier); =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1187C00140 for ; Mon, 15 Aug 2022 18:48:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243944AbiHOSsC (ORCPT ); Mon, 15 Aug 2022 14:48:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232907AbiHOSm5 (ORCPT ); Mon, 15 Aug 2022 14:42: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 4F36B2A43A; Mon, 15 Aug 2022 11:26:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E386060FC4; Mon, 15 Aug 2022 18:26:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E68ECC433C1; Mon, 15 Aug 2022 18:26:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587993; bh=phN+qSxQHO3xHdsp0Cmw0hMbLrUCSsjAQLXTncAvUFU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TFmr9amSxPdxyYlGXxCq/6XJ7CLHwVUOtJyUXOf6Eh4kY/e2k98OpMDmhnS8C7ceo u+k4HupshKDw8HxzldgFUXpC1tDW9tTAtguylIfafghBmd2w3MRU4HGbCRNYvwQrN7 eOggriTU1w4FS+WTDyOoH+toP1cN3mEHYMudTi6U= 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?= , Emil Renner Berthing , Thierry Reding , Sasha Levin Subject: [PATCH 5.15 230/779] pwm: sifive: Shut down hardware only after pwmchip_remove() completed Date: Mon, 15 Aug 2022 19:57:54 +0200 Message-Id: <20220815180347.131601780@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Uwe Kleine-K=C3=B6nig [ Upstream commit 2375e964d541bb09158cd2dff67b5d74e8de61cd ] The PWMs are expected to be functional until pwmchip_remove() is called. So disable the clks only afterwards. Fixes: 9e37a53eb051 ("pwm: sifive: Add a driver for SiFive SoC PWM") Signed-off-by: Uwe Kleine-K=C3=B6nig Tested-by: Emil Renner Berthing Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/pwm/pwm-sifive.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/pwm/pwm-sifive.c b/drivers/pwm/pwm-sifive.c index 3936fda53366..58347fcd4812 100644 --- a/drivers/pwm/pwm-sifive.c +++ b/drivers/pwm/pwm-sifive.c @@ -321,6 +321,9 @@ static int pwm_sifive_remove(struct platform_device *de= v) struct pwm_device *pwm; int ch; =20 + pwmchip_remove(&ddata->chip); + clk_notifier_unregister(ddata->clk, &ddata->notifier); + for (ch =3D 0; ch < ddata->chip.npwm; ch++) { pwm =3D &ddata->chip.pwms[ch]; if (pwm->state.enabled) @@ -328,8 +331,6 @@ static int pwm_sifive_remove(struct platform_device *de= v) } =20 clk_unprepare(ddata->clk); - pwmchip_remove(&ddata->chip); - clk_notifier_unregister(ddata->clk, &ddata->notifier); =20 return 0; } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7310DC00140 for ; Mon, 15 Aug 2022 18:44:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243430AbiHOSoJ (ORCPT ); Mon, 15 Aug 2022 14:44:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243799AbiHOSlY (ORCPT ); Mon, 15 Aug 2022 14:41:24 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC2562657; Mon, 15 Aug 2022 11:25: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 sin.source.kernel.org (Postfix) with ESMTPS id E646ACE125C; Mon, 15 Aug 2022 18:25:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA1C6C433D6; Mon, 15 Aug 2022 18:24:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587899; bh=XAE+/OLaoY0GXqpevQP/rGZXBm8MGtL2ZRz1sE5nkBk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LgS+1Q14uEfCUrlF67lidyvpe/f7bYe8iErpqbfuJeIzQCwnO5K/rgZ/UgFYRZNb2 c8ylAps7RxUYe0dMciKcJktztwtjVufrj4hchhroOPWg1d2EhQm0hJW6VgX3Rlp8je uwQZ81T+ceqZa6IFKcjh2lOvA+qM21LTs5S2M9mI= 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?= , Thierry Reding , Sasha Levin Subject: [PATCH 5.15 231/779] pwm: lpc18xx-sct: Reduce number of devm memory allocations Date: Mon, 15 Aug 2022 19:57:55 +0200 Message-Id: <20220815180347.162000913@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Uwe Kleine-K=C3=B6nig [ Upstream commit 20d9de9c4d6642bb40c935233697723b56573cbc ] Each devm allocations has an overhead of 24 bytes to store the related struct devres_node additionally to the fragmentation of the allocator. So allocating 16 struct lpc18xx_pwm_data (which only hold a single int) adds quite some overhead. Instead put the per-channel data into the driver data struct and allocate it in one go. Signed-off-by: Uwe Kleine-K=C3=B6nig Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/pwm/pwm-lpc18xx-sct.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/pwm/pwm-lpc18xx-sct.c b/drivers/pwm/pwm-lpc18xx-sct.c index 8cc8ae16553c..6cf02554066c 100644 --- a/drivers/pwm/pwm-lpc18xx-sct.c +++ b/drivers/pwm/pwm-lpc18xx-sct.c @@ -76,6 +76,8 @@ #define LPC18XX_PWM_EVENT_PERIOD 0 #define LPC18XX_PWM_EVENT_MAX 16 =20 +#define LPC18XX_NUM_PWMS 16 + /* SCT conflict resolution */ enum lpc18xx_pwm_res_action { LPC18XX_PWM_RES_NONE, @@ -101,6 +103,7 @@ struct lpc18xx_pwm_chip { unsigned long event_map; struct mutex res_lock; struct mutex period_lock; + struct lpc18xx_pwm_data channeldata[LPC18XX_NUM_PWMS]; }; =20 static inline struct lpc18xx_pwm_chip * @@ -370,7 +373,7 @@ static int lpc18xx_pwm_probe(struct platform_device *pd= ev) =20 lpc18xx_pwm->chip.dev =3D &pdev->dev; lpc18xx_pwm->chip.ops =3D &lpc18xx_pwm_ops; - lpc18xx_pwm->chip.npwm =3D 16; + lpc18xx_pwm->chip.npwm =3D LPC18XX_NUM_PWMS; =20 /* SCT counter must be in unify (32 bit) mode */ lpc18xx_pwm_writel(lpc18xx_pwm, LPC18XX_PWM_CONFIG, @@ -400,12 +403,7 @@ static int lpc18xx_pwm_probe(struct platform_device *p= dev) =20 pwm =3D &lpc18xx_pwm->chip.pwms[i]; =20 - data =3D devm_kzalloc(lpc18xx_pwm->dev, sizeof(*data), - GFP_KERNEL); - if (!data) { - ret =3D -ENOMEM; - goto disable_pwmclk; - } + data =3D &lpc18xx_pwm->channeldata[i]; =20 pwm_set_chip_data(pwm, data); } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08295C00140 for ; Mon, 15 Aug 2022 18:44:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243445AbiHOSoP (ORCPT ); Mon, 15 Aug 2022 14:44:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243815AbiHOSl0 (ORCPT ); Mon, 15 Aug 2022 14:41:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 423123F32A; Mon, 15 Aug 2022 11:25: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 CEB41B80F99; Mon, 15 Aug 2022 18:25:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07CD3C433D6; Mon, 15 Aug 2022 18:25:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587902; bh=UF5GPIszFRHwpo/77bs1bWbnNvzx9uno6HUPVgnvNao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xPf5cRvjf2EIFMPV7OauN6gY4yCMlT9VclNlyujHy8zAZyt/4Znku91ZoKdinvFQd Lcx1A+y6VZ8Mu5TxU1KKYR3d23SmYXhbKc6xYvTh/BRAkYy0nHHPh6O36gcmuZgf66 edMjZLFwNQcJI5Ra4ZZZ/2lDyPFbFOmTeSXU+fCM= 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?= , Thierry Reding , Sasha Levin Subject: [PATCH 5.15 232/779] pwm: lpc18xx-sct: Simplify driver by not using pwm_[gs]et_chip_data() Date: Mon, 15 Aug 2022 19:57:56 +0200 Message-Id: <20220815180347.200305319@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Uwe Kleine-K=C3=B6nig [ Upstream commit 9136a39e6cf69e49803ac6123a4ac4431bc915a2 ] The per-channel data is available directly in the driver data struct. So use it without making use of pwm_[gs]et_chip_data(). The relevant change introduced by this patch to lpc18xx_pwm_disable() at the assembler level (for an arm lpc18xx_defconfig build) is: push {r3, r4, r5, lr} mov r4, r0 mov r0, r1 mov r5, r1 bl 0 ldr r3, [r0, #0] changes to ldr r3, [r1, #8] push {r4, lr} add.w r3, r0, r3, lsl #2 ldr r3, [r3, #92] ; 0x5c So this reduces stack usage, has an improved runtime behavior because of better pipeline usage, doesn't branch to an external function and the generated code is a bit smaller occupying less memory. The codesize of lpc18xx_pwm_probe() is reduced by 32 bytes. Signed-off-by: Uwe Kleine-K=C3=B6nig Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/pwm/pwm-lpc18xx-sct.c | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/drivers/pwm/pwm-lpc18xx-sct.c b/drivers/pwm/pwm-lpc18xx-sct.c index 6cf02554066c..b909096dba2f 100644 --- a/drivers/pwm/pwm-lpc18xx-sct.c +++ b/drivers/pwm/pwm-lpc18xx-sct.c @@ -166,7 +166,7 @@ static void lpc18xx_pwm_config_duty(struct pwm_chip *ch= ip, struct pwm_device *pwm, int duty_ns) { struct lpc18xx_pwm_chip *lpc18xx_pwm =3D to_lpc18xx_pwm_chip(chip); - struct lpc18xx_pwm_data *lpc18xx_data =3D pwm_get_chip_data(pwm); + struct lpc18xx_pwm_data *lpc18xx_data =3D &lpc18xx_pwm->channeldata[pwm->= hwpwm]; u64 val; =20 val =3D (u64)duty_ns * lpc18xx_pwm->clk_rate; @@ -236,7 +236,7 @@ static int lpc18xx_pwm_set_polarity(struct pwm_chip *ch= ip, static int lpc18xx_pwm_enable(struct pwm_chip *chip, struct pwm_device *pw= m) { struct lpc18xx_pwm_chip *lpc18xx_pwm =3D to_lpc18xx_pwm_chip(chip); - struct lpc18xx_pwm_data *lpc18xx_data =3D pwm_get_chip_data(pwm); + struct lpc18xx_pwm_data *lpc18xx_data =3D &lpc18xx_pwm->channeldata[pwm->= hwpwm]; enum lpc18xx_pwm_res_action res_action; unsigned int set_event, clear_event; =20 @@ -271,7 +271,7 @@ static int lpc18xx_pwm_enable(struct pwm_chip *chip, st= ruct pwm_device *pwm) static void lpc18xx_pwm_disable(struct pwm_chip *chip, struct pwm_device *= pwm) { struct lpc18xx_pwm_chip *lpc18xx_pwm =3D to_lpc18xx_pwm_chip(chip); - struct lpc18xx_pwm_data *lpc18xx_data =3D pwm_get_chip_data(pwm); + struct lpc18xx_pwm_data *lpc18xx_data =3D &lpc18xx_pwm->channeldata[pwm->= hwpwm]; =20 lpc18xx_pwm_writel(lpc18xx_pwm, LPC18XX_PWM_EVCTRL(lpc18xx_data->duty_event), 0); @@ -282,7 +282,7 @@ static void lpc18xx_pwm_disable(struct pwm_chip *chip, = struct pwm_device *pwm) static int lpc18xx_pwm_request(struct pwm_chip *chip, struct pwm_device *p= wm) { struct lpc18xx_pwm_chip *lpc18xx_pwm =3D to_lpc18xx_pwm_chip(chip); - struct lpc18xx_pwm_data *lpc18xx_data =3D pwm_get_chip_data(pwm); + struct lpc18xx_pwm_data *lpc18xx_data =3D &lpc18xx_pwm->channeldata[pwm->= hwpwm]; unsigned long event; =20 event =3D find_first_zero_bit(&lpc18xx_pwm->event_map, @@ -303,7 +303,7 @@ static int lpc18xx_pwm_request(struct pwm_chip *chip, s= truct pwm_device *pwm) static void lpc18xx_pwm_free(struct pwm_chip *chip, struct pwm_device *pwm) { struct lpc18xx_pwm_chip *lpc18xx_pwm =3D to_lpc18xx_pwm_chip(chip); - struct lpc18xx_pwm_data *lpc18xx_data =3D pwm_get_chip_data(pwm); + struct lpc18xx_pwm_data *lpc18xx_data =3D &lpc18xx_pwm->channeldata[pwm->= hwpwm]; =20 clear_bit(lpc18xx_data->duty_event, &lpc18xx_pwm->event_map); } @@ -327,8 +327,7 @@ MODULE_DEVICE_TABLE(of, lpc18xx_pwm_of_match); static int lpc18xx_pwm_probe(struct platform_device *pdev) { struct lpc18xx_pwm_chip *lpc18xx_pwm; - struct pwm_device *pwm; - int ret, i; + int ret; u64 val; =20 lpc18xx_pwm =3D devm_kzalloc(&pdev->dev, sizeof(*lpc18xx_pwm), @@ -398,16 +397,6 @@ static int lpc18xx_pwm_probe(struct platform_device *p= dev) lpc18xx_pwm_writel(lpc18xx_pwm, LPC18XX_PWM_LIMIT, BIT(lpc18xx_pwm->period_event)); =20 - for (i =3D 0; i < lpc18xx_pwm->chip.npwm; i++) { - struct lpc18xx_pwm_data *data; - - pwm =3D &lpc18xx_pwm->chip.pwms[i]; - - data =3D &lpc18xx_pwm->channeldata[i]; - - pwm_set_chip_data(pwm, data); - } - val =3D lpc18xx_pwm_readl(lpc18xx_pwm, LPC18XX_PWM_CTRL); val &=3D ~LPC18XX_PWM_BIDIR; val &=3D ~LPC18XX_PWM_CTRL_HALT; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40024C25B0E for ; Mon, 15 Aug 2022 18:44:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243480AbiHOSoZ (ORCPT ); Mon, 15 Aug 2022 14:44:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243846AbiHOSl3 (ORCPT ); Mon, 15 Aug 2022 14:41:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44E8B3FA05; Mon, 15 Aug 2022 11:25: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 E126BB80F99; Mon, 15 Aug 2022 18:25:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3CC28C433C1; Mon, 15 Aug 2022 18:25:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587905; bh=tyewOjfDvcMDuNc0n8mcfNqZN/2ho/mbC0GukSH0x9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h2aaNKTV1CA4gxJZCAtqw8h1ZSoddBOybBGo7wkuKJiVzO/0nbwWyXpPNMMf68Tln 8IZhYZcpkKVHoko/xWUHQTu2PAMhht6p3u5QFJloF/jC2Udy4TaHlPwb8QD7NrFdJK LWRGJ3iOhPTGnawGINX3J5VSLgDTd5iEvKUhkZcg= 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?= , Thierry Reding , Sasha Levin Subject: [PATCH 5.15 233/779] pwm: lpc18xx: Fix period handling Date: Mon, 15 Aug 2022 19:57:57 +0200 Message-Id: <20220815180347.244304969@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Uwe Kleine-K=C3=B6nig [ Upstream commit 8933d30c5f468d6cc1e4bf9bb535149da35f202e ] The calculation: val =3D (u64)NSEC_PER_SEC * LPC18XX_PWM_TIMER_MAX; do_div(val, lpc18xx_pwm->clk_rate); lpc18xx_pwm->max_period_ns =3D val; is bogus because with NSEC_PER_SEC =3D 1000000000, LPC18XX_PWM_TIMER_MAX =3D 0xffffffff and clk_rate < NSEC_PER_SEC this overflows the (on lpc18xx (i.e. ARM32) 32 bit wide) unsigned int .max_period_ns. This results (dependant of the actual clk rate) in an arbitrary limitation of the maximal period. E.g. for clkrate =3D 333333333 (Hz) we get max_period_ns =3D 9 instead of 12884901897. So make .max_period_ns an u64 and pass period and duty as u64 to not discard relevant digits. And also make use of mul_u64_u64_div_u64() which prevents all overflows assuming clk_rate < NSEC_PER_SEC. Fixes: 841e6f90bb78 ("pwm: NXP LPC18xx PWM/SCT driver") Signed-off-by: Uwe Kleine-K=C3=B6nig Signed-off-by: Thierry Reding Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/pwm/pwm-lpc18xx-sct.c | 55 +++++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/drivers/pwm/pwm-lpc18xx-sct.c b/drivers/pwm/pwm-lpc18xx-sct.c index b909096dba2f..43b5509dde51 100644 --- a/drivers/pwm/pwm-lpc18xx-sct.c +++ b/drivers/pwm/pwm-lpc18xx-sct.c @@ -98,7 +98,7 @@ struct lpc18xx_pwm_chip { unsigned long clk_rate; unsigned int period_ns; unsigned int min_period_ns; - unsigned int max_period_ns; + u64 max_period_ns; unsigned int period_event; unsigned long event_map; struct mutex res_lock; @@ -145,40 +145,48 @@ static void lpc18xx_pwm_set_conflict_res(struct lpc18= xx_pwm_chip *lpc18xx_pwm, mutex_unlock(&lpc18xx_pwm->res_lock); } =20 -static void lpc18xx_pwm_config_period(struct pwm_chip *chip, int period_ns) +static void lpc18xx_pwm_config_period(struct pwm_chip *chip, u64 period_ns) { struct lpc18xx_pwm_chip *lpc18xx_pwm =3D to_lpc18xx_pwm_chip(chip); - u64 val; + u32 val; =20 - val =3D (u64)period_ns * lpc18xx_pwm->clk_rate; - do_div(val, NSEC_PER_SEC); + /* + * With clk_rate < NSEC_PER_SEC this cannot overflow. + * With period_ns < max_period_ns this also fits into an u32. + * As period_ns >=3D min_period_ns =3D DIV_ROUND_UP(NSEC_PER_SEC, lpc18xx= _pwm->clk_rate); + * we have val >=3D 1. + */ + val =3D mul_u64_u64_div_u64(period_ns, lpc18xx_pwm->clk_rate, NSEC_PER_SE= C); =20 lpc18xx_pwm_writel(lpc18xx_pwm, LPC18XX_PWM_MATCH(lpc18xx_pwm->period_event), - (u32)val - 1); + val - 1); =20 lpc18xx_pwm_writel(lpc18xx_pwm, LPC18XX_PWM_MATCHREL(lpc18xx_pwm->period_event), - (u32)val - 1); + val - 1); } =20 static void lpc18xx_pwm_config_duty(struct pwm_chip *chip, - struct pwm_device *pwm, int duty_ns) + struct pwm_device *pwm, u64 duty_ns) { struct lpc18xx_pwm_chip *lpc18xx_pwm =3D to_lpc18xx_pwm_chip(chip); struct lpc18xx_pwm_data *lpc18xx_data =3D &lpc18xx_pwm->channeldata[pwm->= hwpwm]; - u64 val; + u32 val; =20 - val =3D (u64)duty_ns * lpc18xx_pwm->clk_rate; - do_div(val, NSEC_PER_SEC); + /* + * With clk_rate < NSEC_PER_SEC this cannot overflow. + * With duty_ns <=3D period_ns < max_period_ns this also fits into an u32. + */ + val =3D mul_u64_u64_div_u64(duty_ns, lpc18xx_pwm->clk_rate, NSEC_PER_SEC); =20 lpc18xx_pwm_writel(lpc18xx_pwm, LPC18XX_PWM_MATCH(lpc18xx_data->duty_event), - (u32)val); + val); =20 lpc18xx_pwm_writel(lpc18xx_pwm, LPC18XX_PWM_MATCHREL(lpc18xx_data->duty_event), - (u32)val); + val); } =20 static int lpc18xx_pwm_config(struct pwm_chip *chip, struct pwm_device *pw= m, @@ -360,12 +368,27 @@ static int lpc18xx_pwm_probe(struct platform_device *= pdev) goto disable_pwmclk; } =20 + /* + * If clkrate is too fast, the calculations in .apply() might overflow. + */ + if (lpc18xx_pwm->clk_rate > NSEC_PER_SEC) { + ret =3D dev_err_probe(&pdev->dev, -EINVAL, "pwm clock to fast\n"); + goto disable_pwmclk; + } + + /* + * If clkrate is too fast, the calculations in .apply() might overflow. + */ + if (lpc18xx_pwm->clk_rate > NSEC_PER_SEC) { + ret =3D dev_err_probe(&pdev->dev, -EINVAL, "pwm clock to fast\n"); + goto disable_pwmclk; + } + mutex_init(&lpc18xx_pwm->res_lock); mutex_init(&lpc18xx_pwm->period_lock); =20 - val =3D (u64)NSEC_PER_SEC * LPC18XX_PWM_TIMER_MAX; - do_div(val, lpc18xx_pwm->clk_rate); - lpc18xx_pwm->max_period_ns =3D val; + lpc18xx_pwm->max_period_ns =3D + mul_u64_u64_div_u64(NSEC_PER_SEC, LPC18XX_PWM_TIMER_MAX, lpc18xx_pwm->cl= k_rate); =20 lpc18xx_pwm->min_period_ns =3D DIV_ROUND_UP(NSEC_PER_SEC, lpc18xx_pwm->clk_rate); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53A24C00140 for ; Mon, 15 Aug 2022 18:44:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241862AbiHOSo1 (ORCPT ); Mon, 15 Aug 2022 14:44:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243883AbiHOSle (ORCPT ); Mon, 15 Aug 2022 14:41:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EAED2ED79; Mon, 15 Aug 2022 11:25: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 D7244B8107A; Mon, 15 Aug 2022 18:25:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C57EC433D6; Mon, 15 Aug 2022 18:25:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587908; bh=hPaoAoTABbJA0k59XLBjjONJsaLFqDVLNIXSySjz6vo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lNuM5MG1O/3TqSYQEBc/SPWQLy6NwVFlGdrNIdBoJzwXMrEW4tvP/YWXHdAIUf+pZ zSKzONIlJcTGBeJY+DY3CeD8R34xadUQWhaGju+j2SDbTsc2RAbOfS6D7StgAQgM2F 4kL0BnFbivPUkTMXWjgrTtLCtAOdgFSUzGUVuyTw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Douglas Anderson , Dmitry Baryshkov , Sasha Levin Subject: [PATCH 5.15 234/779] drm/dp: Export symbol / kerneldoc fixes for DP AUX bus Date: Mon, 15 Aug 2022 19:57:58 +0200 Message-Id: <20220815180347.292508079@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Anderson [ Upstream commit 39c28cdfb719f0e306b447f0827dfd712f81858b ] While working on the DP AUX bus code I found a few small things that should be fixed. Namely the non-devm version of of_dp_aux_populate_ep_devices() was missing an export. There was also an extra blank line in a kerneldoc and a kerneldoc that incorrectly documented a return value. Fix these. Fixes: aeb33699fc2c ("drm: Introduce the DP AUX bus") Signed-off-by: Douglas Anderson Reviewed-by: Dmitry Baryshkov Link: https://patchwork.freedesktop.org/patch/msgid/20220510122726.v3.1.Ia9= 1f4849adfc5eb9da1eb37ba79aa65fb3c95a0f@changeid Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/drm_dp_aux_bus.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_dp_aux_bus.c b/drivers/gpu/drm/drm_dp_aux_= bus.c index 298ea7a49591..f7c03ad5a15a 100644 --- a/drivers/gpu/drm/drm_dp_aux_bus.c +++ b/drivers/gpu/drm/drm_dp_aux_bus.c @@ -66,7 +66,6 @@ static int dp_aux_ep_probe(struct device *dev) * @dev: The device to remove. * * Calls through to the endpoint driver remove. - * */ static void dp_aux_ep_remove(struct device *dev) { @@ -120,8 +119,6 @@ ATTRIBUTE_GROUPS(dp_aux_ep_dev); /** * dp_aux_ep_dev_release() - Free memory for the dp_aux_ep device * @dev: The device to free. - * - * Return: 0 if no error or negative error code. */ static void dp_aux_ep_dev_release(struct device *dev) { @@ -256,6 +253,7 @@ int of_dp_aux_populate_ep_devices(struct drm_dp_aux *au= x) =20 return 0; } +EXPORT_SYMBOL_GPL(of_dp_aux_populate_ep_devices); =20 static void of_dp_aux_depopulate_ep_devices_void(void *data) { --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34A33C00140 for ; Mon, 15 Aug 2022 18:44:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243500AbiHOSoc (ORCPT ); Mon, 15 Aug 2022 14:44:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243893AbiHOSli (ORCPT ); Mon, 15 Aug 2022 14:41:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36AC9BC; Mon, 15 Aug 2022 11:25: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 B7946B80F99; Mon, 15 Aug 2022 18:25:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0275CC433C1; Mon, 15 Aug 2022 18:25:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587911; bh=DNt4WbPxh9ZOJW2Cbt6ropOHdfsmBte4nCv3qnWluoo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B0i5H5ytKXBPMzBBeQpkwJkUDKLzUcBViSZVCp/kuYF18JWZXKUxs0q2DFYf73rWE +tisakBP1vyOAb6y1y7kZlXzoZU5B53NkznU7nYA35KLViXfOQqAbt21tWHGIMfv4T hKsGFBTwIA2HNTL5dpLGEvahOf1ZqhMO5ZRbdGoA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lucas Stach , Marek Vasut , Jonas Karlman , Laurent Pinchart , Maxime Ripard , Neil Armstrong , Sam Ravnborg , Robert Foss , Sasha Levin Subject: [PATCH 5.15 235/779] drm/bridge: tc358767: Move (e)DP bridge endpoint parsing into dedicated function Date: Mon, 15 Aug 2022 19:57:59 +0200 Message-Id: <20220815180347.324851023@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 8478095a8c4bcea3c83b0767d6c9127434160761 ] The TC358767/TC358867/TC9595 are all capable of operating in multiple modes, DPI-to-(e)DP, DSI-to-(e)DP, DSI-to-DPI. Only the first mode is currently supported. In order to support the rest of the modes without making the tc_probe() overly long, split the bridge endpoint parsing into dedicated function, where the necessary logic to detect the bridge mode based on which endpoints are connected, can be implemented. Reviewed-by: Lucas Stach Tested-by: Lucas Stach # In both DPI to eDP and DS= I to DPI mode. Signed-off-by: Marek Vasut Cc: Jonas Karlman Cc: Laurent Pinchart Cc: Maxime Ripard Cc: Neil Armstrong Cc: Sam Ravnborg Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220329085015.39159-7-= marex@denx.de Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/bridge/tc358767.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc3= 58767.c index 23a6f90b694b..a2d051ed6cd8 100644 --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -1549,19 +1549,12 @@ static irqreturn_t tc_irq_handler(int irq, void *ar= g) return IRQ_HANDLED; } =20 -static int tc_probe(struct i2c_client *client, const struct i2c_device_id = *id) +static int tc_probe_edp_bridge_endpoint(struct tc_data *tc) { - struct device *dev =3D &client->dev; + struct device *dev =3D tc->dev; struct drm_panel *panel; - struct tc_data *tc; int ret; =20 - tc =3D devm_kzalloc(dev, sizeof(*tc), GFP_KERNEL); - if (!tc) - return -ENOMEM; - - tc->dev =3D dev; - /* port@2 is the output port */ ret =3D drm_of_find_panel_or_bridge(dev->of_node, 2, 0, &panel, NULL); if (ret && ret !=3D -ENODEV) @@ -1580,6 +1573,25 @@ static int tc_probe(struct i2c_client *client, const= struct i2c_device_id *id) tc->bridge.type =3D DRM_MODE_CONNECTOR_DisplayPort; } =20 + return ret; +} + +static int tc_probe(struct i2c_client *client, const struct i2c_device_id = *id) +{ + struct device *dev =3D &client->dev; + struct tc_data *tc; + int ret; + + tc =3D devm_kzalloc(dev, sizeof(*tc), GFP_KERNEL); + if (!tc) + return -ENOMEM; + + tc->dev =3D dev; + + ret =3D tc_probe_edp_bridge_endpoint(tc); + if (ret) + return ret; + /* Shut down GPIO is optional */ tc->sd_gpio =3D devm_gpiod_get_optional(dev, "shutdown", GPIOD_OUT_HIGH); if (IS_ERR(tc->sd_gpio)) --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C557C3F6B0 for ; Mon, 15 Aug 2022 18:44:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243509AbiHOSof (ORCPT ); Mon, 15 Aug 2022 14:44:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243911AbiHOSlk (ORCPT ); Mon, 15 Aug 2022 14:41: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 2E223C1C; Mon, 15 Aug 2022 11:25: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 46DE960FB5; Mon, 15 Aug 2022 18:25:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E21CC433C1; Mon, 15 Aug 2022 18:25:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587914; bh=MwQx0kl1Vvr/QAikUnONp1UQCcEMBPy/CsbZtyschfU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gl2fZmopXa/pR0IzJdSBhPDKGDEYOBPfg55ToEyCQ6E5htNBnFPAHDAEoTRqMN0ac QbCZ+t6jtv2h4j/aJm4gWGXreM29q5Hn6jT+i/s6KNV5uMXW6Znfchma+0tOwbeZZ8 a/JTsrAN101gdKDqsCDCBmGL46g3C6nJNUXgQ6x8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Steev Klimaszewski , Kalle Valo , Sasha Levin Subject: [PATCH 5.15 236/779] ath10k: do not enforce interrupt trigger type Date: Mon, 15 Aug 2022 19:58:00 +0200 Message-Id: <20220815180347.366469325@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 1ee6c5abebd3cacf2ac4378d0ed4f57fd4850421 ] Interrupt line can be configured on different hardware in different way, even inverted. Therefore driver should not enforce specific trigger type - edge rising - but instead rely on Devicetree to configure it. All Qualcomm DTSI with WCN3990 define the interrupt type as level high, so the mismatch between DTSI and driver causes rebind issues: $ echo 18800000.wifi > /sys/bus/platform/drivers/ath10k_snoc/unbind $ echo 18800000.wifi > /sys/bus/platform/drivers/ath10k_snoc/bind [ 44.763114] irq: type mismatch, failed to map hwirq-446 for interrupt-= controller@17a00000! [ 44.763130] ath10k_snoc 18800000.wifi: error -ENXIO: IRQ index 0 not f= ound [ 44.763140] ath10k_snoc 18800000.wifi: failed to initialize resource: = -6 Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.3.2.0.c8-00009-QCAHLSWSC8180XMTPLZ-1 Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.2.0-01387-QCAHLSWMTPLZ-1 Fixes: c963a683e701 ("ath10k: add resource init and deinit for WCN3990") Signed-off-by: Krzysztof Kozlowski Tested-by: Steev Klimaszewski Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220513151516.357549-1-krzysztof.kozlowski= @linaro.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/wireless/ath/ath10k/snoc.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/= ath/ath10k/snoc.c index f79dd9a71690..73fe77e7824b 100644 --- a/drivers/net/wireless/ath/ath10k/snoc.c +++ b/drivers/net/wireless/ath/ath10k/snoc.c @@ -1249,13 +1249,12 @@ static void ath10k_snoc_init_napi(struct ath10k *ar) static int ath10k_snoc_request_irq(struct ath10k *ar) { struct ath10k_snoc *ar_snoc =3D ath10k_snoc_priv(ar); - int irqflags =3D IRQF_TRIGGER_RISING; int ret, id; =20 for (id =3D 0; id < CE_COUNT_MAX; id++) { ret =3D request_irq(ar_snoc->ce_irqs[id].irq_line, - ath10k_snoc_per_engine_handler, - irqflags, ce_name[id], ar); + ath10k_snoc_per_engine_handler, 0, + ce_name[id], ar); if (ret) { ath10k_err(ar, "failed to register IRQ handler for CE %d: %d\n", --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D49BEC25B0E for ; Mon, 15 Aug 2022 18:44:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242464AbiHOSom (ORCPT ); Mon, 15 Aug 2022 14:44:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243927AbiHOSlm (ORCPT ); Mon, 15 Aug 2022 14:41: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 58C962601; Mon, 15 Aug 2022 11:25: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 DF4FDB8107A; Mon, 15 Aug 2022 18:25:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39596C433C1; Mon, 15 Aug 2022 18:25:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587917; bh=pnvaMLesXBJXsHLWxICNiZb97IBc/mzaCI8YP8hNkwc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1xj9JAYukJKxtqtXhgKhD/tbX0E8ADylRZazLnIZaijSf/X3kbrRa4F7GfBjof97G U15N2N495nkOLo8LZ3qDoUW5+xYNae9fT/kCF1ebdMBgjJDaQfkELbijrzDo3cBn7B 8fHUMr/3+aPpjxhpLVHSNEk8T89VaHo/lh9njtS4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Javier Martinez Canillas , Geert Uytterhoeven , David Lechner , Sasha Levin Subject: [PATCH 5.15 237/779] drm/st7735r: Fix module autoloading for Okaya RH128128T Date: Mon, 15 Aug 2022 19:58:01 +0200 Message-Id: <20220815180347.414913382@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Javier Martinez Canillas [ Upstream commit 9ad6f181ad9a19a26bda73a7b199df44ccfcdaba ] The SPI core always reports a "MODALIAS=3Dspi:", even if the device was registered via OF. This means that the st7735r.ko module won't autoload if a DT has a node with a compatible "okaya,rh128128t" string. In that case, kmod expects a "MODALIAS=3Dof:N*T*Cokaya,rh128128t" uevent but instead will get a "MODALIAS=3Dspi:rh128128t", which is not present in the list of aliases: $ modinfo drivers/gpu/drm/tiny/st7735r.ko | grep alias alias: of:N*T*Cokaya,rh128128tC* alias: of:N*T*Cokaya,rh128128t alias: of:N*T*Cjianda,jd-t18003-t01C* alias: of:N*T*Cjianda,jd-t18003-t01 alias: spi:jd-t18003-t01 To workaround this issue, add in the SPI table an entry for that device. Fixes: d1d511d516f7 ("drm: tiny: st7735r: Add support for Okaya RH128128T") Signed-off-by: Javier Martinez Canillas Reviewed-by: Geert Uytterhoeven Acked-by: David Lechner Link: https://patchwork.freedesktop.org/patch/msgid/20220520091602.179078-1= -javierm@redhat.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/tiny/st7735r.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/tiny/st7735r.c b/drivers/gpu/drm/tiny/st7735r.c index fc40dd10efa8..713e4b286210 100644 --- a/drivers/gpu/drm/tiny/st7735r.c +++ b/drivers/gpu/drm/tiny/st7735r.c @@ -174,6 +174,7 @@ MODULE_DEVICE_TABLE(of, st7735r_of_match); =20 static const struct spi_device_id st7735r_id[] =3D { { "jd-t18003-t01", (uintptr_t)&jd_t18003_t01_cfg }, + { "rh128128t", (uintptr_t)&rh128128t_cfg }, { }, }; MODULE_DEVICE_TABLE(spi, st7735r_id); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F8DAC3F6B0 for ; Mon, 15 Aug 2022 18:44:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243130AbiHOSou (ORCPT ); Mon, 15 Aug 2022 14:44:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243937AbiHOSlr (ORCPT ); Mon, 15 Aug 2022 14:41:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 347EA2DD6; Mon, 15 Aug 2022 11:25: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 BEAF760FB5; Mon, 15 Aug 2022 18:25:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5318BC433C1; Mon, 15 Aug 2022 18:25:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587921; bh=qNfThmwwq1963EsJfsk7YisRF50ZzA+a4G/WyzoxZvs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JcHUbreC2liXied1gplOA2r9WNLh9k78IDWtTWwOdPblH4VYPFu3wbMKwdXjy/a/V 6+NqdO37LWVawKB+uFWOPHzzLP4gWtxsO/7dcLq9XLw2FmkDEGBrfEPw/M7nAj3wmY mhvd0UhKLNtLlgG6OabMjlVwi/PoA2Hubviu7ZWg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Gao Chao , Douglas Anderson , Sasha Levin Subject: [PATCH 5.15 238/779] drm/panel: Fix build error when CONFIG_DRM_PANEL_SAMSUNG_ATNA33XC20=y && CONFIG_DRM_DISPLAY_HELPER=m Date: Mon, 15 Aug 2022 19:58:02 +0200 Message-Id: <20220815180347.456238519@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Gao Chao [ Upstream commit a67664860f7833015a683ea295f7c79ac2901332 ] If CONFIG_DRM_PANEL_SAMSUNG_ATNA33XC20=3Dy && CONFIG_DRM_DISPLAY_HELPER=3Dm, bulding fails: drivers/gpu/drm/panel/panel-samsung-atna33xc20.o: In function `atana33xc20_= probe': panel-samsung-atna33xc20.c:(.text+0x744): undefined reference to `drm_panel_dp_aux_backlight' make: *** [vmlinux] Error 1 Let CONFIG_DRM_PANEL_SAMSUNG_ATNA33XC20 select DRM_DISPLAY_DP_HELPER and CONFIG_DRM_DISPLAY_HELPER to fix this error. Fixes: 32ce3b320343 ("drm/panel: atna33xc20: Introduce the Samsung ATNA33XC= 20 panel") Reported-by: Hulk Robot Signed-off-by: Gao Chao Reviewed-by: Douglas Anderson Signed-off-by: Douglas Anderson Link: https://patchwork.freedesktop.org/patch/msgid/20220524024551.539-1-ga= ochao49@huawei.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/panel/Kconfig | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index af1402d83d51..479ffdb64486 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -373,6 +373,8 @@ config DRM_PANEL_SAMSUNG_ATNA33XC20 depends on OF depends on BACKLIGHT_CLASS_DEVICE depends on PM + select DRM_DISPLAY_DP_HELPER + select DRM_DISPLAY_HELPER select DRM_DP_AUX_BUS help DRM panel driver for the Samsung ATNA33XC20 panel. This panel can't --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D228C25B0E for ; Mon, 15 Aug 2022 18:44:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243275AbiHOSoz (ORCPT ); Mon, 15 Aug 2022 14:44:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243955AbiHOSlv (ORCPT ); Mon, 15 Aug 2022 14:41: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 F1BED65F8; Mon, 15 Aug 2022 11:25: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 8E51B60FDA; Mon, 15 Aug 2022 18:25:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94DBDC433C1; Mon, 15 Aug 2022 18:25:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587924; bh=LMkp6NyyuV2Ez/uJw716SkPh5MsLtM2lf94sqx8wvtc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Afrz65FgGG57HRV1z7jFO0WG5ReQ4TJuWd9QcbMXX/GzsYHbz8mvw3q/mb5307dva 4g1zc9/y5kz8OolamzL48hB33s2BH6hADIqTI989InTQBSlBXB8jOT/d0w1urn8B3+ 7RFEpKyrAigq5OvrvJMZLhzgmB5bJMJlQ03GMr+M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Kalle Valo , Sasha Levin Subject: [PATCH 5.15 239/779] wifi: rtlwifi: fix error codes in rtl_debugfs_set_write_h2c() Date: Mon, 15 Aug 2022 19:58:03 +0200 Message-Id: <20220815180347.495994260@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter [ Upstream commit b88d28146c30a8e14f0f012d56ebf19b68a348f4 ] If the copy_from_user() fails or the user gives invalid date then the correct thing to do is to return a negative error code. (Currently it returns success). I made a copy additional related cleanups: 1) There is no need to check "buffer" for NULL. That's handled by copy_from_user(). 2) The "h2c_len" variable cannot be negative because it is unsigned and because sscanf() does not return negative error codes. Fixes: 610247f46feb ("rtlwifi: Improve debugging by using debugfs") Signed-off-by: Dan Carpenter Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/YoOLnDkHgVltyXK7@kili Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/wireless/realtek/rtlwifi/debug.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/realtek/rtlwifi/debug.c b/drivers/net/wir= eless/realtek/rtlwifi/debug.c index 901cdfe3723c..0b1bc04cb6ad 100644 --- a/drivers/net/wireless/realtek/rtlwifi/debug.c +++ b/drivers/net/wireless/realtek/rtlwifi/debug.c @@ -329,8 +329,8 @@ static ssize_t rtl_debugfs_set_write_h2c(struct file *f= ilp, =20 tmp_len =3D (count > sizeof(tmp) - 1 ? sizeof(tmp) - 1 : count); =20 - if (!buffer || copy_from_user(tmp, buffer, tmp_len)) - return count; + if (copy_from_user(tmp, buffer, tmp_len)) + return -EFAULT; =20 tmp[tmp_len] =3D '\0'; =20 @@ -340,8 +340,8 @@ static ssize_t rtl_debugfs_set_write_h2c(struct file *f= ilp, &h2c_data[4], &h2c_data[5], &h2c_data[6], &h2c_data[7]); =20 - if (h2c_len <=3D 0) - return count; + if (h2c_len =3D=3D 0) + return -EINVAL; =20 for (i =3D 0; i < h2c_len; i++) h2c_data_packed[i] =3D (u8)h2c_data[i]; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 02BA5C25B08 for ; Mon, 15 Aug 2022 18:45:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243698AbiHOSo7 (ORCPT ); Mon, 15 Aug 2022 14:44:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243967AbiHOSlw (ORCPT ); Mon, 15 Aug 2022 14:41:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DC8A11A16; Mon, 15 Aug 2022 11:25: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 C225B60FD0; Mon, 15 Aug 2022 18:25:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80FCDC433D6; Mon, 15 Aug 2022 18:25:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587927; bh=60CuFHXWJNw/gjcsxiSLg5Tv8sOVH9XOecH9WAGiZ/Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pkjFPqsKNG53mHQNzjO3gzfS7cZ/QHCzo/eJ5lpCvlvuHzG6CC/EMjfEl+0fRL/KO XvW30CAtwqbWfMW7TViYJaSE3Q2Sd4NznpP5pWIndqfdHIc3KdFcVZ/XtKanSO3Yj/ TmoS5UBe1gv05eNz82He4YAwEeimyraLmXiPZk68= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Kalle Valo , Sasha Levin Subject: [PATCH 5.15 240/779] ath11k: fix netdev open race Date: Mon, 15 Aug 2022 19:58:04 +0200 Message-Id: <20220815180347.545103980@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 [ Upstream commit d4ba1ff87b17e81686ada8f429300876f55f95ad ] Make sure to allocate resources needed before registering the device. This specifically avoids having a racing open() trigger a BUG_ON() in mod_timer() when ath11k_mac_op_start() is called before the mon_reap_timer as been set up. I did not see this issue with next-20220310, but I hit it on every probe with next-20220511. Perhaps some timing changed in between. Here's the backtrace: [ 51.346947] kernel BUG at kernel/time/timer.c:990! [ 51.346958] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ... [ 51.578225] Call trace: [ 51.583293] __mod_timer+0x298/0x390 [ 51.589518] mod_timer+0x14/0x20 [ 51.595368] ath11k_mac_op_start+0x41c/0x4a0 [ath11k] [ 51.603165] drv_start+0x38/0x60 [mac80211] [ 51.610110] ieee80211_do_open+0x29c/0x7d0 [mac80211] [ 51.617945] ieee80211_open+0x60/0xb0 [mac80211] [ 51.625311] __dev_open+0x100/0x1c0 [ 51.631420] __dev_change_flags+0x194/0x210 [ 51.638214] dev_change_flags+0x24/0x70 [ 51.644646] do_setlink+0x228/0xdb0 [ 51.650723] __rtnl_newlink+0x460/0x830 [ 51.657162] rtnl_newlink+0x4c/0x80 [ 51.663229] rtnetlink_rcv_msg+0x124/0x390 [ 51.669917] netlink_rcv_skb+0x58/0x130 [ 51.676314] rtnetlink_rcv+0x18/0x30 [ 51.682460] netlink_unicast+0x250/0x310 [ 51.688960] netlink_sendmsg+0x19c/0x3e0 [ 51.695458] ____sys_sendmsg+0x220/0x290 [ 51.701938] ___sys_sendmsg+0x7c/0xc0 [ 51.708148] __sys_sendmsg+0x68/0xd0 [ 51.714254] __arm64_sys_sendmsg+0x28/0x40 [ 51.720900] invoke_syscall+0x48/0x120 Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_L= ITE-3 Fixes: d5c65159f289 ("ath11k: driver for Qualcomm IEEE 802.11ax devices") Fixes: 840c36fa727a ("ath11k: dp: stop rx pktlog before suspend") Signed-off-by: Johan Hovold Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220517103436.15867-1-johan+linaro@kernel.= org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/wireless/ath/ath11k/core.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/= ath/ath11k/core.c index 48b4151e13a3..48a449fbd2bc 100644 --- a/drivers/net/wireless/ath/ath11k/core.c +++ b/drivers/net/wireless/ath/ath11k/core.c @@ -699,23 +699,23 @@ static int ath11k_core_pdev_create(struct ath11k_base= *ab) return ret; } =20 - ret =3D ath11k_mac_register(ab); + ret =3D ath11k_dp_pdev_alloc(ab); if (ret) { - ath11k_err(ab, "failed register the radio with mac80211: %d\n", ret); + ath11k_err(ab, "failed to attach DP pdev: %d\n", ret); goto err_pdev_debug; } =20 - ret =3D ath11k_dp_pdev_alloc(ab); + ret =3D ath11k_mac_register(ab); if (ret) { - ath11k_err(ab, "failed to attach DP pdev: %d\n", ret); - goto err_mac_unregister; + ath11k_err(ab, "failed register the radio with mac80211: %d\n", ret); + goto err_dp_pdev_free; } =20 ret =3D ath11k_thermal_register(ab); if (ret) { ath11k_err(ab, "could not register thermal device: %d\n", ret); - goto err_dp_pdev_free; + goto err_mac_unregister; } =20 ret =3D ath11k_spectral_init(ab); @@ -728,10 +728,10 @@ static int ath11k_core_pdev_create(struct ath11k_base= *ab) =20 err_thermal_unregister: ath11k_thermal_unregister(ab); -err_dp_pdev_free: - ath11k_dp_pdev_free(ab); err_mac_unregister: ath11k_mac_unregister(ab); +err_dp_pdev_free: + ath11k_dp_pdev_free(ab); err_pdev_debug: ath11k_debugfs_pdev_destroy(ab); =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCA07C00140 for ; Mon, 15 Aug 2022 18:45:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243723AbiHOSpL (ORCPT ); Mon, 15 Aug 2022 14:45:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244000AbiHOSl5 (ORCPT ); Mon, 15 Aug 2022 14:41:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0C09193F9; Mon, 15 Aug 2022 11:25: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 41150B81071; Mon, 15 Aug 2022 18:25:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 853F8C433D6; Mon, 15 Aug 2022 18:25:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587932; bh=897j7/IG76KnO1vB9qbkdsaobuPqY38yZ+NkGlcgl5w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WQ3j1ccSaEPMBfZ9ncOUlgaVWFvhKY3KQn51NoR/hotrEbTQw+65BZ8giLjx9/fPq v3vOA8IgcLVvlus89mtn7muUvarV4S2Groq3ce0ylSo+TsxRL890ZpblcuRkVw5qdB IKj7aYuOIFJPbc9XqhCbX2x1fBWEwDOkY6r9sw1o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yunhao Tian , =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= , Sasha Levin Subject: [PATCH 5.15 241/779] drm/mipi-dbi: align max_chunk to 2 in spi_transfer Date: Mon, 15 Aug 2022 19:58:05 +0200 Message-Id: <20220815180347.594312970@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yunhao Tian [ Upstream commit 435c249008cba04ed6a7975e9411f3b934620204 ] In __spi_validate, there's a validation that no partial transfers are accepted (xfer->len % w_size must be zero). When max_chunk is not a multiple of bpw (e.g. max_chunk =3D 65535, bpw =3D 16), the transfer will be rejected. This patch aligns max_chunk to 2 bytes (the maximum value of bpw is 16), so that no partial transfer will occur. Fixes: d23d4d4dac01 ("drm/tinydrm: Move tinydrm_spi_transfer()") Signed-off-by: Yunhao Tian Signed-off-by: Noralf Tr=C3=B8nnes Link: https://patchwork.freedesktop.org/patch/msgid/20220510030219.2486687-= 1-t123yh.xyz@gmail.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/drm_mipi_dbi.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c index 71b646c4131f..00d470ff071d 100644 --- a/drivers/gpu/drm/drm_mipi_dbi.c +++ b/drivers/gpu/drm/drm_mipi_dbi.c @@ -1183,6 +1183,13 @@ int mipi_dbi_spi_transfer(struct spi_device *spi, u3= 2 speed_hz, size_t chunk; int ret; =20 + /* In __spi_validate, there's a validation that no partial transfers + * are accepted (xfer->len % w_size must be zero). + * Here we align max_chunk to multiple of 2 (16bits), + * to prevent transfers from being rejected. + */ + max_chunk =3D ALIGN_DOWN(max_chunk, 2); + spi_message_init_with_transfers(&m, &tr, 1); =20 while (len) { --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0AAFC25B08 for ; Mon, 15 Aug 2022 18:45:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229879AbiHOSpQ (ORCPT ); Mon, 15 Aug 2022 14:45:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244012AbiHOSl6 (ORCPT ); Mon, 15 Aug 2022 14:41:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 724532ED76; Mon, 15 Aug 2022 11:25: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 067E6B81085; Mon, 15 Aug 2022 18:25:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42411C433C1; Mon, 15 Aug 2022 18:25:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587935; bh=LRYanTTuM7Fr/DtH9Gv9pC3t6OmIF336n5aBC7aLuoI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aI9Llr53gn/QD3wzKQ3OtKzgDvCwVfm+qPn530XZqJPnE7AwchVWA+gpIXq5V76a6 bHhHBh9vZ0/C+4nLv6okqIPvN8LcZgPYH1M0/SjZt9ZUV6yHZ+Vf+q01obcUznKa5p 696nMIp2XzAnlLSSygS2epRJkLmxYEsRDd+AU9Y8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manikanta Pubbisetty , Kalle Valo , Sasha Levin Subject: [PATCH 5.15 242/779] ath11k: Fix incorrect debug_mask mappings Date: Mon, 15 Aug 2022 19:58:06 +0200 Message-Id: <20220815180347.642909135@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Manikanta Pubbisetty [ Upstream commit 9331f7d3c54a263bede5055e106e40b28d0bd937 ] Currently a couple of debug_mask entries are mapped to the same value, this could enable unintended driver logging. If enabling DP_TX logs was the intention, then this could also enable PCI logs flooding the dmesg buffer or vice versa. Fix this by correctly assigning the debug masks. Found during code review. Tested-on: WCN6750 hw1.0 AHB WLAN.MSL.1.0.1-00887-QCAMSLSWPLZ-1 Fixes: aa2092a9bab3f ("ath11k: add raw mode and software crypto support") Signed-off-by: Manikanta Pubbisetty Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220602115621.15339-1-quic_mpubbise@quicin= c.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/wireless/ath/ath11k/debug.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/debug.h b/drivers/net/wireless= /ath/ath11k/debug.h index 659a275e2eb3..694ebba17fad 100644 --- a/drivers/net/wireless/ath/ath11k/debug.h +++ b/drivers/net/wireless/ath/ath11k/debug.h @@ -23,8 +23,8 @@ enum ath11k_debug_mask { ATH11K_DBG_TESTMODE =3D 0x00000400, ATH11k_DBG_HAL =3D 0x00000800, ATH11K_DBG_PCI =3D 0x00001000, - ATH11K_DBG_DP_TX =3D 0x00001000, - ATH11K_DBG_DP_RX =3D 0x00002000, + ATH11K_DBG_DP_TX =3D 0x00002000, + ATH11K_DBG_DP_RX =3D 0x00004000, ATH11K_DBG_ANY =3D 0xffffffff, }; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78802C00140 for ; Mon, 15 Aug 2022 18:45:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243767AbiHOSp1 (ORCPT ); Mon, 15 Aug 2022 14:45:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244019AbiHOSl7 (ORCPT ); Mon, 15 Aug 2022 14:41: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 39D2B2F01E; Mon, 15 Aug 2022 11:25:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E55F8B81071; Mon, 15 Aug 2022 18:25:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45653C433C1; Mon, 15 Aug 2022 18:25:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587938; bh=sFF/GLrtKkldifMSHkZh0cLIrumrBiRtQIFmzUP1GiI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DC/37QfVO/mu7o7j6bJqlEhzLRbX+W3+WUsQEnSyOmhncPZJuF8HFRPbdM7oZNjB9 50cFm4sUu0IVGgl6IUurJY8plAQ7h0s7Hxd7ocIDgsvzi8yKxu+aHA54d+7K1AOEY3 9ZB+tfzTwrtsuk8KziDxzzhCEUVk8WYLG/Fe1dWs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Kodanev , Alex Deucher , Sasha Levin Subject: [PATCH 5.15 243/779] drm/radeon: fix potential buffer overflow in ni_set_mc_special_registers() Date: Mon, 15 Aug 2022 19:58:07 +0200 Message-Id: <20220815180347.697326143@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexey Kodanev [ Upstream commit 136f614931a2bb73616b292cf542da3a18daefd5 ] The last case label can write two buffers 'mc_reg_address[j]' and 'mc_data[j]' with 'j' offset equal to SMC_NISLANDS_MC_REGISTER_ARRAY_SIZE since there are no checks for this value in both case labels after the last 'j++'. Instead of changing '>' to '>=3D' there, add the bounds check at the start of the second 'case' (the first one already has it). Also, remove redundant last checks for 'j' index bigger than array size. The expression is always false. Moreover, before or after the patch 'table->last' can be equal to SMC_NISLANDS_MC_REGISTER_ARRAY_SIZE and it seems it can be a valid value. Detected using the static analysis tool - Svace. Fixes: 69e0b57a91ad ("drm/radeon/kms: add dpm support for cayman (v5)") Signed-off-by: Alexey Kodanev Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/radeon/ni_dpm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/radeon/ni_dpm.c b/drivers/gpu/drm/radeon/ni_dp= m.c index 769f666335ac..672d2239293e 100644 --- a/drivers/gpu/drm/radeon/ni_dpm.c +++ b/drivers/gpu/drm/radeon/ni_dpm.c @@ -2741,10 +2741,10 @@ static int ni_set_mc_special_registers(struct radeo= n_device *rdev, table->mc_reg_table_entry[k].mc_data[j] |=3D 0x100; } j++; - if (j > SMC_NISLANDS_MC_REGISTER_ARRAY_SIZE) - return -EINVAL; break; case MC_SEQ_RESERVE_M >> 2: + if (j >=3D SMC_NISLANDS_MC_REGISTER_ARRAY_SIZE) + return -EINVAL; temp_reg =3D RREG32(MC_PMG_CMD_MRS1); table->mc_reg_address[j].s1 =3D MC_PMG_CMD_MRS1 >> 2; table->mc_reg_address[j].s0 =3D MC_SEQ_PMG_CMD_MRS1_LP >> 2; @@ -2753,8 +2753,6 @@ static int ni_set_mc_special_registers(struct radeon_= device *rdev, (temp_reg & 0xffff0000) | (table->mc_reg_table_entry[k].mc_data[i] & 0x0000ffff); j++; - if (j > SMC_NISLANDS_MC_REGISTER_ARRAY_SIZE) - return -EINVAL; break; default: break; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6B7D1C25B0E for ; Mon, 15 Aug 2022 18:45:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229732AbiHOSpW (ORCPT ); Mon, 15 Aug 2022 14:45:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244027AbiHOSl7 (ORCPT ); Mon, 15 Aug 2022 14:41:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 257B755BF; Mon, 15 Aug 2022 11:25: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 D4CD0B80F99; Mon, 15 Aug 2022 18:25:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4170CC433C1; Mon, 15 Aug 2022 18:25:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587941; bh=FAdioyiEhZTtTySmbBNz7a6TLgzDkzXLBR8+kMfwe5g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ktTQronPJ9rMptXy0ercI6Q9uw2KN00eyI5Sz+zaSYmS6LLO28o/cKzpuDi+M+E9t jzikWqvUnrMbU9u67+QeGsjWLEivfZ4s7na5xaLY1DmwcaTNtAVwvkSwO56FBajiCE OMuq7jAgLxO4OeB3KffwGTwWMbwTCvmqL2vpRsF8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jitao Shi , Xinlei Lee , Rex-BC Chen , Chun-Kuang Hu , Sasha Levin Subject: [PATCH 5.15 244/779] drm/mediatek: Modify dsi funcs to atomic operations Date: Mon, 15 Aug 2022 19:58:08 +0200 Message-Id: <20220815180347.748224936@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xinlei Lee [ Upstream commit 7f6335c6a258edf4d5ff1b904bc033188dc7b48b ] Because .enable & .disable are deprecated. Use .atomic_enable & .atomic_disable instead. Link: https://patchwork.kernel.org/project/linux-mediatek/patch/1653012007-= 11854-2-git-send-email-xinlei.lee@mediatek.com/ Signed-off-by: Jitao Shi Signed-off-by: Xinlei Lee Reviewed-by: Rex-BC Chen Signed-off-by: Chun-Kuang Hu Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/mediatek/mtk_dsi.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/= mtk_dsi.c index 5d90d2eb0019..cfa354037bb8 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -751,14 +751,16 @@ static void mtk_dsi_bridge_mode_set(struct drm_bridge= *bridge, drm_display_mode_to_videomode(adjusted, &dsi->vm); } =20 -static void mtk_dsi_bridge_disable(struct drm_bridge *bridge) +static void mtk_dsi_bridge_atomic_disable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) { struct mtk_dsi *dsi =3D bridge_to_dsi(bridge); =20 mtk_output_dsi_disable(dsi); } =20 -static void mtk_dsi_bridge_enable(struct drm_bridge *bridge) +static void mtk_dsi_bridge_atomic_enable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) { struct mtk_dsi *dsi =3D bridge_to_dsi(bridge); =20 @@ -767,8 +769,8 @@ static void mtk_dsi_bridge_enable(struct drm_bridge *br= idge) =20 static const struct drm_bridge_funcs mtk_dsi_bridge_funcs =3D { .attach =3D mtk_dsi_bridge_attach, - .disable =3D mtk_dsi_bridge_disable, - .enable =3D mtk_dsi_bridge_enable, + .atomic_disable =3D mtk_dsi_bridge_atomic_disable, + .atomic_enable =3D mtk_dsi_bridge_atomic_enable, .mode_set =3D mtk_dsi_bridge_mode_set, }; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBD85C00140 for ; Mon, 15 Aug 2022 18:45:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243739AbiHOSpT (ORCPT ); Mon, 15 Aug 2022 14:45:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244030AbiHOSmA (ORCPT ); Mon, 15 Aug 2022 14:42:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE4BA2F386; Mon, 15 Aug 2022 11:25: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 469FD60693; Mon, 15 Aug 2022 18:25:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FAF9C433C1; Mon, 15 Aug 2022 18:25:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587944; bh=Z/NltabhsuR4e77xbYHTWIzSHxeANw3DcDZUPjXlfVU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c3IxYaVG6d7HlhoHBQxS3urM4cGyuQyYd7AGeIx9IBal/P6qDv5rI7WxFrQuMf+LJ vYek66IL5DnASpvj7e7lD6NklR4F1cSRuxoLY0RmEPiaze8vPukKEwDd1LVgy43DOy jDPPXFw8w730aAyiUQaeuo9NWU5dk942MX16yGM0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jitao Shi , Xinlei Lee , AngeloGioacchino Del Regno , Rex-BC Chen , Chun-Kuang Hu , Sasha Levin Subject: [PATCH 5.15 245/779] drm/mediatek: Separate poweron/poweroff from enable/disable and define new funcs Date: Mon, 15 Aug 2022 19:58:09 +0200 Message-Id: <20220815180347.793051428@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jitao Shi [ Upstream commit cde7e2e35c2866d22a3a012e72a41052dfcc255d ] In order to match the changes of "Use the drm_panel_bridge API", the poweron/poweroff of dsi is extracted from enable/disable and defined as new funcs (atomic_pre_enable/atomic_post_disable). Since dsi_poweron is moved from dsi_enable to pre_enable function, in order to avoid poweron failure, the operation of dsi register fails to cause bus hang. Therefore, the protection mechanism is added to the dsi_enable function. Fixes: 2dd8075d2185 ("drm/mediatek: mtk_dsi: Use the drm_panel_bridge API") Link: https://patchwork.kernel.org/project/linux-mediatek/patch/1653012007-= 11854-3-git-send-email-xinlei.lee@mediatek.com/ Signed-off-by: Jitao Shi Signed-off-by: Xinlei Lee Reviewed-by: AngeloGioacchino Del Regno Reviewed-by: Rex-BC Chen Signed-off-by: Chun-Kuang Hu Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/mediatek/mtk_dsi.c | 53 +++++++++++++++++++----------- 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/= mtk_dsi.c index cfa354037bb8..c30af7ca5fad 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -679,16 +679,6 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi) if (--dsi->refcount !=3D 0) return; =20 - /* - * mtk_dsi_stop() and mtk_dsi_start() is asymmetric, since - * mtk_dsi_stop() should be called after mtk_drm_crtc_atomic_disable(), - * which needs irq for vblank, and mtk_dsi_stop() will disable irq. - * mtk_dsi_start() needs to be called in mtk_output_dsi_enable(), - * after dsi is fully set. - */ - mtk_dsi_stop(dsi); - - mtk_dsi_switch_to_cmd_mode(dsi, VM_DONE_INT_FLAG, 500); mtk_dsi_reset_engine(dsi); mtk_dsi_lane0_ulp_mode_enter(dsi); mtk_dsi_clk_ulp_mode_enter(dsi); @@ -703,17 +693,9 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi) =20 static void mtk_output_dsi_enable(struct mtk_dsi *dsi) { - int ret; - if (dsi->enabled) return; =20 - ret =3D mtk_dsi_poweron(dsi); - if (ret < 0) { - DRM_ERROR("failed to power on dsi\n"); - return; - } - mtk_dsi_set_mode(dsi); mtk_dsi_clk_hs_mode(dsi, 1); =20 @@ -727,7 +709,16 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi) if (!dsi->enabled) return; =20 - mtk_dsi_poweroff(dsi); + /* + * mtk_dsi_stop() and mtk_dsi_start() is asymmetric, since + * mtk_dsi_stop() should be called after mtk_drm_crtc_atomic_disable(), + * which needs irq for vblank, and mtk_dsi_stop() will disable irq. + * mtk_dsi_start() needs to be called in mtk_output_dsi_enable(), + * after dsi is fully set. + */ + mtk_dsi_stop(dsi); + + mtk_dsi_switch_to_cmd_mode(dsi, VM_DONE_INT_FLAG, 500); =20 dsi->enabled =3D false; } @@ -764,13 +755,37 @@ static void mtk_dsi_bridge_atomic_enable(struct drm_b= ridge *bridge, { struct mtk_dsi *dsi =3D bridge_to_dsi(bridge); =20 + if (dsi->refcount =3D=3D 0) + return; + mtk_output_dsi_enable(dsi); } =20 +static void mtk_dsi_bridge_atomic_pre_enable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) +{ + struct mtk_dsi *dsi =3D bridge_to_dsi(bridge); + int ret; + + ret =3D mtk_dsi_poweron(dsi); + if (ret < 0) + DRM_ERROR("failed to power on dsi\n"); +} + +static void mtk_dsi_bridge_atomic_post_disable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) +{ + struct mtk_dsi *dsi =3D bridge_to_dsi(bridge); + + mtk_dsi_poweroff(dsi); +} + static const struct drm_bridge_funcs mtk_dsi_bridge_funcs =3D { .attach =3D mtk_dsi_bridge_attach, .atomic_disable =3D mtk_dsi_bridge_atomic_disable, .atomic_enable =3D mtk_dsi_bridge_atomic_enable, + .atomic_pre_enable =3D mtk_dsi_bridge_atomic_pre_enable, + .atomic_post_disable =3D mtk_dsi_bridge_atomic_post_disable, .mode_set =3D mtk_dsi_bridge_mode_set, }; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E13C6C2BB45 for ; Mon, 15 Aug 2022 18:51:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233203AbiHOSpf (ORCPT ); Mon, 15 Aug 2022 14:45:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244059AbiHOSmD (ORCPT ); Mon, 15 Aug 2022 14:42: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 30B492ED61; Mon, 15 Aug 2022 11:25: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 E00E6B8107A; Mon, 15 Aug 2022 18:25:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C270C433D6; Mon, 15 Aug 2022 18:25:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587947; bh=vpMq/77TVTXbKQJL3MIASgFymPhjuzR2piBhY6nQYck=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sPRqrN4m1nUrfwOFu0ybOT07zfIwHBcoRRqaK9R0+COn4AjrY9MU8Q78jc9XyX8uE LH41CO5/sYuAj4+MRJgMrZnGSjjgZtsIdv4zG0PmL+15BLAd+Kyl0MRpHBS2EI6H8T RtwuGLfjldRUbPvrQ54CINuTfXWxwCaiM+KKTDXY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jitao Shi , Xinlei Lee , Rex-BC Chen , Chun-Kuang Hu , Sasha Levin Subject: [PATCH 5.15 246/779] drm/mediatek: Add pull-down MIPI operation in mtk_dsi_poweroff function Date: Mon, 15 Aug 2022 19:58:10 +0200 Message-Id: <20220815180347.844606474@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xinlei Lee [ Upstream commit fa5d0a0205c34734c5b8daa77e39ac2817f63a10 ] In the dsi_enable function, mtk_dsi_rxtx_control is to pull up the MIPI signal operation. Before dsi_disable, MIPI should also be pulled down by writing a register instead of disabling dsi. If disable dsi without pulling the mipi signal low, the value of the register will still maintain the setting of the mipi signal being pulled high. After resume, even if the mipi signal is not pulled high, it will still be in the high state. Fixes: 2e54c14e310f ("drm/mediatek: Add DSI sub driver") Link: https://patchwork.kernel.org/project/linux-mediatek/patch/1653012007-= 11854-5-git-send-email-xinlei.lee@mediatek.com/ Signed-off-by: Jitao Shi Signed-off-by: Xinlei Lee Reviewed-by: Rex-BC Chen Signed-off-by: Chun-Kuang Hu Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/mediatek/mtk_dsi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/= mtk_dsi.c index c30af7ca5fad..b0cb0ba53589 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -682,6 +682,8 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi) mtk_dsi_reset_engine(dsi); mtk_dsi_lane0_ulp_mode_enter(dsi); mtk_dsi_clk_ulp_mode_enter(dsi); + /* set the lane number as 0 to pull down mipi */ + writel(0, dsi->regs + DSI_TXRX_CTRL); =20 mtk_dsi_disable(dsi); =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03931C2BB43 for ; Mon, 15 Aug 2022 18:51:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244265AbiHOSq4 (ORCPT ); Mon, 15 Aug 2022 14:46:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244074AbiHOSmF (ORCPT ); Mon, 15 Aug 2022 14:42: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 B6A752F39B; Mon, 15 Aug 2022 11:25: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 5365660693; Mon, 15 Aug 2022 18:25:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5042EC433C1; Mon, 15 Aug 2022 18:25:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587950; bh=7kTuRjWeXotfCma1C7/3Cu45ZAi4uAA33+Sq6BvAK7M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lwdK1Wnb/wmsvLDAR5b5l5iSB9uBCLT7H1kzkNnR6nQtw3hGGG6C9JeHjdKmkyWd3 cr2RstdO+b3nv2nhozi8qFK3I/cuUsePbdIMWRZo8kZcaiT4DmB6lgZb9vcPOs+RNN DkPMDg5WZEa/DLnkB+5iI7DI2C+8ytNQXMiqg6Ag= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Neil Armstrong , Sam Ravnborg , Martin Blumenstingl , Sasha Levin Subject: [PATCH 5.15 247/779] drm/meson: encoder_hdmi: switch to bridge DRM_BRIDGE_ATTACH_NO_CONNECTOR Date: Mon, 15 Aug 2022 19:58:11 +0200 Message-Id: <20220815180347.894058731@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Neil Armstrong [ Upstream commit 0af5e0b41110e2da872030395231ab19c45be931 ] This implements the necessary change to no more use the embedded connector in dw-hdmi and use the dedicated bridge connector driver by passing DRM_BRIDGE_ATTACH_NO_CONNECTOR to the bridge attach call. The necessary connector properties are added to handle the same functionalities as the embedded dw-hdmi connector, i.e. the HDR metadata, the CEC notifier & other flags. The dw-hdmi output_port is set to 1 in order to look for a connector next bridge in order to get DRM_BRIDGE_ATTACH_NO_CONNECTOR working. Signed-off-by: Neil Armstrong Acked-by: Sam Ravnborg Acked-by: Martin Blumenstingl Link: https://patchwork.freedesktop.org/patch/msgid/20211020123947.2585572-= 5-narmstrong@baylibre.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/meson/Kconfig | 2 + drivers/gpu/drm/meson/meson_dw_hdmi.c | 1 + drivers/gpu/drm/meson/meson_encoder_hdmi.c | 81 +++++++++++++++++++++- 3 files changed, 82 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/meson/Kconfig b/drivers/gpu/drm/meson/Kconfig index 9f9281dd49f8..a4e1ed96e5e8 100644 --- a/drivers/gpu/drm/meson/Kconfig +++ b/drivers/gpu/drm/meson/Kconfig @@ -6,9 +6,11 @@ config DRM_MESON select DRM_KMS_HELPER select DRM_KMS_CMA_HELPER select DRM_GEM_CMA_HELPER + select DRM_DISPLAY_CONNECTOR select VIDEOMODE_HELPERS select REGMAP_MMIO select MESON_CANVAS + select CEC_CORE if CEC_NOTIFIER =20 config DRM_MESON_DW_HDMI tristate "HDMI Synopsys Controller support for Amlogic Meson Display" diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/= meson_dw_hdmi.c index fb540a503efe..5cd2b2ebbbd3 100644 --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c @@ -803,6 +803,7 @@ static int meson_dw_hdmi_bind(struct device *dev, struc= t device *master, dw_plat_data->input_bus_encoding =3D V4L2_YCBCR_ENC_709; dw_plat_data->ycbcr_420_allowed =3D true; dw_plat_data->disable_cec =3D true; + dw_plat_data->output_port =3D 1; =20 if (dw_hdmi_is_compatible(meson_dw_hdmi, "amlogic,meson-gxl-dw-hdmi") || dw_hdmi_is_compatible(meson_dw_hdmi, "amlogic,meson-gxm-dw-hdmi") || diff --git a/drivers/gpu/drm/meson/meson_encoder_hdmi.c b/drivers/gpu/drm/m= eson/meson_encoder_hdmi.c index db332fa4cd54..5e306de6f485 100644 --- a/drivers/gpu/drm/meson/meson_encoder_hdmi.c +++ b/drivers/gpu/drm/meson/meson_encoder_hdmi.c @@ -14,8 +14,11 @@ #include #include =20 +#include + #include #include +#include #include #include #include @@ -34,8 +37,10 @@ struct meson_encoder_hdmi { struct drm_encoder encoder; struct drm_bridge bridge; struct drm_bridge *next_bridge; + struct drm_connector *connector; struct meson_drm *priv; unsigned long output_bus_fmt; + struct cec_notifier *cec_notifier; }; =20 #define bridge_to_meson_encoder_hdmi(x) \ @@ -50,6 +55,14 @@ static int meson_encoder_hdmi_attach(struct drm_bridge *= bridge, &encoder_hdmi->bridge, flags); } =20 +static void meson_encoder_hdmi_detach(struct drm_bridge *bridge) +{ + struct meson_encoder_hdmi *encoder_hdmi =3D bridge_to_meson_encoder_hdmi(= bridge); + + cec_notifier_conn_unregister(encoder_hdmi->cec_notifier); + encoder_hdmi->cec_notifier =3D NULL; +} + static void meson_encoder_hdmi_set_vclk(struct meson_encoder_hdmi *encoder= _hdmi, const struct drm_display_mode *mode) { @@ -298,9 +311,30 @@ static int meson_encoder_hdmi_atomic_check(struct drm_= bridge *bridge, return 0; } =20 +static void meson_encoder_hdmi_hpd_notify(struct drm_bridge *bridge, + enum drm_connector_status status) +{ + struct meson_encoder_hdmi *encoder_hdmi =3D bridge_to_meson_encoder_hdmi(= bridge); + struct edid *edid; + + if (!encoder_hdmi->cec_notifier) + return; + + if (status =3D=3D connector_status_connected) { + edid =3D drm_bridge_get_edid(encoder_hdmi->next_bridge, encoder_hdmi->co= nnector); + if (!edid) + return; + + cec_notifier_set_phys_addr_from_edid(encoder_hdmi->cec_notifier, edid); + } else + cec_notifier_phys_addr_invalidate(encoder_hdmi->cec_notifier); +} + static const struct drm_bridge_funcs meson_encoder_hdmi_bridge_funcs =3D { .attach =3D meson_encoder_hdmi_attach, + .detach =3D meson_encoder_hdmi_detach, .mode_valid =3D meson_encoder_hdmi_mode_valid, + .hpd_notify =3D meson_encoder_hdmi_hpd_notify, .atomic_enable =3D meson_encoder_hdmi_atomic_enable, .atomic_disable =3D meson_encoder_hdmi_atomic_disable, .atomic_get_input_bus_fmts =3D meson_encoder_hdmi_get_inp_bus_fmts, @@ -313,6 +347,7 @@ static const struct drm_bridge_funcs meson_encoder_hdmi= _bridge_funcs =3D { int meson_encoder_hdmi_init(struct meson_drm *priv) { struct meson_encoder_hdmi *meson_encoder_hdmi; + struct platform_device *pdev; struct device_node *remote; int ret; =20 @@ -337,6 +372,7 @@ int meson_encoder_hdmi_init(struct meson_drm *priv) meson_encoder_hdmi->bridge.funcs =3D &meson_encoder_hdmi_bridge_funcs; meson_encoder_hdmi->bridge.of_node =3D priv->dev->of_node; meson_encoder_hdmi->bridge.type =3D DRM_MODE_CONNECTOR_HDMIA; + meson_encoder_hdmi->bridge.interlace_allowed =3D true; =20 drm_bridge_add(&meson_encoder_hdmi->bridge); =20 @@ -353,17 +389,58 @@ int meson_encoder_hdmi_init(struct meson_drm *priv) meson_encoder_hdmi->encoder.possible_crtcs =3D BIT(0); =20 /* Attach HDMI Encoder Bridge to Encoder */ - ret =3D drm_bridge_attach(&meson_encoder_hdmi->encoder, &meson_encoder_hd= mi->bridge, NULL, 0); + ret =3D drm_bridge_attach(&meson_encoder_hdmi->encoder, &meson_encoder_hd= mi->bridge, NULL, + DRM_BRIDGE_ATTACH_NO_CONNECTOR); if (ret) { dev_err(priv->dev, "Failed to attach bridge: %d\n", ret); return ret; } =20 + /* Initialize & attach Bridge Connector */ + meson_encoder_hdmi->connector =3D drm_bridge_connector_init(priv->drm, + &meson_encoder_hdmi->encoder); + if (IS_ERR(meson_encoder_hdmi->connector)) { + dev_err(priv->dev, "Unable to create HDMI bridge connector\n"); + return PTR_ERR(meson_encoder_hdmi->connector); + } + drm_connector_attach_encoder(meson_encoder_hdmi->connector, + &meson_encoder_hdmi->encoder); + /* * We should have now in place: - * encoder->[hdmi encoder bridge]->[dw-hdmi bridge]->[dw-hdmi connector] + * encoder->[hdmi encoder bridge]->[dw-hdmi bridge]->[display connector b= ridge]->[display connector] */ =20 + /* + * drm_connector_attach_max_bpc_property() requires the + * connector to have a state. + */ + drm_atomic_helper_connector_reset(meson_encoder_hdmi->connector); + + if (meson_vpu_is_compatible(priv, VPU_COMPATIBLE_GXL) || + meson_vpu_is_compatible(priv, VPU_COMPATIBLE_GXM) || + meson_vpu_is_compatible(priv, VPU_COMPATIBLE_G12A)) + drm_connector_attach_hdr_output_metadata_property(meson_encoder_hdmi->co= nnector); + + drm_connector_attach_max_bpc_property(meson_encoder_hdmi->connector, 8, 8= ); + + /* Handle this here until handled by drm_bridge_connector_init() */ + meson_encoder_hdmi->connector->ycbcr_420_allowed =3D true; + + pdev =3D of_find_device_by_node(remote); + if (pdev) { + struct cec_connector_info conn_info; + struct cec_notifier *notifier; + + cec_fill_conn_info_from_drm(&conn_info, meson_encoder_hdmi->connector); + + notifier =3D cec_notifier_conn_register(&pdev->dev, NULL, &conn_info); + if (!notifier) + return -ENOMEM; + + meson_encoder_hdmi->cec_notifier =3D notifier; + } + dev_dbg(priv->dev, "HDMI encoder initialized\n"); =20 return 0; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84F76C25B0E for ; Mon, 15 Aug 2022 18:47:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244285AbiHOSrB (ORCPT ); Mon, 15 Aug 2022 14:47:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244095AbiHOSmI (ORCPT ); Mon, 15 Aug 2022 14:42:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64C072F3B8; Mon, 15 Aug 2022 11:25: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 0277EB80F99; Mon, 15 Aug 2022 18:25:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B5BDC433D6; Mon, 15 Aug 2022 18:25:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587953; bh=jVXleNbYzX0yrVfrIObxlmms/7Qv6oFGmQoqOUB/KoA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gORTQe58n3/uS5Fc6dtwxZGBlvDceqAXlbF/FQN3OUTsYRGDQp7psFoRJJpbJE8Mn 4gCnf/ibVYHst8mGeDgtlZn/F5Xt5mg0l6RE0Z/dsn43Ugb2rb6PJXKgKKNPkOyAA/ 2OlKXmt6xNJc3FZtbacelkUbOB2Y47KF0294iJd8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Martin Blumenstingl , Neil Armstrong , Sasha Levin Subject: [PATCH 5.15 248/779] drm/meson: encoder_hdmi: Fix refcount leak in meson_encoder_hdmi_init Date: Mon, 15 Aug 2022 19:58:12 +0200 Message-Id: <20220815180347.937220300@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit d82a5a4aae9d0203234737caed1bf470aa317568 ] of_graph_get_remote_node() returns remote device nodepointer with refcount incremented, we should use of_node_put() on it when done. Add missing of_node_put() to avoid refcount leak. Fixes: e67f6037ae1b ("drm/meson: split out encoder from meson_dw_hdmi") Signed-off-by: Miaoqian Lin Reviewed-by: Martin Blumenstingl Signed-off-by: Neil Armstrong Link: https://patchwork.freedesktop.org/patch/msgid/20220601033927.47814-3-= linmq006@gmail.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/meson/meson_encoder_hdmi.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/meson/meson_encoder_hdmi.c b/drivers/gpu/drm/m= eson/meson_encoder_hdmi.c index 5e306de6f485..0d532e8e8cca 100644 --- a/drivers/gpu/drm/meson/meson_encoder_hdmi.c +++ b/drivers/gpu/drm/meson/meson_encoder_hdmi.c @@ -365,7 +365,8 @@ int meson_encoder_hdmi_init(struct meson_drm *priv) meson_encoder_hdmi->next_bridge =3D of_drm_find_bridge(remote); if (!meson_encoder_hdmi->next_bridge) { dev_err(priv->dev, "Failed to find HDMI transceiver bridge\n"); - return -EPROBE_DEFER; + ret =3D -EPROBE_DEFER; + goto err_put_node; } =20 /* HDMI Encoder Bridge */ @@ -383,7 +384,7 @@ int meson_encoder_hdmi_init(struct meson_drm *priv) DRM_MODE_ENCODER_TMDS); if (ret) { dev_err(priv->dev, "Failed to init HDMI encoder: %d\n", ret); - return ret; + goto err_put_node; } =20 meson_encoder_hdmi->encoder.possible_crtcs =3D BIT(0); @@ -393,7 +394,7 @@ int meson_encoder_hdmi_init(struct meson_drm *priv) DRM_BRIDGE_ATTACH_NO_CONNECTOR); if (ret) { dev_err(priv->dev, "Failed to attach bridge: %d\n", ret); - return ret; + goto err_put_node; } =20 /* Initialize & attach Bridge Connector */ @@ -401,7 +402,8 @@ int meson_encoder_hdmi_init(struct meson_drm *priv) &meson_encoder_hdmi->encoder); if (IS_ERR(meson_encoder_hdmi->connector)) { dev_err(priv->dev, "Unable to create HDMI bridge connector\n"); - return PTR_ERR(meson_encoder_hdmi->connector); + ret =3D PTR_ERR(meson_encoder_hdmi->connector); + goto err_put_node; } drm_connector_attach_encoder(meson_encoder_hdmi->connector, &meson_encoder_hdmi->encoder); @@ -428,6 +430,7 @@ int meson_encoder_hdmi_init(struct meson_drm *priv) meson_encoder_hdmi->connector->ycbcr_420_allowed =3D true; =20 pdev =3D of_find_device_by_node(remote); + of_node_put(remote); if (pdev) { struct cec_connector_info conn_info; struct cec_notifier *notifier; @@ -444,4 +447,8 @@ int meson_encoder_hdmi_init(struct meson_drm *priv) dev_dbg(priv->dev, "HDMI encoder initialized\n"); =20 return 0; + +err_put_node: + of_node_put(remote); + return ret; } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30E28C2BB43 for ; Mon, 15 Aug 2022 18:47:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243522AbiHOSrG (ORCPT ); Mon, 15 Aug 2022 14:47:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244104AbiHOSmJ (ORCPT ); Mon, 15 Aug 2022 14:42:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 872D42F3BD; Mon, 15 Aug 2022 11:25: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 32480B81071; Mon, 15 Aug 2022 18:25:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 635A9C433D6; Mon, 15 Aug 2022 18:25:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587956; bh=Z8QdnvFIXKN5jemo17wpQnROqTwiw5XqL1IzUTYZcv0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=smrvQfbcCngFEN8JdM0cj6iF/AxwH9QGpbBCga9pUZX7SYOob6f07BhFl5enmkwyp j7tHUO57tycr96fmIgBNfa3U8YIKcUskOOFpumLCSWxGQtmHTNlT7ade0lbJYk0+PV tC/GIHvoZUQpIw8hzl2TxGCDNGq+4s7zQ2QHpKug= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bjorn Andersson , Neil Armstrong , Robert Foss , Sasha Levin Subject: [PATCH 5.15 249/779] drm/bridge: lt9611uxc: Cancel only drivers work Date: Mon, 15 Aug 2022 19:58:13 +0200 Message-Id: <20220815180347.989861665@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bjorn Andersson [ Upstream commit dfa687bffc8a4a21ed929c7dececf01b8f1f52ee ] During device remove care needs to be taken that no work is pending before it removes the underlying DRM bridge etc, but this can be done on the specific work rather than waiting for the flush of the system-wide workqueue. Fixes: bc6fa8676ebb ("drm/bridge/lontium-lt9611uxc: move HPD notification o= ut of IRQ handler") Signed-off-by: Bjorn Andersson Reviewed-by: Neil Armstrong Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220601233818.1877963-= 1-bjorn.andersson@linaro.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/bridge/lontium-lt9611uxc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c b/drivers/gpu/drm/b= ridge/lontium-lt9611uxc.c index 010657ea7af7..c4454d0f6cad 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611uxc.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611uxc.c @@ -997,7 +997,7 @@ static int lt9611uxc_remove(struct i2c_client *client) struct lt9611uxc *lt9611uxc =3D i2c_get_clientdata(client); =20 disable_irq(client->irq); - flush_scheduled_work(); + cancel_work_sync(<9611uxc->work); lt9611uxc_audio_exit(lt9611uxc); drm_bridge_remove(<9611uxc->bridge); =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A036C25B0E for ; Mon, 15 Aug 2022 18:47:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243579AbiHOSrK (ORCPT ); Mon, 15 Aug 2022 14:47:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244108AbiHOSmJ (ORCPT ); Mon, 15 Aug 2022 14:42:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A69B329CA7; Mon, 15 Aug 2022 11:26:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 42B8560FC4; Mon, 15 Aug 2022 18:26:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F480C433D6; Mon, 15 Aug 2022 18:25:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587959; bh=mnrYvGynoNV2T6sVFeiXHQmy/DOrDpdMQcPlEzeqDwM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sG54BncoFFrgPSuo8atlru8uIf4/va9Mu/Ak7pwUxUwJjhwdbKBVmcyI6ewqEPkxe zYb37liXZbGmL7i69LaN2TQFs0a+qklrrfIw+JAewLS4djkSDzjGem3IQagOyRxepC iefMsdGJ8bt5r+xes6LITG0y3jOwaKShsIuDjfEE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tali Perry , Tyrone Ting , Andy Shevchenko , Wolfram Sang , Sasha Levin Subject: [PATCH 5.15 250/779] i2c: npcm: Remove own slave addresses 2:10 Date: Mon, 15 Aug 2022 19:58:14 +0200 Message-Id: <20220815180348.024693735@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tali Perry [ Upstream commit 47d506d1a28fd10a9fb1f33df5622d88fae72095 ] NPCM can support up to 10 own slave addresses. In practice, only one address is actually being used. In order to access addresses 2 and above, need to switch register banks. The switch needs spinlock. To avoid using spinlock for this useless feature removed support of SA >=3D 2. Also fix returned slave event enum. Remove some comment since the bank selection is not required. The bank selection is not required since the supported slave addresses are reduced. Fixes: 56a1485b102e ("i2c: npcm7xx: Add Nuvoton NPCM I2C controller driver") Signed-off-by: Tali Perry Signed-off-by: Tyrone Ting Reviewed-by: Andy Shevchenko Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/i2c/busses/i2c-npcm7xx.c | 41 +++++++++++++------------------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm= 7xx.c index d9ac62c1ac25..ab31e7fb4cc9 100644 --- a/drivers/i2c/busses/i2c-npcm7xx.c +++ b/drivers/i2c/busses/i2c-npcm7xx.c @@ -123,11 +123,11 @@ enum i2c_addr { * Since the addr regs are sprinkled all over the address space, * use this array to get the address or each register. */ -#define I2C_NUM_OWN_ADDR 10 +#define I2C_NUM_OWN_ADDR 2 +#define I2C_NUM_OWN_ADDR_SUPPORTED 2 + static const int npcm_i2caddr[I2C_NUM_OWN_ADDR] =3D { - NPCM_I2CADDR1, NPCM_I2CADDR2, NPCM_I2CADDR3, NPCM_I2CADDR4, - NPCM_I2CADDR5, NPCM_I2CADDR6, NPCM_I2CADDR7, NPCM_I2CADDR8, - NPCM_I2CADDR9, NPCM_I2CADDR10, + NPCM_I2CADDR1, NPCM_I2CADDR2, }; #endif =20 @@ -391,14 +391,10 @@ static void npcm_i2c_disable(struct npcm_i2c *bus) #if IS_ENABLED(CONFIG_I2C_SLAVE) int i; =20 - /* select bank 0 for I2C addresses */ - npcm_i2c_select_bank(bus, I2C_BANK_0); - /* Slave addresses removal */ - for (i =3D I2C_SLAVE_ADDR1; i < I2C_NUM_OWN_ADDR; i++) + for (i =3D I2C_SLAVE_ADDR1; i < I2C_NUM_OWN_ADDR_SUPPORTED; i++) iowrite8(0, bus->reg + npcm_i2caddr[i]); =20 - npcm_i2c_select_bank(bus, I2C_BANK_1); #endif /* Disable module */ i2cctl2 =3D ioread8(bus->reg + NPCM_I2CCTL2); @@ -603,8 +599,7 @@ static int npcm_i2c_slave_enable(struct npcm_i2c *bus, = enum i2c_addr addr_type, i2cctl1 &=3D ~NPCM_I2CCTL1_GCMEN; iowrite8(i2cctl1, bus->reg + NPCM_I2CCTL1); return 0; - } - if (addr_type =3D=3D I2C_ARP_ADDR) { + } else if (addr_type =3D=3D I2C_ARP_ADDR) { i2cctl3 =3D ioread8(bus->reg + NPCM_I2CCTL3); if (enable) i2cctl3 |=3D I2CCTL3_ARPMEN; @@ -613,16 +608,16 @@ static int npcm_i2c_slave_enable(struct npcm_i2c *bus= , enum i2c_addr addr_type, iowrite8(i2cctl3, bus->reg + NPCM_I2CCTL3); return 0; } + if (addr_type > I2C_SLAVE_ADDR2 && addr_type <=3D I2C_SLAVE_ADDR10) + dev_err(bus->dev, "try to enable more than 2 SA not supported\n"); + if (addr_type >=3D I2C_ARP_ADDR) return -EFAULT; - /* select bank 0 for address 3 to 10 */ - if (addr_type > I2C_SLAVE_ADDR2) - npcm_i2c_select_bank(bus, I2C_BANK_0); + /* Set and enable the address */ iowrite8(sa_reg, bus->reg + npcm_i2caddr[addr_type]); npcm_i2c_slave_int_enable(bus, enable); - if (addr_type > I2C_SLAVE_ADDR2) - npcm_i2c_select_bank(bus, I2C_BANK_1); + return 0; } #endif @@ -843,15 +838,11 @@ static u8 npcm_i2c_get_slave_addr(struct npcm_i2c *bu= s, enum i2c_addr addr_type) { u8 slave_add; =20 - /* select bank 0 for address 3 to 10 */ - if (addr_type > I2C_SLAVE_ADDR2) - npcm_i2c_select_bank(bus, I2C_BANK_0); + if (addr_type > I2C_SLAVE_ADDR2 && addr_type <=3D I2C_SLAVE_ADDR10) + dev_err(bus->dev, "get slave: try to use more than 2 SA not supported\n"= ); =20 slave_add =3D ioread8(bus->reg + npcm_i2caddr[(int)addr_type]); =20 - if (addr_type > I2C_SLAVE_ADDR2) - npcm_i2c_select_bank(bus, I2C_BANK_1); - return slave_add; } =20 @@ -861,12 +852,12 @@ static int npcm_i2c_remove_slave_addr(struct npcm_i2c= *bus, u8 slave_add) =20 /* Set the enable bit */ slave_add |=3D 0x80; - npcm_i2c_select_bank(bus, I2C_BANK_0); - for (i =3D I2C_SLAVE_ADDR1; i < I2C_NUM_OWN_ADDR; i++) { + + for (i =3D I2C_SLAVE_ADDR1; i < I2C_NUM_OWN_ADDR_SUPPORTED; i++) { if (ioread8(bus->reg + npcm_i2caddr[i]) =3D=3D slave_add) iowrite8(0, bus->reg + npcm_i2caddr[i]); } - npcm_i2c_select_bank(bus, I2C_BANK_1); + return 0; } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C93F7C00140 for ; Mon, 15 Aug 2022 18:47:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243837AbiHOSrV (ORCPT ); Mon, 15 Aug 2022 14:47:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244144AbiHOSmP (ORCPT ); Mon, 15 Aug 2022 14:42: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 2793C2B61D; Mon, 15 Aug 2022 11:26: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 BCA92B80F99; Mon, 15 Aug 2022 18:26:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E4B5C433C1; Mon, 15 Aug 2022 18:26:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587965; bh=adh1CfaAQMrvtv+mKh3OYoijuXPEkwULKQoz71MtB0k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sMSmSp6q/G5Y3pTGSvZnY82p1k1/GKyeBYIVXdPEm1itkj2Gk9H5cKJk9FJyNB1JJ JFShhdxZBVKoFmTeHXEk0AyM8+/1ZZeW1hToUR60n8D1g6fBQde7pAnHLW56+j9nQM LEKSd1aaClfZTjU+sREEwHmikDM7KJuhEj4DD0DI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tali Perry , Tyrone Ting , Andy Shevchenko , Wolfram Sang , Sasha Levin Subject: [PATCH 5.15 251/779] i2c: npcm: Correct slave role behavior Date: Mon, 15 Aug 2022 19:58:15 +0200 Message-Id: <20220815180348.061466377@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tali Perry [ Upstream commit d7aa1b149b8fc04d802879cf4662010aa4a42deb ] Correct the slave transaction logic to be compatible with the generic slave backend driver. Fixes: 56a1485b102e ("i2c: npcm7xx: Add Nuvoton NPCM I2C controller driver") Signed-off-by: Tali Perry Signed-off-by: Tyrone Ting Reviewed-by: Andy Shevchenko Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/i2c/busses/i2c-npcm7xx.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm= 7xx.c index ab31e7fb4cc9..31e3d2c9d6bc 100644 --- a/drivers/i2c/busses/i2c-npcm7xx.c +++ b/drivers/i2c/busses/i2c-npcm7xx.c @@ -912,11 +912,15 @@ static int npcm_i2c_slave_get_wr_buf(struct npcm_i2c = *bus) for (i =3D 0; i < I2C_HW_FIFO_SIZE; i++) { if (bus->slv_wr_size >=3D I2C_HW_FIFO_SIZE) break; - i2c_slave_event(bus->slave, I2C_SLAVE_READ_REQUESTED, &value); + if (bus->state =3D=3D I2C_SLAVE_MATCH) { + i2c_slave_event(bus->slave, I2C_SLAVE_READ_REQUESTED, &value); + bus->state =3D I2C_OPER_STARTED; + } else { + i2c_slave_event(bus->slave, I2C_SLAVE_READ_PROCESSED, &value); + } ind =3D (bus->slv_wr_ind + bus->slv_wr_size) % I2C_HW_FIFO_SIZE; bus->slv_wr_buf[ind] =3D value; bus->slv_wr_size++; - i2c_slave_event(bus->slave, I2C_SLAVE_READ_PROCESSED, &value); } return I2C_HW_FIFO_SIZE - ret; } @@ -964,7 +968,6 @@ static void npcm_i2c_slave_xmit(struct npcm_i2c *bus, u= 16 nwrite, if (nwrite =3D=3D 0) return; =20 - bus->state =3D I2C_OPER_STARTED; bus->operation =3D I2C_WRITE_OPER; =20 /* get the next buffer */ --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 072F0C00140 for ; Mon, 15 Aug 2022 18:47:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243851AbiHOSra (ORCPT ); Mon, 15 Aug 2022 14:47:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244162AbiHOSmR (ORCPT ); Mon, 15 Aug 2022 14:42:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11C252F653; Mon, 15 Aug 2022 11:26: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 BC8D4B8106C; Mon, 15 Aug 2022 18:26:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27558C433C1; Mon, 15 Aug 2022 18:26:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587968; bh=7R7XRJk9VX5l9JuQ7DA+8HY+77GdZP4j+qwtfoEEtrE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nPhPLQtxkdLLxtGFUaWPbk++zcoWDO5MnOKWUOvDokW4FmFuH+cf9a+Em1x4qbIv5 rFkttIWQ69UgF65s4aDY0OhxSaxX3Xv0JDrat6oqv6ydWa7uti4ntROrUG/GWVMhpX wyQI2/r6IcOm11clyveVUyVH2TTJdeXHOKn9D20o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Fabio Estevam , Wolfram Sang , Sasha Levin Subject: [PATCH 5.15 252/779] i2c: mxs: Silence a clang warning Date: Mon, 15 Aug 2022 19:58:16 +0200 Message-Id: <20220815180348.099412806@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 3d43273d7d1e1a5374d531e901d3c537b4c97bbf ] Change the of_device_get_match_data() cast to (uintptr_t) to silence the following clang warning: drivers/i2c/busses/i2c-mxs.c:802:18: warning: cast to smaller integer type = 'enum mxs_i2c_devtype' from 'const void *' [-Wvoid-pointer-to-enum-cast] Reported-by: kernel test robot Fixes: c32abd8b5691 ("i2c: mxs: Remove unneeded platform_device_id") Signed-off-by: Fabio Estevam Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/i2c/busses/i2c-mxs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c index 864a3f1bd4e1..68f67d084c63 100644 --- a/drivers/i2c/busses/i2c-mxs.c +++ b/drivers/i2c/busses/i2c-mxs.c @@ -799,7 +799,7 @@ static int mxs_i2c_probe(struct platform_device *pdev) if (!i2c) return -ENOMEM; =20 - i2c->dev_type =3D (enum mxs_i2c_devtype)of_device_get_match_data(&pdev->d= ev); + i2c->dev_type =3D (uintptr_t)of_device_get_match_data(&pdev->dev); =20 i2c->regs =3D devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(i2c->regs)) --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCFB4C00140 for ; Mon, 15 Aug 2022 18:47:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243869AbiHOSrd (ORCPT ); Mon, 15 Aug 2022 14:47:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232958AbiHOSmS (ORCPT ); Mon, 15 Aug 2022 14:42:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1824B2F3AF; Mon, 15 Aug 2022 11:26: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 C6304B8106C; Mon, 15 Aug 2022 18:26:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C4E1C433D6; Mon, 15 Aug 2022 18:26:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587971; bh=zYhBqrRVQv4M1lLZWwjM0jKDb57E/fRn1jxdc7X1x5I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LO7jFiEWZdLNuaIpcQGp9AxVFm1dATMr+dec9t8C611xscKRdFm4GFEdjv8IHEduA VLrjKdIq/y7v+cGZ0u0Su7qT2ixeKc5PPM1qgwJrib8nXN6Z8AillcjVBqUD1Wto+a HNRVo7pE8JdTDy10fGz9hbBED5+AtBdaiqrX/IcM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiaomeng Tong , Chia-I Wu , Gerd Hoffmann , Sasha Levin Subject: [PATCH 5.15 253/779] virtio-gpu: fix a missing check to avoid NULL dereference Date: Mon, 15 Aug 2022 19:58:17 +0200 Message-Id: <20220815180348.147837223@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xiaomeng Tong [ Upstream commit bd63f11f4c3c46afec07d821f74736161ff6e526 ] 'cache_ent' could be set NULL inside virtio_gpu_cmd_get_capset() and it will lead to a NULL dereference by a lately use of it (i.e., ptr =3D cache_ent->caps_cache). Fix it with a NULL check. Fixes: 62fb7a5e10962 ("virtio-gpu: add 3d/virgl support") Signed-off-by: Xiaomeng Tong Reviewed-by: Chia-I Wu Link: http://patchwork.freedesktop.org/patch/msgid/20220327050945.1614-1-xi= am0nd.tong@gmail.com [ kraxel: minor codestyle fixup ] Signed-off-by: Gerd Hoffmann Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/virtio/virtgpu_ioctl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_ioctl.c b/drivers/gpu/drm/virti= o/virtgpu_ioctl.c index 5c1ad1596889..15c3e63db396 100644 --- a/drivers/gpu/drm/virtio/virtgpu_ioctl.c +++ b/drivers/gpu/drm/virtio/virtgpu_ioctl.c @@ -512,8 +512,10 @@ static int virtio_gpu_get_caps_ioctl(struct drm_device= *dev, spin_unlock(&vgdev->display_info_lock); =20 /* not in cache - need to talk to hw */ - virtio_gpu_cmd_get_capset(vgdev, found_valid, args->cap_set_ver, - &cache_ent); + ret =3D virtio_gpu_cmd_get_capset(vgdev, found_valid, args->cap_set_ver, + &cache_ent); + if (ret) + return ret; virtio_gpu_notify(vgdev); =20 copy_exit: --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FCF3C00140 for ; Mon, 15 Aug 2022 18:47:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243875AbiHOSrj (ORCPT ); Mon, 15 Aug 2022 14:47:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231310AbiHOSmS (ORCPT ); Mon, 15 Aug 2022 14:42: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 E0C462AC6E; Mon, 15 Aug 2022 11:26: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 6403560F23; Mon, 15 Aug 2022 18:26:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4EFFDC433D7; Mon, 15 Aug 2022 18:26:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587974; bh=HCDTP6YCyVvWZ0zXAbXHOSnCidLQo2cVAidr/dDN0dg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1ALCVUzH2oBn9izkjXO2emnzIAw9+WLvYfwMMsXcTYGoVYzLS4QzLIX4nPPIp5Nnf 1r4RV4ba4ydMuY99YwTKNsjdk8wsfhML7ff5ze4hMz/7TjE12XKyq0D2ObivHu0NVN SG7tlVXEGDe/WAfJns4n09pnf7nZXmcybKQSSsBs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Zimmermann , Daniel Vetter , Sasha Levin Subject: [PATCH 5.15 254/779] drm/shmem-helper: Unexport drm_gem_shmem_create_with_handle() Date: Mon, 15 Aug 2022 19:58:18 +0200 Message-Id: <20220815180348.189902912@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Thomas Zimmermann [ Upstream commit 5a363c20673308e968b6640deb73d7bf77e8b463 ] Turn drm_gem_shmem_create_with_handle() into an internal helper function. It's not used outside of the compilation unit. Signed-off-by: Thomas Zimmermann Acked-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20211108093149.7226-2-t= zimmermann@suse.de Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/drm_gem_shmem_helper.c | 3 +-- include/drm/drm_gem_shmem_helper.h | 5 ----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_g= em_shmem_helper.c index 3eb580d76559..15e53674ed54 100644 --- a/drivers/gpu/drm/drm_gem_shmem_helper.c +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c @@ -391,7 +391,7 @@ void drm_gem_shmem_vunmap(struct drm_gem_object *obj, s= truct dma_buf_map *map) } EXPORT_SYMBOL(drm_gem_shmem_vunmap); =20 -struct drm_gem_shmem_object * +static struct drm_gem_shmem_object * drm_gem_shmem_create_with_handle(struct drm_file *file_priv, struct drm_device *dev, size_t size, uint32_t *handle) @@ -415,7 +415,6 @@ drm_gem_shmem_create_with_handle(struct drm_file *file_= priv, =20 return shmem; } -EXPORT_SYMBOL(drm_gem_shmem_create_with_handle); =20 /* Update madvise status, returns true if not purged, else * false or -errno. diff --git a/include/drm/drm_gem_shmem_helper.h b/include/drm/drm_gem_shmem= _helper.h index 434328d8a0d9..6b47eb7d9f76 100644 --- a/include/drm/drm_gem_shmem_helper.h +++ b/include/drm/drm_gem_shmem_helper.h @@ -128,11 +128,6 @@ static inline bool drm_gem_shmem_is_purgeable(struct d= rm_gem_shmem_object *shmem void drm_gem_shmem_purge_locked(struct drm_gem_object *obj); bool drm_gem_shmem_purge(struct drm_gem_object *obj); =20 -struct drm_gem_shmem_object * -drm_gem_shmem_create_with_handle(struct drm_file *file_priv, - struct drm_device *dev, size_t size, - uint32_t *handle); - int drm_gem_shmem_dumb_create(struct drm_file *file, struct drm_device *de= v, struct drm_mode_create_dumb *args); =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28890C00140 for ; Mon, 15 Aug 2022 18:52:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244105AbiHOSwg (ORCPT ); Mon, 15 Aug 2022 14:52:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233730AbiHOSrC (ORCPT ); Mon, 15 Aug 2022 14:47:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96AAF41D2C; Mon, 15 Aug 2022 11:28: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 EF84A61032; Mon, 15 Aug 2022 18:28:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1660C433C1; Mon, 15 Aug 2022 18:28:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588105; bh=FtRX3OJhVJqVloDCno8Lu3KgaykPiRF3SJcKLdU3mqc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e5iOl9tNHk7rzMOE25GTnJGk5K/QpfVZH5eVsSa5sh9rhovgtCAw9h91onw3E2jUr xDs60VaMfeQbC4kP51yOTeO+BeUbc/hgXXO9Q6qP8egvCDiIyqIgE0w7JrlXdogcBM Ku9YMfn65IKaj3MaKND+nWHkj+A+3sGtzVKoPE5o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Zimmermann , Daniel Vetter , Sasha Levin Subject: [PATCH 5.15 255/779] drm/shmem-helper: Export dedicated wrappers for GEM object functions Date: Mon, 15 Aug 2022 19:58:19 +0200 Message-Id: <20220815180348.237248530@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Thomas Zimmermann [ Upstream commit c7fbcb7149ff9321bbbcc93c9920de534ea8102c ] Wrap GEM SHMEM functions for struct drm_gem_object_funcs and update all callers. This will allow for an update of the public interfaces of the GEM SHMEM helper library. v2: * fix docs for drm_gem_shmem_object_print_info() Signed-off-by: Thomas Zimmermann Acked-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20211108093149.7226-3-t= zimmermann@suse.de Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/drm_gem_shmem_helper.c | 45 ++++----- drivers/gpu/drm/lima/lima_gem.c | 8 +- drivers/gpu/drm/panfrost/panfrost_gem.c | 12 +-- drivers/gpu/drm/v3d/v3d_bo.c | 14 +-- drivers/gpu/drm/virtio/virtgpu_object.c | 15 ++- include/drm/drm_gem_shmem_helper.h | 120 ++++++++++++++++++++++++ 6 files changed, 161 insertions(+), 53 deletions(-) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_g= em_shmem_helper.c index 15e53674ed54..05a924e29133 100644 --- a/drivers/gpu/drm/drm_gem_shmem_helper.c +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c @@ -25,14 +25,14 @@ */ =20 static const struct drm_gem_object_funcs drm_gem_shmem_funcs =3D { - .free =3D drm_gem_shmem_free_object, - .print_info =3D drm_gem_shmem_print_info, - .pin =3D drm_gem_shmem_pin, - .unpin =3D drm_gem_shmem_unpin, - .get_sg_table =3D drm_gem_shmem_get_sg_table, - .vmap =3D drm_gem_shmem_vmap, - .vunmap =3D drm_gem_shmem_vunmap, - .mmap =3D drm_gem_shmem_mmap, + .free =3D drm_gem_shmem_object_free, + .print_info =3D drm_gem_shmem_object_print_info, + .pin =3D drm_gem_shmem_object_pin, + .unpin =3D drm_gem_shmem_object_unpin, + .get_sg_table =3D drm_gem_shmem_object_get_sg_table, + .vmap =3D drm_gem_shmem_object_vmap, + .vunmap =3D drm_gem_shmem_object_vunmap, + .mmap =3D drm_gem_shmem_object_mmap, }; =20 static struct drm_gem_shmem_object * @@ -116,8 +116,7 @@ EXPORT_SYMBOL_GPL(drm_gem_shmem_create); * @obj: GEM object to free * * This function cleans up the GEM object state and frees the memory used = to - * store the object itself. It should be used to implement - * &drm_gem_object_funcs.free. + * store the object itself. */ void drm_gem_shmem_free_object(struct drm_gem_object *obj) { @@ -228,8 +227,7 @@ EXPORT_SYMBOL(drm_gem_shmem_put_pages); * @obj: GEM object * * This function makes sure the backing pages are pinned in memory while t= he - * buffer is exported. It should only be used to implement - * &drm_gem_object_funcs.pin. + * buffer is exported. * * Returns: * 0 on success or a negative error code on failure. @@ -249,7 +247,7 @@ EXPORT_SYMBOL(drm_gem_shmem_pin); * @obj: GEM object * * This function removes the requirement that the backing pages are pinned= in - * memory. It should only be used to implement &drm_gem_object_funcs.unpin. + * memory. */ void drm_gem_shmem_unpin(struct drm_gem_object *obj) { @@ -321,11 +319,8 @@ static int drm_gem_shmem_vmap_locked(struct drm_gem_sh= mem_object *shmem, struct * store. * * This function makes sure that a contiguous kernel virtual address mappi= ng - * exists for the buffer backing the shmem GEM object. - * - * This function can be used to implement &drm_gem_object_funcs.vmap. But = it can - * also be called by drivers directly, in which case it will hide the - * differences between dma-buf imported and natively allocated objects. + * exists for the buffer backing the shmem GEM object. It hides the differ= ences + * between dma-buf imported and natively allocated objects. * * Acquired mappings should be cleaned up by calling drm_gem_shmem_vunmap(= ). * @@ -377,9 +372,8 @@ static void drm_gem_shmem_vunmap_locked(struct drm_gem_= shmem_object *shmem, * drm_gem_shmem_vmap(). The mapping is only removed when the use count dr= ops to * zero. * - * This function can be used to implement &drm_gem_object_funcs.vmap. But = it can - * also be called by drivers directly, in which case it will hide the - * differences between dma-buf imported and natively allocated objects. + * This function hides the differences between dma-buf imported and native= ly + * allocated objects. */ void drm_gem_shmem_vunmap(struct drm_gem_object *obj, struct dma_buf_map *= map) { @@ -585,8 +579,7 @@ static const struct vm_operations_struct drm_gem_shmem_= vm_ops =3D { * @vma: VMA for the area to be mapped * * This function implements an augmented version of the GEM DRM file mmap - * operation for shmem objects. Drivers which employ the shmem helpers sho= uld - * use this function as their &drm_gem_object_funcs.mmap handler. + * operation for shmem objects. * * Returns: * 0 on success or a negative error code on failure. @@ -627,8 +620,6 @@ EXPORT_SYMBOL_GPL(drm_gem_shmem_mmap); * @p: DRM printer * @indent: Tab indentation level * @obj: GEM object - * - * This implements the &drm_gem_object_funcs.info callback. */ void drm_gem_shmem_print_info(struct drm_printer *p, unsigned int indent, const struct drm_gem_object *obj) @@ -647,9 +638,7 @@ EXPORT_SYMBOL(drm_gem_shmem_print_info); * @obj: GEM object * * This function exports a scatter/gather table suitable for PRIME usage by - * calling the standard DMA mapping API. Drivers should not call this func= tion - * directly, instead it should only be used as an implementation for - * &drm_gem_object_funcs.get_sg_table. + * calling the standard DMA mapping API. * * Drivers who need to acquire an scatter/gather table for objects need to= call * drm_gem_shmem_get_pages_sgt() instead. diff --git a/drivers/gpu/drm/lima/lima_gem.c b/drivers/gpu/drm/lima/lima_ge= m.c index de62966243cd..6590e1cae4ee 100644 --- a/drivers/gpu/drm/lima/lima_gem.c +++ b/drivers/gpu/drm/lima/lima_gem.c @@ -206,12 +206,12 @@ static const struct drm_gem_object_funcs lima_gem_fun= cs =3D { .free =3D lima_gem_free_object, .open =3D lima_gem_object_open, .close =3D lima_gem_object_close, - .print_info =3D drm_gem_shmem_print_info, + .print_info =3D drm_gem_shmem_object_print_info, .pin =3D lima_gem_pin, - .unpin =3D drm_gem_shmem_unpin, - .get_sg_table =3D drm_gem_shmem_get_sg_table, + .unpin =3D drm_gem_shmem_object_unpin, + .get_sg_table =3D drm_gem_shmem_object_get_sg_table, .vmap =3D lima_gem_vmap, - .vunmap =3D drm_gem_shmem_vunmap, + .vunmap =3D drm_gem_shmem_object_vunmap, .mmap =3D lima_gem_mmap, }; =20 diff --git a/drivers/gpu/drm/panfrost/panfrost_gem.c b/drivers/gpu/drm/panf= rost/panfrost_gem.c index 23377481f4e3..be1cc6579a71 100644 --- a/drivers/gpu/drm/panfrost/panfrost_gem.c +++ b/drivers/gpu/drm/panfrost/panfrost_gem.c @@ -197,13 +197,13 @@ static const struct drm_gem_object_funcs panfrost_gem= _funcs =3D { .free =3D panfrost_gem_free_object, .open =3D panfrost_gem_open, .close =3D panfrost_gem_close, - .print_info =3D drm_gem_shmem_print_info, + .print_info =3D drm_gem_shmem_object_print_info, .pin =3D panfrost_gem_pin, - .unpin =3D drm_gem_shmem_unpin, - .get_sg_table =3D drm_gem_shmem_get_sg_table, - .vmap =3D drm_gem_shmem_vmap, - .vunmap =3D drm_gem_shmem_vunmap, - .mmap =3D drm_gem_shmem_mmap, + .unpin =3D drm_gem_shmem_object_unpin, + .get_sg_table =3D drm_gem_shmem_object_get_sg_table, + .vmap =3D drm_gem_shmem_object_vmap, + .vunmap =3D drm_gem_shmem_object_vunmap, + .mmap =3D drm_gem_shmem_object_mmap, }; =20 /** diff --git a/drivers/gpu/drm/v3d/v3d_bo.c b/drivers/gpu/drm/v3d/v3d_bo.c index 6a8731ab9d7d..b50677beb6ac 100644 --- a/drivers/gpu/drm/v3d/v3d_bo.c +++ b/drivers/gpu/drm/v3d/v3d_bo.c @@ -52,13 +52,13 @@ void v3d_free_object(struct drm_gem_object *obj) =20 static const struct drm_gem_object_funcs v3d_gem_funcs =3D { .free =3D v3d_free_object, - .print_info =3D drm_gem_shmem_print_info, - .pin =3D drm_gem_shmem_pin, - .unpin =3D drm_gem_shmem_unpin, - .get_sg_table =3D drm_gem_shmem_get_sg_table, - .vmap =3D drm_gem_shmem_vmap, - .vunmap =3D drm_gem_shmem_vunmap, - .mmap =3D drm_gem_shmem_mmap, + .print_info =3D drm_gem_shmem_object_print_info, + .pin =3D drm_gem_shmem_object_pin, + .unpin =3D drm_gem_shmem_object_unpin, + .get_sg_table =3D drm_gem_shmem_object_get_sg_table, + .vmap =3D drm_gem_shmem_object_vmap, + .vunmap =3D drm_gem_shmem_object_vunmap, + .mmap =3D drm_gem_shmem_object_mmap, }; =20 /* gem_create_object function for allocating a BO struct and doing diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b/drivers/gpu/drm/virt= io/virtgpu_object.c index f648b0e24447..698431d233b8 100644 --- a/drivers/gpu/drm/virtio/virtgpu_object.c +++ b/drivers/gpu/drm/virtio/virtgpu_object.c @@ -116,15 +116,14 @@ static const struct drm_gem_object_funcs virtio_gpu_s= hmem_funcs =3D { .free =3D virtio_gpu_free_object, .open =3D virtio_gpu_gem_object_open, .close =3D virtio_gpu_gem_object_close, - - .print_info =3D drm_gem_shmem_print_info, + .print_info =3D drm_gem_shmem_object_print_info, .export =3D virtgpu_gem_prime_export, - .pin =3D drm_gem_shmem_pin, - .unpin =3D drm_gem_shmem_unpin, - .get_sg_table =3D drm_gem_shmem_get_sg_table, - .vmap =3D drm_gem_shmem_vmap, - .vunmap =3D drm_gem_shmem_vunmap, - .mmap =3D drm_gem_shmem_mmap, + .pin =3D drm_gem_shmem_object_pin, + .unpin =3D drm_gem_shmem_object_unpin, + .get_sg_table =3D drm_gem_shmem_object_get_sg_table, + .vmap =3D drm_gem_shmem_object_vmap, + .vunmap =3D drm_gem_shmem_object_vunmap, + .mmap =3D drm_gem_shmem_object_mmap, }; =20 bool virtio_gpu_is_shmem(struct virtio_gpu_object *bo) diff --git a/include/drm/drm_gem_shmem_helper.h b/include/drm/drm_gem_shmem= _helper.h index 6b47eb7d9f76..4199877ae588 100644 --- a/include/drm/drm_gem_shmem_helper.h +++ b/include/drm/drm_gem_shmem_helper.h @@ -137,6 +137,126 @@ void drm_gem_shmem_print_info(struct drm_printer *p, = unsigned int indent, const struct drm_gem_object *obj); =20 struct sg_table *drm_gem_shmem_get_sg_table(struct drm_gem_object *obj); + +/* + * GEM object functions + */ + +/** + * drm_gem_shmem_object_free - GEM object function for drm_gem_shmem_free_= object() + * @obj: GEM object to free + * + * This function wraps drm_gem_shmem_free_object(). Drivers that employ th= e shmem helpers + * should use it as their &drm_gem_object_funcs.free handler. + */ +static inline void drm_gem_shmem_object_free(struct drm_gem_object *obj) +{ + drm_gem_shmem_free_object(obj); +} + +/** + * drm_gem_shmem_object_print_info() - Print &drm_gem_shmem_object info fo= r debugfs + * @p: DRM printer + * @indent: Tab indentation level + * @obj: GEM object + * + * This function wraps drm_gem_shmem_print_info(). Drivers that employ the= shmem helpers should + * use this function as their &drm_gem_object_funcs.print_info handler. + */ +static inline void drm_gem_shmem_object_print_info(struct drm_printer *p, = unsigned int indent, + const struct drm_gem_object *obj) +{ + drm_gem_shmem_print_info(p, indent, obj); +} + +/** + * drm_gem_shmem_object_pin - GEM object function for drm_gem_shmem_pin() + * @obj: GEM object + * + * This function wraps drm_gem_shmem_pin(). Drivers that employ the shmem = helpers should + * use it as their &drm_gem_object_funcs.pin handler. + */ +static inline int drm_gem_shmem_object_pin(struct drm_gem_object *obj) +{ + return drm_gem_shmem_pin(obj); +} + +/** + * drm_gem_shmem_object_unpin - GEM object function for drm_gem_shmem_unpi= n() + * @obj: GEM object + * + * This function wraps drm_gem_shmem_unpin(). Drivers that employ the shme= m helpers should + * use it as their &drm_gem_object_funcs.unpin handler. + */ +static inline void drm_gem_shmem_object_unpin(struct drm_gem_object *obj) +{ + drm_gem_shmem_unpin(obj); +} + +/** + * drm_gem_shmem_object_get_sg_table - GEM object function for drm_gem_shm= em_get_sg_table() + * @obj: GEM object + * + * This function wraps drm_gem_shmem_get_sg_table(). Drivers that employ t= he shmem helpers should + * use it as their &drm_gem_object_funcs.get_sg_table handler. + * + * Returns: + * A pointer to the scatter/gather table of pinned pages or NULL on failur= e. + */ +static inline struct sg_table *drm_gem_shmem_object_get_sg_table(struct dr= m_gem_object *obj) +{ + return drm_gem_shmem_get_sg_table(obj); +} + +/* + * drm_gem_shmem_object_vmap - GEM object function for drm_gem_shmem_vmap() + * @obj: GEM object + * @map: Returns the kernel virtual address of the SHMEM GEM object's back= ing store. + * + * This function wraps drm_gem_shmem_vmap(). Drivers that employ the shmem= helpers should + * use it as their &drm_gem_object_funcs.vmap handler. + * + * Returns: + * 0 on success or a negative error code on failure. + */ +static inline int drm_gem_shmem_object_vmap(struct drm_gem_object *obj, st= ruct dma_buf_map *map) +{ + return drm_gem_shmem_vmap(obj, map); +} + +/* + * drm_gem_shmem_object_vunmap - GEM object function for drm_gem_shmem_vun= map() + * @obj: GEM object + * @map: Kernel virtual address where the SHMEM GEM object was mapped + * + * This function wraps drm_gem_shmem_vunmap(). Drivers that employ the shm= em helpers should + * use it as their &drm_gem_object_funcs.vunmap handler. + */ +static inline void drm_gem_shmem_object_vunmap(struct drm_gem_object *obj,= struct dma_buf_map *map) +{ + drm_gem_shmem_vunmap(obj, map); +} + +/** + * drm_gem_shmem_object_mmap - GEM object function for drm_gem_shmem_mmap() + * @obj: GEM object + * @vma: VMA for the area to be mapped + * + * This function wraps drm_gem_shmem_mmap(). Drivers that employ the shmem= helpers should + * use it as their &drm_gem_object_funcs.mmap handler. + * + * Returns: + * 0 on success or a negative error code on failure. + */ +static inline int drm_gem_shmem_object_mmap(struct drm_gem_object *obj, st= ruct vm_area_struct *vma) +{ + return drm_gem_shmem_mmap(obj, vma); +} + +/* + * Driver ops + */ + struct drm_gem_object * drm_gem_shmem_prime_import_sg_table(struct drm_device *dev, struct dma_buf_attachment *attach, --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91ECDC00140 for ; Mon, 15 Aug 2022 18:48:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243580AbiHOSsg (ORCPT ); Mon, 15 Aug 2022 14:48:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242952AbiHOSnI (ORCPT ); Mon, 15 Aug 2022 14:43:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3866C2F64A; Mon, 15 Aug 2022 11:26: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 C373EB8107A; Mon, 15 Aug 2022 18:26:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECFECC433C1; Mon, 15 Aug 2022 18:26:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660587999; bh=5iy48iCyEwGdrV+incTh6wLrS6/kv5XVhoVB1Qw6QyM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=scZ/hBDMANurIJG/uISEnkgGAn+PuLQw4NxEECuBhj965CY5f+673OC1yquhbgT8e AsTB5v/1r9b8yX+ZILckoiZ8LahoyVf9wM+IaFHT+J45LncVw093lSm6CRVibZan5o ZCn+DsoOQCGPdUZYwwLvkzH0AcNJcDcnew7DVfoc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Zimmermann , Daniel Vetter , Sasha Levin Subject: [PATCH 5.15 256/779] drm/shmem-helper: Pass GEM shmem object in public interfaces Date: Mon, 15 Aug 2022 19:58:20 +0200 Message-Id: <20220815180348.284447299@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Thomas Zimmermann [ Upstream commit a193f3b4e050e35c506a34d0870c838d8e0b0449 ] Change all GEM SHMEM object functions that receive a GEM object of type struct drm_gem_object to expect an object of type struct drm_gem_shmem_object instead. This change reduces the number of upcasts from struct drm_gem_object by moving them into callers. The C compiler can now verify that the GEM SHMEM functions are called with the correct type. For consistency, the patch also renames drm_gem_shmem_free_object to drm_gem_shmem_free. It further updates documentation for a number of functions. v3: * fix docs for drm_gem_shmem_object_free() v2: * mention _object_ callbacks in docs (Daniel) Signed-off-by: Thomas Zimmermann Acked-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20211108093149.7226-4-t= zimmermann@suse.de Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/drm_gem_shmem_helper.c | 83 ++++++++----------- drivers/gpu/drm/lima/lima_gem.c | 10 +-- drivers/gpu/drm/lima/lima_sched.c | 4 +- drivers/gpu/drm/panfrost/panfrost_drv.c | 2 +- drivers/gpu/drm/panfrost/panfrost_gem.c | 8 +- .../gpu/drm/panfrost/panfrost_gem_shrinker.c | 2 +- drivers/gpu/drm/panfrost/panfrost_mmu.c | 5 +- drivers/gpu/drm/panfrost/panfrost_perfcnt.c | 6 +- drivers/gpu/drm/v3d/v3d_bo.c | 8 +- drivers/gpu/drm/virtio/virtgpu_object.c | 12 +-- include/drm/drm_gem_shmem_helper.h | 69 ++++++++------- 11 files changed, 107 insertions(+), 102 deletions(-) diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_g= em_shmem_helper.c index 05a924e29133..a30ffc07470c 100644 --- a/drivers/gpu/drm/drm_gem_shmem_helper.c +++ b/drivers/gpu/drm/drm_gem_shmem_helper.c @@ -22,6 +22,11 @@ * * This library provides helpers for GEM objects backed by shmem buffers * allocated using anonymous pageable memory. + * + * Functions that operate on the GEM object receive struct &drm_gem_shmem_= object. + * For GEM callback helpers in struct &drm_gem_object functions, see likew= ise + * named functions with an _object_ infix (e.g., drm_gem_shmem_object_vmap= () wraps + * drm_gem_shmem_vmap()). These helpers perform the necessary type convers= ion. */ =20 static const struct drm_gem_object_funcs drm_gem_shmem_funcs =3D { @@ -112,15 +117,15 @@ struct drm_gem_shmem_object *drm_gem_shmem_create(str= uct drm_device *dev, size_t EXPORT_SYMBOL_GPL(drm_gem_shmem_create); =20 /** - * drm_gem_shmem_free_object - Free resources associated with a shmem GEM = object - * @obj: GEM object to free + * drm_gem_shmem_free - Free resources associated with a shmem GEM object + * @shmem: shmem GEM object to free * * This function cleans up the GEM object state and frees the memory used = to * store the object itself. */ -void drm_gem_shmem_free_object(struct drm_gem_object *obj) +void drm_gem_shmem_free(struct drm_gem_shmem_object *shmem) { - struct drm_gem_shmem_object *shmem =3D to_drm_gem_shmem_obj(obj); + struct drm_gem_object *obj =3D &shmem->base; =20 WARN_ON(shmem->vmap_use_count); =20 @@ -144,7 +149,7 @@ void drm_gem_shmem_free_object(struct drm_gem_object *o= bj) mutex_destroy(&shmem->vmap_lock); kfree(shmem); } -EXPORT_SYMBOL_GPL(drm_gem_shmem_free_object); +EXPORT_SYMBOL_GPL(drm_gem_shmem_free); =20 static int drm_gem_shmem_get_pages_locked(struct drm_gem_shmem_object *shm= em) { @@ -224,7 +229,7 @@ EXPORT_SYMBOL(drm_gem_shmem_put_pages); =20 /** * drm_gem_shmem_pin - Pin backing pages for a shmem GEM object - * @obj: GEM object + * @shmem: shmem GEM object * * This function makes sure the backing pages are pinned in memory while t= he * buffer is exported. @@ -232,10 +237,8 @@ EXPORT_SYMBOL(drm_gem_shmem_put_pages); * Returns: * 0 on success or a negative error code on failure. */ -int drm_gem_shmem_pin(struct drm_gem_object *obj) +int drm_gem_shmem_pin(struct drm_gem_shmem_object *shmem) { - struct drm_gem_shmem_object *shmem =3D to_drm_gem_shmem_obj(obj); - WARN_ON(shmem->base.import_attach); =20 return drm_gem_shmem_get_pages(shmem); @@ -244,15 +247,13 @@ EXPORT_SYMBOL(drm_gem_shmem_pin); =20 /** * drm_gem_shmem_unpin - Unpin backing pages for a shmem GEM object - * @obj: GEM object + * @shmem: shmem GEM object * * This function removes the requirement that the backing pages are pinned= in * memory. */ -void drm_gem_shmem_unpin(struct drm_gem_object *obj) +void drm_gem_shmem_unpin(struct drm_gem_shmem_object *shmem) { - struct drm_gem_shmem_object *shmem =3D to_drm_gem_shmem_obj(obj); - WARN_ON(shmem->base.import_attach); =20 drm_gem_shmem_put_pages(shmem); @@ -327,9 +328,8 @@ static int drm_gem_shmem_vmap_locked(struct drm_gem_shm= em_object *shmem, struct * Returns: * 0 on success or a negative error code on failure. */ -int drm_gem_shmem_vmap(struct drm_gem_object *obj, struct dma_buf_map *map) +int drm_gem_shmem_vmap(struct drm_gem_shmem_object *shmem, struct dma_buf_= map *map) { - struct drm_gem_shmem_object *shmem =3D to_drm_gem_shmem_obj(obj); int ret; =20 ret =3D mutex_lock_interruptible(&shmem->vmap_lock); @@ -375,10 +375,8 @@ static void drm_gem_shmem_vunmap_locked(struct drm_gem= _shmem_object *shmem, * This function hides the differences between dma-buf imported and native= ly * allocated objects. */ -void drm_gem_shmem_vunmap(struct drm_gem_object *obj, struct dma_buf_map *= map) +void drm_gem_shmem_vunmap(struct drm_gem_shmem_object *shmem, struct dma_b= uf_map *map) { - struct drm_gem_shmem_object *shmem =3D to_drm_gem_shmem_obj(obj); - mutex_lock(&shmem->vmap_lock); drm_gem_shmem_vunmap_locked(shmem, map); mutex_unlock(&shmem->vmap_lock); @@ -413,10 +411,8 @@ drm_gem_shmem_create_with_handle(struct drm_file *file= _priv, /* Update madvise status, returns true if not purged, else * false or -errno. */ -int drm_gem_shmem_madvise(struct drm_gem_object *obj, int madv) +int drm_gem_shmem_madvise(struct drm_gem_shmem_object *shmem, int madv) { - struct drm_gem_shmem_object *shmem =3D to_drm_gem_shmem_obj(obj); - mutex_lock(&shmem->pages_lock); =20 if (shmem->madv >=3D 0) @@ -430,14 +426,14 @@ int drm_gem_shmem_madvise(struct drm_gem_object *obj,= int madv) } EXPORT_SYMBOL(drm_gem_shmem_madvise); =20 -void drm_gem_shmem_purge_locked(struct drm_gem_object *obj) +void drm_gem_shmem_purge_locked(struct drm_gem_shmem_object *shmem) { + struct drm_gem_object *obj =3D &shmem->base; struct drm_device *dev =3D obj->dev; - struct drm_gem_shmem_object *shmem =3D to_drm_gem_shmem_obj(obj); =20 WARN_ON(!drm_gem_shmem_is_purgeable(shmem)); =20 - dma_unmap_sgtable(obj->dev->dev, shmem->sgt, DMA_BIDIRECTIONAL, 0); + dma_unmap_sgtable(dev->dev, shmem->sgt, DMA_BIDIRECTIONAL, 0); sg_free_table(shmem->sgt); kfree(shmem->sgt); shmem->sgt =3D NULL; @@ -456,18 +452,15 @@ void drm_gem_shmem_purge_locked(struct drm_gem_object= *obj) */ shmem_truncate_range(file_inode(obj->filp), 0, (loff_t)-1); =20 - invalidate_mapping_pages(file_inode(obj->filp)->i_mapping, - 0, (loff_t)-1); + invalidate_mapping_pages(file_inode(obj->filp)->i_mapping, 0, (loff_t)-1); } EXPORT_SYMBOL(drm_gem_shmem_purge_locked); =20 -bool drm_gem_shmem_purge(struct drm_gem_object *obj) +bool drm_gem_shmem_purge(struct drm_gem_shmem_object *shmem) { - struct drm_gem_shmem_object *shmem =3D to_drm_gem_shmem_obj(obj); - if (!mutex_trylock(&shmem->pages_lock)) return false; - drm_gem_shmem_purge_locked(obj); + drm_gem_shmem_purge_locked(shmem); mutex_unlock(&shmem->pages_lock); =20 return true; @@ -575,7 +568,7 @@ static const struct vm_operations_struct drm_gem_shmem_= vm_ops =3D { =20 /** * drm_gem_shmem_mmap - Memory-map a shmem GEM object - * @obj: gem object + * @shmem: shmem GEM object * @vma: VMA for the area to be mapped * * This function implements an augmented version of the GEM DRM file mmap @@ -584,9 +577,9 @@ static const struct vm_operations_struct drm_gem_shmem_= vm_ops =3D { * Returns: * 0 on success or a negative error code on failure. */ -int drm_gem_shmem_mmap(struct drm_gem_object *obj, struct vm_area_struct *= vma) +int drm_gem_shmem_mmap(struct drm_gem_shmem_object *shmem, struct vm_area_= struct *vma) { - struct drm_gem_shmem_object *shmem; + struct drm_gem_object *obj =3D &shmem->base; int ret; =20 if (obj->import_attach) { @@ -597,8 +590,6 @@ int drm_gem_shmem_mmap(struct drm_gem_object *obj, stru= ct vm_area_struct *vma) return dma_buf_mmap(obj->dma_buf, vma, 0); } =20 - shmem =3D to_drm_gem_shmem_obj(obj); - ret =3D drm_gem_shmem_get_pages(shmem); if (ret) { drm_gem_vm_close(vma); @@ -617,15 +608,13 @@ EXPORT_SYMBOL_GPL(drm_gem_shmem_mmap); =20 /** * drm_gem_shmem_print_info() - Print &drm_gem_shmem_object info for debug= fs + * @shmem: shmem GEM object * @p: DRM printer * @indent: Tab indentation level - * @obj: GEM object */ -void drm_gem_shmem_print_info(struct drm_printer *p, unsigned int indent, - const struct drm_gem_object *obj) +void drm_gem_shmem_print_info(const struct drm_gem_shmem_object *shmem, + struct drm_printer *p, unsigned int indent) { - const struct drm_gem_shmem_object *shmem =3D to_drm_gem_shmem_obj(obj); - drm_printf_indent(p, indent, "pages_use_count=3D%u\n", shmem->pages_use_c= ount); drm_printf_indent(p, indent, "vmap_use_count=3D%u\n", shmem->vmap_use_cou= nt); drm_printf_indent(p, indent, "vaddr=3D%p\n", shmem->vaddr); @@ -635,7 +624,7 @@ EXPORT_SYMBOL(drm_gem_shmem_print_info); /** * drm_gem_shmem_get_sg_table - Provide a scatter/gather table of pinned * pages for a shmem GEM object - * @obj: GEM object + * @shmem: shmem GEM object * * This function exports a scatter/gather table suitable for PRIME usage by * calling the standard DMA mapping API. @@ -646,9 +635,9 @@ EXPORT_SYMBOL(drm_gem_shmem_print_info); * Returns: * A pointer to the scatter/gather table of pinned pages or NULL on failur= e. */ -struct sg_table *drm_gem_shmem_get_sg_table(struct drm_gem_object *obj) +struct sg_table *drm_gem_shmem_get_sg_table(struct drm_gem_shmem_object *s= hmem) { - struct drm_gem_shmem_object *shmem =3D to_drm_gem_shmem_obj(obj); + struct drm_gem_object *obj =3D &shmem->base; =20 WARN_ON(shmem->base.import_attach); =20 @@ -659,7 +648,7 @@ EXPORT_SYMBOL_GPL(drm_gem_shmem_get_sg_table); /** * drm_gem_shmem_get_pages_sgt - Pin pages, dma map them, and return a * scatter/gather table for a shmem GEM object. - * @obj: GEM object + * @shmem: shmem GEM object * * This function returns a scatter/gather table suitable for driver usage.= If * the sg table doesn't exist, the pages are pinned, dma-mapped, and a sg @@ -672,10 +661,10 @@ EXPORT_SYMBOL_GPL(drm_gem_shmem_get_sg_table); * Returns: * A pointer to the scatter/gather table of pinned pages or errno on failu= re. */ -struct sg_table *drm_gem_shmem_get_pages_sgt(struct drm_gem_object *obj) +struct sg_table *drm_gem_shmem_get_pages_sgt(struct drm_gem_shmem_object *= shmem) { + struct drm_gem_object *obj =3D &shmem->base; int ret; - struct drm_gem_shmem_object *shmem =3D to_drm_gem_shmem_obj(obj); struct sg_table *sgt; =20 if (shmem->sgt) @@ -687,7 +676,7 @@ struct sg_table *drm_gem_shmem_get_pages_sgt(struct drm= _gem_object *obj) if (ret) return ERR_PTR(ret); =20 - sgt =3D drm_gem_shmem_get_sg_table(&shmem->base); + sgt =3D drm_gem_shmem_get_sg_table(shmem); if (IS_ERR(sgt)) { ret =3D PTR_ERR(sgt); goto err_put_pages; diff --git a/drivers/gpu/drm/lima/lima_gem.c b/drivers/gpu/drm/lima/lima_ge= m.c index 6590e1cae4ee..09ea621a4806 100644 --- a/drivers/gpu/drm/lima/lima_gem.c +++ b/drivers/gpu/drm/lima/lima_gem.c @@ -127,7 +127,7 @@ int lima_gem_create_handle(struct drm_device *dev, stru= ct drm_file *file, if (err) goto out; } else { - struct sg_table *sgt =3D drm_gem_shmem_get_pages_sgt(obj); + struct sg_table *sgt =3D drm_gem_shmem_get_pages_sgt(shmem); =20 if (IS_ERR(sgt)) { err =3D PTR_ERR(sgt); @@ -151,7 +151,7 @@ static void lima_gem_free_object(struct drm_gem_object = *obj) if (!list_empty(&bo->va)) dev_err(obj->dev->dev, "lima gem free bo still has va\n"); =20 - drm_gem_shmem_free_object(obj); + drm_gem_shmem_free(&bo->base); } =20 static int lima_gem_object_open(struct drm_gem_object *obj, struct drm_fil= e *file) @@ -179,7 +179,7 @@ static int lima_gem_pin(struct drm_gem_object *obj) if (bo->heap_size) return -EINVAL; =20 - return drm_gem_shmem_pin(obj); + return drm_gem_shmem_pin(&bo->base); } =20 static int lima_gem_vmap(struct drm_gem_object *obj, struct dma_buf_map *m= ap) @@ -189,7 +189,7 @@ static int lima_gem_vmap(struct drm_gem_object *obj, st= ruct dma_buf_map *map) if (bo->heap_size) return -EINVAL; =20 - return drm_gem_shmem_vmap(obj, map); + return drm_gem_shmem_vmap(&bo->base, map); } =20 static int lima_gem_mmap(struct drm_gem_object *obj, struct vm_area_struct= *vma) @@ -199,7 +199,7 @@ static int lima_gem_mmap(struct drm_gem_object *obj, st= ruct vm_area_struct *vma) if (bo->heap_size) return -EINVAL; =20 - return drm_gem_shmem_mmap(obj, vma); + return drm_gem_shmem_mmap(&bo->base, vma); } =20 static const struct drm_gem_object_funcs lima_gem_funcs =3D { diff --git a/drivers/gpu/drm/lima/lima_sched.c b/drivers/gpu/drm/lima/lima_= sched.c index dba8329937a3..2e817dbdcad7 100644 --- a/drivers/gpu/drm/lima/lima_sched.c +++ b/drivers/gpu/drm/lima/lima_sched.c @@ -390,7 +390,7 @@ static void lima_sched_build_error_task_list(struct lim= a_sched_task *task) } else { buffer_chunk->size =3D lima_bo_size(bo); =20 - ret =3D drm_gem_shmem_vmap(&bo->base.base, &map); + ret =3D drm_gem_shmem_vmap(&bo->base, &map); if (ret) { kvfree(et); goto out; @@ -398,7 +398,7 @@ static void lima_sched_build_error_task_list(struct lim= a_sched_task *task) =20 memcpy(buffer_chunk + 1, map.vaddr, buffer_chunk->size); =20 - drm_gem_shmem_vunmap(&bo->base.base, &map); + drm_gem_shmem_vunmap(&bo->base, &map); } =20 buffer_chunk =3D (void *)(buffer_chunk + 1) + buffer_chunk->size; diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panf= rost/panfrost_drv.c index de533f372764..e48e357ea4f1 100644 --- a/drivers/gpu/drm/panfrost/panfrost_drv.c +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c @@ -418,7 +418,7 @@ static int panfrost_ioctl_madvise(struct drm_device *de= v, void *data, } } =20 - args->retained =3D drm_gem_shmem_madvise(gem_obj, args->madv); + args->retained =3D drm_gem_shmem_madvise(&bo->base, args->madv); =20 if (args->retained) { if (args->madv =3D=3D PANFROST_MADV_DONTNEED) diff --git a/drivers/gpu/drm/panfrost/panfrost_gem.c b/drivers/gpu/drm/panf= rost/panfrost_gem.c index be1cc6579a71..6d9bdb9180cb 100644 --- a/drivers/gpu/drm/panfrost/panfrost_gem.c +++ b/drivers/gpu/drm/panfrost/panfrost_gem.c @@ -49,7 +49,7 @@ static void panfrost_gem_free_object(struct drm_gem_objec= t *obj) kvfree(bo->sgts); } =20 - drm_gem_shmem_free_object(obj); + drm_gem_shmem_free(&bo->base); } =20 struct panfrost_gem_mapping * @@ -187,10 +187,12 @@ void panfrost_gem_close(struct drm_gem_object *obj, s= truct drm_file *file_priv) =20 static int panfrost_gem_pin(struct drm_gem_object *obj) { - if (to_panfrost_bo(obj)->is_heap) + struct panfrost_gem_object *bo =3D to_panfrost_bo(obj); + + if (bo->is_heap) return -EINVAL; =20 - return drm_gem_shmem_pin(obj); + return drm_gem_shmem_pin(&bo->base); } =20 static const struct drm_gem_object_funcs panfrost_gem_funcs =3D { diff --git a/drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c b/drivers/gpu= /drm/panfrost/panfrost_gem_shrinker.c index 1b9f68d8e9aa..b0142341e223 100644 --- a/drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c +++ b/drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c @@ -52,7 +52,7 @@ static bool panfrost_gem_purge(struct drm_gem_object *obj) goto unlock_mappings; =20 panfrost_gem_teardown_mappings_locked(bo); - drm_gem_shmem_purge_locked(obj); + drm_gem_shmem_purge_locked(&bo->base); ret =3D true; =20 mutex_unlock(&shmem->pages_lock); diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panf= rost/panfrost_mmu.c index c0189cc9a2f1..c3292a6bd1ae 100644 --- a/drivers/gpu/drm/panfrost/panfrost_mmu.c +++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c @@ -288,7 +288,8 @@ static int mmu_map_sg(struct panfrost_device *pfdev, st= ruct panfrost_mmu *mmu, int panfrost_mmu_map(struct panfrost_gem_mapping *mapping) { struct panfrost_gem_object *bo =3D mapping->obj; - struct drm_gem_object *obj =3D &bo->base.base; + struct drm_gem_shmem_object *shmem =3D &bo->base; + struct drm_gem_object *obj =3D &shmem->base; struct panfrost_device *pfdev =3D to_panfrost_device(obj->dev); struct sg_table *sgt; int prot =3D IOMMU_READ | IOMMU_WRITE; @@ -299,7 +300,7 @@ int panfrost_mmu_map(struct panfrost_gem_mapping *mappi= ng) if (bo->noexec) prot |=3D IOMMU_NOEXEC; =20 - sgt =3D drm_gem_shmem_get_pages_sgt(obj); + sgt =3D drm_gem_shmem_get_pages_sgt(shmem); if (WARN_ON(IS_ERR(sgt))) return PTR_ERR(sgt); =20 diff --git a/drivers/gpu/drm/panfrost/panfrost_perfcnt.c b/drivers/gpu/drm/= panfrost/panfrost_perfcnt.c index 5ab03d605f57..9d9c067c1d70 100644 --- a/drivers/gpu/drm/panfrost/panfrost_perfcnt.c +++ b/drivers/gpu/drm/panfrost/panfrost_perfcnt.c @@ -105,7 +105,7 @@ static int panfrost_perfcnt_enable_locked(struct panfro= st_device *pfdev, goto err_close_bo; } =20 - ret =3D drm_gem_shmem_vmap(&bo->base, &map); + ret =3D drm_gem_shmem_vmap(bo, &map); if (ret) goto err_put_mapping; perfcnt->buf =3D map.vaddr; @@ -164,7 +164,7 @@ static int panfrost_perfcnt_enable_locked(struct panfro= st_device *pfdev, return 0; =20 err_vunmap: - drm_gem_shmem_vunmap(&bo->base, &map); + drm_gem_shmem_vunmap(bo, &map); err_put_mapping: panfrost_gem_mapping_put(perfcnt->mapping); err_close_bo: @@ -194,7 +194,7 @@ static int panfrost_perfcnt_disable_locked(struct panfr= ost_device *pfdev, GPU_PERFCNT_CFG_MODE(GPU_PERFCNT_CFG_MODE_OFF)); =20 perfcnt->user =3D NULL; - drm_gem_shmem_vunmap(&perfcnt->mapping->obj->base.base, &map); + drm_gem_shmem_vunmap(&perfcnt->mapping->obj->base, &map); perfcnt->buf =3D NULL; panfrost_gem_close(&perfcnt->mapping->obj->base.base, file_priv); panfrost_mmu_as_put(pfdev, perfcnt->mapping->mmu); diff --git a/drivers/gpu/drm/v3d/v3d_bo.c b/drivers/gpu/drm/v3d/v3d_bo.c index b50677beb6ac..0d9af62f69ad 100644 --- a/drivers/gpu/drm/v3d/v3d_bo.c +++ b/drivers/gpu/drm/v3d/v3d_bo.c @@ -47,7 +47,7 @@ void v3d_free_object(struct drm_gem_object *obj) /* GPU execution may have dirtied any pages in the BO. */ bo->base.pages_mark_dirty_on_put =3D true; =20 - drm_gem_shmem_free_object(obj); + drm_gem_shmem_free(&bo->base); } =20 static const struct drm_gem_object_funcs v3d_gem_funcs =3D { @@ -95,7 +95,7 @@ v3d_bo_create_finish(struct drm_gem_object *obj) /* So far we pin the BO in the MMU for its lifetime, so use * shmem's helper for getting a lifetime sgt. */ - sgt =3D drm_gem_shmem_get_pages_sgt(&bo->base.base); + sgt =3D drm_gem_shmem_get_pages_sgt(&bo->base); if (IS_ERR(sgt)) return PTR_ERR(sgt); =20 @@ -141,7 +141,7 @@ struct v3d_bo *v3d_bo_create(struct drm_device *dev, st= ruct drm_file *file_priv, return bo; =20 free_obj: - drm_gem_shmem_free_object(&shmem_obj->base); + drm_gem_shmem_free(shmem_obj); return ERR_PTR(ret); } =20 @@ -159,7 +159,7 @@ v3d_prime_import_sg_table(struct drm_device *dev, =20 ret =3D v3d_bo_create_finish(obj); if (ret) { - drm_gem_shmem_free_object(obj); + drm_gem_shmem_free(&to_v3d_bo(obj)->base); return ERR_PTR(ret); } =20 diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b/drivers/gpu/drm/virt= io/virtgpu_object.c index 698431d233b8..187e10da2f17 100644 --- a/drivers/gpu/drm/virtio/virtgpu_object.c +++ b/drivers/gpu/drm/virtio/virtgpu_object.c @@ -79,10 +79,10 @@ void virtio_gpu_cleanup_object(struct virtio_gpu_object= *bo) sg_free_table(shmem->pages); kfree(shmem->pages); shmem->pages =3D NULL; - drm_gem_shmem_unpin(&bo->base.base); + drm_gem_shmem_unpin(&bo->base); } =20 - drm_gem_shmem_free_object(&bo->base.base); + drm_gem_shmem_free(&bo->base); } else if (virtio_gpu_is_vram(bo)) { struct virtio_gpu_object_vram *vram =3D to_virtio_gpu_vram(bo); =20 @@ -156,7 +156,7 @@ static int virtio_gpu_object_shmem_init(struct virtio_g= pu_device *vgdev, struct scatterlist *sg; int si, ret; =20 - ret =3D drm_gem_shmem_pin(&bo->base.base); + ret =3D drm_gem_shmem_pin(&bo->base); if (ret < 0) return -EINVAL; =20 @@ -166,9 +166,9 @@ static int virtio_gpu_object_shmem_init(struct virtio_g= pu_device *vgdev, * dma-ops. This is discouraged for other drivers, but should be fine * since virtio_gpu doesn't support dma-buf import from other devices. */ - shmem->pages =3D drm_gem_shmem_get_sg_table(&bo->base.base); + shmem->pages =3D drm_gem_shmem_get_sg_table(&bo->base); if (!shmem->pages) { - drm_gem_shmem_unpin(&bo->base.base); + drm_gem_shmem_unpin(&bo->base); return -EINVAL; } =20 @@ -276,6 +276,6 @@ int virtio_gpu_object_create(struct virtio_gpu_device *= vgdev, err_put_id: virtio_gpu_resource_id_put(vgdev, bo->hw_res_handle); err_free_gem: - drm_gem_shmem_free_object(&shmem_obj->base); + drm_gem_shmem_free(shmem_obj); return ret; } diff --git a/include/drm/drm_gem_shmem_helper.h b/include/drm/drm_gem_shmem= _helper.h index 4199877ae588..311d66c9cf4b 100644 --- a/include/drm/drm_gem_shmem_helper.h +++ b/include/drm/drm_gem_shmem_helper.h @@ -107,16 +107,17 @@ struct drm_gem_shmem_object { container_of(obj, struct drm_gem_shmem_object, base) =20 struct drm_gem_shmem_object *drm_gem_shmem_create(struct drm_device *dev, = size_t size); -void drm_gem_shmem_free_object(struct drm_gem_object *obj); +void drm_gem_shmem_free(struct drm_gem_shmem_object *shmem); =20 int drm_gem_shmem_get_pages(struct drm_gem_shmem_object *shmem); void drm_gem_shmem_put_pages(struct drm_gem_shmem_object *shmem); -int drm_gem_shmem_pin(struct drm_gem_object *obj); -void drm_gem_shmem_unpin(struct drm_gem_object *obj); -int drm_gem_shmem_vmap(struct drm_gem_object *obj, struct dma_buf_map *map= ); -void drm_gem_shmem_vunmap(struct drm_gem_object *obj, struct dma_buf_map *= map); +int drm_gem_shmem_pin(struct drm_gem_shmem_object *shmem); +void drm_gem_shmem_unpin(struct drm_gem_shmem_object *shmem); +int drm_gem_shmem_vmap(struct drm_gem_shmem_object *shmem, struct dma_buf_= map *map); +void drm_gem_shmem_vunmap(struct drm_gem_shmem_object *shmem, struct dma_b= uf_map *map); +int drm_gem_shmem_mmap(struct drm_gem_shmem_object *shmem, struct vm_area_= struct *vma); =20 -int drm_gem_shmem_madvise(struct drm_gem_object *obj, int madv); +int drm_gem_shmem_madvise(struct drm_gem_shmem_object *shmem, int madv); =20 static inline bool drm_gem_shmem_is_purgeable(struct drm_gem_shmem_object = *shmem) { @@ -125,33 +126,31 @@ static inline bool drm_gem_shmem_is_purgeable(struct = drm_gem_shmem_object *shmem !shmem->base.dma_buf && !shmem->base.import_attach; } =20 -void drm_gem_shmem_purge_locked(struct drm_gem_object *obj); -bool drm_gem_shmem_purge(struct drm_gem_object *obj); +void drm_gem_shmem_purge_locked(struct drm_gem_shmem_object *shmem); +bool drm_gem_shmem_purge(struct drm_gem_shmem_object *shmem); =20 -int drm_gem_shmem_dumb_create(struct drm_file *file, struct drm_device *de= v, - struct drm_mode_create_dumb *args); - -int drm_gem_shmem_mmap(struct drm_gem_object *obj, struct vm_area_struct *= vma); - -void drm_gem_shmem_print_info(struct drm_printer *p, unsigned int indent, - const struct drm_gem_object *obj); +struct sg_table *drm_gem_shmem_get_sg_table(struct drm_gem_shmem_object *s= hmem); +struct sg_table *drm_gem_shmem_get_pages_sgt(struct drm_gem_shmem_object *= shmem); =20 -struct sg_table *drm_gem_shmem_get_sg_table(struct drm_gem_object *obj); +void drm_gem_shmem_print_info(const struct drm_gem_shmem_object *shmem, + struct drm_printer *p, unsigned int indent); =20 /* * GEM object functions */ =20 /** - * drm_gem_shmem_object_free - GEM object function for drm_gem_shmem_free_= object() + * drm_gem_shmem_object_free - GEM object function for drm_gem_shmem_free() * @obj: GEM object to free * - * This function wraps drm_gem_shmem_free_object(). Drivers that employ th= e shmem helpers + * This function wraps drm_gem_shmem_free(). Drivers that employ the shmem= helpers * should use it as their &drm_gem_object_funcs.free handler. */ static inline void drm_gem_shmem_object_free(struct drm_gem_object *obj) { - drm_gem_shmem_free_object(obj); + struct drm_gem_shmem_object *shmem =3D to_drm_gem_shmem_obj(obj); + + drm_gem_shmem_free(shmem); } =20 /** @@ -166,7 +165,9 @@ static inline void drm_gem_shmem_object_free(struct drm= _gem_object *obj) static inline void drm_gem_shmem_object_print_info(struct drm_printer *p, = unsigned int indent, const struct drm_gem_object *obj) { - drm_gem_shmem_print_info(p, indent, obj); + const struct drm_gem_shmem_object *shmem =3D to_drm_gem_shmem_obj(obj); + + drm_gem_shmem_print_info(shmem, p, indent); } =20 /** @@ -178,7 +179,9 @@ static inline void drm_gem_shmem_object_print_info(stru= ct drm_printer *p, unsign */ static inline int drm_gem_shmem_object_pin(struct drm_gem_object *obj) { - return drm_gem_shmem_pin(obj); + struct drm_gem_shmem_object *shmem =3D to_drm_gem_shmem_obj(obj); + + return drm_gem_shmem_pin(shmem); } =20 /** @@ -190,7 +193,9 @@ static inline int drm_gem_shmem_object_pin(struct drm_g= em_object *obj) */ static inline void drm_gem_shmem_object_unpin(struct drm_gem_object *obj) { - drm_gem_shmem_unpin(obj); + struct drm_gem_shmem_object *shmem =3D to_drm_gem_shmem_obj(obj); + + drm_gem_shmem_unpin(shmem); } =20 /** @@ -205,7 +210,9 @@ static inline void drm_gem_shmem_object_unpin(struct dr= m_gem_object *obj) */ static inline struct sg_table *drm_gem_shmem_object_get_sg_table(struct dr= m_gem_object *obj) { - return drm_gem_shmem_get_sg_table(obj); + struct drm_gem_shmem_object *shmem =3D to_drm_gem_shmem_obj(obj); + + return drm_gem_shmem_get_sg_table(shmem); } =20 /* @@ -221,7 +228,9 @@ static inline struct sg_table *drm_gem_shmem_object_get= _sg_table(struct drm_gem_ */ static inline int drm_gem_shmem_object_vmap(struct drm_gem_object *obj, st= ruct dma_buf_map *map) { - return drm_gem_shmem_vmap(obj, map); + struct drm_gem_shmem_object *shmem =3D to_drm_gem_shmem_obj(obj); + + return drm_gem_shmem_vmap(shmem, map); } =20 /* @@ -234,7 +243,9 @@ static inline int drm_gem_shmem_object_vmap(struct drm_= gem_object *obj, struct d */ static inline void drm_gem_shmem_object_vunmap(struct drm_gem_object *obj,= struct dma_buf_map *map) { - drm_gem_shmem_vunmap(obj, map); + struct drm_gem_shmem_object *shmem =3D to_drm_gem_shmem_obj(obj); + + drm_gem_shmem_vunmap(shmem, map); } =20 /** @@ -250,7 +261,9 @@ static inline void drm_gem_shmem_object_vunmap(struct d= rm_gem_object *obj, struc */ static inline int drm_gem_shmem_object_mmap(struct drm_gem_object *obj, st= ruct vm_area_struct *vma) { - return drm_gem_shmem_mmap(obj, vma); + struct drm_gem_shmem_object *shmem =3D to_drm_gem_shmem_obj(obj); + + return drm_gem_shmem_mmap(shmem, vma); } =20 /* @@ -261,8 +274,8 @@ struct drm_gem_object * drm_gem_shmem_prime_import_sg_table(struct drm_device *dev, struct dma_buf_attachment *attach, struct sg_table *sgt); - -struct sg_table *drm_gem_shmem_get_pages_sgt(struct drm_gem_object *obj); +int drm_gem_shmem_dumb_create(struct drm_file *file, struct drm_device *de= v, + struct drm_mode_create_dumb *args); =20 /** * DRM_GEM_SHMEM_DRIVER_OPS - Default shmem GEM operations --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EEBFFC3F6B0 for ; Mon, 15 Aug 2022 18:49:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243080AbiHOStl (ORCPT ); Mon, 15 Aug 2022 14:49:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243380AbiHOSoA (ORCPT ); Mon, 15 Aug 2022 14:44: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 E3BDF2F67D; Mon, 15 Aug 2022 11:27:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6343460691; Mon, 15 Aug 2022 18:27:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51C03C433D7; Mon, 15 Aug 2022 18:27:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588034; bh=zYrR9oYzIaayks9bURRjZG2gtT1h3u/amPt6DIA3Tbs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Up3TCvAg00RnUBp1wt8OIqYsKpa9reYRLQ+oWxrpJnyGfiTaNco6sKsYa3+8X/APs rjD50MXBELr09KwUFGzIGOuvFDDxrUqFKizImvRc3cFKrgjpwt2quUMOYD1FirE9nz peJwplh6QDl042FLh8hfyZ0eBU/ZS9FEfLQC0yf8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Gerd Hoffmann , Sasha Levin Subject: [PATCH 5.15 257/779] drm/virtio: Fix NULL vs IS_ERR checking in virtio_gpu_object_shmem_init Date: Mon, 15 Aug 2022 19:58:21 +0200 Message-Id: <20220815180348.333416901@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit c24968734abfed81c8f93dc5f44a7b7a9aecadfa ] Since drm_prime_pages_to_sg() function return error pointers. The drm_gem_shmem_get_sg_table() function returns error pointers too. Using IS_ERR() to check the return value to fix this. Fixes: 2f2aa13724d5 ("drm/virtio: move virtio_gpu_mem_entry initialization = to new function") Signed-off-by: Miaoqian Lin Link: http://patchwork.freedesktop.org/patch/msgid/20220602104223.54527-1-l= inmq006@gmail.com Signed-off-by: Gerd Hoffmann Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/virtio/virtgpu_object.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_object.c b/drivers/gpu/drm/virt= io/virtgpu_object.c index 187e10da2f17..9af9f355e0a7 100644 --- a/drivers/gpu/drm/virtio/virtgpu_object.c +++ b/drivers/gpu/drm/virtio/virtgpu_object.c @@ -167,9 +167,9 @@ static int virtio_gpu_object_shmem_init(struct virtio_g= pu_device *vgdev, * since virtio_gpu doesn't support dma-buf import from other devices. */ shmem->pages =3D drm_gem_shmem_get_sg_table(&bo->base); - if (!shmem->pages) { + if (IS_ERR(shmem->pages)) { drm_gem_shmem_unpin(&bo->base); - return -EINVAL; + return PTR_ERR(shmem->pages); } =20 if (use_dma_api) { --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35E90C25B0E for ; Mon, 15 Aug 2022 18:51:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244229AbiHOSuk (ORCPT ); Mon, 15 Aug 2022 14:50:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243937AbiHOSqH (ORCPT ); Mon, 15 Aug 2022 14:46:07 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FB663F309; Mon, 15 Aug 2022 11:27: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 sin.source.kernel.org (Postfix) with ESMTPS id 71C96CE125F; Mon, 15 Aug 2022 18:27:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 692C4C433D6; Mon, 15 Aug 2022 18:27:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588068; bh=Km42Bxm6yHHfHS41fGN5FwzM/bDyy4QOKUQuJLMLkqI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JHmw0ZR0xQhy6jIhAjMQrHdvr+ufhIVvTw9brsk54BwrtQYKO1cLr4EijQycQ9C0n 1dAloPRwEKGVyLDE2uyZ9/YoWnPmnaKHmvYjy5LjxIby4bluGivzqkieE502GZizVN 5USc7gZYrvqBZ0Bf+/1xYd8ylEE9CBrztmP3fUzw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Antonio Borneo , Kieran Bingham , Robert Foss , Sasha Levin Subject: [PATCH 5.15 258/779] drm: adv7511: override i2c address of cec before accessing it Date: Mon, 15 Aug 2022 19:58:22 +0200 Message-Id: <20220815180348.375452011@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Antonio Borneo [ Upstream commit 9cc4853e4781bf0dd0f35355dc92d97c9da02f5d ] Commit 680532c50bca ("drm: adv7511: Add support for i2c_new_secondary_device") allows a device tree node to override the default addresses of the secondary i2c devices. This is useful for solving address conflicts on the i2c bus. In adv7511_init_cec_regmap() the new i2c address of cec device is read from device tree and immediately accessed, well before it is written in the proper register to override the default address. This can cause an i2c error during probe and a consequent probe failure. Once the new i2c address is read from the device tree, override the default address before any attempt to access the cec. Tested with adv7533 and stm32mp157f. Signed-off-by: Antonio Borneo Fixes: 680532c50bca ("drm: adv7511: Add support for i2c_new_secondary_devic= e") Reviewed-by: Kieran Bingham Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220607213144.427177-1= -antonio.borneo@foss.st.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm= /bridge/adv7511/adv7511_drv.c index 8c2025584f1b..1aadc6e94fde 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c @@ -1063,6 +1063,10 @@ static int adv7511_init_cec_regmap(struct adv7511 *a= dv) ADV7511_CEC_I2C_ADDR_DEFAULT); if (IS_ERR(adv->i2c_cec)) return PTR_ERR(adv->i2c_cec); + + regmap_write(adv->regmap, ADV7511_REG_CEC_I2C_ADDR, + adv->i2c_cec->addr << 1); + i2c_set_clientdata(adv->i2c_cec, adv); =20 adv->regmap_cec =3D devm_regmap_init_i2c(adv->i2c_cec, @@ -1267,9 +1271,6 @@ static int adv7511_probe(struct i2c_client *i2c, cons= t struct i2c_device_id *id) if (ret) goto err_i2c_unregister_packet; =20 - regmap_write(adv7511->regmap, ADV7511_REG_CEC_I2C_ADDR, - adv7511->i2c_cec->addr << 1); - INIT_WORK(&adv7511->hpd_work, adv7511_hpd_work); =20 if (i2c->irq) { --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE611C28B2C for ; Mon, 15 Aug 2022 18:51:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244457AbiHOSvL (ORCPT ); Mon, 15 Aug 2022 14:51:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244101AbiHOSqd (ORCPT ); Mon, 15 Aug 2022 14:46:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92BE740BC5; Mon, 15 Aug 2022 11:28:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3D0FB60FBA; Mon, 15 Aug 2022 18:28:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89ECDC43146; Mon, 15 Aug 2022 18:28:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588086; bh=h5vc3yvXunEp0SALg3u9XixYh+znlF9+B4f8XKf+EY0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vq1cGRQZDP+i3O/EonRvVGUJIxfarnSoUlqmO1/fXRUJjc7Lu3Pt68yrvrUoU+UoO Vtxqe38FIaI6xlr4UjpbrjBCWF+adyI1O4yj6HK+uvtYwvoTTDKVUARUE/Q8WRGU4w wJkkOoCqYDjjwh6mxDcC/0xolCrbjXu5A25/dIQc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Corentin Labbe , Herbert Xu , Sasha Levin Subject: [PATCH 5.15 259/779] crypto: sun8i-ss - do not allocate memory when handling hash requests Date: Mon, 15 Aug 2022 19:58:23 +0200 Message-Id: <20220815180348.408876754@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Corentin Labbe [ Upstream commit 8eec4563f152981a441693fc97c5459843dc5e6e ] Instead of allocate memory on each requests, it is easier to pre-allocate buffers. This made error path easier. Signed-off-by: Corentin Labbe Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c | 10 ++++++++++ drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c | 15 +++------------ drivers/crypto/allwinner/sun8i-ss/sun8i-ss.h | 4 ++++ 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c b/drivers/cr= ypto/allwinner/sun8i-ss/sun8i-ss-core.c index 657530578643..786b6f5cf300 100644 --- a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c +++ b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c @@ -486,6 +486,16 @@ static int allocate_flows(struct sun8i_ss_dev *ss) goto error_engine; } =20 + /* the padding could be up to two block. */ + ss->flows[i].pad =3D devm_kmalloc(ss->dev, SHA256_BLOCK_SIZE * 2, + GFP_KERNEL | GFP_DMA); + if (!ss->flows[i].pad) + goto error_engine; + ss->flows[i].result =3D devm_kmalloc(ss->dev, SHA256_DIGEST_SIZE, + GFP_KERNEL | GFP_DMA); + if (!ss->flows[i].result) + goto error_engine; + ss->flows[i].engine =3D crypto_engine_alloc_init(ss->dev, true); if (!ss->flows[i].engine) { dev_err(ss->dev, "Cannot allocate engine\n"); diff --git a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c b/drivers/cr= ypto/allwinner/sun8i-ss/sun8i-ss-hash.c index ca4f280af35d..f89a580618aa 100644 --- a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c +++ b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c @@ -342,18 +342,11 @@ int sun8i_ss_hash_run(struct crypto_engine *engine, v= oid *breq) if (digestsize =3D=3D SHA224_DIGEST_SIZE) digestsize =3D SHA256_DIGEST_SIZE; =20 - /* the padding could be up to two block. */ - pad =3D kzalloc(algt->alg.hash.halg.base.cra_blocksize * 2, GFP_KERNEL | = GFP_DMA); - if (!pad) - return -ENOMEM; + result =3D ss->flows[rctx->flow].result; + pad =3D ss->flows[rctx->flow].pad; + memset(pad, 0, algt->alg.hash.halg.base.cra_blocksize * 2); bf =3D (__le32 *)pad; =20 - result =3D kzalloc(digestsize, GFP_KERNEL | GFP_DMA); - if (!result) { - kfree(pad); - return -ENOMEM; - } - for (i =3D 0; i < MAX_SG; i++) { rctx->t_dst[i].addr =3D 0; rctx->t_dst[i].len =3D 0; @@ -449,8 +442,6 @@ int sun8i_ss_hash_run(struct crypto_engine *engine, voi= d *breq) =20 memcpy(areq->result, result, algt->alg.hash.halg.digestsize); theend: - kfree(pad); - kfree(result); local_bh_disable(); crypto_finalize_hash_request(engine, breq, err); local_bh_enable(); diff --git a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss.h b/drivers/crypto/= allwinner/sun8i-ss/sun8i-ss.h index 57ada8653855..eb82ee5345ae 100644 --- a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss.h +++ b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss.h @@ -123,6 +123,8 @@ struct sginfo { * @stat_req: number of request done by this flow * @iv: list of IV to use for each step * @biv: buffer which contain the backuped IV + * @pad: padding buffer for hash operations + * @result: buffer for storing the result of hash operations */ struct sun8i_ss_flow { struct crypto_engine *engine; @@ -130,6 +132,8 @@ struct sun8i_ss_flow { int status; u8 *iv[MAX_SG]; u8 *biv; + void *pad; + void *result; #ifdef CONFIG_CRYPTO_DEV_SUN8I_SS_DEBUG unsigned long stat_req; #endif --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCD45C2BB41 for ; Mon, 15 Aug 2022 18:51:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244487AbiHOSvS (ORCPT ); Mon, 15 Aug 2022 14:51:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244116AbiHOSqe (ORCPT ); Mon, 15 Aug 2022 14:46: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 48FFA40BD6; Mon, 15 Aug 2022 11:28: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 79D8460FEE; Mon, 15 Aug 2022 18:28:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63BEEC433C1; Mon, 15 Aug 2022 18:28:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588089; bh=KH+LbbLmVGf4w93XlXej3XCKb8SjTDmLrLAJpeWu4S8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wfOGI8xTpfZyfD7pDdgREuYahR2W+cAuKjFIYW8GMUx/bp1DYhmHXeaH71whnR9Pa jBCw9oxnWlLg30qqV0fc7HeIlI2nuI8BlXNuoQyddMC4Wpve0tB9oyaEnpxqHb5xRM woTHdaV5qNMvmMI0YCQp0zFKJlUwY2nrxmCFKVOs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Corentin Labbe , Herbert Xu , Sasha Levin Subject: [PATCH 5.15 260/779] crypto: sun8i-ss - fix error codes in allocate_flows() Date: Mon, 15 Aug 2022 19:58:24 +0200 Message-Id: <20220815180348.460484140@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter [ Upstream commit d2765e1b9ac4b2d5a5d5bf17f468c9b3566c3770 ] These failure paths should return -ENOMEM. Currently they return success. Fixes: 359e893e8af4 ("crypto: sun8i-ss - rework handling of IV") Fixes: 8eec4563f152 ("crypto: sun8i-ss - do not allocate memory when handli= ng hash requests") Signed-off-by: Dan Carpenter Acked-by: Corentin Labbe Tested-by: Corentin Labbe Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- .../crypto/allwinner/sun8i-ss/sun8i-ss-core.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c b/drivers/cr= ypto/allwinner/sun8i-ss/sun8i-ss-core.c index 786b6f5cf300..47b5828e35c3 100644 --- a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c +++ b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-core.c @@ -476,25 +476,33 @@ static int allocate_flows(struct sun8i_ss_dev *ss) =20 ss->flows[i].biv =3D devm_kmalloc(ss->dev, AES_BLOCK_SIZE, GFP_KERNEL | GFP_DMA); - if (!ss->flows[i].biv) + if (!ss->flows[i].biv) { + err =3D -ENOMEM; goto error_engine; + } =20 for (j =3D 0; j < MAX_SG; j++) { ss->flows[i].iv[j] =3D devm_kmalloc(ss->dev, AES_BLOCK_SIZE, GFP_KERNEL | GFP_DMA); - if (!ss->flows[i].iv[j]) + if (!ss->flows[i].iv[j]) { + err =3D -ENOMEM; goto error_engine; + } } =20 /* the padding could be up to two block. */ ss->flows[i].pad =3D devm_kmalloc(ss->dev, SHA256_BLOCK_SIZE * 2, GFP_KERNEL | GFP_DMA); - if (!ss->flows[i].pad) + if (!ss->flows[i].pad) { + err =3D -ENOMEM; goto error_engine; + } ss->flows[i].result =3D devm_kmalloc(ss->dev, SHA256_DIGEST_SIZE, GFP_KERNEL | GFP_DMA); - if (!ss->flows[i].result) + if (!ss->flows[i].result) { + err =3D -ENOMEM; goto error_engine; + } =20 ss->flows[i].engine =3D crypto_engine_alloc_init(ss->dev, true); if (!ss->flows[i].engine) { --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01186C00140 for ; Mon, 15 Aug 2022 18:55:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244587AbiHOSy6 (ORCPT ); Mon, 15 Aug 2022 14:54:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244160AbiHOSql (ORCPT ); Mon, 15 Aug 2022 14:46:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84D9B40BE7; Mon, 15 Aug 2022 11:28:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 89CCC6102C; Mon, 15 Aug 2022 18:28:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8557BC433D7; Mon, 15 Aug 2022 18:28:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588093; bh=lRviNUT/rYmASAJMOBhWRjeohlYDqq+Z0AqjhvA7WX8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gNki2vpb3eJ+aR2D47HYOASttkC8/eaUd4oMCLGQq7eJGsLdxIjhG9Jyias3cbn3D viVg9OG23w6nS/9PupUaALJ2yuuSNb5OZiOT5q7mz3uAaBJdS/akiZD3+VfXyJ+Tbe vkNj7JxZMWm1J8qLDkVhhPdR3lofQ93h5vURECSU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , Shakeel Butt , Soheil Hassas Yeganeh , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 261/779] net: fix sk_wmem_schedule() and sk_rmem_schedule() errors Date: Mon, 15 Aug 2022 19:58:25 +0200 Message-Id: <20220815180348.501598319@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 7c80b038d23e1f4c7fcc311f43f83b8c60e7fb80 ] If sk->sk_forward_alloc is 150000, and we need to schedule 150001 bytes, we want to allocate 1 byte more (rounded up to one page), instead of 150001 :/ Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Eric Dumazet Reviewed-by: Shakeel Butt Acked-by: Soheil Hassas Yeganeh Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- include/net/sock.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/include/net/sock.h b/include/net/sock.h index 819c53965ef3..e0a88bb0a58c 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -1507,19 +1507,23 @@ static inline bool sk_has_account(struct sock *sk) =20 static inline bool sk_wmem_schedule(struct sock *sk, int size) { + int delta; + if (!sk_has_account(sk)) return true; - return size <=3D sk->sk_forward_alloc || - __sk_mem_schedule(sk, size, SK_MEM_SEND); + delta =3D size - sk->sk_forward_alloc; + return delta <=3D 0 || __sk_mem_schedule(sk, delta, SK_MEM_SEND); } =20 static inline bool sk_rmem_schedule(struct sock *sk, struct sk_buff *skb, int size) { + int delta; + if (!sk_has_account(sk)) return true; - return size <=3D sk->sk_forward_alloc || - __sk_mem_schedule(sk, size, SK_MEM_RECV) || + delta =3D size - sk->sk_forward_alloc; + return delta <=3D 0 || __sk_mem_schedule(sk, delta, SK_MEM_RECV) || skb_pfmemalloc(skb); } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F379FC2BB41 for ; Mon, 15 Aug 2022 18:52:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233571AbiHOSwB (ORCPT ); Mon, 15 Aug 2022 14:52:01 -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 S244176AbiHOSqm (ORCPT ); Mon, 15 Aug 2022 14:46:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77B5840BFE; Mon, 15 Aug 2022 11:28:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BC00861029; Mon, 15 Aug 2022 18:28:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BCBA8C433D6; Mon, 15 Aug 2022 18:28:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588096; bh=CsOJWnSbPjF0pCX5rb3IIuN2cNFjsDCln1raPB769b8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xuMtqk1YqCXWQ42KiqnmieuRq5qvIEkxocPBGU5cDTY5lDHhFauQnX3UZ+E6xiaiA VJwLJp0n5S8LcHBlVPXpcFBC832FiVqDY0kz4Kk8QLW/CRoh4K85MmqPnEtq06I6bm UT6LRooYqkHg29Udnq72vrb03TPUsQ4ABPMYjKQk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Max Staudt , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.15 262/779] can: netlink: allow configuring of fixed bit rates without need for do_set_bittiming callback Date: Mon, 15 Aug 2022 19:58:26 +0200 Message-Id: <20220815180348.549146924@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marc Kleine-Budde [ Upstream commit 7e193a42c37cf40eba8ac5af2d5e8eeb8b9506f9 ] Usually CAN devices support configurable bit rates. The limits are defined by struct can_priv::bittiming_const. Another way is to implement the struct can_priv::do_set_bittiming callback. If the bit rate is configured via netlink, the can_changelink() function checks that either can_priv::bittiming_const or struct can_priv::do_set_bittiming is implemented. In commit 431af779256c ("can: dev: add CAN interface API for fixed bitrates") an API for configuring bit rates on CAN interfaces that only support fixed bit rates was added. The supported bit rates are defined by struct can_priv::bitrate_const. However the above mentioned commit forgot to add the struct can_priv::bitrate_const to the check in can_changelink(). In order to avoid to implement a no-op can_priv::do_set_bittiming callback on devices with fixed bit rates, extend the check in can_changelink() accordingly. Link: https://lore.kernel.org/all/20220611144248.3924903-1-mkl@pengutronix.= de Fixes: 431af779256c ("can: dev: add CAN interface API for fixed bitrates") Reported-by: Max Staudt Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/can/dev/netlink.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/can/dev/netlink.c b/drivers/net/can/dev/netlink.c index 80425636049d..cdde7fecefcf 100644 --- a/drivers/net/can/dev/netlink.c +++ b/drivers/net/can/dev/netlink.c @@ -76,7 +76,8 @@ static int can_changelink(struct net_device *dev, struct = nlattr *tb[], * directly via do_set_bitrate(). Bail out if neither * is given. */ - if (!priv->bittiming_const && !priv->do_set_bittiming) + if (!priv->bittiming_const && !priv->do_set_bittiming && + !priv->bitrate_const) return -EOPNOTSUPP; =20 memcpy(&bt, nla_data(data[IFLA_CAN_BITTIMING]), sizeof(bt)); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 009E6C00140 for ; Mon, 15 Aug 2022 18:52:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243867AbiHOSwN (ORCPT ); Mon, 15 Aug 2022 14:52:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244244AbiHOSqv (ORCPT ); Mon, 15 Aug 2022 14:46: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 5502E419B1; Mon, 15 Aug 2022 11:28: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 9615EB81062; Mon, 15 Aug 2022 18:28:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E37D1C433C1; Mon, 15 Aug 2022 18:28:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588099; bh=Qt1VPSwfEWzTtNanrkuYk5V/ufnsCNnE/v6Cq1OAj1E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bUxTcmDUyauRmu6OMpHKkREXwdLNbOZe3MGDernXtxc6DkSJ1n4nyrUjoY3l55mbe JN7HxLN/R16JcGEr8AMHzqSjLNZihqlbGqKQgl6UFsu46NfJeUOS6bfj4LQYj+8qcK Vou9Xk5QYQhtdLlo0E6o79bV37BkUsqDsHw0mWic= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Max Staudt , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.15 263/779] can: netlink: allow configuring of fixed data bit rates without need for do_set_data_bittiming callback Date: Mon, 15 Aug 2022 19:58:27 +0200 Message-Id: <20220815180348.599658611@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marc Kleine-Budde [ Upstream commit ec30c109391c5eac9b1d689a61e4bfed88148947 ] This patch is similar to 7e193a42c37c ("can: netlink: allow configuring of fixed bit rates without need for do_set_bittiming callback") but for data bit rates instead of bit rates. Usually CAN devices support configurable data bit rates. The limits are defined by struct can_priv::data_bittiming_const. Another way is to implement the struct can_priv::do_set_data_bittiming callback. If the bit rate is configured via netlink, the can_changelink() function checks that either can_priv::data_bittiming_const or struct can_priv::do_set_data_bittiming is implemented. In commit 431af779256c ("can: dev: add CAN interface API for fixed bitrates") an API for configuring bit rates on CAN interfaces that only support fixed bit rates was added. The supported bit rates are defined by struct can_priv::bitrate_const. However the above mentioned commit forgot to add the struct can_priv::data_bitrate_const to the check in can_changelink(). In order to avoid to implement a no-op can_priv::do_set_data_bittiming callback on devices with fixed data bit rates, extend the check in can_changelink() accordingly. Link: https://lore.kernel.org/all/20220613143633.4151884-1-mkl@pengutronix.= de Fixes: 431af779256c ("can: dev: add CAN interface API for fixed bitrates") Acked-by: Max Staudt Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/can/dev/netlink.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/can/dev/netlink.c b/drivers/net/can/dev/netlink.c index cdde7fecefcf..29e2beae3357 100644 --- a/drivers/net/can/dev/netlink.c +++ b/drivers/net/can/dev/netlink.c @@ -170,7 +170,8 @@ static int can_changelink(struct net_device *dev, struc= t nlattr *tb[], * directly via do_set_bitrate(). Bail out if neither * is given. */ - if (!priv->data_bittiming_const && !priv->do_set_data_bittiming) + if (!priv->data_bittiming_const && !priv->do_set_data_bittiming && + !priv->data_bitrate_const) return -EOPNOTSUPP; =20 memcpy(&dbt, nla_data(data[IFLA_CAN_DATA_BITTIMING]), --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77A99C00140 for ; Mon, 15 Aug 2022 18:52:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243992AbiHOSwR (ORCPT ); Mon, 15 Aug 2022 14:52:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244231AbiHOSqt (ORCPT ); Mon, 15 Aug 2022 14:46:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BED7841D01; Mon, 15 Aug 2022 11:28: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 C8F1160FBA; Mon, 15 Aug 2022 18:28:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D203AC433D7; Mon, 15 Aug 2022 18:28:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588102; bh=9fFU841hpe5Pyc79KUrqRFYYT/dlO83nB9lU2JYsXWQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yz1HGcAky8HTi81egvG5nfYaXEuU94j7M5D5n3sgBGifs/ksVk8PWo875GZPYWeuY HH3NLl5pl0qUqVio7p90pU/ZSUnfNt+/ybUTYV5yR2yC8ECuNwaeWcqKiafNz+DTCT sZuXDgEKQGigFCHYTNGp/OMizU3+E6bBbCBytj8Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xu Wang , Wolfram Sang , Sasha Levin Subject: [PATCH 5.15 264/779] i2c: Fix a potential use after free Date: Mon, 15 Aug 2022 19:58:28 +0200 Message-Id: <20220815180348.650294076@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xu Wang [ Upstream commit e4c72c06c367758a14f227c847f9d623f1994ecf ] Free the adap structure only after we are done using it. This patch just moves the put_device() down a bit to avoid the use after free. Fixes: 611e12ea0f12 ("i2c: core: manage i2c bus device refcount in i2c_[get= |put]_adapter") Signed-off-by: Xu Wang [wsa: added comment to the code, added Fixes tag] Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/i2c/i2c-core-base.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c index cfbef70e8ba7..8fb065caf30b 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c @@ -2464,8 +2464,9 @@ void i2c_put_adapter(struct i2c_adapter *adap) if (!adap) return; =20 - put_device(&adap->dev); module_put(adap->owner); + /* Should be last, otherwise we risk use-after-free with 'adap' */ + put_device(&adap->dev); } EXPORT_SYMBOL(i2c_put_adapter); =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 043DCC00140 for ; Mon, 15 Aug 2022 18:48:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229903AbiHOSs1 (ORCPT ); Mon, 15 Aug 2022 14:48:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242986AbiHOSnK (ORCPT ); Mon, 15 Aug 2022 14:43:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 817402A275; Mon, 15 Aug 2022 11:26: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 2B58DB8107B; Mon, 15 Aug 2022 18:26:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44E6BC433C1; Mon, 15 Aug 2022 18:26:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588002; bh=65ljVjHidvP03ijUNO/zjfxop07YULtw68E7rTTUr9s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k/K1iejG9AkT0HSWr3esAZY1yuakOqbNhwxyeLnE6VgBDdGva1u9NGv3OGRKAxxBS z9WVtVyfJfWsE0G2FWPYOSijEz9Vx2zhzUt4I66E19IUP1Qr2mp5rgl6+A+60NBrBm JYJ8sKWPA+NluOr7f/E/rHP1mo0KM3rBGR/7wCWg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Khoroshilov , Corentin Labbe , Herbert Xu , Sasha Levin Subject: [PATCH 5.15 265/779] crypto: sun8i-ss - fix infinite loop in sun8i_ss_setup_ivs() Date: Mon, 15 Aug 2022 19:58:29 +0200 Message-Id: <20220815180348.698511625@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexey Khoroshilov [ Upstream commit d61a7b3decf7f0cf4121a7204303deefd2c7151b ] There is no i decrement in while (i >=3D 0) loop. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Alexey Khoroshilov Fixes: 359e893e8af4 ("crypto: sun8i-ss - rework handling of IV") Acked-by: Corentin Labbe Tested-by: Corentin Labbe Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c b/drivers/= crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c index 70e2e6e37389..3c46ad8c3a1c 100644 --- a/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c +++ b/drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c @@ -151,6 +151,7 @@ static int sun8i_ss_setup_ivs(struct skcipher_request *= areq) while (i >=3D 0) { dma_unmap_single(ss->dev, rctx->p_iv[i], ivsize, DMA_TO_DEVICE); memzero_explicit(sf->iv[i], ivsize); + i--; } return err; } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A4853C25B08 for ; Mon, 15 Aug 2022 18:48:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243346AbiHOSsU (ORCPT ); Mon, 15 Aug 2022 14:48:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243004AbiHOSnL (ORCPT ); Mon, 15 Aug 2022 14:43: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 9743D29CB8; Mon, 15 Aug 2022 11:26: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 537D2B8107A; Mon, 15 Aug 2022 18:26:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9521C433C1; Mon, 15 Aug 2022 18:26:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588006; bh=z/yU3AHakXSnub2TkT7CGnzttRrLNEnyvwIiYdqnSNc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mNcs/DR/cPVWg2Rfi0vtUtphgCKrGGCSd2oO0SnvdEOsvN7/h+EhOJ9XDvlVtIN9U t/BP2ZGIs5fwIUg2VnjoLIOxUFdgRky1S/jPxsJ0IVllirl1cnetJj1JfSvzku2Bo/ b0tqODzHgLMCgGiZ/UYj66GnY2ZbDHow4YwsXcP8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Eugen Hristev , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.15 266/779] media: atmel: atmel-sama7g5-isc: fix warning in configs without OF Date: Mon, 15 Aug 2022 19:58:30 +0200 Message-Id: <20220815180348.730259275@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eugen Hristev [ Upstream commit b2bae4b8e637dd751d27918a6b27bd5abcd08859 ] All warnings (new ones prefixed by >>): >> drivers/media/platform/atmel/atmel-sama7g5-isc.c:610:34: warning: unused= variable 'microchip_xisc_of_match' [-Wunused-const-variable] static const struct of_device_id microchip_xisc_of_match[] =3D { ^ 13 warnings generated. vim +/microchip_xisc_of_match +610 drivers/media/platform/atmel/atmel-sama7= g5-isc.c 609 > 610 static const struct of_device_id microchip_xisc_of_match[] =3D { 611 { .compatible =3D "microchip,sama7g5-isc" }, 612 { } 613 }; 614 MODULE_DEVICE_TABLE(of, microchip_xisc_of_match); 615 Fixed warning by guarding the atmel_isc_of_match by CONFIG_OF. Reported-by: kernel test robot Fixes: c9aa973884a1 ("media: atmel: atmel-isc: add microchip-xisc driver") Signed-off-by: Eugen Hristev Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/media/platform/atmel/atmel-sama7g5-isc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/platform/atmel/atmel-sama7g5-isc.c b/drivers/med= ia/platform/atmel/atmel-sama7g5-isc.c index 6a5d3f7ce75e..a4defc30cf41 100644 --- a/drivers/media/platform/atmel/atmel-sama7g5-isc.c +++ b/drivers/media/platform/atmel/atmel-sama7g5-isc.c @@ -587,11 +587,13 @@ static const struct dev_pm_ops microchip_xisc_dev_pm_= ops =3D { SET_RUNTIME_PM_OPS(xisc_runtime_suspend, xisc_runtime_resume, NULL) }; =20 +#if IS_ENABLED(CONFIG_OF) static const struct of_device_id microchip_xisc_of_match[] =3D { { .compatible =3D "microchip,sama7g5-isc" }, { } }; MODULE_DEVICE_TABLE(of, microchip_xisc_of_match); +#endif =20 static struct platform_driver microchip_xisc_driver =3D { .probe =3D microchip_xisc_probe, --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8052FC00140 for ; Mon, 15 Aug 2022 18:48:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243976AbiHOSsR (ORCPT ); Mon, 15 Aug 2022 14:48:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243033AbiHOSnO (ORCPT ); Mon, 15 Aug 2022 14:43:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 210322B635; Mon, 15 Aug 2022 11:26:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B080860FC4; Mon, 15 Aug 2022 18:26:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE863C433D6; Mon, 15 Aug 2022 18:26:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588009; bh=waPJhJ6SojFPzfGmvO2QfFFRmbu4h7chPRsAD9faz1o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yolOCqAngAS0OgabI2czW0gRKsR3YIRaKpKZJwGCFem2PyIX95vo2uVXY25Mekih5 MLSH7i6cAUZqGqF4F0gsGSgU0fNHdSssRFS83JEmbgrtZMfAwZMfPWZqQ9vkCHsa34 xI8GSVoIphWko0o0QxL2i1/1EU6QTEK228ZvlYtM= 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.15 267/779] media: tw686x: Register the irq at the end of probe Date: Mon, 15 Aug 2022 19:58:31 +0200 Message-Id: <20220815180348.771223446@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 fb730334e0f759d00f72168fbc555e5a95e35210 ] We got the following warning when booting the kernel: [ 3.243674] INFO: trying to register non-static key. [ 3.243922] The code is fine but needs lockdep annotation, or maybe [ 3.244230] you didn't initialize this object before use? [ 3.245642] Call Trace: [ 3.247836] lock_acquire+0xff/0x2d0 [ 3.248727] tw686x_audio_irq+0x1a5/0xcc0 [tw686x] [ 3.249211] tw686x_irq+0x1f9/0x480 [tw686x] The lock 'vc->qlock' will be initialized in tw686x_video_init(), but the driver registers the irq before calling the tw686x_video_init(), and we got the warning. Fix this by registering the irq at the end of probe Fixes: 704a84ccdbf1 ("[media] media: Support Intersil/Techwell TW686x-based= video capture cards") Signed-off-by: Zheyu Ma Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/media/pci/tw686x/tw686x-core.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/drivers/media/pci/tw686x/tw686x-core.c b/drivers/media/pci/tw6= 86x/tw686x-core.c index 6676e069b515..384d38754a4b 100644 --- a/drivers/media/pci/tw686x/tw686x-core.c +++ b/drivers/media/pci/tw686x/tw686x-core.c @@ -315,13 +315,6 @@ static int tw686x_probe(struct pci_dev *pci_dev, =20 spin_lock_init(&dev->lock); =20 - err =3D request_irq(pci_dev->irq, tw686x_irq, IRQF_SHARED, - dev->name, dev); - if (err < 0) { - dev_err(&pci_dev->dev, "unable to request interrupt\n"); - goto iounmap; - } - timer_setup(&dev->dma_delay_timer, tw686x_dma_delay, 0); =20 /* @@ -333,18 +326,23 @@ static int tw686x_probe(struct pci_dev *pci_dev, err =3D tw686x_video_init(dev); if (err) { dev_err(&pci_dev->dev, "can't register video\n"); - goto free_irq; + goto iounmap; } =20 err =3D tw686x_audio_init(dev); if (err) dev_warn(&pci_dev->dev, "can't register audio\n"); =20 + err =3D request_irq(pci_dev->irq, tw686x_irq, IRQF_SHARED, + dev->name, dev); + if (err < 0) { + dev_err(&pci_dev->dev, "unable to request interrupt\n"); + goto iounmap; + } + pci_set_drvdata(pci_dev, dev); return 0; =20 -free_irq: - free_irq(pci_dev->irq, dev); iounmap: pci_iounmap(pci_dev, dev->mmio); free_region: --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E88D9C00140 for ; Mon, 15 Aug 2022 18:48:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243605AbiHOSsr (ORCPT ); Mon, 15 Aug 2022 14:48:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243273AbiHOSnj (ORCPT ); Mon, 15 Aug 2022 14:43: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 9B4FA2F664; Mon, 15 Aug 2022 11:26: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 4F8D1B8107A; Mon, 15 Aug 2022 18:26:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4E7CC433D6; Mon, 15 Aug 2022 18:26:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588012; bh=bULFZigN71IgZSrJ/Hx87DvZyhXZUau5RsagxCuLl7c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RzIVuX7qK8Ad7xbG6LEXCfrdQp1A6B7b3prt72H9QEiFrFGomK2Nrh58lwjb8UR4v EZ/ZwMsdm65ulXH+S6e59FVwIzdeJB8DAo1K//LVKiYwz9EUqvASYvVPcAsilMprUF nvz0I9fpiSUy6e9A6YA8tbqefH1l1Wu/VLM4pbTA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Mirela Rabulea , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.15 268/779] media: imx-jpeg: Correct some definition according specification Date: Mon, 15 Aug 2022 19:58:32 +0200 Message-Id: <20220815180348.801515500@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Qian [ Upstream commit 5a601f89e846c1b6005ab274d039e5036fc22015 ] the register CAST_NOMFRSIZE_LO should be equal to CAST_STATUS16 the register CAST_NOMFRSIZE_HI should be equal to CAST_STATUS17 the register CAST_OFBSIZE_LO should be equal to CAST_STATUS18 the register CAST_OFBSIZE_HI should be equal to CAST_STATUS19 Fixes: 2db16c6ed72ce ("media: imx-jpeg: Add V4L2 driver for i.MX8 JPEG Enco= der/Decoder") Signed-off-by: Ming Qian Reviewed-by: Mirela Rabulea Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/media/platform/imx-jpeg/mxc-jpeg-hw.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg-hw.h b/drivers/media/= platform/imx-jpeg/mxc-jpeg-hw.h index ae70d3a0dc24..12f132a83a23 100644 --- a/drivers/media/platform/imx-jpeg/mxc-jpeg-hw.h +++ b/drivers/media/platform/imx-jpeg/mxc-jpeg-hw.h @@ -53,10 +53,10 @@ #define CAST_REC_REGS_SEL CAST_STATUS4 #define CAST_LUMTH CAST_STATUS5 #define CAST_CHRTH CAST_STATUS6 -#define CAST_NOMFRSIZE_LO CAST_STATUS7 -#define CAST_NOMFRSIZE_HI CAST_STATUS8 -#define CAST_OFBSIZE_LO CAST_STATUS9 -#define CAST_OFBSIZE_HI CAST_STATUS10 +#define CAST_NOMFRSIZE_LO CAST_STATUS16 +#define CAST_NOMFRSIZE_HI CAST_STATUS17 +#define CAST_OFBSIZE_LO CAST_STATUS18 +#define CAST_OFBSIZE_HI CAST_STATUS19 =20 #define MXC_MAX_SLOTS 1 /* TODO use all 4 slots*/ /* JPEG-Decoder Wrapper Slot Registers 0..3 */ --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04011C00140 for ; Mon, 15 Aug 2022 18:49:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244026AbiHOSs6 (ORCPT ); Mon, 15 Aug 2022 14:48:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243278AbiHOSnj (ORCPT ); Mon, 15 Aug 2022 14:43:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 571C82F665; Mon, 15 Aug 2022 11:26: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 E797660FA2; Mon, 15 Aug 2022 18:26:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0141C433D6; Mon, 15 Aug 2022 18:26:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588015; bh=iVbT3hOIMXfKnRpHkhG0uTYIVfdh5PIQwHNiNTQL4dY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kg1tdPGQaI7ix/abUgGZCqw/wN41YjUY47BOV7ePnG6iSJ0DUytgJ7qi0JGT3HOm6 qYZWpD5iF9e+eHPgzLKTJFmKI5VTIiLgdovJ+7pSgihwuc1/FmvtwhNvvJYFHhy7A2 AFVsIPf8Uy62bfDkJU+U6Mb5VNjqa2c9Gmcuk5eE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Mirela Rabulea , Tommaso Merciai , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.15 269/779] media: imx-jpeg: Leave a blank space before the configuration data Date: Mon, 15 Aug 2022 19:58:33 +0200 Message-Id: <20220815180348.839768786@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Qian [ Upstream commit 6285cdea19daf764bf00f662a59fc83ef67345cf ] There is a hardware bug that it will load the first 128 bytes of configuration data twice, it will led to some configure error. so shift the configuration data 128 bytes, and make the first 128 bytes all zero, then hardware will load the 128 zero twice, and ignore them as garbage. then the configuration data can be loaded correctly Fixes: 2db16c6ed72ce ("media: imx-jpeg: Add V4L2 driver for i.MX8 JPEG Enco= der/Decoder") Signed-off-by: Ming Qian Reviewed-by: Mirela Rabulea Reviewed-by: Tommaso Merciai Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/media/platform/imx-jpeg/mxc-jpeg.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg.c b/drivers/media/pla= tform/imx-jpeg/mxc-jpeg.c index 37905547466b..5289a822bcb1 100644 --- a/drivers/media/platform/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/imx-jpeg/mxc-jpeg.c @@ -493,6 +493,7 @@ static bool mxc_jpeg_alloc_slot_data(struct mxc_jpeg_de= v *jpeg, GFP_ATOMIC); if (!cfg_stm) goto err; + memset(cfg_stm, 0, MXC_JPEG_MAX_CFG_STREAM); jpeg->slot_data[slot].cfg_stream_vaddr =3D cfg_stm; =20 skip_alloc: @@ -728,7 +729,13 @@ static unsigned int mxc_jpeg_setup_cfg_stream(void *cf= g_stream_vaddr, u32 fourcc, u16 w, u16 h) { - unsigned int offset =3D 0; + /* + * There is a hardware issue that first 128 bytes of configuration data + * can't be loaded correctly. + * To avoid this issue, we need to write the configuration from + * an offset which should be no less than 0x80 (128 bytes). + */ + unsigned int offset =3D 0x80; u8 *cfg =3D (u8 *)cfg_stream_vaddr; struct mxc_jpeg_sof *sof; struct mxc_jpeg_sos *sos; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8392EC00140 for ; Mon, 15 Aug 2022 18:48:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244016AbiHOSsx (ORCPT ); Mon, 15 Aug 2022 14:48:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243284AbiHOSnk (ORCPT ); Mon, 15 Aug 2022 14:43: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 A9F652F666; Mon, 15 Aug 2022 11:26: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 39E3260FCC; Mon, 15 Aug 2022 18:26:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26410C433D7; Mon, 15 Aug 2022 18:26:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588018; bh=bY9QZ16eAawxiTewKuMnGgnKDZ3/A95yXiW9idzT2OM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kp2Fn/zBWnbfbnkiphcDzhnR6K0aYXlBfsgaZZXLMzrMhzFDwOAqBFjicoHR7ZByr jUXaqgQVMfEwrE+zoF6CFkDX3CMzkl2/+L10PKFlKXiePjxjLVpxI0+vcaVgAaMmKy EgyFRs1ymKf3e3u4Gz16LjVzTSrgNSInQJCd5+HQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mirela Rabulea , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.15 270/779] media: imx-jpeg: Add pm-runtime support for imx-jpeg Date: Mon, 15 Aug 2022 19:58:34 +0200 Message-Id: <20220815180348.871974141@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mirela Rabulea [ Upstream commit 4c2e5156d9fa63a3f41c2bf56b694ad42df825d7 ] Save some power by disabling/enabling the jpeg clocks with every stream stop/start. Do not use DL_FLAG_RPM_ACTIVE in mxc_jpeg_attach_pm_domains, to ensure power domains are off after probe. Signed-off-by: Mirela Rabulea Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/media/platform/imx-jpeg/mxc-jpeg.c | 73 +++++++++++++++++++++- drivers/media/platform/imx-jpeg/mxc-jpeg.h | 2 + 2 files changed, 72 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg.c b/drivers/media/pla= tform/imx-jpeg/mxc-jpeg.c index 5289a822bcb1..bc66c09b807a 100644 --- a/drivers/media/platform/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/imx-jpeg/mxc-jpeg.c @@ -49,6 +49,7 @@ #include #include #include +#include #include #include =20 @@ -1074,10 +1075,17 @@ static int mxc_jpeg_start_streaming(struct vb2_queu= e *q, unsigned int count) { struct mxc_jpeg_ctx *ctx =3D vb2_get_drv_priv(q); struct mxc_jpeg_q_data *q_data =3D mxc_jpeg_get_q_data(ctx, q->type); + int ret; =20 dev_dbg(ctx->mxc_jpeg->dev, "Start streaming ctx=3D%p", ctx); q_data->sequence =3D 0; =20 + ret =3D pm_runtime_resume_and_get(ctx->mxc_jpeg->dev); + if (ret < 0) { + dev_err(ctx->mxc_jpeg->dev, "Failed to power up jpeg\n"); + return ret; + } + return 0; } =20 @@ -1095,9 +1103,10 @@ static void mxc_jpeg_stop_streaming(struct vb2_queue= *q) else vbuf =3D v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx); if (!vbuf) - return; + break; v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_ERROR); } + pm_runtime_put_sync(&ctx->mxc_jpeg->pdev->dev); } =20 static int mxc_jpeg_valid_comp_id(struct device *dev, @@ -1957,8 +1966,7 @@ static int mxc_jpeg_attach_pm_domains(struct mxc_jpeg= _dev *jpeg) =20 jpeg->pd_link[i] =3D device_link_add(dev, jpeg->pd_dev[i], DL_FLAG_STATELESS | - DL_FLAG_PM_RUNTIME | - DL_FLAG_RPM_ACTIVE); + DL_FLAG_PM_RUNTIME); if (!jpeg->pd_link[i]) { ret =3D -EINVAL; goto fail; @@ -2023,6 +2031,19 @@ static int mxc_jpeg_probe(struct platform_device *pd= ev) jpeg->dev =3D dev; jpeg->mode =3D mode; =20 + /* Get clocks */ + jpeg->clk_ipg =3D devm_clk_get(dev, "ipg"); + if (IS_ERR(jpeg->clk_ipg)) { + dev_err(dev, "failed to get clock: ipg\n"); + goto err_clk; + } + + jpeg->clk_per =3D devm_clk_get(dev, "per"); + if (IS_ERR(jpeg->clk_per)) { + dev_err(dev, "failed to get clock: per\n"); + goto err_clk; + } + ret =3D mxc_jpeg_attach_pm_domains(jpeg); if (ret < 0) { dev_err(dev, "failed to attach power domains %d\n", ret); @@ -2091,6 +2112,7 @@ static int mxc_jpeg_probe(struct platform_device *pde= v) jpeg->dec_vdev->minor); =20 platform_set_drvdata(pdev, jpeg); + pm_runtime_enable(dev); =20 return 0; =20 @@ -2107,9 +2129,52 @@ static int mxc_jpeg_probe(struct platform_device *pd= ev) mxc_jpeg_detach_pm_domains(jpeg); =20 err_irq: +err_clk: + return ret; +} + +#ifdef CONFIG_PM +static int mxc_jpeg_runtime_resume(struct device *dev) +{ + struct mxc_jpeg_dev *jpeg =3D dev_get_drvdata(dev); + int ret; + + ret =3D clk_prepare_enable(jpeg->clk_ipg); + if (ret < 0) { + dev_err(dev, "failed to enable clock: ipg\n"); + goto err_ipg; + } + + ret =3D clk_prepare_enable(jpeg->clk_per); + if (ret < 0) { + dev_err(dev, "failed to enable clock: per\n"); + goto err_per; + } + + return 0; + +err_per: + clk_disable_unprepare(jpeg->clk_ipg); +err_ipg: return ret; } =20 +static int mxc_jpeg_runtime_suspend(struct device *dev) +{ + struct mxc_jpeg_dev *jpeg =3D dev_get_drvdata(dev); + + clk_disable_unprepare(jpeg->clk_ipg); + clk_disable_unprepare(jpeg->clk_per); + + return 0; +} +#endif + +static const struct dev_pm_ops mxc_jpeg_pm_ops =3D { + SET_RUNTIME_PM_OPS(mxc_jpeg_runtime_suspend, + mxc_jpeg_runtime_resume, NULL) +}; + static int mxc_jpeg_remove(struct platform_device *pdev) { unsigned int slot; @@ -2118,6 +2183,7 @@ static int mxc_jpeg_remove(struct platform_device *pd= ev) for (slot =3D 0; slot < MXC_MAX_SLOTS; slot++) mxc_jpeg_free_slot_data(jpeg, slot); =20 + pm_runtime_disable(&pdev->dev); video_unregister_device(jpeg->dec_vdev); v4l2_m2m_release(jpeg->m2m_dev); v4l2_device_unregister(&jpeg->v4l2_dev); @@ -2134,6 +2200,7 @@ static struct platform_driver mxc_jpeg_driver =3D { .driver =3D { .name =3D "mxc-jpeg", .of_match_table =3D mxc_jpeg_match, + .pm =3D &mxc_jpeg_pm_ops, }, }; module_platform_driver(mxc_jpeg_driver); diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg.h b/drivers/media/pla= tform/imx-jpeg/mxc-jpeg.h index 4c210852e876..9fb2a5aaa941 100644 --- a/drivers/media/platform/imx-jpeg/mxc-jpeg.h +++ b/drivers/media/platform/imx-jpeg/mxc-jpeg.h @@ -109,6 +109,8 @@ struct mxc_jpeg_dev { spinlock_t hw_lock; /* hardware access lock */ unsigned int mode; struct mutex lock; /* v4l2 ioctls serialization */ + struct clk *clk_ipg; + struct clk *clk_per; struct platform_device *pdev; struct device *dev; void __iomem *base_reg; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D8D6C00140 for ; Mon, 15 Aug 2022 18:49:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244029AbiHOStC (ORCPT ); Mon, 15 Aug 2022 14:49:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243301AbiHOSno (ORCPT ); Mon, 15 Aug 2022 14:43:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA3BF2F667; Mon, 15 Aug 2022 11:27: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 5F2AF60FA2; Mon, 15 Aug 2022 18:27:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69524C433C1; Mon, 15 Aug 2022 18:27:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588021; bh=o+CfgAyj9rPLk8ZM6G7S0zQl0iS1yoI3dsi9OirsY7s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xKoPm8gmfl015jRxmOoYPwPioT1GuPhRNtH402ldaMk4RsbXeHAzChBXCvrT4Xj3r fTUUekLYKxBIv6Zd8F1qAS+ayOoN3NK1AhrWchrlaeysR7EirQcdUmS4k0YWbN9AK4 hFQTeAjJPIfHfCuDvqSldsGlZe4QNfKcvrspLKcw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Shijie Qin , Zhou Peng , Mirela Rabulea , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.15 271/779] media: imx-jpeg: use NV12M to represent non contiguous NV12 Date: Mon, 15 Aug 2022 19:58:35 +0200 Message-Id: <20220815180348.911162679@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Qian [ Upstream commit 784a1883cff07e7510a81ad3041d6ec443d51944 ] V4L2_PIX_FMT_NV12 requires num_planes equals to 1, V4L2_PIX_FMT_NV12M requires num_planes equals to 2. and mxc-jpeg supports 2 planes for nv12, so we should use 4L2_PIX_FMT_NV12M instead of V4L2_PIX_FMT_NV12, otherwise it will confuses gstreamer and prevent encoding and decoding. Signed-off-by: Ming Qian Signed-off-by: Shijie Qin Signed-off-by: Zhou Peng Reviewed-by: Mirela Rabulea Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/media/platform/imx-jpeg/mxc-jpeg.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg.c b/drivers/media/pla= tform/imx-jpeg/mxc-jpeg.c index bc66c09b807a..1ec60f54d5a1 100644 --- a/drivers/media/platform/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/imx-jpeg/mxc-jpeg.c @@ -96,7 +96,7 @@ static const struct mxc_jpeg_fmt mxc_formats[] =3D { }, { .name =3D "YUV420", /* 1st plane =3D Y, 2nd plane =3D UV */ - .fourcc =3D V4L2_PIX_FMT_NV12, + .fourcc =3D V4L2_PIX_FMT_NV12M, .subsampling =3D V4L2_JPEG_CHROMA_SUBSAMPLING_420, .nc =3D 3, .depth =3D 12, /* 6 bytes (4Y + UV) for 4 pixels */ @@ -390,7 +390,7 @@ static enum mxc_jpeg_image_format mxc_jpeg_fourcc_to_im= gfmt(u32 fourcc) return MXC_JPEG_GRAY; case V4L2_PIX_FMT_YUYV: return MXC_JPEG_YUV422; - case V4L2_PIX_FMT_NV12: + case V4L2_PIX_FMT_NV12M: return MXC_JPEG_YUV420; case V4L2_PIX_FMT_YUV24: return MXC_JPEG_YUV444; @@ -660,7 +660,7 @@ static int mxc_jpeg_fixup_sof(struct mxc_jpeg_sof *sof, _bswap16(&sof->width); =20 switch (fourcc) { - case V4L2_PIX_FMT_NV12: + case V4L2_PIX_FMT_NV12M: sof->components_no =3D 3; sof->comp[0].v =3D 0x2; sof->comp[0].h =3D 0x2; @@ -696,7 +696,7 @@ static int mxc_jpeg_fixup_sos(struct mxc_jpeg_sos *sos, u8 *sof_u8 =3D (u8 *)sos; =20 switch (fourcc) { - case V4L2_PIX_FMT_NV12: + case V4L2_PIX_FMT_NV12M: sos->components_no =3D 3; break; case V4L2_PIX_FMT_YUYV: @@ -1179,7 +1179,7 @@ static void mxc_jpeg_bytesperline(struct mxc_jpeg_q_d= ata *q, /* bytesperline unused for compressed formats */ q->bytesperline[0] =3D 0; q->bytesperline[1] =3D 0; - } else if (q->fmt->fourcc =3D=3D V4L2_PIX_FMT_NV12) { + } else if (q->fmt->fourcc =3D=3D V4L2_PIX_FMT_NV12M) { /* When the image format is planar the bytesperline value * applies to the first plane and is divided by the same factor * as the width field for the other planes @@ -1211,7 +1211,7 @@ static void mxc_jpeg_sizeimage(struct mxc_jpeg_q_data= *q) } else { q->sizeimage[0] =3D q->bytesperline[0] * q->h; q->sizeimage[1] =3D 0; - if (q->fmt->fourcc =3D=3D V4L2_PIX_FMT_NV12) + if (q->fmt->fourcc =3D=3D V4L2_PIX_FMT_NV12M) q->sizeimage[1] =3D q->sizeimage[0] / 2; } } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C02C4C00140 for ; Mon, 15 Aug 2022 18:49:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243818AbiHOStN (ORCPT ); Mon, 15 Aug 2022 14:49:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243330AbiHOSnq (ORCPT ); Mon, 15 Aug 2022 14:43: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 E03362B63C; Mon, 15 Aug 2022 11:27: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 98AC6B8107B; Mon, 15 Aug 2022 18:27:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CAF56C433C1; Mon, 15 Aug 2022 18:27:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588025; bh=s6hE0dcnfjRm35xl0ubYTMLoz5IO6Zpumb/khgzk3bk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1l+n3fBRBxgolpTG5vljKLLskcNfcvuDAW1AEzkGrJbtJ0waFbWS/Z021OJ2VWsZV GVmkEMQ3M7onp45OsDkkfLlJKNSTdET6oxzjgHIuNPMptTUGuiw82II5eMryB0cJr3 cbJHXMQqnukqIF7x9HVJi4o96b2qvTZWB3A8p3cs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Mirela Rabulea , Hans Verkuil , Sasha Levin Subject: [PATCH 5.15 272/779] media: imx-jpeg: Set V4L2_BUF_FLAG_LAST at eos Date: Mon, 15 Aug 2022 19:58:36 +0200 Message-Id: <20220815180348.943426094@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Qian [ Upstream commit d8ebe298d008ccbae3011cbeb139707f01a730c8 ] The V4L2_EVENT_EOS event is a deprecated behavior, the V4L2_BUF_FLAG_LAST buffer flag should be used instead. Signed-off-by: Ming Qian Reviewed-by: Mirela Rabulea Signed-off-by: Hans Verkuil Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/media/platform/imx-jpeg/mxc-jpeg.c | 41 ++++++++++++++++++++-- drivers/media/platform/imx-jpeg/mxc-jpeg.h | 1 + 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg.c b/drivers/media/pla= tform/imx-jpeg/mxc-jpeg.c index 1ec60f54d5a1..2d0c1307180f 100644 --- a/drivers/media/platform/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/imx-jpeg/mxc-jpeg.c @@ -988,6 +988,20 @@ static void mxc_jpeg_device_run(void *priv) spin_unlock_irqrestore(&ctx->mxc_jpeg->hw_lock, flags); } =20 +static void mxc_jpeg_set_last_buffer_dequeued(struct mxc_jpeg_ctx *ctx) +{ + struct vb2_queue *q; + + ctx->stopped =3D 1; + q =3D v4l2_m2m_get_dst_vq(ctx->fh.m2m_ctx); + if (!list_empty(&q->done_list)) + return; + + q->last_buffer_dequeued =3D true; + wake_up(&q->done_wq); + ctx->stopped =3D 0; +} + static int mxc_jpeg_decoder_cmd(struct file *file, void *priv, struct v4l2_decoder_cmd *cmd) { @@ -1005,6 +1019,7 @@ static int mxc_jpeg_decoder_cmd(struct file *file, vo= id *priv, if (v4l2_m2m_num_src_bufs_ready(fh->m2m_ctx) =3D=3D 0) { /* No more src bufs, notify app EOS */ notify_eos(ctx); + mxc_jpeg_set_last_buffer_dequeued(ctx); } else { /* will send EOS later*/ ctx->stopping =3D 1; @@ -1031,6 +1046,7 @@ static int mxc_jpeg_encoder_cmd(struct file *file, vo= id *priv, if (v4l2_m2m_num_src_bufs_ready(fh->m2m_ctx) =3D=3D 0) { /* No more src bufs, notify app EOS */ notify_eos(ctx); + mxc_jpeg_set_last_buffer_dequeued(ctx); } else { /* will send EOS later*/ ctx->stopping =3D 1; @@ -1107,6 +1123,10 @@ static void mxc_jpeg_stop_streaming(struct vb2_queue= *q) v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_ERROR); } pm_runtime_put_sync(&ctx->mxc_jpeg->pdev->dev); + if (V4L2_TYPE_IS_OUTPUT(q->type)) { + ctx->stopping =3D 0; + ctx->stopped =3D 0; + } } =20 static int mxc_jpeg_valid_comp_id(struct device *dev, @@ -1398,12 +1418,29 @@ static int mxc_jpeg_buf_prepare(struct vb2_buffer *= vb) return 0; } =20 +static void mxc_jpeg_buf_finish(struct vb2_buffer *vb) +{ + struct vb2_v4l2_buffer *vbuf =3D to_vb2_v4l2_buffer(vb); + struct mxc_jpeg_ctx *ctx =3D vb2_get_drv_priv(vb->vb2_queue); + struct vb2_queue *q =3D vb->vb2_queue; + + if (V4L2_TYPE_IS_OUTPUT(vb->type)) + return; + if (!ctx->stopped) + return; + if (list_empty(&q->done_list)) { + vbuf->flags |=3D V4L2_BUF_FLAG_LAST; + ctx->stopped =3D 0; + } +} + static const struct vb2_ops mxc_jpeg_qops =3D { .queue_setup =3D mxc_jpeg_queue_setup, .wait_prepare =3D vb2_ops_wait_prepare, .wait_finish =3D vb2_ops_wait_finish, .buf_out_validate =3D mxc_jpeg_buf_out_validate, .buf_prepare =3D mxc_jpeg_buf_prepare, + .buf_finish =3D mxc_jpeg_buf_finish, .start_streaming =3D mxc_jpeg_start_streaming, .stop_streaming =3D mxc_jpeg_stop_streaming, .buf_queue =3D mxc_jpeg_buf_queue, @@ -1839,14 +1876,14 @@ static int mxc_jpeg_dqbuf(struct file *file, void *= priv, int ret; =20 dev_dbg(dev, "DQBUF type=3D%d, index=3D%d", buf->type, buf->index); - if (ctx->stopping =3D=3D 1 && num_src_ready =3D=3D 0) { + if (ctx->stopping =3D=3D 1 && num_src_ready =3D=3D 0) { /* No more src bufs, notify app EOS */ notify_eos(ctx); ctx->stopping =3D 0; + mxc_jpeg_set_last_buffer_dequeued(ctx); } =20 ret =3D v4l2_m2m_dqbuf(file, fh->m2m_ctx, buf); - return ret; } =20 diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg.h b/drivers/media/pla= tform/imx-jpeg/mxc-jpeg.h index 9fb2a5aaa941..f53f004ba851 100644 --- a/drivers/media/platform/imx-jpeg/mxc-jpeg.h +++ b/drivers/media/platform/imx-jpeg/mxc-jpeg.h @@ -91,6 +91,7 @@ struct mxc_jpeg_ctx { struct v4l2_fh fh; enum mxc_jpeg_enc_state enc_state; unsigned int stopping; + unsigned int stopped; unsigned int slot; }; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B8EAC00140 for ; Mon, 15 Aug 2022 18:49:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243832AbiHOStS (ORCPT ); Mon, 15 Aug 2022 14:49:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243344AbiHOSnt (ORCPT ); Mon, 15 Aug 2022 14:43:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84B912F66B; Mon, 15 Aug 2022 11:27: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 21F4B60FC4; Mon, 15 Aug 2022 18:27:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14834C433D7; Mon, 15 Aug 2022 18:27:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588028; bh=lnkl56a31MbvW6ouXWsb6NWSAKbk0Xa/VASYs6iBCg0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zHbM7MXTHaHuNWxcT0J2sRXEEM8TaIg3Qx/dwsm7Oh3lvgtFCO8S+aLpbXiJNQRLp Y95j4eA4ENVN4GvE3OO1lrkX62RVGbT4liTBeeMsXfYafZRrbgu+5FHLghxW/u3lAZ NCK/wfmTAHGQCfgfaeEfTUpVyOHt13zA0AVYBVeE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Mirela Rabulea , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.15 273/779] media: imx-jpeg: Refactor function mxc_jpeg_parse Date: Mon, 15 Aug 2022 19:58:37 +0200 Message-Id: <20220815180348.974481341@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Qian [ Upstream commit 8dd504a3a0a5f73b4c137ce3afc35936a4ecd871 ] Refine code to support dynamic resolution change Signed-off-by: Ming Qian Reviewed-by: Mirela Rabulea Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/media/platform/imx-jpeg/mxc-jpeg.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg.c b/drivers/media/pla= tform/imx-jpeg/mxc-jpeg.c index 2d0c1307180f..5064a994a42e 100644 --- a/drivers/media/platform/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/imx-jpeg/mxc-jpeg.c @@ -1236,8 +1236,7 @@ static void mxc_jpeg_sizeimage(struct mxc_jpeg_q_data= *q) } } =20 -static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx, - u8 *src_addr, u32 size, bool *dht_needed) +static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx, struct vb2_buffer *vb) { struct device *dev =3D ctx->mxc_jpeg->dev; struct mxc_jpeg_q_data *q_data_out, *q_data_cap; @@ -1247,6 +1246,9 @@ static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx, struct v4l2_jpeg_header header; struct mxc_jpeg_sof *psof =3D NULL; struct mxc_jpeg_sos *psos =3D NULL; + struct mxc_jpeg_src_buf *jpeg_src_buf =3D vb2_to_mxc_buf(vb); + u8 *src_addr =3D (u8 *)vb2_plane_vaddr(vb, 0); + u32 size =3D vb2_get_plane_payload(vb, 0); int ret; =20 memset(&header, 0, sizeof(header)); @@ -1257,7 +1259,7 @@ static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx, } =20 /* if DHT marker present, no need to inject default one */ - *dht_needed =3D (header.num_dht =3D=3D 0); + jpeg_src_buf->dht_needed =3D (header.num_dht =3D=3D 0); =20 q_data_out =3D mxc_jpeg_get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE); @@ -1372,10 +1374,7 @@ static void mxc_jpeg_buf_queue(struct vb2_buffer *vb) =20 jpeg_src_buf =3D vb2_to_mxc_buf(vb); jpeg_src_buf->jpeg_parse_error =3D false; - ret =3D mxc_jpeg_parse(ctx, - (u8 *)vb2_plane_vaddr(vb, 0), - vb2_get_plane_payload(vb, 0), - &jpeg_src_buf->dht_needed); + ret =3D mxc_jpeg_parse(ctx, vb); if (ret) jpeg_src_buf->jpeg_parse_error =3D true; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D25E6C00140 for ; Mon, 15 Aug 2022 18:49:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243859AbiHOSt2 (ORCPT ); Mon, 15 Aug 2022 14:49:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243350AbiHOSnt (ORCPT ); Mon, 15 Aug 2022 14:43:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 944602BB07; Mon, 15 Aug 2022 11:27:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 31AC060EEB; Mon, 15 Aug 2022 18:27:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2965FC433D6; Mon, 15 Aug 2022 18:27:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588031; bh=PKc2T3fY74EMGaI7u7Ln8IptTYkyGTfoHS2qJcdxyHY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dz4046sqwLvf8mABX5eY63Yp+4/M7kPH9k+u2TXw68CnKmwHS/ErM0463bqx4Yyhk wU6aB6EJkPt2VNOhnJac7/59ck5Zc8zgdlJ31AoIaZu+iWo05R5QvLipW7MgShLfSe Ze5jjNE9SCbqvcTjyNO9cHBnhbF96ZgpqT3OEa00= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Mirela Rabulea , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.15 274/779] media: imx-jpeg: Identify and handle precision correctly Date: Mon, 15 Aug 2022 19:58:38 +0200 Message-Id: <20220815180349.020193615@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Qian [ Upstream commit bec0a3a67389ede106d0661a007edf832878d8b2 ] The decoder will save the precision that was detected from jpeg header and use it later, when choosing the pixel format and also calculate bytesperline according to precision. The 12bit jpeg is not supported yet, but driver shouldn't led to serious problem if user enqueue a 12 bit jpeg. And the 12bit jpeg is supported by hardware, driver may support it later. [hverkuil: document the new precision field] Signed-off-by: Ming Qian Reviewed-by: Mirela Rabulea Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/media/platform/imx-jpeg/mxc-jpeg.c | 37 +++++++++++++++------- drivers/media/platform/imx-jpeg/mxc-jpeg.h | 2 ++ 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg.c b/drivers/media/pla= tform/imx-jpeg/mxc-jpeg.c index 5064a994a42e..718de999987e 100644 --- a/drivers/media/platform/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/imx-jpeg/mxc-jpeg.c @@ -82,6 +82,7 @@ static const struct mxc_jpeg_fmt mxc_formats[] =3D { .h_align =3D 3, .v_align =3D 3, .flags =3D MXC_JPEG_FMT_TYPE_RAW, + .precision =3D 8, }, { .name =3D "ARGB", /* ARGBARGB packed format */ @@ -93,6 +94,7 @@ static const struct mxc_jpeg_fmt mxc_formats[] =3D { .h_align =3D 3, .v_align =3D 3, .flags =3D MXC_JPEG_FMT_TYPE_RAW, + .precision =3D 8, }, { .name =3D "YUV420", /* 1st plane =3D Y, 2nd plane =3D UV */ @@ -104,6 +106,7 @@ static const struct mxc_jpeg_fmt mxc_formats[] =3D { .h_align =3D 4, .v_align =3D 4, .flags =3D MXC_JPEG_FMT_TYPE_RAW, + .precision =3D 8, }, { .name =3D "YUV422", /* YUYV */ @@ -115,6 +118,7 @@ static const struct mxc_jpeg_fmt mxc_formats[] =3D { .h_align =3D 4, .v_align =3D 3, .flags =3D MXC_JPEG_FMT_TYPE_RAW, + .precision =3D 8, }, { .name =3D "YUV444", /* YUVYUV */ @@ -126,6 +130,7 @@ static const struct mxc_jpeg_fmt mxc_formats[] =3D { .h_align =3D 3, .v_align =3D 3, .flags =3D MXC_JPEG_FMT_TYPE_RAW, + .precision =3D 8, }, { .name =3D "Gray", /* Gray (Y8/Y12) or Single Comp */ @@ -137,6 +142,7 @@ static const struct mxc_jpeg_fmt mxc_formats[] =3D { .h_align =3D 3, .v_align =3D 3, .flags =3D MXC_JPEG_FMT_TYPE_RAW, + .precision =3D 8, }, }; =20 @@ -1166,14 +1172,17 @@ static u32 mxc_jpeg_get_image_format(struct device = *dev, =20 for (i =3D 0; i < MXC_JPEG_NUM_FORMATS; i++) if (mxc_formats[i].subsampling =3D=3D header->frame.subsampling && - mxc_formats[i].nc =3D=3D header->frame.num_components) { + mxc_formats[i].nc =3D=3D header->frame.num_components && + mxc_formats[i].precision =3D=3D header->frame.precision) { fourcc =3D mxc_formats[i].fourcc; break; } if (fourcc =3D=3D 0) { - dev_err(dev, "Could not identify image format nc=3D%d, subsampling=3D%d\= n", + dev_err(dev, + "Could not identify image format nc=3D%d, subsampling=3D%d, precision= =3D%d\n", header->frame.num_components, - header->frame.subsampling); + header->frame.subsampling, + header->frame.precision); return fourcc; } /* @@ -1199,18 +1208,22 @@ static void mxc_jpeg_bytesperline(struct mxc_jpeg_q= _data *q, /* bytesperline unused for compressed formats */ q->bytesperline[0] =3D 0; q->bytesperline[1] =3D 0; - } else if (q->fmt->fourcc =3D=3D V4L2_PIX_FMT_NV12M) { + } else if (q->fmt->subsampling =3D=3D V4L2_JPEG_CHROMA_SUBSAMPLING_420) { /* When the image format is planar the bytesperline value * applies to the first plane and is divided by the same factor * as the width field for the other planes */ - q->bytesperline[0] =3D q->w * (precision / 8) * - (q->fmt->depth / 8); + q->bytesperline[0] =3D q->w * DIV_ROUND_UP(precision, 8); q->bytesperline[1] =3D q->bytesperline[0]; + } else if (q->fmt->subsampling =3D=3D V4L2_JPEG_CHROMA_SUBSAMPLING_422) { + q->bytesperline[0] =3D q->w * DIV_ROUND_UP(precision, 8) * 2; + q->bytesperline[1] =3D 0; + } else if (q->fmt->subsampling =3D=3D V4L2_JPEG_CHROMA_SUBSAMPLING_444) { + q->bytesperline[0] =3D q->w * DIV_ROUND_UP(precision, 8) * q->fmt->nc; + q->bytesperline[1] =3D 0; } else { - /* single plane formats */ - q->bytesperline[0] =3D q->w * (precision / 8) * - (q->fmt->depth / 8); + /* grayscale */ + q->bytesperline[0] =3D q->w * DIV_ROUND_UP(precision, 8); q->bytesperline[1] =3D 0; } } @@ -1344,7 +1357,7 @@ static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx, s= truct vb2_buffer *vb) (fourcc >> 24) & 0xff); =20 /* setup bytesperline/sizeimage for capture queue */ - mxc_jpeg_bytesperline(q_data_cap, header.frame.precision); + mxc_jpeg_bytesperline(q_data_cap, q_data_cap->fmt->precision); mxc_jpeg_sizeimage(q_data_cap); =20 /* @@ -1500,7 +1513,7 @@ static void mxc_jpeg_set_default_params(struct mxc_jp= eg_ctx *ctx) q[i]->h =3D MXC_JPEG_DEFAULT_HEIGHT; q[i]->w_adjusted =3D MXC_JPEG_DEFAULT_WIDTH; q[i]->h_adjusted =3D MXC_JPEG_DEFAULT_HEIGHT; - mxc_jpeg_bytesperline(q[i], 8); + mxc_jpeg_bytesperline(q[i], q[i]->fmt->precision); mxc_jpeg_sizeimage(q[i]); } } @@ -1642,7 +1655,7 @@ static int mxc_jpeg_try_fmt(struct v4l2_format *f, co= nst struct mxc_jpeg_fmt *fm } =20 /* calculate bytesperline & sizeimage into the tmp_q */ - mxc_jpeg_bytesperline(&tmp_q, 8); + mxc_jpeg_bytesperline(&tmp_q, fmt->precision); mxc_jpeg_sizeimage(&tmp_q); =20 /* adjust user format according to our calculations */ diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg.h b/drivers/media/pla= tform/imx-jpeg/mxc-jpeg.h index f53f004ba851..2b4b30d01e51 100644 --- a/drivers/media/platform/imx-jpeg/mxc-jpeg.h +++ b/drivers/media/platform/imx-jpeg/mxc-jpeg.h @@ -49,6 +49,7 @@ enum mxc_jpeg_mode { * @h_align: horizontal alignment order (align to 2^h_align) * @v_align: vertical alignment order (align to 2^v_align) * @flags: flags describing format applicability + * @precision: jpeg sample precision */ struct mxc_jpeg_fmt { const char *name; @@ -60,6 +61,7 @@ struct mxc_jpeg_fmt { int h_align; int v_align; u32 flags; + u8 precision; }; =20 struct mxc_jpeg_desc { --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FB71C00140 for ; Mon, 15 Aug 2022 18:50:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244107AbiHOSt5 (ORCPT ); Mon, 15 Aug 2022 14:49:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243519AbiHOSom (ORCPT ); Mon, 15 Aug 2022 14:44: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 39B0D2FFE7; Mon, 15 Aug 2022 11:27:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 62E24B8107B; Mon, 15 Aug 2022 18:27:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9495DC433D6; Mon, 15 Aug 2022 18:27:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588038; bh=hlUezt4dDe5NSypX1nefqTVbi2t5LWEChRAf2JC1sIc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X+t/oMifAe1S47VKneEAstlcIgWcoC8Oyc5Ip9e2lf0KNp5PF24yOOtdmNsqfDja4 h/Jhz8ujZO7bPL3ac3IfWJbdHnGMZEtR7uZA6CmUCBj1oDF/5WwuvbVwtKsvIp/zx2 l5VJCjaFdEbYcEReHvKTXFTGEA9taZUQffCFDCy4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Mirela Rabulea , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.15 275/779] media: imx-jpeg: Handle source change in a function Date: Mon, 15 Aug 2022 19:58:39 +0200 Message-Id: <20220815180349.062957517@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Qian [ Upstream commit 831f87424dd3973612782983ef7352789795b4df ] Refine code to support dynamic resolution change Signed-off-by: Ming Qian Reviewed-by: Mirela Rabulea Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/media/platform/imx-jpeg/mxc-jpeg.c | 114 ++++++++++++--------- 1 file changed, 65 insertions(+), 49 deletions(-) diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg.c b/drivers/media/pla= tform/imx-jpeg/mxc-jpeg.c index 718de999987e..6289fec6e2a0 100644 --- a/drivers/media/platform/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/imx-jpeg/mxc-jpeg.c @@ -301,6 +301,9 @@ struct mxc_jpeg_src_buf { /* mxc-jpeg specific */ bool dht_needed; bool jpeg_parse_error; + const struct mxc_jpeg_fmt *fmt; + int w; + int h; }; =20 static inline struct mxc_jpeg_src_buf *vb2_to_mxc_buf(struct vb2_buffer *v= b) @@ -313,6 +316,9 @@ static unsigned int debug; module_param(debug, int, 0644); MODULE_PARM_DESC(debug, "Debug level (0-3)"); =20 +static void mxc_jpeg_bytesperline(struct mxc_jpeg_q_data *q, u32 precision= ); +static void mxc_jpeg_sizeimage(struct mxc_jpeg_q_data *q); + static void _bswap16(u16 *a) { *a =3D ((*a & 0x00FF) << 8) | ((*a & 0xFF00) >> 8); @@ -908,6 +914,59 @@ static void mxc_jpeg_config_enc_desc(struct vb2_buffer= *out_buf, mxc_jpeg_set_desc(cfg_desc_handle, reg, slot); } =20 +static bool mxc_jpeg_source_change(struct mxc_jpeg_ctx *ctx, + struct mxc_jpeg_src_buf *jpeg_src_buf) +{ + struct device *dev =3D ctx->mxc_jpeg->dev; + struct mxc_jpeg_q_data *q_data_cap; + bool src_chg =3D false; + + if (!jpeg_src_buf->fmt) + return src_chg; + + q_data_cap =3D mxc_jpeg_get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); + if (q_data_cap->w !=3D jpeg_src_buf->w || q_data_cap->h !=3D jpeg_src_buf= ->h) { + dev_dbg(dev, "Detected jpeg res=3D(%dx%d)->(%dx%d), pixfmt=3D%c%c%c%c\n", + q_data_cap->w, q_data_cap->h, + jpeg_src_buf->w, jpeg_src_buf->h, + (jpeg_src_buf->fmt->fourcc & 0xff), + (jpeg_src_buf->fmt->fourcc >> 8) & 0xff, + (jpeg_src_buf->fmt->fourcc >> 16) & 0xff, + (jpeg_src_buf->fmt->fourcc >> 24) & 0xff); + + /* + * set-up the capture queue with the pixelformat and resolution + * detected from the jpeg output stream + */ + q_data_cap->w =3D jpeg_src_buf->w; + q_data_cap->h =3D jpeg_src_buf->h; + q_data_cap->fmt =3D jpeg_src_buf->fmt; + q_data_cap->w_adjusted =3D q_data_cap->w; + q_data_cap->h_adjusted =3D q_data_cap->h; + + /* + * align up the resolution for CAST IP, + * but leave the buffer resolution unchanged + */ + v4l_bound_align_image(&q_data_cap->w_adjusted, + q_data_cap->w_adjusted, /* adjust up */ + MXC_JPEG_MAX_WIDTH, + q_data_cap->fmt->h_align, + &q_data_cap->h_adjusted, + q_data_cap->h_adjusted, /* adjust up */ + MXC_JPEG_MAX_HEIGHT, + q_data_cap->fmt->v_align, + 0); + + /* setup bytesperline/sizeimage for capture queue */ + mxc_jpeg_bytesperline(q_data_cap, jpeg_src_buf->fmt->precision); + mxc_jpeg_sizeimage(q_data_cap); + notify_src_chg(ctx); + src_chg =3D true; + } + return src_chg; +} + static void mxc_jpeg_device_run(void *priv) { struct mxc_jpeg_ctx *ctx =3D priv; @@ -1200,8 +1259,7 @@ static u32 mxc_jpeg_get_image_format(struct device *d= ev, return fourcc; } =20 -static void mxc_jpeg_bytesperline(struct mxc_jpeg_q_data *q, - u32 precision) +static void mxc_jpeg_bytesperline(struct mxc_jpeg_q_data *q, u32 precision) { /* Bytes distance between the leftmost pixels in two adjacent lines */ if (q->fmt->fourcc =3D=3D V4L2_PIX_FMT_JPEG) { @@ -1252,9 +1310,7 @@ static void mxc_jpeg_sizeimage(struct mxc_jpeg_q_data= *q) static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx, struct vb2_buffer *vb) { struct device *dev =3D ctx->mxc_jpeg->dev; - struct mxc_jpeg_q_data *q_data_out, *q_data_cap; - enum v4l2_buf_type cap_type =3D V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; - bool src_chg =3D false; + struct mxc_jpeg_q_data *q_data_out; u32 fourcc; struct v4l2_jpeg_header header; struct mxc_jpeg_sof *psof =3D NULL; @@ -1322,51 +1378,11 @@ static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx,= struct vb2_buffer *vb) if (fourcc =3D=3D 0) return -EINVAL; =20 - /* - * set-up the capture queue with the pixelformat and resolution - * detected from the jpeg output stream - */ - q_data_cap =3D mxc_jpeg_get_q_data(ctx, cap_type); - if (q_data_cap->w !=3D header.frame.width || - q_data_cap->h !=3D header.frame.height) - src_chg =3D true; - q_data_cap->w =3D header.frame.width; - q_data_cap->h =3D header.frame.height; - q_data_cap->fmt =3D mxc_jpeg_find_format(ctx, fourcc); - q_data_cap->w_adjusted =3D q_data_cap->w; - q_data_cap->h_adjusted =3D q_data_cap->h; - /* - * align up the resolution for CAST IP, - * but leave the buffer resolution unchanged - */ - v4l_bound_align_image(&q_data_cap->w_adjusted, - q_data_cap->w_adjusted, /* adjust up */ - MXC_JPEG_MAX_WIDTH, - q_data_cap->fmt->h_align, - &q_data_cap->h_adjusted, - q_data_cap->h_adjusted, /* adjust up */ - MXC_JPEG_MAX_HEIGHT, - q_data_cap->fmt->v_align, - 0); - dev_dbg(dev, "Detected jpeg res=3D(%dx%d)->(%dx%d), pixfmt=3D%c%c%c%c\n", - q_data_cap->w, q_data_cap->h, - q_data_cap->w_adjusted, q_data_cap->h_adjusted, - (fourcc & 0xff), - (fourcc >> 8) & 0xff, - (fourcc >> 16) & 0xff, - (fourcc >> 24) & 0xff); - - /* setup bytesperline/sizeimage for capture queue */ - mxc_jpeg_bytesperline(q_data_cap, q_data_cap->fmt->precision); - mxc_jpeg_sizeimage(q_data_cap); + jpeg_src_buf->fmt =3D mxc_jpeg_find_format(ctx, fourcc); + jpeg_src_buf->w =3D header.frame.width; + jpeg_src_buf->h =3D header.frame.height; =20 - /* - * if the CAPTURE format was updated with new values, regardless of - * whether they match the values set by the client or not, signal - * a source change event - */ - if (src_chg) - notify_src_chg(ctx); + mxc_jpeg_source_change(ctx, jpeg_src_buf); =20 return 0; } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66F5EC00140 for ; Mon, 15 Aug 2022 18:49:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244102AbiHOStx (ORCPT ); Mon, 15 Aug 2022 14:49:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243526AbiHOSon (ORCPT ); Mon, 15 Aug 2022 14:44:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48E0F2FFEB; Mon, 15 Aug 2022 11:27: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 9CCCC60691; Mon, 15 Aug 2022 18:27:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91671C433D7; Mon, 15 Aug 2022 18:27:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588041; bh=fiSO3jBXEXqACFFwooF7XCH3mk6KVEXM0hjIHuOLFAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KRMH/QD0757lpsEF8wifgF8lUFhkQ+5nSv1Zo3QFrDrvNa2NQkzWP/yAhQhWpNO2A gA+DOwnMw7S2jpocRnuMN+prDQaCwFlIzTmRTdBKGiICdxeiBrG2n5LIqNuikHoIgP jcpPPas2kGThICUf0z7cbS7Mmr5PkihvfrK1ucrI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Mirela Rabulea , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.15 276/779] media: imx-jpeg: Support dynamic resolution change Date: Mon, 15 Aug 2022 19:58:40 +0200 Message-Id: <20220815180349.102600750@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Qian [ Upstream commit b4e1fb8643daabba850e97df532191acffc23e6a ] To support dynamic resolution change, driver should meet the following conditions: 1. the previous pictures are all decoded before source change event. 2. prevent decoding new resolution pictures with incorrect capture buffer, until user handle source change event and setup capture. 3. report correct fmt and resolution during source change. Signed-off-by: Ming Qian Reviewed-by: Mirela Rabulea Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/media/platform/imx-jpeg/mxc-jpeg.c | 69 +++++++++++++++++----- drivers/media/platform/imx-jpeg/mxc-jpeg.h | 2 + 2 files changed, 55 insertions(+), 16 deletions(-) diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg.c b/drivers/media/pla= tform/imx-jpeg/mxc-jpeg.c index 6289fec6e2a0..52732fbb2664 100644 --- a/drivers/media/platform/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/imx-jpeg/mxc-jpeg.c @@ -919,13 +919,14 @@ static bool mxc_jpeg_source_change(struct mxc_jpeg_ct= x *ctx, { struct device *dev =3D ctx->mxc_jpeg->dev; struct mxc_jpeg_q_data *q_data_cap; - bool src_chg =3D false; =20 if (!jpeg_src_buf->fmt) - return src_chg; + return false; =20 q_data_cap =3D mxc_jpeg_get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_CAPTURE); - if (q_data_cap->w !=3D jpeg_src_buf->w || q_data_cap->h !=3D jpeg_src_buf= ->h) { + if (q_data_cap->fmt !=3D jpeg_src_buf->fmt || + q_data_cap->w !=3D jpeg_src_buf->w || + q_data_cap->h !=3D jpeg_src_buf->h) { dev_dbg(dev, "Detected jpeg res=3D(%dx%d)->(%dx%d), pixfmt=3D%c%c%c%c\n", q_data_cap->w, q_data_cap->h, jpeg_src_buf->w, jpeg_src_buf->h, @@ -962,9 +963,16 @@ static bool mxc_jpeg_source_change(struct mxc_jpeg_ctx= *ctx, mxc_jpeg_bytesperline(q_data_cap, jpeg_src_buf->fmt->precision); mxc_jpeg_sizeimage(q_data_cap); notify_src_chg(ctx); - src_chg =3D true; + ctx->source_change =3D 1; } - return src_chg; + return ctx->source_change ? true : false; +} + +static int mxc_jpeg_job_ready(void *priv) +{ + struct mxc_jpeg_ctx *ctx =3D priv; + + return ctx->source_change ? 0 : 1; } =20 static void mxc_jpeg_device_run(void *priv) @@ -1014,6 +1022,13 @@ static void mxc_jpeg_device_run(void *priv) =20 return; } + if (ctx->mxc_jpeg->mode =3D=3D MXC_JPEG_DECODE) { + if (ctx->source_change || mxc_jpeg_source_change(ctx, jpeg_src_buf)) { + spin_unlock_irqrestore(&ctx->mxc_jpeg->hw_lock, flags); + v4l2_m2m_job_finish(jpeg->m2m_dev, ctx->fh.m2m_ctx); + return; + } + } =20 /* * TODO: this reset should be removed, once we figure out @@ -1065,6 +1080,7 @@ static void mxc_jpeg_set_last_buffer_dequeued(struct = mxc_jpeg_ctx *ctx) q->last_buffer_dequeued =3D true; wake_up(&q->done_wq); ctx->stopped =3D 0; + ctx->header_parsed =3D false; } =20 static int mxc_jpeg_decoder_cmd(struct file *file, void *priv, @@ -1158,6 +1174,8 @@ static int mxc_jpeg_start_streaming(struct vb2_queue = *q, unsigned int count) struct mxc_jpeg_q_data *q_data =3D mxc_jpeg_get_q_data(ctx, q->type); int ret; =20 + if (ctx->mxc_jpeg->mode =3D=3D MXC_JPEG_DECODE && V4L2_TYPE_IS_CAPTURE(q-= >type)) + ctx->source_change =3D 0; dev_dbg(ctx->mxc_jpeg->dev, "Start streaming ctx=3D%p", ctx); q_data->sequence =3D 0; =20 @@ -1336,16 +1354,15 @@ static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx,= struct vb2_buffer *vb) dev_warn(dev, "Invalid user resolution 0x0"); dev_warn(dev, "Keeping resolution from JPEG: %dx%d", header.frame.width, header.frame.height); - q_data_out->w =3D header.frame.width; - q_data_out->h =3D header.frame.height; } else if (header.frame.width !=3D q_data_out->w || header.frame.height !=3D q_data_out->h) { dev_err(dev, "Resolution mismatch: %dx%d (JPEG) versus %dx%d(user)", header.frame.width, header.frame.height, q_data_out->w, q_data_out->h); - return -EINVAL; } + q_data_out->w =3D header.frame.width; + q_data_out->h =3D header.frame.height; if (header.frame.width % 8 !=3D 0 || header.frame.height % 8 !=3D 0) { dev_err(dev, "JPEG width or height not multiple of 8: %dx%d\n", header.frame.width, header.frame.height); @@ -1381,8 +1398,10 @@ static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx, = struct vb2_buffer *vb) jpeg_src_buf->fmt =3D mxc_jpeg_find_format(ctx, fourcc); jpeg_src_buf->w =3D header.frame.width; jpeg_src_buf->h =3D header.frame.height; + ctx->header_parsed =3D true; =20 - mxc_jpeg_source_change(ctx, jpeg_src_buf); + if (!v4l2_m2m_num_src_bufs_ready(ctx->fh.m2m_ctx)) + mxc_jpeg_source_change(ctx, jpeg_src_buf); =20 return 0; } @@ -1459,6 +1478,7 @@ static void mxc_jpeg_buf_finish(struct vb2_buffer *vb) if (list_empty(&q->done_list)) { vbuf->flags |=3D V4L2_BUF_FLAG_LAST; ctx->stopped =3D 0; + ctx->header_parsed =3D false; } } =20 @@ -1604,26 +1624,42 @@ static int mxc_jpeg_enum_fmt_vid_cap(struct file *f= ile, void *priv, struct v4l2_fmtdesc *f) { struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_fh_to_ctx(priv); + struct mxc_jpeg_q_data *q_data =3D mxc_jpeg_get_q_data(ctx, f->type); =20 - if (ctx->mxc_jpeg->mode =3D=3D MXC_JPEG_ENCODE) + if (ctx->mxc_jpeg->mode =3D=3D MXC_JPEG_ENCODE) { return enum_fmt(mxc_formats, MXC_JPEG_NUM_FORMATS, f, MXC_JPEG_FMT_TYPE_ENC); - else + } else if (!ctx->header_parsed) { return enum_fmt(mxc_formats, MXC_JPEG_NUM_FORMATS, f, MXC_JPEG_FMT_TYPE_RAW); + } else { + /* For the decoder CAPTURE queue, only enumerate the raw formats + * supported for the format currently active on OUTPUT + * (more precisely what was propagated on capture queue + * after jpeg parse on the output buffer) + */ + if (f->index) + return -EINVAL; + f->pixelformat =3D q_data->fmt->fourcc; + strscpy(f->description, q_data->fmt->name, sizeof(f->description)); + return 0; + } } =20 static int mxc_jpeg_enum_fmt_vid_out(struct file *file, void *priv, struct v4l2_fmtdesc *f) { struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_fh_to_ctx(priv); + u32 type =3D ctx->mxc_jpeg->mode =3D=3D MXC_JPEG_DECODE ? MXC_JPEG_FMT_T= YPE_ENC : + MXC_JPEG_FMT_TYPE_RAW; + int ret; =20 + ret =3D enum_fmt(mxc_formats, MXC_JPEG_NUM_FORMATS, f, type); + if (ret) + return ret; if (ctx->mxc_jpeg->mode =3D=3D MXC_JPEG_DECODE) - return enum_fmt(mxc_formats, MXC_JPEG_NUM_FORMATS, f, - MXC_JPEG_FMT_TYPE_ENC); - else - return enum_fmt(mxc_formats, MXC_JPEG_NUM_FORMATS, f, - MXC_JPEG_FMT_TYPE_RAW); + f->flags =3D V4L2_FMT_FLAG_DYN_RESOLUTION; + return 0; } =20 static int mxc_jpeg_try_fmt(struct v4l2_format *f, const struct mxc_jpeg_f= mt *fmt, @@ -1981,6 +2017,7 @@ static const struct v4l2_file_operations mxc_jpeg_fop= s =3D { }; =20 static const struct v4l2_m2m_ops mxc_jpeg_m2m_ops =3D { + .job_ready =3D mxc_jpeg_job_ready, .device_run =3D mxc_jpeg_device_run, }; =20 diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg.h b/drivers/media/pla= tform/imx-jpeg/mxc-jpeg.h index 2b4b30d01e51..6913ae087e44 100644 --- a/drivers/media/platform/imx-jpeg/mxc-jpeg.h +++ b/drivers/media/platform/imx-jpeg/mxc-jpeg.h @@ -95,6 +95,8 @@ struct mxc_jpeg_ctx { unsigned int stopping; unsigned int stopped; unsigned int slot; + unsigned int source_change; + bool header_parsed; }; =20 struct mxc_jpeg_slot_data { --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6DA4FC00140 for ; Mon, 15 Aug 2022 18:50:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244115AbiHOSuC (ORCPT ); Mon, 15 Aug 2022 14:50:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243588AbiHOSow (ORCPT ); Mon, 15 Aug 2022 14:44:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2523C30540; Mon, 15 Aug 2022 11:27: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 4DB9BB8107D; Mon, 15 Aug 2022 18:27:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EA10C433D6; Mon, 15 Aug 2022 18:27:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588044; bh=YZkmjwX7Z1FgL8qC8zGujWuyNfh/J5kjf4QiARB3t4w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yDtKmhIOaLmI9l/7mFm/bX9viVc/CDlz5zKvBk8vCgWjHknPV3hu71ilmFHtAF/QU Iq0Mf5BmgxSZTFR9sHYXAwbJWDxRPGPVXwbSKofnAq3ghP9huCmWBh00b9HumGNrfh NnDclh9ExMQytP2uaZF41NimL/FPnHs4mO0pzcwE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.15 277/779] media: imx-jpeg: Align upwards buffer size Date: Mon, 15 Aug 2022 19:58:41 +0200 Message-Id: <20220815180349.152856750@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Qian [ Upstream commit 9e7aa76cdb02923ee23a0ddd48f38bdc3512f92b ] The hardware can support any image size WxH, with arbitrary W (image width) and H (image height) dimensions. Align upwards buffer size for both encoder and decoder. and leave the picture resolution unchanged. For decoder, the risk of memory out of bounds can be avoided. For both encoder and decoder, the driver will lift the limitation of resolution alignment. For example, the decoder can support jpeg whose resolution is 227x149 the encoder can support nv12 1080P, won't change it to 1920x1072. Fixes: 2db16c6ed72ce ("media: imx-jpeg: Add V4L2 driver for i.MX8 JPEG Enco= der/Decoder") Signed-off-by: Ming Qian Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/media/platform/imx-jpeg/mxc-jpeg.c | 88 +++++++++------------- 1 file changed, 37 insertions(+), 51 deletions(-) diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg.c b/drivers/media/pla= tform/imx-jpeg/mxc-jpeg.c index 52732fbb2664..e043023836e3 100644 --- a/drivers/media/platform/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/imx-jpeg/mxc-jpeg.c @@ -875,8 +875,8 @@ static void mxc_jpeg_config_enc_desc(struct vb2_buffer = *out_buf, jpeg->slot_data[slot].cfg_stream_size =3D mxc_jpeg_setup_cfg_stream(cfg_stream_vaddr, q_data->fmt->fourcc, - q_data->w_adjusted, - q_data->h_adjusted); + q_data->w, + q_data->h); =20 /* chain the config descriptor with the encoding descriptor */ cfg_desc->next_descpt_ptr =3D desc_handle | MXC_NXT_DESCPT_EN; @@ -956,7 +956,7 @@ static bool mxc_jpeg_source_change(struct mxc_jpeg_ctx = *ctx, &q_data_cap->h_adjusted, q_data_cap->h_adjusted, /* adjust up */ MXC_JPEG_MAX_HEIGHT, - q_data_cap->fmt->v_align, + 0, 0); =20 /* setup bytesperline/sizeimage for capture queue */ @@ -1145,16 +1145,28 @@ static int mxc_jpeg_queue_setup(struct vb2_queue *q, { struct mxc_jpeg_ctx *ctx =3D vb2_get_drv_priv(q); struct mxc_jpeg_q_data *q_data =3D NULL; + struct mxc_jpeg_q_data tmp_q; int i; =20 q_data =3D mxc_jpeg_get_q_data(ctx, q->type); if (!q_data) return -EINVAL; =20 + tmp_q.fmt =3D q_data->fmt; + tmp_q.w =3D q_data->w_adjusted; + tmp_q.h =3D q_data->h_adjusted; + for (i =3D 0; i < MXC_JPEG_MAX_PLANES; i++) { + tmp_q.bytesperline[i] =3D q_data->bytesperline[i]; + tmp_q.sizeimage[i] =3D q_data->sizeimage[i]; + } + mxc_jpeg_sizeimage(&tmp_q); + for (i =3D 0; i < MXC_JPEG_MAX_PLANES; i++) + tmp_q.sizeimage[i] =3D max(tmp_q.sizeimage[i], q_data->sizeimage[i]); + /* Handle CREATE_BUFS situation - *nplanes !=3D 0 */ if (*nplanes) { for (i =3D 0; i < *nplanes; i++) { - if (sizes[i] < q_data->sizeimage[i]) + if (sizes[i] < tmp_q.sizeimage[i]) return -EINVAL; } return 0; @@ -1163,7 +1175,7 @@ static int mxc_jpeg_queue_setup(struct vb2_queue *q, /* Handle REQBUFS situation */ *nplanes =3D q_data->fmt->colplanes; for (i =3D 0; i < *nplanes; i++) - sizes[i] =3D q_data->sizeimage[i]; + sizes[i] =3D tmp_q.sizeimage[i]; =20 return 0; } @@ -1363,11 +1375,6 @@ static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx, = struct vb2_buffer *vb) } q_data_out->w =3D header.frame.width; q_data_out->h =3D header.frame.height; - if (header.frame.width % 8 !=3D 0 || header.frame.height % 8 !=3D 0) { - dev_err(dev, "JPEG width or height not multiple of 8: %dx%d\n", - header.frame.width, header.frame.height); - return -EINVAL; - } if (header.frame.width > MXC_JPEG_MAX_WIDTH || header.frame.height > MXC_JPEG_MAX_HEIGHT) { dev_err(dev, "JPEG width or height should be <=3D 8192: %dx%d\n", @@ -1679,22 +1686,17 @@ static int mxc_jpeg_try_fmt(struct v4l2_format *f, = const struct mxc_jpeg_fmt *fm pix_mp->num_planes =3D fmt->colplanes; pix_mp->pixelformat =3D fmt->fourcc; =20 - /* - * use MXC_JPEG_H_ALIGN instead of fmt->v_align, for vertical - * alignment, to loosen up the alignment to multiple of 8, - * otherwise NV12-1080p fails as 1080 is not a multiple of 16 - */ + pix_mp->width =3D w; + pix_mp->height =3D h; v4l_bound_align_image(&w, - MXC_JPEG_MIN_WIDTH, - w, /* adjust downwards*/ + w, /* adjust upwards*/ + MXC_JPEG_MAX_WIDTH, fmt->h_align, &h, - MXC_JPEG_MIN_HEIGHT, - h, /* adjust downwards*/ - MXC_JPEG_H_ALIGN, + h, /* adjust upwards*/ + MXC_JPEG_MAX_HEIGHT, + 0, 0); - pix_mp->width =3D w; /* negotiate the width */ - pix_mp->height =3D h; /* negotiate the height */ =20 /* get user input into the tmp_q */ tmp_q.w =3D w; @@ -1820,35 +1822,19 @@ static int mxc_jpeg_s_fmt(struct mxc_jpeg_ctx *ctx, =20 q_data->w_adjusted =3D q_data->w; q_data->h_adjusted =3D q_data->h; - if (jpeg->mode =3D=3D MXC_JPEG_DECODE) { - /* - * align up the resolution for CAST IP, - * but leave the buffer resolution unchanged - */ - v4l_bound_align_image(&q_data->w_adjusted, - q_data->w_adjusted, /* adjust upwards */ - MXC_JPEG_MAX_WIDTH, - q_data->fmt->h_align, - &q_data->h_adjusted, - q_data->h_adjusted, /* adjust upwards */ - MXC_JPEG_MAX_HEIGHT, - q_data->fmt->v_align, - 0); - } else { - /* - * align down the resolution for CAST IP, - * but leave the buffer resolution unchanged - */ - v4l_bound_align_image(&q_data->w_adjusted, - MXC_JPEG_MIN_WIDTH, - q_data->w_adjusted, /* adjust downwards*/ - q_data->fmt->h_align, - &q_data->h_adjusted, - MXC_JPEG_MIN_HEIGHT, - q_data->h_adjusted, /* adjust downwards*/ - q_data->fmt->v_align, - 0); - } + /* + * align up the resolution for CAST IP, + * but leave the buffer resolution unchanged + */ + v4l_bound_align_image(&q_data->w_adjusted, + q_data->w_adjusted, /* adjust upwards */ + MXC_JPEG_MAX_WIDTH, + q_data->fmt->h_align, + &q_data->h_adjusted, + q_data->h_adjusted, /* adjust upwards */ + MXC_JPEG_MAX_HEIGHT, + q_data->fmt->v_align, + 0); =20 for (i =3D 0; i < pix_mp->num_planes; i++) { q_data->bytesperline[i] =3D pix_mp->plane_fmt[i].bytesperline; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72772C00140 for ; Mon, 15 Aug 2022 18:50:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244127AbiHOSuG (ORCPT ); Mon, 15 Aug 2022 14:50:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243793AbiHOSpg (ORCPT ); Mon, 15 Aug 2022 14:45: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 993AD3057D; Mon, 15 Aug 2022 11:27:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 68800B81082; Mon, 15 Aug 2022 18:27:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9AA17C433C1; Mon, 15 Aug 2022 18:27:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588047; bh=4VZBp0Emmo8vOrGg7J0zJiKan3ApsLMdZPu52KotUC8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jKbD8Tf6ke6qm7O+U90wGxNrT/vjr8o92aZalM+SYHY0/qW6BSQOM1nkGVXKiJ10l lK9CGup1GwsoCybyZp63GZG8Iai8EoUIbljTRz+tt/Ez7pvk59RRjatUbznidF7MwH qS92FhNqzkR+5ng2jKNe61vsRFiEpu3annFbnnBw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.15 278/779] media: imx-jpeg: Implement drain using v4l2-mem2mem helpers Date: Mon, 15 Aug 2022 19:58:42 +0200 Message-Id: <20220815180349.186810968@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Qian [ Upstream commit 4911c5acf9351c4caf692895c7cf6a4fa46c26b0 ] v4l2 m2m has supplied some helper function to handle drain, so the driver can use the helper function directly. Fixes: d8ebe298d008c ("media: imx-jpeg: Set V4L2_BUF_FLAG_LAST at eos") Signed-off-by: Ming Qian Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/media/platform/imx-jpeg/mxc-jpeg.c | 155 ++++++++++----------- drivers/media/platform/imx-jpeg/mxc-jpeg.h | 2 - 2 files changed, 73 insertions(+), 84 deletions(-) diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg.c b/drivers/media/pla= tform/imx-jpeg/mxc-jpeg.c index e043023836e3..da80167cb57d 100644 --- a/drivers/media/platform/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/imx-jpeg/mxc-jpeg.c @@ -545,6 +545,18 @@ static void mxc_jpeg_free_slot_data(struct mxc_jpeg_de= v *jpeg, jpeg->slot_data[slot].used =3D false; } =20 +static void mxc_jpeg_check_and_set_last_buffer(struct mxc_jpeg_ctx *ctx, + struct vb2_v4l2_buffer *src_buf, + struct vb2_v4l2_buffer *dst_buf) +{ + if (v4l2_m2m_is_last_draining_src_buf(ctx->fh.m2m_ctx, src_buf)) { + dst_buf->flags |=3D V4L2_BUF_FLAG_LAST; + v4l2_m2m_mark_stopped(ctx->fh.m2m_ctx); + notify_eos(ctx); + ctx->header_parsed =3D false; + } +} + static irqreturn_t mxc_jpeg_dec_irq(int irq, void *priv) { struct mxc_jpeg_dev *jpeg =3D priv; @@ -619,6 +631,7 @@ static irqreturn_t mxc_jpeg_dec_irq(int irq, void *priv) dev_dbg(dev, "Decoder DHT cfg finished. Start decoding...\n"); goto job_unlock; } + if (jpeg->mode =3D=3D MXC_JPEG_ENCODE) { payload =3D readl(reg + MXC_SLOT_OFFSET(slot, SLOT_BUF_PTR)); vb2_set_plane_payload(&dst_buf->vb2_buf, 0, payload); @@ -647,6 +660,7 @@ static irqreturn_t mxc_jpeg_dec_irq(int irq, void *priv) =20 buffers_done: jpeg->slot_data[slot].used =3D false; /* unused, but don't free */ + mxc_jpeg_check_and_set_last_buffer(ctx, src_buf, dst_buf); v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx); v4l2_m2m_buf_done(src_buf, buf_state); @@ -1013,6 +1027,7 @@ static void mxc_jpeg_device_run(void *priv) jpeg_src_buf->jpeg_parse_error =3D true; } if (jpeg_src_buf->jpeg_parse_error) { + mxc_jpeg_check_and_set_last_buffer(ctx, src_buf, dst_buf); v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); v4l2_m2m_dst_buf_remove(ctx->fh.m2m_ctx); v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_ERROR); @@ -1068,45 +1083,33 @@ static void mxc_jpeg_device_run(void *priv) spin_unlock_irqrestore(&ctx->mxc_jpeg->hw_lock, flags); } =20 -static void mxc_jpeg_set_last_buffer_dequeued(struct mxc_jpeg_ctx *ctx) -{ - struct vb2_queue *q; - - ctx->stopped =3D 1; - q =3D v4l2_m2m_get_dst_vq(ctx->fh.m2m_ctx); - if (!list_empty(&q->done_list)) - return; - - q->last_buffer_dequeued =3D true; - wake_up(&q->done_wq); - ctx->stopped =3D 0; - ctx->header_parsed =3D false; -} - static int mxc_jpeg_decoder_cmd(struct file *file, void *priv, struct v4l2_decoder_cmd *cmd) { struct v4l2_fh *fh =3D file->private_data; struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_fh_to_ctx(fh); - struct device *dev =3D ctx->mxc_jpeg->dev; int ret; =20 ret =3D v4l2_m2m_ioctl_try_decoder_cmd(file, fh, cmd); if (ret < 0) return ret; =20 - if (cmd->cmd =3D=3D V4L2_DEC_CMD_STOP) { - dev_dbg(dev, "Received V4L2_DEC_CMD_STOP"); - if (v4l2_m2m_num_src_bufs_ready(fh->m2m_ctx) =3D=3D 0) { - /* No more src bufs, notify app EOS */ - notify_eos(ctx); - mxc_jpeg_set_last_buffer_dequeued(ctx); - } else { - /* will send EOS later*/ - ctx->stopping =3D 1; - } + if (!vb2_is_streaming(v4l2_m2m_get_src_vq(fh->m2m_ctx))) + return 0; + + ret =3D v4l2_m2m_ioctl_decoder_cmd(file, priv, cmd); + if (ret < 0) + return ret; + + if (cmd->cmd =3D=3D V4L2_DEC_CMD_STOP && + v4l2_m2m_has_stopped(fh->m2m_ctx)) { + notify_eos(ctx); + ctx->header_parsed =3D false; } =20 + if (cmd->cmd =3D=3D V4L2_DEC_CMD_START && + v4l2_m2m_has_stopped(fh->m2m_ctx)) + vb2_clear_last_buffer_dequeued(&fh->m2m_ctx->cap_q_ctx.q); return 0; } =20 @@ -1115,24 +1118,27 @@ static int mxc_jpeg_encoder_cmd(struct file *file, = void *priv, { struct v4l2_fh *fh =3D file->private_data; struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_fh_to_ctx(fh); - struct device *dev =3D ctx->mxc_jpeg->dev; int ret; =20 ret =3D v4l2_m2m_ioctl_try_encoder_cmd(file, fh, cmd); if (ret < 0) return ret; =20 - if (cmd->cmd =3D=3D V4L2_ENC_CMD_STOP) { - dev_dbg(dev, "Received V4L2_ENC_CMD_STOP"); - if (v4l2_m2m_num_src_bufs_ready(fh->m2m_ctx) =3D=3D 0) { - /* No more src bufs, notify app EOS */ - notify_eos(ctx); - mxc_jpeg_set_last_buffer_dequeued(ctx); - } else { - /* will send EOS later*/ - ctx->stopping =3D 1; - } - } + if (!vb2_is_streaming(v4l2_m2m_get_src_vq(fh->m2m_ctx)) || + !vb2_is_streaming(v4l2_m2m_get_dst_vq(fh->m2m_ctx))) + return 0; + + ret =3D v4l2_m2m_ioctl_encoder_cmd(file, fh, cmd); + if (ret < 0) + return 0; + + if (cmd->cmd =3D=3D V4L2_ENC_CMD_STOP && + v4l2_m2m_has_stopped(fh->m2m_ctx)) + notify_eos(ctx); + + if (cmd->cmd =3D=3D V4L2_ENC_CMD_START && + v4l2_m2m_has_stopped(fh->m2m_ctx)) + vb2_clear_last_buffer_dequeued(&fh->m2m_ctx->cap_q_ctx.q); =20 return 0; } @@ -1186,6 +1192,8 @@ static int mxc_jpeg_start_streaming(struct vb2_queue = *q, unsigned int count) struct mxc_jpeg_q_data *q_data =3D mxc_jpeg_get_q_data(ctx, q->type); int ret; =20 + v4l2_m2m_update_start_streaming_state(ctx->fh.m2m_ctx, q); + if (ctx->mxc_jpeg->mode =3D=3D MXC_JPEG_DECODE && V4L2_TYPE_IS_CAPTURE(q-= >type)) ctx->source_change =3D 0; dev_dbg(ctx->mxc_jpeg->dev, "Start streaming ctx=3D%p", ctx); @@ -1217,11 +1225,15 @@ static void mxc_jpeg_stop_streaming(struct vb2_queu= e *q) break; v4l2_m2m_buf_done(vbuf, VB2_BUF_STATE_ERROR); } - pm_runtime_put_sync(&ctx->mxc_jpeg->pdev->dev); - if (V4L2_TYPE_IS_OUTPUT(q->type)) { - ctx->stopping =3D 0; - ctx->stopped =3D 0; + + v4l2_m2m_update_stop_streaming_state(ctx->fh.m2m_ctx, q); + if (V4L2_TYPE_IS_OUTPUT(q->type) && + v4l2_m2m_has_stopped(ctx->fh.m2m_ctx)) { + notify_eos(ctx); + ctx->header_parsed =3D false; } + + pm_runtime_put_sync(&ctx->mxc_jpeg->pdev->dev); } =20 static int mxc_jpeg_valid_comp_id(struct device *dev, @@ -1420,6 +1432,20 @@ static void mxc_jpeg_buf_queue(struct vb2_buffer *vb) struct mxc_jpeg_ctx *ctx =3D vb2_get_drv_priv(vb->vb2_queue); struct mxc_jpeg_src_buf *jpeg_src_buf; =20 + if (V4L2_TYPE_IS_CAPTURE(vb->vb2_queue->type) && + vb2_is_streaming(vb->vb2_queue) && + v4l2_m2m_dst_buf_is_last(ctx->fh.m2m_ctx)) { + struct mxc_jpeg_q_data *q_data; + + q_data =3D mxc_jpeg_get_q_data(ctx, vb->vb2_queue->type); + vbuf->field =3D V4L2_FIELD_NONE; + vbuf->sequence =3D q_data->sequence++; + v4l2_m2m_last_buffer_done(ctx->fh.m2m_ctx, vbuf); + notify_eos(ctx); + ctx->header_parsed =3D false; + return; + } + if (vb->vb2_queue->type =3D=3D V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) goto end; =20 @@ -1469,24 +1495,11 @@ static int mxc_jpeg_buf_prepare(struct vb2_buffer *= vb) } vb2_set_plane_payload(vb, i, sizeimage); } - return 0; -} - -static void mxc_jpeg_buf_finish(struct vb2_buffer *vb) -{ - struct vb2_v4l2_buffer *vbuf =3D to_vb2_v4l2_buffer(vb); - struct mxc_jpeg_ctx *ctx =3D vb2_get_drv_priv(vb->vb2_queue); - struct vb2_queue *q =3D vb->vb2_queue; - - if (V4L2_TYPE_IS_OUTPUT(vb->type)) - return; - if (!ctx->stopped) - return; - if (list_empty(&q->done_list)) { - vbuf->flags |=3D V4L2_BUF_FLAG_LAST; - ctx->stopped =3D 0; - ctx->header_parsed =3D false; + if (V4L2_TYPE_IS_CAPTURE(vb->vb2_queue->type)) { + vb2_set_plane_payload(vb, 0, 0); + vb2_set_plane_payload(vb, 1, 0); } + return 0; } =20 static const struct vb2_ops mxc_jpeg_qops =3D { @@ -1495,7 +1508,6 @@ static const struct vb2_ops mxc_jpeg_qops =3D { .wait_finish =3D vb2_ops_wait_finish, .buf_out_validate =3D mxc_jpeg_buf_out_validate, .buf_prepare =3D mxc_jpeg_buf_prepare, - .buf_finish =3D mxc_jpeg_buf_finish, .start_streaming =3D mxc_jpeg_start_streaming, .stop_streaming =3D mxc_jpeg_stop_streaming, .buf_queue =3D mxc_jpeg_buf_queue, @@ -1916,27 +1928,6 @@ static int mxc_jpeg_subscribe_event(struct v4l2_fh *= fh, } } =20 -static int mxc_jpeg_dqbuf(struct file *file, void *priv, - struct v4l2_buffer *buf) -{ - struct v4l2_fh *fh =3D file->private_data; - struct mxc_jpeg_ctx *ctx =3D mxc_jpeg_fh_to_ctx(priv); - struct device *dev =3D ctx->mxc_jpeg->dev; - int num_src_ready =3D v4l2_m2m_num_src_bufs_ready(fh->m2m_ctx); - int ret; - - dev_dbg(dev, "DQBUF type=3D%d, index=3D%d", buf->type, buf->index); - if (ctx->stopping =3D=3D 1 && num_src_ready =3D=3D 0) { - /* No more src bufs, notify app EOS */ - notify_eos(ctx); - ctx->stopping =3D 0; - mxc_jpeg_set_last_buffer_dequeued(ctx); - } - - ret =3D v4l2_m2m_dqbuf(file, fh->m2m_ctx, buf); - return ret; -} - static const struct v4l2_ioctl_ops mxc_jpeg_ioctl_ops =3D { .vidioc_querycap =3D mxc_jpeg_querycap, .vidioc_enum_fmt_vid_cap =3D mxc_jpeg_enum_fmt_vid_cap, @@ -1960,7 +1951,7 @@ static const struct v4l2_ioctl_ops mxc_jpeg_ioctl_ops= =3D { .vidioc_encoder_cmd =3D mxc_jpeg_encoder_cmd, =20 .vidioc_qbuf =3D v4l2_m2m_ioctl_qbuf, - .vidioc_dqbuf =3D mxc_jpeg_dqbuf, + .vidioc_dqbuf =3D v4l2_m2m_ioctl_dqbuf, =20 .vidioc_create_bufs =3D v4l2_m2m_ioctl_create_bufs, .vidioc_prepare_buf =3D v4l2_m2m_ioctl_prepare_buf, diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg.h b/drivers/media/pla= tform/imx-jpeg/mxc-jpeg.h index 6913ae087e44..542993eb8d5b 100644 --- a/drivers/media/platform/imx-jpeg/mxc-jpeg.h +++ b/drivers/media/platform/imx-jpeg/mxc-jpeg.h @@ -92,8 +92,6 @@ struct mxc_jpeg_ctx { struct mxc_jpeg_q_data cap_q; struct v4l2_fh fh; enum mxc_jpeg_enc_state enc_state; - unsigned int stopping; - unsigned int stopped; unsigned int slot; unsigned int source_change; bool header_parsed; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B62A9C00140 for ; Mon, 15 Aug 2022 18:50:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243970AbiHOSuK (ORCPT ); Mon, 15 Aug 2022 14:50:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243349AbiHOSpM (ORCPT ); Mon, 15 Aug 2022 14:45:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A1F430567; Mon, 15 Aug 2022 11:27: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 BC85260FD0; Mon, 15 Aug 2022 18:27:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA962C433D7; Mon, 15 Aug 2022 18:27:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588050; bh=BokTBTMkZ4346PaQMeY33bF5LXXEd68/+dwp0v89MXc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jfem1UaPpo4KOsmhsqqKgV1X9St2XQsPajcFGmVUYsCd+j0O1WqzZ1491douHPSeB VYzvdcb7vW+2XLD4PaGzepxaTkfxQPphY/qC1HwD2GHSNT+lKWlvjL5lSLc9zh33KG H1jU9I8URNNnjynN2ri5Sw+6znCwODNmFVjsB6yU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Skripkin , =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= , Kalle Valo , Sasha Levin , syzbot+03110230a11411024147@syzkaller.appspotmail.com, syzbot+c6dde1f690b60e0b9fbe@syzkaller.appspotmail.com Subject: [PATCH 5.15 279/779] ath9k: fix use-after-free in ath9k_hif_usb_rx_cb Date: Mon, 15 Aug 2022 19:58:43 +0200 Message-Id: <20220815180349.237918719@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pavel Skripkin [ Upstream commit 0ac4827f78c7ffe8eef074bc010e7e34bc22f533 ] Syzbot reported use-after-free Read in ath9k_hif_usb_rx_cb() [0]. The problem was in incorrect htc_handle->drv_priv initialization. Probable call trace which can trigger use-after-free: ath9k_htc_probe_device() /* htc_handle->drv_priv =3D priv; */ ath9k_htc_wait_for_target() <--- Failed ieee80211_free_hw() <--- priv pointer is freed ... ath9k_hif_usb_rx_cb() ath9k_hif_usb_rx_stream() RX_STAT_INC() <--- htc_handle->drv_priv access In order to not add fancy protection for drv_priv we can move htc_handle->drv_priv initialization at the end of the ath9k_htc_probe_device() and add helper macro to make all *_STAT_* macros NULL safe, since syzbot has reported related NULL deref in that macros [1] Link: https://syzkaller.appspot.com/bug?id=3D6ead44e37afb6866ac0c7dd121b4ce= 07cb665f60 [0] Link: https://syzkaller.appspot.com/bug?id=3Db8101ffcec107c0567a0cd8acbbace= c91e9ee8de [1] Fixes: fb9987d0f748 ("ath9k_htc: Support for AR9271 chipset.") Reported-and-tested-by: syzbot+03110230a11411024147@syzkaller.appspotmail.c= om Reported-and-tested-by: syzbot+c6dde1f690b60e0b9fbe@syzkaller.appspotmail.c= om Signed-off-by: Pavel Skripkin Acked-by: Toke H=C3=B8iland-J=C3=B8rgensen Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/d57bbedc857950659bfacac0ab48790c1eda00c8.16= 55145743.git.paskripkin@gmail.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/wireless/ath/ath9k/htc.h | 10 +++++----- drivers/net/wireless/ath/ath9k/htc_drv_init.c | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireless/ath/ath9k/htc.h b/drivers/net/wireless/at= h/ath9k/htc.h index 6b45e63fae4b..e3d546ef71dd 100644 --- a/drivers/net/wireless/ath/ath9k/htc.h +++ b/drivers/net/wireless/ath/ath9k/htc.h @@ -327,11 +327,11 @@ static inline struct ath9k_htc_tx_ctl *HTC_SKB_CB(str= uct sk_buff *skb) } =20 #ifdef CONFIG_ATH9K_HTC_DEBUGFS - -#define TX_STAT_INC(c) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c++) -#define TX_STAT_ADD(c, a) (hif_dev->htc_handle->drv_priv->debug.tx_stats.c= +=3D a) -#define RX_STAT_INC(c) (hif_dev->htc_handle->drv_priv->debug.skbrx_stats.c= ++) -#define RX_STAT_ADD(c, a) (hif_dev->htc_handle->drv_priv->debug.skbrx_stat= s.c +=3D a) +#define __STAT_SAFE(expr) (hif_dev->htc_handle->drv_priv ? (expr) : 0) +#define TX_STAT_INC(c) __STAT_SAFE(hif_dev->htc_handle->drv_priv->debug.tx= _stats.c++) +#define TX_STAT_ADD(c, a) __STAT_SAFE(hif_dev->htc_handle->drv_priv->debug= .tx_stats.c +=3D a) +#define RX_STAT_INC(c) __STAT_SAFE(hif_dev->htc_handle->drv_priv->debug.sk= brx_stats.c++) +#define RX_STAT_ADD(c, a) __STAT_SAFE(hif_dev->htc_handle->drv_priv->debug= .skbrx_stats.c +=3D a) #define CAB_STAT_INC priv->debug.tx_stats.cab_queued++ =20 #define TX_QSTAT_INC(q) (priv->debug.tx_stats.queue_stats[q]++) diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_init.c b/drivers/net/wi= reless/ath/ath9k/htc_drv_init.c index ff61ae34ecdf..07ac88fb1c57 100644 --- a/drivers/net/wireless/ath/ath9k/htc_drv_init.c +++ b/drivers/net/wireless/ath/ath9k/htc_drv_init.c @@ -944,7 +944,6 @@ int ath9k_htc_probe_device(struct htc_target *htc_handl= e, struct device *dev, priv->hw =3D hw; priv->htc =3D htc_handle; priv->dev =3D dev; - htc_handle->drv_priv =3D priv; SET_IEEE80211_DEV(hw, priv->dev); =20 ret =3D ath9k_htc_wait_for_target(priv); @@ -965,6 +964,8 @@ int ath9k_htc_probe_device(struct htc_target *htc_handl= e, struct device *dev, if (ret) goto err_init; =20 + htc_handle->drv_priv =3D priv; + return 0; =20 err_init: --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F4C5C00140 for ; Mon, 15 Aug 2022 18:50:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244169AbiHOSuU (ORCPT ); Mon, 15 Aug 2022 14:50:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243824AbiHOSpp (ORCPT ); Mon, 15 Aug 2022 14:45:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E3C030F7A; Mon, 15 Aug 2022 11:27:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CBBB960FB8; Mon, 15 Aug 2022 18:27:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA007C433C1; Mon, 15 Aug 2022 18:27:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588053; bh=C+7qbxZDcsHmioA8hGAKIIf6AxtRN3IaVwqqKwIMSR0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XiGvHBRpsN5dnHi63w+LLQbJ2tWhqgzA1Z9jN5IfD2+SPcOacDfNceumuAymGTkTi N4+/gSVPV8Pkt5tWF1FqRGJuM6kU3Ue7vqDOH14vdeR4or3A3WpQC4ivQLYazeaTmB 9aQUCfnEzpl8bDspAbPXyV2NTt3qp1QrH4vLTZ8Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Kodanev , Kalle Valo , Sasha Levin Subject: [PATCH 5.15 280/779] wifi: iwlegacy: 4965: fix potential off-by-one overflow in il4965_rs_fill_link_cmd() Date: Mon, 15 Aug 2022 19:58:44 +0200 Message-Id: <20220815180349.281891910@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexey Kodanev [ Upstream commit a8eb8e6f7159c7c20c0ddac428bde3d110890aa7 ] As a result of the execution of the inner while loop, the value of 'idx' can be equal to LINK_QUAL_MAX_RETRY_NUM. However, this is not checked after the loop and 'idx' is used to write the LINK_QUAL_MAX_RETRY_NUM size array 'lq_cmd->rs_table[idx]' below in the outer loop. The fix is to check the new value of 'idx' inside the nested loop, and break both loops if index equals the size. Checking it at the start is now pointless, so let's remove it. Detected using the static analysis tool - Svace. Fixes: be663ab67077 ("iwlwifi: split the drivers for agn and legacy devices= 3945/4965") Signed-off-by: Alexey Kodanev Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220608171614.28891-1-aleksei.kodanev@bell= -sw.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/wireless/intel/iwlegacy/4965-rs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/intel/iwlegacy/4965-rs.c b/drivers/net/wi= reless/intel/iwlegacy/4965-rs.c index 9a491e5db75b..532e3b91777d 100644 --- a/drivers/net/wireless/intel/iwlegacy/4965-rs.c +++ b/drivers/net/wireless/intel/iwlegacy/4965-rs.c @@ -2403,7 +2403,7 @@ il4965_rs_fill_link_cmd(struct il_priv *il, struct il= _lq_sta *lq_sta, /* Repeat initial/next rate. * For legacy IL_NUMBER_TRY =3D=3D 1, this loop will not execute. * For HT IL_HT_NUMBER_TRY =3D=3D 3, this executes twice. */ - while (repeat_rate > 0 && idx < LINK_QUAL_MAX_RETRY_NUM) { + while (repeat_rate > 0) { if (is_legacy(tbl_type.lq_type)) { if (ant_toggle_cnt < NUM_TRY_BEFORE_ANT_TOGGLE) ant_toggle_cnt++; @@ -2422,6 +2422,8 @@ il4965_rs_fill_link_cmd(struct il_priv *il, struct il= _lq_sta *lq_sta, cpu_to_le32(new_rate); repeat_rate--; idx++; + if (idx >=3D LINK_QUAL_MAX_RETRY_NUM) + goto out; } =20 il4965_rs_get_tbl_info_from_mcs(new_rate, lq_sta->band, @@ -2466,6 +2468,7 @@ il4965_rs_fill_link_cmd(struct il_priv *il, struct il= _lq_sta *lq_sta, repeat_rate--; } =20 +out: lq_cmd->agg_params.agg_frame_cnt_limit =3D LINK_QUAL_AGG_FRAME_LIMIT_DEF; lq_cmd->agg_params.agg_dis_start_th =3D LINK_QUAL_AGG_DISABLE_START_DEF; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FC35C00140 for ; Mon, 15 Aug 2022 18:50:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244145AbiHOSuP (ORCPT ); Mon, 15 Aug 2022 14:50:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243828AbiHOSpq (ORCPT ); Mon, 15 Aug 2022 14:45:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 148013120F; Mon, 15 Aug 2022 11:27: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 C1D6060FDC; Mon, 15 Aug 2022 18:27:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2F42C433C1; Mon, 15 Aug 2022 18:27:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588056; bh=0GoneA/qGJtls0aUIePvwzp+dy/pKMZAcfjAAZ2A3tM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q2eXh5cTfx9OzpR9/REoMLAlIK3RBL1vQLDnoYSZw7/vpp7z+IeKj2qDDSA8c3SKz V4Iu080ucAaJEPW91wnNyS2zQ9E/GJuPX7cn1h5XJQAYHUQhLE5LoJ152u8CgRPSER fdxOFItYVwkE8DI1oEI+1Onknf9n9oZKpYaMPpVo= 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?= , Alex Deucher , Sasha Levin Subject: [PATCH 5.15 281/779] drm/radeon: fix incorrrect SPDX-License-Identifiers Date: Mon, 15 Aug 2022 19:58:45 +0200 Message-Id: <20220815180349.323039928@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alex Deucher [ Upstream commit 1f43b8903f3aae4a26a603c36f6d5dd25d6edb51 ] radeon is MIT. This were incorrectly changed in commit b24413180f56 ("License cleanup: add SPDX GPL-2.0 license identifier = to files with no license") and commit d198b34f3855 (".gitignore: add SPDX License Identifier") and: commit ec8f24b7faaf ("treewide: Add SPDX license identifier - Makefile/Kcon= fig") Fixes: d198b34f3855 (".gitignore: add SPDX License Identifier") Fixes: ec8f24b7faaf ("treewide: Add SPDX license identifier - Makefile/Kcon= fig") Fixes: b24413180f56 ("License cleanup: add SPDX GPL-2.0 license identifier = to files with no license") Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/2053 Reviewed-by: Christian K=C3=B6nig Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/radeon/.gitignore | 2 +- drivers/gpu/drm/radeon/Kconfig | 2 +- drivers/gpu/drm/radeon/Makefile | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/radeon/.gitignore b/drivers/gpu/drm/radeon/.gi= tignore index 9c1a94153983..d8777383a64a 100644 --- a/drivers/gpu/drm/radeon/.gitignore +++ b/drivers/gpu/drm/radeon/.gitignore @@ -1,4 +1,4 @@ -# SPDX-License-Identifier: GPL-2.0-only +# SPDX-License-Identifier: MIT mkregtable *_reg_safe.h =20 diff --git a/drivers/gpu/drm/radeon/Kconfig b/drivers/gpu/drm/radeon/Kconfig index 6f60f4840cc5..52819e7f1fca 100644 --- a/drivers/gpu/drm/radeon/Kconfig +++ b/drivers/gpu/drm/radeon/Kconfig @@ -1,4 +1,4 @@ -# SPDX-License-Identifier: GPL-2.0-only +# SPDX-License-Identifier: MIT config DRM_RADEON_USERPTR bool "Always enable userptr support" depends on DRM_RADEON diff --git a/drivers/gpu/drm/radeon/Makefile b/drivers/gpu/drm/radeon/Makef= ile index 11c97edde54d..3d502f1bbfcb 100644 --- a/drivers/gpu/drm/radeon/Makefile +++ b/drivers/gpu/drm/radeon/Makefile @@ -1,4 +1,4 @@ -# SPDX-License-Identifier: GPL-2.0 +# SPDX-License-Identifier: MIT # # Makefile for the drm device driver. This driver provides support for the # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher. --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98A24C00140 for ; Mon, 15 Aug 2022 18:50:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244177AbiHOSuZ (ORCPT ); Mon, 15 Aug 2022 14:50:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243863AbiHOSp4 (ORCPT ); Mon, 15 Aug 2022 14:45:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 553BB31228; Mon, 15 Aug 2022 11:27: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 94D38B81081; Mon, 15 Aug 2022 18:27:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDED5C433D6; Mon, 15 Aug 2022 18:27:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588059; bh=tncehYp3RIreavQFAJJmsSQ5PE2Xm9k9/Z+h64kWCsw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fi7utdLG/NsolvOE1jLc7d6umBQP9jm8PVgmDkSLkD0taE0Fa9XVoZ7ymI9SAmKI0 iBvPFCaD3ZrDfYz/xLxCkbxg/tFuGGz3D3GUrGeLvlL2iyNkDQC9+OTcRwFdPxiFxU r04+43Uhihqol+mNTEh3oYPtj8D8R1KboWEjqiwQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Paul E. McKenney" , Sasha Levin Subject: [PATCH 5.15 282/779] rcutorture: Warn on individual rcu_torture_init() error conditions Date: Mon, 15 Aug 2022 19:58:46 +0200 Message-Id: <20220815180349.367984790@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 efeff6b39b9de4480572c7b0c5eb77204795cb57 ] When running rcutorture as a module, any rcu_torture_init() issues will be reflected in the error code from modprobe or insmod, as the case may be. However, these error codes are not available when running rcutorture built-in, for example, when using the kvm.sh script. This commit therefore adds WARN_ON_ONCE() to allow distinguishing rcu_torture_init() errors when running rcutorture built-in. Signed-off-by: Paul E. McKenney Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- include/linux/torture.h | 8 ++++++++ kernel/rcu/rcutorture.c | 30 +++++++++++++++--------------- 2 files changed, 23 insertions(+), 15 deletions(-) diff --git a/include/linux/torture.h b/include/linux/torture.h index 0910c5803f35..24f58e50a94b 100644 --- a/include/linux/torture.h +++ b/include/linux/torture.h @@ -47,6 +47,14 @@ do { \ } while (0) void verbose_torout_sleep(void); =20 +#define torture_init_error(firsterr) \ +({ \ + int ___firsterr =3D (firsterr); \ + \ + WARN_ONCE(!IS_MODULE(CONFIG_RCU_TORTURE_TEST) && ___firsterr < 0, "Tortur= e-test initialization failed with error code %d\n", ___firsterr); \ + ___firsterr < 0; \ +}) + /* Definitions for online/offline exerciser. */ #ifdef CONFIG_HOTPLUG_CPU int torture_num_online_cpus(void); diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index f922937eb39a..c1b36c52e896 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -3066,7 +3066,7 @@ rcu_torture_init(void) rcu_torture_write_types(); firsterr =3D torture_create_kthread(rcu_torture_writer, NULL, writer_task); - if (firsterr) + if (torture_init_error(firsterr)) goto unwind; if (nfakewriters > 0) { fakewriter_tasks =3D kcalloc(nfakewriters, @@ -3081,7 +3081,7 @@ rcu_torture_init(void) for (i =3D 0; i < nfakewriters; i++) { firsterr =3D torture_create_kthread(rcu_torture_fakewriter, NULL, fakewriter_tasks[i]); - if (firsterr) + if (torture_init_error(firsterr)) goto unwind; } reader_tasks =3D kcalloc(nrealreaders, sizeof(reader_tasks[0]), @@ -3097,7 +3097,7 @@ rcu_torture_init(void) rcu_torture_reader_mbchk[i].rtc_chkrdr =3D -1; firsterr =3D torture_create_kthread(rcu_torture_reader, (void *)i, reader_tasks[i]); - if (firsterr) + if (torture_init_error(firsterr)) goto unwind; } nrealnocbers =3D nocbs_nthreads; @@ -3117,18 +3117,18 @@ rcu_torture_init(void) } for (i =3D 0; i < nrealnocbers; i++) { firsterr =3D torture_create_kthread(rcu_nocb_toggle, NULL, nocb_tasks[i]= ); - if (firsterr) + if (torture_init_error(firsterr)) goto unwind; } if (stat_interval > 0) { firsterr =3D torture_create_kthread(rcu_torture_stats, NULL, stats_task); - if (firsterr) + if (torture_init_error(firsterr)) goto unwind; } if (test_no_idle_hz && shuffle_interval > 0) { firsterr =3D torture_shuffle_init(shuffle_interval * HZ); - if (firsterr) + if (torture_init_error(firsterr)) goto unwind; } if (stutter < 0) @@ -3138,7 +3138,7 @@ rcu_torture_init(void) =20 t =3D cur_ops->stall_dur ? cur_ops->stall_dur() : stutter * HZ; firsterr =3D torture_stutter_init(stutter * HZ, t); - if (firsterr) + if (torture_init_error(firsterr)) goto unwind; } if (fqs_duration < 0) @@ -3147,7 +3147,7 @@ rcu_torture_init(void) /* Create the fqs thread */ firsterr =3D torture_create_kthread(rcu_torture_fqs, NULL, fqs_task); - if (firsterr) + if (torture_init_error(firsterr)) goto unwind; } if (test_boost_interval < 1) @@ -3161,7 +3161,7 @@ rcu_torture_init(void) firsterr =3D cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "RCU_TORTURE", rcutorture_booster_init, rcutorture_booster_cleanup); - if (firsterr < 0) + if (torture_init_error(firsterr)) goto unwind; rcutor_hp =3D firsterr; =20 @@ -3182,23 +3182,23 @@ rcu_torture_init(void) } shutdown_jiffies =3D jiffies + shutdown_secs * HZ; firsterr =3D torture_shutdown_init(shutdown_secs, rcu_torture_cleanup); - if (firsterr) + if (torture_init_error(firsterr)) goto unwind; firsterr =3D torture_onoff_init(onoff_holdoff * HZ, onoff_interval, rcutorture_sync); - if (firsterr) + if (torture_init_error(firsterr)) goto unwind; firsterr =3D rcu_torture_stall_init(); - if (firsterr) + if (torture_init_error(firsterr)) goto unwind; firsterr =3D rcu_torture_fwd_prog_init(); - if (firsterr) + if (torture_init_error(firsterr)) goto unwind; firsterr =3D rcu_torture_barrier_init(); - if (firsterr) + if (torture_init_error(firsterr)) goto unwind; firsterr =3D rcu_torture_read_exit_init(); - if (firsterr) + if (torture_init_error(firsterr)) goto unwind; if (object_debug) rcu_test_debug_objects(); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11FF9C00140 for ; Mon, 15 Aug 2022 18:50:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243591AbiHOSu2 (ORCPT ); Mon, 15 Aug 2022 14:50:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243886AbiHOSp7 (ORCPT ); Mon, 15 Aug 2022 14:45:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8204E3134B; Mon, 15 Aug 2022 11:27: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 C388AB8107E; Mon, 15 Aug 2022 18:27:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14AD3C43470; Mon, 15 Aug 2022 18:27:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588062; bh=TsSpg9xei03B3IEjwmKrEgwfTR9D4NPgnrc2GqCzx+U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x+L7JPq+7teDBwzkuMYF6FP6i22KmbCaZJW0I1SrO4j0A6QFhNeeqVd/3WaXKA9H5 bsaTlmZRvB8C4pdFaoXbUN7aF+UWvzyS0ChHk4iRqOO67Dyi8ULBBYuL08fYBB+HzM 1vZyz3GRwvP1tFyMhOfiaqNGN+U+1YLAR9RyVrvo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Paul E. McKenney" , Sasha Levin Subject: [PATCH 5.15 283/779] rcutorture: Dont cpuhp_remove_state() if cpuhp_setup_state() failed Date: Mon, 15 Aug 2022 19:58:47 +0200 Message-Id: <20220815180349.403405923@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 fd13fe16db0d82612b260640f4e26f6d9d1e11fd ] Currently, in CONFIG_RCU_BOOST kernels, if the rcu_torture_init() function's call to cpuhp_setup_state() fails, rcu_torture_cleanup() gamely passes nonsense to cpuhp_remove_state(). This results in strange and misleading splats. This commit therefore ensures that if the rcu_torture_init() function's call to cpuhp_setup_state() fails, rcu_torture_cleanup() avoids invoking cpuhp_remove_state(). Signed-off-by: Paul E. McKenney Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- kernel/rcu/rcutorture.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index c1b36c52e896..3262330d1679 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -2848,7 +2848,7 @@ rcu_torture_cleanup(void) rcutorture_seq_diff(gp_seq, start_gp_seq)); torture_stop_kthread(rcu_torture_stats, stats_task); torture_stop_kthread(rcu_torture_fqs, fqs_task); - if (rcu_torture_can_boost()) + if (rcu_torture_can_boost() && rcutor_hp >=3D 0) cpuhp_remove_state(rcutor_hp); =20 /* @@ -3161,9 +3161,9 @@ rcu_torture_init(void) firsterr =3D cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "RCU_TORTURE", rcutorture_booster_init, rcutorture_booster_cleanup); + rcutor_hp =3D firsterr; if (torture_init_error(firsterr)) goto unwind; - rcutor_hp =3D firsterr; =20 // Testing RCU priority boosting requires rcutorture do // some serious abuse. Counter this by running ksoftirqd --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69970C00140 for ; Mon, 15 Aug 2022 18:51:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244207AbiHOSug (ORCPT ); Mon, 15 Aug 2022 14:50:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243908AbiHOSqC (ORCPT ); Mon, 15 Aug 2022 14:46:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6436131368; Mon, 15 Aug 2022 11:27: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 E6206B81084; Mon, 15 Aug 2022 18:27:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E9C3C433D7; Mon, 15 Aug 2022 18:27:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588065; bh=BxpY6iIlfLnFd1njRfSfnNl01nNyiLcBbiK0AkRMjks=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gNtRgD8U6SXizNBNZUug5Sc0xmYhij12ZlXwqdfOXB5upG5SUZgnSsbDOtB07Jfdk /yf+QhcmNBvwd4yR6oHvzlsuhukduFI4Gpg3qe+n0xip52VaSyUXy8MPUPa2VUgz1P WwwBNjKIaeFceC1AggPpcNlBEtJQMmwyjYi8xBbc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Frederic Weisbecker , "Paul E. McKenney" , Sasha Levin Subject: [PATCH 5.15 284/779] rcutorture: Fix ksoftirqd boosting timing and iteration Date: Mon, 15 Aug 2022 19:58:48 +0200 Message-Id: <20220815180349.450307256@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Frederic Weisbecker [ Upstream commit 3002153a91a9732a6d1d0bb95138593c7da15743 ] The RCU priority boosting can fail in two situations: 1) If (nr_cpus=3D > maxcpus=3D), which means if the total number of CPUs is higher than those brought online at boot, then torture_onoff() may later bring up CPUs that weren't online on boot. Now since rcutorture initialization only boosts the ksoftirqds of the CPUs that have been set online on boot, the CPUs later set online by torture_onoff won't benefit from the boost, making RCU priority boosting fail. 2) The ksoftirqd kthreads are boosted after the creation of rcu_torture_boost() kthreads, which opens a window large enough for these rcu_torture_boost() kthreads to wait (despite running at FIFO priority) for ksoftirqds that are still running at SCHED_NORMAL priority. The issues can trigger for example with: ./kvm.sh --configs TREE01 --kconfig "CONFIG_RCU_BOOST=3Dy" [ 34.968561] rcu-torture: !!! [ 34.968627] ------------[ cut here ]------------ [ 35.014054] WARNING: CPU: 4 PID: 114 at kernel/rcu/rcutorture.c:1979 rc= u_torture_stats_print+0x5ad/0x610 [ 35.052043] Modules linked in: [ 35.069138] CPU: 4 PID: 114 Comm: rcu_torture_sta Not tainted 5.18.0-rc= 1 #1 [ 35.096424] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS re= l-1.14.0-0-g155821a-rebuilt.opensuse.org 04/01/2014 [ 35.154570] RIP: 0010:rcu_torture_stats_print+0x5ad/0x610 [ 35.198527] Code: 63 1b 02 00 74 02 0f 0b 48 83 3d 35 63 1b 02 00 74 02= 0f 0b 48 83 3d 21 63 1b 02 00 74 02 0f 0b 48 83 3d 0d 63 1b 02 00 74 02 <0= f> 0b 83 eb 01 0f 8e ba fc ff ff 0f 0b e9 b3 fc ff f82 [ 37.251049] RSP: 0000:ffffa92a0050bdf8 EFLAGS: 00010202 [ 37.277320] rcu: De-offloading 8 [ 37.290367] RAX: 0000000000000000 RBX: 0000000000000001 RCX: 0000000000= 000001 [ 37.290387] RDX: 0000000000000000 RSI: 00000000ffffbfff RDI: 00000000ff= ffffff [ 37.290398] RBP: 000000000000007b R08: 0000000000000000 R09: c0000000ff= ffbfff [ 37.290407] R10: 000000000000002a R11: ffffa92a0050bc18 R12: ffffa92a00= 50be20 [ 37.290417] R13: ffffa92a0050be78 R14: 0000000000000000 R15: 0000000000= 01bea0 [ 37.290427] FS: 0000000000000000(0000) GS:ffff96045eb00000(0000) knlGS= :0000000000000000 [ 37.290448] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 37.290460] CR2: 0000000000000000 CR3: 000000001dc0c000 CR4: 0000000000= 0006e0 [ 37.290470] Call Trace: [ 37.295049] [ 37.295065] ? preempt_count_add+0x63/0x90 [ 37.295095] ? _raw_spin_lock_irqsave+0x12/0x40 [ 37.295125] ? rcu_torture_stats_print+0x610/0x610 [ 37.295143] rcu_torture_stats+0x29/0x70 [ 37.295160] kthread+0xe3/0x110 [ 37.295176] ? kthread_complete_and_exit+0x20/0x20 [ 37.295193] ret_from_fork+0x22/0x30 [ 37.295218] Fix this with boosting the ksoftirqds kthreads from the boosting hotplug callback itself and before the boosting kthreads are created. Fixes: ea6d962e80b6 ("rcutorture: Judge RCU priority boosting on grace peri= ods, not callbacks") Signed-off-by: Frederic Weisbecker Signed-off-by: Paul E. McKenney Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- kernel/rcu/rcutorture.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c index 3262330d1679..d820ef615475 100644 --- a/kernel/rcu/rcutorture.c +++ b/kernel/rcu/rcutorture.c @@ -1991,6 +1991,19 @@ static int rcutorture_booster_init(unsigned int cpu) if (boost_tasks[cpu] !=3D NULL) return 0; /* Already created, nothing more to do. */ =20 + // Testing RCU priority boosting requires rcutorture do + // some serious abuse. Counter this by running ksoftirqd + // at higher priority. + if (IS_BUILTIN(CONFIG_RCU_TORTURE_TEST)) { + struct sched_param sp; + struct task_struct *t; + + t =3D per_cpu(ksoftirqd, cpu); + WARN_ON_ONCE(!t); + sp.sched_priority =3D 2; + sched_setscheduler_nocheck(t, SCHED_FIFO, &sp); + } + /* Don't allow time recalculation while creating a new task. */ mutex_lock(&boost_mutex); rcu_torture_disable_rt_throttle(); @@ -3164,21 +3177,6 @@ rcu_torture_init(void) rcutor_hp =3D firsterr; if (torture_init_error(firsterr)) goto unwind; - - // Testing RCU priority boosting requires rcutorture do - // some serious abuse. Counter this by running ksoftirqd - // at higher priority. - if (IS_BUILTIN(CONFIG_RCU_TORTURE_TEST)) { - for_each_online_cpu(cpu) { - struct sched_param sp; - struct task_struct *t; - - t =3D per_cpu(ksoftirqd, cpu); - WARN_ON_ONCE(!t); - sp.sched_priority =3D 2; - sched_setscheduler_nocheck(t, SCHED_FIFO, &sp); - } - } } shutdown_jiffies =3D jiffies + shutdown_secs * HZ; firsterr =3D torture_shutdown_init(shutdown_secs, rcu_torture_cleanup); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 474C4C25B08 for ; Mon, 15 Aug 2022 18:51:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244293AbiHOSur (ORCPT ); Mon, 15 Aug 2022 14:50:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243942AbiHOSqI (ORCPT ); Mon, 15 Aug 2022 14:46:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 849283135F; Mon, 15 Aug 2022 11:27: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 A6C4160EEB; Mon, 15 Aug 2022 18:27:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94D1FC433D6; Mon, 15 Aug 2022 18:27:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588072; bh=r3gFHJXvMQTsie8xZMIS5wiBAkPF8wfD8WAJ2H1V96E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KT/kHU47yC9mC6wAz4WfoMX2LSvUvs5aiRI05ObHGS4VVD5C0IHKxhYHdNS+Rj87K K8BoJGDkBlVtUg/nD6xKsCUdRSlMDoKvePqGAwvZP/FQaM08gLpNFxYhp8EMkuxoj9 XR3k+kSwgGfdfSM1M9qEbbgOwop2+RlFXvuZiL6c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jian Shen , John Fastabend , Alexei Starovoitov , Sasha Levin Subject: [PATCH 5.15 285/779] test_bpf: fix incorrect netdev features Date: Mon, 15 Aug 2022 19:58:49 +0200 Message-Id: <20220815180349.484552952@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jian Shen [ Upstream commit 9676feccacdb0571791c88b23e3b7ac4e7c9c457 ] The prototype of .features is netdev_features_t, it should use NETIF_F_LLTX and NETIF_F_HW_VLAN_STAG_TX, not NETIF_F_LLTX_BIT and NETIF_F_HW_VLAN_STAG_TX_BIT. Fixes: cf204a718357 ("bpf, testing: Introduce 'gso_linear_no_head_frag' skb= _segment test") Signed-off-by: Jian Shen Acked-by: John Fastabend Link: https://lore.kernel.org/r/20220622135002.8263-1-shenjian15@huawei.com Signed-off-by: Alexei Starovoitov Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- lib/test_bpf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/test_bpf.c b/lib/test_bpf.c index 68d125b409f2..84f5dd3b0fc7 100644 --- a/lib/test_bpf.c +++ b/lib/test_bpf.c @@ -8890,9 +8890,9 @@ static struct skb_segment_test skb_segment_tests[] __= initconst =3D { .build_skb =3D build_test_skb_linear_no_head_frag, .features =3D NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_GSO | - NETIF_F_LLTX_BIT | NETIF_F_GRO | + NETIF_F_LLTX | NETIF_F_GRO | NETIF_F_IPV6_CSUM | NETIF_F_RXCSUM | - NETIF_F_HW_VLAN_STAG_TX_BIT + NETIF_F_HW_VLAN_STAG_TX } }; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 663ECC282E7 for ; Mon, 15 Aug 2022 18:51:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244319AbiHOSu5 (ORCPT ); Mon, 15 Aug 2022 14:50:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243978AbiHOSqO (ORCPT ); Mon, 15 Aug 2022 14:46: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 AF7BB3FA29; Mon, 15 Aug 2022 11:27: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 5BF2BB8106C; Mon, 15 Aug 2022 18:27:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E914C433D6; Mon, 15 Aug 2022 18:27:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588075; bh=hYBvICLMS9A7g+4gD3UtJkpPzToAMIOOW5sERuULXvQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q08h0VUtnSeUR8ni9Ajkm8G6nDELeqBiy3kBQm1UQ4vKTEqEWKJY8y+aw29IrNvak 4k8ILVoBVlNXRwe99ImUaVofYolVLM5cfSP7W/gkVw+iDxUhFu2KojSX7YDYPz11vU ka/3OO0tDSmIVSOnn+GMYDMJI07OcGMxoD9Z3HwY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Lendacky , Herbert Xu , Sasha Levin Subject: [PATCH 5.15 286/779] crypto: ccp - During shutdown, check SEV data pointer before using Date: Mon, 15 Aug 2022 19:58:50 +0200 Message-Id: <20220815180349.525914719@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Lendacky [ Upstream commit 1b05ece0c931536c0a38a9385e243a7962e933f6 ] On shutdown, each CCP device instance performs shutdown processing. However, __sev_platform_shutdown_locked() uses the controlling psp structure to obtain the pointer to the sev_device structure. However, during driver initialization, it is possible that an error can be received from the firmware that results in the sev_data pointer being cleared from the controlling psp structure. The __sev_platform_shutdown_locked() function does not check for this situation and will segfault. While not common, this scenario should be accounted for. Add a check for a NULL sev_device structure before attempting to use it. Fixes: 5441a07a127f ("crypto: ccp - shutdown SEV firmware on kexec") Signed-off-by: Tom Lendacky Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/crypto/ccp/sev-dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c index 8cf86dae20a4..900727b5edda 100644 --- a/drivers/crypto/ccp/sev-dev.c +++ b/drivers/crypto/ccp/sev-dev.c @@ -314,7 +314,7 @@ static int __sev_platform_shutdown_locked(int *error) struct sev_device *sev =3D psp_master->sev_data; int ret; =20 - if (sev->state =3D=3D SEV_STATE_UNINIT) + if (!sev || sev->state =3D=3D SEV_STATE_UNINIT) return 0; =20 ret =3D __sev_do_cmd_locked(SEV_CMD_SHUTDOWN, NULL, error); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 769DBC28B2B for ; Mon, 15 Aug 2022 18:51:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244353AbiHOSvB (ORCPT ); Mon, 15 Aug 2022 14:51:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244003AbiHOSqU (ORCPT ); Mon, 15 Aug 2022 14:46: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 E82833FA28; Mon, 15 Aug 2022 11:27: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 6DF9861028; Mon, 15 Aug 2022 18:27:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 342F6C433C1; Mon, 15 Aug 2022 18:27:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588078; bh=A/7L7qdPZrdDnu57+1oW0UmXRuUAqgLCJZWnb6neBG0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QEE0tSGQzmVDfO4gqcEiPEXWFtQzuUkPXKnoPtLvVb7tPv5isAea+3K2m1Qg9ULGI +t17c0bh1LLgwD0bolRk8dR0ktXZxFttEYA+uzkr1SPzQyZfTUH7SR1X2MSzsYBI+H K1/oPNjuoljsCxWb5Yxekk8cJxRHFwJodj11qRuU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Laurent Pinchart , Sam Ravnborg , Sasha Levin Subject: [PATCH 5.15 287/779] drm: bridge: adv7511: Add check for mipi_dsi_driver_register Date: Mon, 15 Aug 2022 19:58:51 +0200 Message-Id: <20220815180349.566051226@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiasheng Jiang [ Upstream commit 831463667b5f4f1e5bce9c3b94e9e794d2bc8923 ] As mipi_dsi_driver_register could return error if fails, it should be better to check the return value and return error if fails. Moreover, if i2c_add_driver fails, mipi_dsi_driver_register should be reverted. Fixes: 1e4d58cd7f88 ("drm/bridge: adv7533: Create a MIPI DSI device") Signed-off-by: Jiasheng Jiang Reviewed-by: Laurent Pinchart Signed-off-by: Sam Ravnborg Link: https://patchwork.freedesktop.org/patch/msgid/20220602103401.2980938-= 1-jiasheng@iscas.ac.cn Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm= /bridge/adv7511/adv7511_drv.c index 1aadc6e94fde..7e3f6633f255 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c @@ -1379,10 +1379,21 @@ static struct i2c_driver adv7511_driver =3D { =20 static int __init adv7511_init(void) { - if (IS_ENABLED(CONFIG_DRM_MIPI_DSI)) - mipi_dsi_driver_register(&adv7533_dsi_driver); + int ret; + + if (IS_ENABLED(CONFIG_DRM_MIPI_DSI)) { + ret =3D mipi_dsi_driver_register(&adv7533_dsi_driver); + if (ret) + return ret; + } =20 - return i2c_add_driver(&adv7511_driver); + ret =3D i2c_add_driver(&adv7511_driver); + if (ret) { + if (IS_ENABLED(CONFIG_DRM_MIPI_DSI)) + mipi_dsi_driver_unregister(&adv7533_dsi_driver); + } + + return ret; } module_init(adv7511_init); =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8CB0DC3F6B0 for ; Mon, 15 Aug 2022 18:51:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244392AbiHOSvF (ORCPT ); Mon, 15 Aug 2022 14:51:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244072AbiHOSq3 (ORCPT ); Mon, 15 Aug 2022 14:46:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72189402D5; Mon, 15 Aug 2022 11:28: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 9D2A2B81081; Mon, 15 Aug 2022 18:28:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7AE2C433C1; Mon, 15 Aug 2022 18:28:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588082; bh=D/y4d5pdZ1Tbn7G1nCT5Caup0UrGiQVHDoH3a+sxbaA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SgB8HwO65xIv9fCjL1CeTAD5QLn9+aapk7iPjNBrB2ifHWrRgsWJKOnIWtWBK454Z Oz07Xr6AU6i1B9Yf4nFIk0ZBllVH9L0OBOC0ThtQb0nHo/gCT/iTqzz4WfmKoVtMW1 s13P04OviMF0jkQvwpqmKrO0/oFzW4Z4zGhKmbr8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Mirela Rabulea , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.15 288/779] media: imx-jpeg: Disable slot interrupt when frame done Date: Mon, 15 Aug 2022 19:58:52 +0200 Message-Id: <20220815180349.606620241@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Qian [ Upstream commit 22a2bc88c139dc9757bdb1d0a3665ac27edc79a5 ] The interrupt STMBUF_HALF may be triggered after frame done. It may led to system hang if driver try to access the register after power off. Disable the slot interrupt when frame done. Fixes: 2db16c6ed72ce ("media: imx-jpeg: Add V4L2 driver for i.MX8 JPEG Enco= der/Decoder") Signed-off-by: Ming Qian Reviewed-by: Mirela Rabulea Tested-by: Mirela Rabulea Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/media/platform/imx-jpeg/mxc-jpeg-hw.c | 5 +++++ drivers/media/platform/imx-jpeg/mxc-jpeg-hw.h | 1 + drivers/media/platform/imx-jpeg/mxc-jpeg.c | 10 ++-------- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg-hw.c b/drivers/media/= platform/imx-jpeg/mxc-jpeg-hw.c index 29c604b1b179..718b7b08f93e 100644 --- a/drivers/media/platform/imx-jpeg/mxc-jpeg-hw.c +++ b/drivers/media/platform/imx-jpeg/mxc-jpeg-hw.c @@ -79,6 +79,11 @@ void mxc_jpeg_enable_irq(void __iomem *reg, int slot) writel(0xFFFFFFFF, reg + MXC_SLOT_OFFSET(slot, SLOT_IRQ_EN)); } =20 +void mxc_jpeg_disable_irq(void __iomem *reg, int slot) +{ + writel(0x0, reg + MXC_SLOT_OFFSET(slot, SLOT_IRQ_EN)); +} + void mxc_jpeg_sw_reset(void __iomem *reg) { /* diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg-hw.h b/drivers/media/= platform/imx-jpeg/mxc-jpeg-hw.h index 12f132a83a23..bf4e1973a066 100644 --- a/drivers/media/platform/imx-jpeg/mxc-jpeg-hw.h +++ b/drivers/media/platform/imx-jpeg/mxc-jpeg-hw.h @@ -125,6 +125,7 @@ u32 mxc_jpeg_get_offset(void __iomem *reg, int slot); void mxc_jpeg_enable_slot(void __iomem *reg, int slot); void mxc_jpeg_set_l_endian(void __iomem *reg, int le); void mxc_jpeg_enable_irq(void __iomem *reg, int slot); +void mxc_jpeg_disable_irq(void __iomem *reg, int slot); int mxc_jpeg_set_input(void __iomem *reg, u32 in_buf, u32 bufsize); int mxc_jpeg_set_output(void __iomem *reg, u16 out_pitch, u32 out_buf, u16 w, u16 h); diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg.c b/drivers/media/pla= tform/imx-jpeg/mxc-jpeg.c index da80167cb57d..aeb3704cfff0 100644 --- a/drivers/media/platform/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/imx-jpeg/mxc-jpeg.c @@ -579,15 +579,8 @@ static irqreturn_t mxc_jpeg_dec_irq(int irq, void *pri= v) dev_dbg(dev, "Irq %d on slot %d.\n", irq, slot); =20 ctx =3D v4l2_m2m_get_curr_priv(jpeg->m2m_dev); - if (!ctx) { - dev_err(dev, - "Instance released before the end of transaction.\n"); - /* soft reset only resets internal state, not registers */ - mxc_jpeg_sw_reset(reg); - /* clear all interrupts */ - writel(0xFFFFFFFF, reg + MXC_SLOT_OFFSET(slot, SLOT_STATUS)); + if (WARN_ON(!ctx)) goto job_unlock; - } =20 if (slot !=3D ctx->slot) { /* TODO investigate when adding multi-instance support */ @@ -659,6 +652,7 @@ static irqreturn_t mxc_jpeg_dec_irq(int irq, void *priv) buf_state =3D VB2_BUF_STATE_DONE; =20 buffers_done: + mxc_jpeg_disable_irq(reg, ctx->slot); jpeg->slot_data[slot].used =3D false; /* unused, but don't free */ mxc_jpeg_check_and_set_last_buffer(ctx, src_buf, dst_buf); v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D04CCC25B0E for ; Mon, 15 Aug 2022 18:58:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244598AbiHOS61 (ORCPT ); Mon, 15 Aug 2022 14:58:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244715AbiHOSzp (ORCPT ); Mon, 15 Aug 2022 14:55:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51175128; Mon, 15 Aug 2022 11:30: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 657A460F9F; Mon, 15 Aug 2022 18:30:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05AFFC433C1; Mon, 15 Aug 2022 18:30:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588213; bh=2VervNbxgxeZXfNV44+wbwlA2Se2WoQVV5BHYKxRI50=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rw3SgLBYYD/cI2VllJBa4bXww5D7cClzDgxyQ4+3dt4Y1lDgO/moo7A4nFtAnNTc8 tPBFvFv5xixsD5IKqkc4fprF8uOqr+VAd/oI25BjB0C8qO4wGRYz76Ix5ugpwe27uO 4FPTWTEevvo+8cjsapUnA/qHDBvFmqIvj1cV8k8M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Linus Walleij , Sasha Levin Subject: [PATCH 5.15 289/779] drm/mcde: Fix refcount leak in mcde_dsi_bind Date: Mon, 15 Aug 2022 19:58:53 +0200 Message-Id: <20220815180349.642523280@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 3a149169e4a2f9127022fec6ef5d71b4e804b3b9 ] Every iteration of for_each_available_child_of_node() decrements the reference counter of the previous node. There is no decrement when break out from the loop and results in refcount leak. Add missing of_node_put() to fix this. Fixes: 5fc537bfd000 ("drm/mcde: Add new driver for ST-Ericsson MCDE") Signed-off-by: Miaoqian Lin Signed-off-by: Linus Walleij Link: https://patchwork.freedesktop.org/patch/msgid/20220525115411.65455-1-= linmq006@gmail.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/mcde/mcde_dsi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/mcde/mcde_dsi.c b/drivers/gpu/drm/mcde/mcde_ds= i.c index 180ebbccbeda..0b58d7f4ba78 100644 --- a/drivers/gpu/drm/mcde/mcde_dsi.c +++ b/drivers/gpu/drm/mcde/mcde_dsi.c @@ -1111,6 +1111,7 @@ static int mcde_dsi_bind(struct device *dev, struct d= evice *master, bridge =3D of_drm_find_bridge(child); if (!bridge) { dev_err(dev, "failed to find bridge\n"); + of_node_put(child); return -EINVAL; } } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77F5CC00140 for ; Mon, 15 Aug 2022 18:52:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244154AbiHOSws (ORCPT ); Mon, 15 Aug 2022 14:52:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243811AbiHOSrT (ORCPT ); Mon, 15 Aug 2022 14:47:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF02C422D1; Mon, 15 Aug 2022 11:28: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 CC336B81062; Mon, 15 Aug 2022 18:28:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2836BC43140; Mon, 15 Aug 2022 18:28:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588108; bh=a31WYOj3u0YxhhWWPGE8uaQmFHl6yu7OQLekdTH58ts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u+hawDHH3ocb5xzJ8ko/OWiNMzq6J4vgIVrEA2PBzm2sN0ok4HtbSE/HJJhkMBsX8 nGOUZAYot1FUGJwoUJ1VNn//7z3IdnIxEeIwthgmL9x1ITJfrpme/YQ4eGP9faxfFa UYxlhqvhiphYZ+ruG1S9JVjZuTJcM94Wj50qE1UY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Niels Dossche , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.15 290/779] media: hdpvr: fix error value returns in hdpvr_read Date: Mon, 15 Aug 2022 19:58:54 +0200 Message-Id: <20220815180349.674403989@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 359c27c6ddbde404f44a9c0d3ec88ccd1e2042f2 ] Error return values are supposed to be negative in hdpvr_read. Most error returns are currently handled via an unsigned integer "ret". When setting a negative error value to "ret", the value actually becomes a large positive value, because "ret" is unsigned. Later on, the "ret" value is returned. But as ssize_t is a 64-bit signed number, the error return value stays a large positive integer instead of a negative integer. This can cause an error value to be interpreted as the read size, which can cause a buffer overread for applications relying on the returned size. Fixes: 9aba42efe85b ("V4L/DVB (11096): V4L2 Driver for the Hauppauge HD PVR= usb capture device") Signed-off-by: Niels Dossche Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/media/usb/hdpvr/hdpvr-video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/usb/hdpvr/hdpvr-video.c b/drivers/media/usb/hdpv= r/hdpvr-video.c index 60e57e0f1927..fd7d2a9d0449 100644 --- a/drivers/media/usb/hdpvr/hdpvr-video.c +++ b/drivers/media/usb/hdpvr/hdpvr-video.c @@ -409,7 +409,7 @@ static ssize_t hdpvr_read(struct file *file, char __use= r *buffer, size_t count, struct hdpvr_device *dev =3D video_drvdata(file); struct hdpvr_buffer *buf =3D NULL; struct urb *urb; - unsigned int ret =3D 0; + int ret =3D 0; int rem, cnt; =20 if (*pos) --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 173F0C00140 for ; Mon, 15 Aug 2022 18:53:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244420AbiHOSxq (ORCPT ); Mon, 15 Aug 2022 14:53:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244367AbiHOSvD (ORCPT ); Mon, 15 Aug 2022 14:51: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 02D0E4507D; Mon, 15 Aug 2022 11:29: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 524AC60FD0; Mon, 15 Aug 2022 18:29:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44D19C433C1; Mon, 15 Aug 2022 18:29:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588142; bh=g1mk+vmcxktkc1t9tqPGfbG+JhLYSmNUrGkq/633Ips=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j71Rh768OTwCyr6TNZwL/R9cTbVeHuEIuXBaBVvfWonBd8YRdkUNlCiEKgrQjCVz/ slk6hSHGzOmvgjaz3D5SyuTkJq/TRd9PMioxWGdoEka8nNh7v4gptWPUXkXM9J4n4U 93Eyy4ZQRMJfAMuB60bRqy9DFSSWsjk+PkAroKIE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Qian , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.15 291/779] media: v4l2-mem2mem: prevent pollerr when last_buffer_dequeued is set Date: Mon, 15 Aug 2022 19:58:55 +0200 Message-Id: <20220815180349.712391088@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ming Qian [ Upstream commit d4de27a9b1eadd33a2e40de87a646d1bf5fef756 ] If the last buffer was dequeued from the capture queue, signal userspace. DQBUF(CAPTURE) will return -EPIPE. But if output queue is empty and capture queue is empty, v4l2_m2m_poll_for_data will return EPOLLERR, This is very easy to happen in drain. When last_buffer_dequeued is set, we shouldn't return EPOLLERR, but return EPOLLIN | EPOLLRDNORM. Fixes: 1698a7f151126 ("media: v4l2-mem2mem: simplify poll logic") Signed-off-by: Ming Qian Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/media/v4l2-core/v4l2-mem2mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-co= re/v4l2-mem2mem.c index 3de683b5e06d..8aeed39c415f 100644 --- a/drivers/media/v4l2-core/v4l2-mem2mem.c +++ b/drivers/media/v4l2-core/v4l2-mem2mem.c @@ -924,7 +924,7 @@ static __poll_t v4l2_m2m_poll_for_data(struct file *fil= e, if ((!src_q->streaming || src_q->error || list_empty(&src_q->queued_list)) && (!dst_q->streaming || dst_q->error || - list_empty(&dst_q->queued_list))) + (list_empty(&dst_q->queued_list) && !dst_q->last_buffer_dequeued))) return EPOLLERR; =20 spin_lock_irqsave(&src_q->done_lock, flags); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0EC2FC00140 for ; Mon, 15 Aug 2022 18:55:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244332AbiHOSzS (ORCPT ); Mon, 15 Aug 2022 14:55:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244755AbiHOSvv (ORCPT ); Mon, 15 Aug 2022 14:51: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 651AF474F4; Mon, 15 Aug 2022 11:29:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BE10CB81062; Mon, 15 Aug 2022 18:29:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1938AC433D6; Mon, 15 Aug 2022 18:29:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588178; bh=1epsVxATSZFmvE/+LKcAw9ma1DkPFnaS/bMMkv+nrm0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NfCj/U8cOFFungxm+vXnFSAqYvm+mjwKp0tZAS4VUYJzVHK2YlurTltF/EaObT86u Fd8iNGrZWqL8jLJ74oKCaM3iTbenqZCe0tZmzbwsVprR2jMgGHKKKmn83HnbnucnQn 4VtvWpWdLv0PHsWefjEyENKpPVTGyy87i7IK73f0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Jian Zhang , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.15 292/779] media: driver/nxp/imx-jpeg: fix a unexpected return value problem Date: Mon, 15 Aug 2022 19:58:56 +0200 Message-Id: <20220815180349.760209981@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jian Zhang [ Upstream commit 5b304046a81eda221b5d06a9c62f7b5e45530fa5 ] In function mxc_jpeg_probe(), when devm_clk_get() fail, the return value will be unexpected, and it should be the devm_clk_get's error code. Fixes: 4c2e5156d9fa6 ("media: imx-jpeg: Add pm-runtime support for imx-jpeg= ") Reported-by: Hulk Robot Signed-off-by: Jian Zhang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/media/platform/imx-jpeg/mxc-jpeg.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg.c b/drivers/media/pla= tform/imx-jpeg/mxc-jpeg.c index aeb3704cfff0..984fcdfa0f09 100644 --- a/drivers/media/platform/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/imx-jpeg/mxc-jpeg.c @@ -2108,12 +2108,14 @@ static int mxc_jpeg_probe(struct platform_device *p= dev) jpeg->clk_ipg =3D devm_clk_get(dev, "ipg"); if (IS_ERR(jpeg->clk_ipg)) { dev_err(dev, "failed to get clock: ipg\n"); + ret =3D PTR_ERR(jpeg->clk_ipg); goto err_clk; } =20 jpeg->clk_per =3D devm_clk_get(dev, "per"); if (IS_ERR(jpeg->clk_per)) { dev_err(dev, "failed to get clock: per\n"); + ret =3D PTR_ERR(jpeg->clk_per); goto err_clk; } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3FC7DC25B0E for ; Mon, 15 Aug 2022 18:57:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229611AbiHOS5c (ORCPT ); Mon, 15 Aug 2022 14:57:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34472 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244305AbiHOSxH (ORCPT ); Mon, 15 Aug 2022 14:53:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8DF8481DA; Mon, 15 Aug 2022 11:29:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0EBA3B8106C; Mon, 15 Aug 2022 18:29:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F718C433C1; Mon, 15 Aug 2022 18:29:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588194; bh=zkcR0TpSskPaMHhtJO8TQPX3DUVVd6bVpF2lpjf73/c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nA7hPClVV4OYTFPn/mK5J+f/CzrXwhEV0AQBBHpxu/RZ0HeEm17Cr37FC1KIJl81A QJW7RWJbLwJgiQpUozMPyoYgB7/y6Od9HEKWmad7c8cffLwpg9akEXjd9lM7G9Ri0k f38k66+Fakd2HBi2TrqcrmZI5RxbIRcbaFq+ZnF4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.15 293/779] media: tw686x: Fix memory leak in tw686x_video_init Date: Mon, 15 Aug 2022 19:58:57 +0200 Message-Id: <20220815180349.810320432@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit e0b212ec9d8177d6f7c404315293f6a085d6ee42 ] video_device_alloc() allocates memory for vdev, when video_register_device() fails, it doesn't release the memory and leads to memory leak, call video_device_release() to fix this. Fixes: 704a84ccdbf1 ("[media] media: Support Intersil/Techwell TW686x-based= video capture cards") Signed-off-by: Miaoqian Lin Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/media/pci/tw686x/tw686x-video.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/media/pci/tw686x/tw686x-video.c b/drivers/media/pci/tw= 686x/tw686x-video.c index b227e9e78ebd..37a20fe24241 100644 --- a/drivers/media/pci/tw686x/tw686x-video.c +++ b/drivers/media/pci/tw686x/tw686x-video.c @@ -1282,8 +1282,10 @@ int tw686x_video_init(struct tw686x_dev *dev) video_set_drvdata(vdev, vc); =20 err =3D video_register_device(vdev, VFL_TYPE_VIDEO, -1); - if (err < 0) + if (err < 0) { + video_device_release(vdev); goto error; + } vc->num =3D vdev->num; } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37641C25B08 for ; Mon, 15 Aug 2022 18:57:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243889AbiHOS5i (ORCPT ); Mon, 15 Aug 2022 14:57:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244398AbiHOSxj (ORCPT ); Mon, 15 Aug 2022 14:53:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62937B37; Mon, 15 Aug 2022 11:30: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 35DB3B81072; Mon, 15 Aug 2022 18:29:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D141C433C1; Mon, 15 Aug 2022 18:29:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588197; bh=Djxr4Q9PARgu7k/PygHtmesCsyE/lk+cgw4S9PN9t1g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pqQhw0XcFeQN4NaL2hehM7eW5GOad3eEOxWIsD7WGrss2yz7WQxAHZ9SzhLf36oai Ncp07PURco8NGsx937EGxRKzvLa5O2Kbt8cQNFokiE8pLC8tvk4YSZ7u46JsDnq2eX 5Fi59Ri2FlhbOveyVKouogSTw/6O0x88aTZnzk/0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dom Cobley , Maxime Ripard , Sasha Levin Subject: [PATCH 5.15 294/779] drm/vc4: plane: Remove subpixel positioning check Date: Mon, 15 Aug 2022 19:58:58 +0200 Message-Id: <20220815180349.858620981@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dom Cobley [ Upstream commit 517db1ab1566dba3093dbdb8de4263ba4aa66416 ] There is little harm in ignoring fractional coordinates (they just get truncated). Without this: modetest -M vc4 -F tiles,gradient -s 32:1920x1080-60 -P89@74:1920x1080*.1.1= @XR24 is rejected. We have the same issue in Kodi when trying to use zoom options on video. Note: even if all coordinates are fully integer. e.g. src:[0,0,1920,1080] dest:[-10,-10,1940,1100] it will still get rejected as drm_atomic_helper_check_plane_state uses drm_rect_clip_scaled which transforms this to fractional src coords Fixes: 21af94cf1a4c ("drm/vc4: Add support for scaling of display planes.") Signed-off-by: Dom Cobley Link: https://lore.kernel.org/r/20220613144800.326124-5-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_plane.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plan= e.c index 19161b6ab27f..e9d214d42cc7 100644 --- a/drivers/gpu/drm/vc4/vc4_plane.c +++ b/drivers/gpu/drm/vc4/vc4_plane.c @@ -332,7 +332,6 @@ static int vc4_plane_setup_clipping_and_scaling(struct = drm_plane_state *state) struct vc4_plane_state *vc4_state =3D to_vc4_plane_state(state); struct drm_framebuffer *fb =3D state->fb; struct drm_gem_cma_object *bo =3D drm_fb_cma_get_gem_obj(fb, 0); - u32 subpixel_src_mask =3D (1 << 16) - 1; int num_planes =3D fb->format->num_planes; struct drm_crtc_state *crtc_state; u32 h_subsample =3D fb->format->hsub; @@ -354,18 +353,15 @@ static int vc4_plane_setup_clipping_and_scaling(struc= t drm_plane_state *state) for (i =3D 0; i < num_planes; i++) vc4_state->offsets[i] =3D bo->paddr + fb->offsets[i]; =20 - /* We don't support subpixel source positioning for scaling. */ - if ((state->src.x1 & subpixel_src_mask) || - (state->src.x2 & subpixel_src_mask) || - (state->src.y1 & subpixel_src_mask) || - (state->src.y2 & subpixel_src_mask)) { - return -EINVAL; - } - - vc4_state->src_x =3D state->src.x1 >> 16; - vc4_state->src_y =3D state->src.y1 >> 16; - vc4_state->src_w[0] =3D (state->src.x2 - state->src.x1) >> 16; - vc4_state->src_h[0] =3D (state->src.y2 - state->src.y1) >> 16; + /* + * We don't support subpixel source positioning for scaling, + * but fractional coordinates can be generated by clipping + * so just round for now + */ + vc4_state->src_x =3D DIV_ROUND_CLOSEST(state->src.x1, 1 << 16); + vc4_state->src_y =3D DIV_ROUND_CLOSEST(state->src.y1, 1 << 16); + vc4_state->src_w[0] =3D DIV_ROUND_CLOSEST(state->src.x2, 1 << 16) - vc4_s= tate->src_x; + vc4_state->src_h[0] =3D DIV_ROUND_CLOSEST(state->src.y2, 1 << 16) - vc4_s= tate->src_y; =20 vc4_state->crtc_x =3D state->dst.x1; vc4_state->crtc_y =3D state->dst.y1; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14E12C2BB47 for ; Mon, 15 Aug 2022 18:57:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244394AbiHOS5n (ORCPT ); Mon, 15 Aug 2022 14:57:43 -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 S244472AbiHOSx5 (ORCPT ); Mon, 15 Aug 2022 14:53:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 189BC48C83; Mon, 15 Aug 2022 11:30:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7D855B81062; Mon, 15 Aug 2022 18:30:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2E25C433C1; Mon, 15 Aug 2022 18:30:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588201; bh=0N4As4azLpHBEk0eq2k/MWRlxyWK2E4iyLDYUMLXGQY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hgvkswPjp4f8h8ApA+D+YhaRXgGpmW87zraGkswrPgeO/CgpQBnRqRgzT3xEt5R+p M6TFdQregJZQYICQINJL54nWip7Op6HpNeGmynBHp/psiwbum4XbdnLgkm1XvqUm6W KfVF/i+UeCQa3ibGth+5VLHHbPi1njF2BHKOm1rk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Stevenson , Maxime Ripard , Sasha Levin Subject: [PATCH 5.15 295/779] drm/vc4: plane: Fix margin calculations for the right/bottom edges Date: Mon, 15 Aug 2022 19:58:59 +0200 Message-Id: <20220815180349.907225246@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dave Stevenson [ Upstream commit b7c3d6821627861f4ea3e1f2b595d0ed9e80aac8 ] The current plane margin calculation code clips the right and bottom edges of the range based using the left and top margins. This is obviously wrong, so let's fix it. Fixes: 666e73587f90 ("drm/vc4: Take margin setup into account when updating= planes") Signed-off-by: Dave Stevenson Link: https://lore.kernel.org/r/20220613144800.326124-6-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_plane.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_plane.c b/drivers/gpu/drm/vc4/vc4_plan= e.c index e9d214d42cc7..8574acefd40e 100644 --- a/drivers/gpu/drm/vc4/vc4_plane.c +++ b/drivers/gpu/drm/vc4/vc4_plane.c @@ -303,16 +303,16 @@ static int vc4_plane_margins_adj(struct drm_plane_sta= te *pstate) adjhdisplay, crtc_state->mode.hdisplay); vc4_pstate->crtc_x +=3D left; - if (vc4_pstate->crtc_x > crtc_state->mode.hdisplay - left) - vc4_pstate->crtc_x =3D crtc_state->mode.hdisplay - left; + if (vc4_pstate->crtc_x > crtc_state->mode.hdisplay - right) + vc4_pstate->crtc_x =3D crtc_state->mode.hdisplay - right; =20 adjvdisplay =3D crtc_state->mode.vdisplay - (top + bottom); vc4_pstate->crtc_y =3D DIV_ROUND_CLOSEST(vc4_pstate->crtc_y * adjvdisplay, crtc_state->mode.vdisplay); vc4_pstate->crtc_y +=3D top; - if (vc4_pstate->crtc_y > crtc_state->mode.vdisplay - top) - vc4_pstate->crtc_y =3D crtc_state->mode.vdisplay - top; + if (vc4_pstate->crtc_y > crtc_state->mode.vdisplay - bottom) + vc4_pstate->crtc_y =3D crtc_state->mode.vdisplay - bottom; =20 vc4_pstate->crtc_w =3D DIV_ROUND_CLOSEST(vc4_pstate->crtc_w * adjhdisplay, --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51D1AC00140 for ; Mon, 15 Aug 2022 18:58:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244515AbiHOS5s (ORCPT ); Mon, 15 Aug 2022 14:57:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244505AbiHOSyM (ORCPT ); Mon, 15 Aug 2022 14:54:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B092F48C8F; Mon, 15 Aug 2022 11:30:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F378060F9F; Mon, 15 Aug 2022 18:30:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB17AC43470; Mon, 15 Aug 2022 18:30:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588204; bh=5p72wdtJqlGgqiGZV6Xmuba4jF0CiLY0HM63e1HbpVc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XYvDkl4uooiIdb4GjvSdl5KUSlChxRXMPo38e4IQhYsWaprkALn3vBFYwvaaH9EZH i42cTWMXq8jjq8ag8ct7RNSBDFAh5XwloZ0NR77Byzu7NaoPVIWq+EywU3yRvbZ0PE DcTYZg8uP98b9QIYKzpCRz6BakIiGAPk6UVACCDE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxime Ripard , Sam Ravnborg , Sasha Levin Subject: [PATCH 5.15 296/779] drm/bridge: Add a function to abstract away panels Date: Mon, 15 Aug 2022 19:59:00 +0200 Message-Id: <20220815180349.940425632@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maxime Ripard [ Upstream commit 87ea95808d53e56b03e620e8f8f3add48899a88d ] Display drivers so far need to have a lot of boilerplate to first retrieve either the panel or bridge that they are connected to using drm_of_find_panel_or_bridge(), and then either deal with each with ad-hoc functions or create a drm panel bridge through drm_panel_bridge_add. In order to reduce the boilerplate and hopefully create a path of least resistance towards using the DRM panel bridge layer, let's create the function devm_drm_of_get_bridge() to reduce that boilerplate. Signed-off-by: Maxime Ripard Reviewed-by: Sam Ravnborg Link: https://patchwork.freedesktop.org/patch/msgid/20210910130941.1740182-= 2-maxime@cerno.tech Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/drm_bridge.c | 41 ++++++++++++++++++++++++++++++++---- drivers/gpu/drm/drm_of.c | 3 +++ include/drm/drm_bridge.h | 2 ++ 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index a8ed66751c2d..4c68733fa660 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -28,6 +28,7 @@ #include #include #include +#include #include =20 #include "drm_crtc_internal.h" @@ -51,10 +52,8 @@ * * Display drivers are responsible for linking encoders with the first bri= dge * in the chains. This is done by acquiring the appropriate bridge with - * of_drm_find_bridge() or drm_of_find_panel_or_bridge(), or creating it f= or a - * panel with drm_panel_bridge_add_typed() (or the managed version - * devm_drm_panel_bridge_add_typed()). Once acquired, the bridge shall be - * attached to the encoder with a call to drm_bridge_attach(). + * devm_drm_of_get_bridge(). Once acquired, the bridge shall be attached t= o the + * encoder with a call to drm_bridge_attach(). * * Bridges are responsible for linking themselves with the next bridge in = the * chain, if any. This is done the same way as for encoders, with the call= to @@ -1233,6 +1232,40 @@ struct drm_bridge *of_drm_find_bridge(struct device_= node *np) return NULL; } EXPORT_SYMBOL(of_drm_find_bridge); + +/** + * devm_drm_of_get_bridge - Return next bridge in the chain + * @dev: device to tie the bridge lifetime to + * @np: device tree node containing encoder output ports + * @port: port in the device tree node + * @endpoint: endpoint in the device tree node + * + * Given a DT node's port and endpoint number, finds the connected node + * and returns the associated bridge if any, or creates and returns a + * drm panel bridge instance if a panel is connected. + * + * Returns a pointer to the bridge if successful, or an error pointer + * otherwise. + */ +struct drm_bridge *devm_drm_of_get_bridge(struct device *dev, + struct device_node *np, + u32 port, u32 endpoint) +{ + struct drm_bridge *bridge; + struct drm_panel *panel; + int ret; + + ret =3D drm_of_find_panel_or_bridge(np, port, endpoint, + &panel, &bridge); + if (ret) + return ERR_PTR(ret); + + if (panel) + bridge =3D devm_drm_panel_bridge_add(dev, panel); + + return bridge; +} +EXPORT_SYMBOL(devm_drm_of_get_bridge); #endif =20 MODULE_AUTHOR("Ajay Kumar "); diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c index 997b8827fed2..37c34146eea8 100644 --- a/drivers/gpu/drm/drm_of.c +++ b/drivers/gpu/drm/drm_of.c @@ -231,6 +231,9 @@ EXPORT_SYMBOL_GPL(drm_of_encoder_active_endpoint); * return either the associated struct drm_panel or drm_bridge device. Eit= her * @panel or @bridge must not be NULL. * + * This function is deprecated and should not be used in new drivers. Use + * devm_drm_of_get_bridge() instead. + * * Returns zero if successful, or one of the standard error codes if it fa= ils. */ int drm_of_find_panel_or_bridge(const struct device_node *np, diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index 46bdfa48c413..9cdbd209388e 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -911,6 +911,8 @@ struct drm_bridge *devm_drm_panel_bridge_add(struct dev= ice *dev, struct drm_bridge *devm_drm_panel_bridge_add_typed(struct device *dev, struct drm_panel *panel, u32 connector_type); +struct drm_bridge *devm_drm_of_get_bridge(struct device *dev, struct devic= e_node *node, + u32 port, u32 endpoint); struct drm_connector *drm_panel_bridge_connector(struct drm_bridge *bridge= ); #endif =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A1A0C25B0E for ; Mon, 15 Aug 2022 18:58:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229730AbiHOS6O (ORCPT ); Mon, 15 Aug 2022 14:58:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244562AbiHOSyj (ORCPT ); Mon, 15 Aug 2022 14:54:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0571448CAF; Mon, 15 Aug 2022 11:30:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E9AD161050; Mon, 15 Aug 2022 18:30:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF013C433C1; Mon, 15 Aug 2022 18:30:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588207; bh=PRf5I9/9OWbqMYqRtr1TFnB82kwN/Tq7+SulViMUAGo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ssfxkEElTcTFnPh+t0UgsFn8eKX9EibFZcjH50MZcB97TRUqxJ/QtkbmEvb1E+G6r ee4D6Tgk86RCA7JYbqrffFN+6tFBQMobVMc2BetQ58Qe0gnpnotYrbgVm0yGE7XWWo 4VmZ9GQxFlF+Vd62b8amEYc2HTNkfCA89ASJJnm0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxime Ripard , Sam Ravnborg , Sasha Levin Subject: [PATCH 5.15 297/779] drm/vc4: dsi: Switch to devm_drm_of_get_bridge Date: Mon, 15 Aug 2022 19:59:01 +0200 Message-Id: <20220815180349.978287223@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maxime Ripard [ Upstream commit a43dd76bacd0d5441a4c84f60d64bdfaedc95bac ] The new devm_drm_of_get_bridge removes most of the boilerplate we have to deal with. Let's switch to it. Signed-off-by: Maxime Ripard Acked-by: Sam Ravnborg Link: https://patchwork.freedesktop.org/patch/msgid/20210910130941.1740182-= 4-maxime@cerno.tech Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_dsi.c | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c index ca8506316660..64dfefeb03f5 100644 --- a/drivers/gpu/drm/vc4/vc4_dsi.c +++ b/drivers/gpu/drm/vc4/vc4_dsi.c @@ -1493,7 +1493,6 @@ static int vc4_dsi_bind(struct device *dev, struct de= vice *master, void *data) struct drm_device *drm =3D dev_get_drvdata(master); struct vc4_dsi *dsi =3D dev_get_drvdata(dev); struct vc4_dsi_encoder *vc4_dsi_encoder; - struct drm_panel *panel; const struct of_device_id *match; dma_cap_mask_t dma_mask; int ret; @@ -1605,27 +1604,9 @@ static int vc4_dsi_bind(struct device *dev, struct d= evice *master, void *data) return ret; } =20 - ret =3D drm_of_find_panel_or_bridge(dev->of_node, 0, 0, - &panel, &dsi->bridge); - if (ret) { - /* If the bridge or panel pointed by dev->of_node is not - * enabled, just return 0 here so that we don't prevent the DRM - * dev from being registered. Of course that means the DSI - * encoder won't be exposed, but that's not a problem since - * nothing is connected to it. - */ - if (ret =3D=3D -ENODEV) - return 0; - - return ret; - } - - if (panel) { - dsi->bridge =3D devm_drm_panel_bridge_add_typed(dev, panel, - DRM_MODE_CONNECTOR_DSI); - if (IS_ERR(dsi->bridge)) - return PTR_ERR(dsi->bridge); - } + dsi->bridge =3D devm_drm_of_get_bridge(dev, dev->of_node, 0, 0); + if (IS_ERR(dsi->bridge)) + return PTR_ERR(dsi->bridge); =20 /* The esc clock rate is supposed to always be 100Mhz. */ ret =3D clk_set_rate(dsi->escape_clock, 100 * 1000000); @@ -1663,8 +1644,7 @@ static void vc4_dsi_unbind(struct device *dev, struct= device *master, { struct vc4_dsi *dsi =3D dev_get_drvdata(dev); =20 - if (dsi->bridge) - pm_runtime_disable(dev); + pm_runtime_disable(dev); =20 /* * Restore the bridge_chain so the bridge detach procedure can happen --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98BE2C282E7 for ; Mon, 15 Aug 2022 18:58:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244558AbiHOS6T (ORCPT ); Mon, 15 Aug 2022 14:58:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244650AbiHOSzg (ORCPT ); Mon, 15 Aug 2022 14:55:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC41048CB9; Mon, 15 Aug 2022 11:30:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 015A060EEB; Mon, 15 Aug 2022 18:30:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 087FDC433D7; Mon, 15 Aug 2022 18:30:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588210; bh=eQjlNsFUeo7Ol1B/gW2YN5f5GReWLkx2orpeVdoEiDQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=chgWhflh6GnDQXhwER+cbG3zsc+FgbhwFwK+Cek3E7ag8Gu9AfMe2vAg7vAj9cClp brtGCCTiyQicrzJK7Q5j0bkI3j4KGI1dl6xKXzXVxiZ2AiEO0qYyAlO1whdUKeQC8b O9Zs2UE6MivllzedHM8EWA9cpr7dMXGcX+TNMDZE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zeal Robot , "Minghao Chi (CGEL ZTE)" , Maxime Ripard , Sasha Levin Subject: [PATCH 5.15 298/779] drm/vc4: Use of_device_get_match_data() Date: Mon, 15 Aug 2022 19:59:02 +0200 Message-Id: <20220815180350.024639631@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 (CGEL ZTE) [ Upstream commit 9cbe89ede58294d23af06ec12c20f2ce6acc1892 ] Use of_device_get_match_data() to simplify the code. Reported-by: Zeal Robot Signed-off-by: Minghao Chi (CGEL ZTE) Signed-off-by: Maxime Ripard Link: https://patchwork.freedesktop.org/patch/msgid/20220214020530.1714631-= 1-chi.minghao@zte.com.cn Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_dsi.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c index 64dfefeb03f5..98308a17e4ed 100644 --- a/drivers/gpu/drm/vc4/vc4_dsi.c +++ b/drivers/gpu/drm/vc4/vc4_dsi.c @@ -1493,15 +1493,10 @@ static int vc4_dsi_bind(struct device *dev, struct = device *master, void *data) struct drm_device *drm =3D dev_get_drvdata(master); struct vc4_dsi *dsi =3D dev_get_drvdata(dev); struct vc4_dsi_encoder *vc4_dsi_encoder; - const struct of_device_id *match; dma_cap_mask_t dma_mask; int ret; =20 - match =3D of_match_device(vc4_dsi_dt_match, dev); - if (!match) - return -ENODEV; - - dsi->variant =3D match->data; + dsi->variant =3D of_device_get_match_data(dev); =20 vc4_dsi_encoder =3D devm_kzalloc(dev, sizeof(*vc4_dsi_encoder), GFP_KERNEL); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 799ACC25B0E for ; Mon, 15 Aug 2022 18:52:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232685AbiHOSwz (ORCPT ); Mon, 15 Aug 2022 14:52:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243825AbiHOSrU (ORCPT ); Mon, 15 Aug 2022 14:47: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 E6E55422E4; Mon, 15 Aug 2022 11:28:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 39598B8108F; Mon, 15 Aug 2022 18:28:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B406C433C1; Mon, 15 Aug 2022 18:28:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588111; bh=glN6sxhxG13vQizBKcYdIeAELf9tcp4qdEOf3tEnxBA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cryqR7vW2QnRmqy8wCuIOjm7b6heXl4xZ0B0wMMQqqTKJOFbg17uh0JCnjdkkCkdI 8AOhQSpnLgEKb+95gef9LNytSw7wRyUqiEVcC3RLSMQSj4XZIRu+JT3t/1ykiGwNg8 5qn4g0jJq8Y9of0vDOI/vo+oId4UGazNoPDdn7Io= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Stevenson , Maxime Ripard , Sasha Levin Subject: [PATCH 5.15 299/779] drm/vc4: dsi: Release workaround buffer and DMA Date: Mon, 15 Aug 2022 19:59:03 +0200 Message-Id: <20220815180350.058059034@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dave Stevenson [ Upstream commit 89c4bbe2a01ea401c2b0fabc104720809084b77f ] On Pi0-3 the driver allocates a buffer and requests a DMA channel because the ARM can't write to DSI1's registers directly. However, we never release that buffer or channel. Let's add a device-managed action to release each. Fixes: 4078f5757144 ("drm/vc4: Add DSI driver") Signed-off-by: Dave Stevenson Link: https://lore.kernel.org/r/20220613144800.326124-12-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_dsi.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c index 98308a17e4ed..e82ee94cafc7 100644 --- a/drivers/gpu/drm/vc4/vc4_dsi.c +++ b/drivers/gpu/drm/vc4/vc4_dsi.c @@ -1487,13 +1487,29 @@ vc4_dsi_init_phy_clocks(struct vc4_dsi *dsi) dsi->clk_onecell); } =20 +static void vc4_dsi_dma_mem_release(void *ptr) +{ + struct vc4_dsi *dsi =3D ptr; + struct device *dev =3D &dsi->pdev->dev; + + dma_free_coherent(dev, 4, dsi->reg_dma_mem, dsi->reg_dma_paddr); + dsi->reg_dma_mem =3D NULL; +} + +static void vc4_dsi_dma_chan_release(void *ptr) +{ + struct vc4_dsi *dsi =3D ptr; + + dma_release_channel(dsi->reg_dma_chan); + dsi->reg_dma_chan =3D NULL; +} + static int vc4_dsi_bind(struct device *dev, struct device *master, void *d= ata) { struct platform_device *pdev =3D to_platform_device(dev); struct drm_device *drm =3D dev_get_drvdata(master); struct vc4_dsi *dsi =3D dev_get_drvdata(dev); struct vc4_dsi_encoder *vc4_dsi_encoder; - dma_cap_mask_t dma_mask; int ret; =20 dsi->variant =3D of_device_get_match_data(dev); @@ -1527,6 +1543,8 @@ static int vc4_dsi_bind(struct device *dev, struct de= vice *master, void *data) * so set up a channel for talking to it. */ if (dsi->variant->broken_axi_workaround) { + dma_cap_mask_t dma_mask; + dsi->reg_dma_mem =3D dma_alloc_coherent(dev, 4, &dsi->reg_dma_paddr, GFP_KERNEL); @@ -1535,8 +1553,13 @@ static int vc4_dsi_bind(struct device *dev, struct d= evice *master, void *data) return -ENOMEM; } =20 + ret =3D devm_add_action_or_reset(dev, vc4_dsi_dma_mem_release, dsi); + if (ret) + return ret; + dma_cap_zero(dma_mask); dma_cap_set(DMA_MEMCPY, dma_mask); + dsi->reg_dma_chan =3D dma_request_chan_by_mask(&dma_mask); if (IS_ERR(dsi->reg_dma_chan)) { ret =3D PTR_ERR(dsi->reg_dma_chan); @@ -1546,6 +1569,10 @@ static int vc4_dsi_bind(struct device *dev, struct d= evice *master, void *data) return ret; } =20 + ret =3D devm_add_action_or_reset(dev, vc4_dsi_dma_chan_release, dsi); + if (ret) + return ret; + /* Get the physical address of the device's registers. The * struct resource for the regs gives us the bus address * instead. --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D57AC00140 for ; Mon, 15 Aug 2022 18:53:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244251AbiHOSxA (ORCPT ); Mon, 15 Aug 2022 14:53:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243839AbiHOSrV (ORCPT ); Mon, 15 Aug 2022 14:47:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BD59422E9; Mon, 15 Aug 2022 11:28: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 A7CE160FD0; Mon, 15 Aug 2022 18:28:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96677C433D6; Mon, 15 Aug 2022 18:28:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588115; bh=zJh7aVjy83OVBviyzmE9wu2gQP51nHf6qxEIm9t2EEo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ISMapfeWzUq0qVKFejpRUu8KsBlsWn7qZ6EFy/HLoSysz3BSOpJMPyIxpb98Kwfkc kugOKxQ/T1Ec5BhjMyuImSoitfrgSHLmcrTXa0PQmT2O+zsW8IPeJOIatG8IyfYJt4 tg6My+9tqq+16hLu8dC0iLkZ3+6yn9DRsuvp3TNw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Stevenson , Maxime Ripard , Sasha Levin Subject: [PATCH 5.15 300/779] drm/vc4: dsi: Correct DSI divider calculations Date: Mon, 15 Aug 2022 19:59:04 +0200 Message-Id: <20220815180350.104564051@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dave Stevenson [ Upstream commit 3b45eee87da171caa28f61240ddb5c21170cda53 ] The divider calculations tried to find the divider just faster than the clock requested. However if it required a divider of 7 then the for loop aborted without handling the "error" case, and could end up with a clock lower than requested. The integer divider from parent PLL to DSI clock is also capable of going up to /255, not just /7 that the driver was trying. This allows for slower link frequencies on the DSI bus where the resolution permits. Correct the loop so that we always have a clock greater than requested, and covering the whole range of dividers. Fixes: 86c1b9eff3f2 ("drm/vc4: Adjust modes in DSI to work around the integ= er PLL divider.") Signed-off-by: Dave Stevenson Link: https://lore.kernel.org/r/20220613144800.326124-13-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_dsi.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c index e82ee94cafc7..81a6c4e9576d 100644 --- a/drivers/gpu/drm/vc4/vc4_dsi.c +++ b/drivers/gpu/drm/vc4/vc4_dsi.c @@ -805,11 +805,9 @@ static bool vc4_dsi_encoder_mode_fixup(struct drm_enco= der *encoder, /* Find what divider gets us a faster clock than the requested * pixel clock. */ - for (divider =3D 1; divider < 8; divider++) { - if (parent_rate / divider < pll_clock) { - divider--; + for (divider =3D 1; divider < 255; divider++) { + if (parent_rate / (divider + 1) < pll_clock) break; - } } =20 /* Now that we've picked a PLL divider, calculate back to its --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24EEEC00140 for ; Mon, 15 Aug 2022 18:53:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244268AbiHOSxD (ORCPT ); Mon, 15 Aug 2022 14:53:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229611AbiHOSsS (ORCPT ); Mon, 15 Aug 2022 14:48:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAAC131DEE; Mon, 15 Aug 2022 11:28: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 B555C61029; Mon, 15 Aug 2022 18:28:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8BDCC433C1; Mon, 15 Aug 2022 18:28:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588118; bh=sHq264QxcHklrIWI5OzuVs2T/IbfnxE+ODEb1yfrqOs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=izCsol+6at4o7P8U586IeatCoYy8aIEDyZMVEhThLLGONWNcWPrWnwYedCzVvFklI KdHfs6y6dsWkyS50Q+sOUU3+Tpm9rWqJ1bxmCKR+PbT3fDZ4ggm/mG+9B179u0QmZO 1U9k+RZNTga2aGtygLIo8ZKxmufNfB4xW5H0BFXE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Stevenson , Maxime Ripard , Sasha Levin Subject: [PATCH 5.15 301/779] drm/vc4: dsi: Correct pixel order for DSI0 Date: Mon, 15 Aug 2022 19:59:05 +0200 Message-Id: <20220815180350.148481813@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dave Stevenson [ Upstream commit edfe84ae0df16be1251b5a8e840d95f1f3827500 ] For slightly unknown reasons, dsi0 takes a different pixel format to dsi1, and that has to be set in the pixel valve. Amend the setup accordingly. Fixes: a86773d120d7 ("drm/vc4: Add support for feeding DSI encoders from th= e pixel valve.") Signed-off-by: Dave Stevenson Link: https://lore.kernel.org/r/20220613144800.326124-14-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_crtc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c index 88dbb282d15c..5a8c3c6c91af 100644 --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c @@ -330,7 +330,8 @@ static void vc4_crtc_config_pv(struct drm_crtc *crtc, s= truct drm_atomic_state *s u32 pixel_rep =3D (mode->flags & DRM_MODE_FLAG_DBLCLK) ? 2 : 1; bool is_dsi =3D (vc4_encoder->type =3D=3D VC4_ENCODER_TYPE_DSI0 || vc4_encoder->type =3D=3D VC4_ENCODER_TYPE_DSI1); - u32 format =3D is_dsi ? PV_CONTROL_FORMAT_DSIV_24 : PV_CONTROL_FORMAT_24; + bool is_dsi1 =3D vc4_encoder->type =3D=3D VC4_ENCODER_TYPE_DSI1; + u32 format =3D is_dsi1 ? PV_CONTROL_FORMAT_DSIV_24 : PV_CONTROL_FORMAT_24; u8 ppc =3D pv_data->pixels_per_clock; bool debug_dump_regs =3D false; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC3E3C00140 for ; Mon, 15 Aug 2022 18:53:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244318AbiHOSxK (ORCPT ); Mon, 15 Aug 2022 14:53:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243618AbiHOSs6 (ORCPT ); Mon, 15 Aug 2022 14:48:58 -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 B172131DF2; Mon, 15 Aug 2022 11:28:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B343160FD0; Mon, 15 Aug 2022 18:28:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA244C433C1; Mon, 15 Aug 2022 18:28:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588121; bh=KcEV8SKvsjL468XkPQvCHNAT9nTCGEg25sQJaScv6vE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UeCv0/Ekv/Wrz3UWBkSg0TUZjqUGEE9gJsfnWbfzWvHBx46r+DkiDwkTrC0r8bUKG DlU55Z36BroX5owM5VJTsizMMipA2gcQkh3WPBFafr9jX9YXwg+swvppC++qzBHNVi BNE7N/ct3yVWg14QDZLd/Vaa9fvAIfaCex1xAZAU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Stevenson , Maxime Ripard , Sasha Levin Subject: [PATCH 5.15 302/779] drm/vc4: dsi: Register dsi0 as the correct vc4 encoder type Date: Mon, 15 Aug 2022 19:59:06 +0200 Message-Id: <20220815180350.197867110@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dave Stevenson [ Upstream commit 4d9273c978d4c1af15d7874c10c732ec83d444d0 ] vc4_dsi was registering both dsi0 and dsi1 as VC4_ENCODER_TYPE_DSI1 which seemed to work OK for a single DSI display, but fails if there are two DSI displays connected. Update to register the correct type. Fixes: 4078f5757144 ("drm/vc4: Add DSI driver") Signed-off-by: Dave Stevenson Link: https://lore.kernel.org/r/20220613144800.326124-15-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_dsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c index 81a6c4e9576d..97a258c934af 100644 --- a/drivers/gpu/drm/vc4/vc4_dsi.c +++ b/drivers/gpu/drm/vc4/vc4_dsi.c @@ -1518,7 +1518,8 @@ static int vc4_dsi_bind(struct device *dev, struct de= vice *master, void *data) return -ENOMEM; =20 INIT_LIST_HEAD(&dsi->bridge_chain); - vc4_dsi_encoder->base.type =3D VC4_ENCODER_TYPE_DSI1; + vc4_dsi_encoder->base.type =3D dsi->variant->port ? + VC4_ENCODER_TYPE_DSI1 : VC4_ENCODER_TYPE_DSI0; vc4_dsi_encoder->dsi =3D dsi; dsi->encoder =3D &vc4_dsi_encoder->base.base; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CC35C25B08 for ; Mon, 15 Aug 2022 18:53:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244342AbiHOSxQ (ORCPT ); Mon, 15 Aug 2022 14:53:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244066AbiHOStQ (ORCPT ); Mon, 15 Aug 2022 14:49:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1F114331A; Mon, 15 Aug 2022 11:28: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 BF23561028; Mon, 15 Aug 2022 18:28:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C52D2C433C1; Mon, 15 Aug 2022 18:28:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588124; bh=fZqr0HeqVX/CO92GLshtVf3UowJIdnYMudi1aIHwhnU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l/VsvdBR+Xy/DfTtvw3x3g1ZGIezg5eJsr6Cx06qikJOzSl7DEeiYOgvEAfoyVvok 3Zpy2NuK7EJgpX9ZHC0R7yZL6V4eT0OxLsrgiMQUGHtfUjAEMeoMr/B9kZw40MBqCZ gF7Akf8ZHTgis1agXUj22VzHAfGnDwB1Ra/hKLuU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Stevenson , Maxime Ripard , Sasha Levin Subject: [PATCH 5.15 303/779] drm/vc4: dsi: Fix dsi0 interrupt support Date: Mon, 15 Aug 2022 19:59:07 +0200 Message-Id: <20220815180350.246172209@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dave Stevenson [ Upstream commit bc5b815e06f90cccdb6461aba1e49fdc2f3c8cd1 ] DSI0 seemingly had very little or no testing as a load of the register mappings were incorrect/missing, so host transfers always timed out due to enabling/checking incorrect bits in the interrupt enable and status registers. Fixes: 4078f5757144 ("drm/vc4: Add DSI driver") Signed-off-by: Dave Stevenson Link: https://lore.kernel.org/r/20220613144800.326124-16-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_dsi.c | 111 ++++++++++++++++++++++++++-------- 1 file changed, 85 insertions(+), 26 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c index 97a258c934af..333ea96fcde4 100644 --- a/drivers/gpu/drm/vc4/vc4_dsi.c +++ b/drivers/gpu/drm/vc4/vc4_dsi.c @@ -181,8 +181,50 @@ =20 #define DSI0_TXPKT_PIX_FIFO 0x20 /* AKA PIX_FIFO */ =20 -#define DSI0_INT_STAT 0x24 -#define DSI0_INT_EN 0x28 +#define DSI0_INT_STAT 0x24 +#define DSI0_INT_EN 0x28 +# define DSI0_INT_FIFO_ERR BIT(25) +# define DSI0_INT_CMDC_DONE_MASK VC4_MASK(24, 23) +# define DSI0_INT_CMDC_DONE_SHIFT 23 +# define DSI0_INT_CMDC_DONE_NO_REPEAT 1 +# define DSI0_INT_CMDC_DONE_REPEAT 3 +# define DSI0_INT_PHY_DIR_RTF BIT(22) +# define DSI0_INT_PHY_D1_ULPS BIT(21) +# define DSI0_INT_PHY_D1_STOP BIT(20) +# define DSI0_INT_PHY_RXLPDT BIT(19) +# define DSI0_INT_PHY_RXTRIG BIT(18) +# define DSI0_INT_PHY_D0_ULPS BIT(17) +# define DSI0_INT_PHY_D0_LPDT BIT(16) +# define DSI0_INT_PHY_D0_FTR BIT(15) +# define DSI0_INT_PHY_D0_STOP BIT(14) +/* Signaled when the clock lane enters the given state. */ +# define DSI0_INT_PHY_CLK_ULPS BIT(13) +# define DSI0_INT_PHY_CLK_HS BIT(12) +# define DSI0_INT_PHY_CLK_FTR BIT(11) +/* Signaled on timeouts */ +# define DSI0_INT_PR_TO BIT(10) +# define DSI0_INT_TA_TO BIT(9) +# define DSI0_INT_LPRX_TO BIT(8) +# define DSI0_INT_HSTX_TO BIT(7) +/* Contention on a line when trying to drive the line low */ +# define DSI0_INT_ERR_CONT_LP1 BIT(6) +# define DSI0_INT_ERR_CONT_LP0 BIT(5) +/* Control error: incorrect line state sequence on data lane 0. */ +# define DSI0_INT_ERR_CONTROL BIT(4) +# define DSI0_INT_ERR_SYNC_ESC BIT(3) +# define DSI0_INT_RX2_PKT BIT(2) +# define DSI0_INT_RX1_PKT BIT(1) +# define DSI0_INT_CMD_PKT BIT(0) + +#define DSI0_INTERRUPTS_ALWAYS_ENABLED (DSI0_INT_ERR_SYNC_ESC | \ + DSI0_INT_ERR_CONTROL | \ + DSI0_INT_ERR_CONT_LP0 | \ + DSI0_INT_ERR_CONT_LP1 | \ + DSI0_INT_HSTX_TO | \ + DSI0_INT_LPRX_TO | \ + DSI0_INT_TA_TO | \ + DSI0_INT_PR_TO) + # define DSI1_INT_PHY_D3_ULPS BIT(30) # define DSI1_INT_PHY_D3_STOP BIT(29) # define DSI1_INT_PHY_D2_ULPS BIT(28) @@ -892,6 +934,9 @@ static void vc4_dsi_encoder_enable(struct drm_encoder *= encoder) =20 DSI_PORT_WRITE(PHY_AFEC0, afec0); =20 + /* AFEC reset hold time */ + mdelay(1); + DSI_PORT_WRITE(PHY_AFEC1, VC4_SET_FIELD(6, DSI0_PHY_AFEC1_IDR_DLANE1) | VC4_SET_FIELD(6, DSI0_PHY_AFEC1_IDR_DLANE0) | @@ -1058,12 +1103,9 @@ static void vc4_dsi_encoder_enable(struct drm_encode= r *encoder) DSI_PORT_WRITE(CTRL, DSI_PORT_READ(CTRL) | DSI1_CTRL_EN); =20 /* Bring AFE out of reset. */ - if (dsi->variant->port =3D=3D 0) { - } else { - DSI_PORT_WRITE(PHY_AFEC0, - DSI_PORT_READ(PHY_AFEC0) & - ~DSI1_PHY_AFEC0_RESET); - } + DSI_PORT_WRITE(PHY_AFEC0, + DSI_PORT_READ(PHY_AFEC0) & + ~DSI_PORT_BIT(PHY_AFEC0_RESET)); =20 vc4_dsi_ulps(dsi, false); =20 @@ -1182,13 +1224,28 @@ static ssize_t vc4_dsi_host_transfer(struct mipi_ds= i_host *host, /* Enable the appropriate interrupt for the transfer completion. */ dsi->xfer_result =3D 0; reinit_completion(&dsi->xfer_completion); - DSI_PORT_WRITE(INT_STAT, DSI1_INT_TXPKT1_DONE | DSI1_INT_PHY_DIR_RTF); - if (msg->rx_len) { - DSI_PORT_WRITE(INT_EN, (DSI1_INTERRUPTS_ALWAYS_ENABLED | - DSI1_INT_PHY_DIR_RTF)); + if (dsi->variant->port =3D=3D 0) { + DSI_PORT_WRITE(INT_STAT, + DSI0_INT_CMDC_DONE_MASK | DSI1_INT_PHY_DIR_RTF); + if (msg->rx_len) { + DSI_PORT_WRITE(INT_EN, (DSI0_INTERRUPTS_ALWAYS_ENABLED | + DSI0_INT_PHY_DIR_RTF)); + } else { + DSI_PORT_WRITE(INT_EN, + (DSI0_INTERRUPTS_ALWAYS_ENABLED | + VC4_SET_FIELD(DSI0_INT_CMDC_DONE_NO_REPEAT, + DSI0_INT_CMDC_DONE))); + } } else { - DSI_PORT_WRITE(INT_EN, (DSI1_INTERRUPTS_ALWAYS_ENABLED | - DSI1_INT_TXPKT1_DONE)); + DSI_PORT_WRITE(INT_STAT, + DSI1_INT_TXPKT1_DONE | DSI1_INT_PHY_DIR_RTF); + if (msg->rx_len) { + DSI_PORT_WRITE(INT_EN, (DSI1_INTERRUPTS_ALWAYS_ENABLED | + DSI1_INT_PHY_DIR_RTF)); + } else { + DSI_PORT_WRITE(INT_EN, (DSI1_INTERRUPTS_ALWAYS_ENABLED | + DSI1_INT_TXPKT1_DONE)); + } } =20 /* Send the packet. */ @@ -1205,7 +1262,7 @@ static ssize_t vc4_dsi_host_transfer(struct mipi_dsi_= host *host, ret =3D dsi->xfer_result; } =20 - DSI_PORT_WRITE(INT_EN, DSI1_INTERRUPTS_ALWAYS_ENABLED); + DSI_PORT_WRITE(INT_EN, DSI_PORT_BIT(INTERRUPTS_ALWAYS_ENABLED)); =20 if (ret) goto reset_fifo_and_return; @@ -1251,7 +1308,7 @@ static ssize_t vc4_dsi_host_transfer(struct mipi_dsi_= host *host, DSI_PORT_BIT(CTRL_RESET_FIFOS)); =20 DSI_PORT_WRITE(TXPKT1C, 0); - DSI_PORT_WRITE(INT_EN, DSI1_INTERRUPTS_ALWAYS_ENABLED); + DSI_PORT_WRITE(INT_EN, DSI_PORT_BIT(INTERRUPTS_ALWAYS_ENABLED)); return ret; } =20 @@ -1388,26 +1445,28 @@ static irqreturn_t vc4_dsi_irq_handler(int irq, voi= d *data) DSI_PORT_WRITE(INT_STAT, stat); =20 dsi_handle_error(dsi, &ret, stat, - DSI1_INT_ERR_SYNC_ESC, "LPDT sync"); + DSI_PORT_BIT(INT_ERR_SYNC_ESC), "LPDT sync"); dsi_handle_error(dsi, &ret, stat, - DSI1_INT_ERR_CONTROL, "data lane 0 sequence"); + DSI_PORT_BIT(INT_ERR_CONTROL), "data lane 0 sequence"); dsi_handle_error(dsi, &ret, stat, - DSI1_INT_ERR_CONT_LP0, "LP0 contention"); + DSI_PORT_BIT(INT_ERR_CONT_LP0), "LP0 contention"); dsi_handle_error(dsi, &ret, stat, - DSI1_INT_ERR_CONT_LP1, "LP1 contention"); + DSI_PORT_BIT(INT_ERR_CONT_LP1), "LP1 contention"); dsi_handle_error(dsi, &ret, stat, - DSI1_INT_HSTX_TO, "HSTX timeout"); + DSI_PORT_BIT(INT_HSTX_TO), "HSTX timeout"); dsi_handle_error(dsi, &ret, stat, - DSI1_INT_LPRX_TO, "LPRX timeout"); + DSI_PORT_BIT(INT_LPRX_TO), "LPRX timeout"); dsi_handle_error(dsi, &ret, stat, - DSI1_INT_TA_TO, "turnaround timeout"); + DSI_PORT_BIT(INT_TA_TO), "turnaround timeout"); dsi_handle_error(dsi, &ret, stat, - DSI1_INT_PR_TO, "peripheral reset timeout"); + DSI_PORT_BIT(INT_PR_TO), "peripheral reset timeout"); =20 - if (stat & (DSI1_INT_TXPKT1_DONE | DSI1_INT_PHY_DIR_RTF)) { + if (stat & ((dsi->variant->port ? DSI1_INT_TXPKT1_DONE : + DSI0_INT_CMDC_DONE_MASK) | + DSI_PORT_BIT(INT_PHY_DIR_RTF))) { complete(&dsi->xfer_completion); ret =3D IRQ_HANDLED; - } else if (stat & DSI1_INT_HSTX_TO) { + } else if (stat & DSI_PORT_BIT(INT_HSTX_TO)) { complete(&dsi->xfer_completion); dsi->xfer_result =3D -ETIMEDOUT; ret =3D IRQ_HANDLED; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D791DC00140 for ; Mon, 15 Aug 2022 18:53:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244374AbiHOSxe (ORCPT ); Mon, 15 Aug 2022 14:53:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244185AbiHOSu0 (ORCPT ); Mon, 15 Aug 2022 14:50:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C085C4333A; Mon, 15 Aug 2022 11:28:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 89860B81062; Mon, 15 Aug 2022 18:28:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0241C433D6; Mon, 15 Aug 2022 18:28:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588127; bh=FXcmKym8+v4WXGSA74E5HXWL4LuU9++qS5FPtliBTcI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GNuy19mQPr1E2jK2VETAJpclZx1djr8HXQCYEnNUJpISsnH8jIEwVabMj957FXVPE 2GLp0tT2Rx3rSkUuzl5AHaf9QTbB5T0h7pzWlDp794oM/GiLZzHKhZRY+cGYoADqvY ymdgv/uwhhUYye/mVSOjR7Q4mQ1m2r0jFApaqzVM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Stevenson , Maxime Ripard , Sasha Levin Subject: [PATCH 5.15 304/779] drm/vc4: dsi: Add correct stop condition to vc4_dsi_encoder_disable iteration Date: Mon, 15 Aug 2022 19:59:08 +0200 Message-Id: <20220815180350.288301178@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dave Stevenson [ Upstream commit 7bcb9c8d0bc9f3cab8ac2634b056c2e6b63945ca ] vc4_dsi_encoder_disable is partially an open coded version of drm_bridge_chain_disable, but it missed a termination condition in the loop for ->disable which meant that no post_disable calls were made. Add in the termination clause. Fixes: 033bfe7538a1 ("drm/vc4: dsi: Fix bridge chain handling") Signed-off-by: Dave Stevenson Link: https://lore.kernel.org/r/20220613144800.326124-17-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_dsi.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c index 333ea96fcde4..b7b2c76770dc 100644 --- a/drivers/gpu/drm/vc4/vc4_dsi.c +++ b/drivers/gpu/drm/vc4/vc4_dsi.c @@ -803,6 +803,9 @@ static void vc4_dsi_encoder_disable(struct drm_encoder = *encoder) list_for_each_entry_reverse(iter, &dsi->bridge_chain, chain_node) { if (iter->funcs->disable) iter->funcs->disable(iter); + + if (iter =3D=3D dsi->bridge) + break; } =20 vc4_dsi_ulps(dsi, true); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13ED4C00140 for ; Mon, 15 Aug 2022 18:53:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244363AbiHOSx3 (ORCPT ); Mon, 15 Aug 2022 14:53:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244136AbiHOSuK (ORCPT ); Mon, 15 Aug 2022 14:50:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEDD043E52; Mon, 15 Aug 2022 11:28: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 26D2060F9F; Mon, 15 Aug 2022 18:28:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13A4DC433B5; Mon, 15 Aug 2022 18:28:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588130; bh=cmDsqLOGQfyeTpTaFLigwTiIwb3RCMp1vGAzPHr5B50=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ek4WjC9cdH4woGVDY8zk2V7P1At/yHgUV7k1KM0VPMHCe/jkCZPvKWbpU1Kw313wR 8DDBeFa3GcTPnMW/TyL1pSxDAbr4MjDGKqHATrVLgA08uRPbY/mEcooAKIc2A64rq/ B3uloLY9HL6V3IGjDOvtWm05dMG2O8aXxGzm64lo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxime Ripard , Dave Stevenson , Sasha Levin Subject: [PATCH 5.15 305/779] drm/vc4: hdmi: Fix HPD GPIO detection Date: Mon, 15 Aug 2022 19:59:09 +0200 Message-Id: <20220815180350.335774846@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maxime Ripard [ Upstream commit e32e5723256a99c5324824503572f743377dd0fe ] Prior to commit 6800234ceee0 ("drm/vc4: hdmi: Convert to gpiod"), in the detect hook, if we had an HPD GPIO we would only rely on it and return whatever state it was in. However, that commit changed that by mistake to only consider the case where we have a GPIO and it returns a logical high, and would fall back to the other methods otherwise. Since we can read the EDIDs when the HPD signal is low on some displays, we changed the detection status from disconnected to connected, and we would ignore an HPD pulse. Fixes: 6800234ceee0 ("drm/vc4: hdmi: Convert to gpiod") Signed-off-by: Maxime Ripard Reviewed-by: Dave Stevenson Link: https://lore.kernel.org/r/20211025152903.1088803-3-maxime@cerno.tech Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_hdmi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 1aeb57656112..e4533fe315bf 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -173,9 +173,9 @@ vc4_hdmi_connector_detect(struct drm_connector *connect= or, bool force) =20 WARN_ON(pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev)); =20 - if (vc4_hdmi->hpd_gpio && - gpiod_get_value_cansleep(vc4_hdmi->hpd_gpio)) { - connected =3D true; + if (vc4_hdmi->hpd_gpio) { + if (gpiod_get_value_cansleep(vc4_hdmi->hpd_gpio)) + connected =3D true; } else if (drm_probe_ddc(vc4_hdmi->ddc)) { connected =3D true; } else if (HDMI_READ(HDMI_HOTPLUG) & VC4_HDMI_HOTPLUG_CONNECTED) { --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22B4CC00140 for ; Mon, 15 Aug 2022 18:53:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244388AbiHOSxi (ORCPT ); Mon, 15 Aug 2022 14:53:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244291AbiHOSur (ORCPT ); Mon, 15 Aug 2022 14:50:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA0B143E63; Mon, 15 Aug 2022 11:28: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 85E6C61024; Mon, 15 Aug 2022 18:28:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F586C433D6; Mon, 15 Aug 2022 18:28:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588133; bh=hdV8J5AyuQITJCxcJPRnfcmvqD7I0mHvRmOnQModVmk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jCuZ2bQHLapVGuyH1wRsFpL4OYjpZosdy1myybw4JlNfVaEOZC/66o0kZUVTpCzsn HBYRRytL6FZRjq84ZvgMkzA05jzcvIwUlw0LIPeNPvRKetiO3hddMtQp3R8YjyrnP+ 4zqd0t1Ih9C2RHz5ALl9KTl71s8YuAW6uhVFLNZI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dom Cobley , Maxime Ripard , Sasha Levin Subject: [PATCH 5.15 306/779] drm/vc4: hdmi: Avoid full hdmi audio fifo writes Date: Mon, 15 Aug 2022 19:59:10 +0200 Message-Id: <20220815180350.370077660@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dom Cobley [ Upstream commit 1c594eeccf92368177c2e22f1d3ee4933dfb8567 ] We are getting occasional VC4_HD_MAI_CTL_ERRORF in HDMI_MAI_CTL which seem to correspond with audio dropouts. Reduce the threshold where we deassert DREQ to avoid the fifo overfilling Fixes: bb7d78568814 ("drm/vc4: Add HDMI audio support") Signed-off-by: Dom Cobley Link: https://lore.kernel.org/r/20220613144800.326124-21-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_hdmi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index e4533fe315bf..879245808e26 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -1383,10 +1383,10 @@ static int vc4_hdmi_audio_prepare(struct device *de= v, void *data, =20 /* Set the MAI threshold */ HDMI_WRITE(HDMI_MAI_THR, - VC4_SET_FIELD(0x10, VC4_HD_MAI_THR_PANICHIGH) | - VC4_SET_FIELD(0x10, VC4_HD_MAI_THR_PANICLOW) | - VC4_SET_FIELD(0x10, VC4_HD_MAI_THR_DREQHIGH) | - VC4_SET_FIELD(0x10, VC4_HD_MAI_THR_DREQLOW)); + VC4_SET_FIELD(0x08, VC4_HD_MAI_THR_PANICHIGH) | + VC4_SET_FIELD(0x08, VC4_HD_MAI_THR_PANICLOW) | + VC4_SET_FIELD(0x06, VC4_HD_MAI_THR_DREQHIGH) | + VC4_SET_FIELD(0x08, VC4_HD_MAI_THR_DREQLOW)); =20 HDMI_WRITE(HDMI_MAI_CONFIG, VC4_HDMI_MAI_CONFIG_BIT_REVERSE | --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 598F6C25B0E for ; Mon, 15 Aug 2022 18:53:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244411AbiHOSxl (ORCPT ); Mon, 15 Aug 2022 14:53:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244328AbiHOSu6 (ORCPT ); Mon, 15 Aug 2022 14:50:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C398F4504B; Mon, 15 Aug 2022 11:28: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 DDA6EB81081; Mon, 15 Aug 2022 18:28:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E2EEC433D6; Mon, 15 Aug 2022 18:28:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588136; bh=mZW8ED33u+A2FgscfFPXlX5JDkvNzIjQrACfOxCP7HA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kc0O2hDRPRuVoHJiW+ZWKyQW+GDP7MJMi0wacoo7UALdDtmjt3i0b6rH2w3PGd/Qn nuaGbPHdewF/b/VMHSm0Qt+1+APnSaGlYicp9Lvgy5pfFT4aqYcit9nmsLYGHGdigC 2oWYJM6U8US+lMsgxekVgoTVFCSoYWCuCd8OGX3M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Stevenson , Maxime Ripard , Sasha Levin Subject: [PATCH 5.15 307/779] drm/vc4: hdmi: Reset HDMI MISC_CONTROL register Date: Mon, 15 Aug 2022 19:59:11 +0200 Message-Id: <20220815180350.417995874@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dave Stevenson [ Upstream commit 35dc00c12a72700a9c4592afee7d136ecb280cbd ] The HDMI block can repeat pixels for double clocked modes, and the firmware is now configuring the block to do this as the PV is doing it incorrectly when at 2pixels/clock. If the kernel doesn't reset it then we end up with strange modes. Reset MISC_CONTROL. Fixes: 8323989140f3 ("drm/vc4: hdmi: Support the BCM2711 HDMI controllers") Signed-off-by: Dave Stevenson Link: https://lore.kernel.org/r/20220613144800.326124-22-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_hdmi.c | 8 ++++++++ drivers/gpu/drm/vc4/vc4_hdmi_regs.h | 3 +++ 2 files changed, 11 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 879245808e26..e16fece541da 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -79,6 +79,9 @@ #define VC5_HDMI_VERTB_VSPO_SHIFT 16 #define VC5_HDMI_VERTB_VSPO_MASK VC4_MASK(29, 16) =20 +#define VC5_HDMI_MISC_CONTROL_PIXEL_REP_SHIFT 0 +#define VC5_HDMI_MISC_CONTROL_PIXEL_REP_MASK VC4_MASK(3, 0) + #define VC5_HDMI_SCRAMBLER_CTL_ENABLE BIT(0) =20 #define VC5_HDMI_DEEP_COLOR_CONFIG_1_INIT_PACK_PHASE_SHIFT 8 @@ -849,6 +852,11 @@ static void vc5_hdmi_set_timings(struct vc4_hdmi *vc4_= hdmi, reg |=3D gcp_en ? VC5_HDMI_GCP_CONFIG_GCP_ENABLE : 0; HDMI_WRITE(HDMI_GCP_CONFIG, reg); =20 + reg =3D HDMI_READ(HDMI_MISC_CONTROL); + reg &=3D ~VC5_HDMI_MISC_CONTROL_PIXEL_REP_MASK; + reg |=3D VC4_SET_FIELD(0, VC5_HDMI_MISC_CONTROL_PIXEL_REP); + HDMI_WRITE(HDMI_MISC_CONTROL, reg); + HDMI_WRITE(HDMI_CLOCK_STOP, 0); } =20 diff --git a/drivers/gpu/drm/vc4/vc4_hdmi_regs.h b/drivers/gpu/drm/vc4/vc4_= hdmi_regs.h index 19d2fdc446bc..f126fa425a1d 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi_regs.h +++ b/drivers/gpu/drm/vc4/vc4_hdmi_regs.h @@ -123,6 +123,7 @@ enum vc4_hdmi_field { HDMI_VERTB0, HDMI_VERTB1, HDMI_VID_CTL, + HDMI_MISC_CONTROL, }; =20 struct vc4_hdmi_register { @@ -233,6 +234,7 @@ static const struct vc4_hdmi_register __maybe_unused vc= 5_hdmi_hdmi0_fields[] =3D { VC4_HDMI_REG(HDMI_VERTB0, 0x0f0), VC4_HDMI_REG(HDMI_VERTA1, 0x0f4), VC4_HDMI_REG(HDMI_VERTB1, 0x0f8), + VC4_HDMI_REG(HDMI_MISC_CONTROL, 0x100), VC4_HDMI_REG(HDMI_MAI_CHANNEL_MAP, 0x09c), VC4_HDMI_REG(HDMI_MAI_CONFIG, 0x0a0), VC4_HDMI_REG(HDMI_DEEP_COLOR_CONFIG_1, 0x170), @@ -313,6 +315,7 @@ static const struct vc4_hdmi_register __maybe_unused vc= 5_hdmi_hdmi1_fields[] =3D { VC4_HDMI_REG(HDMI_VERTB0, 0x0f0), VC4_HDMI_REG(HDMI_VERTA1, 0x0f4), VC4_HDMI_REG(HDMI_VERTB1, 0x0f8), + VC4_HDMI_REG(HDMI_MISC_CONTROL, 0x100), VC4_HDMI_REG(HDMI_MAI_CHANNEL_MAP, 0x09c), VC4_HDMI_REG(HDMI_MAI_CONFIG, 0x0a0), VC4_HDMI_REG(HDMI_DEEP_COLOR_CONFIG_1, 0x170), --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E350C25B08 for ; Mon, 15 Aug 2022 18:53:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244439AbiHOSxt (ORCPT ); Mon, 15 Aug 2022 14:53:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244378AbiHOSvD (ORCPT ); Mon, 15 Aug 2022 14:51:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77E8F4505A; Mon, 15 Aug 2022 11:29: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 C5542B81062; Mon, 15 Aug 2022 18:29:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31808C433C1; Mon, 15 Aug 2022 18:28:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588139; bh=aBr/68DQJz7Js4ul47klddeDM95zLeJBjJAEtr6IZcI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j4x4FexZfnuaQ1y+Jq1IzfV6Tp6ty6gFQaw/plNiR6J7xA/UPrVzU/Zopux8WQvma PP3kPdysJup2q7CWbwcVCahtcT4t8UXRgCI5cSxJcJcqx0emyrfH2x76vt2qN65Ru1 E6OM+jZ75n46cnRpWU9nKz6rrRXhOIx6fxw4YtUw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mateusz Kwiatkowski , Maxime Ripard , Sasha Levin Subject: [PATCH 5.15 308/779] drm/vc4: hdmi: Fix timings for interlaced modes Date: Mon, 15 Aug 2022 19:59:12 +0200 Message-Id: <20220815180350.457921293@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mateusz Kwiatkowski [ Upstream commit 0ee5a40152b15f200ed3a0d51e8aa782ea979c6a ] Increase the number of post-sync blanking lines on odd fields instead of decreasing it on even fields. This makes the total number of lines properly match the modelines. Additionally fix the value of PV_VCONTROL_ODD_DELAY, which did not take pixels_per_clock into account, causing some displays to invert the fields when driven by bcm2711. Fixes: 682e62c45406 ("drm/vc4: Fix support for interlaced modes on HDMI.") Signed-off-by: Mateusz Kwiatkowski Link: https://lore.kernel.org/r/20220613144800.326124-31-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_crtc.c | 7 ++++--- drivers/gpu/drm/vc4/vc4_hdmi.c | 12 ++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_crtc.c b/drivers/gpu/drm/vc4/vc4_crtc.c index 5a8c3c6c91af..3b8576f19321 100644 --- a/drivers/gpu/drm/vc4/vc4_crtc.c +++ b/drivers/gpu/drm/vc4/vc4_crtc.c @@ -357,7 +357,8 @@ static void vc4_crtc_config_pv(struct drm_crtc *crtc, s= truct drm_atomic_state *s PV_HORZB_HACTIVE)); =20 CRTC_WRITE(PV_VERTA, - VC4_SET_FIELD(mode->crtc_vtotal - mode->crtc_vsync_end, + VC4_SET_FIELD(mode->crtc_vtotal - mode->crtc_vsync_end + + interlace, PV_VERTA_VBP) | VC4_SET_FIELD(mode->crtc_vsync_end - mode->crtc_vsync_start, PV_VERTA_VSYNC)); @@ -369,7 +370,7 @@ static void vc4_crtc_config_pv(struct drm_crtc *crtc, s= truct drm_atomic_state *s if (interlace) { CRTC_WRITE(PV_VERTA_EVEN, VC4_SET_FIELD(mode->crtc_vtotal - - mode->crtc_vsync_end - 1, + mode->crtc_vsync_end, PV_VERTA_VBP) | VC4_SET_FIELD(mode->crtc_vsync_end - mode->crtc_vsync_start, @@ -389,7 +390,7 @@ static void vc4_crtc_config_pv(struct drm_crtc *crtc, s= truct drm_atomic_state *s PV_VCONTROL_CONTINUOUS | (is_dsi ? PV_VCONTROL_DSI : 0) | PV_VCONTROL_INTERLACE | - VC4_SET_FIELD(mode->htotal * pixel_rep / 2, + VC4_SET_FIELD(mode->htotal * pixel_rep / (2 * ppc), PV_VCONTROL_ODD_DELAY)); CRTC_WRITE(PV_VSYNCD_EVEN, 0); } else { diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index e16fece541da..ddcead896fe8 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -738,12 +738,12 @@ static void vc4_hdmi_set_timings(struct vc4_hdmi *vc4= _hdmi, VC4_HDMI_VERTA_VFP) | VC4_SET_FIELD(mode->crtc_vdisplay, VC4_HDMI_VERTA_VAL)); u32 vertb =3D (VC4_SET_FIELD(0, VC4_HDMI_VERTB_VSPO) | - VC4_SET_FIELD(mode->crtc_vtotal - mode->crtc_vsync_end, + VC4_SET_FIELD(mode->crtc_vtotal - mode->crtc_vsync_end + + interlaced, VC4_HDMI_VERTB_VBP)); u32 vertb_even =3D (VC4_SET_FIELD(0, VC4_HDMI_VERTB_VSPO) | VC4_SET_FIELD(mode->crtc_vtotal - - mode->crtc_vsync_end - - interlaced, + mode->crtc_vsync_end, VC4_HDMI_VERTB_VBP)); =20 HDMI_WRITE(HDMI_HORZA, @@ -784,12 +784,12 @@ static void vc5_hdmi_set_timings(struct vc4_hdmi *vc4= _hdmi, VC5_HDMI_VERTA_VFP) | VC4_SET_FIELD(mode->crtc_vdisplay, VC5_HDMI_VERTA_VAL)); u32 vertb =3D (VC4_SET_FIELD(0, VC5_HDMI_VERTB_VSPO) | - VC4_SET_FIELD(mode->crtc_vtotal - mode->crtc_vsync_end, + VC4_SET_FIELD(mode->crtc_vtotal - mode->crtc_vsync_end + + interlaced, VC4_HDMI_VERTB_VBP)); u32 vertb_even =3D (VC4_SET_FIELD(0, VC5_HDMI_VERTB_VSPO) | VC4_SET_FIELD(mode->crtc_vtotal - - mode->crtc_vsync_end - - interlaced, + mode->crtc_vsync_end, VC4_HDMI_VERTB_VBP)); unsigned char gcp; bool gcp_en; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C52BC00140 for ; Mon, 15 Aug 2022 18:54:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244470AbiHOSx5 (ORCPT ); Mon, 15 Aug 2022 14:53:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244429AbiHOSvI (ORCPT ); Mon, 15 Aug 2022 14:51: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 8E66245996; Mon, 15 Aug 2022 11:29: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 78E8B6101F; Mon, 15 Aug 2022 18:29:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 690D6C433B5; Mon, 15 Aug 2022 18:29:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588145; bh=ANCbfLTy2qe8P5vzzrHbpl5shPffVIXQhslF+WBvc9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vIUw+vORXS+W6UWpSVAYiDWwWtpJtv95DIRvA2Fg9yHJWizZSOBMlzul/cOMWRxcZ oz8l7ER2iMZ/jY/fcVWOyjPH7lH9dxvEGVsOrzIQIdrdBJ6+hWb2oGNyLusK7Kk3VP VtnE5UBmtHVHAW/hl0+TYJNYvGMAvqQtdcAF/3yk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Stevenson , Maxime Ripard , Sasha Levin Subject: [PATCH 5.15 309/779] drm/vc4: hdmi: Correct HDMI timing registers for interlaced modes Date: Mon, 15 Aug 2022 19:59:13 +0200 Message-Id: <20220815180350.498952673@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dave Stevenson [ Upstream commit fb10dc451c0f15e3c19798a2f41d357f3f7576f5 ] For interlaced modes the timings were not being correctly programmed into the HDMI block, so correct them. Fixes: 8323989140f3 ("drm/vc4: hdmi: Support the BCM2711 HDMI controllers") Signed-off-by: Dave Stevenson Link: https://lore.kernel.org/r/20220613144800.326124-33-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_hdmi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index ddcead896fe8..10cf623d2830 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -783,13 +783,13 @@ static void vc5_hdmi_set_timings(struct vc4_hdmi *vc4= _hdmi, VC4_SET_FIELD(mode->crtc_vsync_start - mode->crtc_vdisplay, VC5_HDMI_VERTA_VFP) | VC4_SET_FIELD(mode->crtc_vdisplay, VC5_HDMI_VERTA_VAL)); - u32 vertb =3D (VC4_SET_FIELD(0, VC5_HDMI_VERTB_VSPO) | - VC4_SET_FIELD(mode->crtc_vtotal - mode->crtc_vsync_end + - interlaced, + u32 vertb =3D (VC4_SET_FIELD(mode->htotal >> (2 - pixel_rep), + VC5_HDMI_VERTB_VSPO) | + VC4_SET_FIELD(mode->crtc_vtotal - mode->crtc_vsync_end, VC4_HDMI_VERTB_VBP)); u32 vertb_even =3D (VC4_SET_FIELD(0, VC5_HDMI_VERTB_VSPO) | VC4_SET_FIELD(mode->crtc_vtotal - - mode->crtc_vsync_end, + mode->crtc_vsync_end - interlaced, VC4_HDMI_VERTB_VBP)); unsigned char gcp; bool gcp_en; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A318CC00140 for ; Mon, 15 Aug 2022 18:54:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244492AbiHOSyB (ORCPT ); Mon, 15 Aug 2022 14:54:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244482AbiHOSvS (ORCPT ); Mon, 15 Aug 2022 14:51:18 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EC83459BC; Mon, 15 Aug 2022 11:29: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 CB528CE1264; Mon, 15 Aug 2022 18:29:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 703DBC433C1; Mon, 15 Aug 2022 18:29:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588149; bh=8NDVX8rGIyuK8un0KHxKdn2+1yKhDm+2GnDz3ZQSE4M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rTXlv3SxIZ9/0GHsVMtT1hq4jNplVPC2FazjdNoktnKGSVgg096oDflRZv23LFjeJ iGz6sH6WW8eKZjpcCTfjCZAYZETr9YdD/f8NIK4L7GMGUORjeIXTcFilvLOF0b7tkZ opSwfvlW7yPe2075JZ4TYGlar/UuNNl/wH8p8LN4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qian Cai , Herbert Xu , Sasha Levin Subject: [PATCH 5.15 310/779] crypto: arm64/gcm - Select AEAD for GHASH_ARM64_CE Date: Mon, 15 Aug 2022 19:59:14 +0200 Message-Id: <20220815180350.547966746@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Qian Cai [ Upstream commit fac76f2260893dde5aa05bb693b4c13e8ed0454b ] Otherwise, we could fail to compile. ld: arch/arm64/crypto/ghash-ce-glue.o: in function 'ghash_ce_mod_exit': ghash-ce-glue.c:(.exit.text+0x24): undefined reference to 'crypto_unregiste= r_aead' ld: arch/arm64/crypto/ghash-ce-glue.o: in function 'ghash_ce_mod_init': ghash-ce-glue.c:(.init.text+0x34): undefined reference to 'crypto_register_= aead' Fixes: 537c1445ab0b ("crypto: arm64/gcm - implement native driver using v8 = Crypto Extensions") Signed-off-by: Qian Cai Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm64/crypto/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/crypto/Kconfig b/arch/arm64/crypto/Kconfig index 55f19450091b..1a5406e599ba 100644 --- a/arch/arm64/crypto/Kconfig +++ b/arch/arm64/crypto/Kconfig @@ -59,6 +59,7 @@ config CRYPTO_GHASH_ARM64_CE select CRYPTO_HASH select CRYPTO_GF128MUL select CRYPTO_LIB_AES + select CRYPTO_AEAD =20 config CRYPTO_CRCT10DIF_ARM64_CE tristate "CRCT10DIF digest algorithm using PMULL instructions" --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8AFEEC00140 for ; Mon, 15 Aug 2022 18:54:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244501AbiHOSyL (ORCPT ); Mon, 15 Aug 2022 14:54:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244518AbiHOSvW (ORCPT ); Mon, 15 Aug 2022 14:51:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77A504598B; Mon, 15 Aug 2022 11:29: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 067E9B81062; Mon, 15 Aug 2022 18:29:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F782C433D6; Mon, 15 Aug 2022 18:29:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588152; bh=IH/eqnSii+jb589bXR/fw04LvgxuSLSD1NZCXm8mjqk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sB14TNc6JkJSXKH9ZktVllYm7j6HHnlwNPkBX5aUAE1Z6xVIumZIhBkEdueSZKs8m SuUzbzQjGNkEyTexRlxNixNJ3MnvS0dwDsKDzvezO6jRQKtGqobbEkmBvz/7iQbBCk dYPDzTtmzSYpjwuRlkBGvIZWqKHYvrbmDQQbdnWA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maciej Fijalkowski , Daniel Borkmann , Magnus Karlsson , Sasha Levin Subject: [PATCH 5.15 311/779] selftests/xsk: Destroy BPF resources only when ctx refcount drops to 0 Date: Mon, 15 Aug 2022 19:59:15 +0200 Message-Id: <20220815180350.586778586@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maciej Fijalkowski [ Upstream commit 39e940d4abfabb08b6937a315546b24d10be67e3 ] Currently, xsk_socket__delete frees BPF resources regardless of ctx refcount. Xdpxceiver has a test to verify whether underlying BPF resources would not be wiped out after closing XSK socket that was bound to interface with other active sockets. From library's xsk part perspective it also means that the internal xsk context is shared and its refcount is bumped accordingly. After a switch to loading XDP prog based on previously opened XSK socket, mentioned xdpxceiver test fails with: not ok 16 [xdpxceiver.c:swap_xsk_resources:1334]: ERROR: 9/"Bad file desc= riptor which means that in swap_xsk_resources(), xsk_socket__delete() released xskmap which in turn caused a failure of xsk_socket__update_xskmap(). To fix this, when deleting socket, decrement ctx refcount before releasing BPF resources and do so only when refcount dropped to 0 which means there are no more active sockets for this ctx so BPF resources can be freed safely. Fixes: 2f6324a3937f ("libbpf: Support shared umems between queues and devic= es") Signed-off-by: Maciej Fijalkowski Signed-off-by: Daniel Borkmann Acked-by: Magnus Karlsson Link: https://lore.kernel.org/bpf/20220629143458.934337-5-maciej.fijalkowsk= i@intel.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- tools/lib/bpf/xsk.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c index a27b3141463a..42b8437b0535 100644 --- a/tools/lib/bpf/xsk.c +++ b/tools/lib/bpf/xsk.c @@ -1164,8 +1164,6 @@ int xsk_socket__create_shared(struct xsk_socket **xsk= _ptr, goto out_mmap_tx; } =20 - ctx->prog_fd =3D -1; - if (!(xsk->config.libbpf_flags & XSK_LIBBPF_FLAGS__INHIBIT_PROG_LOAD)) { err =3D __xsk_setup_xdp_prog(xsk, NULL); if (err) @@ -1246,7 +1244,10 @@ void xsk_socket__delete(struct xsk_socket *xsk) =20 ctx =3D xsk->ctx; umem =3D ctx->umem; - if (ctx->prog_fd !=3D -1) { + + xsk_put_ctx(ctx, true); + + if (!ctx->refcount) { xsk_delete_bpf_maps(xsk); close(ctx->prog_fd); if (ctx->has_bpf_link) @@ -1265,8 +1266,6 @@ void xsk_socket__delete(struct xsk_socket *xsk) } } =20 - xsk_put_ctx(ctx, true); - umem->refcount--; /* Do not close an fd that also has an associated umem connected * to it. --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8F4EC25B08 for ; Mon, 15 Aug 2022 18:54:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244520AbiHOSyR (ORCPT ); Mon, 15 Aug 2022 14:54:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244534AbiHOSvZ (ORCPT ); Mon, 15 Aug 2022 14:51:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC08343323; Mon, 15 Aug 2022 11:29:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2EC0F60FEE; Mon, 15 Aug 2022 18:29:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29EC1C433D6; Mon, 15 Aug 2022 18:29:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588155; bh=kpVBEoT6LCIL/pFUQuqn8rGR3aDGvmQPx3ShG7RBrfw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sR24tCoqaRj0AfatXAYVhfLUYOepkfJW0oxU1Xo8I9t2dNuiTdEf1NaiJwnxiWdYM p0i/vr5mWfBfKrv7UPqLAgsGfUgKWnvKP9oEY/IDH1duZIJQZI6LvOByeAPwx/yzT8 vpNszX68OSWnqOVcMP8U6x/mYIbp4ogaxLqVP1UI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Norris , Sean Paul , Douglas Anderson , Heiko Stuebner , Sasha Levin Subject: [PATCH 5.15 312/779] drm/rockchip: vop: Dont crash for invalid duplicate_state() Date: Mon, 15 Aug 2022 19:59:16 +0200 Message-Id: <20220815180350.631718767@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 1449110b0dade8b638d2c17ab7c5b0ff696bfccb ] It's possible for users to try to duplicate the CRTC state even when the state doesn't exist. drm_atomic_helper_crtc_duplicate_state() (and other users of __drm_atomic_helper_crtc_duplicate_state()) already guard this with a WARN_ON() instead of crashing, so let's do that here too. Fixes: 4e257d9eee23 ("drm/rockchip: get rid of rockchip_drm_crtc_mode_confi= g") Signed-off-by: Brian Norris Reviewed-by: Sean Paul Reviewed-by: Douglas Anderson Signed-off-by: Heiko Stuebner Link: https://patchwork.freedesktop.org/patch/msgid/20220617172623.1.I62db2= 28170b1559ada60b8d3e1637e1688424926@changeid Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/rockchip/rockchip_drm_vop.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c b/drivers/gpu/drm/= rockchip/rockchip_drm_vop.c index 8b4287d40379..d5b74ea06a45 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_vop.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_vop.c @@ -1550,6 +1550,9 @@ static struct drm_crtc_state *vop_crtc_duplicate_stat= e(struct drm_crtc *crtc) { struct rockchip_crtc_state *rockchip_state; =20 + if (WARN_ON(!crtc->state)) + return NULL; + rockchip_state =3D kzalloc(sizeof(*rockchip_state), GFP_KERNEL); if (!rockchip_state) return NULL; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95BCBC00140 for ; Mon, 15 Aug 2022 18:54:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244045AbiHOSyX (ORCPT ); Mon, 15 Aug 2022 14:54:23 -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 S244564AbiHOSv3 (ORCPT ); Mon, 15 Aug 2022 14:51:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4697641989; Mon, 15 Aug 2022 11:29: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 9BCC160FDA; Mon, 15 Aug 2022 18:29:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EBB5C433C1; Mon, 15 Aug 2022 18:29:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588159; bh=75PJQzjZ5bs1glYwli5PDChBligTr07n+c98BVE86jI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1vmfqLdqNhqzZM0+Ju/DZ/fYgZNB5Sj2tOFuKkdrFZy+X+3SnJHmIkbdXsDnOGAYN WSFxrZ7SOa2tbemv2yEBoDyaB/PgyicMUKwd1FSWDUUgW6Mrdxnz1QQV6k6CYWCmJg AjnC4ZJQUPQFz9Xs1F4H1MAFPbeXhqxBHe5kXqHw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Heiko Stuebner , Sasha Levin Subject: [PATCH 5.15 313/779] drm/rockchip: Fix an error handling path rockchip_dp_probe() Date: Mon, 15 Aug 2022 19:59:17 +0200 Message-Id: <20220815180350.662255941@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET [ Upstream commit 5074376822fe99fa4ce344b851c5016d00c0444f ] Should component_add() fail, we should call analogix_dp_remove() in the error handling path, as already done in the remove function. Fixes: 152cce0006ab ("drm/bridge: analogix_dp: Split bind() into probe() an= d real bind()") Signed-off-by: Christophe JAILLET Signed-off-by: Heiko Stuebner Link: https://patchwork.freedesktop.org/patch/msgid/b719d9061bb97eb85145fbd= 3c5e63f4549f2e13e.1655572071.git.christophe.jaillet@wanadoo.fr Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/= drm/rockchip/analogix_dp-rockchip.c index ade2327a10e2..512581698a1e 100644 --- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c @@ -398,7 +398,15 @@ static int rockchip_dp_probe(struct platform_device *p= dev) if (IS_ERR(dp->adp)) return PTR_ERR(dp->adp); =20 - return component_add(dev, &rockchip_dp_component_ops); + ret =3D component_add(dev, &rockchip_dp_component_ops); + if (ret) + goto err_dp_remove; + + return 0; + +err_dp_remove: + analogix_dp_remove(dp->adp); + return ret; } =20 static int rockchip_dp_remove(struct platform_device *pdev) --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7CB38C00140 for ; Mon, 15 Aug 2022 18:54:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244543AbiHOSyc (ORCPT ); Mon, 15 Aug 2022 14:54:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244637AbiHOSvh (ORCPT ); Mon, 15 Aug 2022 14:51: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 2CD2A46DA2; Mon, 15 Aug 2022 11:29: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 598EAB81082; Mon, 15 Aug 2022 18:29:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1609C433C1; Mon, 15 Aug 2022 18:29:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588162; bh=NDaqN0HN4Lw9xKA+GYcUn8lKUCBj57SDn6sS5RzJY98=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hDe3y8Vg3MbK1WW/9mgzV/cIMa2YFoGxRMZRXPPX2tsBXwgI0s871/BxUmIFeu7Gb karNeV8fbk3ZtQHKF+lMBPRNPcF+GgFkl18wkyHLtNd4RYUmKLDjYVrjwN0MotwjwY vCOPrReXxTe/aCtWVhviokk8xbSp2LoihcsJs5LU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bo-Chen Chen , Chun-Kuang Hu , Sasha Levin Subject: [PATCH 5.15 314/779] drm/mediatek: dpi: Remove output format of YUV Date: Mon, 15 Aug 2022 19:59:18 +0200 Message-Id: <20220815180350.701746314@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bo-Chen Chen [ Upstream commit c9ed0713b3c35fc45677707ba47f432cad95da56 ] DPI is not support output format as YUV, but there is the setting of configuring output YUV. Therefore, remove them in this patch. Fixes: 9e629c17aa8d ("drm/mediatek: Add DPI sub driver") Signed-off-by: Bo-Chen Chen Link: https://patchwork.kernel.org/project/linux-mediatek/patch/20220701035= 845.16458-5-rex-bc.chen@mediatek.com/ Signed-off-by: Chun-Kuang Hu Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/mediatek/mtk_dpi.c | 31 ++++++------------------------ 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/= mtk_dpi.c index e61cd67b978f..675e2e4072df 100644 --- a/drivers/gpu/drm/mediatek/mtk_dpi.c +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c @@ -54,13 +54,7 @@ enum mtk_dpi_out_channel_swap { }; =20 enum mtk_dpi_out_color_format { - MTK_DPI_COLOR_FORMAT_RGB, - MTK_DPI_COLOR_FORMAT_RGB_FULL, - MTK_DPI_COLOR_FORMAT_YCBCR_444, - MTK_DPI_COLOR_FORMAT_YCBCR_422, - MTK_DPI_COLOR_FORMAT_XV_YCC, - MTK_DPI_COLOR_FORMAT_YCBCR_444_FULL, - MTK_DPI_COLOR_FORMAT_YCBCR_422_FULL + MTK_DPI_COLOR_FORMAT_RGB }; =20 struct mtk_dpi { @@ -364,24 +358,11 @@ static void mtk_dpi_config_disable_edge(struct mtk_dp= i *dpi) static void mtk_dpi_config_color_format(struct mtk_dpi *dpi, enum mtk_dpi_out_color_format format) { - if ((format =3D=3D MTK_DPI_COLOR_FORMAT_YCBCR_444) || - (format =3D=3D MTK_DPI_COLOR_FORMAT_YCBCR_444_FULL)) { - mtk_dpi_config_yuv422_enable(dpi, false); - mtk_dpi_config_csc_enable(dpi, true); - mtk_dpi_config_swap_input(dpi, false); - mtk_dpi_config_channel_swap(dpi, MTK_DPI_OUT_CHANNEL_SWAP_BGR); - } else if ((format =3D=3D MTK_DPI_COLOR_FORMAT_YCBCR_422) || - (format =3D=3D MTK_DPI_COLOR_FORMAT_YCBCR_422_FULL)) { - mtk_dpi_config_yuv422_enable(dpi, true); - mtk_dpi_config_csc_enable(dpi, true); - mtk_dpi_config_swap_input(dpi, true); - mtk_dpi_config_channel_swap(dpi, MTK_DPI_OUT_CHANNEL_SWAP_RGB); - } else { - mtk_dpi_config_yuv422_enable(dpi, false); - mtk_dpi_config_csc_enable(dpi, false); - mtk_dpi_config_swap_input(dpi, false); - mtk_dpi_config_channel_swap(dpi, MTK_DPI_OUT_CHANNEL_SWAP_RGB); - } + /* only support RGB888 */ + mtk_dpi_config_yuv422_enable(dpi, false); + mtk_dpi_config_csc_enable(dpi, false); + mtk_dpi_config_swap_input(dpi, false); + mtk_dpi_config_channel_swap(dpi, MTK_DPI_OUT_CHANNEL_SWAP_RGB); } =20 static void mtk_dpi_dual_edge(struct mtk_dpi *dpi) --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AA04C25B08 for ; Mon, 15 Aug 2022 18:54:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244578AbiHOSyw (ORCPT ); Mon, 15 Aug 2022 14:54:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244654AbiHOSvj (ORCPT ); Mon, 15 Aug 2022 14:51: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 7A81E45F6E; Mon, 15 Aug 2022 11:29:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AB71CB81087; Mon, 15 Aug 2022 18:29:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7D7AC433D6; Mon, 15 Aug 2022 18:29:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588165; bh=ZCTlZ6oiSDxVQ1XvejSCzZ84C+U5CBdJqQG1WcctKyc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wb9EIrUc9tWysIQkS72pl2LDoob+LSwXiMk1C6PFopfkicuhte7k53OdSvXO86kzg PhW7pFo1J+kiEQSBnaYETYU3yls9tK/6MAuKiRvccLApmPL4e+DM+JDYAGa0yroI7p YnD+qpf8+Ew+xTd+o71jBBHDYZ1MRQwB+N+f2HlE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guillaume Ranquet , Bo-Chen Chen , AngeloGioacchino Del Regno , Chun-Kuang Hu , Sasha Levin Subject: [PATCH 5.15 315/779] drm/mediatek: dpi: Only enable dpi after the bridge is enabled Date: Mon, 15 Aug 2022 19:59:19 +0200 Message-Id: <20220815180350.750853416@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Guillaume Ranquet [ Upstream commit aed61ef6beb911cc043af0f2f291167663995065 ] Enabling the dpi too early causes glitches on screen. Move the call to mtk_dpi_enable() at the end of the bridge_enable callback to ensure everything is setup properly before enabling dpi. Fixes: 9e629c17aa8d ("drm/mediatek: Add DPI sub driver") Signed-off-by: Guillaume Ranquet Signed-off-by: Bo-Chen Chen Tested-by: AngeloGioacchino Del Regno Link: https://patchwork.kernel.org/project/linux-mediatek/patch/20220701035= 845.16458-16-rex-bc.chen@mediatek.com/ Signed-off-by: Chun-Kuang Hu Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/mediatek/mtk_dpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/= mtk_dpi.c index 675e2e4072df..41c783349321 100644 --- a/drivers/gpu/drm/mediatek/mtk_dpi.c +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c @@ -417,7 +417,6 @@ static int mtk_dpi_power_on(struct mtk_dpi *dpi) if (dpi->pinctrl && dpi->pins_dpi) pinctrl_select_state(dpi->pinctrl, dpi->pins_dpi); =20 - mtk_dpi_enable(dpi); return 0; =20 err_pixel: @@ -639,6 +638,7 @@ static void mtk_dpi_bridge_enable(struct drm_bridge *br= idge) =20 mtk_dpi_power_on(dpi); mtk_dpi_set_display_mode(dpi, &dpi->mode); + mtk_dpi_enable(dpi); } =20 static enum drm_mode_status --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE422C00140 for ; Mon, 15 Aug 2022 18:54:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244153AbiHOSym (ORCPT ); Mon, 15 Aug 2022 14:54:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244662AbiHOSvj (ORCPT ); Mon, 15 Aug 2022 14:51:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04FF646DBD; Mon, 15 Aug 2022 11:29: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 E5C6260F23; Mon, 15 Aug 2022 18:29:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D54AFC433D7; Mon, 15 Aug 2022 18:29:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588168; bh=LZk7gSWpaSoUsHd/k9TE2xG/PGVAIeKrKwCihr/MDmk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YrJXdSSGVH9Lsoji0c8fujkuPgYPeNbVNAH/hcScH9z1rtsqDyOTDA7ng8LB2SbgZ sV2IeaI1Ic4ed2Lv8wzr8ocwJ1T0Swii0QIyFlD1cYKfhBLuVvrZmLH3fCqiPJsVYk yPnEOObvQe9LwNreY4WORUBErCghprbtrjXRUOmM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangyu Hua , Andrzej Hajda , Robert Foss , Sasha Levin Subject: [PATCH 5.15 316/779] drm: bridge: sii8620: fix possible off-by-one Date: Mon, 15 Aug 2022 19:59:20 +0200 Message-Id: <20220815180350.788189441@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 21779cc21c732c5eff8ea1624be6590450baa30f ] The next call to sii8620_burst_get_tx_buf will result in off-by-one When ctx->burst.tx_count + size =3D=3D ARRAY_SIZE(ctx->burst.tx_buf). The s= ame thing happens in sii8620_burst_get_rx_buf. This patch also change tx_count and tx_buf to rx_count and rx_buf in sii8620_burst_get_rx_buf. It is unreasonable to check tx_buf's size and use rx_buf. Fixes: e19e9c692f81 ("drm/bridge/sii8620: add support for burst eMSC transm= issions") Signed-off-by: Hangyu Hua Reviewed-by: Andrzej Hajda Signed-off-by: Robert Foss Link: https://patchwork.freedesktop.org/patch/msgid/20220518065856.18936-1-= hbh25y@gmail.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/bridge/sil-sii8620.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/sil-sii8620.c b/drivers/gpu/drm/bridge/= sil-sii8620.c index ec7745c31da0..ab0bce4a988c 100644 --- a/drivers/gpu/drm/bridge/sil-sii8620.c +++ b/drivers/gpu/drm/bridge/sil-sii8620.c @@ -605,7 +605,7 @@ static void *sii8620_burst_get_tx_buf(struct sii8620 *c= tx, int len) u8 *buf =3D &ctx->burst.tx_buf[ctx->burst.tx_count]; int size =3D len + 2; =20 - if (ctx->burst.tx_count + size > ARRAY_SIZE(ctx->burst.tx_buf)) { + if (ctx->burst.tx_count + size >=3D ARRAY_SIZE(ctx->burst.tx_buf)) { dev_err(ctx->dev, "TX-BLK buffer exhausted\n"); ctx->error =3D -EINVAL; return NULL; @@ -622,7 +622,7 @@ static u8 *sii8620_burst_get_rx_buf(struct sii8620 *ctx= , int len) u8 *buf =3D &ctx->burst.rx_buf[ctx->burst.rx_count]; int size =3D len + 1; =20 - if (ctx->burst.tx_count + size > ARRAY_SIZE(ctx->burst.tx_buf)) { + if (ctx->burst.rx_count + size >=3D ARRAY_SIZE(ctx->burst.rx_buf)) { dev_err(ctx->dev, "RX-BLK buffer exhausted\n"); ctx->error =3D -EINVAL; return NULL; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24272C00140 for ; Mon, 15 Aug 2022 18:55:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244595AbiHOSzF (ORCPT ); Mon, 15 Aug 2022 14:55:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244688AbiHOSvn (ORCPT ); Mon, 15 Aug 2022 14:51:43 -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 BBFCF474CF; Mon, 15 Aug 2022 11:29: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 38E3D60FDA; Mon, 15 Aug 2022 18:29:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 23EC9C433D6; Mon, 15 Aug 2022 18:29:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588171; bh=TxnbgPq7C531PMW+6Zh6jzpMqahQckFdHnZGC1A72TY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KlqxF1BEqDnVBUxp7cAasyAYj2z9d9HrtIqe7lb4s8sNhPhNX9F4ujJ78HD7aUj3F PMLIRhK/Pp8YVppKJIfENyqxpkwliooc4xadgXL6mQHGeuwk9r91oSepI7e29/9K2c zQQoPPhIGkFqVN02XnlXcwrLbtdf+afnGC/HfB1k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 317/779] hinic: Use the bitmap API when applicable Date: Mon, 15 Aug 2022 19:59:21 +0200 Message-Id: <20220815180350.830851945@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET [ Upstream commit 7c2c57263af41cfd8b5022274e6801542831bb69 ] 'vlan_bitmap' is a bitmap and is used as such. So allocate it with devm_bitmap_zalloc() and its explicit bit size (i.e. VLAN_N_VID). This avoids the need of the VLAN_BITMAP_SIZE macro which: - needlessly has a 'nic_dev' parameter - should be "long" (and not byte) aligned, so that the bitmap semantic is respected This is in fact not an issue because VLAN_N_VID is 4096 at the time being, but devm_bitmap_zalloc() is less verbose and easier to understand. Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/6ff7b7d21414240794a77dc2456914412718a145.16= 56260842.git.christophe.jaillet@wanadoo.fr Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/ethernet/huawei/hinic/hinic_main.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/huawei/hinic/hinic_main.c b/drivers/net/e= thernet/huawei/hinic/hinic_main.c index f8aa80ec201b..bece6a12368d 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_main.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_main.c @@ -62,8 +62,6 @@ MODULE_PARM_DESC(rx_weight, "Number Rx packets for NAPI b= udget (default=3D64)"); =20 #define HINIC_LRO_RX_TIMER_DEFAULT 16 =20 -#define VLAN_BITMAP_SIZE(nic_dev) (ALIGN(VLAN_N_VID, 8) / 8) - #define work_to_rx_mode_work(work) \ container_of(work, struct hinic_rx_mode_work, work) =20 @@ -1241,9 +1239,8 @@ static int nic_dev_init(struct pci_dev *pdev) u64_stats_init(&tx_stats->syncp); u64_stats_init(&rx_stats->syncp); =20 - nic_dev->vlan_bitmap =3D devm_kzalloc(&pdev->dev, - VLAN_BITMAP_SIZE(nic_dev), - GFP_KERNEL); + nic_dev->vlan_bitmap =3D devm_bitmap_zalloc(&pdev->dev, VLAN_N_VID, + GFP_KERNEL); if (!nic_dev->vlan_bitmap) { err =3D -ENOMEM; goto err_vlan_bitmap; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31BF3C25B0E for ; Mon, 15 Aug 2022 18:55:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244605AbiHOSzN (ORCPT ); Mon, 15 Aug 2022 14:55:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244734AbiHOSvs (ORCPT ); Mon, 15 Aug 2022 14:51:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF125474F1; Mon, 15 Aug 2022 11:29: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 1BD7460F9F; Mon, 15 Aug 2022 18:29:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3FC5C433C1; Mon, 15 Aug 2022 18:29:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588175; bh=F0con2KvPkmIDmWnbct8EVsgTcKg07z9A+fO0VKWGjI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k9/2MfRQv6/iLyycfHvT4G1LZ2+XsnRykT2OUWrckL6T9g2npXv5LJY4mIqUjz3dl OwAEp21iG384THK0toL8JqOAq28S+a66OmEs3zyajKDOb3zJZNAK5+L25cXja1pA1r D0kUdAFUCfI3/dYwY0/J9YTg+ls3ebP2CCmxK9Pg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qiao Ma , kernel test robot , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 318/779] net: hinic: fix bug that ethtool get wrong stats Date: Mon, 15 Aug 2022 19:59:22 +0200 Message-Id: <20220815180350.875859976@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Qiao Ma [ Upstream commit 67dffd3db98570af8ff54c934f7d14664c0d182a ] Function hinic_get_stats64() will do two operations: 1. reads stats from every hinic_rxq/txq and accumulates them 2. calls hinic_rxq/txq_clean_stats() to clean every rxq/txq's stats For hinic_get_stats64(), it could get right data, because it sums all data to nic_dev->rx_stats/tx_stats. But it is wrong for get_drv_queue_stats(), this function will read hinic_rxq's stats, which have been cleared to zero by hinic_get_stats64(). I have observed hinic's cleanup operation by using such command: > watch -n 1 "cat ethtool -S eth4 | tail -40" Result before: ... rxq7_pkts: 1 rxq7_bytes: 90 rxq7_errors: 0 rxq7_csum_errors: 0 rxq7_other_errors: 0 ... rxq9_pkts: 11 rxq9_bytes: 726 rxq9_errors: 0 rxq9_csum_errors: 0 rxq9_other_errors: 0 ... rxq11_pkts: 0 rxq11_bytes: 0 rxq11_errors: 0 rxq11_csum_errors: 0 rxq11_other_errors: 0 Result after a few seconds: ... rxq7_pkts: 0 rxq7_bytes: 0 rxq7_errors: 0 rxq7_csum_errors: 0 rxq7_other_errors: 0 ... rxq9_pkts: 2 rxq9_bytes: 132 rxq9_errors: 0 rxq9_csum_errors: 0 rxq9_other_errors: 0 ... rxq11_pkts: 1 rxq11_bytes: 170 rxq11_errors: 0 rxq11_csum_errors: 0 rxq11_other_errors: 0 To solve this problem, we just keep every queue's total stats in their own queue (aka hinic_{rxq|txq}), and simply sum all per-queue stats every time calling hinic_get_stats64(). With that solution, there is no need to clean per-queue stats now, and there is no need to maintain global hinic_dev.{tx|rx}_stats, too. Fixes: edd384f682cc ("net-next/hinic: Add ethtool and stats") Signed-off-by: Qiao Ma Reported-by: kernel test robot Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/ethernet/huawei/hinic/hinic_dev.h | 3 - .../net/ethernet/huawei/hinic/hinic_main.c | 57 ++++++------------- drivers/net/ethernet/huawei/hinic/hinic_rx.c | 2 - drivers/net/ethernet/huawei/hinic/hinic_tx.c | 2 - 4 files changed, 16 insertions(+), 48 deletions(-) diff --git a/drivers/net/ethernet/huawei/hinic/hinic_dev.h b/drivers/net/et= hernet/huawei/hinic/hinic_dev.h index fb3e89141a0d..a4fbf44f944c 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_dev.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_dev.h @@ -95,9 +95,6 @@ struct hinic_dev { u16 sq_depth; u16 rq_depth; =20 - struct hinic_txq_stats tx_stats; - struct hinic_rxq_stats rx_stats; - u8 rss_tmpl_idx; u8 rss_hash_engine; u16 num_rss; diff --git a/drivers/net/ethernet/huawei/hinic/hinic_main.c b/drivers/net/e= thernet/huawei/hinic/hinic_main.c index bece6a12368d..909758367e7c 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_main.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_main.c @@ -80,56 +80,44 @@ static int set_features(struct hinic_dev *nic_dev, netdev_features_t pre_features, netdev_features_t features, bool force_change); =20 -static void update_rx_stats(struct hinic_dev *nic_dev, struct hinic_rxq *r= xq) +static void gather_rx_stats(struct hinic_rxq_stats *nic_rx_stats, struct h= inic_rxq *rxq) { - struct hinic_rxq_stats *nic_rx_stats =3D &nic_dev->rx_stats; struct hinic_rxq_stats rx_stats; =20 - u64_stats_init(&rx_stats.syncp); - hinic_rxq_get_stats(rxq, &rx_stats); =20 - u64_stats_update_begin(&nic_rx_stats->syncp); nic_rx_stats->bytes +=3D rx_stats.bytes; nic_rx_stats->pkts +=3D rx_stats.pkts; nic_rx_stats->errors +=3D rx_stats.errors; nic_rx_stats->csum_errors +=3D rx_stats.csum_errors; nic_rx_stats->other_errors +=3D rx_stats.other_errors; - u64_stats_update_end(&nic_rx_stats->syncp); - - hinic_rxq_clean_stats(rxq); } =20 -static void update_tx_stats(struct hinic_dev *nic_dev, struct hinic_txq *t= xq) +static void gather_tx_stats(struct hinic_txq_stats *nic_tx_stats, struct h= inic_txq *txq) { - struct hinic_txq_stats *nic_tx_stats =3D &nic_dev->tx_stats; struct hinic_txq_stats tx_stats; =20 - u64_stats_init(&tx_stats.syncp); - hinic_txq_get_stats(txq, &tx_stats); =20 - u64_stats_update_begin(&nic_tx_stats->syncp); nic_tx_stats->bytes +=3D tx_stats.bytes; nic_tx_stats->pkts +=3D tx_stats.pkts; nic_tx_stats->tx_busy +=3D tx_stats.tx_busy; nic_tx_stats->tx_wake +=3D tx_stats.tx_wake; nic_tx_stats->tx_dropped +=3D tx_stats.tx_dropped; nic_tx_stats->big_frags_pkts +=3D tx_stats.big_frags_pkts; - u64_stats_update_end(&nic_tx_stats->syncp); - - hinic_txq_clean_stats(txq); } =20 -static void update_nic_stats(struct hinic_dev *nic_dev) +static void gather_nic_stats(struct hinic_dev *nic_dev, + struct hinic_rxq_stats *nic_rx_stats, + struct hinic_txq_stats *nic_tx_stats) { int i, num_qps =3D hinic_hwdev_num_qps(nic_dev->hwdev); =20 for (i =3D 0; i < num_qps; i++) - update_rx_stats(nic_dev, &nic_dev->rxqs[i]); + gather_rx_stats(nic_rx_stats, &nic_dev->rxqs[i]); =20 for (i =3D 0; i < num_qps; i++) - update_tx_stats(nic_dev, &nic_dev->txqs[i]); + gather_tx_stats(nic_tx_stats, &nic_dev->txqs[i]); } =20 /** @@ -558,8 +546,6 @@ int hinic_close(struct net_device *netdev) netif_carrier_off(netdev); netif_tx_disable(netdev); =20 - update_nic_stats(nic_dev); - up(&nic_dev->mgmt_lock); =20 if (!HINIC_IS_VF(nic_dev->hwdev->hwif)) @@ -853,26 +839,23 @@ static void hinic_get_stats64(struct net_device *netd= ev, struct rtnl_link_stats64 *stats) { struct hinic_dev *nic_dev =3D netdev_priv(netdev); - struct hinic_rxq_stats *nic_rx_stats; - struct hinic_txq_stats *nic_tx_stats; - - nic_rx_stats =3D &nic_dev->rx_stats; - nic_tx_stats =3D &nic_dev->tx_stats; + struct hinic_rxq_stats nic_rx_stats =3D {}; + struct hinic_txq_stats nic_tx_stats =3D {}; =20 down(&nic_dev->mgmt_lock); =20 if (nic_dev->flags & HINIC_INTF_UP) - update_nic_stats(nic_dev); + gather_nic_stats(nic_dev, &nic_rx_stats, &nic_tx_stats); =20 up(&nic_dev->mgmt_lock); =20 - stats->rx_bytes =3D nic_rx_stats->bytes; - stats->rx_packets =3D nic_rx_stats->pkts; - stats->rx_errors =3D nic_rx_stats->errors; + stats->rx_bytes =3D nic_rx_stats.bytes; + stats->rx_packets =3D nic_rx_stats.pkts; + stats->rx_errors =3D nic_rx_stats.errors; =20 - stats->tx_bytes =3D nic_tx_stats->bytes; - stats->tx_packets =3D nic_tx_stats->pkts; - stats->tx_errors =3D nic_tx_stats->tx_dropped; + stats->tx_bytes =3D nic_tx_stats.bytes; + stats->tx_packets =3D nic_tx_stats.pkts; + stats->tx_errors =3D nic_tx_stats.tx_dropped; } =20 static int hinic_set_features(struct net_device *netdev, @@ -1171,8 +1154,6 @@ static void hinic_free_intr_coalesce(struct hinic_dev= *nic_dev) static int nic_dev_init(struct pci_dev *pdev) { struct hinic_rx_mode_work *rx_mode_work; - struct hinic_txq_stats *tx_stats; - struct hinic_rxq_stats *rx_stats; struct hinic_dev *nic_dev; struct net_device *netdev; struct hinic_hwdev *hwdev; @@ -1233,12 +1214,6 @@ static int nic_dev_init(struct pci_dev *pdev) =20 sema_init(&nic_dev->mgmt_lock, 1); =20 - tx_stats =3D &nic_dev->tx_stats; - rx_stats =3D &nic_dev->rx_stats; - - u64_stats_init(&tx_stats->syncp); - u64_stats_init(&rx_stats->syncp); - nic_dev->vlan_bitmap =3D devm_bitmap_zalloc(&pdev->dev, VLAN_N_VID, GFP_KERNEL); if (!nic_dev->vlan_bitmap) { diff --git a/drivers/net/ethernet/huawei/hinic/hinic_rx.c b/drivers/net/eth= ernet/huawei/hinic/hinic_rx.c index fed3b6bc0d76..a102d486c435 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_rx.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_rx.c @@ -73,7 +73,6 @@ void hinic_rxq_get_stats(struct hinic_rxq *rxq, struct hi= nic_rxq_stats *stats) struct hinic_rxq_stats *rxq_stats =3D &rxq->rxq_stats; unsigned int start; =20 - u64_stats_update_begin(&stats->syncp); do { start =3D u64_stats_fetch_begin(&rxq_stats->syncp); stats->pkts =3D rxq_stats->pkts; @@ -83,7 +82,6 @@ void hinic_rxq_get_stats(struct hinic_rxq *rxq, struct hi= nic_rxq_stats *stats) stats->csum_errors =3D rxq_stats->csum_errors; stats->other_errors =3D rxq_stats->other_errors; } while (u64_stats_fetch_retry(&rxq_stats->syncp, start)); - u64_stats_update_end(&stats->syncp); } =20 /** diff --git a/drivers/net/ethernet/huawei/hinic/hinic_tx.c b/drivers/net/eth= ernet/huawei/hinic/hinic_tx.c index a984a7a6dd2e..d1ea358a1fc0 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_tx.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_tx.c @@ -97,7 +97,6 @@ void hinic_txq_get_stats(struct hinic_txq *txq, struct hi= nic_txq_stats *stats) struct hinic_txq_stats *txq_stats =3D &txq->txq_stats; unsigned int start; =20 - u64_stats_update_begin(&stats->syncp); do { start =3D u64_stats_fetch_begin(&txq_stats->syncp); stats->pkts =3D txq_stats->pkts; @@ -107,7 +106,6 @@ void hinic_txq_get_stats(struct hinic_txq *txq, struct = hinic_txq_stats *stats) stats->tx_dropped =3D txq_stats->tx_dropped; stats->big_frags_pkts =3D txq_stats->big_frags_pkts; } while (u64_stats_fetch_retry(&txq_stats->syncp, start)); - u64_stats_update_end(&stats->syncp); } =20 /** --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 181F8C25B08 for ; Mon, 15 Aug 2022 18:57:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244656AbiHOSzi (ORCPT ); Mon, 15 Aug 2022 14:55:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244778AbiHOSv4 (ORCPT ); Mon, 15 Aug 2022 14:51: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 422B2474FD; Mon, 15 Aug 2022 11:29: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 9EA08B81085; Mon, 15 Aug 2022 18:29:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A7F2C433C1; Mon, 15 Aug 2022 18:29:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588181; bh=qJnDuBurTqdvBzjne3TDhA/1cOkjclrl2uNtQkxSvVs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MFNkw2KB0ESDRRXPAtMgwpcU7meaDjUQlGkGl+JOASUeNkgLWbVI4qPpVudp43LFd MZtKyBJGphhc4hf56X2PO+c4gYTXamCOT9bJssG8vwWD8wIGJGsifgKIh2B0KxuimS oaJpaJe9VQRIYmgaBt02WFCCcxKYxPbNZWRDoSJk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qiao Ma , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 319/779] net: hinic: avoid kernel hung in hinic_get_stats64() Date: Mon, 15 Aug 2022 19:59:23 +0200 Message-Id: <20220815180350.915194042@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Qiao Ma [ Upstream commit 98f9fcdee35add80505b6c73f72de5f750d5c03c ] When using hinic device as a bond slave device, and reading device stats of master bond device, the kernel may hung. The kernel panic calltrace as follows: Kernel panic - not syncing: softlockup: hung tasks Call trace: native_queued_spin_lock_slowpath+0x1ec/0x31c dev_get_stats+0x60/0xcc dev_seq_printf_stats+0x40/0x120 dev_seq_show+0x1c/0x40 seq_read_iter+0x3c8/0x4dc seq_read+0xe0/0x130 proc_reg_read+0xa8/0xe0 vfs_read+0xb0/0x1d4 ksys_read+0x70/0xfc __arm64_sys_read+0x20/0x30 el0_svc_common+0x88/0x234 do_el0_svc+0x2c/0x90 el0_svc+0x1c/0x30 el0_sync_handler+0xa8/0xb0 el0_sync+0x148/0x180 And the calltrace of task that actually caused kernel hungs as follows: __switch_to+124 __schedule+548 schedule+72 schedule_timeout+348 __down_common+188 __down+24 down+104 hinic_get_stats64+44 [hinic] dev_get_stats+92 bond_get_stats+172 [bonding] dev_get_stats+92 dev_seq_printf_stats+60 dev_seq_show+24 seq_read_iter+964 seq_read+220 proc_reg_read+164 vfs_read+172 ksys_read+108 __arm64_sys_read+28 el0_svc_common+132 do_el0_svc+40 el0_svc+24 el0_sync_handler+164 el0_sync+324 When getting device stats from bond, kernel will call bond_get_stats(). It first holds the spinlock bond->stats_lock, and then call hinic_get_stats64() to collect hinic device's stats. However, hinic_get_stats64() calls `down(&nic_dev->mgmt_lock)` to protect its critical section, which may schedule current task out. And if system is under high pressure, the task cannot be woken up immediately, which eventually triggers kernel hung panic. Since previous patch has replaced hinic_dev.tx_stats/rx_stats with local variable in hinic_get_stats64(), there is nothing need to be protected by lock, so just removing down()/up() is ok. Fixes: edd384f682cc ("net-next/hinic: Add ethtool and stats") Signed-off-by: Qiao Ma Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/ethernet/huawei/hinic/hinic_main.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/net/ethernet/huawei/hinic/hinic_main.c b/drivers/net/e= thernet/huawei/hinic/hinic_main.c index 909758367e7c..8c6ec7c25809 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_main.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_main.c @@ -842,13 +842,9 @@ static void hinic_get_stats64(struct net_device *netde= v, struct hinic_rxq_stats nic_rx_stats =3D {}; struct hinic_txq_stats nic_tx_stats =3D {}; =20 - down(&nic_dev->mgmt_lock); - if (nic_dev->flags & HINIC_INTF_UP) gather_nic_stats(nic_dev, &nic_rx_stats, &nic_tx_stats); =20 - up(&nic_dev->mgmt_lock); - stats->rx_bytes =3D nic_rx_stats.bytes; stats->rx_packets =3D nic_rx_stats.pkts; stats->rx_errors =3D nic_rx_stats.errors; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36666C3F6B0 for ; Mon, 15 Aug 2022 18:57:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244684AbiHOSzl (ORCPT ); Mon, 15 Aug 2022 14:55:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244786AbiHOSv5 (ORCPT ); Mon, 15 Aug 2022 14:51: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 5B51E47B8F; Mon, 15 Aug 2022 11:29:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9C67061043; Mon, 15 Aug 2022 18:29:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25006C43142; Mon, 15 Aug 2022 18:29:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588185; bh=qthlUxLyneTrQoXxQBbYo31Gy/R5BpXEYmeBs7zGNCU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vzmaZtt5B23gWGESEJQEwvJEO6LCTck2mzOgN4ii8WcCUi/oQPC0JFRffHUX6WqxH UGcTlNDRlj7ftN4IrMUG6VOHzw8ayXIhteWNA/GboyRrUJ7KFSpVz5vgu/RFeyUemh zpwgI3k6/MomQy142l5CAkeioCTi0XL09u/H398A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rob Clark , Abhinav Kumar , Sasha Levin Subject: [PATCH 5.15 320/779] drm/msm/mdp5: Fix global state lock backoff Date: Mon, 15 Aug 2022 19:59:24 +0200 Message-Id: <20220815180350.955357281@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rob Clark [ Upstream commit 92ef86ab513593c6329d04146e61f9a670e72fc5 ] We need to grab the lock after the early return for !hwpipe case. Otherwise, we could have hit contention yet still returned 0. Fixes an issue that the new CONFIG_DRM_DEBUG_MODESET_LOCK stuff flagged in CI: WARNING: CPU: 0 PID: 282 at drivers/gpu/drm/drm_modeset_lock.c:296 drm_m= odeset_lock+0xf8/0x154 Modules linked in: CPU: 0 PID: 282 Comm: kms_cursor_lega Tainted: G W 5.19.0= -rc2-15930-g875cc8bc536a #1 Hardware name: Qualcomm Technologies, Inc. DB820c (DT) pstate: 60000005 (nZCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=3D--) pc : drm_modeset_lock+0xf8/0x154 lr : drm_atomic_get_private_obj_state+0x84/0x170 sp : ffff80000cfab6a0 x29: ffff80000cfab6a0 x28: 0000000000000000 x27: ffff000083bc4d00 x26: 0000000000000038 x25: 0000000000000000 x24: ffff80000957ca58 x23: 0000000000000000 x22: ffff000081ace080 x21: 0000000000000001 x20: ffff000081acec18 x19: ffff80000cfabb80 x18: 0000000000000038 x17: 0000000000000000 x16: 0000000000000000 x15: fffffffffffea0d0 x14: 0000000000000000 x13: 284e4f5f4e524157 x12: 5f534b434f4c5f47 x11: ffff80000a386aa8 x10: 0000000000000029 x9 : ffff80000cfab610 x8 : 0000000000000029 x7 : 0000000000000014 x6 : 0000000000000000 x5 : 0000000000000001 x4 : ffff8000081ad904 x3 : 0000000000000029 x2 : ffff0000801db4c0 x1 : ffff80000cfabb80 x0 : ffff000081aceb58 Call trace: drm_modeset_lock+0xf8/0x154 drm_atomic_get_private_obj_state+0x84/0x170 mdp5_get_global_state+0x54/0x6c mdp5_pipe_release+0x2c/0xd4 mdp5_plane_atomic_check+0x2ec/0x414 drm_atomic_helper_check_planes+0xd8/0x210 drm_atomic_helper_check+0x54/0xb0 ... ---[ end trace 0000000000000000 ]--- drm_modeset_lock attempting to lock a contended lock without backoff: drm_modeset_lock+0x148/0x154 mdp5_get_global_state+0x30/0x6c mdp5_pipe_release+0x2c/0xd4 mdp5_plane_atomic_check+0x290/0x414 drm_atomic_helper_check_planes+0xd8/0x210 drm_atomic_helper_check+0x54/0xb0 drm_atomic_check_only+0x4b0/0x8f4 drm_atomic_commit+0x68/0xe0 Fixes: d59be579fa93 ("drm/msm/mdp5: Return error code in mdp5_pipe_release = when deadlock is detected") Signed-off-by: Rob Clark Reviewed-by: Abhinav Kumar Patchwork: https://patchwork.freedesktop.org/patch/492701/ Link: https://lore.kernel.org/r/20220707162040.1594855-1-robdclark@gmail.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/msm/disp/mdp5/mdp5_pipe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_pipe.c b/drivers/gpu/drm/ms= m/disp/mdp5/mdp5_pipe.c index a4f5cb90f3e8..e4b8a789835a 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_pipe.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_pipe.c @@ -123,12 +123,13 @@ int mdp5_pipe_release(struct drm_atomic_state *s, str= uct mdp5_hw_pipe *hwpipe) { struct msm_drm_private *priv =3D s->dev->dev_private; struct mdp5_kms *mdp5_kms =3D to_mdp5_kms(to_mdp_kms(priv->kms)); - struct mdp5_global_state *state =3D mdp5_get_global_state(s); + struct mdp5_global_state *state; struct mdp5_hw_pipe_state *new_state; =20 if (!hwpipe) return 0; =20 + state =3D mdp5_get_global_state(s); if (IS_ERR(state)) return PTR_ERR(state); =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D9C5C282E7 for ; Mon, 15 Aug 2022 18:57:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244721AbiHOSzq (ORCPT ); Mon, 15 Aug 2022 14:55:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243889AbiHOSwN (ORCPT ); Mon, 15 Aug 2022 14:52: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 4539E43E70; Mon, 15 Aug 2022 11:29: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 DA2D360F23; Mon, 15 Aug 2022 18:29:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB50BC433D6; Mon, 15 Aug 2022 18:29:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588188; bh=GcJR48wUjvC4zNR17cIs0BpOV+e7vwVAANrGSOGAe4g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pS39eEYbLs9RjU6V45jIIeoRvtAxQAYYmrVCUro9YSXzs4oTQ5dlofyU42Gqdmy2O RZ8KWN7P1+wyLuKpn1bAGdrBfiRLbjF/TTbxKxRA4AsJm7oXa5wXpwtfSvM26GOvIt n4FwB21wTahR7qOfWdulclMXDhNh63HjD7hpA2/c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhengchao Shao , Herbert Xu , Sasha Levin Subject: [PATCH 5.15 321/779] crypto: hisilicon/sec - dont sleep when in softirq Date: Mon, 15 Aug 2022 19:59:25 +0200 Message-Id: <20220815180350.999731717@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhengchao Shao [ Upstream commit 02884a4f12de11f54d4ca67a07dd1f111d96fdbd ] When kunpeng920 encryption driver is used to deencrypt and decrypt packets during the softirq, it is not allowed to use mutex lock. The kernel will report the following error: BUG: scheduling while atomic: swapper/57/0/0x00000300 Call trace: dump_backtrace+0x0/0x1e4 show_stack+0x20/0x2c dump_stack+0xd8/0x140 __schedule_bug+0x68/0x80 __schedule+0x728/0x840 schedule+0x50/0xe0 schedule_preempt_disabled+0x18/0x24 __mutex_lock.constprop.0+0x594/0x5dc __mutex_lock_slowpath+0x1c/0x30 mutex_lock+0x50/0x60 sec_request_init+0x8c/0x1a0 [hisi_sec2] sec_process+0x28/0x1ac [hisi_sec2] sec_skcipher_crypto+0xf4/0x1d4 [hisi_sec2] sec_skcipher_encrypt+0x1c/0x30 [hisi_sec2] crypto_skcipher_encrypt+0x2c/0x40 crypto_authenc_encrypt+0xc8/0xfc [authenc] crypto_aead_encrypt+0x2c/0x40 echainiv_encrypt+0x144/0x1a0 [echainiv] crypto_aead_encrypt+0x2c/0x40 esp_output_tail+0x348/0x5c0 [esp4] esp_output+0x120/0x19c [esp4] xfrm_output_one+0x25c/0x4d4 xfrm_output_resume+0x6c/0x1fc xfrm_output+0xac/0x3c0 xfrm4_output+0x64/0x130 ip_build_and_send_pkt+0x158/0x20c tcp_v4_send_synack+0xdc/0x1f0 tcp_conn_request+0x7d0/0x994 tcp_v4_conn_request+0x58/0x6c tcp_v6_conn_request+0xf0/0x100 tcp_rcv_state_process+0x1cc/0xd60 tcp_v4_do_rcv+0x10c/0x250 tcp_v4_rcv+0xfc4/0x10a4 ip_protocol_deliver_rcu+0xf4/0x200 ip_local_deliver_finish+0x58/0x70 ip_local_deliver+0x68/0x120 ip_sublist_rcv_finish+0x70/0x94 ip_list_rcv_finish.constprop.0+0x17c/0x1d0 ip_sublist_rcv+0x40/0xb0 ip_list_rcv+0x140/0x1dc __netif_receive_skb_list_core+0x154/0x28c __netif_receive_skb_list+0x120/0x1a0 netif_receive_skb_list_internal+0xe4/0x1f0 napi_complete_done+0x70/0x1f0 gro_cell_poll+0x9c/0xb0 napi_poll+0xcc/0x264 net_rx_action+0xd4/0x21c __do_softirq+0x130/0x358 irq_exit+0x11c/0x13c __handle_domain_irq+0x88/0xf0 gic_handle_irq+0x78/0x2c0 el1_irq+0xb8/0x140 arch_cpu_idle+0x18/0x40 default_idle_call+0x5c/0x1c0 cpuidle_idle_call+0x174/0x1b0 do_idle+0xc8/0x160 cpu_startup_entry+0x30/0x11c secondary_start_kernel+0x158/0x1e4 softirq: huh, entered softirq 3 NET_RX 0000000093774ee4 with preempt_count 00000100, exited with fffffe00? Fixes: 416d82204df4 ("crypto: hisilicon - add HiSilicon SEC V2 driver") Signed-off-by: Zhengchao Shao Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/crypto/hisilicon/sec2/sec.h | 2 +- drivers/crypto/hisilicon/sec2/sec_crypto.c | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/crypto/hisilicon/sec2/sec.h b/drivers/crypto/hisilicon= /sec2/sec.h index d97cf02b1df7..cff00fd29765 100644 --- a/drivers/crypto/hisilicon/sec2/sec.h +++ b/drivers/crypto/hisilicon/sec2/sec.h @@ -119,7 +119,7 @@ struct sec_qp_ctx { struct idr req_idr; struct sec_alg_res res[QM_Q_DEPTH]; struct sec_ctx *ctx; - struct mutex req_lock; + spinlock_t req_lock; struct list_head backlog; struct hisi_acc_sgl_pool *c_in_pool; struct hisi_acc_sgl_pool *c_out_pool; diff --git a/drivers/crypto/hisilicon/sec2/sec_crypto.c b/drivers/crypto/hi= silicon/sec2/sec_crypto.c index 090920ed50c8..36c789ff1bd4 100644 --- a/drivers/crypto/hisilicon/sec2/sec_crypto.c +++ b/drivers/crypto/hisilicon/sec2/sec_crypto.c @@ -124,11 +124,11 @@ static int sec_alloc_req_id(struct sec_req *req, stru= ct sec_qp_ctx *qp_ctx) { int req_id; =20 - mutex_lock(&qp_ctx->req_lock); + spin_lock_bh(&qp_ctx->req_lock); =20 req_id =3D idr_alloc_cyclic(&qp_ctx->req_idr, NULL, 0, QM_Q_DEPTH, GFP_ATOMIC); - mutex_unlock(&qp_ctx->req_lock); + spin_unlock_bh(&qp_ctx->req_lock); if (unlikely(req_id < 0)) { dev_err(req->ctx->dev, "alloc req id fail!\n"); return req_id; @@ -153,9 +153,9 @@ static void sec_free_req_id(struct sec_req *req) qp_ctx->req_list[req_id] =3D NULL; req->qp_ctx =3D NULL; =20 - mutex_lock(&qp_ctx->req_lock); + spin_lock_bh(&qp_ctx->req_lock); idr_remove(&qp_ctx->req_idr, req_id); - mutex_unlock(&qp_ctx->req_lock); + spin_unlock_bh(&qp_ctx->req_lock); } =20 static u8 pre_parse_finished_bd(struct bd_status *status, void *resp) @@ -270,7 +270,7 @@ static int sec_bd_send(struct sec_ctx *ctx, struct sec_= req *req) !(req->flag & CRYPTO_TFM_REQ_MAY_BACKLOG)) return -EBUSY; =20 - mutex_lock(&qp_ctx->req_lock); + spin_lock_bh(&qp_ctx->req_lock); ret =3D hisi_qp_send(qp_ctx->qp, &req->sec_sqe); =20 if (ctx->fake_req_limit <=3D @@ -278,10 +278,10 @@ static int sec_bd_send(struct sec_ctx *ctx, struct se= c_req *req) list_add_tail(&req->backlog_head, &qp_ctx->backlog); atomic64_inc(&ctx->sec->debug.dfx.send_cnt); atomic64_inc(&ctx->sec->debug.dfx.send_busy_cnt); - mutex_unlock(&qp_ctx->req_lock); + spin_unlock_bh(&qp_ctx->req_lock); return -EBUSY; } - mutex_unlock(&qp_ctx->req_lock); + spin_unlock_bh(&qp_ctx->req_lock); =20 if (unlikely(ret =3D=3D -EBUSY)) return -ENOBUFS; @@ -484,7 +484,7 @@ static int sec_create_qp_ctx(struct hisi_qm *qm, struct= sec_ctx *ctx, =20 qp->req_cb =3D sec_req_cb; =20 - mutex_init(&qp_ctx->req_lock); + spin_lock_init(&qp_ctx->req_lock); idr_init(&qp_ctx->req_idr); INIT_LIST_HEAD(&qp_ctx->backlog); =20 @@ -1373,7 +1373,7 @@ static struct sec_req *sec_back_req_clear(struct sec_= ctx *ctx, { struct sec_req *backlog_req =3D NULL; =20 - mutex_lock(&qp_ctx->req_lock); + spin_lock_bh(&qp_ctx->req_lock); if (ctx->fake_req_limit >=3D atomic_read(&qp_ctx->qp->qp_status.used) && !list_empty(&qp_ctx->backlog)) { @@ -1381,7 +1381,7 @@ static struct sec_req *sec_back_req_clear(struct sec_= ctx *ctx, typeof(*backlog_req), backlog_head); list_del(&backlog_req->backlog_head); } - mutex_unlock(&qp_ctx->req_lock); + spin_unlock_bh(&qp_ctx->req_lock); =20 return backlog_req; } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 68635C28B2B for ; Mon, 15 Aug 2022 18:57:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244760AbiHOSzs (ORCPT ); Mon, 15 Aug 2022 14:55:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244164AbiHOSwv (ORCPT ); Mon, 15 Aug 2022 14:52:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 866C9481CA; Mon, 15 Aug 2022 11:29:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D6EBFB8106E; Mon, 15 Aug 2022 18:29:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 332E7C433C1; Mon, 15 Aug 2022 18:29:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588191; bh=UDGcVwRi7O++OPdySi9hrL7ej4PyhcDWLK6vrD9AdiA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eDiyzfIUb0I3Rne7rhO1NbTlo9PD/SxXGoVrW8/Z6oNUFCGmG9Ew/i10p5VzH4CM2 R1OVuIpBq9k8LuM1AKEkrYh8H+2G/q5hq9R8BON41HDH03XU3V2KxbKXWn/HWo1TTp EYgr5llR4KyN6apMtQ76vnXapUVwcovGn0O8kzRA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhengchao Shao , Herbert Xu , Sasha Levin Subject: [PATCH 5.15 322/779] crypto: hisilicon - Kunpeng916 crypto driver dont sleep when in softirq Date: Mon, 15 Aug 2022 19:59:26 +0200 Message-Id: <20220815180351.049912089@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhengchao Shao [ Upstream commit 68740ab505431f268dc1ee26a54b871e75f0ddaa ] When kunpeng916 encryption driver is used to deencrypt and decrypt packets during the softirq, it is not allowed to use mutex lock. Fixes: 915e4e8413da ("crypto: hisilicon - SEC security accelerator driver") Signed-off-by: Zhengchao Shao Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/crypto/hisilicon/sec/sec_algs.c | 14 +++++++------- drivers/crypto/hisilicon/sec/sec_drv.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/crypto/hisilicon/sec/sec_algs.c b/drivers/crypto/hisil= icon/sec/sec_algs.c index 0a3c8f019b02..490e1542305e 100644 --- a/drivers/crypto/hisilicon/sec/sec_algs.c +++ b/drivers/crypto/hisilicon/sec/sec_algs.c @@ -449,7 +449,7 @@ static void sec_skcipher_alg_callback(struct sec_bd_inf= o *sec_resp, */ } =20 - mutex_lock(&ctx->queue->queuelock); + spin_lock_bh(&ctx->queue->queuelock); /* Put the IV in place for chained cases */ switch (ctx->cipher_alg) { case SEC_C_AES_CBC_128: @@ -509,7 +509,7 @@ static void sec_skcipher_alg_callback(struct sec_bd_inf= o *sec_resp, list_del(&backlog_req->backlog_head); } } - mutex_unlock(&ctx->queue->queuelock); + spin_unlock_bh(&ctx->queue->queuelock); =20 mutex_lock(&sec_req->lock); list_del(&sec_req_el->head); @@ -798,7 +798,7 @@ static int sec_alg_skcipher_crypto(struct skcipher_requ= est *skreq, */ =20 /* Grab a big lock for a long time to avoid concurrency issues */ - mutex_lock(&queue->queuelock); + spin_lock_bh(&queue->queuelock); =20 /* * Can go on to queue if we have space in either: @@ -814,15 +814,15 @@ static int sec_alg_skcipher_crypto(struct skcipher_re= quest *skreq, ret =3D -EBUSY; if ((skreq->base.flags & CRYPTO_TFM_REQ_MAY_BACKLOG)) { list_add_tail(&sec_req->backlog_head, &ctx->backlog); - mutex_unlock(&queue->queuelock); + spin_unlock_bh(&queue->queuelock); goto out; } =20 - mutex_unlock(&queue->queuelock); + spin_unlock_bh(&queue->queuelock); goto err_free_elements; } ret =3D sec_send_request(sec_req, queue); - mutex_unlock(&queue->queuelock); + spin_unlock_bh(&queue->queuelock); if (ret) goto err_free_elements; =20 @@ -881,7 +881,7 @@ static int sec_alg_skcipher_init(struct crypto_skcipher= *tfm) if (IS_ERR(ctx->queue)) return PTR_ERR(ctx->queue); =20 - mutex_init(&ctx->queue->queuelock); + spin_lock_init(&ctx->queue->queuelock); ctx->queue->havesoftqueue =3D false; =20 return 0; diff --git a/drivers/crypto/hisilicon/sec/sec_drv.h b/drivers/crypto/hisili= con/sec/sec_drv.h index 179a8250d691..e2a50bf2234b 100644 --- a/drivers/crypto/hisilicon/sec/sec_drv.h +++ b/drivers/crypto/hisilicon/sec/sec_drv.h @@ -347,7 +347,7 @@ struct sec_queue { DECLARE_BITMAP(unprocessed, SEC_QUEUE_LEN); DECLARE_KFIFO_PTR(softqueue, typeof(struct sec_request_el *)); bool havesoftqueue; - struct mutex queuelock; + spinlock_t queuelock; void *shadow[SEC_QUEUE_LEN]; }; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4382C28B2B for ; Mon, 15 Aug 2022 19:02:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245280AbiHOTBo (ORCPT ); Mon, 15 Aug 2022 15:01:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245169AbiHOS44 (ORCPT ); Mon, 15 Aug 2022 14:56:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FC6048E90; Mon, 15 Aug 2022 11:31: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 F26C7B8106E; Mon, 15 Aug 2022 18:31:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C172C433B5; Mon, 15 Aug 2022 18:31:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588315; bh=aQEoMfCovPkTWLiJW3uCpiZOLirceCKWhcTPW0uKekk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pzPn+Dvh4hYkSKM9MjKaqhBoDJj7DsvM9CNcQKFfMD1GxQYcUrgSOi3JtRQ3folmQ l/HZULGJewH66U/HSHST+MVSeKs15vvKdJYXhxbkNb3lm6wcO3kP/4uAmPl/5HRr3Y I4RFmGyLEebVb7LiAX3Govw6ICSdc2ol0RhbItCE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , Houlong Wei , Irui Wang , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.15 323/779] media: platform: mtk-mdp: Fix mdp_ipi_comm structure alignment Date: Mon, 15 Aug 2022 19:59:27 +0200 Message-Id: <20220815180351.088343494@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: AngeloGioacchino Del Regno [ Upstream commit ab14c99c035da7156a3b66fa171171295bc4b89a ] The mdp_ipi_comm structure defines a command that is either PROCESS (start processing) or DEINIT (destroy instance); we are using this one to send PROCESS or DEINIT commands from Linux to an MDP instance through a VPU write but, while the first wants us to stay 4-bytes aligned, the VPU instead requires an 8-bytes data alignment. Keeping in mind that these commands are executed immediately after sending them (hence not chained with others before the VPU/MDP "actually" start executing), it is fine to simply add a padding of 4 bytes to this structure: this keeps the same performance as before, as we're still stack-allocating it, while avoiding hackery inside of mtk-vpu to ensure alignment bringing a definitely bigger performance impact. Fixes: c8eb2d7e8202 ("[media] media: Add Mediatek MDP Driver") Signed-off-by: AngeloGioacchino Del Regno Reviewed-by: Houlong Wei Reviewed-by: Irui Wang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h b/drivers/media/p= latform/mtk-mdp/mtk_mdp_ipi.h index 2cb8cecb3077..b810c96695c8 100644 --- a/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h +++ b/drivers/media/platform/mtk-mdp/mtk_mdp_ipi.h @@ -40,12 +40,14 @@ struct mdp_ipi_init { * @ipi_id : IPI_MDP * @ap_inst : AP mtk_mdp_vpu address * @vpu_inst_addr : VPU MDP instance address + * @padding : Alignment padding */ struct mdp_ipi_comm { uint32_t msg_id; uint32_t ipi_id; uint64_t ap_inst; uint32_t vpu_inst_addr; + uint32_t padding; }; =20 /** --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82DDFC28B2B for ; Mon, 15 Aug 2022 18:58:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244671AbiHOS6a (ORCPT ); Mon, 15 Aug 2022 14:58:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244764AbiHOSzs (ORCPT ); Mon, 15 Aug 2022 14:55:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C860F28; Mon, 15 Aug 2022 11:30: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 ED7A1B81062; Mon, 15 Aug 2022 18:30:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 593C0C433D7; Mon, 15 Aug 2022 18:30:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588216; bh=8+GExw1I6H3NJqrDSCnM52HuDRkSazdqafSvhci3HH4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xyt8iX3aWjM0ytQS27C1cHN01G7CFGOeOY4Ve8HmEgChOAajSsd6FHZF1hIvExli3 LbBpTF978CQ5Sc7ZRS527Z8eBLdsW3LY/bSkkGlJ079CyitOjj0M0GvKVf75hJVjps 5NxbOFTmOdMAQGrPqC7S2BrX6P9/l77W5frkMZbE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rob Clark , Dmitry Baryshkov , Sasha Levin Subject: [PATCH 5.15 324/779] drm/msm: Avoid dirtyfb stalls on video mode displays (v2) Date: Mon, 15 Aug 2022 19:59:28 +0200 Message-Id: <20220815180351.139763922@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rob Clark [ Upstream commit 9e4dde28e9cd34ee13a6b7247f0857fb49fd3f19 ] Someone on IRC once asked an innocent enough sounding question: Why with xf86-video-modesetting is es2gears limited at 120fps. So I broke out the perfetto tracing mesa MR and took a look. It turns out the problem was drm_atomic_helper_dirtyfb(), which would end up waiting for vblank.. es2gears would rapidly push two frames to Xorg, which would blit them to screen and in idle hook (I assume) call the DIRTYFB ioctl. Which in turn would do an atomic update to flush the dirty rects, which would stall until the next vblank. And then the whole process would repeat. But this is a bit silly, we only need dirtyfb for command mode DSI panels. So track in plane state whether dirtyfb is required, and track in the fb how many attached planes require dirtyfb so that we can skip it when not required. (Note, mdp4 does not actually have cmd mode support.) Signed-off-by: Rob Clark Reviewed-by: Dmitry Baryshkov Link: https://lore.kernel.org/r/20220223191118.881321-1-robdclark@gmail.com Signed-off-by: Rob Clark Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 20 ++++++++++- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c | 5 +-- drivers/gpu/drm/msm/disp/dpu1/dpu_plane.h | 3 ++ drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c | 19 ++++++++-- drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c | 8 +++++ drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h | 5 +++ drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c | 21 +++++++++-- drivers/gpu/drm/msm/msm_atomic.c | 15 -------- drivers/gpu/drm/msm/msm_drv.h | 6 ++-- drivers/gpu/drm/msm/msm_fb.c | 41 ++++++++++++++++++---- 10 files changed, 110 insertions(+), 33 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm= /disp/dpu1/dpu_crtc.c index 768012243b44..7706a7106122 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -898,6 +898,20 @@ struct plane_state { u32 pipe_id; }; =20 +static bool dpu_crtc_needs_dirtyfb(struct drm_crtc_state *cstate) +{ + struct drm_crtc *crtc =3D cstate->crtc; + struct drm_encoder *encoder; + + drm_for_each_encoder_mask (encoder, crtc->dev, cstate->encoder_mask) { + if (dpu_encoder_get_intf_mode(encoder) =3D=3D INTF_MODE_CMD) { + return true; + } + } + + return false; +} + static int dpu_crtc_atomic_check(struct drm_crtc *crtc, struct drm_atomic_state *state) { @@ -918,6 +932,7 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc, const struct drm_plane_state *pipe_staged[SSPP_MAX]; int left_zpos_cnt =3D 0, right_zpos_cnt =3D 0; struct drm_rect crtc_rect =3D { 0 }; + bool needs_dirtyfb =3D dpu_crtc_needs_dirtyfb(crtc_state); =20 pstates =3D kzalloc(sizeof(*pstates) * DPU_STAGE_MAX * 4, GFP_KERNEL); =20 @@ -949,6 +964,7 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc, =20 /* get plane state for all drm planes associated with crtc state */ drm_atomic_crtc_state_for_each_plane_state(plane, pstate, crtc_state) { + struct dpu_plane_state *dpu_pstate =3D to_dpu_plane_state(pstate); struct drm_rect dst, clip =3D crtc_rect; =20 if (IS_ERR_OR_NULL(pstate)) { @@ -960,11 +976,13 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crt= c, if (cnt >=3D DPU_STAGE_MAX * 4) continue; =20 - pstates[cnt].dpu_pstate =3D to_dpu_plane_state(pstate); + pstates[cnt].dpu_pstate =3D dpu_pstate; pstates[cnt].drm_pstate =3D pstate; pstates[cnt].stage =3D pstate->normalized_zpos; pstates[cnt].pipe_id =3D dpu_plane_pipe(plane); =20 + dpu_pstate->needs_dirtyfb =3D needs_dirtyfb; + if (pipe_staged[pstates[cnt].pipe_id]) { multirect_plane[multirect_count].r0 =3D pipe_staged[pstates[cnt].pipe_id]; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c b/drivers/gpu/drm/ms= m/disp/dpu1/dpu_plane.c index c989621209aa..e32fe89c203c 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c @@ -894,7 +894,7 @@ static int dpu_plane_prepare_fb(struct drm_plane *plane, =20 if (pstate->aspace) { ret =3D msm_framebuffer_prepare(new_state->fb, - pstate->aspace); + pstate->aspace, pstate->needs_dirtyfb); if (ret) { DPU_ERROR("failed to prepare framebuffer\n"); return ret; @@ -925,7 +925,8 @@ static void dpu_plane_cleanup_fb(struct drm_plane *plan= e, =20 DPU_DEBUG_PLANE(pdpu, "FB[%u]\n", old_state->fb->base.id); =20 - msm_framebuffer_cleanup(old_state->fb, old_pstate->aspace); + msm_framebuffer_cleanup(old_state->fb, old_pstate->aspace, + old_pstate->needs_dirtyfb); } =20 static bool dpu_plane_validate_src(struct drm_rect *src, diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.h b/drivers/gpu/drm/ms= m/disp/dpu1/dpu_plane.h index 34e03ac05f4a..17ff48564c8a 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.h @@ -28,6 +28,7 @@ * @cdp_cfg: CDP configuration * @plane_fetch_bw: calculated BW per plane * @plane_clk: calculated clk per plane + * @needs_dirtyfb: whether attached CRTC needs pixel data explicitly flush= ed */ struct dpu_plane_state { struct drm_plane_state base; @@ -45,6 +46,8 @@ struct dpu_plane_state { struct dpu_hw_pipe_cdp_cfg cdp_cfg; u64 plane_fetch_bw; u64 plane_clk; + + bool needs_dirtyfb; }; =20 /** diff --git a/drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c b/drivers/gpu/drm/m= sm/disp/mdp4/mdp4_plane.c index 49bdabea8ed5..3e20f72d75ef 100644 --- a/drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c +++ b/drivers/gpu/drm/msm/disp/mdp4/mdp4_plane.c @@ -7,6 +7,7 @@ #include #include #include +#include =20 #include "mdp4_kms.h" =20 @@ -90,6 +91,20 @@ static const struct drm_plane_funcs mdp4_plane_funcs =3D= { .atomic_destroy_state =3D drm_atomic_helper_plane_destroy_state, }; =20 +static int mdp4_plane_prepare_fb(struct drm_plane *plane, + struct drm_plane_state *new_state) +{ + struct msm_drm_private *priv =3D plane->dev->dev_private; + struct msm_kms *kms =3D priv->kms; + + if (!new_state->fb) + return 0; + + drm_gem_plane_helper_prepare_fb(plane, new_state); + + return msm_framebuffer_prepare(new_state->fb, kms->aspace, false); +} + static void mdp4_plane_cleanup_fb(struct drm_plane *plane, struct drm_plane_state *old_state) { @@ -102,7 +117,7 @@ static void mdp4_plane_cleanup_fb(struct drm_plane *pla= ne, return; =20 DBG("%s: cleanup: FB[%u]", mdp4_plane->name, fb->base.id); - msm_framebuffer_cleanup(fb, kms->aspace); + msm_framebuffer_cleanup(fb, kms->aspace, false); } =20 =20 @@ -130,7 +145,7 @@ static void mdp4_plane_atomic_update(struct drm_plane *= plane, } =20 static const struct drm_plane_helper_funcs mdp4_plane_helper_funcs =3D { - .prepare_fb =3D msm_atomic_prepare_fb, + .prepare_fb =3D mdp4_plane_prepare_fb, .cleanup_fb =3D mdp4_plane_cleanup_fb, .atomic_check =3D mdp4_plane_atomic_check, .atomic_update =3D mdp4_plane_atomic_update, diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c b/drivers/gpu/drm/ms= m/disp/mdp5/mdp5_crtc.c index 0e02e252ff89..31447da0af25 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_crtc.c @@ -696,6 +696,8 @@ static int mdp5_crtc_atomic_check(struct drm_crtc *crtc, { struct drm_crtc_state *crtc_state =3D drm_atomic_get_new_crtc_state(state, crtc); + struct mdp5_crtc_state *mdp5_cstate =3D to_mdp5_crtc_state(crtc_state); + struct mdp5_interface *intf =3D mdp5_cstate->pipeline.intf; struct mdp5_kms *mdp5_kms =3D get_kms(crtc); struct drm_plane *plane; struct drm_device *dev =3D crtc->dev; @@ -712,12 +714,18 @@ static int mdp5_crtc_atomic_check(struct drm_crtc *cr= tc, DBG("%s: check", crtc->name); =20 drm_atomic_crtc_state_for_each_plane_state(plane, pstate, crtc_state) { + struct mdp5_plane_state *mdp5_pstate =3D + to_mdp5_plane_state(pstate); + if (!pstate->visible) continue; =20 pstates[cnt].plane =3D plane; pstates[cnt].state =3D to_mdp5_plane_state(pstate); =20 + mdp5_pstate->needs_dirtyfb =3D + intf->mode =3D=3D MDP5_INTF_DSI_MODE_COMMAND; + /* * if any plane on this crtc uses 2 hwpipes, then we need * the crtc to have a right hwmixer. diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h b/drivers/gpu/drm/msm= /disp/mdp5/mdp5_kms.h index ac269a6802df..29bf11f08601 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.h @@ -100,6 +100,11 @@ struct mdp5_plane_state { =20 /* assigned by crtc blender */ enum mdp_mixer_stage_id stage; + + /* whether attached CRTC needs pixel data explicitly flushed to + * display (ex. DSI command mode display) + */ + bool needs_dirtyfb; }; #define to_mdp5_plane_state(x) \ container_of(x, struct mdp5_plane_state, base) diff --git a/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c b/drivers/gpu/drm/m= sm/disp/mdp5/mdp5_plane.c index c0d947bce9e9..9c42776cb9a8 100644 --- a/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c +++ b/drivers/gpu/drm/msm/disp/mdp5/mdp5_plane.c @@ -8,6 +8,7 @@ #include #include #include +#include #include =20 #include "mdp5_kms.h" @@ -143,18 +144,34 @@ static const struct drm_plane_funcs mdp5_plane_funcs = =3D { .atomic_print_state =3D mdp5_plane_atomic_print_state, }; =20 +static int mdp5_plane_prepare_fb(struct drm_plane *plane, + struct drm_plane_state *new_state) +{ + struct msm_drm_private *priv =3D plane->dev->dev_private; + struct msm_kms *kms =3D priv->kms; + bool needs_dirtyfb =3D to_mdp5_plane_state(new_state)->needs_dirtyfb; + + if (!new_state->fb) + return 0; + + drm_gem_plane_helper_prepare_fb(plane, new_state); + + return msm_framebuffer_prepare(new_state->fb, kms->aspace, needs_dirtyfb); +} + static void mdp5_plane_cleanup_fb(struct drm_plane *plane, struct drm_plane_state *old_state) { struct mdp5_kms *mdp5_kms =3D get_kms(plane); struct msm_kms *kms =3D &mdp5_kms->base.base; struct drm_framebuffer *fb =3D old_state->fb; + bool needed_dirtyfb =3D to_mdp5_plane_state(old_state)->needs_dirtyfb; =20 if (!fb) return; =20 DBG("%s: cleanup: FB[%u]", plane->name, fb->base.id); - msm_framebuffer_cleanup(fb, kms->aspace); + msm_framebuffer_cleanup(fb, kms->aspace, needed_dirtyfb); } =20 static int mdp5_plane_atomic_check_with_state(struct drm_crtc_state *crtc_= state, @@ -452,7 +469,7 @@ static void mdp5_plane_atomic_async_update(struct drm_p= lane *plane, } =20 static const struct drm_plane_helper_funcs mdp5_plane_helper_funcs =3D { - .prepare_fb =3D msm_atomic_prepare_fb, + .prepare_fb =3D mdp5_plane_prepare_fb, .cleanup_fb =3D mdp5_plane_cleanup_fb, .atomic_check =3D mdp5_plane_atomic_check, .atomic_update =3D mdp5_plane_atomic_update, diff --git a/drivers/gpu/drm/msm/msm_atomic.c b/drivers/gpu/drm/msm/msm_ato= mic.c index fab09e7c6efc..458f4e4316dd 100644 --- a/drivers/gpu/drm/msm/msm_atomic.c +++ b/drivers/gpu/drm/msm/msm_atomic.c @@ -5,7 +5,6 @@ */ =20 #include -#include #include =20 #include "msm_atomic_trace.h" @@ -13,20 +12,6 @@ #include "msm_gem.h" #include "msm_kms.h" =20 -int msm_atomic_prepare_fb(struct drm_plane *plane, - struct drm_plane_state *new_state) -{ - struct msm_drm_private *priv =3D plane->dev->dev_private; - struct msm_kms *kms =3D priv->kms; - - if (!new_state->fb) - return 0; - - drm_gem_plane_helper_prepare_fb(plane, new_state); - - return msm_framebuffer_prepare(new_state->fb, kms->aspace); -} - /* * Helpers to control vblanks while we flush.. basically just to ensure * that vblank accounting is switched on, so we get valid seqn/timestamp diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index bd5132bb9bde..8488e49817e1 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -247,8 +247,6 @@ struct msm_format { =20 struct msm_pending_timer; =20 -int msm_atomic_prepare_fb(struct drm_plane *plane, - struct drm_plane_state *new_state); int msm_atomic_init_pending_timer(struct msm_pending_timer *timer, struct msm_kms *kms, int crtc_idx); void msm_atomic_destroy_pending_timer(struct msm_pending_timer *timer); @@ -308,9 +306,9 @@ int msm_gem_prime_pin(struct drm_gem_object *obj); void msm_gem_prime_unpin(struct drm_gem_object *obj); =20 int msm_framebuffer_prepare(struct drm_framebuffer *fb, - struct msm_gem_address_space *aspace); + struct msm_gem_address_space *aspace, bool needs_dirtyfb); void msm_framebuffer_cleanup(struct drm_framebuffer *fb, - struct msm_gem_address_space *aspace); + struct msm_gem_address_space *aspace, bool needed_dirtyfb); uint32_t msm_framebuffer_iova(struct drm_framebuffer *fb, struct msm_gem_address_space *aspace, int plane); struct drm_gem_object *msm_framebuffer_bo(struct drm_framebuffer *fb, int = plane); diff --git a/drivers/gpu/drm/msm/msm_fb.c b/drivers/gpu/drm/msm/msm_fb.c index 4d34df5354e0..96b379a08327 100644 --- a/drivers/gpu/drm/msm/msm_fb.c +++ b/drivers/gpu/drm/msm/msm_fb.c @@ -18,16 +18,36 @@ struct msm_framebuffer { struct drm_framebuffer base; const struct msm_format *format; + + /* Count of # of attached planes which need dirtyfb: */ + refcount_t dirtyfb; }; #define to_msm_framebuffer(x) container_of(x, struct msm_framebuffer, base) =20 static struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev, const struct drm_mode_fb_cmd2 *mode_cmd, struct drm_gem_object **bos); =20 +static int msm_framebuffer_dirtyfb(struct drm_framebuffer *fb, + struct drm_file *file_priv, unsigned int flags, + unsigned int color, struct drm_clip_rect *clips, + unsigned int num_clips) +{ + struct msm_framebuffer *msm_fb =3D to_msm_framebuffer(fb); + + /* If this fb is not used on any display requiring pixel data to be + * flushed, then skip dirtyfb + */ + if (refcount_read(&msm_fb->dirtyfb) =3D=3D 0) + return 0; + + return drm_atomic_helper_dirtyfb(fb, file_priv, flags, color, + clips, num_clips); +} + static const struct drm_framebuffer_funcs msm_framebuffer_funcs =3D { .create_handle =3D drm_gem_fb_create_handle, .destroy =3D drm_gem_fb_destroy, - .dirty =3D drm_atomic_helper_dirtyfb, + .dirty =3D msm_framebuffer_dirtyfb, }; =20 #ifdef CONFIG_DEBUG_FS @@ -48,17 +68,19 @@ void msm_framebuffer_describe(struct drm_framebuffer *f= b, struct seq_file *m) } #endif =20 -/* prepare/pin all the fb's bo's for scanout. Note that it is not valid - * to prepare an fb more multiple different initiator 'id's. But that - * should be fine, since only the scanout (mdpN) side of things needs - * this, the gpu doesn't care about fb's. +/* prepare/pin all the fb's bo's for scanout. */ int msm_framebuffer_prepare(struct drm_framebuffer *fb, - struct msm_gem_address_space *aspace) + struct msm_gem_address_space *aspace, + bool needs_dirtyfb) { + struct msm_framebuffer *msm_fb =3D to_msm_framebuffer(fb); int ret, i, n =3D fb->format->num_planes; uint64_t iova; =20 + if (needs_dirtyfb) + refcount_inc(&msm_fb->dirtyfb); + for (i =3D 0; i < n; i++) { ret =3D msm_gem_get_and_pin_iova(fb->obj[i], aspace, &iova); drm_dbg_state(fb->dev, "FB[%u]: iova[%d]: %08llx (%d)", fb->base.id, i, = iova, ret); @@ -70,10 +92,15 @@ int msm_framebuffer_prepare(struct drm_framebuffer *fb, } =20 void msm_framebuffer_cleanup(struct drm_framebuffer *fb, - struct msm_gem_address_space *aspace) + struct msm_gem_address_space *aspace, + bool needed_dirtyfb) { + struct msm_framebuffer *msm_fb =3D to_msm_framebuffer(fb); int i, n =3D fb->format->num_planes; =20 + if (needed_dirtyfb) + refcount_dec(&msm_fb->dirtyfb); + for (i =3D 0; i < n; i++) msm_gem_unpin_iova(fb->obj[i], aspace); } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE8ACC00140 for ; Mon, 15 Aug 2022 18:59:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244839AbiHOS7S (ORCPT ); Mon, 15 Aug 2022 14:59:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244944AbiHOS4V (ORCPT ); Mon, 15 Aug 2022 14:56:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D09B53207D; Mon, 15 Aug 2022 11:30: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 790B4B8106E; Mon, 15 Aug 2022 18:30:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C78B1C433D7; Mon, 15 Aug 2022 18:30:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588249; bh=0r83TGpcAX7q/Cw7qOMQx30enfCYni4wKmfou4vNh/8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TklbjKTtiFP9nY/y7iygYB6QalvVeN94EDyPnf3sjd7eooFAUuMkCrTd3x343dudC cJChAegqi33PzwSGCaRlgc2DwdFuVcS/ZRn2wuaZ+chgPalnwqpWbujZORe7QMGLM9 VeSCUy564HfDG//dOHHuY567GDTKDwXj65NQV+PM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rob Clark , Dmitry Baryshkov , Abhinav Kumar , Sasha Levin Subject: [PATCH 5.15 325/779] drm/msm/dpu: Fix for non-visible planes Date: Mon, 15 Aug 2022 19:59:29 +0200 Message-Id: <20220815180351.184909912@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rob Clark [ Upstream commit cb77085b1f0a86ef9dfba86b5f3ed6c3340c2ea3 ] Fixes `kms_cursor_crc --run-subtest cursor-offscreen`.. when the cursor moves offscreen the plane becomes non-visible, so we need to skip over it in crtc atomic test and mixer setup. Signed-off-by: Rob Clark Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support") Reviewed-by: Dmitry Baryshkov Reviewed-by: Abhinav Kumar Patchwork: https://patchwork.freedesktop.org/patch/492819/ Link: https://lore.kernel.org/r/20220707212003.1710163-1-robdclark@gmail.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c b/drivers/gpu/drm/msm= /disp/dpu1/dpu_crtc.c index 7706a7106122..2186fc947e5b 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_crtc.c @@ -230,6 +230,9 @@ static void _dpu_crtc_blend_setup_mixer(struct drm_crtc= *crtc, if (!state) continue; =20 + if (!state->visible) + continue; + pstate =3D to_dpu_plane_state(state); fb =3D state->fb; =20 @@ -976,6 +979,9 @@ static int dpu_crtc_atomic_check(struct drm_crtc *crtc, if (cnt >=3D DPU_STAGE_MAX * 4) continue; =20 + if (!pstate->visible) + continue; + pstates[cnt].dpu_pstate =3D dpu_pstate; pstates[cnt].drm_pstate =3D pstate; pstates[cnt].stage =3D pstate->normalized_zpos; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3619EC00140 for ; Mon, 15 Aug 2022 19:00:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244611AbiHOTAH (ORCPT ); Mon, 15 Aug 2022 15:00:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245061AbiHOS4h (ORCPT ); Mon, 15 Aug 2022 14:56:37 -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 215202CC81; Mon, 15 Aug 2022 11:31:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 93D1ACE125C; Mon, 15 Aug 2022 18:31:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86F6BC433C1; Mon, 15 Aug 2022 18:31:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588284; bh=b7hS5d454oaulv4KcfZU56i0AKfffymxFdCbBxiLZoY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eU4IN1OcGYH02YASoYAXQwyUJekauG2bXCkWVNOesIEtGMNWogtmHrg9cC27h+kRS KpeKIzX9CqCcpSGJ6hPBwG4yHPAzbfiauHdLP5X682HfsdSBE7aSl6UpOtPtU/LZyK 0AXfJwPvRbG8NHJG4E8YXrtYsFo61slEmocHx3d0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gergo Koteles , Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 5.15 326/779] mt76: mt76x02u: fix possible memory leak in __mt76x02u_mcu_send_msg Date: Mon, 15 Aug 2022 19:59:30 +0200 Message-Id: <20220815180351.223926042@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lorenzo Bianconi [ Upstream commit cffd93411575afd987788e2ec3cb8eaff70f0215 ] Free the skb if mt76u_bulk_msg fails in __mt76x02u_mcu_send_msg routine. Fixes: 4c89ff2c74e39 ("mt76: split __mt76u_mcu_send_msg and mt76u_mcu_send_= msg routines") Co-developed-by: Gergo Koteles Signed-off-by: Gergo Koteles Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c b/drivers= /net/wireless/mediatek/mt76/mt76x02_usb_mcu.c index 2953df7d8388..c6c16fe8ee85 100644 --- a/drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt76x02_usb_mcu.c @@ -108,7 +108,7 @@ __mt76x02u_mcu_send_msg(struct mt76_dev *dev, struct sk= _buff *skb, ret =3D mt76u_bulk_msg(dev, skb->data, skb->len, NULL, 500, MT_EP_OUT_INBAND_CMD); if (ret) - return ret; + goto out; =20 if (wait_resp) ret =3D mt76x02u_mcu_wait_resp(dev, seq); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC34EC00140 for ; Mon, 15 Aug 2022 19:02:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244971AbiHOTAr (ORCPT ); Mon, 15 Aug 2022 15:00:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245094AbiHOS4k (ORCPT ); Mon, 15 Aug 2022 14:56: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 829EE326F0; Mon, 15 Aug 2022 11:31:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1F4FD61050; Mon, 15 Aug 2022 18:31:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AA82C433D6; Mon, 15 Aug 2022 18:31:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588296; bh=XRB3SSSa6lVv1vpESnbZZPaeZevVKXbJ/c1B4ApnyA0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BMW2jTvb2NJ3SJHD0+MeHlMphkWZAskmjEcEERcFlrOYAmHMteWytTBLB3tiTIPpi 860LmMX9uk0VFgbgxHDFtkDZ0ndHKbPstfCxhlctwtEzcEVjSdAEodjl8noQ9dTIC5 hvln6AUOlWAw9sO8Xc7NTFik9PwZ07iUzxXltNH4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lorenzo Bianconi , Felix Fietkau , Sasha Levin Subject: [PATCH 5.15 327/779] mt76: mt7615: do not update pm stats in case of error Date: Mon, 15 Aug 2022 19:59:31 +0200 Message-Id: <20220815180351.267315169@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lorenzo Bianconi [ Upstream commit 79717c4eeeae9dec894794fbe8af72f08f03ebdd ] Do not update pm stats if mt7615_mcu_fw_pmctrl returns an error. Fixes: abe912ae3cd42 ("mt76: mt7663: add awake and doze time accounting") Signed-off-by: Lorenzo Bianconi Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/wireless/mediatek/mt76/mt7615/mcu.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c b/drivers/net/= wireless/mediatek/mt76/mt7615/mcu.c index 4fed3afad67c..bde65af72fed 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mcu.c @@ -385,10 +385,11 @@ static int mt7615_mcu_fw_pmctrl(struct mt7615_dev *de= v) } =20 mt7622_trigger_hif_int(dev, false); - - pm->stats.last_doze_event =3D jiffies; - pm->stats.awake_time +=3D pm->stats.last_doze_event - - pm->stats.last_wake_event; + if (!err) { + pm->stats.last_doze_event =3D jiffies; + pm->stats.awake_time +=3D pm->stats.last_doze_event - + pm->stats.last_wake_event; + } out: mutex_unlock(&pm->mutex); =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7946C3F6B0 for ; Mon, 15 Aug 2022 19:02:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245024AbiHOTA6 (ORCPT ); Mon, 15 Aug 2022 15:00:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245117AbiHOS4s (ORCPT ); Mon, 15 Aug 2022 14:56:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E3BF32B8B; Mon, 15 Aug 2022 11:31: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 C8818B81084; Mon, 15 Aug 2022 18:31:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31CBDC43141; Mon, 15 Aug 2022 18:31:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588299; bh=VV8gink0WExPDdKn781lcIG6OPIv8hTyhv2dKHY8ToM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kaRNJ83agi5rLMCstyZ2Ccmc/pX7WUfoY0yN9sWrZwHYmTD4jk8zZF9G+PysKvUiW cjWsXe3clLscc3+e5X6uSE9Jg6EPjyiMs9WEE57/ZVlSnKkMNeIu0qud90elWigvDD wv3Uq6jL0/zz12LRTDVg9C9JEGD4UIiB7NKQyMWg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mordechay Goodstein , Johannes Berg , Sasha Levin Subject: [PATCH 5.15 328/779] ieee80211: add EHT 1K aggregation definitions Date: Mon, 15 Aug 2022 19:59:32 +0200 Message-Id: <20220815180351.314176311@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mordechay Goodstein [ Upstream commit 2a2c86f15e17c5013b9897b67d895e64a25ae3cb ] We add the fields for parsing extended ADDBA request/respond, and new max 1K aggregation for limit ADDBA request/respond. Adjust drivers to use the proper macro, IEEE80211_MAX_AMPDU_BUF -> IEEE80211_MAX_AMPDU_BUF_HE. Signed-off-by: Mordechay Goodstein Link: https://lore.kernel.org/r/20220214173004.b8b447ce95b7.I0ee2554c94e89a= bc7a752b0f7cc7fd79c273efea@changeid Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/wireless/ath/ath11k/mac.c | 2 +- drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 4 ++-- drivers/net/wireless/mediatek/mt76/mt7915/init.c | 4 ++-- include/linux/ieee80211.h | 6 +++++- net/mac80211/agg-rx.c | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/mac.c b/drivers/net/wireless/a= th/ath11k/mac.c index f85fd341557e..c7ee373a9d2c 100644 --- a/drivers/net/wireless/ath/ath11k/mac.c +++ b/drivers/net/wireless/ath/ath11k/mac.c @@ -6566,7 +6566,7 @@ static int __ath11k_mac_register(struct ath11k *ar) ar->hw->queues =3D ATH11K_HW_MAX_QUEUES; ar->hw->wiphy->tx_queue_len =3D ATH11K_QUEUE_LEN; ar->hw->offchannel_tx_hw_queue =3D ATH11K_HW_MAX_QUEUES - 1; - ar->hw->max_rx_aggregation_subframes =3D IEEE80211_MAX_AMPDU_BUF; + ar->hw->max_rx_aggregation_subframes =3D IEEE80211_MAX_AMPDU_BUF_HE; =20 ar->hw->vif_data_size =3D sizeof(struct ath11k_vif); ar->hw->sta_data_size =3D sizeof(struct ath11k_sta); diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wir= eless/intel/iwlwifi/mvm/ops.c index c77d98c88811..eeb81808db08 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c @@ -761,12 +761,12 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const = struct iwl_cfg *cfg, if (!hw) return NULL; =20 - hw->max_rx_aggregation_subframes =3D IEEE80211_MAX_AMPDU_BUF; + hw->max_rx_aggregation_subframes =3D IEEE80211_MAX_AMPDU_BUF_HE; =20 if (cfg->max_tx_agg_size) hw->max_tx_aggregation_subframes =3D cfg->max_tx_agg_size; else - hw->max_tx_aggregation_subframes =3D IEEE80211_MAX_AMPDU_BUF; + hw->max_tx_aggregation_subframes =3D IEEE80211_MAX_AMPDU_BUF_HE; =20 op_mode =3D hw->priv; =20 diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/init.c b/drivers/net= /wireless/mediatek/mt76/mt7915/init.c index b171027e0cfa..1ae42ef147c8 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/init.c @@ -217,8 +217,8 @@ mt7915_init_wiphy(struct ieee80211_hw *hw) struct wiphy *wiphy =3D hw->wiphy; =20 hw->queues =3D 4; - hw->max_rx_aggregation_subframes =3D IEEE80211_MAX_AMPDU_BUF; - hw->max_tx_aggregation_subframes =3D IEEE80211_MAX_AMPDU_BUF; + hw->max_rx_aggregation_subframes =3D IEEE80211_MAX_AMPDU_BUF_HE; + hw->max_tx_aggregation_subframes =3D IEEE80211_MAX_AMPDU_BUF_HE; hw->netdev_features =3D NETIF_F_RXCSUM; =20 hw->radiotap_timestamp.units_pos =3D diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index 694264503119..00ed7c17698d 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h @@ -1023,6 +1023,8 @@ struct ieee80211_tpc_report_ie { #define IEEE80211_ADDBA_EXT_FRAG_LEVEL_MASK GENMASK(2, 1) #define IEEE80211_ADDBA_EXT_FRAG_LEVEL_SHIFT 1 #define IEEE80211_ADDBA_EXT_NO_FRAG BIT(0) +#define IEEE80211_ADDBA_EXT_BUF_SIZE_MASK GENMASK(7, 5) +#define IEEE80211_ADDBA_EXT_BUF_SIZE_SHIFT 10 =20 struct ieee80211_addba_ext_ie { u8 data; @@ -1697,10 +1699,12 @@ struct ieee80211_ht_operation { * A-MPDU buffer sizes * According to HT size varies from 8 to 64 frames * HE adds the ability to have up to 256 frames. + * EHT adds the ability to have up to 1K frames. */ #define IEEE80211_MIN_AMPDU_BUF 0x8 #define IEEE80211_MAX_AMPDU_BUF_HT 0x40 -#define IEEE80211_MAX_AMPDU_BUF 0x100 +#define IEEE80211_MAX_AMPDU_BUF_HE 0x100 +#define IEEE80211_MAX_AMPDU_BUF_EHT 0x400 =20 =20 /* Spatial Multiplexing Power Save Modes (for capability) */ diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c index ef729b1e39ea..e43176794149 100644 --- a/net/mac80211/agg-rx.c +++ b/net/mac80211/agg-rx.c @@ -310,7 +310,7 @@ void ___ieee80211_start_rx_ba_session(struct sta_info *= sta, } =20 if (sta->sta.he_cap.has_he) - max_buf_size =3D IEEE80211_MAX_AMPDU_BUF; + max_buf_size =3D IEEE80211_MAX_AMPDU_BUF_HE; else max_buf_size =3D IEEE80211_MAX_AMPDU_BUF_HT; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24429C28B2C for ; Mon, 15 Aug 2022 19:02:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245183AbiHOTBa (ORCPT ); Mon, 15 Aug 2022 15:01:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245123AbiHOS4t (ORCPT ); Mon, 15 Aug 2022 14:56:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 723B932B80; Mon, 15 Aug 2022 11:31: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 2F0DAB81074; Mon, 15 Aug 2022 18:31:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F33AC433C1; Mon, 15 Aug 2022 18:31:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588303; bh=wyiVrrGdycrYaIwarSvQnWljLCRKuXVgDXQDnpxxn+s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LNlYtFzA5tAhb/VtnpGNUPORWT49hn/H0XvCOIM0CthSBTmSseWay/PNqZ4+M5+4i l8iGIwpWP2V3BVqpNUAaqRBLDclDHakecbxinq2+ZG/JhYMLFZ9/NaJrZlA4rQV3sI SahnO6WxjYOgCTX3TrE1tRhq4tAbBqSG4LVt0ovE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Yen Hsieh , Sean Wang , Deren Wu , Felix Fietkau , Sasha Levin Subject: [PATCH 5.15 329/779] mt76: mt7921: fix aggregation subframes setting to HE max Date: Mon, 15 Aug 2022 19:59:33 +0200 Message-Id: <20220815180351.353510538@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Deren Wu [ Upstream commit d5a50e6bd1972c481f82befa846dce0b9866f025 ] mt7921/mt7922 support HE max aggregation subframes 256 for both tx/rx. Get better throughput then before. Fixes: 94bb18b03d43 ("mt76: mt7921: fix max aggregation subframes setting") Tested-by: Ming Yen Hsieh Reviewed-by: Sean Wang Signed-off-by: Deren Wu Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/wireless/mediatek/mt76/mt7921/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net= /wireless/mediatek/mt76/mt7921/init.c index 78a00028137b..a8998e6bfb6f 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c @@ -49,8 +49,8 @@ mt7921_init_wiphy(struct ieee80211_hw *hw) struct wiphy *wiphy =3D hw->wiphy; =20 hw->queues =3D 4; - hw->max_rx_aggregation_subframes =3D 64; - hw->max_tx_aggregation_subframes =3D 128; + hw->max_rx_aggregation_subframes =3D IEEE80211_MAX_AMPDU_BUF_HE; + hw->max_tx_aggregation_subframes =3D IEEE80211_MAX_AMPDU_BUF_HE; hw->netdev_features =3D NETIF_F_RXCSUM; =20 hw->radiotap_timestamp.units_pos =3D --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7B95C25B08 for ; Mon, 15 Aug 2022 19:02:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245063AbiHOTBG (ORCPT ); Mon, 15 Aug 2022 15:01:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245124AbiHOS4t (ORCPT ); Mon, 15 Aug 2022 14:56:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AE0432BA1; Mon, 15 Aug 2022 11:31:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A1A6160F7A; Mon, 15 Aug 2022 18:31:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1D1EC433D7; Mon, 15 Aug 2022 18:31:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588306; bh=TJX1OypiKOTJzTAK+LPMVpM8lfOZsNWrL6SA6rnT1x8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0TJg91EqMDytPLBMWzVsqXU3LVcVmlb6fyo1su+DQkdXyE1sl6tIlPyagSB6xxGw7 ckdsvjVKnh5tx0Azrfr/cW/Q8nXOAhV4tunzSfJUxSLZzIhvbUrkeSkLThLUskb6yO AW704UruKBxLOuWBns29cw5enC+HNutydbmA6lkw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ming Yen Hsieh , Deren Wu , Felix Fietkau , Sasha Levin Subject: [PATCH 5.15 330/779] mt76: mt7921: enlarge maximum VHT MPDU length to 11454 Date: Mon, 15 Aug 2022 19:59:34 +0200 Message-Id: <20220815180351.395809915@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Deren Wu [ Upstream commit 31f3248a75932b111bc90c66b1f6c7d89eedca8e ] Enlarge maximum MPDU length to 11454 that both mt7921/mt7922 can support. After this fixing, we can get better performance. Fixes: 5c14a5f944b9 ("mt76: mt7921: introduce mt7921e support") Tested-by: Ming Yen Hsieh Signed-off-by: Deren Wu Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/wireless/mediatek/mt76/mt7921/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7921/init.c b/drivers/net= /wireless/mediatek/mt76/mt7921/init.c index a8998e6bfb6f..c059cb419efd 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7921/init.c +++ b/drivers/net/wireless/mediatek/mt76/mt7921/init.c @@ -219,7 +219,7 @@ int mt7921_register_device(struct mt7921_dev *dev) IEEE80211_HT_CAP_LDPC_CODING | IEEE80211_HT_CAP_MAX_AMSDU; dev->mphy.sband_5g.sband.vht_cap.cap |=3D - IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 | + IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 | IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK | IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE | IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE | --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D75D7C282E7 for ; Mon, 15 Aug 2022 19:02:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245144AbiHOTBV (ORCPT ); Mon, 15 Aug 2022 15:01:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245135AbiHOS4t (ORCPT ); Mon, 15 Aug 2022 14:56:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2557D32D83; Mon, 15 Aug 2022 11:31: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 B610060EEB; Mon, 15 Aug 2022 18:31:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9DD3C433C1; Mon, 15 Aug 2022 18:31:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588309; bh=lXmSoEFvjXAkURKNKmyiZ+4nCTy+7MrPzpLlojqoji4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dQINk7EnmIyBP4JCnkvhvFRPq8DVY3qvhxNVBtr6H0oMIhHa2rzaWdxLCJLGWE0p2 8GPegJdsAT5sAux8dFwEUPJw75/lqpqVLfboNdOOUX+eU3Dg4RIigBIhvI7Z+7p5H/ G28SCm6MVXhvTIX3InxfLS6Sy+g4NBVReaR/uMRQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Felix Fietkau , Sasha Levin Subject: [PATCH 5.15 331/779] mediatek: mt76: mac80211: Fix missing of_node_put() in mt76_led_init() Date: Mon, 15 Aug 2022 19:59:35 +0200 Message-Id: <20220815180351.441197342@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 0a14c1d0113f121151edf34333cdf212dd209190 ] We should use of_node_put() for the reference 'np' returned by of_get_child_by_name() which will increase the refcount. Fixes: 17f1de56df05 ("mt76: add common code shared between multiple chipset= s") Signed-off-by: Liang He Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/wireless/mediatek/mt76/mac80211.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c b/drivers/net/wi= reless/mediatek/mt76/mac80211.c index 029599d68ca7..028519a739fd 100644 --- a/drivers/net/wireless/mediatek/mt76/mac80211.c +++ b/drivers/net/wireless/mediatek/mt76/mac80211.c @@ -123,6 +123,7 @@ static int mt76_led_init(struct mt76_dev *dev) if (!of_property_read_u32(np, "led-sources", &led_pin)) dev->led_pin =3D led_pin; dev->led_al =3D of_property_read_bool(np, "led-active-low"); + of_node_put(np); } =20 return led_classdev_register(dev->dev, &dev->led_cdev); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93927C00140 for ; Mon, 15 Aug 2022 19:02:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245233AbiHOTBj (ORCPT ); Mon, 15 Aug 2022 15:01:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245157AbiHOS4w (ORCPT ); Mon, 15 Aug 2022 14:56:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C89B32DBB; Mon, 15 Aug 2022 11:31:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CECF3B81082; Mon, 15 Aug 2022 18:31:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 053A9C433C1; Mon, 15 Aug 2022 18:31:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588312; bh=UNse/8MvXDfLtiLsFDhl/AJsP8hoheWPNg98s6jZGdA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=abxF6zHlVgj2Md8Kd/Jk2TmmxKYxhaFPe169wY3AgtaA+Cj8w9/HeIFbww7dItNE6 KdcJrr3wikOzN2LLWxWIGxnLWETJP4XWiHHEF6F+H6u/oTYKIGlMr/Re2DglE0r2u3 5Lv1df24yXD/r8nYaNS3fwiRxDuDG0PlKmfXLBJQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Felix Fietkau , Sasha Levin Subject: [PATCH 5.15 332/779] mediatek: mt76: eeprom: fix missing of_node_put() in mt76_find_power_limits_node() Date: Mon, 15 Aug 2022 19:59:36 +0200 Message-Id: <20220815180351.473557798@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 3bd53ea02d77917c2314ec7be9e2d05be22f87d3 ] We should use of_node_put() for the reference 'np' returned by of_get_child_by_name() which will increase the refcount. Fixes: 22b980badc0f ("mt76: add functions for parsing rate power limits fro= m DT") Signed-off-by: Liang He Signed-off-by: Felix Fietkau Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/wireless/mediatek/mt76/eeprom.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/mediatek/mt76/eeprom.c b/drivers/net/wire= less/mediatek/mt76/eeprom.c index 3b47e85e95e7..db0cd56c8dc7 100644 --- a/drivers/net/wireless/mediatek/mt76/eeprom.c +++ b/drivers/net/wireless/mediatek/mt76/eeprom.c @@ -146,10 +146,13 @@ mt76_find_power_limits_node(struct mt76_dev *dev) } =20 if (mt76_string_prop_find(country, dev->alpha2) || - mt76_string_prop_find(regd, region_name)) + mt76_string_prop_find(regd, region_name)) { + of_node_put(np); return cur; + } } =20 + of_node_put(np); return fallback; } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB78CC25B0E for ; Mon, 15 Aug 2022 18:58:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244701AbiHOS6e (ORCPT ); Mon, 15 Aug 2022 14:58:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244798AbiHOSzw (ORCPT ); Mon, 15 Aug 2022 14:55:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6942B2DF2; Mon, 15 Aug 2022 11:30:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id ED9E1B8106C; Mon, 15 Aug 2022 18:30:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BDF0C433C1; Mon, 15 Aug 2022 18:30:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588219; bh=9gl4kRdQ+WLKKQ5khPH9o29OL7Te4TCVWT384FGVGKk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YFvrVIyHedvj8BPGtTk2kG0HtAiSii/3i8n+6P0lX3t7dNoGUVqdCCNttjNMJu14X FgLTXNZkZ4x9Cdyv2oGMloxSmiljjhNp2w2c2BwmGwpdAQekpAzBLHjYhoyrtuPjBn 7cHC9q1zhqZ0ooJZQ3VPrNXz5CMpqzJJXMnVuA20= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liu Jian , Daniel Borkmann , John Fastabend , Sasha Levin Subject: [PATCH 5.15 333/779] skmsg: Fix invalid last sg check in sk_msg_recvmsg() Date: Mon, 15 Aug 2022 19:59:37 +0200 Message-Id: <20220815180351.507977711@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Jian [ Upstream commit 9974d37ea75f01b47d16072b5dad305bd8d23fcc ] In sk_psock_skb_ingress_enqueue function, if the linear area + nr_frags + frag_list of the SKB has NR_MSG_FRAG_IDS blocks in total, skb_to_sgvec will return NR_MSG_FRAG_IDS, then msg->sg.end will be set to NR_MSG_FRAG_IDS, and in addition, (NR_MSG_FRAG_IDS - 1) is set to the last SG of msg. Recv the msg in sk_msg_recvmsg, when i is (NR_MSG_FRAG_IDS - 1), the sk_msg_iter_var_next(i) will change i to 0 (not NR_MSG_FRAG_IDS), the judgment condition "msg_rx->sg.start=3D=3Dmsg_rx->sg.end" and "i !=3D msg_rx->sg.end" can not work. As a result, the processed msg cannot be deleted from ingress_msg list. But the length of all the sge of the msg has changed to 0. Then the next recvmsg syscall will process the msg repeatedly, because the length of sge is 0, the -EFAULT error is always returned. Fixes: 604326b41a6f ("bpf, sockmap: convert to generic sk_msg interface") Signed-off-by: Liu Jian Signed-off-by: Daniel Borkmann Acked-by: John Fastabend Link: https://lore.kernel.org/bpf/20220628123616.186950-1-liujian56@huawei.= com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- net/core/skmsg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/core/skmsg.c b/net/core/skmsg.c index ede0af308f40..f50f8d95b628 100644 --- a/net/core/skmsg.c +++ b/net/core/skmsg.c @@ -462,7 +462,7 @@ int sk_msg_recvmsg(struct sock *sk, struct sk_psock *ps= ock, struct msghdr *msg, =20 if (copied =3D=3D len) break; - } while (i !=3D msg_rx->sg.end); + } while (!sg_is_last(sge)); =20 if (unlikely(peek)) { msg_rx =3D sk_psock_next_msg(psock, msg_rx); @@ -472,7 +472,7 @@ int sk_msg_recvmsg(struct sock *sk, struct sk_psock *ps= ock, struct msghdr *msg, } =20 msg_rx->sg.start =3D i; - if (!sge->length && msg_rx->sg.start =3D=3D msg_rx->sg.end) { + if (!sge->length && sg_is_last(sge)) { msg_rx =3D sk_psock_dequeue_msg(psock); kfree_sk_msg(msg_rx); } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D04EC00140 for ; Mon, 15 Aug 2022 19:03:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245051AbiHOTDK (ORCPT ); Mon, 15 Aug 2022 15:03:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244799AbiHOSzw (ORCPT ); Mon, 15 Aug 2022 14:55:52 -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 0BB5360E4; Mon, 15 Aug 2022 11:30: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 AE77DB81072; Mon, 15 Aug 2022 18:30:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A891C433C1; Mon, 15 Aug 2022 18:30:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588222; bh=9ccLgAqjt7Dl6BlclVAuiLC/sPv9m41xvtN4WQdTUaE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MDNIg/So9yXThpB3PtlY9z1XpPqqe04Z77yIed8MYXO8Y2WU7E8d/8EYnQsyjfkpu hqkfvYFAqVI7tMy1MKPcfuXzmASPC/PPAFPb0C7GYWBsY35lZg/hU0hrh3oaAENb4D RmOYOJ+5jeC8OcTU7xidFQnR+r0n5E7NP/jFefrY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Jian Zhang , Inki Dae , Sasha Levin Subject: [PATCH 5.15 334/779] drm/exynos/exynos7_drm_decon: free resources when clk_set_parent() failed. Date: Mon, 15 Aug 2022 19:59:38 +0200 Message-Id: <20220815180351.545883472@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jian Zhang [ Upstream commit 48b927770f8ad3f8cf4a024a552abf272af9f592 ] In exynos7_decon_resume, When it fails, we must use clk_disable_unprepare() to free resource that have been used. Fixes: 6f83d20838c09 ("drm/exynos: use DRM_DEV_ERROR to print out error message") Reported-by: Hulk Robot Signed-off-by: Jian Zhang Signed-off-by: Inki Dae Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/exynos/exynos7_drm_decon.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/e= xynos/exynos7_drm_decon.c index 12571ac45540..12989a47eb66 100644 --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c @@ -806,31 +806,40 @@ static int exynos7_decon_resume(struct device *dev) if (ret < 0) { DRM_DEV_ERROR(dev, "Failed to prepare_enable the pclk [%d]\n", ret); - return ret; + goto err_pclk_enable; } =20 ret =3D clk_prepare_enable(ctx->aclk); if (ret < 0) { DRM_DEV_ERROR(dev, "Failed to prepare_enable the aclk [%d]\n", ret); - return ret; + goto err_aclk_enable; } =20 ret =3D clk_prepare_enable(ctx->eclk); if (ret < 0) { DRM_DEV_ERROR(dev, "Failed to prepare_enable the eclk [%d]\n", ret); - return ret; + goto err_eclk_enable; } =20 ret =3D clk_prepare_enable(ctx->vclk); if (ret < 0) { DRM_DEV_ERROR(dev, "Failed to prepare_enable the vclk [%d]\n", ret); - return ret; + goto err_vclk_enable; } =20 return 0; + +err_vclk_enable: + clk_disable_unprepare(ctx->eclk); +err_eclk_enable: + clk_disable_unprepare(ctx->aclk); +err_aclk_enable: + clk_disable_unprepare(ctx->pclk); +err_pclk_enable: + return ret; } #endif =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08E55C00140 for ; Mon, 15 Aug 2022 18:58:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231719AbiHOS6l (ORCPT ); Mon, 15 Aug 2022 14:58:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244827AbiHOSz4 (ORCPT ); Mon, 15 Aug 2022 14:55: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 4B4136433; Mon, 15 Aug 2022 11:30:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B5E80B81084; Mon, 15 Aug 2022 18:30:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0499EC433B5; Mon, 15 Aug 2022 18:30:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588225; bh=fLuLv2yh8AGC1FfcjmtGnEvVzIHF2InizORL1tbTmdo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XGQbqhaUACn34iY65BvZJKteGJeUIcKIdBNVyl/1iRVhO0VTVNtYTpz9VGHrIuBwh D5XZElQJppBXoFz1ltsJSpHGEZzPp/J7pfnE63BZoox2QfwKcWUivZaSo0UliRyivp Lu61pVPnTEJyEbbjYjyRHDP00rQxiuSoTKE6o4A4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yonglong Li , Eric Dumazet , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 335/779] tcp: make retransmitted SKB fit into the send window Date: Mon, 15 Aug 2022 19:59:39 +0200 Message-Id: <20220815180351.597849976@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yonglong Li [ Upstream commit 536a6c8e05f95e3d1118c40ae8b3022ee2d05d52 ] current code of __tcp_retransmit_skb only check TCP_SKB_CB(skb)->seq in send window, and TCP_SKB_CB(skb)->seq_end maybe out of send window. If receiver has shrunk his window, and skb is out of new window, it should retransmit a smaller portion of the payload. test packetdrill script: 0 socket(..., SOCK_STREAM, IPPROTO_TCP) =3D 3 +0 fcntl(3, F_GETFL) =3D 0x2 (flags O_RDWR) +0 fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) =3D 0 +0 connect(3, ..., ...) =3D -1 EINPROGRESS (Operation now in progress) +0 > S 0:0(0) win 65535 +.05 < S. 0:0(0) ack 1 win 6000 +0 > . 1:1(0) ack 1 +0 write(3, ..., 10000) =3D 10000 +0 > . 1:2001(2000) ack 1 win 65535 +0 > . 2001:4001(2000) ack 1 win 65535 +0 > . 4001:6001(2000) ack 1 win 65535 +.05 < . 1:1(0) ack 4001 win 1001 and tcpdump show: 192.168.226.67.55 > 192.0.2.1.8080: Flags [.], seq 1:2001, ack 1, win 65535= , length 2000 192.168.226.67.55 > 192.0.2.1.8080: Flags [.], seq 2001:4001, ack 1, win 65= 535, length 2000 192.168.226.67.55 > 192.0.2.1.8080: Flags [P.], seq 4001:5001, ack 1, win 6= 5535, length 1000 192.168.226.67.55 > 192.0.2.1.8080: Flags [.], seq 5001:6001, ack 1, win 65= 535, length 1000 192.0.2.1.8080 > 192.168.226.67.55: Flags [.], ack 4001, win 1001, length 0 192.168.226.67.55 > 192.0.2.1.8080: Flags [.], seq 5001:6001, ack 1, win 65= 535, length 1000 192.168.226.67.55 > 192.0.2.1.8080: Flags [P.], seq 4001:5001, ack 1, win 6= 5535, length 1000 when cient retract window to 1001, send window is [4001,5002], but TLP send 5001-6001 packet which is out of send window. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Yonglong Li Signed-off-by: Eric Dumazet Link: https://lore.kernel.org/r/1657532838-20200-1-git-send-email-liyonglon= g@chinatelecom.cn Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- net/ipv4/tcp_output.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 9c9a0f7a3dee..24cadcdb9890 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -3145,7 +3145,7 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk_b= uff *skb, int segs) struct tcp_sock *tp =3D tcp_sk(sk); unsigned int cur_mss; int diff, len, err; - + int avail_wnd; =20 /* Inconclusive MTU probe */ if (icsk->icsk_mtup.probe_size) @@ -3167,17 +3167,25 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk= _buff *skb, int segs) return -EHOSTUNREACH; /* Routing failure or similar. */ =20 cur_mss =3D tcp_current_mss(sk); + avail_wnd =3D tcp_wnd_end(tp) - TCP_SKB_CB(skb)->seq; =20 /* If receiver has shrunk his window, and skb is out of * new window, do not retransmit it. The exception is the * case, when window is shrunk to zero. In this case - * our retransmit serves as a zero window probe. + * our retransmit of one segment serves as a zero window probe. */ - if (!before(TCP_SKB_CB(skb)->seq, tcp_wnd_end(tp)) && - TCP_SKB_CB(skb)->seq !=3D tp->snd_una) - return -EAGAIN; + if (avail_wnd <=3D 0) { + if (TCP_SKB_CB(skb)->seq !=3D tp->snd_una) + return -EAGAIN; + avail_wnd =3D cur_mss; + } =20 len =3D cur_mss * segs; + if (len > avail_wnd) { + len =3D rounddown(avail_wnd, cur_mss); + if (!len) + len =3D avail_wnd; + } if (skb->len > len) { if (tcp_fragment(sk, TCP_FRAG_IN_RTX_QUEUE, skb, len, cur_mss, GFP_ATOMIC)) @@ -3191,8 +3199,9 @@ int __tcp_retransmit_skb(struct sock *sk, struct sk_b= uff *skb, int segs) diff -=3D tcp_skb_pcount(skb); if (diff) tcp_adjust_pcount(sk, skb, diff); - if (skb->len < cur_mss) - tcp_retrans_try_collapse(sk, skb, cur_mss); + avail_wnd =3D min_t(int, avail_wnd, cur_mss); + if (skb->len < avail_wnd) + tcp_retrans_try_collapse(sk, skb, avail_wnd); } =20 /* RFC3168, section 6.1.1.1. ECN fallback */ --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29CE0C00140 for ; Mon, 15 Aug 2022 19:03:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245076AbiHOTDR (ORCPT ); Mon, 15 Aug 2022 15:03:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244844AbiHOSz6 (ORCPT ); Mon, 15 Aug 2022 14:55: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 5E1C39FE1; Mon, 15 Aug 2022 11:30:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E0CBEB81082; Mon, 15 Aug 2022 18:30:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 124E1C433C1; Mon, 15 Aug 2022 18:30:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588228; bh=KkHREOusnFK0praXr7IyTVls1fNCqrScOy5EFJVCbVg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FFPOO9r5vdT6UExl1hU1fq7Bl6oAS7Thk9DQgkEpUV21WFbvq12dfSIqC2610ACcT WVfV1LtjtIlGScJsKsGoz1ahcLVUsQ6UOSAbb+CO/cnbmFgHy+U7b5+QjuHd95TwwQ E4KFvH50mdrBe3QGRMxlCHfbAyVLBO19hA2sV/20= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anquan Wu , Andrii Nakryiko , Sasha Levin Subject: [PATCH 5.15 336/779] libbpf: Fix the name of a reused map Date: Mon, 15 Aug 2022 19:59:40 +0200 Message-Id: <20220815180351.640658608@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Anquan Wu [ Upstream commit bf3f00378524adae16628cbadbd11ba7211863bb ] BPF map name is limited to BPF_OBJ_NAME_LEN. A map name is defined as being longer than BPF_OBJ_NAME_LEN, it will be truncated to BPF_OBJ_NAME_LEN when a userspace program calls libbpf to create the map. A pinned map also generates a path in the /sys. If the previous program wanted to reuse the map=EF=BC=8C it can not get bpf_map by name, because the name of the map is only partially the same as the name which get from pinned path. The syscall information below show that map name "process_pinned_map" is truncated to "process_pinned_". bpf(BPF_OBJ_GET, {pathname=3D"/sys/fs/bpf/process_pinned_map", bpf_fd=3D0, file_flags=3D0}, 144) =3D -1 ENOENT (No such file or direct= ory) bpf(BPF_MAP_CREATE, {map_type=3DBPF_MAP_TYPE_HASH, key_size=3D4, value_size=3D4,max_entries=3D1024, map_flags=3D0, inner_map_fd=3D0, map_name=3D"process_pinned_",map_ifindex=3D0, btf_fd=3D3, btf_key_type_= id=3D6, btf_value_type_id=3D10,btf_vmlinux_value_type_id=3D0}, 72) =3D 4 This patch check that if the name of pinned map are the same as the actual name for the first (BPF_OBJ_NAME_LEN - 1), bpf map still uses the name which is included in bpf object. Fixes: 26736eb9a483 ("tools: libbpf: allow map reuse") Signed-off-by: Anquan Wu Signed-off-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/OSZP286MB1725CEA1C95C5CB8E7CCC53FB8869@OS= ZP286MB1725.JPNP286.PROD.OUTLOOK.COM Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- tools/lib/bpf/libbpf.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 1ba2dd3523f8..050622649797 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -3942,7 +3942,7 @@ static int bpf_get_map_info_from_fdinfo(int fd, struc= t bpf_map_info *info) int bpf_map__reuse_fd(struct bpf_map *map, int fd) { struct bpf_map_info info =3D {}; - __u32 len =3D sizeof(info); + __u32 len =3D sizeof(info), name_len; int new_fd, err; char *new_name; =20 @@ -3952,7 +3952,12 @@ int bpf_map__reuse_fd(struct bpf_map *map, int fd) if (err) return libbpf_err(err); =20 - new_name =3D strdup(info.name); + name_len =3D strlen(info.name); + if (name_len =3D=3D BPF_OBJ_NAME_LEN - 1 && strncmp(map->name, info.name,= name_len) =3D=3D 0) + new_name =3D strdup(map->name); + else + new_name =3D strdup(info.name); + if (!new_name) return libbpf_err(-errno); =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5880CC00140 for ; Mon, 15 Aug 2022 18:58:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244764AbiHOS6u (ORCPT ); Mon, 15 Aug 2022 14:58:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244856AbiHOS4A (ORCPT ); Mon, 15 Aug 2022 14:56: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 99002AE60; Mon, 15 Aug 2022 11:30:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1A1D9606A1; Mon, 15 Aug 2022 18:30:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 189A2C433C1; Mon, 15 Aug 2022 18:30:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588231; bh=791j+2hWy8TOd/D1gDSC01GR07M5nk56qoSUdhg5FAU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qJ94i9N6/HbiEnGL5wnEF5KiWa93n+vcu3+TPCfhLY4xf41YdfZoTXlEvQ+dhil+k x+Eg+eYZfF9raZZyxY07aHMdsnXKUwnrGvoA48qzlxuWTtpprWSHuXS0usoHJGh1z7 nzAoTF4m2a3HWRBSMGBBK4nvfWGJ6zn5RAXs38Jc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wolfram Sang , John Stultz , Shuah Khan , Sasha Levin Subject: [PATCH 5.15 337/779] selftests: timers: valid-adjtimex: build fix for newer toolchains Date: Mon, 15 Aug 2022 19:59:41 +0200 Message-Id: <20220815180351.675607587@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wolfram Sang [ Upstream commit 9a162977d20436be5678a8e21a8e58eb4616d86a ] Toolchains with an include file 'sys/timex.h' based on 3.18 will have a 'clock_adjtime' definition added, so it can't be static in the code: valid-adjtimex.c:43:12: error: static declaration of =E2=80=98clock_adjtime= =E2=80=99 follows non-static declaration Fixes: e03a58c320e1 ("kselftests: timers: Add adjtimex SETOFFSET validity t= ests") Signed-off-by: Wolfram Sang Acked-by: John Stultz Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- tools/testing/selftests/timers/valid-adjtimex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/timers/valid-adjtimex.c b/tools/testin= g/selftests/timers/valid-adjtimex.c index 5397de708d3c..48b9a803235a 100644 --- a/tools/testing/selftests/timers/valid-adjtimex.c +++ b/tools/testing/selftests/timers/valid-adjtimex.c @@ -40,7 +40,7 @@ #define ADJ_SETOFFSET 0x0100 =20 #include -static int clock_adjtime(clockid_t id, struct timex *tx) +int clock_adjtime(clockid_t id, struct timex *tx) { return syscall(__NR_clock_adjtime, id, tx); } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C51A9C00140 for ; Mon, 15 Aug 2022 18:59:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244813AbiHOS7H (ORCPT ); Mon, 15 Aug 2022 14:59:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244894AbiHOS4N (ORCPT ); Mon, 15 Aug 2022 14:56:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF5EC175AD; Mon, 15 Aug 2022 11:30: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 DF996B8106E; Mon, 15 Aug 2022 18:30:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1BD51C433C1; Mon, 15 Aug 2022 18:30:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588234; bh=wuOSQasS4O7g9t9kdiLWCgRp6fK3GbiBlpL7zqz9SuQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HyP5tqYfmQfmu5t4irsYSV7a5oqjMMvNjVQMPO9pxydkS4hB5cvrmMVNJg7AfR/Au ppE490xdWP2GMDhJYUDqar/5MRwqZwoedwOe1qkRXzo6wXvjz8JLOYZriSPdA/+mu2 OUMLSpmXAx2ypCN4AsWgsCTT8kvhyXDzmphwxVtY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wolfram Sang , John Stultz , Shuah Khan , Sasha Levin Subject: [PATCH 5.15 338/779] selftests: timers: clocksource-switch: fix passing errors from child Date: Mon, 15 Aug 2022 19:59:42 +0200 Message-Id: <20220815180351.724522140@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wolfram Sang [ Upstream commit 4d8f52ac5fa9eede7b7aa2f2d67c841d9eeb655f ] The return value from system() is a waitpid-style integer. Do not return it directly because with the implicit masking in exit() it will always return 0. Access it with appropriate macros to really pass on errors. Fixes: 7290ce1423c3 ("selftests/timers: Add clocksource-switch test from ti= metest suite") Signed-off-by: Wolfram Sang Acked-by: John Stultz Signed-off-by: Shuah Khan Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- tools/testing/selftests/timers/clocksource-switch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/timers/clocksource-switch.c b/tools/te= sting/selftests/timers/clocksource-switch.c index ef8eb3604595..b57f0a9be490 100644 --- a/tools/testing/selftests/timers/clocksource-switch.c +++ b/tools/testing/selftests/timers/clocksource-switch.c @@ -110,10 +110,10 @@ int run_tests(int secs) =20 sprintf(buf, "./inconsistency-check -t %i", secs); ret =3D system(buf); - if (ret) - return ret; + if (WIFEXITED(ret) && WEXITSTATUS(ret)) + return WEXITSTATUS(ret); ret =3D system("./nanosleep"); - return ret; + return WIFEXITED(ret) ? WEXITSTATUS(ret) : 0; } =20 =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E516AC00140 for ; Mon, 15 Aug 2022 18:59:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244797AbiHOS67 (ORCPT ); Mon, 15 Aug 2022 14:58:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244896AbiHOS4N (ORCPT ); Mon, 15 Aug 2022 14:56: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 E13692A73D; Mon, 15 Aug 2022 11:30:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 392B260F9F; Mon, 15 Aug 2022 18:30:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 427C0C433C1; Mon, 15 Aug 2022 18:30:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588237; bh=ORph88blPiFZ+kkoAYxCbSsKbFMd7dm7uoia54TWeYk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TZPqMo6mzoQg8Q2Wd6FliN10qNRk9rPKNDhAOMJXzPOccN362drQEHwhbEMwT+0IP b3DZqq+khr0Et49haisy8tL0IXM3KRwSNIj7TPqPF9BhibbFePqF7u0NvGVyPf9VbD M2eEUbTXqosPptWZuTU+JkboqdfDwyYeF+eriIbE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tejun Heo , Alexei Starovoitov , Andrii Nakryiko , Martin KaFai Lau , Yonghong Song , Sasha Levin Subject: [PATCH 5.15 339/779] bpf: Fix subprog names in stack traces. Date: Mon, 15 Aug 2022 19:59:43 +0200 Message-Id: <20220815180351.764246993@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexei Starovoitov [ Upstream commit 9c7c48d6a1e2eb5192ad5294c1c4dbd42a88e88b ] The commit 7337224fc150 ("bpf: Improve the info.func_info and info.func_inf= o_rec_size behavior") accidently made bpf_prog_ksym_set_name() conservative for bpf subprograms. Fixed it so instead of "bpf_prog_tag_F" the stack traces print "bpf_prog_ta= g_full_subprog_name". Fixes: 7337224fc150 ("bpf: Improve the info.func_info and info.func_info_re= c_size behavior") Reported-by: Tejun Heo Signed-off-by: Alexei Starovoitov Signed-off-by: Andrii Nakryiko Acked-by: Martin KaFai Lau Acked-by: Yonghong Song Link: https://lore.kernel.org/bpf/20220714211637.17150-1-alexei.starovoitov= @gmail.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- kernel/bpf/verifier.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 346d36c905a9..c8b534a498b3 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -12445,6 +12445,7 @@ static int jit_subprogs(struct bpf_verifier_env *en= v) /* Below members will be freed only at prog->aux */ func[i]->aux->btf =3D prog->aux->btf; func[i]->aux->func_info =3D prog->aux->func_info; + func[i]->aux->func_info_cnt =3D prog->aux->func_info_cnt; func[i]->aux->poke_tab =3D prog->aux->poke_tab; func[i]->aux->size_poke_tab =3D prog->aux->size_poke_tab; =20 @@ -12457,9 +12458,6 @@ static int jit_subprogs(struct bpf_verifier_env *en= v) poke->aux =3D func[i]->aux; } =20 - /* Use bpf_prog_F_tag to indicate functions in stack traces. - * Long term would need debug info to populate names - */ func[i]->aux->name[0] =3D 'F'; func[i]->aux->stack_depth =3D env->subprog_info[i].stack_depth; func[i]->jit_requested =3D 1; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9A44C00140 for ; Mon, 15 Aug 2022 18:59:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244826AbiHOS7N (ORCPT ); Mon, 15 Aug 2022 14:59:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244916AbiHOS4P (ORCPT ); Mon, 15 Aug 2022 14:56:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DEE9E32D95; Mon, 15 Aug 2022 11:30: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 5A22F606A1; Mon, 15 Aug 2022 18:30:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 32473C433C1; Mon, 15 Aug 2022 18:30:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588240; bh=zm49u6YjALaQGCdWKi28QKevV2pSXaFcAw/nSI9Mu/c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yOc+c7n5QdkJkUsxiLIeVNQd77nMTGFgJzUL3ZY21I5cs/s0ZsUN6KbkOd1JHd0Td B5GTjS+hZxrLNN9mFsxoH68AxLqVnsbaFc/cQ0i9zRfysei/qKA6eaOz2CpTRPtIMa 6jP++ozBkwdXz9WLV6xh3gKCGCwA4EGrE5bWRqhQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jens Axboe , "Jason A. Donenfeld" , Al Viro , Sasha Levin Subject: [PATCH 5.15 340/779] fs: check FMODE_LSEEK to control internal pipe splicing Date: Mon, 15 Aug 2022 19:59:44 +0200 Message-Id: <20220815180351.801825867@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 97ef77c52b789ec1411d360ed99dca1efe4b2c81 ] The original direct splicing mechanism from Jens required the input to be a regular file because it was avoiding the special socket case. It also recognized blkdevs as being close enough to a regular file. But it forgot about chardevs, which behave the same way and work fine here. This is an okayish heuristic, but it doesn't totally work. For example, a few chardevs should be spliceable here. And a few regular files shouldn't. This patch fixes this by instead checking whether FMODE_LSEEK is set, which represents decently enough what we need rewinding for when splicing to internal pipes. Fixes: b92ce5589374 ("[PATCH] splice: add direct fd <-> fd splicing support= ") Cc: Jens Axboe Signed-off-by: Jason A. Donenfeld Signed-off-by: Al Viro Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/splice.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/fs/splice.c b/fs/splice.c index 5dbce4dcc1a7..3abcd7fbc9f2 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -814,17 +814,15 @@ ssize_t splice_direct_to_actor(struct file *in, struc= t splice_desc *sd, { struct pipe_inode_info *pipe; long ret, bytes; - umode_t i_mode; size_t len; int i, flags, more; =20 /* - * We require the input being a regular file, as we don't want to - * randomly drop data for eg socket -> socket splicing. Use the - * piped splicing for that! + * We require the input to be seekable, as we don't want to randomly + * drop data for eg socket -> socket splicing. Use the piped splicing + * for that! */ - i_mode =3D file_inode(in)->i_mode; - if (unlikely(!S_ISREG(i_mode) && !S_ISBLK(i_mode))) + if (unlikely(!(in->f_mode & FMODE_LSEEK))) return -EINVAL; =20 /* --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9876DC00140 for ; Mon, 15 Aug 2022 18:59:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230339AbiHOS73 (ORCPT ); Mon, 15 Aug 2022 14:59:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244935AbiHOS4U (ORCPT ); Mon, 15 Aug 2022 14:56:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2ABC72C100; Mon, 15 Aug 2022 11:30: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 D9E59B81074; Mon, 15 Aug 2022 18:30:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34EBDC433D7; Mon, 15 Aug 2022 18:30:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588243; bh=KPIT0rX4vehbcxwhw9hn4GDvpctrofJn58SXiBI/FTM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RWOVqqxxNkpa3VNm8qTIzlldeCellNfWov39s8vRuoSEbBGJ83ZRiQBbTethCuv2r PIRz+suQsTf0LSF3BPkKKY45uFgJY8REL5DSZapjVJQ9cWa57iOBost8oE1MK1M6Xs oBqxpTm/dBxirFeusHUhR48mMfPDs8Hg1jyBdU7c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jernej Skrabec , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.15 341/779] media: cedrus: h265: Fix flag name Date: Mon, 15 Aug 2022 19:59:45 +0200 Message-Id: <20220815180351.852340263@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jernej Skrabec [ Upstream commit 104a70e1d0bcef28db13c4192b8729086089651c ] Bit 21 in register 0x24 (slice header info 1) actually represents negated version of low delay flag. This can be seen in vendor Cedar library source code. While this flag is not part of the standard, it can be found in reference HEVC implementation. Fix macro name and change it to flag. Fixes: 86caab29da78 ("media: cedrus: Add HEVC/H.265 decoding support") Signed-off-by: Jernej Skrabec Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/staging/media/sunxi/cedrus/cedrus_h265.c | 4 +++- drivers/staging/media/sunxi/cedrus/cedrus_regs.h | 3 +-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c b/drivers/sta= ging/media/sunxi/cedrus/cedrus_h265.c index 754942ecf064..f2cec43fd1f0 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c @@ -495,7 +495,6 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx, =20 reg =3D VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_TC_OFFSET_DIV2(slice_params= ->slice_tc_offset_div2) | VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_BETA_OFFSET_DIV2(slice_params= ->slice_beta_offset_div2) | - VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_POC_BIGEST_IN_RPS_ST(decode_p= arams->num_poc_st_curr_after =3D=3D 0) | VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_CR_QP_OFFSET(slice_params->sl= ice_cr_qp_offset) | VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_CB_QP_OFFSET(slice_params->sl= ice_cb_qp_offset) | VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_QP_DELTA(slice_params->slice_= qp_delta); @@ -508,6 +507,9 @@ static void cedrus_h265_setup(struct cedrus_ctx *ctx, V4L2_HEVC_SLICE_PARAMS_FLAG_SLICE_LOOP_FILTER_ACROSS_SLICES_ENABLED, slice_params->flags); =20 + if (decode_params->num_poc_st_curr_after =3D=3D 0) + reg |=3D VE_DEC_H265_DEC_SLICE_HDR_INFO1_FLAG_SLICE_NOT_LOW_DELAY; + cedrus_write(dev, VE_DEC_H265_DEC_SLICE_HDR_INFO1, reg); =20 chroma_log2_weight_denom =3D pred_weight_table->luma_log2_weight_denom + diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_regs.h b/drivers/sta= ging/media/sunxi/cedrus/cedrus_regs.h index 92ace87c1c7d..5f34e3670289 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus_regs.h +++ b/drivers/staging/media/sunxi/cedrus/cedrus_regs.h @@ -377,13 +377,12 @@ =20 #define VE_DEC_H265_DEC_SLICE_HDR_INFO1_FLAG_SLICE_DEBLOCKING_FILTER_DISAB= LED BIT(23) #define VE_DEC_H265_DEC_SLICE_HDR_INFO1_FLAG_SLICE_LOOP_FILTER_ACROSS_SLIC= ES_ENABLED BIT(22) +#define VE_DEC_H265_DEC_SLICE_HDR_INFO1_FLAG_SLICE_NOT_LOW_DELAY BIT(21) =20 #define VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_TC_OFFSET_DIV2(v) \ SHIFT_AND_MASK_BITS(v, 31, 28) #define VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_BETA_OFFSET_DIV2(v) \ SHIFT_AND_MASK_BITS(v, 27, 24) -#define VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_POC_BIGEST_IN_RPS_ST(v) \ - ((v) ? BIT(21) : 0) #define VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_CR_QP_OFFSET(v) \ SHIFT_AND_MASK_BITS(v, 20, 16) #define VE_DEC_H265_DEC_SLICE_HDR_INFO1_SLICE_CB_QP_OFFSET(v) \ --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3582C00140 for ; Mon, 15 Aug 2022 18:59:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244854AbiHOS7Y (ORCPT ); Mon, 15 Aug 2022 14:59:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244937AbiHOS4U (ORCPT ); Mon, 15 Aug 2022 14:56:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 452C964FD; Mon, 15 Aug 2022 11:30: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 D5C0160F9F; Mon, 15 Aug 2022 18:30:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1A1BC433D6; Mon, 15 Aug 2022 18:30:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588246; bh=QPTfQKqh2f76lb3mUBMoomoHcK9nZi9n8RF13z/wN6M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HEDElQGt+prNOtlc0t8DjCOE8niGMB49FzBD+8NHY5TKUFRoxm4qRAlcKNONgDDZ9 BgN+sIEOmwd3YZZLHoXmz92mh/jwme12xwr5HGmac2C28jhs/KqpGHbwBPV2hdw2qj YICGHXhpejnRMIrAB8rCq1Wo69mTzlvPBxVFtq7o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ezequiel Garcia , Andrzej Pietrasiewicz , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.15 342/779] media: hantro: postproc: Fix motion vector space size Date: Mon, 15 Aug 2022 19:59:46 +0200 Message-Id: <20220815180351.888932267@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ezequiel Garcia [ Upstream commit 9393761aec4c56b7f2f19d21f806d316731401c1 ] When the post-processor hardware block is enabled, the driver allocates an internal queue of buffers for the decoder enginer, and uses the vb2 queue for the post-processor engine. For instance, on a G1 core, the decoder engine produces NV12 buffers and the post-processor engine can produce YUY2 buffers. The decoder engine expects motion vectors to be appended to the NV12 buffers, but this is only required for CODECs that need motion vectors, such as H.264. Fix the post-processor logic accordingly. Signed-off-by: Ezequiel Garcia Signed-off-by: Andrzej Pietrasiewicz Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/staging/media/hantro/hantro_postproc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/media/hantro/hantro_postproc.c b/drivers/stagi= ng/media/hantro/hantro_postproc.c index ed8916c950a4..07842152003f 100644 --- a/drivers/staging/media/hantro/hantro_postproc.c +++ b/drivers/staging/media/hantro/hantro_postproc.c @@ -132,9 +132,10 @@ int hantro_postproc_alloc(struct hantro_ctx *ctx) unsigned int num_buffers =3D cap_queue->num_buffers; unsigned int i, buf_size; =20 - buf_size =3D ctx->dst_fmt.plane_fmt[0].sizeimage + - hantro_h264_mv_size(ctx->dst_fmt.width, - ctx->dst_fmt.height); + buf_size =3D ctx->dst_fmt.plane_fmt[0].sizeimage; + if (ctx->vpu_src_fmt->fourcc =3D=3D V4L2_PIX_FMT_H264_SLICE) + buf_size +=3D hantro_h264_mv_size(ctx->dst_fmt.width, + ctx->dst_fmt.height); =20 for (i =3D 0; i < num_buffers; ++i) { struct hantro_aux_buf *priv =3D &ctx->postproc.dec_q[i]; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11854C00140 for ; Mon, 15 Aug 2022 18:59:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244879AbiHOS7c (ORCPT ); Mon, 15 Aug 2022 14:59:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244952AbiHOS4W (ORCPT ); Mon, 15 Aug 2022 14:56: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 B5171AE4D; Mon, 15 Aug 2022 11:30: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 78857B81062; Mon, 15 Aug 2022 18:30:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D69E8C433D6; Mon, 15 Aug 2022 18:30:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588252; bh=b+UBN1FBQ7qTYL/22sOwtFW1DR36fOVK9mF/Wjsb7gI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sBdqQ+gQtBQT3HybY5xrbcPTUclTR6KbwruzxkhMfl7giOmzMZYoJwTp+PYHfU90w E6b++PLtZiW72hX2mdM9WltTBZx+Yylxkfx+3/kNmR7RiLXXwEEPCdDcTKrnhazNKL Hz0IA8wwRB0y1EX+0Wb02ofIuwngA7/zQje5Gxeo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ezequiel Garcia , Andrzej Pietrasiewicz , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.15 343/779] media: hantro: Simplify postprocessor Date: Mon, 15 Aug 2022 19:59:47 +0200 Message-Id: <20220815180351.922425700@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ezequiel Garcia [ Upstream commit 53a3e71095c572333ceea30762565dbedec951ca ] Add a 'postprocessed' boolean property to struct hantro_fmt to signal that a format is produced by the post-processor. This will allow to introduce the G2 post-processor in a simple way. Signed-off-by: Ezequiel Garcia Signed-off-by: Andrzej Pietrasiewicz Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/staging/media/hantro/hantro.h | 2 ++ drivers/staging/media/hantro/hantro_postproc.c | 8 +------- drivers/staging/media/hantro/imx8m_vpu_hw.c | 1 + drivers/staging/media/hantro/rockchip_vpu_hw.c | 1 + drivers/staging/media/hantro/sama5d4_vdec_hw.c | 1 + 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/staging/media/hantro/hantro.h b/drivers/staging/media/= hantro/hantro.h index c2e2dca38628..88792c863edc 100644 --- a/drivers/staging/media/hantro/hantro.h +++ b/drivers/staging/media/hantro/hantro.h @@ -262,6 +262,7 @@ struct hantro_ctx { * @max_depth: Maximum depth, for bitstream formats * @enc_fmt: Format identifier for encoder registers. * @frmsize: Supported range of frame sizes (only for bitstream formats). + * @postprocessed: Indicates if this format needs the post-processor. */ struct hantro_fmt { char *name; @@ -271,6 +272,7 @@ struct hantro_fmt { int max_depth; enum hantro_enc_fmt enc_fmt; struct v4l2_frmsize_stepwise frmsize; + bool postprocessed; }; =20 struct hantro_reg { diff --git a/drivers/staging/media/hantro/hantro_postproc.c b/drivers/stagi= ng/media/hantro/hantro_postproc.c index 07842152003f..46434c97317b 100644 --- a/drivers/staging/media/hantro/hantro_postproc.c +++ b/drivers/staging/media/hantro/hantro_postproc.c @@ -53,15 +53,9 @@ const struct hantro_postproc_regs hantro_g1_postproc_reg= s =3D { bool hantro_needs_postproc(const struct hantro_ctx *ctx, const struct hantro_fmt *fmt) { - struct hantro_dev *vpu =3D ctx->dev; - if (ctx->is_encoder) return false; - - if (!vpu->variant->postproc_fmts) - return false; - - return fmt->fourcc !=3D V4L2_PIX_FMT_NV12; + return fmt->postprocessed; } =20 void hantro_postproc_enable(struct hantro_ctx *ctx) diff --git a/drivers/staging/media/hantro/imx8m_vpu_hw.c b/drivers/staging/= media/hantro/imx8m_vpu_hw.c index ea919bfb9891..b692b74b0914 100644 --- a/drivers/staging/media/hantro/imx8m_vpu_hw.c +++ b/drivers/staging/media/hantro/imx8m_vpu_hw.c @@ -82,6 +82,7 @@ static const struct hantro_fmt imx8m_vpu_postproc_fmts[] = =3D { { .fourcc =3D V4L2_PIX_FMT_YUYV, .codec_mode =3D HANTRO_MODE_NONE, + .postprocessed =3D true, }, }; =20 diff --git a/drivers/staging/media/hantro/rockchip_vpu_hw.c b/drivers/stagi= ng/media/hantro/rockchip_vpu_hw.c index 0c22039162a0..543dc4a5486c 100644 --- a/drivers/staging/media/hantro/rockchip_vpu_hw.c +++ b/drivers/staging/media/hantro/rockchip_vpu_hw.c @@ -62,6 +62,7 @@ static const struct hantro_fmt rockchip_vpu1_postproc_fmt= s[] =3D { { .fourcc =3D V4L2_PIX_FMT_YUYV, .codec_mode =3D HANTRO_MODE_NONE, + .postprocessed =3D true, }, }; =20 diff --git a/drivers/staging/media/hantro/sama5d4_vdec_hw.c b/drivers/stagi= ng/media/hantro/sama5d4_vdec_hw.c index 9c3b8cd0b239..99432008b241 100644 --- a/drivers/staging/media/hantro/sama5d4_vdec_hw.c +++ b/drivers/staging/media/hantro/sama5d4_vdec_hw.c @@ -15,6 +15,7 @@ static const struct hantro_fmt sama5d4_vdec_postproc_fmts= [] =3D { { .fourcc =3D V4L2_PIX_FMT_YUYV, .codec_mode =3D HANTRO_MODE_NONE, + .postprocessed =3D true, }, }; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABA6BC00140 for ; Mon, 15 Aug 2022 19:03:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245097AbiHOTD1 (ORCPT ); Mon, 15 Aug 2022 15:03:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244957AbiHOS4X (ORCPT ); Mon, 15 Aug 2022 14:56: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 BD16B2AE16; Mon, 15 Aug 2022 11:30:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7A86FB8106C; Mon, 15 Aug 2022 18:30:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E05EBC433D6; Mon, 15 Aug 2022 18:30:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588255; bh=RclICDonFjO944ZHoBtWwLTYZURYZW3jTo1y4qRELnA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jxQ0lDzOzE3oeAB+LIUgxzFMiggdP+wC/VsTh+9TpZfvZV0YP8FUyGaoTmK5Xi7o7 /D+YXUqqlzZpq6GLj373ijNJa6MF7NIE5REUwJ56TgGe2c6mHNRvyXKJS5ojr/eiIz 8t/jgSgMXQ3jzBI0jBKm2wXuvrusTSERIfYWEzMk= 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.15 344/779] media: hevc: Embedded indexes in RPS Date: Mon, 15 Aug 2022 19:59:48 +0200 Message-Id: <20220815180351.954446748@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 d95a63daca85f4bca3b70e622c75586b5bf0ea5c ] Reference Picture Set lists provide indices of short and long term reference in DBP array. Fix Hantro to not do a look up in DBP entries. Make documentation more clear about it. [hverkuil: fix typo in commit log] 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 Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- .../media/v4l/ext-ctrls-codec.rst | 6 ++--- .../staging/media/hantro/hantro_g2_hevc_dec.c | 25 +++++-------------- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Do= cumentation/userspace-api/media/v4l/ext-ctrls-codec.rst index 976d34445a24..f1421cf1a1b3 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst @@ -3326,15 +3326,15 @@ enum v4l2_mpeg_video_hevc_size_of_length_field - * - __u8 - ``poc_st_curr_before[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]`` - PocStCurrBefore as described in section 8.3.2 "Decoding process fo= r reference - picture set. + picture set": provides the index of the short term before referenc= es in DPB array. * - __u8 - ``poc_st_curr_after[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]`` - PocStCurrAfter as described in section 8.3.2 "Decoding process for= reference - picture set. + picture set": provides the index of the short term after reference= s in DPB array. * - __u8 - ``poc_lt_curr[V4L2_HEVC_DPB_ENTRIES_NUM_MAX]`` - PocLtCurr as described in section 8.3.2 "Decoding process for refe= rence - picture set. + picture set": provides the index of the long term references in DP= B array. * - __u64 - ``flags`` - See :ref:`Decode Parameters Flags ` diff --git a/drivers/staging/media/hantro/hantro_g2_hevc_dec.c b/drivers/st= aging/media/hantro/hantro_g2_hevc_dec.c index e63b777d4266..87086f5c5495 100644 --- a/drivers/staging/media/hantro/hantro_g2_hevc_dec.c +++ b/drivers/staging/media/hantro/hantro_g2_hevc_dec.c @@ -264,24 +264,11 @@ static void set_params(struct hantro_ctx *ctx) hantro_reg_write(vpu, &g2_apf_threshold, 8); } =20 -static int find_ref_pic_index(const struct v4l2_hevc_dpb_entry *dpb, int p= ic_order_cnt) -{ - int i; - - for (i =3D 0; i < V4L2_HEVC_DPB_ENTRIES_NUM_MAX; i++) { - if (dpb[i].pic_order_cnt[0] =3D=3D pic_order_cnt) - return i; - } - - return 0x0; -} - static void set_ref_pic_list(struct hantro_ctx *ctx) { const struct hantro_hevc_dec_ctrls *ctrls =3D &ctx->hevc_dec.ctrls; struct hantro_dev *vpu =3D ctx->dev; const struct v4l2_ctrl_hevc_decode_params *decode_params =3D ctrls->decod= e_params; - const struct v4l2_hevc_dpb_entry *dpb =3D decode_params->dpb; u32 list0[V4L2_HEVC_DPB_ENTRIES_NUM_MAX] =3D {}; u32 list1[V4L2_HEVC_DPB_ENTRIES_NUM_MAX] =3D {}; static const struct hantro_reg ref_pic_regs0[] =3D { @@ -325,11 +312,11 @@ static void set_ref_pic_list(struct hantro_ctx *ctx) /* List 0 contains: short term before, short term after and long term */ j =3D 0; for (i =3D 0; i < decode_params->num_poc_st_curr_before && j < ARRAY_SIZE= (list0); i++) - list0[j++] =3D find_ref_pic_index(dpb, decode_params->poc_st_curr_before= [i]); + list0[j++] =3D decode_params->poc_st_curr_before[i]; for (i =3D 0; i < decode_params->num_poc_st_curr_after && j < ARRAY_SIZE(= list0); i++) - list0[j++] =3D find_ref_pic_index(dpb, decode_params->poc_st_curr_after[= i]); + list0[j++] =3D decode_params->poc_st_curr_after[i]; for (i =3D 0; i < decode_params->num_poc_lt_curr && j < ARRAY_SIZE(list0)= ; i++) - list0[j++] =3D find_ref_pic_index(dpb, decode_params->poc_lt_curr[i]); + list0[j++] =3D decode_params->poc_lt_curr[i]; =20 /* Fill the list, copying over and over */ i =3D 0; @@ -338,11 +325,11 @@ static void set_ref_pic_list(struct hantro_ctx *ctx) =20 j =3D 0; for (i =3D 0; i < decode_params->num_poc_st_curr_after && j < ARRAY_SIZE(= list1); i++) - list1[j++] =3D find_ref_pic_index(dpb, decode_params->poc_st_curr_after[= i]); + list1[j++] =3D decode_params->poc_st_curr_after[i]; for (i =3D 0; i < decode_params->num_poc_st_curr_before && j < ARRAY_SIZE= (list1); i++) - list1[j++] =3D find_ref_pic_index(dpb, decode_params->poc_st_curr_before= [i]); + list1[j++] =3D decode_params->poc_st_curr_before[i]; for (i =3D 0; i < decode_params->num_poc_lt_curr && j < ARRAY_SIZE(list1)= ; i++) - list1[j++] =3D find_ref_pic_index(dpb, decode_params->poc_lt_curr[i]); + list1[j++] =3D decode_params->poc_lt_curr[i]; =20 i =3D 0; while (j < ARRAY_SIZE(list1)) --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1027DC00140 for ; Mon, 15 Aug 2022 18:59:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239537AbiHOS7i (ORCPT ); Mon, 15 Aug 2022 14:59:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244960AbiHOS4X (ORCPT ); Mon, 15 Aug 2022 14:56: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 220AE2A72C; Mon, 15 Aug 2022 11:31:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B244461041; Mon, 15 Aug 2022 18:30:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82C01C433C1; Mon, 15 Aug 2022 18:30:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588259; bh=OCR+DclVKf0xQJ9S7RLXh1tW8XReanFojT84UmrK5oo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aI8ZirHpeEuSqDj+nWLJJmK0GKhT+KTqt38qLsZFEkT36BnJp4TGDPAP3rRxzcRo9 uaKi62b2/n2JA195YRVIAn0aBTrFV+0r6L6p5MfYYLHAPkM/jat23kF3mPZh3sRyRW 4WJuNYhIFbELw+44fOFZtCm2ZNHctA6MokthvZOA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sebastian Fricke , Nicolas Dufresne , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.15 345/779] media: staging: media: hantro: Fix typos Date: Mon, 15 Aug 2022 19:59:49 +0200 Message-Id: <20220815180351.985437656@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sebastian Fricke [ Upstream commit d8f6f1c56d5469e22eeb7cc1f3580b29e2f0fef5 ] Fix typos in comments within the Hantro driver. Signed-off-by: Sebastian Fricke Reviewed-by: Nicolas Dufresne Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/staging/media/hantro/hantro_g2_hevc_dec.c | 2 +- drivers/staging/media/hantro/hantro_hevc.c | 2 +- 2 files changed, 2 insertions(+), 2 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 87086f5c5495..bcdfa359de7f 100644 --- a/drivers/staging/media/hantro/hantro_g2_hevc_dec.c +++ b/drivers/staging/media/hantro/hantro_g2_hevc_dec.c @@ -413,7 +413,7 @@ static int set_ref(struct hantro_ctx *ctx) =20 set_ref_pic_list(ctx); =20 - /* We will only keep the references picture that are still used */ + /* We will only keep the reference pictures that are still used */ ctx->hevc_dec.ref_bufs_used =3D 0; =20 /* Set up addresses of DPB buffers */ diff --git a/drivers/staging/media/hantro/hantro_hevc.c b/drivers/staging/m= edia/hantro/hantro_hevc.c index 5347f5a41c2a..7ce98a2b1655 100644 --- a/drivers/staging/media/hantro/hantro_hevc.c +++ b/drivers/staging/media/hantro/hantro_hevc.c @@ -98,7 +98,7 @@ dma_addr_t hantro_hevc_get_ref_buf(struct hantro_ctx *ctx, struct hantro_hevc_dec_hw_ctx *hevc_dec =3D &ctx->hevc_dec; int i; =20 - /* Find the reference buffer in already know ones */ + /* Find the reference buffer in already known ones */ for (i =3D 0; i < NUM_REF_PICTURES; i++) { if (hevc_dec->ref_bufs_poc[i] =3D=3D poc) { hevc_dec->ref_bufs_used |=3D 1 << i; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51E4FC25B0E for ; Mon, 15 Aug 2022 18:59:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244895AbiHOS7l (ORCPT ); Mon, 15 Aug 2022 14:59:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244971AbiHOS4Y (ORCPT ); Mon, 15 Aug 2022 14:56: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 9E9E62A40D; Mon, 15 Aug 2022 11:31:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5F089B8106C; Mon, 15 Aug 2022 18:31:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1DC5C433D7; Mon, 15 Aug 2022 18:31:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588262; bh=qXskdu1j9rHf85RE4xREBJawMz2p1A/Hq3++wgRptaI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1DJlR7slCRGb3Slf0/Y8ypP/uML4YXk+8k+8YA7c39Vn5DdM52N19B3b+7vddGJeP Q38/jpvLdRa4lE/OYe8hzyOoy3ojyOSacYSiemeBBRfWstk+zRkmIgv57twr9kU0O+ kcYeBQEcidTs6IW7oeZ63/DKX69rRXjQwXwZQv3M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Kalle Valo , Sasha Levin Subject: [PATCH 5.15 346/779] wifi: wil6210: debugfs: fix info leak in wil_write_file_wmi() Date: Mon, 15 Aug 2022 19:59:50 +0200 Message-Id: <20220815180352.034180561@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter [ Upstream commit 7a4836560a6198d245d5732e26f94898b12eb760 ] The simple_write_to_buffer() function will succeed if even a single byte is initialized. However, we need to initialize the whole buffer to prevent information leaks. Just use memdup_user(). Fixes: ff974e408334 ("wil6210: debugfs interface to send raw WMI command") Signed-off-by: Dan Carpenter Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/Ysg14NdKAZF/hcNG@kili Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/wireless/ath/wil6210/debugfs.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wirel= ess/ath/wil6210/debugfs.c index 4c944e595978..c6f8254cb21d 100644 --- a/drivers/net/wireless/ath/wil6210/debugfs.c +++ b/drivers/net/wireless/ath/wil6210/debugfs.c @@ -1012,18 +1012,12 @@ static ssize_t wil_write_file_wmi(struct file *file= , const char __user *buf, u16 cmdid; int rc, rc1; =20 - if (cmdlen < 0) + if (cmdlen < 0 || *ppos !=3D 0) return -EINVAL; =20 - wmi =3D kmalloc(len, GFP_KERNEL); - if (!wmi) - return -ENOMEM; - - rc =3D simple_write_to_buffer(wmi, len, ppos, buf, len); - if (rc < 0) { - kfree(wmi); - return rc; - } + wmi =3D memdup_user(buf, len); + if (IS_ERR(wmi)) + return PTR_ERR(wmi); =20 cmd =3D (cmdlen > 0) ? &wmi[1] : NULL; cmdid =3D le16_to_cpu(wmi->command_id); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1923FC00140 for ; Mon, 15 Aug 2022 18:59:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244413AbiHOS7u (ORCPT ); Mon, 15 Aug 2022 14:59:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245005AbiHOS43 (ORCPT ); Mon, 15 Aug 2022 14:56:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 730C22C65E; Mon, 15 Aug 2022 11:31: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 9EA0FB8106C; Mon, 15 Aug 2022 18:31:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AD05C433C1; Mon, 15 Aug 2022 18:31:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588265; bh=NOfUXmPqSk1PmDgPrBf/kn0GN7etkIuaEtAbPGOg2Ns=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RMNJowNv7WoyatQTP+9C1+VIxy57huKsSx16lVCGRyA2efSGDqXXq6T1ZhRQqTUWl BGCfEo48l2fwvDOBH82w1xJrmcYrCBGNlPzVUHdNDcd0BMdMY1+RjhLPLD1MMp7wiD nYu2AkmUcBwXtbAXewCovua3qTYZvni2Y1ZfiI7M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Christian Lamparter , Kalle Valo , Sasha Levin Subject: [PATCH 5.15 347/779] wifi: p54: Fix an error handling path in p54spi_probe() Date: Mon, 15 Aug 2022 19:59:51 +0200 Message-Id: <20220815180352.072639286@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET [ Upstream commit 83781f0162d080fec7dcb911afd1bc2f5ad04471 ] If an error occurs after a successful call to p54spi_request_firmware(), it must be undone by a corresponding release_firmware() as already done in the error handling path of p54spi_request_firmware() and in the .remove() function. Add the missing call in the error handling path and remove it from p54spi_request_firmware() now that it is the responsibility of the caller to release the firmware Fixes: cd8d3d321285 ("p54spi: p54spi driver") Signed-off-by: Christophe JAILLET Acked-by: Christian Lamparter Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/297d2547ff2ee627731662abceeab9dbdaf23231.16= 55068321.git.christophe.jaillet@wanadoo.fr Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/wireless/intersil/p54/p54spi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/intersil/p54/p54spi.c b/drivers/net/wirel= ess/intersil/p54/p54spi.c index ab0fe8565851..cdb57819684a 100644 --- a/drivers/net/wireless/intersil/p54/p54spi.c +++ b/drivers/net/wireless/intersil/p54/p54spi.c @@ -164,7 +164,7 @@ static int p54spi_request_firmware(struct ieee80211_hw = *dev) =20 ret =3D p54_parse_firmware(dev, priv->firmware); if (ret) { - release_firmware(priv->firmware); + /* the firmware is released by the caller */ return ret; } =20 @@ -659,6 +659,7 @@ static int p54spi_probe(struct spi_device *spi) return 0; =20 err_free_common: + release_firmware(priv->firmware); free_irq(gpio_to_irq(p54spi_gpio_irq), spi); err_free_gpio_irq: gpio_free(p54spi_gpio_irq); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BB35C00140 for ; Mon, 15 Aug 2022 18:59:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244466AbiHOS74 (ORCPT ); Mon, 15 Aug 2022 14:59:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245013AbiHOS4b (ORCPT ); Mon, 15 Aug 2022 14:56:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5947532050; Mon, 15 Aug 2022 11:31:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7B86AB81062; Mon, 15 Aug 2022 18:31:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF13CC433C1; Mon, 15 Aug 2022 18:31:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588268; bh=fQ8GGMOh4zLwx6CDpw5/MD/NznF498JGC0ZDntJHGnk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z31veFr30V2ZspsHM73szcyrvsbYsnWz9eqE8LW8Lgn0hqZRqTdh7ed0TYTA5EH7S 7b+M4XjOr44r95JwyRdThKIe3VLB2k/8LWrVC6Og8ADQP/TJGSB9flA373PfIotcs5 gwK5wSSA53rSg4WIuyfkfq1+Bw0hAOF+eStzT3/Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rustam Subkhankulov , Christian Lamparter , Kalle Valo , Sasha Levin Subject: [PATCH 5.15 348/779] wifi: p54: add missing parentheses in p54_flush() Date: Mon, 15 Aug 2022 19:59:52 +0200 Message-Id: <20220815180352.117019903@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rustam Subkhankulov [ Upstream commit bcfd9d7f6840b06d5988c7141127795cf405805e ] The assignment of the value to the variable total in the loop condition must be enclosed in additional parentheses, since otherwise, in accordance with the precedence of the operators, the conjunction will be performed first, and only then the assignment. Due to this error, a warning later in the function after the loop may not occur in the situation when it should. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Rustam Subkhankulov Fixes: 0d4171e2153b ("p54: implement flush callback") Acked-by: Christian Lamparter Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220714134831.106004-1-subkhankulov@ispras= .ru Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/wireless/intersil/p54/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/intersil/p54/main.c b/drivers/net/wireles= s/intersil/p54/main.c index a3ca6620dc0c..8fa3ec71603e 100644 --- a/drivers/net/wireless/intersil/p54/main.c +++ b/drivers/net/wireless/intersil/p54/main.c @@ -682,7 +682,7 @@ static void p54_flush(struct ieee80211_hw *dev, struct = ieee80211_vif *vif, * queues have already been stopped and no new frames can sneak * up from behind. */ - while ((total =3D p54_flush_count(priv) && i--)) { + while ((total =3D p54_flush_count(priv)) && i--) { /* waste time */ msleep(20); } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E65A0C00140 for ; Mon, 15 Aug 2022 19:03:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245128AbiHOTDa (ORCPT ); Mon, 15 Aug 2022 15:03:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245022AbiHOS4d (ORCPT ); Mon, 15 Aug 2022 14:56:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 593273123E; Mon, 15 Aug 2022 11:31: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 C1A9061029; Mon, 15 Aug 2022 18:31:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD37CC433D6; Mon, 15 Aug 2022 18:31:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588271; bh=cTSrOZZlQgwy0HFIlp6AGXKL8rVxPWkxyDtUG4Olxmw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kEXFY1xxHiKlKzM63U4MhLUoSnWchax/TlAZQ7mcX1Mi8hXZ9OVL5+xVxmDP0u14L 9KLSD3Yh2jiIdc+wIn5x2Tb6cA15eATFB1Z9Ugyp3/4urI7DEpjoqvUmuKlJIXEM2O FdTVa17QNnUYsHQLSJVuAaPq5CtwgmI3b7lvB/ZE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Martin KaFai Lau , Alexei Starovoitov , Sasha Levin Subject: [PATCH 5.15 349/779] selftests/bpf: fix a test for snprintf() overflow Date: Mon, 15 Aug 2022 19:59:53 +0200 Message-Id: <20220815180352.150562016@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter [ Upstream commit c5d22f4cfe8dfb93f1db0a1e7e2e7ebc41395d98 ] The snprintf() function returns the number of bytes which *would* have been copied if there were space. In other words, it can be > sizeof(pin_path). Fixes: c0fa1b6c3efc ("bpf: btf: Add BTF tests") Signed-off-by: Dan Carpenter Acked-by: Martin KaFai Lau Link: https://lore.kernel.org/r/YtZ+aD/tZMkgOUw+@kili Signed-off-by: Alexei Starovoitov Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- tools/testing/selftests/bpf/prog_tests/btf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/prog_tests/btf.c b/tools/testing/s= elftests/bpf/prog_tests/btf.c index 649f87382c8d..50afa75bd45b 100644 --- a/tools/testing/selftests/bpf/prog_tests/btf.c +++ b/tools/testing/selftests/bpf/prog_tests/btf.c @@ -4913,7 +4913,7 @@ static void do_test_pprint(int test_num) ret =3D snprintf(pin_path, sizeof(pin_path), "%s/%s", "/sys/fs/bpf", test->map_name); =20 - if (CHECK(ret =3D=3D sizeof(pin_path), "pin_path %s/%s is too long", + if (CHECK(ret >=3D sizeof(pin_path), "pin_path %s/%s is too long", "/sys/fs/bpf", test->map_name)) { err =3D -1; goto done; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95E8DC00140 for ; Mon, 15 Aug 2022 19:00:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244927AbiHOS77 (ORCPT ); Mon, 15 Aug 2022 14:59:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245042AbiHOS4f (ORCPT ); Mon, 15 Aug 2022 14:56:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A5AA2C67B; Mon, 15 Aug 2022 11:31:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7104B61043; Mon, 15 Aug 2022 18:31:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 486C8C433D6; Mon, 15 Aug 2022 18:31:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588274; bh=Am9f5DX2cRApJL2HJEP4OQCjdiP3VXL6uJRI/RttOyI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GYdx9mzHNIAUoDsEWQsOSzUKkY+eoUtqiiAoI5rbg+Z0ycUeWhOAr2cy2KeMmh4cT I25bLQkzQ4BZjSkgbDQvgz4Xbw730FZoEhwYLa/R16ScGb1muJ/bhxtPFOsOp/IsW1 rQciFrgNVX/o2KEZAAfIWRSI2dpKyovyy6VJgC/Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Martin KaFai Lau , Alexei Starovoitov , Sasha Levin Subject: [PATCH 5.15 350/779] libbpf: fix an snprintf() overflow check Date: Mon, 15 Aug 2022 19:59:54 +0200 Message-Id: <20220815180352.200320192@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter [ Upstream commit b77ffb30cfc5f58e957571d8541c6a7e3da19221 ] The snprintf() function returns the number of bytes it *would* have copied if there were enough space. So it can return > the sizeof(gen->attach_target). Fixes: 67234743736a ("libbpf: Generate loader program out of BPF ELF file.") Signed-off-by: Dan Carpenter Acked-by: Martin KaFai Lau Link: https://lore.kernel.org/r/YtZ+oAySqIhFl6/J@kili Signed-off-by: Alexei Starovoitov Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- tools/lib/bpf/gen_loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/lib/bpf/gen_loader.c b/tools/lib/bpf/gen_loader.c index 33c19590ee43..4435c09fe132 100644 --- a/tools/lib/bpf/gen_loader.c +++ b/tools/lib/bpf/gen_loader.c @@ -480,7 +480,7 @@ void bpf_gen__record_attach_target(struct bpf_gen *gen,= const char *attach_name, gen->attach_kind =3D kind; ret =3D snprintf(gen->attach_target, sizeof(gen->attach_target), "%s%s", prefix, attach_name); - if (ret =3D=3D sizeof(gen->attach_target)) + if (ret >=3D sizeof(gen->attach_target)) gen->error =3D -ENOSPC; } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 905DBC00140 for ; Mon, 15 Aug 2022 19:03:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245159AbiHOTDk (ORCPT ); Mon, 15 Aug 2022 15:03:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245047AbiHOS4f (ORCPT ); Mon, 15 Aug 2022 14:56:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54A6A13E89; Mon, 15 Aug 2022 11:31: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 03019B8106C; Mon, 15 Aug 2022 18:31:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64524C433D6; Mon, 15 Aug 2022 18:31:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588277; bh=pra7bgqG8B0oe80z4hTPgBltj34wEKu3m3tEpNh2ngg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N920RhCHM6u4L3yKUwL6HpJYxpmBp8TGducSWsCDCXjyW5xWpp98RAFdFi/TlA3Qd k/mil9UaZYUVJhDwVugfuEkMfYTYp5OTSX20hEcrrV/KvII/t6Bpa0+n7TJCvGA5Ch OvAv5cTqVQYxYu+05HzwhRUTnG9esux2vrOnTSVE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Mailhol , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.15 351/779] can: pch_can: do not report txerr and rxerr during bus-off Date: Mon, 15 Aug 2022 19:59:55 +0200 Message-Id: <20220815180352.245349523@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 3a5c7e4611ddcf0ef37a3a17296b964d986161a6 ] During bus off, the error count is greater than 255 and can not fit in a u8. Fixes: 0c78ab76a05c ("pch_can: Add setting TEC/REC statistics processing") Link: https://lore.kernel.org/all/20220719143550.3681-2-mailhol.vincent@wan= adoo.fr Signed-off-by: Vincent Mailhol Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/can/pch_can.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/can/pch_can.c b/drivers/net/can/pch_can.c index 964c8a09226a..f20e75eb1ce0 100644 --- a/drivers/net/can/pch_can.c +++ b/drivers/net/can/pch_can.c @@ -496,6 +496,9 @@ static void pch_can_error(struct net_device *ndev, u32 = status) cf->can_id |=3D CAN_ERR_BUSOFF; priv->can.can_stats.bus_off++; can_bus_off(ndev); + } else { + cf->data[6] =3D errc & PCH_TEC; + cf->data[7] =3D (errc & PCH_REC) >> 8; } =20 errc =3D ioread32(&priv->regs->errc); @@ -556,9 +559,6 @@ static void pch_can_error(struct net_device *ndev, u32 = status) break; } =20 - cf->data[6] =3D errc & PCH_TEC; - cf->data[7] =3D (errc & PCH_REC) >> 8; - priv->can.state =3D state; netif_receive_skb(skb); =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBCE9C00140 for ; Mon, 15 Aug 2022 19:03:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245142AbiHOTDg (ORCPT ); Mon, 15 Aug 2022 15:03:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245048AbiHOS4f (ORCPT ); Mon, 15 Aug 2022 14:56:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 09E0E2A723; Mon, 15 Aug 2022 11:31: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 921C361045; Mon, 15 Aug 2022 18:31:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E1A0C433C1; Mon, 15 Aug 2022 18:31:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588281; bh=vHE7bzpXCHPPzuOeyNENQUQhtUMxApiv+WHVyCycKlI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h15KyDnbNQZocGbcbVAeht684bbzvtZ6fExgKIKx4+YGEhbLx1ldqwjWo1+AilZ6v DARBesa5PhL39FIFqlLtAaIlsCMFfM2jWE/3RHuWBvEoDbPyL257uX0suW2esfTYhg 8MyZh73MwzEzA3pAS/dCpb3Wl8URLeOqAbf0reVI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Mailhol , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.15 352/779] can: rcar_can: do not report txerr and rxerr during bus-off Date: Mon, 15 Aug 2022 19:59:56 +0200 Message-Id: <20220815180352.288125995@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 a37b7245e831a641df360ca41db6a71c023d3746 ] During bus off, the error count is greater than 255 and can not fit in a u8. Fixes: fd1159318e55 ("can: add Renesas R-Car CAN driver") Link: https://lore.kernel.org/all/20220719143550.3681-3-mailhol.vincent@wan= adoo.fr Signed-off-by: Vincent Mailhol Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/can/rcar/rcar_can.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/can/rcar/rcar_can.c b/drivers/net/can/rcar/rcar_ca= n.c index 8999ec9455ec..945b319de841 100644 --- a/drivers/net/can/rcar/rcar_can.c +++ b/drivers/net/can/rcar/rcar_can.c @@ -235,11 +235,8 @@ static void rcar_can_error(struct net_device *ndev) if (eifr & (RCAR_CAN_EIFR_EWIF | RCAR_CAN_EIFR_EPIF)) { txerr =3D readb(&priv->regs->tecr); rxerr =3D readb(&priv->regs->recr); - if (skb) { + if (skb) cf->can_id |=3D CAN_ERR_CRTL; - cf->data[6] =3D txerr; - cf->data[7] =3D rxerr; - } } if (eifr & RCAR_CAN_EIFR_BEIF) { int rx_errors =3D 0, tx_errors =3D 0; @@ -339,6 +336,9 @@ static void rcar_can_error(struct net_device *ndev) can_bus_off(ndev); if (skb) cf->can_id |=3D CAN_ERR_BUSOFF; + } else if (skb) { + cf->data[6] =3D txerr; + cf->data[7] =3D rxerr; } if (eifr & RCAR_CAN_EIFR_ORIF) { netdev_dbg(priv->ndev, "Receive overrun error interrupt\n"); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D0F3C00140 for ; Mon, 15 Aug 2022 19:00:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244937AbiHOTAE (ORCPT ); Mon, 15 Aug 2022 15:00:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245070AbiHOS4h (ORCPT ); Mon, 15 Aug 2022 14:56:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F501326C8; Mon, 15 Aug 2022 11:31: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 AF0AD61029; Mon, 15 Aug 2022 18:31:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A430DC433C1; Mon, 15 Aug 2022 18:31:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588287; bh=SUa8h2m6mypWO7doBPbdoMm7YnhVBnsmn1EZLZBxgRA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I5qyrZFftOzc6uhPh/wTRdMFU7lVeHg9rgn1j6KvzfbY4eOWSciZZQmogc3eBoeRr WKE99Prz9gN0+OFA6gvhXUE8YCKmGFrUxTLdLn15Ud4NRoIAggp54GHEKwme9Oq2De xIOf3QdGOkAckB16JfcxUlFEmssNdcd1deEdU9BI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Mailhol , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.15 353/779] can: sja1000: do not report txerr and rxerr during bus-off Date: Mon, 15 Aug 2022 19:59:57 +0200 Message-Id: <20220815180352.335672612@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 164d7cb2d5a30f1b3a5ab4fab1a27731fb1494a8 ] During bus off, the error count is greater than 255 and can not fit in a u8. Fixes: 215db1856e83 ("can: sja1000: Consolidate and unify state change hand= ling") Link: https://lore.kernel.org/all/20220719143550.3681-4-mailhol.vincent@wan= adoo.fr Signed-off-by: Vincent Mailhol Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/can/sja1000/sja1000.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sj= a1000.c index 3fad54646746..aae2677e24f9 100644 --- a/drivers/net/can/sja1000/sja1000.c +++ b/drivers/net/can/sja1000/sja1000.c @@ -404,9 +404,6 @@ static int sja1000_err(struct net_device *dev, uint8_t = isrc, uint8_t status) txerr =3D priv->read_reg(priv, SJA1000_TXERR); rxerr =3D priv->read_reg(priv, SJA1000_RXERR); =20 - cf->data[6] =3D txerr; - cf->data[7] =3D rxerr; - if (isrc & IRQ_DOI) { /* data overrun interrupt */ netdev_dbg(dev, "data overrun interrupt\n"); @@ -428,6 +425,10 @@ static int sja1000_err(struct net_device *dev, uint8_t= isrc, uint8_t status) else state =3D CAN_STATE_ERROR_ACTIVE; } + if (state !=3D CAN_STATE_BUS_OFF) { + cf->data[6] =3D txerr; + cf->data[7] =3D rxerr; + } if (isrc & IRQ_BEI) { /* bus error interrupt */ priv->can.can_stats.bus_error++; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A18C0C00140 for ; Mon, 15 Aug 2022 19:00:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244787AbiHOTA2 (ORCPT ); Mon, 15 Aug 2022 15:00:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245074AbiHOS4i (ORCPT ); Mon, 15 Aug 2022 14:56:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48B1D2CC87; Mon, 15 Aug 2022 11:31: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 D9FC161043; Mon, 15 Aug 2022 18:31:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C87D1C433C1; Mon, 15 Aug 2022 18:31:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588290; bh=PV0DCN/w6gznVYgw07YsdZ7KKqqykyP06skBcW/arXc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bgIYQE6GpXj4rLMw03U92swR+wqAVg4fe+tCbyOUQJf/oWoIophzOgTem9RkAqTFF iPoN8C2Y6Ok4jyJ9RBbEiGmCnQpPVzR2EIeAA1uyOy960hmt5Y+k3k9N6zzSAKjtTU q9dPx1O1u73VCeKmnBk/ce90PB8ZHw5F86vul/00= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Mailhol , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.15 354/779] can: hi311x: do not report txerr and rxerr during bus-off Date: Mon, 15 Aug 2022 19:59:58 +0200 Message-Id: <20220815180352.368672380@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 a22bd630cfff496b270211745536e50e98eb3a45 ] During bus off, the error count is greater than 255 and can not fit in a u8. Fixes: 57e83fb9b746 ("can: hi311x: Add Holt HI-311x CAN driver") Link: https://lore.kernel.org/all/20220719143550.3681-6-mailhol.vincent@wan= adoo.fr Signed-off-by: Vincent Mailhol Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/can/spi/hi311x.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/can/spi/hi311x.c b/drivers/net/can/spi/hi311x.c index 89d9c986a229..b08b98e6ad1c 100644 --- a/drivers/net/can/spi/hi311x.c +++ b/drivers/net/can/spi/hi311x.c @@ -670,8 +670,6 @@ static irqreturn_t hi3110_can_ist(int irq, void *dev_id) =20 txerr =3D hi3110_read(spi, HI3110_READ_TEC); rxerr =3D hi3110_read(spi, HI3110_READ_REC); - cf->data[6] =3D txerr; - cf->data[7] =3D rxerr; tx_state =3D txerr >=3D rxerr ? new_state : 0; rx_state =3D txerr <=3D rxerr ? new_state : 0; can_change_state(net, cf, tx_state, rx_state); @@ -684,6 +682,9 @@ static irqreturn_t hi3110_can_ist(int irq, void *dev_id) hi3110_hw_sleep(spi); break; } + } else { + cf->data[6] =3D txerr; + cf->data[7] =3D rxerr; } } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 972FCC25B0E for ; Mon, 15 Aug 2022 19:02:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244995AbiHOTAw (ORCPT ); Mon, 15 Aug 2022 15:00:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245092AbiHOS4k (ORCPT ); Mon, 15 Aug 2022 14:56:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02A65326EC; Mon, 15 Aug 2022 11:31:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A57D2B8106C; Mon, 15 Aug 2022 18:31:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F39D4C433D7; Mon, 15 Aug 2022 18:31:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588293; bh=krxEmlAhMWjFuXD+91ae82JjlUXKy2weARJAVJVH2KM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LtJUTRCxzTD1uINaYufDX5iGNr7Hcg5iMk/pZwMeuQet2hFICKg6vt0mZymbDlRmw +XGqqq4qwZQm1hY8dBEy2dw0QpJU2u9oNdA1/G08h8sVFhBt4STksscGQw4paizCbi dAJVzgRElh0XKpv4h1OjDCmovB3TTiT7OhzvDIXE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen-Yu Tsai , Vincent Mailhol , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.15 355/779] can: sun4i_can: do not report txerr and rxerr during bus-off Date: Mon, 15 Aug 2022 19:59:59 +0200 Message-Id: <20220815180352.401450631@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 0ac15a8f661b941519379831d09bfb12271b23ee ] During bus off, the error count is greater than 255 and can not fit in a u8. Fixes: 0738eff14d81 ("can: Allwinner A10/A20 CAN Controller support - Kerne= l module") Link: https://lore.kernel.org/all/20220719143550.3681-7-mailhol.vincent@wan= adoo.fr CC: Chen-Yu Tsai Signed-off-by: Vincent Mailhol Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/can/sun4i_can.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/net/can/sun4i_can.c b/drivers/net/can/sun4i_can.c index 54aa7c25c4de..ad8f50807aca 100644 --- a/drivers/net/can/sun4i_can.c +++ b/drivers/net/can/sun4i_can.c @@ -525,11 +525,6 @@ static int sun4i_can_err(struct net_device *dev, u8 is= rc, u8 status) rxerr =3D (errc >> 16) & 0xFF; txerr =3D errc & 0xFF; =20 - if (skb) { - cf->data[6] =3D txerr; - cf->data[7] =3D rxerr; - } - if (isrc & SUN4I_INT_DATA_OR) { /* data overrun interrupt */ netdev_dbg(dev, "data overrun interrupt\n"); @@ -560,6 +555,10 @@ static int sun4i_can_err(struct net_device *dev, u8 is= rc, u8 status) else state =3D CAN_STATE_ERROR_ACTIVE; } + if (skb && state !=3D CAN_STATE_BUS_OFF) { + cf->data[6] =3D txerr; + cf->data[7] =3D rxerr; + } if (isrc & SUN4I_INT_BUS_ERR) { /* bus error interrupt */ netdev_dbg(dev, "bus error interrupt\n"); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E60FC00140 for ; Mon, 15 Aug 2022 19:07:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245394AbiHOTHN (ORCPT ); Mon, 15 Aug 2022 15:07:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245669AbiHOTCe (ORCPT ); Mon, 15 Aug 2022 15:02:34 -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 2359A4D4CA; Mon, 15 Aug 2022 11:33: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 sin.source.kernel.org (Postfix) with ESMTPS id 0BFA0CE1253; Mon, 15 Aug 2022 18:33:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF894C433C1; Mon, 15 Aug 2022 18:33:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588417; bh=Qd0WN9AbOZnHo0ee9xcyfLl0nqUxk4PoBCVtLLWpov0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iGce04l3QZmxz5b6RV7ff/EpMM87/yL6hrfZXKUJVTetpZMJiJ18IjK40vWzPJula x9PiiNrxbGxkgqolIR37cI3bBQhPL4tT8UwVay7qhz02wkUKAjeGfrHZZNVsaSbFsU 22fbRWyouZHcPSkcfm359w1srOE1VroibAR7MMgE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jimmy Assarsson , Vincent Mailhol , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.15 356/779] can: kvaser_usb_hydra: do not report txerr and rxerr during bus-off Date: Mon, 15 Aug 2022 20:00:00 +0200 Message-Id: <20220815180352.447930198@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 936e90595376e64b6247c72d3ea8b8b164b7ac96 ] During bus off, the error count is greater than 255 and can not fit in a u8. Fixes: aec5fb2268b7 ("can: kvaser_usb: Add support for Kvaser USB hydra fam= ily") Link: https://lore.kernel.org/all/20220719143550.3681-8-mailhol.vincent@wan= adoo.fr CC: Jimmy Assarsson Signed-off-by: Vincent Mailhol Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c b/drivers/ne= t/can/usb/kvaser_usb/kvaser_usb_hydra.c index fce3f069cdbc..93d7ee6d17b6 100644 --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_hydra.c @@ -916,8 +916,10 @@ static void kvaser_usb_hydra_update_state(struct kvase= r_usb_net_priv *priv, new_state < CAN_STATE_BUS_OFF) priv->can.can_stats.restarts++; =20 - cf->data[6] =3D bec->txerr; - cf->data[7] =3D bec->rxerr; + if (new_state !=3D CAN_STATE_BUS_OFF) { + cf->data[6] =3D bec->txerr; + cf->data[7] =3D bec->rxerr; + } =20 stats =3D &netdev->stats; stats->rx_packets++; @@ -1071,8 +1073,10 @@ kvaser_usb_hydra_error_frame(struct kvaser_usb_net_p= riv *priv, shhwtstamps->hwtstamp =3D hwtstamp; =20 cf->can_id |=3D CAN_ERR_BUSERROR; - cf->data[6] =3D bec.txerr; - cf->data[7] =3D bec.rxerr; + if (new_state !=3D CAN_STATE_BUS_OFF) { + cf->data[6] =3D bec.txerr; + cf->data[7] =3D bec.rxerr; + } =20 stats->rx_packets++; stats->rx_bytes +=3D cf->len; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D30EC25B0E for ; Mon, 15 Aug 2022 19:03:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245203AbiHOTDq (ORCPT ); Mon, 15 Aug 2022 15:03:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245190AbiHOS47 (ORCPT ); Mon, 15 Aug 2022 14:56:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E80E448EAB; Mon, 15 Aug 2022 11:32:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4B154B8106E; Mon, 15 Aug 2022 18:32:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78E67C433D7; Mon, 15 Aug 2022 18:31:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588318; bh=pmGhTR49xpJP6eRZfxJ44RAp0EPunMj+LF0Cvr6MHvE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kXndhrkXXfzaJpByH0+4o547WD5bFalkYKsL628VD2bZGVMHcLcLOmy8zGEYDf+VY CVnDDyg6y9VblbfFWd5wPtLy0976WVWXylrcFxNWnh2qf7/Ftix26wSlCoWFQkwfYS FB7ur0EbzIrg4LvojBTlltE1/SpUBJm6pfgZyK5A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jimmy Assarsson , Vincent Mailhol , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.15 357/779] can: kvaser_usb_leaf: do not report txerr and rxerr during bus-off Date: Mon, 15 Aug 2022 20:00:01 +0200 Message-Id: <20220815180352.500916131@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 a57732084e06791d37ea1ea447cca46220737abd ] During bus off, the error count is greater than 255 and can not fit in a u8. Fixes: 7259124eac7d1 ("can: kvaser_usb: Split driver into kvaser_usb_core.c= and kvaser_usb_leaf.c") Link: https://lore.kernel.org/all/20220719143550.3681-9-mailhol.vincent@wan= adoo.fr CC: Jimmy Assarsson Signed-off-by: Vincent Mailhol Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c b/drivers/net= /can/usb/kvaser_usb/kvaser_usb_leaf.c index b9c2231e4b43..05d54c4f929f 100644 --- a/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c +++ b/drivers/net/can/usb/kvaser_usb/kvaser_usb_leaf.c @@ -857,8 +857,10 @@ static void kvaser_usb_leaf_rx_error(const struct kvas= er_usb *dev, break; } =20 - cf->data[6] =3D es->txerr; - cf->data[7] =3D es->rxerr; + if (new_state !=3D CAN_STATE_BUS_OFF) { + cf->data[6] =3D es->txerr; + cf->data[7] =3D es->rxerr; + } =20 stats->rx_packets++; stats->rx_bytes +=3D cf->len; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 667EFC00140 for ; Mon, 15 Aug 2022 19:04:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245330AbiHOTEQ (ORCPT ); Mon, 15 Aug 2022 15:04:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232524AbiHOS6W (ORCPT ); Mon, 15 Aug 2022 14:58:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75C4B4A83D; Mon, 15 Aug 2022 11:32: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 B3CF8B81081; Mon, 15 Aug 2022 18:32:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D877C433C1; Mon, 15 Aug 2022 18:32:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588352; bh=JTRANzMjaPOW8Ur2YW7iccu5qz+t3mRlHrXJ+b2dZcg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=woIop/JXeBjcsD7IkWuFXg0QR42LLNN2NaLpzdfWKJ83LkBHyAx+C0O60VK6J/bnW h1iWFdFBBWLoeBtTYnkn031RKHVoF8bTTFMMnxtnbduTOzOf9BhpeQG0AnLNSyfa6u tPcyVu4nMNw9oxZyTEZuF4QXFipXvb4OvmZtFcRs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Mailhol , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.15 358/779] can: usb_8dev: do not report txerr and rxerr during bus-off Date: Mon, 15 Aug 2022 20:00:02 +0200 Message-Id: <20220815180352.539459225@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 aebe8a2433cd090ccdc222861f44bddb75eb01de ] During bus off, the error count is greater than 255 and can not fit in a u8. Fixes: 0024d8ad1639 ("can: usb_8dev: Add support for USB2CAN interface from= 8 devices") Link: https://lore.kernel.org/all/20220719143550.3681-10-mailhol.vincent@wa= nadoo.fr Signed-off-by: Vincent Mailhol Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/can/usb/usb_8dev.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/can/usb/usb_8dev.c b/drivers/net/can/usb/usb_8dev.c index d4c8f934a1ce..a5dee2ee2465 100644 --- a/drivers/net/can/usb/usb_8dev.c +++ b/drivers/net/can/usb/usb_8dev.c @@ -442,9 +442,10 @@ static void usb_8dev_rx_err_msg(struct usb_8dev_priv *= priv, =20 if (rx_errors) stats->rx_errors++; - - cf->data[6] =3D txerr; - cf->data[7] =3D rxerr; + if (priv->can.state !=3D CAN_STATE_BUS_OFF) { + cf->data[6] =3D txerr; + cf->data[7] =3D rxerr; + } =20 priv->bec.txerr =3D txerr; priv->bec.rxerr =3D rxerr; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22237C00140 for ; Mon, 15 Aug 2022 19:05:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245423AbiHOTFO (ORCPT ); Mon, 15 Aug 2022 15:05:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245360AbiHOTBv (ORCPT ); Mon, 15 Aug 2022 15:01: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 2BDFA4BD1E; Mon, 15 Aug 2022 11:33: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 ED306B8106C; Mon, 15 Aug 2022 18:33:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DF7DC433C1; Mon, 15 Aug 2022 18:33:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588386; bh=jGYDKm0Tw+bfYKYZH5hqWm2mnwiYORDMGSxt/7Z6A0k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e2itnGBRP/8Ps4gyFvhJHG7K7fesmFCpvnKFk+Ta96Buwox2e9+I4cU2x9WN+fdZ4 VNCoS3p2YqKjVX7WULRxpsyfx4CCas5aMe3vdnR9UMUPRIvR5r7/VjS1sgn4cwqanY xov8X/RREU+QZIaHsdjfeXQygfAXmKPjtP9FhVD0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Mailhol , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.15 359/779] can: error: specify the values of data[5..7] of CAN error frames Date: Mon, 15 Aug 2022 20:00:03 +0200 Message-Id: <20220815180352.587551937@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 e70a3263a7eed768d5f947b8f2aff8d2a79c9d97 ] Currently, data[5..7] of struct can_frame, when used as a CAN error frame, are defined as being "controller specific". Device specific behaviours are problematic because it prevents someone from writing code which is portable between devices. As a matter of fact, data[5] is never used, data[6] is always used to report TX error counter and data[7] is always used to report RX error counter. can-utils also relies on this. This patch updates the comment in the uapi header to specify that data[5] is reserved (and thus should not be used) and that data[6..7] are used for error counters. Fixes: 0d66548a10cb ("[CAN]: Add PF_CAN core module") Link: https://lore.kernel.org/all/20220719143550.3681-11-mailhol.vincent@wa= nadoo.fr Signed-off-by: Vincent Mailhol Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- include/uapi/linux/can/error.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/can/error.h b/include/uapi/linux/can/error.h index 34633283de64..a1000cb63063 100644 --- a/include/uapi/linux/can/error.h +++ b/include/uapi/linux/can/error.h @@ -120,6 +120,9 @@ #define CAN_ERR_TRX_CANL_SHORT_TO_GND 0x70 /* 0111 0000 */ #define CAN_ERR_TRX_CANL_SHORT_TO_CANH 0x80 /* 1000 0000 */ =20 -/* controller specific additional information / data[5..7] */ +/* data[5] is reserved (do not use) */ + +/* TX error counter / data[6] */ +/* RX error counter / data[7] */ =20 #endif /* _UAPI_CAN_ERROR_H */ --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8BC4C00140 for ; Mon, 15 Aug 2022 19:06:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245466AbiHOTFj (ORCPT ); Mon, 15 Aug 2022 15:05:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245477AbiHOTCJ (ORCPT ); Mon, 15 Aug 2022 15: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 D41834C61F; Mon, 15 Aug 2022 11:33: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 6B757610A5; Mon, 15 Aug 2022 18:33:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59B0FC4347C; Mon, 15 Aug 2022 18:33:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588398; bh=5UDTB5oRrpIWgtYefT1GAb2JQyq7hd543v1XzvjHopk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hFZ7Zx3sj6gWnm3+X15AeQ/M3J5u4mb66tRs+oItQgOUo2fpPEAGFNtcnMZX9tgT1 jK/d8vHY4PUCISfFUuIe9gJyaCDmEB7ahmSCJAk45YwoGKc2OOJOu4fDGcrka1+4AK VukMOlAc3MQm4epRkQHAuHiBvEg4r7ge/ZUERJoo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Vincent Mailhol , Marc Kleine-Budde , Sasha Levin Subject: [PATCH 5.15 360/779] can: pch_can: pch_can_error(): initialize errc before using it Date: Mon, 15 Aug 2022 20:00:04 +0200 Message-Id: <20220815180352.626529057@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 9950f11211331180269867aef848c7cf56861742 ] After commit 3a5c7e4611dd, the variable errc is accessed before being initialized, c.f. below W=3D2 warning: | In function 'pch_can_error', | inlined from 'pch_can_poll' at drivers/net/can/pch_can.c:739:4: | drivers/net/can/pch_can.c:501:29: warning: 'errc' may be used uninitializ= ed [-Wmaybe-uninitialized] | 501 | cf->data[6] =3D errc & PCH_TEC; | | ^ | drivers/net/can/pch_can.c: In function 'pch_can_poll': | drivers/net/can/pch_can.c:484:13: note: 'errc' was declared here | 484 | u32 errc, lec; | | ^~~~ Moving errc initialization up solves this issue. Fixes: 3a5c7e4611dd ("can: pch_can: do not report txerr and rxerr during bu= s-off") Reported-by: Nathan Chancellor Signed-off-by: Vincent Mailhol Reviewed-by: Nathan Chancellor Link: https://lore.kernel.org/all/20220721160032.9348-1-mailhol.vincent@wan= adoo.fr Signed-off-by: Marc Kleine-Budde Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/can/pch_can.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/can/pch_can.c b/drivers/net/can/pch_can.c index f20e75eb1ce0..cd8d536c6fb2 100644 --- a/drivers/net/can/pch_can.c +++ b/drivers/net/can/pch_can.c @@ -489,6 +489,7 @@ static void pch_can_error(struct net_device *ndev, u32 = status) if (!skb) return; =20 + errc =3D ioread32(&priv->regs->errc); if (status & PCH_BUS_OFF) { pch_can_set_tx_all(priv, 0); pch_can_set_rx_all(priv, 0); @@ -501,7 +502,6 @@ static void pch_can_error(struct net_device *ndev, u32 = status) cf->data[7] =3D (errc & PCH_REC) >> 8; } =20 - errc =3D ioread32(&priv->regs->errc); /* Warning interrupt. */ if (status & PCH_EWARN) { state =3D CAN_STATE_ERROR_WARNING; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EE79C25B0E for ; Mon, 15 Aug 2022 19:06:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245484AbiHOTFn (ORCPT ); Mon, 15 Aug 2022 15:05:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245526AbiHOTCR (ORCPT ); Mon, 15 Aug 2022 15:02:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E4E933E30; Mon, 15 Aug 2022 11:33: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 2748CB8105C; Mon, 15 Aug 2022 18:33:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AB3DC433C1; Mon, 15 Aug 2022 18:33:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588401; bh=8TplkGd97N18pN9xdr3NQUO0P7WdvSM5cJZ6n9xVWmU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Up/1Vk+9BU1uphqQM/iS3u5520owWz1j/5mJk3FK5dkSRdzAlteylCMUVZKbYYHbB 3okI4YZy96YFMUAqTV7U1U5Zk41N/sUhrNmImuGHH43VfW+hiCPQ5fjGGhFjuH6tZt 8K9Bb0pc9ztXBpaf50e7FW8J8qHhefDZ7hDE7Dy4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Marcel Holtmann , Sasha Levin Subject: [PATCH 5.15 361/779] Bluetooth: hci_intel: Add check for platform_driver_register Date: Mon, 15 Aug 2022 20:00:05 +0200 Message-Id: <20220815180352.668150891@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiasheng Jiang [ Upstream commit ab2d2a982ff721f4b029282d9a40602ea46a745e ] As platform_driver_register() could fail, it should be better to deal with the return value in order to maintain the code consisitency. Fixes: 1ab1f239bf17 ("Bluetooth: hci_intel: Add support for platform driver= ") Signed-off-by: Jiasheng Jiang Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/bluetooth/hci_intel.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/bluetooth/hci_intel.c b/drivers/bluetooth/hci_intel.c index 7249b91d9b91..78afb9a348e7 100644 --- a/drivers/bluetooth/hci_intel.c +++ b/drivers/bluetooth/hci_intel.c @@ -1217,7 +1217,11 @@ static struct platform_driver intel_driver =3D { =20 int __init intel_init(void) { - platform_driver_register(&intel_driver); + int err; + + err =3D platform_driver_register(&intel_driver); + if (err) + return err; =20 return hci_uart_register_proto(&intel_proto); } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3E439C3F6B0 for ; Mon, 15 Aug 2022 19:06:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245532AbiHOTFs (ORCPT ); Mon, 15 Aug 2022 15:05:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245540AbiHOTCS (ORCPT ); Mon, 15 Aug 2022 15: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 D0B5D4D143; Mon, 15 Aug 2022 11:33:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 403C4B8106E; Mon, 15 Aug 2022 18:33:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 896F8C433C1; Mon, 15 Aug 2022 18:33:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588405; bh=vYKQ+tCX8WDdMfseVHQsF3kvwn3B0p/f7dOk+AcTaPc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TGsnAQCWrQUjz3+/1poSwLls6us6OELeZcSbwY0P70YgoAUebtQiOg3MUDWcYEOif zHS465s+Fh75hzUOQqux6qPSkbS3+MkDYFkudECNuHJDhm0q/dQm7J/SFgoKrOPPRU JAP+Fzku8LZJ+IifGAxjv1K6t6rkAzh4tnzrniCI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lars-Peter Clausen , Shubhrajyoti Datta , Wolfram Sang , Sasha Levin Subject: [PATCH 5.15 362/779] i2c: cadence: Support PEC for SMBus block read Date: Mon, 15 Aug 2022 20:00:06 +0200 Message-Id: <20220815180352.714268192@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lars-Peter Clausen [ Upstream commit 9fdf6d97f03035ad5298e2d1635036c74c2090ed ] SMBus packet error checking (PEC) is implemented by appending one additional byte of checksum data at the end of the message. This provides additional protection and allows to detect data corruption on the I2C bus. SMBus block reads support variable length reads. The first byte in the read message is the number of available data bytes. The combination of PEC and block read is currently not supported by the Cadence I2C driver. * When PEC is enabled the maximum transfer length for block reads increases from 33 to 34 bytes. * The I2C core smbus emulation layer relies on the driver updating the `i2c_msg` `len` field with the number of received bytes. The updated length is used when checking the PEC. Add support to the Cadence I2C driver for handling SMBus block reads with PEC. To determine the maximum transfer length uses the initial `len` value of the `i2c_msg`. When PEC is enabled this will be 2, when it is disabled it will be 1. Once a read transfer is done also increment the `len` field by the amount of received data bytes. This change has been tested with a UCM90320 PMBus power monitor, which requires block reads to access certain data fields, but also has PEC enabled by default. Fixes: df8eb5691c48 ("i2c: Add driver for Cadence I2C controller") Signed-off-by: Lars-Peter Clausen Tested-by: Shubhrajyoti Datta Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/i2c/busses/i2c-cadence.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cade= nce.c index 630cfa4ddd46..33f5588a50c0 100644 --- a/drivers/i2c/busses/i2c-cadence.c +++ b/drivers/i2c/busses/i2c-cadence.c @@ -573,8 +573,13 @@ static void cdns_i2c_mrecv(struct cdns_i2c *id) ctrl_reg =3D cdns_i2c_readreg(CDNS_I2C_CR_OFFSET); ctrl_reg |=3D CDNS_I2C_CR_RW | CDNS_I2C_CR_CLR_FIFO; =20 + /* + * Receive up to I2C_SMBUS_BLOCK_MAX data bytes, plus one message length + * byte, plus one checksum byte if PEC is enabled. p_msg->len will be 2 if + * PEC is enabled, otherwise 1. + */ if (id->p_msg->flags & I2C_M_RECV_LEN) - id->recv_count =3D I2C_SMBUS_BLOCK_MAX + 1; + id->recv_count =3D I2C_SMBUS_BLOCK_MAX + id->p_msg->len; =20 id->curr_recv_count =3D id->recv_count; =20 @@ -789,6 +794,9 @@ static int cdns_i2c_process_msg(struct cdns_i2c *id, st= ruct i2c_msg *msg, if (id->err_status & CDNS_I2C_IXR_ARB_LOST) return -EAGAIN; =20 + if (msg->flags & I2C_M_RECV_LEN) + msg->len +=3D min_t(unsigned int, msg->buf[0], I2C_SMBUS_BLOCK_MAX); + return 0; } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E052C25B08 for ; Mon, 15 Aug 2022 19:06:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245582AbiHOTFy (ORCPT ); Mon, 15 Aug 2022 15:05:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245566AbiHOTCW (ORCPT ); Mon, 15 Aug 2022 15:02: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 D586933436; Mon, 15 Aug 2022 11:33: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 5A80EB81081; Mon, 15 Aug 2022 18:33:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1065C433C1; Mon, 15 Aug 2022 18:33:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588408; bh=GOWshVnBwy6EwloCgplMH55chcLT2EZdBYc4L1saBCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QjybJC5claaT44IqMOsmFiw5kQR+Tb81WCaWUx57Uk1qmYruyQh0CjRZ7ydR1pE+k T12qReVfcO0I7TQ/gn6UMJ9ZoxplUiRXOkY/FytSRHDHgldZ3kt9mmMM5G9JjNGCOz JGJKjQvwtQNPL7DmlVYvqrL5ZhvmvqX9qw//dDKA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Peter Rosin , Wolfram Sang , Sasha Levin Subject: [PATCH 5.15 363/779] i2c: mux-gpmux: Add of_node_put() when breaking out of loop Date: Mon, 15 Aug 2022 20:00:07 +0200 Message-Id: <20220815180352.756604330@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 6435319c34704994e19b0767f6a4e6f37439867b ] In i2c_mux_probe(), we should call of_node_put() when breaking out of for_each_child_of_node() which will automatically increase and decrease the refcount. Fixes: ac8498f0ce53 ("i2c: i2c-mux-gpmux: new driver") Signed-off-by: Liang He Acked-by: Peter Rosin Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/i2c/muxes/i2c-mux-gpmux.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/i2c/muxes/i2c-mux-gpmux.c b/drivers/i2c/muxes/i2c-mux-= gpmux.c index d3acd8d66c32..33024acaac02 100644 --- a/drivers/i2c/muxes/i2c-mux-gpmux.c +++ b/drivers/i2c/muxes/i2c-mux-gpmux.c @@ -134,6 +134,7 @@ static int i2c_mux_probe(struct platform_device *pdev) return 0; =20 err_children: + of_node_put(child); i2c_mux_del_adapters(muxc); err_parent: i2c_put_adapter(parent); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 440CEC25B0E for ; Mon, 15 Aug 2022 19:07:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245219AbiHOTHE (ORCPT ); Mon, 15 Aug 2022 15:07:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245606AbiHOTC0 (ORCPT ); Mon, 15 Aug 2022 15:02:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DDF64D165; Mon, 15 Aug 2022 11:33:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 87798B8105D; Mon, 15 Aug 2022 18:33:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B90F8C433D6; Mon, 15 Aug 2022 18:33:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588411; bh=AZWjm2x8zpKJXfI6zI6/Cj794cVBbJ4zC6s5gwi7uz0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WBnBtTsueU/q4NwyNbe8TLuP8YdkVbQnpSEn5DItNGebPaQlSeA75vUk3k7izO7TQ RtNQmdVmuROIf+I75cb52Nemppz3HZMhexkJJ6ziwSBXB/REZ9bIvvm+L54RKlJ+VF OCK9r6Q3dVa/++H16nlf6XIiTnuRoKxqwJJIR5Eo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , kernel test robot , Ammar Faizi , Kalle Valo , Sasha Levin Subject: [PATCH 5.15 364/779] wifi: wil6210: debugfs: fix uninitialized variable use in `wil_write_file_wmi()` Date: Mon, 15 Aug 2022 20:00:08 +0200 Message-Id: <20220815180352.795448181@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 [ Upstream commit d578e0af3a003736f6c440188b156483d451b329 ] Commit 7a4836560a61 changes simple_write_to_buffer() with memdup_user() but it forgets to change the value to be returned that came from simple_write_to_buffer() call. It results in the following warning: warning: variable 'rc' is uninitialized when used here [-Wuninitialized] return rc; ^~ Remove rc variable and just return the passed in length if the memdup_user() succeeds. Cc: Dan Carpenter Reported-by: kernel test robot Fixes: 7a4836560a6198d245d5732e26f94898b12eb760 ("wifi: wil6210: debugfs: f= ix info leak in wil_write_file_wmi()") Fixes: ff974e4083341383d3dd4079e52ed30f57f376f0 ("wil6210: debugfs interfac= e to send raw WMI command") Signed-off-by: Ammar Faizi Reviewed-by: Dan Carpenter Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220724202452.61846-1-ammar.faizi@intel.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/wireless/ath/wil6210/debugfs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/wil6210/debugfs.c b/drivers/net/wirel= ess/ath/wil6210/debugfs.c index c6f8254cb21d..ac7787e1a7f6 100644 --- a/drivers/net/wireless/ath/wil6210/debugfs.c +++ b/drivers/net/wireless/ath/wil6210/debugfs.c @@ -1010,7 +1010,7 @@ static ssize_t wil_write_file_wmi(struct file *file, = const char __user *buf, void *cmd; int cmdlen =3D len - sizeof(struct wmi_cmd_hdr); u16 cmdid; - int rc, rc1; + int rc1; =20 if (cmdlen < 0 || *ppos !=3D 0) return -EINVAL; @@ -1027,7 +1027,7 @@ static ssize_t wil_write_file_wmi(struct file *file, = const char __user *buf, =20 wil_info(wil, "0x%04x[%d] -> %d\n", cmdid, cmdlen, rc1); =20 - return rc; + return len; } =20 static const struct file_operations fops_wmi =3D { --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E825C25B0E for ; Mon, 15 Aug 2022 19:07:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245299AbiHOTHI (ORCPT ); Mon, 15 Aug 2022 15:07:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245623AbiHOTC2 (ORCPT ); Mon, 15 Aug 2022 15:02:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CFDD14D172; Mon, 15 Aug 2022 11:33: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 DCF6761043; Mon, 15 Aug 2022 18:33:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E686BC433C1; Mon, 15 Aug 2022 18:33:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588414; bh=zbMaZtBiQRbwr/E8U3j7sNCx/+3EbBrLW62H8jk6Owc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dvzXRJ38j/CLNm/Dq2DDhv9w3gPHUrVf0ZgeCcJ+kPb/QnB5QIa0OdFOjO0OcvDYI GAedT4DrDp2aoEipH/Eie1rsRtwJebr/Xe7M2u7fjEtZ1qPd3S0M2iIMYKfKX5D6Pa ActICwrSBt8TCJjZZYndk3L0dq3If3WicfjvJhNc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takayuki Nagata , Petr Stourac , Jose Ignacio Tornos Martinez , Kalle Valo , Sasha Levin Subject: [PATCH 5.15 365/779] wifi: iwlwifi: mvm: fix double list_add at iwl_mvm_mac_wake_tx_queue Date: Mon, 15 Aug 2022 20:00:09 +0200 Message-Id: <20220815180352.846319225@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jose Ignacio Tornos Martinez [ Upstream commit 14a3aacf517a9de725dd3219dbbcf741e31763c4 ] After successfull station association, if station queues are disabled for some reason, the related lists are not emptied. So if some new element is added to the list in iwl_mvm_mac_wake_tx_queue, it can match with the old one and produce a BUG like this: [ 46.535263] list_add corruption. prev->next should be next (ffff94c1c318= a360), but was 0000000000000000. (prev=3Dffff94c1d02d3388). [ 46.535283] ------------[ cut here ]------------ [ 46.535284] kernel BUG at lib/list_debug.c:26! [ 46.535290] invalid opcode: 0000 [#1] PREEMPT SMP PTI [ 46.585304] CPU: 0 PID: 623 Comm: wpa_supplicant Not tainted 5.19.0-rc3+= #1 [ 46.592380] Hardware name: Dell Inc. Inspiron 660s/0478VN , BIOS A= 07 08/24/2012 [ 46.600336] RIP: 0010:__list_add_valid.cold+0x3d/0x3f [ 46.605475] Code: f2 4c 89 c1 48 89 fe 48 c7 c7 c8 40 67 93 e8 20 cc fd = ff 0f 0b 48 89 d1 4c 89 c6 4c 89 ca 48 c7 c7 70 40 67 93 e8 09 cc fd ff <0f= > 0b 48 89 fe 48 c7 c7 00 41 67 93 e8 f8 cb fd ff 0f 0b 48 89 d1 [ 46.624469] RSP: 0018:ffffb20800ab76d8 EFLAGS: 00010286 [ 46.629854] RAX: 0000000000000075 RBX: ffff94c1c318a0e0 RCX: 00000000000= 00000 [ 46.637105] RDX: 0000000000000201 RSI: ffffffff9365e100 RDI: 00000000fff= fffff [ 46.644356] RBP: ffff94c1c5f43370 R08: 0000000000000075 R09: 30643163343= 96666 [ 46.651607] R10: 3364323064316334 R11: 39666666663d7665 R12: ffff94c1c5f= 43388 [ 46.658857] R13: ffff94c1d02d3388 R14: ffff94c1c318a360 R15: ffff94c1cf2= 289c0 [ 46.666108] FS: 00007f65634ff7c0(0000) GS:ffff94c1da200000(0000) knlGS:= 0000000000000000 [ 46.674331] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 46.680170] CR2: 00007f7dfe984460 CR3: 000000010e894003 CR4: 00000000000= 606f0 [ 46.687422] Call Trace: [ 46.689906] [ 46.691950] iwl_mvm_mac_wake_tx_queue+0xec/0x15c [iwlmvm] [ 46.697601] ieee80211_queue_skb+0x4b3/0x720 [mac80211] [ 46.702973] ? sta_info_get+0x46/0x60 [mac80211] [ 46.707703] ieee80211_tx+0xad/0x110 [mac80211] [ 46.712355] __ieee80211_tx_skb_tid_band+0x71/0x90 [mac80211] ... In order to avoid this problem, we must also remove the related lists when station queues are disabled. Fixes: cfbc6c4c5b91c ("iwlwifi: mvm: support mac80211 TXQs model") Reported-by: Takayuki Nagata Reported-by: Petr Stourac Tested-by: Petr Stourac Signed-off-by: Jose Ignacio Tornos Martinez Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220719153542.81466-1-jtornosm@redhat.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wir= eless/intel/iwlwifi/mvm/sta.c index a64874c05ced..1bb456daff9e 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c @@ -1794,6 +1794,7 @@ static void iwl_mvm_disable_sta_queues(struct iwl_mvm= *mvm, iwl_mvm_txq_from_mac80211(sta->txq[i]); =20 mvmtxq->txq_id =3D IWL_MVM_INVALID_QUEUE; + list_del_init(&mvmtxq->list); } } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10EE5C00140 for ; Mon, 15 Aug 2022 19:03:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245250AbiHOTDt (ORCPT ); Mon, 15 Aug 2022 15:03:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245201AbiHOS5A (ORCPT ); Mon, 15 Aug 2022 14:57:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B5F932EC4; Mon, 15 Aug 2022 11:32:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 56AA3B81085; Mon, 15 Aug 2022 18:32:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 963D5C433C1; Mon, 15 Aug 2022 18:32:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588322; bh=GuioARgipAjckdAdajthvc005UG73r+y/SYqcn3+24w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cxmwmtRXOAztLvZuK5KFD5VGNoqoiEG6wJO6HJ2TKrjjQUMggLviiiiYzLfDA5qY2 aAIrn3ggHaRlJ2eK5mBD0LrTTTrJvqn0D7SBgmthi1MA6WVo9fm11Fk5GhCI+9ZPOS 1HGsYpMGxiwbY06KtUU5rWFGeXW4AfrJ+vqn0riE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangyu Hua , Kalle Valo , Sasha Levin Subject: [PATCH 5.15 366/779] wifi: libertas: Fix possible refcount leak in if_usb_probe() Date: Mon, 15 Aug 2022 20:00:10 +0200 Message-Id: <20220815180352.894143878@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 6fd57e1d120bf13d4dc6c200a7cf914e6347a316 ] usb_get_dev will be called before lbs_get_firmware_async which means that usb_put_dev need to be called when lbs_get_firmware_async fails. Fixes: ce84bb69f50e ("libertas USB: convert to asynchronous firmware loadin= g") Signed-off-by: Hangyu Hua Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220620092350.39960-1-hbh25y@gmail.com Link: https://lore.kernel.org/r/20220622113402.16969-1-colin.i.king@gmail.c= om Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/wireless/marvell/libertas/if_usb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/marvell/libertas/if_usb.c b/drivers/net/w= ireless/marvell/libertas/if_usb.c index 5d6dc1dd050d..32fdc4150b60 100644 --- a/drivers/net/wireless/marvell/libertas/if_usb.c +++ b/drivers/net/wireless/marvell/libertas/if_usb.c @@ -287,6 +287,7 @@ static int if_usb_probe(struct usb_interface *intf, return 0; =20 err_get_fw: + usb_put_dev(udev); lbs_remove_card(priv); err_add_card: if_usb_reset_device(cardp); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38C5BC00140 for ; Mon, 15 Aug 2022 19:02:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242622AbiHOTCm (ORCPT ); Mon, 15 Aug 2022 15:02:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245219AbiHOS5C (ORCPT ); Mon, 15 Aug 2022 14:57:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DC8148EB6; Mon, 15 Aug 2022 11:32: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 B14BA61070; Mon, 15 Aug 2022 18:32:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C4C0C433C1; Mon, 15 Aug 2022 18:32:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588325; bh=IHCGDqu5bwcqLCvp1VkhijS+mn/FWgB8orbf0bZ0ZjI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jSE6Z5EOcnIeGUGXe9FdvbKsvqM8OM09FQ2PTIsPrH0oKfvw08ysDzy7rT+4Zpiy+ VcjdjDwcCjGBV0gV3R96KbH72V+7bb7oGFkIE9y1CwlzJCvxncZrf79OlUEjZnJHGN tWk6mZRmeL6XoBkmM5O7ikKd/++36i80ggBsXodk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jernej Skrabec , Ezequiel Garcia , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.15 367/779] media: cedrus: hevc: Add check for invalid timestamp Date: Mon, 15 Aug 2022 20:00:11 +0200 Message-Id: <20220815180352.941967383@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jernej Skrabec [ Upstream commit 143201a6435bf65f0115435e9dc6d95c66b908e9 ] Not all DPB entries will be used most of the time. Unused entries will thus have invalid timestamps. They will produce negative buffer index which is not specifically handled. This works just by chance in current code. It will even produce bogus pointer, but since it's not used, it won't do any harm. Let's fix that brittle design by skipping writing DPB entry altogether if timestamp is invalid. Fixes: 86caab29da78 ("media: cedrus: Add HEVC/H.265 decoding support") Signed-off-by: Jernej Skrabec Reviewed-by: Ezequiel Garcia Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/staging/media/sunxi/cedrus/cedrus_h265.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c b/drivers/sta= ging/media/sunxi/cedrus/cedrus_h265.c index f2cec43fd1f0..830cae03fc6e 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus_h265.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus_h265.c @@ -147,6 +147,9 @@ static void cedrus_h265_frame_info_write_dpb(struct ced= rus_ctx *ctx, dpb[i].pic_order_cnt[1] }; =20 + if (buffer_index < 0) + continue; + cedrus_h265_frame_info_write_single(ctx, i, dpb[i].field_pic, pic_order_cnt, buffer_index); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F68FC3F6B0 for ; Mon, 15 Aug 2022 19:02:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242171AbiHOTCr (ORCPT ); Mon, 15 Aug 2022 15:02:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245232AbiHOS5D (ORCPT ); Mon, 15 Aug 2022 14:57: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 312C0326F2; Mon, 15 Aug 2022 11:32:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7E127B8106C; Mon, 15 Aug 2022 18:32:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADA3AC43143; Mon, 15 Aug 2022 18:32:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588328; bh=BzYeuORAkJHPCD80V8MI5zoA/RwoFsTPI8noqeq6Vdg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g1ySNgQ3SJSaSmnb7cqjXv8/KyHcNBopp0hYGYLbCypyRNwk8coP4RLLDkWK/KR4g uo8sfc8XxV3IsOUyq0AZoeyTQm6+JgLCyin2CA0Ky+O2aUoV4onZEe6vQhOSZkEJrt SOhXlNOyMs4Mk7pbtOwQiLbu+ya+y+eIsy3WFec8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gal Pressman , Tariq Toukan , Maxim Mikityanskiy , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.15 368/779] net/mlx5e: Remove WARN_ON when trying to offload an unsupported TLS cipher/version Date: Mon, 15 Aug 2022 20:00:12 +0200 Message-Id: <20220815180352.981767985@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Gal Pressman [ Upstream commit 115d9f95ea7ab780ef315dc356bebba2e07cb731 ] The driver reports whether TX/RX TLS device offloads are supported, but not which ciphers/versions, these should be handled by returning -EOPNOTSUPP when .tls_dev_add() is called. Remove the WARN_ON kernel trace when the driver gets a request to offload a cipher/version that is not supported as it is expected. Fixes: d2ead1f360e8 ("net/mlx5e: Add kTLS TX HW offload support") Signed-off-by: Gal Pressman Reviewed-by: Tariq Toukan Reviewed-by: Maxim Mikityanskiy Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c b/driv= ers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c index d93aadbf10da..90ea78239d40 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ktls.c @@ -16,7 +16,7 @@ static int mlx5e_ktls_add(struct net_device *netdev, stru= ct sock *sk, struct mlx5_core_dev *mdev =3D priv->mdev; int err; =20 - if (WARN_ON(!mlx5e_ktls_type_check(mdev, crypto_info))) + if (!mlx5e_ktls_type_check(mdev, crypto_info)) return -EOPNOTSUPP; =20 if (direction =3D=3D TLS_OFFLOAD_CTX_DIR_TX) --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E09ECC3F6B0 for ; Mon, 15 Aug 2022 19:03:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244961AbiHOTDD (ORCPT ); Mon, 15 Aug 2022 15:03:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245246AbiHOS5F (ORCPT ); Mon, 15 Aug 2022 14:57: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 D9E02491DF; Mon, 15 Aug 2022 11:32: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 7AE18B8106C; Mon, 15 Aug 2022 18:32:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE4E2C433C1; Mon, 15 Aug 2022 18:32:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588331; bh=LRGjQFW/Bt1RPM33pZ/m6sE7bB45yhugFQvUegs7WBc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JPVmeQ2AzJI0383/Kk4Vd6Pysvdv0FUWMW12Cblo9u9Mc6Es6psGwcy6pLPipr1Qq fPhAboGTZaTgG9zYIVeQZ/Q9SCnbmsJ8w23bTS3y8Is3ZeOcpzXdhj8RknYocN2o3U JUnIZWDtG9Qsn/2ottI7ItrWK+aXuRty7sFmG+bQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Mikityanskiy , Tariq Toukan , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.15 369/779] net/mlx5e: Fix the value of MLX5E_MAX_RQ_NUM_MTTS Date: Mon, 15 Aug 2022 20:00:13 +0200 Message-Id: <20220815180353.031228453@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maxim Mikityanskiy [ Upstream commit 562696c3c62c7c23dd896e9447252ce9268cb812 ] MLX5E_MAX_RQ_NUM_MTTS should be the maximum value, so that MLX5_MTT_OCTW(MLX5E_MAX_RQ_NUM_MTTS) fits into u16. The current value of 1 << 17 results in MLX5_MTT_OCTW(1 << 17) =3D 1 << 16, which doesn't fit into u16. This commit replaces it with the maximum value that still fits u16. Fixes: 73281b78a37a ("net/mlx5e: Derive Striding RQ size from MTU") Signed-off-by: Maxim Mikityanskiy Reviewed-by: Tariq Toukan Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/ethernet/mellanox/mlx5/core/en.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/eth= ernet/mellanox/mlx5/core/en.h index 7204bc86e474..c22a38e5337b 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h @@ -103,7 +103,7 @@ struct page_pool; #define MLX5E_REQUIRED_WQE_MTTS (MLX5_ALIGN_MTTS(MLX5_MPWRQ_PAGES_PER_WQE= + 1)) #define MLX5E_REQUIRED_MTTS(wqes) (wqes * MLX5E_REQUIRED_WQE_MTTS) #define MLX5E_MAX_RQ_NUM_MTTS \ - ((1 << 16) * 2) /* So that MLX5_MTT_OCTW(num_mtts) fits into u16 */ + (ALIGN_DOWN(U16_MAX, 4) * 2) /* So that MLX5_MTT_OCTW(num_mtts) fits into= u16 */ #define MLX5E_ORDER2_MAX_PACKET_MTU (order_base_2(10 * 1024)) #define MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE_MPW \ (ilog2(MLX5E_MAX_RQ_NUM_MTTS / MLX5E_REQUIRED_WQE_MTTS)) --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14532C28B2B for ; Mon, 15 Aug 2022 19:02:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244852AbiHOTCy (ORCPT ); Mon, 15 Aug 2022 15:02:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245249AbiHOS5G (ORCPT ); Mon, 15 Aug 2022 14:57:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C93BB32ED8; Mon, 15 Aug 2022 11:32: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 DFC9760EEB; Mon, 15 Aug 2022 18:32:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4A09C433C1; Mon, 15 Aug 2022 18:32:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588334; bh=2uZLLptTm77IE4uWUceIMXb7uuydT0vGoKCyD9yiZkg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bvRpEUOZQSgnNNpEdPENH8OZma+pDwiHYtzvslt/3hy1tDzj8zXeaVJ0tP9v5NooZ IpoGqdzl+YWZznCSppbD8XXW9PojukQOoh7vf1YotO5FyauKaKNrm8wGs07YMWCGll 64bG/ZMvWPmvMRhTZ3kPpdwChcZFCpHo9iovgedo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maher Sanalla , Maor Gottlieb , Saeed Mahameed , Sasha Levin Subject: [PATCH 5.15 370/779] net/mlx5: Adjust log_max_qp to be 18 at most Date: Mon, 15 Aug 2022 20:00:14 +0200 Message-Id: <20220815180353.077646240@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maher Sanalla [ Upstream commit a6e9085d791f8306084fd5bc44dd3fdd4e1ac27b ] The cited commit limited log_max_qp to be 17 due to FW capabilities. Recently, it turned out that there are old FW versions that supported more than 17, so the cited commit caused a degradation. Thus, set the maximum log_max_qp back to 18 as it was before the cited commit. Fixes: 7f839965b2d7 ("net/mlx5: Update log_max_qp value to be 17 at most") Signed-off-by: Maher Sanalla Reviewed-by: Maor Gottlieb Signed-off-by: Saeed Mahameed Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/ethernet/mellanox/mlx5/core/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/e= thernet/mellanox/mlx5/core/main.c index 4ed740994279..5a6606c843ed 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c @@ -516,7 +516,7 @@ static int handle_hca_cap(struct mlx5_core_dev *dev, vo= id *set_ctx) =20 /* Check log_max_qp from HCA caps to set in current profile */ if (prof->log_max_qp =3D=3D LOG_MAX_SUPPORTED_QPS) { - prof->log_max_qp =3D min_t(u8, 17, MLX5_CAP_GEN_MAX(dev, log_max_qp)); + prof->log_max_qp =3D min_t(u8, 18, MLX5_CAP_GEN_MAX(dev, log_max_qp)); } else if (MLX5_CAP_GEN_MAX(dev, log_max_qp) < prof->log_max_qp) { mlx5_core_warn(dev, "log_max_qp value in current profile is %d, changing= it to HCA capability limit (%d)\n", prof->log_max_qp, --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01FECC28B2B for ; Mon, 15 Aug 2022 19:03:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245004AbiHOTDG (ORCPT ); Mon, 15 Aug 2022 15:03:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245298AbiHOS5L (ORCPT ); Mon, 15 Aug 2022 14:57:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70BCE49B51; Mon, 15 Aug 2022 11:32: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 97E57B8107A; Mon, 15 Aug 2022 18:32:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1FB6C433D6; Mon, 15 Aug 2022 18:32:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588337; bh=70ihzHdaa0U9BhqBj0wzWZsZcC9BnrOnx85aHESZwOY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FB0E5kTLqmRaTHjsS1Br/DdTdAjruwVJjB9NLAYaMCt95WMQHI3cFWL9RnkpwgT7p aW/2qD3w8UET20fX+IkWUVxPXcvQyYHjUZKHNsJ1HOB96DgdqEhKEgJ1aXidMRcHo4 yb429XjOHDdvz6nbMQmsT3FFJztP00olt7V4RfDo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhengchao Shao , Herbert Xu , Sasha Levin Subject: [PATCH 5.15 371/779] crypto: hisilicon/hpre - dont use GFP_KERNEL to alloc mem during softirq Date: Mon, 15 Aug 2022 20:00:15 +0200 Message-Id: <20220815180353.125040549@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhengchao Shao [ Upstream commit 98dfa9343f37bdd4112966292751e3a93aaf2e56 ] The hpre encryption driver may be used to encrypt and decrypt packets during the rx softirq, it is not allowed to use GFP_KERNEL. Fixes: c8b4b477079d ("crypto: hisilicon - add HiSilicon HPRE accelerator") Signed-off-by: Zhengchao Shao Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/crypto/hisilicon/hpre/hpre_crypto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/hisilicon/hpre/hpre_crypto.c b/drivers/crypto/h= isilicon/hpre/hpre_crypto.c index 7ba7641723a0..4062251fd1b6 100644 --- a/drivers/crypto/hisilicon/hpre/hpre_crypto.c +++ b/drivers/crypto/hisilicon/hpre/hpre_crypto.c @@ -252,7 +252,7 @@ static int hpre_prepare_dma_buf(struct hpre_asym_reques= t *hpre_req, if (unlikely(shift < 0)) return -EINVAL; =20 - ptr =3D dma_alloc_coherent(dev, ctx->key_sz, tmp, GFP_KERNEL); + ptr =3D dma_alloc_coherent(dev, ctx->key_sz, tmp, GFP_ATOMIC); if (unlikely(!ptr)) return -ENOMEM; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D197C00140 for ; Mon, 15 Aug 2022 19:03:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233014AbiHOTDy (ORCPT ); Mon, 15 Aug 2022 15:03:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245313AbiHOS5N (ORCPT ); Mon, 15 Aug 2022 14:57: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 A435532EEE; Mon, 15 Aug 2022 11:32:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B16DFB81074; Mon, 15 Aug 2022 18:32:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EDCD8C433D6; Mon, 15 Aug 2022 18:32:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588340; bh=E9Bqs6DXdhLdrqZtlcaeECpgCsSG1vqbp0DxY58K9A8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WdYuKQxIim8IgKFZIPjDgSUV6H/MMmWEObTv/520DxgInzQ6K9ZJTiHOemtXPXfC/ YipN2Mn0iaDKpwdmLn7h3qIYLHjPfvbzyOvNMRDXKHP48YhsyO9/Ux26TQPhzsez7E PB9VsurB/xQ6A8k4njgXFRg+lfuIebQ+mojHwhd8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Pali=20Roh=C3=A1r?= , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Herbert Xu , Sasha Levin Subject: [PATCH 5.15 372/779] crypto: inside-secure - Add missing MODULE_DEVICE_TABLE for of Date: Mon, 15 Aug 2022 20:00:16 +0200 Message-Id: <20220815180353.171920122@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pali Roh=C3=A1r [ Upstream commit fa4d57b85786ec0e16565c75a51c208834b0c24d ] Without MODULE_DEVICE_TABLE, crypto_safexcel.ko module is not automatically loaded on platforms where inside-secure crypto HW is specified in device tree (e.g. Armada 3720). So add missing MODULE_DEVICE_TABLE for of. Fixes: 1b44c5a60c13 ("crypto: inside-secure - add SafeXcel EIP197 crypto en= gine driver") Signed-off-by: Pali Roh=C3=A1r Acked-by: Marek Beh=C3=BAn Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/crypto/inside-secure/safexcel.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/crypto/inside-secure/safexcel.c b/drivers/crypto/insid= e-secure/safexcel.c index 9ff885d50edf..389a7b51f1f3 100644 --- a/drivers/crypto/inside-secure/safexcel.c +++ b/drivers/crypto/inside-secure/safexcel.c @@ -1831,6 +1831,8 @@ static const struct of_device_id safexcel_of_match_ta= ble[] =3D { {}, }; =20 +MODULE_DEVICE_TABLE(of, safexcel_of_match_table); + static struct platform_driver crypto_safexcel =3D { .probe =3D safexcel_probe, .remove =3D safexcel_remove, --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F999C00140 for ; Mon, 15 Aug 2022 19:04:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245287AbiHOTED (ORCPT ); Mon, 15 Aug 2022 15:04:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245351AbiHOS5R (ORCPT ); Mon, 15 Aug 2022 14:57:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AFDD32EF0; Mon, 15 Aug 2022 11:32: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 3BDA160F7A; Mon, 15 Aug 2022 18:32:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A0C1C433C1; Mon, 15 Aug 2022 18:32:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588343; bh=87Ds+doF6FOF5oJqNQdMzwQexHSP157Ga24/dqnOdGk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lZdtJReLa785kAjb2gDkrNmnUy3kwrE3mRRkVPWcJn6vqmOcLqGjlhhpHMXg0YexH m7mz0U0G7WhlG5oQr6CtvL1uCz3t/OUDaTi939e4oIkV6EUcNedoc+9vBi7Zwk1Hnd Fzln4WzeyGYnV9EXpiDTn8S4hZU9rOJGGINTG0o8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kai Ye , Herbert Xu , Sasha Levin Subject: [PATCH 5.15 373/779] crypto: hisilicon/sec - fix auth key size error Date: Mon, 15 Aug 2022 20:00:17 +0200 Message-Id: <20220815180353.215358378@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kai Ye [ Upstream commit 45f5d0176d8426cc1ab0bab84fbd8ef5c57526c6 ] The authentication algorithm supports a maximum of 128-byte keys. The allocated key memory is insufficient. Fixes: 2f072d75d1ab ("crypto: hisilicon - Add aead support on SEC2") Signed-off-by: Kai Ye Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/crypto/hisilicon/sec2/sec_crypto.c | 6 +++--- drivers/crypto/hisilicon/sec2/sec_crypto.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/hisilicon/sec2/sec_crypto.c b/drivers/crypto/hi= silicon/sec2/sec_crypto.c index 36c789ff1bd4..0d26eda36a52 100644 --- a/drivers/crypto/hisilicon/sec2/sec_crypto.c +++ b/drivers/crypto/hisilicon/sec2/sec_crypto.c @@ -617,7 +617,7 @@ static int sec_auth_init(struct sec_ctx *ctx) { struct sec_auth_ctx *a_ctx =3D &ctx->a_ctx; =20 - a_ctx->a_key =3D dma_alloc_coherent(ctx->dev, SEC_MAX_KEY_SIZE, + a_ctx->a_key =3D dma_alloc_coherent(ctx->dev, SEC_MAX_AKEY_SIZE, &a_ctx->a_key_dma, GFP_KERNEL); if (!a_ctx->a_key) return -ENOMEM; @@ -629,8 +629,8 @@ static void sec_auth_uninit(struct sec_ctx *ctx) { struct sec_auth_ctx *a_ctx =3D &ctx->a_ctx; =20 - memzero_explicit(a_ctx->a_key, SEC_MAX_KEY_SIZE); - dma_free_coherent(ctx->dev, SEC_MAX_KEY_SIZE, + memzero_explicit(a_ctx->a_key, SEC_MAX_AKEY_SIZE); + dma_free_coherent(ctx->dev, SEC_MAX_AKEY_SIZE, a_ctx->a_key, a_ctx->a_key_dma); } =20 diff --git a/drivers/crypto/hisilicon/sec2/sec_crypto.h b/drivers/crypto/hi= silicon/sec2/sec_crypto.h index 9f71c358a6d3..ee2edaf5058d 100644 --- a/drivers/crypto/hisilicon/sec2/sec_crypto.h +++ b/drivers/crypto/hisilicon/sec2/sec_crypto.h @@ -7,6 +7,7 @@ #define SEC_AIV_SIZE 12 #define SEC_IV_SIZE 24 #define SEC_MAX_KEY_SIZE 64 +#define SEC_MAX_AKEY_SIZE 128 #define SEC_COMM_SCENE 0 #define SEC_MIN_BLOCK_SZ 1 =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AAD54C00140 for ; Mon, 15 Aug 2022 19:04:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245318AbiHOTEM (ORCPT ); Mon, 15 Aug 2022 15:04:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244486AbiHOS5q (ORCPT ); Mon, 15 Aug 2022 14:57:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C55333377; Mon, 15 Aug 2022 11:32:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3521E61029; Mon, 15 Aug 2022 18:32:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22645C433C1; Mon, 15 Aug 2022 18:32:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588346; bh=xFwjR9b18S4XtkLD52WBdoOw1GgnqbnoSM0RUQFkw24=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z4Ae2GORnukJYeoTVZuI/tUyOQwufp96kH2It5Rx+UR09B5TgQg69A6PCRKS5/faU OPIfdQIO1oQtJq6fr31LVNiEipzz9SozJCePJkosmMim/MbGrLOXNgvKV2gH8kOL6h INeXnpPNNeRbpyyXGoqNpvDctYKrPKgub3e0shqk= 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.15 374/779] inet: add READ_ONCE(sk->sk_bound_dev_if) in INET_MATCH() Date: Mon, 15 Aug 2022 20:00:18 +0200 Message-Id: <20220815180353.259445390@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 4915d50e300e96929d2462041d6f6c6f061167fd ] INET_MATCH() runs without holding a lock on the socket. We probably need to annotate most reads. This patch makes INET_MATCH() an inline function to ease our changes. v2: We remove the 32bit version of it, as modern compilers should generate the same code really, no need to try to be smarter. Also make 'struct net *net' the first argument. Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- include/net/inet_hashtables.h | 35 ++++++++++++++++------------------- include/net/sock.h | 3 --- net/ipv4/inet_hashtables.c | 15 +++++---------- net/ipv4/udp.c | 3 +-- 4 files changed, 22 insertions(+), 34 deletions(-) diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index 749bb1e46087..825ad1d06d05 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h @@ -295,7 +295,6 @@ static inline struct sock *inet_lookup_listener(struct = net *net, ((__force __portpair)(((__u32)(__dport) << 16) | (__force __u32)(__be16)(= __sport))) #endif =20 -#if (BITS_PER_LONG =3D=3D 64) #ifdef __BIG_ENDIAN #define INET_ADDR_COOKIE(__name, __saddr, __daddr) \ const __addrpair __name =3D (__force __addrpair) ( \ @@ -307,24 +306,22 @@ static inline struct sock *inet_lookup_listener(struc= t net *net, (((__force __u64)(__be32)(__daddr)) << 32) | \ ((__force __u64)(__be32)(__saddr))) #endif /* __BIG_ENDIAN */ -#define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif= , __sdif) \ - (((__sk)->sk_portpair =3D=3D (__ports)) && \ - ((__sk)->sk_addrpair =3D=3D (__cookie)) && \ - (((__sk)->sk_bound_dev_if =3D=3D (__dif)) || \ - ((__sk)->sk_bound_dev_if =3D=3D (__sdif))) && \ - net_eq(sock_net(__sk), (__net))) -#else /* 32-bit arch */ -#define INET_ADDR_COOKIE(__name, __saddr, __daddr) \ - const int __name __deprecated __attribute__((unused)) - -#define INET_MATCH(__sk, __net, __cookie, __saddr, __daddr, __ports, __dif= , __sdif) \ - (((__sk)->sk_portpair =3D=3D (__ports)) && \ - ((__sk)->sk_daddr =3D=3D (__saddr)) && \ - ((__sk)->sk_rcv_saddr =3D=3D (__daddr)) && \ - (((__sk)->sk_bound_dev_if =3D=3D (__dif)) || \ - ((__sk)->sk_bound_dev_if =3D=3D (__sdif))) && \ - net_eq(sock_net(__sk), (__net))) -#endif /* 64-bit arch */ + +static inline bool INET_MATCH(struct net *net, const struct sock *sk, + const __addrpair cookie, const __portpair ports, + int dif, int sdif) +{ + int bound_dev_if; + + if (!net_eq(sock_net(sk), net) || + sk->sk_portpair !=3D ports || + sk->sk_addrpair !=3D cookie) + return false; + + /* Paired with WRITE_ONCE() from sock_bindtoindex_locked() */ + bound_dev_if =3D READ_ONCE(sk->sk_bound_dev_if); + return bound_dev_if =3D=3D dif || bound_dev_if =3D=3D sdif; +} =20 /* Sockets in TCP_CLOSE state are _always_ taken out of the hash, so we ne= ed * not check it for lookups anymore, thanks Alexey. -DaveM diff --git a/include/net/sock.h b/include/net/sock.h index e0a88bb0a58c..49a6315d521f 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -161,9 +161,6 @@ typedef __u64 __bitwise __addrpair; * for struct sock and struct inet_timewait_sock. */ struct sock_common { - /* skc_daddr and skc_rcv_saddr must be grouped on a 8 bytes aligned - * address on 64bit arches : cf INET_MATCH() - */ union { __addrpair skc_addrpair; struct { diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c index 342f3df77835..7c502c4a160b 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c @@ -410,13 +410,11 @@ struct sock *__inet_lookup_established(struct net *ne= t, sk_nulls_for_each_rcu(sk, node, &head->chain) { if (sk->sk_hash !=3D hash) continue; - if (likely(INET_MATCH(sk, net, acookie, - saddr, daddr, ports, dif, sdif))) { + if (likely(INET_MATCH(net, sk, acookie, ports, dif, sdif))) { if (unlikely(!refcount_inc_not_zero(&sk->sk_refcnt))) goto out; - if (unlikely(!INET_MATCH(sk, net, acookie, - saddr, daddr, ports, - dif, sdif))) { + if (unlikely(!INET_MATCH(net, sk, acookie, + ports, dif, sdif))) { sock_gen_put(sk); goto begin; } @@ -465,8 +463,7 @@ static int __inet_check_established(struct inet_timewai= t_death_row *death_row, if (sk2->sk_hash !=3D hash) continue; =20 - if (likely(INET_MATCH(sk2, net, acookie, - saddr, daddr, ports, dif, sdif))) { + if (likely(INET_MATCH(net, sk2, acookie, ports, dif, sdif))) { if (sk2->sk_state =3D=3D TCP_TIME_WAIT) { tw =3D inet_twsk(sk2); if (twsk_unique(sk, sk2, twp)) @@ -532,9 +529,7 @@ static bool inet_ehash_lookup_by_sk(struct sock *sk, if (esk->sk_hash !=3D sk->sk_hash) continue; if (sk->sk_family =3D=3D AF_INET) { - if (unlikely(INET_MATCH(esk, net, acookie, - sk->sk_daddr, - sk->sk_rcv_saddr, + if (unlikely(INET_MATCH(net, esk, acookie, ports, dif, sdif))) { return true; } diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 4ad4daa16cce..efef7ba44e1d 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -2554,8 +2554,7 @@ static struct sock *__udp4_lib_demux_lookup(struct ne= t *net, struct sock *sk; =20 udp_portaddr_for_each_entry_rcu(sk, &hslot2->head) { - if (INET_MATCH(sk, net, acookie, rmt_addr, - loc_addr, ports, dif, sdif)) + if (INET_MATCH(net, sk, acookie, ports, dif, sdif)) return sk; /* Only check first socket in chain */ break; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC215C25B08 for ; Mon, 15 Aug 2022 19:04:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245307AbiHOTEI (ORCPT ); Mon, 15 Aug 2022 15:04:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239189AbiHOS5b (ORCPT ); Mon, 15 Aug 2022 14:57: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 D76524A829; Mon, 15 Aug 2022 11:32: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 D3F3DB8105D; Mon, 15 Aug 2022 18:32:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F11DC433C1; Mon, 15 Aug 2022 18:32:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588349; bh=gZsXOWi7YEW6JE1/4d/OmEBk6gcSE81edNlQ9cvR2fs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ijflYSf46pulCghQOAXLPNP5rAR4wRsMGBbYmxbBicTCQGVuHI1e2wIt86uknwFoV dl6fbmwU64jnV7BZmS2JSYui9gyrcQkMNtgKQwLqIhaelHaMp7uNr0UHIWGSJ1qvqw MnfVE+ul4Wt3fYktph/t293QzuWWcSAwmA8FX2Bg= 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.15 375/779] ipv6: add READ_ONCE(sk->sk_bound_dev_if) in INET6_MATCH() Date: Mon, 15 Aug 2022 20:00:19 +0200 Message-Id: <20220815180353.308033176@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 5d368f03280d3678433a7f119efe15dfbbb87bc8 ] INET6_MATCH() runs without holding a lock on the socket. We probably need to annotate most reads. This patch makes INET6_MATCH() an inline function to ease our changes. v2: inline function only defined if IS_ENABLED(CONFIG_IPV6) Change the name to inet6_match(), this is no longer a macro. Signed-off-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- include/net/inet6_hashtables.h | 28 +++++++++++++++++++--------- net/ipv4/inet_hashtables.c | 2 +- net/ipv6/inet6_hashtables.c | 6 +++--- net/ipv6/udp.c | 2 +- 4 files changed, 24 insertions(+), 14 deletions(-) diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h index 81b965953036..f259e1ae14ba 100644 --- a/include/net/inet6_hashtables.h +++ b/include/net/inet6_hashtables.h @@ -103,15 +103,25 @@ struct sock *inet6_lookup(struct net *net, struct ine= t_hashinfo *hashinfo, const int dif); =20 int inet6_hash(struct sock *sk); -#endif /* IS_ENABLED(CONFIG_IPV6) */ =20 -#define INET6_MATCH(__sk, __net, __saddr, __daddr, __ports, __dif, __sdif)= \ - (((__sk)->sk_portpair =3D=3D (__ports)) && \ - ((__sk)->sk_family =3D=3D AF_INET6) && \ - ipv6_addr_equal(&(__sk)->sk_v6_daddr, (__saddr)) && \ - ipv6_addr_equal(&(__sk)->sk_v6_rcv_saddr, (__daddr)) && \ - (((__sk)->sk_bound_dev_if =3D=3D (__dif)) || \ - ((__sk)->sk_bound_dev_if =3D=3D (__sdif))) && \ - net_eq(sock_net(__sk), (__net))) +static inline bool inet6_match(struct net *net, const struct sock *sk, + const struct in6_addr *saddr, + const struct in6_addr *daddr, + const __portpair ports, + const int dif, const int sdif) +{ + int bound_dev_if; + + if (!net_eq(sock_net(sk), net) || + sk->sk_family !=3D AF_INET6 || + sk->sk_portpair !=3D ports || + !ipv6_addr_equal(&sk->sk_v6_daddr, saddr) || + !ipv6_addr_equal(&sk->sk_v6_rcv_saddr, daddr)) + return false; + + bound_dev_if =3D READ_ONCE(sk->sk_bound_dev_if); + return bound_dev_if =3D=3D dif || bound_dev_if =3D=3D sdif; +} +#endif /* IS_ENABLED(CONFIG_IPV6) */ =20 #endif /* _INET6_HASHTABLES_H */ diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c index 7c502c4a160b..26c4dd4ec459 100644 --- a/net/ipv4/inet_hashtables.c +++ b/net/ipv4/inet_hashtables.c @@ -536,7 +536,7 @@ static bool inet_ehash_lookup_by_sk(struct sock *sk, } #if IS_ENABLED(CONFIG_IPV6) else if (sk->sk_family =3D=3D AF_INET6) { - if (unlikely(INET6_MATCH(esk, net, + if (unlikely(inet6_match(net, esk, &sk->sk_v6_daddr, &sk->sk_v6_rcv_saddr, ports, dif, sdif))) { diff --git a/net/ipv6/inet6_hashtables.c b/net/ipv6/inet6_hashtables.c index 40203255ed88..b4a5e01e1201 100644 --- a/net/ipv6/inet6_hashtables.c +++ b/net/ipv6/inet6_hashtables.c @@ -71,12 +71,12 @@ struct sock *__inet6_lookup_established(struct net *net, sk_nulls_for_each_rcu(sk, node, &head->chain) { if (sk->sk_hash !=3D hash) continue; - if (!INET6_MATCH(sk, net, saddr, daddr, ports, dif, sdif)) + if (!inet6_match(net, sk, saddr, daddr, ports, dif, sdif)) continue; if (unlikely(!refcount_inc_not_zero(&sk->sk_refcnt))) goto out; =20 - if (unlikely(!INET6_MATCH(sk, net, saddr, daddr, ports, dif, sdif))) { + if (unlikely(!inet6_match(net, sk, saddr, daddr, ports, dif, sdif))) { sock_gen_put(sk); goto begin; } @@ -269,7 +269,7 @@ static int __inet6_check_established(struct inet_timewa= it_death_row *death_row, if (sk2->sk_hash !=3D hash) continue; =20 - if (likely(INET6_MATCH(sk2, net, saddr, daddr, ports, + if (likely(inet6_match(net, sk2, saddr, daddr, ports, dif, sdif))) { if (sk2->sk_state =3D=3D TCP_TIME_WAIT) { tw =3D inet_twsk(sk2); diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index 932c6f2a5494..4a9afdbd5f29 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c @@ -1035,7 +1035,7 @@ static struct sock *__udp6_lib_demux_lookup(struct ne= t *net, =20 udp_portaddr_for_each_entry_rcu(sk, &hslot2->head) { if (sk->sk_state =3D=3D TCP_ESTABLISHED && - INET6_MATCH(sk, net, rmt_addr, loc_addr, ports, dif, sdif)) + inet6_match(net, sk, rmt_addr, loc_addr, ports, dif, sdif)) return sk; /* Only check first socket in chain */ break; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C564BC00140 for ; Mon, 15 Aug 2022 19:04:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244642AbiHOTEW (ORCPT ); Mon, 15 Aug 2022 15:04:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244874AbiHOS73 (ORCPT ); Mon, 15 Aug 2022 14:59:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E66814AD5C; Mon, 15 Aug 2022 11:32: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 0B275B81074; Mon, 15 Aug 2022 18:32:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E517C433C1; Mon, 15 Aug 2022 18:32:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588355; bh=gN0AZ4KaMAhv6HkJ0uXltNqatxe15poS66mDjc+otfc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dQu0FUans9zmWp7KfWBZvf+t/hBQLEqvGawbcleFBeLrTqVdisFNroPoSyILVmur+ jOTLd/I3QYEbIdrJf/1Y2MS7tcci8z+Gqe5/wU/EnsjxJmsAv390m36VmRNjuZ+tAr 2Fz5uR83YAJmB+JJuqYtg/b0mqdGDa9MV1JV4ob4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mike Manning , David Ahern , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 376/779] net: allow unbound socket for packets in VRF when tcp_l3mdev_accept set Date: Mon, 15 Aug 2022 20:00:20 +0200 Message-Id: <20220815180353.349648511@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Manning [ Upstream commit 944fd1aeacb627fa617f85f8e5a34f7ae8ea4d8e ] The commit 3c82a21f4320 ("net: allow binding socket in a VRF when there's an unbound socket") changed the inet socket lookup to avoid packets in a VRF from matching an unbound socket. This is to ensure the necessary isolation between the default and other VRFs for routing and forwarding. VRF-unaware processes running in the default VRF cannot access another VRF and have to be run with 'ip vrf exec '. This is to be expected with tcp_l3mdev_accept disabled, but could be reallowed when this sysctl option is enabled. So instead of directly checking dif and sdif in inet[6]_match, here call inet_sk_bound_dev_eq(). This allows a match on unbound socket for non-zero sdif i.e. for packets in a VRF, if tcp_l3mdev_accept is enabled. Fixes: 3c82a21f4320 ("net: allow binding socket in a VRF when there's an un= bound socket") Signed-off-by: Mike Manning Link: https://lore.kernel.org/netdev/a54c149aed38fded2d3b5fdb1a6c89e36a083b= 74.camel@lasnet.de/ Reviewed-by: David Ahern Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- include/net/inet6_hashtables.h | 7 +++---- include/net/inet_hashtables.h | 19 +++---------------- include/net/inet_sock.h | 11 +++++++++++ 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/include/net/inet6_hashtables.h b/include/net/inet6_hashtables.h index f259e1ae14ba..56f1286583d3 100644 --- a/include/net/inet6_hashtables.h +++ b/include/net/inet6_hashtables.h @@ -110,8 +110,6 @@ static inline bool inet6_match(struct net *net, const s= truct sock *sk, const __portpair ports, const int dif, const int sdif) { - int bound_dev_if; - if (!net_eq(sock_net(sk), net) || sk->sk_family !=3D AF_INET6 || sk->sk_portpair !=3D ports || @@ -119,8 +117,9 @@ static inline bool inet6_match(struct net *net, const s= truct sock *sk, !ipv6_addr_equal(&sk->sk_v6_rcv_saddr, daddr)) return false; =20 - bound_dev_if =3D READ_ONCE(sk->sk_bound_dev_if); - return bound_dev_if =3D=3D dif || bound_dev_if =3D=3D sdif; + /* READ_ONCE() paired with WRITE_ONCE() in sock_bindtoindex_locked() */ + return inet_sk_bound_dev_eq(net, READ_ONCE(sk->sk_bound_dev_if), dif, + sdif); } #endif /* IS_ENABLED(CONFIG_IPV6) */ =20 diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h index 825ad1d06d05..53c22b64e972 100644 --- a/include/net/inet_hashtables.h +++ b/include/net/inet_hashtables.h @@ -203,17 +203,6 @@ static inline void inet_ehash_locks_free(struct inet_h= ashinfo *hashinfo) hashinfo->ehash_locks =3D NULL; } =20 -static inline bool inet_sk_bound_dev_eq(struct net *net, int bound_dev_if, - int dif, int sdif) -{ -#if IS_ENABLED(CONFIG_NET_L3_MASTER_DEV) - return inet_bound_dev_eq(!!READ_ONCE(net->ipv4.sysctl_tcp_l3mdev_accept), - bound_dev_if, dif, sdif); -#else - return inet_bound_dev_eq(true, bound_dev_if, dif, sdif); -#endif -} - struct inet_bind_bucket * inet_bind_bucket_create(struct kmem_cache *cachep, struct net *net, struct inet_bind_hashbucket *head, @@ -311,16 +300,14 @@ static inline bool INET_MATCH(struct net *net, const = struct sock *sk, const __addrpair cookie, const __portpair ports, int dif, int sdif) { - int bound_dev_if; - if (!net_eq(sock_net(sk), net) || sk->sk_portpair !=3D ports || sk->sk_addrpair !=3D cookie) return false; =20 - /* Paired with WRITE_ONCE() from sock_bindtoindex_locked() */ - bound_dev_if =3D READ_ONCE(sk->sk_bound_dev_if); - return bound_dev_if =3D=3D dif || bound_dev_if =3D=3D sdif; + /* READ_ONCE() paired with WRITE_ONCE() in sock_bindtoindex_locked() */ + return inet_sk_bound_dev_eq(net, READ_ONCE(sk->sk_bound_dev_if), dif, + sdif); } =20 /* Sockets in TCP_CLOSE state are _always_ taken out of the hash, so we ne= ed diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h index c307a547d2cb..2c2b41ea7f81 100644 --- a/include/net/inet_sock.h +++ b/include/net/inet_sock.h @@ -149,6 +149,17 @@ static inline bool inet_bound_dev_eq(bool l3mdev_accep= t, int bound_dev_if, return bound_dev_if =3D=3D dif || bound_dev_if =3D=3D sdif; } =20 +static inline bool inet_sk_bound_dev_eq(struct net *net, int bound_dev_if, + int dif, int sdif) +{ +#if IS_ENABLED(CONFIG_NET_L3_MASTER_DEV) + return inet_bound_dev_eq(!!READ_ONCE(net->ipv4.sysctl_tcp_l3mdev_accept), + bound_dev_if, dif, sdif); +#else + return inet_bound_dev_eq(true, bound_dev_if, dif, sdif); +#endif +} + struct inet_cork { unsigned int flags; __be32 addr; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98AA6C00140 for ; Mon, 15 Aug 2022 19:04:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231817AbiHOTEe (ORCPT ); Mon, 15 Aug 2022 15:04:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244631AbiHOTAG (ORCPT ); Mon, 15 Aug 2022 15:00:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F6DF4AD78; Mon, 15 Aug 2022 11:32: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 4CEFCB8105D; Mon, 15 Aug 2022 18:32:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82E83C433C1; Mon, 15 Aug 2022 18:32:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588359; bh=2rlkvR+VSCNZxJ9MpCjFN9T0LkYJDu75Wd2nel5TUv8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S8fd+EWz5Aw7OUn1moW7nQ1R8S+ldrIwjPMtmmqQjca6JbpKWp0dWqgTs80jBaWsN hAaF15dLJpFUOLNopEXyJNkWS+Y7aDk3siccVZqaufpH6196CxK2KuxpkbrD27s9Hl ouCHDnlhE++TSK4xCz1z5Lz/rBENsZAEhdHEWTBE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ido Schimmel , Amit Cohen , David Ahern , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 377/779] netdevsim: fib: Fix reference count leak on route deletion failure Date: Mon, 15 Aug 2022 20:00:21 +0200 Message-Id: <20220815180353.384201774@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ido Schimmel [ Upstream commit 180a6a3ee60a7cb69ed1232388460644f6a21f00 ] As part of FIB offload simulation, netdevsim stores IPv4 and IPv6 routes and holds a reference on FIB info structures that in turn hold a reference on the associated nexthop device(s). In the unlikely case where we are unable to allocate memory to process a route deletion request, netdevsim will not release the reference from the associated FIB info structure, thereby preventing the associated nexthop device(s) from ever being removed [1]. Fix this by scheduling a work item that will flush netdevsim's FIB table upon route deletion failure. This will cause netdevsim to release its reference from all the FIB info structures in its table. Reported by Lucas Leong of Trend Micro Zero Day Initiative. Fixes: 0ae3eb7b4611 ("netdevsim: fib: Perform the route programming in a no= n-atomic context") Signed-off-by: Ido Schimmel Reviewed-by: Amit Cohen Reviewed-by: David Ahern Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/netdevsim/fib.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/drivers/net/netdevsim/fib.c b/drivers/net/netdevsim/fib.c index 378ee779061c..14787d17f703 100644 --- a/drivers/net/netdevsim/fib.c +++ b/drivers/net/netdevsim/fib.c @@ -53,6 +53,7 @@ struct nsim_fib_data { struct rhashtable nexthop_ht; struct devlink *devlink; struct work_struct fib_event_work; + struct work_struct fib_flush_work; struct list_head fib_event_queue; spinlock_t fib_event_queue_lock; /* Protects fib event queue list */ struct mutex nh_lock; /* Protects NH HT */ @@ -977,7 +978,7 @@ static int nsim_fib_event_schedule_work(struct nsim_fib= _data *data, =20 fib_event =3D kzalloc(sizeof(*fib_event), GFP_ATOMIC); if (!fib_event) - return NOTIFY_BAD; + goto err_fib_event_alloc; =20 fib_event->data =3D data; fib_event->event =3D event; @@ -1005,6 +1006,9 @@ static int nsim_fib_event_schedule_work(struct nsim_f= ib_data *data, =20 err_fib_prepare_event: kfree(fib_event); +err_fib_event_alloc: + if (event =3D=3D FIB_EVENT_ENTRY_DEL) + schedule_work(&data->fib_flush_work); return NOTIFY_BAD; } =20 @@ -1482,6 +1486,24 @@ static void nsim_fib_event_work(struct work_struct *= work) mutex_unlock(&data->fib_lock); } =20 +static void nsim_fib_flush_work(struct work_struct *work) +{ + struct nsim_fib_data *data =3D container_of(work, struct nsim_fib_data, + fib_flush_work); + struct nsim_fib_rt *fib_rt, *fib_rt_tmp; + + /* Process pending work. */ + flush_work(&data->fib_event_work); + + mutex_lock(&data->fib_lock); + list_for_each_entry_safe(fib_rt, fib_rt_tmp, &data->fib_rt_list, list) { + rhashtable_remove_fast(&data->fib_rt_ht, &fib_rt->ht_node, + nsim_fib_rt_ht_params); + nsim_fib_rt_free(fib_rt, data); + } + mutex_unlock(&data->fib_lock); +} + static int nsim_fib_debugfs_init(struct nsim_fib_data *data, struct nsim_dev *nsim_de= v) { @@ -1540,6 +1562,7 @@ struct nsim_fib_data *nsim_fib_create(struct devlink = *devlink, goto err_rhashtable_nexthop_destroy; =20 INIT_WORK(&data->fib_event_work, nsim_fib_event_work); + INIT_WORK(&data->fib_flush_work, nsim_fib_flush_work); INIT_LIST_HEAD(&data->fib_event_queue); spin_lock_init(&data->fib_event_queue_lock); =20 @@ -1586,6 +1609,7 @@ struct nsim_fib_data *nsim_fib_create(struct devlink = *devlink, err_nexthop_nb_unregister: unregister_nexthop_notifier(devlink_net(devlink), &data->nexthop_nb); err_rhashtable_fib_destroy: + cancel_work_sync(&data->fib_flush_work); flush_work(&data->fib_event_work); rhashtable_free_and_destroy(&data->fib_rt_ht, nsim_fib_rt_free, data); @@ -1615,6 +1639,7 @@ void nsim_fib_destroy(struct devlink *devlink, struct= nsim_fib_data *data) NSIM_RESOURCE_IPV4_FIB); unregister_fib_notifier(devlink_net(devlink), &data->fib_nb); unregister_nexthop_notifier(devlink_net(devlink), &data->nexthop_nb); + cancel_work_sync(&data->fib_flush_work); flush_work(&data->fib_event_work); rhashtable_free_and_destroy(&data->fib_rt_ht, nsim_fib_rt_free, data); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C248AC00140 for ; Mon, 15 Aug 2022 19:04:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244849AbiHOTE0 (ORCPT ); Mon, 15 Aug 2022 15:04:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244948AbiHOTAF (ORCPT ); Mon, 15 Aug 2022 15:00: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 CA8A74B0C0; Mon, 15 Aug 2022 11:32: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 BDA8761057; Mon, 15 Aug 2022 18:32:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ABF4EC4314A; Mon, 15 Aug 2022 18:32:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588362; bh=z1YM0gPwBlW36x0Nmj2Ijs3X1DFwm9C1rmfuErDEhtU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NFpOZesgAD5bRi5HLoO8Oeil5DO43dJVUmr08eFejL4htXOff/PZAwfumHA7snY2F yv5T371VaqH94uPQCKfz7PyHNuVmATz+fKwhuzWei5EUfreBJhwYqolxfoXamnu9qi VHTRpO64/Om1lpmkAmmODTi1CI5zdM/2Ger0DDBo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hacash Robot , William Dean , Ping-Ke Shih , Kalle Valo , Sasha Levin Subject: [PATCH 5.15 378/779] wifi: rtw88: check the return value of alloc_workqueue() Date: Mon, 15 Aug 2022 20:00:22 +0200 Message-Id: <20220815180353.431786620@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: William Dean [ Upstream commit 42bbf810e155efc6129a3a648ae5300f00b79d7b ] The function alloc_workqueue() in rtw_core_init() can fail, but there is no check of its return value. To fix this bug, its return value should be checked with new error handling code. Fixes: fe101716c7c9d ("rtw88: replace tx tasklet with work queue") Reported-by: Hacash Robot Signed-off-by: William Dean Reviewed-by: Ping-Ke Shih Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20220723063756.2956189-1-williamsukatube@16= 3.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/wireless/realtek/rtw88/main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wirele= ss/realtek/rtw88/main.c index 69512856bb46..5786995d90d4 100644 --- a/drivers/net/wireless/realtek/rtw88/main.c +++ b/drivers/net/wireless/realtek/rtw88/main.c @@ -1819,6 +1819,10 @@ int rtw_core_init(struct rtw_dev *rtwdev) timer_setup(&rtwdev->tx_report.purge_timer, rtw_tx_report_purge_timer, 0); rtwdev->tx_wq =3D alloc_workqueue("rtw_tx_wq", WQ_UNBOUND | WQ_HIGHPRI, 0= ); + if (!rtwdev->tx_wq) { + rtw_warn(rtwdev, "alloc_workqueue rtw_tx_wq failed\n"); + return -ENOMEM; + } =20 INIT_DELAYED_WORK(&rtwdev->watch_dog_work, rtw_watch_dog_work); INIT_DELAYED_WORK(&coex->bt_relink_work, rtw_coex_bt_relink_work); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63BBCC00140 for ; Mon, 15 Aug 2022 19:04:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245348AbiHOTEh (ORCPT ); Mon, 15 Aug 2022 15:04:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244785AbiHOTA2 (ORCPT ); Mon, 15 Aug 2022 15:00:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D03394AD5A; Mon, 15 Aug 2022 11:32: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 8D522B81084; Mon, 15 Aug 2022 18:32:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB019C433D7; Mon, 15 Aug 2022 18:32:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588365; bh=1yz48aHCBQ6Peoc8tzW71zpZ3bWP6L5QX77XZpRmnqk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ptaqPuD2WImufJGl16MvuxqiU1VqqZmGBqXV9xFHIsGN1dR2Fz2yas9E73t+T61BK PpZtjAshmADHGn7SdJiFQDqJrNBKHNUDU1or+6a95VmX2RKdkWHedYSegTSRRFH0Gf NM6I8595uM01MnSEu2dy8+ziaiHuAk8+9f4lK7ds= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Przemyslaw Patynowski , Jun Zhang , Bharathi Sreenivas , Tony Nguyen , Sasha Levin Subject: [PATCH 5.15 379/779] iavf: Fix max_rate limiting Date: Mon, 15 Aug 2022 20:00:23 +0200 Message-Id: <20220815180353.483165470@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Przemyslaw Patynowski [ Upstream commit ec60d54cb9a3d43a02c5612a03093c18233e6601 ] Fix max_rate option in TC, check for proper quanta boundaries. Check for minimum value provided and if it fits expected 50Mbps quanta. Without this patch, iavf could send settings for max_rate limiting that would be accepted from by PF even the max_rate option is less than expected 50Mbps quanta. It results in no rate limiting on traffic as rate limiting will be floored to 0. Example: tc qdisc add dev $vf root mqprio num_tc 3 map 0 2 1 queues \ 2@0 2@2 2@4 hw 1 mode channel shaper bw_rlimit \ max_rate 50Mbps 500Mbps 500Mbps Should limit TC0 to circa 50 Mbps tc qdisc add dev $vf root mqprio num_tc 3 map 0 2 1 queues \ 2@0 2@2 2@4 hw 1 mode channel shaper bw_rlimit \ max_rate 0Mbps 100Kbit 500Mbps Should return error Fixes: d5b33d024496 ("i40evf: add ndo_setup_tc callback to i40evf") Signed-off-by: Przemyslaw Patynowski Signed-off-by: Jun Zhang Tested-by: Bharathi Sreenivas Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/ethernet/intel/iavf/iavf.h | 1 + drivers/net/ethernet/intel/iavf/iavf_main.c | 25 +++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/iavf/iavf.h b/drivers/net/ethernet/= intel/iavf/iavf.h index 9a122aea6979..ab84fc83352f 100644 --- a/drivers/net/ethernet/intel/iavf/iavf.h +++ b/drivers/net/ethernet/intel/iavf/iavf.h @@ -89,6 +89,7 @@ struct iavf_vsi { #define IAVF_HKEY_ARRAY_SIZE ((IAVF_VFQF_HKEY_MAX_INDEX + 1) * 4) #define IAVF_HLUT_ARRAY_SIZE ((IAVF_VFQF_HLUT_MAX_INDEX + 1) * 4) #define IAVF_MBPS_DIVISOR 125000 /* divisor to convert to Mbps */ +#define IAVF_MBPS_QUANTA 50 =20 #define IAVF_VIRTCHNL_VF_RESOURCE_SIZE (sizeof(struct virtchnl_vf_resource= ) + \ (IAVF_MAX_VF_VSI * \ diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethe= rnet/intel/iavf/iavf_main.c index ca74824d40b8..067f0b265e7d 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_main.c +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c @@ -2732,6 +2732,7 @@ static int iavf_validate_ch_config(struct iavf_adapte= r *adapter, struct tc_mqprio_qopt_offload *mqprio_qopt) { u64 total_max_rate =3D 0; + u32 tx_rate_rem =3D 0; int i, num_qps =3D 0; u64 tx_rate =3D 0; int ret =3D 0; @@ -2746,12 +2747,32 @@ static int iavf_validate_ch_config(struct iavf_adap= ter *adapter, return -EINVAL; if (mqprio_qopt->min_rate[i]) { dev_err(&adapter->pdev->dev, - "Invalid min tx rate (greater than 0) specified\n"); + "Invalid min tx rate (greater than 0) specified for TC%d\n", + i); return -EINVAL; } - /*convert to Mbps */ + + /* convert to Mbps */ tx_rate =3D div_u64(mqprio_qopt->max_rate[i], IAVF_MBPS_DIVISOR); + + if (mqprio_qopt->max_rate[i] && + tx_rate < IAVF_MBPS_QUANTA) { + dev_err(&adapter->pdev->dev, + "Invalid max tx rate for TC%d, minimum %dMbps\n", + i, IAVF_MBPS_QUANTA); + return -EINVAL; + } + + (void)div_u64_rem(tx_rate, IAVF_MBPS_QUANTA, &tx_rate_rem); + + if (tx_rate_rem !=3D 0) { + dev_err(&adapter->pdev->dev, + "Invalid max tx rate for TC%d, not divisible by %d\n", + i, IAVF_MBPS_QUANTA); + return -EINVAL; + } + total_max_rate +=3D tx_rate; num_qps +=3D mqprio_qopt->qopt.count[i]; } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20604C00140 for ; Mon, 15 Aug 2022 19:04:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244901AbiHOTEm (ORCPT ); Mon, 15 Aug 2022 15:04:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245109AbiHOTBR (ORCPT ); Mon, 15 Aug 2022 15:01:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D5E24B0FD; Mon, 15 Aug 2022 11:32: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 9BF6EB8106C; Mon, 15 Aug 2022 18:32:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB253C433C1; Mon, 15 Aug 2022 18:32:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588368; bh=grTevtiDtZeHGoNwnZ4+5BrwyLfTwOyIQ6OsoxiYJ1w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BTGZNCqWcOdw+eCswi2KtL4pCY0tKmnKmzSxT9RiPiKXbfppEjBznfdidx3hkeLY+ y0RUvMZejwDSDCj/qdf5VEysJ/NE9zQT/UHmMNqETszt4Lb4R9ROr1Jg8s0xiiNlRE RbOLJJZq9DpWrdfwUdkZEv5YcW4I/ByAHtQOYHmQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Przemyslaw Patynowski , Grzegorz Szczurek , Kiran Patil , Jedrzej Jagielski , Bharathi Sreenivas , Tony Nguyen , Sasha Levin Subject: [PATCH 5.15 380/779] iavf: Fix tc qdisc show listing too many queues Date: Mon, 15 Aug 2022 20:00:24 +0200 Message-Id: <20220815180353.534510020@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Przemyslaw Patynowski [ Upstream commit 93cb804edab1b9a5bb7bb7b6824012dbb20abf22 ] Fix tc qdisc show dev root displaying too many fq_codel qdiscs. tc_modify_qdisc, which is caller of ndo_setup_tc, expects driver to call netif_set_real_num_tx_queues, which prepares qdiscs. Without this patch, fq_codel qdiscs would not be adjusted to number of queues on VF. e.g.: tc qdisc show dev qdisc mq 0: root qdisc fq_codel 0: parent :4 limit 10240p flows 1024 quantum 1514 target 5ms= interval 100ms memory_limit 32Mb ecn drop_batch 64 qdisc fq_codel 0: parent :3 limit 10240p flows 1024 quantum 1514 target 5ms= interval 100ms memory_limit 32Mb ecn drop_batch 64 qdisc fq_codel 0: parent :2 limit 10240p flows 1024 quantum 1514 target 5ms= interval 100ms memory_limit 32Mb ecn drop_batch 64 qdisc fq_codel 0: parent :1 limit 10240p flows 1024 quantum 1514 target 5ms= interval 100ms memory_limit 32Mb ecn drop_batch 64 tc qdisc add dev root mqprio num_tc 2 map 1 0 0 0 0 0 0 0 queues 1@0= 1@1 hw 1 mode channel shaper bw_rlimit max_rate 5000Mbit 150Mbit tc qdisc show dev qdisc mqprio 8003: root tc 2 map 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 queues:(0:0) (1:1) mode:channel shaper:bw_rlimit max_rate:5Gbit 150Mbit qdisc fq_codel 0: parent 8003:4 limit 10240p flows 1024 quantum 1514 target= 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64 qdisc fq_codel 0: parent 8003:3 limit 10240p flows 1024 quantum 1514 target= 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64 qdisc fq_codel 0: parent 8003:2 limit 10240p flows 1024 quantum 1514 target= 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64 qdisc fq_codel 0: parent 8003:1 limit 10240p flows 1024 quantum 1514 target= 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64 While after fix: tc qdisc add dev root mqprio num_tc 2 map 1 0 0 0 0 0 0 0 queues 1@0= 1@1 hw 1 mode channel shaper bw_rlimit max_rate 5000Mbit 150Mbit tc qdisc show dev #should show 2, shows 4 qdisc mqprio 8004: root tc 2 map 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 queues:(0:0) (1:1) mode:channel shaper:bw_rlimit max_rate:5Gbit 150Mbit qdisc fq_codel 0: parent 8004:2 limit 10240p flows 1024 quantum 1514 target= 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64 qdisc fq_codel 0: parent 8004:1 limit 10240p flows 1024 quantum 1514 target= 5ms interval 100ms memory_limit 32Mb ecn drop_batch 64 Fixes: d5b33d024496 ("i40evf: add ndo_setup_tc callback to i40evf") Signed-off-by: Przemyslaw Patynowski Co-developed-by: Grzegorz Szczurek Signed-off-by: Grzegorz Szczurek Co-developed-by: Kiran Patil Signed-off-by: Kiran Patil Signed-off-by: Jedrzej Jagielski Tested-by: Bharathi Sreenivas Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/ethernet/intel/iavf/iavf.h | 5 +++++ drivers/net/ethernet/intel/iavf/iavf_main.c | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/drivers/net/ethernet/intel/iavf/iavf.h b/drivers/net/ethernet/= intel/iavf/iavf.h index ab84fc83352f..99d2b090a1e6 100644 --- a/drivers/net/ethernet/intel/iavf/iavf.h +++ b/drivers/net/ethernet/intel/iavf/iavf.h @@ -378,6 +378,11 @@ struct iavf_adapter { /* lock to protect access to the cloud filter list */ spinlock_t cloud_filter_list_lock; u16 num_cloud_filters; + /* snapshot of "num_active_queues" before setup_tc for qdisc add + * is invoked. This information is useful during qdisc del flow, + * to restore correct number of queues + */ + int orig_num_active_queues; =20 #define IAVF_MAX_FDIR_FILTERS 128 /* max allowed Flow Director filters */ u16 fdir_active_fltr; diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethe= rnet/intel/iavf/iavf_main.c index 067f0b265e7d..e2349131a428 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_main.c +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c @@ -2839,6 +2839,7 @@ static int __iavf_setup_tc(struct net_device *netdev,= void *type_data) netif_tx_disable(netdev); iavf_del_all_cloud_filters(adapter); adapter->aq_required =3D IAVF_FLAG_AQ_DISABLE_CHANNELS; + total_qps =3D adapter->orig_num_active_queues; goto exit; } else { return -EINVAL; @@ -2882,7 +2883,21 @@ static int __iavf_setup_tc(struct net_device *netdev= , void *type_data) adapter->ch_config.ch_info[i].offset =3D 0; } } + + /* Take snapshot of original config such as "num_active_queues" + * It is used later when delete ADQ flow is exercised, so that + * once delete ADQ flow completes, VF shall go back to its + * original queue configuration + */ + + adapter->orig_num_active_queues =3D adapter->num_active_queues; + + /* Store queue info based on TC so that VF gets configured + * with correct number of queues when VF completes ADQ config + * flow + */ adapter->ch_config.total_qps =3D total_qps; + netif_tx_stop_all_queues(netdev); netif_tx_disable(netdev); adapter->aq_required |=3D IAVF_FLAG_AQ_ENABLE_CHANNELS; @@ -2899,6 +2914,12 @@ static int __iavf_setup_tc(struct net_device *netdev= , void *type_data) } } exit: + if (test_bit(__IAVF_IN_REMOVE_TASK, &adapter->crit_section)) + return 0; + + netif_set_real_num_rx_queues(netdev, total_qps); + netif_set_real_num_tx_queues(netdev, total_qps); + return ret; } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1817C00140 for ; Mon, 15 Aug 2022 19:04:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245380AbiHOTEt (ORCPT ); Mon, 15 Aug 2022 15:04:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245208AbiHOTBc (ORCPT ); Mon, 15 Aug 2022 15:01:32 -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 B01CD32EFF; Mon, 15 Aug 2022 11:32: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 CDD4AB81085; Mon, 15 Aug 2022 18:32:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34100C433D6; Mon, 15 Aug 2022 18:32:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588371; bh=rCJ5IZlcujA+VBDei++2b8s3UWpJOoJg5ymsyUzwOQ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aWeyRXExIdfa+T8TL2K4Y4lfi2x37DW/B8W8ZH41AHuwJo+D1JiIcXWW4HHRjuEdl j6lNxtM7YpmIToT4GleD/yIzmphvYTO1CfXeEpzgANtDN5+wgEdgKFNf9nkBCLMEat hurM8yb+06eIqYcWhzFacG7OgdijwhexGzZAHSXk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+ad24705d3fd6463b18c6@syzkaller.appspotmail.com, Jakub Kicinski , Andrii Nakryiko , Sasha Levin Subject: [PATCH 5.15 381/779] netdevsim: Avoid allocation warnings triggered from user space Date: Mon, 15 Aug 2022 20:00:25 +0200 Message-Id: <20220815180353.583783799@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jakub Kicinski [ Upstream commit d0b80a9edb1a029ff913e81b47540e57ad034329 ] We need to suppress warnings from sily map sizes. Also switch from GFP_USER to GFP_KERNEL_ACCOUNT, I'm pretty sure I misunderstood the flags when writing this code. Fixes: 395cacb5f1a0 ("netdevsim: bpf: support fake map offload") Reported-by: syzbot+ad24705d3fd6463b18c6@syzkaller.appspotmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/20220726213605.154204-1-kuba@kernel.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/netdevsim/bpf.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/net/netdevsim/bpf.c b/drivers/net/netdevsim/bpf.c index a43820212932..50854265864d 100644 --- a/drivers/net/netdevsim/bpf.c +++ b/drivers/net/netdevsim/bpf.c @@ -351,10 +351,12 @@ nsim_map_alloc_elem(struct bpf_offloaded_map *offmap,= unsigned int idx) { struct nsim_bpf_bound_map *nmap =3D offmap->dev_priv; =20 - nmap->entry[idx].key =3D kmalloc(offmap->map.key_size, GFP_USER); + nmap->entry[idx].key =3D kmalloc(offmap->map.key_size, + GFP_KERNEL_ACCOUNT | __GFP_NOWARN); if (!nmap->entry[idx].key) return -ENOMEM; - nmap->entry[idx].value =3D kmalloc(offmap->map.value_size, GFP_USER); + nmap->entry[idx].value =3D kmalloc(offmap->map.value_size, + GFP_KERNEL_ACCOUNT | __GFP_NOWARN); if (!nmap->entry[idx].value) { kfree(nmap->entry[idx].key); nmap->entry[idx].key =3D NULL; @@ -496,7 +498,7 @@ nsim_bpf_map_alloc(struct netdevsim *ns, struct bpf_off= loaded_map *offmap) if (offmap->map.map_flags) return -EINVAL; =20 - nmap =3D kzalloc(sizeof(*nmap), GFP_USER); + nmap =3D kzalloc(sizeof(*nmap), GFP_KERNEL_ACCOUNT); if (!nmap) return -ENOMEM; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E94B5C25B0E for ; Mon, 15 Aug 2022 19:05:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245396AbiHOTFG (ORCPT ); Mon, 15 Aug 2022 15:05:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245248AbiHOTBl (ORCPT ); Mon, 15 Aug 2022 15:01: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 E5A6F33A1E; Mon, 15 Aug 2022 11:33: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 DA9AFB8105D; Mon, 15 Aug 2022 18:32:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E085C433D6; Mon, 15 Aug 2022 18:32:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588374; bh=1wr7CAmYtvRQCyqKCWnL96CuCnp+lTL5P0DPj5UZM94=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kw1PnymjhgZSRro1o2uBAM4OiR+J7LTMlOC7kG63JOAxfQ8YTtLJThJtnlO2MKgbY MFr8E2ujchHptY+QiU2u0bVcXjHiSlpoXCWKXnnm1EyXrIoAPWykiae24Tlz1/FGdY BXnaqyYarV42wEArrozx+GUoCSkhDvjIIBWBdZck= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bernard Pidoux , Eric Dumazet , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 382/779] net: rose: fix netdev reference changes Date: Mon, 15 Aug 2022 20:00:26 +0200 Message-Id: <20220815180353.616960976@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 931027820e4dafabc78aff82af59f8c1c4bd3128 ] Bernard reported that trying to unload rose module would lead to infamous messages: unregistered_netdevice: waiting for rose0 to become free. Usage count =3D xx This patch solves the issue, by making sure each socket referring to a netdevice holds a reference count on it, and properly releases it in rose_release(). rose_dev_first() is also fixed to take a device reference before leaving the rcu_read_locked section. Following patch will add ref_tracker annotations to ease future bug hunting. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Reported-by: Bernard Pidoux Signed-off-by: Eric Dumazet Tested-by: Bernard Pidoux Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- net/rose/af_rose.c | 11 +++++++++-- net/rose/rose_route.c | 2 ++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c index cf7d974e0f61..29a208ed8fb8 100644 --- a/net/rose/af_rose.c +++ b/net/rose/af_rose.c @@ -191,6 +191,7 @@ static void rose_kill_by_device(struct net_device *dev) rose_disconnect(s, ENETUNREACH, ROSE_OUT_OF_ORDER, 0); if (rose->neighbour) rose->neighbour->use--; + dev_put(rose->device); rose->device =3D NULL; } } @@ -591,6 +592,8 @@ static struct sock *rose_make_new(struct sock *osk) rose->idle =3D orose->idle; rose->defer =3D orose->defer; rose->device =3D orose->device; + if (rose->device) + dev_hold(rose->device); rose->qbitincl =3D orose->qbitincl; =20 return sk; @@ -644,6 +647,7 @@ static int rose_release(struct socket *sock) break; } =20 + dev_put(rose->device); sock->sk =3D NULL; release_sock(sk); sock_put(sk); @@ -720,7 +724,6 @@ static int rose_connect(struct socket *sock, struct soc= kaddr *uaddr, int addr_le struct rose_sock *rose =3D rose_sk(sk); struct sockaddr_rose *addr =3D (struct sockaddr_rose *)uaddr; unsigned char cause, diagnostic; - struct net_device *dev; ax25_uid_assoc *user; int n, err =3D 0; =20 @@ -777,9 +780,12 @@ static int rose_connect(struct socket *sock, struct so= ckaddr *uaddr, int addr_le } =20 if (sock_flag(sk, SOCK_ZAPPED)) { /* Must bind first - autobinding in thi= s may or may not work */ + struct net_device *dev; + sock_reset_flag(sk, SOCK_ZAPPED); =20 - if ((dev =3D rose_dev_first()) =3D=3D NULL) { + dev =3D rose_dev_first(); + if (!dev) { err =3D -ENETUNREACH; goto out_release; } @@ -787,6 +793,7 @@ static int rose_connect(struct socket *sock, struct soc= kaddr *uaddr, int addr_le user =3D ax25_findbyuid(current_euid()); if (!user) { err =3D -EINVAL; + dev_put(dev); goto out_release; } =20 diff --git a/net/rose/rose_route.c b/net/rose/rose_route.c index 764a726debb1..66aa05db5390 100644 --- a/net/rose/rose_route.c +++ b/net/rose/rose_route.c @@ -615,6 +615,8 @@ struct net_device *rose_dev_first(void) if (first =3D=3D NULL || strncmp(dev->name, first->name, 3) < 0) first =3D dev; } + if (first) + dev_hold(first); rcu_read_unlock(); =20 return first; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20908C3F6B0 for ; Mon, 15 Aug 2022 19:06:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245100AbiHOTGz (ORCPT ); Mon, 15 Aug 2022 15:06:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245213AbiHOTBc (ORCPT ); Mon, 15 Aug 2022 15:01: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 0C20533346; Mon, 15 Aug 2022 11:33:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 09A1F60EEB; Mon, 15 Aug 2022 18:32:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0102EC433C1; Mon, 15 Aug 2022 18:32:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588377; bh=fgbD63ZK38KAvlC/0IPEiqXYZOkpZEoUNR19gQ29OQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UWtP1P/hVxBSlvrJYhE2UCSleRGnop20lLKb0P6Q0m8GFpWRc2pw7FDyzrvM2+mEn RmWcanFGKPA4IUBB4K7Efy6Yavut5RwB6kr905/rsNwOoDGCV9k0YY70STG8dJHZsg 1eJsqTMAPn6A4T2khXSCASuR09xLj1Nl6Wyr7kAg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jian Shen , Guangbin Huang , Shannon Nelson , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 383/779] net: ionic: fix error check for vlan flags in ionic_set_nic_features() Date: Mon, 15 Aug 2022 20:00:27 +0200 Message-Id: <20220815180353.657188214@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jian Shen [ Upstream commit a86e86db5e6d72c82724a63ca1c5293409a21518 ] The prototype of input features of ionic_set_nic_features() is netdev_features_t, but the vlan_flags is using the private definition of ionic drivers. It should use the variable ctx.cmd.lif_setattr.features, rather than features to check the vlan flags. So fixes it. Fixes: beead698b173 ("ionic: Add the basic NDO callbacks for netdev support= ") Signed-off-by: Jian Shen Signed-off-by: Guangbin Huang Acked-by: Shannon Nelson Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/ethernet/pensando/ionic/ionic_lif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_lif.c b/drivers/net/= ethernet/pensando/ionic/ionic_lif.c index 6ac507ddf09a..781313dbd04f 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_lif.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_lif.c @@ -1565,7 +1565,7 @@ static int ionic_set_nic_features(struct ionic_lif *l= if, if ((old_hw_features ^ lif->hw_features) & IONIC_ETH_HW_RX_HASH) ionic_lif_rss_config(lif, lif->rss_types, NULL, NULL); =20 - if ((vlan_flags & features) && + if ((vlan_flags & le64_to_cpu(ctx.cmd.lif_setattr.features)) && !(vlan_flags & le64_to_cpu(ctx.comp.lif_setattr.features))) dev_info_once(lif->ionic->dev, "NIC is not supporting vlan offload, like= ly in SmartNIC mode\n"); =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A57C1C00140 for ; Mon, 15 Aug 2022 19:05:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245387AbiHOTEy (ORCPT ); Mon, 15 Aug 2022 15:04:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245230AbiHOTBf (ORCPT ); Mon, 15 Aug 2022 15:01:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B87B133A1D; Mon, 15 Aug 2022 11:33: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 19E5260F7A; Mon, 15 Aug 2022 18:33:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15794C433C1; Mon, 15 Aug 2022 18:32:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588380; bh=HrPimmobdIk2vbtJv/TMugZDKgUGpjvpS3KaV+bxIQk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VikBquhg9sLn8uVIOtkpPOLlxszMI0fsRJLB8T72mMSDU/xsGYdTpwh5YN7BxXb43 GhbJYdRfUKsX33KkPJHS6GywOf5K2CzTyxHAgVv6HvlnoUbwhSmNKsvjLJGHQi4+8b iA55iKbzcg/Lj2ZkRIeE98jetLTaOG4Y5NBYIiT4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangyu Hua , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 384/779] dccp: put dccp_qpolicy_full() and dccp_qpolicy_push() in the same lock Date: Mon, 15 Aug 2022 20:00:28 +0200 Message-Id: <20220815180353.698944137@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 a41b17ff9dacd22f5f118ee53d82da0f3e52d5e3 ] In the case of sk->dccps_qpolicy =3D=3D DCCPQ_POLICY_PRIO, dccp_qpolicy_full will drop a skb when qpolicy is full. And the lock in dccp_sendmsg is released before sock_alloc_send_skb and then relocked after sock_alloc_send_skb. The following conditions may lead dccp_qpolicy_push to add skb to an already full sk_write_queue: thread1--->lock thread1--->dccp_qpolicy_full: queue is full. drop a skb thread1--->unlock thread2--->lock thread2--->dccp_qpolicy_full: queue is not full. no need to drop. thread2--->unlock thread1--->lock thread1--->dccp_qpolicy_push: add a skb. queue is full. thread1--->unlock thread2--->lock thread2--->dccp_qpolicy_push: add a skb! thread2--->unlock Fix this by moving dccp_qpolicy_full. Fixes: b1308dc015eb ("[DCCP]: Set TX Queue Length Bounds via Sysctl") Signed-off-by: Hangyu Hua Link: https://lore.kernel.org/r/20220729110027.40569-1-hbh25y@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- net/dccp/proto.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/net/dccp/proto.c b/net/dccp/proto.c index fc44dadc778b..c4de716f4994 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c @@ -747,11 +747,6 @@ int dccp_sendmsg(struct sock *sk, struct msghdr *msg, = size_t len) =20 lock_sock(sk); =20 - if (dccp_qpolicy_full(sk)) { - rc =3D -EAGAIN; - goto out_release; - } - timeo =3D sock_sndtimeo(sk, noblock); =20 /* @@ -770,6 +765,11 @@ int dccp_sendmsg(struct sock *sk, struct msghdr *msg, = size_t len) if (skb =3D=3D NULL) goto out_release; =20 + if (dccp_qpolicy_full(sk)) { + rc =3D -EAGAIN; + goto out_discard; + } + if (sk->sk_state =3D=3D DCCP_CLOSED) { rc =3D -ENOTCONN; goto out_discard; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0283C25B0E for ; Mon, 15 Aug 2022 19:05:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245026AbiHOTFL (ORCPT ); Mon, 15 Aug 2022 15:05:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245277AbiHOTBo (ORCPT ); Mon, 15 Aug 2022 15:01:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC4114B4B9; Mon, 15 Aug 2022 11:33: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 5F40461029; Mon, 15 Aug 2022 18:33:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CFE9C433D6; Mon, 15 Aug 2022 18:33:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588383; bh=HlTfPbXchC5cAD7jsM/6p4KFPwSHFJtQRD++oV1z8MA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IsIYxZvoCcuTipC0wvZ5KPlNUK7eYA3mEmIR0rofJwRnpz8ELQh+s2XulVlUgzWR5 EDn4CLbvDzId73oFPirwEcSeFAlriH/vKKEmDaJY7yy2zPgvuZAvMy6b599BvjbYvu pWjBevSg8xQ9BPe9vM/bxXzY567w4j+7XXAm3094= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geert Uytterhoeven , Hayes Wang , Jakub Kicinski , =?UTF-8?q?Maciej=20=C5=BBenczykowski?= , Paolo Abeni , Sasha Levin Subject: [PATCH 5.15 385/779] net: usb: make USB_RTL8153_ECM non user configurable Date: Mon, 15 Aug 2022 20:00:29 +0200 Message-Id: <20220815180353.747685622@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Maciej =C5=BBenczykowski [ Upstream commit f56530dcdb0684406661ac9f1accf48319d07600 ] This refixes: commit 7da17624e7948d5d9660b910f8079d26d26ce453 nt: usb: USB_RTL8153_ECM should not default to y In general, device drivers should not be enabled by default. which basically broke the commit it claimed to fix, ie: commit 657bc1d10bfc23ac06d5d687ce45826c760744f9 r8153_ecm: avoid to be prior to r8152 driver Avoid r8153_ecm is compiled as built-in, if r8152 driver is compiled as modules. Otherwise, the r8153_ecm would be used, even though the device is supported by r8152 driver. this commit amounted to: drivers/net/usb/Kconfig: +config USB_RTL8153_ECM + tristate "RTL8153 ECM support" + depends on USB_NET_CDCETHER && (USB_RTL8152 || USB_RTL8152=3Dn) + default y + help + This option supports ECM mode for RTL8153 ethernet adapter, when + CONFIG_USB_RTL8152 is not set, or the RTL8153 device is not + supported by r8152 driver. drivers/net/usb/Makefile: -obj-$(CONFIG_USB_NET_CDCETHER) +=3D cdc_ether.o r8153_ecm.o +obj-$(CONFIG_USB_NET_CDCETHER) +=3D cdc_ether.o +obj-$(CONFIG_USB_RTL8153_ECM) +=3D r8153_ecm.o And as can be seen it pulls a piece of the cdc_ether driver out into a separate config option to be able to make this piece modular in case cdc_ether is builtin, while r8152 is modular. While in general, device drivers should indeed not be enabled by default: this isn't a device driver per say, but rather this is support code for the CDCETHER (ECM) driver, and should thus be enabled if it is enabled. See also email thread at: https://www.spinics.net/lists/netdev/msg767649.html In: https://www.spinics.net/lists/netdev/msg768284.html Jakub wrote: And when we say "removed" we can just hide it from what's prompted to the user (whatever such internal options are called)? I believe this way we don't bring back Marek's complaint. Side note: these incorrect defaults will result in Android 13 on 5.15 GKI kernels lacking USB_RTL8153_ECM support while having USB_NET_CDCETHER (luckily we also have USB_RTL8150 and USB_RTL8152, so it's probably only an issue for very new RTL815x hardware with no native 5.15 driver). Fixes: 7da17624e7948d5d ("nt: usb: USB_RTL8153_ECM should not default to y") Cc: Geert Uytterhoeven Cc: Greg Kroah-Hartman Cc: Hayes Wang Cc: Jakub Kicinski Signed-off-by: Maciej =C5=BBenczykowski Link: https://lore.kernel.org/r/20220730230113.4138858-1-zenczykowski@gmail= .com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/usb/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/usb/Kconfig b/drivers/net/usb/Kconfig index b554054a7560..8939e5fbd50a 100644 --- a/drivers/net/usb/Kconfig +++ b/drivers/net/usb/Kconfig @@ -636,8 +636,9 @@ config USB_NET_AQC111 * Aquantia AQtion USB to 5GbE =20 config USB_RTL8153_ECM - tristate "RTL8153 ECM support" + tristate depends on USB_NET_CDCETHER && (USB_RTL8152 || USB_RTL8152=3Dn) + default y help This option supports ECM mode for RTL8153 ethernet adapter, when CONFIG_USB_RTL8152 is not set, or the RTL8153 device is not --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC041C00140 for ; Mon, 15 Aug 2022 19:05:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245433AbiHOTFU (ORCPT ); Mon, 15 Aug 2022 15:05:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245375AbiHOTBy (ORCPT ); Mon, 15 Aug 2022 15:01:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B10A733A19; Mon, 15 Aug 2022 11:33: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 35E47610A4; Mon, 15 Aug 2022 18:33:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CFA1C433C1; Mon, 15 Aug 2022 18:33:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588389; bh=hG2YwfD3GERqvp7dAQn4lJn8v53PgZPVyBYg36/I2NI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ztNv+EugwAXUhOEb+XsnNzJIkoF2htQTJ+KriEuUwNO0rCv2Faeohu1wWmHgYnT6D zfxwG7nEUAEvu31nnK+xM+mCtdNXwta43X7idoLSdKpB6xCn3Gfom5OtrRL+ccSgyn QsIUkcuRkUz/3pz0Eoy5ti9trn0zgBqzbC2bQDzg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , "Jason A. Donenfeld" , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 386/779] wireguard: ratelimiter: use hrtimer in selftest Date: Mon, 15 Aug 2022 20:00:30 +0200 Message-Id: <20220815180353.787691263@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 151c8e499f4705010780189377f85b57400ccbf5 ] Using msleep() is problematic because it's compared against ratelimiter.c's ktime_get_coarse_boottime_ns(), which means on systems with slow jiffies (such as UML's forced HZ=3D100), the result is inaccurate. So switch to using schedule_hrtimeout(). However, hrtimer gives us access only to the traditional posix timers, and none of the _COARSE variants. So now, rather than being too imprecise like jiffies, it's too precise. One solution would be to give it a large "range" value, but this will still fire early on a loaded system. A better solution is to align the timeout to the actual coarse timer, and then round up to the nearest tick, plus change. So add the timeout to the current coarse time, and then schedule_hrtimer() until the absolute computed time. This should hopefully reduce flakes in CI as well. Note that we keep the retry loop in case the entire function is running behind, because the test could still be scheduled out, by either the kernel or by the hypervisor's kernel, in which case restarting the test and hoping to not be scheduled out still helps. Fixes: e7096c131e51 ("net: WireGuard secure network tunnel") Suggested-by: Thomas Gleixner Signed-off-by: Jason A. Donenfeld Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/wireguard/selftest/ratelimiter.c | 25 +++++++++++--------- kernel/time/hrtimer.c | 1 + 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/drivers/net/wireguard/selftest/ratelimiter.c b/drivers/net/wir= eguard/selftest/ratelimiter.c index 007cd4457c5f..ba87d294604f 100644 --- a/drivers/net/wireguard/selftest/ratelimiter.c +++ b/drivers/net/wireguard/selftest/ratelimiter.c @@ -6,28 +6,29 @@ #ifdef DEBUG =20 #include +#include =20 static const struct { bool result; - unsigned int msec_to_sleep_before; + u64 nsec_to_sleep_before; } expected_results[] __initconst =3D { [0 ... PACKETS_BURSTABLE - 1] =3D { true, 0 }, [PACKETS_BURSTABLE] =3D { false, 0 }, - [PACKETS_BURSTABLE + 1] =3D { true, MSEC_PER_SEC / PACKETS_PER_SECOND }, + [PACKETS_BURSTABLE + 1] =3D { true, NSEC_PER_SEC / PACKETS_PER_SECOND }, [PACKETS_BURSTABLE + 2] =3D { false, 0 }, - [PACKETS_BURSTABLE + 3] =3D { true, (MSEC_PER_SEC / PACKETS_PER_SECOND) *= 2 }, + [PACKETS_BURSTABLE + 3] =3D { true, (NSEC_PER_SEC / PACKETS_PER_SECOND) *= 2 }, [PACKETS_BURSTABLE + 4] =3D { true, 0 }, [PACKETS_BURSTABLE + 5] =3D { false, 0 } }; =20 static __init unsigned int maximum_jiffies_at_index(int index) { - unsigned int total_msecs =3D 2 * MSEC_PER_SEC / PACKETS_PER_SECOND / 3; + u64 total_nsecs =3D 2 * NSEC_PER_SEC / PACKETS_PER_SECOND / 3; int i; =20 for (i =3D 0; i <=3D index; ++i) - total_msecs +=3D expected_results[i].msec_to_sleep_before; - return msecs_to_jiffies(total_msecs); + total_nsecs +=3D expected_results[i].nsec_to_sleep_before; + return nsecs_to_jiffies(total_nsecs); } =20 static __init int timings_test(struct sk_buff *skb4, struct iphdr *hdr4, @@ -42,8 +43,12 @@ static __init int timings_test(struct sk_buff *skb4, str= uct iphdr *hdr4, loop_start_time =3D jiffies; =20 for (i =3D 0; i < ARRAY_SIZE(expected_results); ++i) { - if (expected_results[i].msec_to_sleep_before) - msleep(expected_results[i].msec_to_sleep_before); + if (expected_results[i].nsec_to_sleep_before) { + ktime_t timeout =3D ktime_add(ktime_add_ns(ktime_get_coarse_boottime(),= TICK_NSEC * 4 / 3), + ns_to_ktime(expected_results[i].nsec_to_sleep_before)); + set_current_state(TASK_UNINTERRUPTIBLE); + schedule_hrtimeout_range_clock(&timeout, 0, HRTIMER_MODE_ABS, CLOCK_BOO= TTIME); + } =20 if (time_is_before_jiffies(loop_start_time + maximum_jiffies_at_index(i))) @@ -127,7 +132,7 @@ bool __init wg_ratelimiter_selftest(void) if (IS_ENABLED(CONFIG_KASAN) || IS_ENABLED(CONFIG_UBSAN)) return true; =20 - BUILD_BUG_ON(MSEC_PER_SEC % PACKETS_PER_SECOND !=3D 0); + BUILD_BUG_ON(NSEC_PER_SEC % PACKETS_PER_SECOND !=3D 0); =20 if (wg_ratelimiter_init()) goto out; @@ -176,7 +181,6 @@ bool __init wg_ratelimiter_selftest(void) test +=3D test_count; goto err; } - msleep(500); continue; } else if (ret < 0) { test +=3D test_count; @@ -195,7 +199,6 @@ bool __init wg_ratelimiter_selftest(void) test +=3D test_count; goto err; } - msleep(50); continue; } test +=3D test_count; diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c index 0ea8702eb516..23af5eca11b1 100644 --- a/kernel/time/hrtimer.c +++ b/kernel/time/hrtimer.c @@ -2311,6 +2311,7 @@ schedule_hrtimeout_range_clock(ktime_t *expires, u64 = delta, =20 return !t.task ? 0 : -EINTR; } +EXPORT_SYMBOL_GPL(schedule_hrtimeout_range_clock); =20 /** * schedule_hrtimeout_range - sleep until timeout --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94EEAC00140 for ; Mon, 15 Aug 2022 19:05:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245452AbiHOTFb (ORCPT ); Mon, 15 Aug 2022 15:05:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245432AbiHOTCA (ORCPT ); Mon, 15 Aug 2022 15:02:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 552604BD3D; Mon, 15 Aug 2022 11:33: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 1D772B8106E; Mon, 15 Aug 2022 18:33:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D14EC433D6; Mon, 15 Aug 2022 18:33:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588392; bh=u0HsNN8rMYruFAvZHEvP0r2fe53rUhzO3lCv1NuR+A8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jP4LWPNJv+YT4IfnjOqMtNVnWnve3ojKMn6IoFAaZAfVx2mNxKaW8q2l/UB43ihz2 Fej6pny0xpo52U0Wq8mGQdkr+LyNrfiSxbPnFWe/+CDjVYEylTOdw9OmvbvWNP3QuU bUz5PVKNgv6L7u9oO7gFQXetHxEzVW8pH0Cq/cUA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Torvalds , "Jason A. Donenfeld" , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 387/779] wireguard: allowedips: dont corrupt stack when detecting overflow Date: Mon, 15 Aug 2022 20:00:31 +0200 Message-Id: <20220815180353.829565855@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 c31b14d86dfe7174361e8c6e5df6c2c3a4d5918c ] In case push_rcu() and related functions are buggy, there's a WARN_ON(len >=3D 128), which the selftest tries to hit by being tricky. In case it is hit, we shouldn't corrupt the kernel's stack, though; otherwise it may be hard to even receive the report that it's buggy. So conditionalize the stack write based on that WARN_ON()'s return value. Note that this never *actually* happens anyway. The WARN_ON() in the first place is bounded by IS_ENABLED(DEBUG), and isn't expected to ever actually hit. This is just a debugging sanity check. Additionally, hoist the constant 128 into a named enum, MAX_ALLOWEDIPS_BITS, so that it's clear why this value is chosen. Suggested-by: Linus Torvalds Link: https://lore.kernel.org/all/CAHk-=3DwjJZGA6w_DxA+k7Ejbqsq+uGK=3D=3Dko= Pai3sqdsfJqemvag@mail.gmail.com/ Fixes: e7096c131e51 ("net: WireGuard secure network tunnel") Signed-off-by: Jason A. Donenfeld Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/wireguard/allowedips.c | 9 ++++++--- drivers/net/wireguard/selftest/allowedips.c | 6 +++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/net/wireguard/allowedips.c b/drivers/net/wireguard/all= owedips.c index 9a4c8ff32d9d..5bf7822c53f1 100644 --- a/drivers/net/wireguard/allowedips.c +++ b/drivers/net/wireguard/allowedips.c @@ -6,6 +6,8 @@ #include "allowedips.h" #include "peer.h" =20 +enum { MAX_ALLOWEDIPS_BITS =3D 128 }; + static struct kmem_cache *node_cache; =20 static void swap_endian(u8 *dst, const u8 *src, u8 bits) @@ -40,7 +42,8 @@ static void push_rcu(struct allowedips_node **stack, struct allowedips_node __rcu *p, unsigned int *len) { if (rcu_access_pointer(p)) { - WARN_ON(IS_ENABLED(DEBUG) && *len >=3D 128); + if (WARN_ON(IS_ENABLED(DEBUG) && *len >=3D MAX_ALLOWEDIPS_BITS)) + return; stack[(*len)++] =3D rcu_dereference_raw(p); } } @@ -52,7 +55,7 @@ static void node_free_rcu(struct rcu_head *rcu) =20 static void root_free_rcu(struct rcu_head *rcu) { - struct allowedips_node *node, *stack[128] =3D { + struct allowedips_node *node, *stack[MAX_ALLOWEDIPS_BITS] =3D { container_of(rcu, struct allowedips_node, rcu) }; unsigned int len =3D 1; =20 @@ -65,7 +68,7 @@ static void root_free_rcu(struct rcu_head *rcu) =20 static void root_remove_peer_lists(struct allowedips_node *root) { - struct allowedips_node *node, *stack[128] =3D { root }; + struct allowedips_node *node, *stack[MAX_ALLOWEDIPS_BITS] =3D { root }; unsigned int len =3D 1; =20 while (len > 0 && (node =3D stack[--len])) { diff --git a/drivers/net/wireguard/selftest/allowedips.c b/drivers/net/wire= guard/selftest/allowedips.c index e173204ae7d7..41db10f9be49 100644 --- a/drivers/net/wireguard/selftest/allowedips.c +++ b/drivers/net/wireguard/selftest/allowedips.c @@ -593,10 +593,10 @@ bool __init wg_allowedips_selftest(void) wg_allowedips_remove_by_peer(&t, a, &mutex); test_negative(4, a, 192, 168, 0, 1); =20 - /* These will hit the WARN_ON(len >=3D 128) in free_node if something - * goes wrong. + /* These will hit the WARN_ON(len >=3D MAX_ALLOWEDIPS_BITS) in free_node + * if something goes wrong. */ - for (i =3D 0; i < 128; ++i) { + for (i =3D 0; i < MAX_ALLOWEDIPS_BITS; ++i) { part =3D cpu_to_be64(~(1LLU << (i % 64))); memset(&ip, 0xff, 16); memcpy((u8 *)&ip + (i < 64) * 8, &part, 8); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EBE60C00140 for ; Mon, 15 Aug 2022 19:05:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245448AbiHOTF0 (ORCPT ); Mon, 15 Aug 2022 15:05:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245434AbiHOTCA (ORCPT ); Mon, 15 Aug 2022 15: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 B19064BD3E; Mon, 15 Aug 2022 11:33: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 4494E61029; Mon, 15 Aug 2022 18:33:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47559C433D6; Mon, 15 Aug 2022 18:33:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588395; bh=SQUrOBXqf5/aHpf7ZBuGXQqIx9y/uHaCHkNS/jJXmJE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vD4zXs8quGPRvjTLMk+QlU06gX0HHGQT+kOAjTRdbiH+dYZVCS9OIeZSIl0yZXfLL PfezLyKheExbwfjxMSKg14Y/iUiu3i0hFjPPl8DRk2R9TpcGC/NAqe/1hUMe04c84P nauhkBTxTFKFup82saz5R/N1gReT/CYWimso/Z6U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Chang , Mario Limonciello , Basavaraj Natikar , Jiri Kosina , Sasha Levin Subject: [PATCH 5.15 388/779] HID: amd_sfh: Dont show client init failed as error when discovery fails Date: Mon, 15 Aug 2022 20:00:32 +0200 Message-Id: <20220815180353.880699617@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 e51d8d3ea3d773334d2c047c8d1623dba66f592a ] When sensor discovery fails, this means that the system doesn't have any sensors connected and a user should only be notified at most one time. A message is already displayed at WARN level of "failed to discover, sensors not enabled". It's pointless to show that the client init failed at ERR level for the same condition. Check the return code and don't display this message in those conditions. Fixes: b5d7f43e97da ("HID: amd_sfh: Add support for sensor discovery") Reported-by: David Chang Signed-off-by: Mario Limonciello Acked-by: Basavaraj Natikar Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c b/drivers/hid/amd-sfh-h= id/amd_sfh_pcie.c index ae8f1f2536e9..13a4db42cd7a 100644 --- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c +++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c @@ -323,7 +323,8 @@ static int amd_mp2_pci_probe(struct pci_dev *pdev, cons= t struct pci_device_id *i rc =3D amd_sfh_hid_client_init(privdata); if (rc) { amd_sfh_clear_intr(privdata); - dev_err(&pdev->dev, "amd_sfh_hid_client_init failed\n"); + if (rc !=3D -EOPNOTSUPP) + dev_err(&pdev->dev, "amd_sfh_hid_client_init failed\n"); return rc; } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6997DC25B08 for ; Mon, 15 Aug 2022 19:10:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343705AbiHOTKV (ORCPT ); Mon, 15 Aug 2022 15:10:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343586AbiHOTGl (ORCPT ); Mon, 15 Aug 2022 15:06: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 8AB43BE6; Mon, 15 Aug 2022 11:35: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 29D8C61019; Mon, 15 Aug 2022 18:35:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C12EC433C1; Mon, 15 Aug 2022 18:35:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588519; bh=hVpoeMwUvpglwrk2FaC7xACVbQKklXD3rXGWF/M7v7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eBBZF3XuroKftKrTO8M9lx8AtvO5KX4HEqm/xynFCDb2Z8Oyiruy0tDlU5mmIQLoW rS+B0e9hvpvQ/RZ2obkhhJurTPc1udAKaL+8EAp9O3EsSaeqQwnJFAbNjohzzAT8wz k6sWqaH7pSrCKzrhWYe6xRgF/1KY0FsGbmYlZe7c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ralph Siemsen , Phil Edworthy , Geert Uytterhoeven , Sasha Levin Subject: [PATCH 5.15 389/779] clk: renesas: r9a06g032: Fix UART clkgrp bitsel Date: Mon, 15 Aug 2022 20:00:33 +0200 Message-Id: <20220815180353.921877745@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ralph Siemsen [ Upstream commit 2dee50ab9e72a3cae75b65e5934c8dd3e9bf01bc ] There are two UART clock groups, each having a mux to select its upstream clock source. The register/bit definitions for accessing these two muxes appear to have been reversed since introduction. Correct them so as to match the hardware manual. Fixes: 4c3d88526eba ("clk: renesas: Renesas R9A06G032 clock driver") Signed-off-by: Ralph Siemsen Reviewed-by: Phil Edworthy Link: https://lore.kernel.org/r/20220518182527.1693156-1-ralph.siemsen@lina= ro.org Signed-off-by: Geert Uytterhoeven Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/clk/renesas/r9a06g032-clocks.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/clk/renesas/r9a06g032-clocks.c b/drivers/clk/renesas/r= 9a06g032-clocks.c index c99942f0e4d4..abc0891fd96d 100644 --- a/drivers/clk/renesas/r9a06g032-clocks.c +++ b/drivers/clk/renesas/r9a06g032-clocks.c @@ -286,8 +286,8 @@ static const struct r9a06g032_clkdesc r9a06g032_clocks[= ] =3D { .name =3D "uart_group_012", .type =3D K_BITSEL, .source =3D 1 + R9A06G032_DIV_UART, - /* R9A06G032_SYSCTRL_REG_PWRCTRL_PG1_PR2 */ - .dual.sel =3D ((0xec / 4) << 5) | 24, + /* R9A06G032_SYSCTRL_REG_PWRCTRL_PG0_0 */ + .dual.sel =3D ((0x34 / 4) << 5) | 30, .dual.group =3D 0, }, { @@ -295,8 +295,8 @@ static const struct r9a06g032_clkdesc r9a06g032_clocks[= ] =3D { .name =3D "uart_group_34567", .type =3D K_BITSEL, .source =3D 1 + R9A06G032_DIV_P2_PG, - /* R9A06G032_SYSCTRL_REG_PWRCTRL_PG0_0 */ - .dual.sel =3D ((0x34 / 4) << 5) | 30, + /* R9A06G032_SYSCTRL_REG_PWRCTRL_PG1_PR2 */ + .dual.sel =3D ((0xec / 4) << 5) | 24, .dual.group =3D 1, }, D_UGATE(CLK_UART0, "clk_uart0", UART_GROUP_012, 0, 0, 0x1b2, 0x1b3, 0x1b4= , 0x1b5), --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0B55C25B08 for ; Mon, 15 Aug 2022 19:07:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245443AbiHOTHT (ORCPT ); Mon, 15 Aug 2022 15:07:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245679AbiHOTCf (ORCPT ); Mon, 15 Aug 2022 15:02:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A38C4D158; Mon, 15 Aug 2022 11:33: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 39737610A5; Mon, 15 Aug 2022 18:33:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D118C433D7; Mon, 15 Aug 2022 18:33:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588420; bh=dUu8ueBkoD9WU0J+cgsPNoGbfDPcl41stYx5RPPV8tc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MQKI4iC/1C8UVIKMVoDy9BJn1PPgJLC8kdypMdv0HscM8754s1PviccqN5/0WSSkW /aArTsyuiuXoSDM93wlaAVp41a5MYFZyBuHSi1jeRajL6z5fQ2bUuGdQ662AUmMKVM yv4VnVxmFEq6UGKiFKAeifTiq/Tl5/K1GvMw7Oso= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Linus Walleij , Miquel Raynal , Sasha Levin Subject: [PATCH 5.15 390/779] mtd: maps: Fix refcount leak in of_flash_probe_versatile Date: Mon, 15 Aug 2022 20:00:34 +0200 Message-Id: <20220815180353.963800547@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 33ec82a6d2b119938f26e5c8040ed5d92378eb54 ] of_find_matching_node_and_match() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: b0afd44bc192 ("mtd: physmap_of: add a hook for Versatile write prote= ction") Signed-off-by: Miaoqian Lin Reviewed-by: Linus Walleij Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220523140205.48625-1-linmq006@gma= il.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/mtd/maps/physmap-versatile.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mtd/maps/physmap-versatile.c b/drivers/mtd/maps/physma= p-versatile.c index ad7cd9cfaee0..297a50957356 100644 --- a/drivers/mtd/maps/physmap-versatile.c +++ b/drivers/mtd/maps/physmap-versatile.c @@ -207,6 +207,7 @@ int of_flash_probe_versatile(struct platform_device *pd= ev, =20 versatile_flashprot =3D (enum versatile_flashprot)devid->data; rmap =3D syscon_node_to_regmap(sysnp); + of_node_put(sysnp); if (IS_ERR(rmap)) return PTR_ERR(rmap); =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4290FC00140 for ; Mon, 15 Aug 2022 19:08:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245758AbiHOTIT (ORCPT ); Mon, 15 Aug 2022 15:08:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242806AbiHOTE1 (ORCPT ); Mon, 15 Aug 2022 15:04:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 744732A415; Mon, 15 Aug 2022 11:34: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 083A461024; Mon, 15 Aug 2022 18:34:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A22DC433C1; Mon, 15 Aug 2022 18:34:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588454; bh=Y2YVxMxFUYn+u8NnVUBKFgPVl4Mn/bDpZE1Y3UP0Zr4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bkgFwWL5lTdwxXBrSTV6pnBu8ITiprsS7aqwvSFqyovpQURhp/qrKaQe9jlKhck49 Ri4z0ZvN75OyxOCCAHzZ794sizg0pBMg+0AcsJ9CGXsCs8sglLIYz7t2c2V+KHAbRA 7ImMldNQ8g6ai8VGSdsRTXLYlfnp1Ilgdo38NptM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Linus Walleij , Miquel Raynal , Sasha Levin Subject: [PATCH 5.15 391/779] mtd: maps: Fix refcount leak in ap_flash_init Date: Mon, 15 Aug 2022 20:00:35 +0200 Message-Id: <20220815180354.002946786@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 77087a04c8fd554134bddcb8a9ff87b21f357926 ] of_find_matching_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: b0afd44bc192 ("mtd: physmap_of: add a hook for Versatile write prote= ction") Signed-off-by: Miaoqian Lin Reviewed-by: Linus Walleij Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220523143255.4376-1-linmq006@gmai= l.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/mtd/maps/physmap-versatile.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mtd/maps/physmap-versatile.c b/drivers/mtd/maps/physma= p-versatile.c index 297a50957356..a1b8b7b25f88 100644 --- a/drivers/mtd/maps/physmap-versatile.c +++ b/drivers/mtd/maps/physmap-versatile.c @@ -93,6 +93,7 @@ static int ap_flash_init(struct platform_device *pdev) return -ENODEV; } ebi_base =3D of_iomap(ebi, 0); + of_node_put(ebi); if (!ebi_base) return -ENODEV; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3AEC3C00140 for ; Mon, 15 Aug 2022 19:09:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343619AbiHOTJT (ORCPT ); Mon, 15 Aug 2022 15:09:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245730AbiHOTGK (ORCPT ); Mon, 15 Aug 2022 15:06:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 122942CDD7; Mon, 15 Aug 2022 11:34: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 A3D7D6105C; Mon, 15 Aug 2022 18:34:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D8CAC433C1; Mon, 15 Aug 2022 18:34:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588489; bh=JDV9LBwF5joWK8HGi4wBwjEykNxNVY96ePmNBMJjcug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PanmB8eaXtt/yJVlCZRVxWagEdwhHo+HOVYMzbb4QbIf5FUC1xe+grFWQku3bF1VG M3Gy1JXvg+Ucfrb9MN0vimUiAOzQg6VR+79L8DTPmlnTyl9cEgpPbK9C+Xh+YTV5kn Qvd9V4bD311QgunN+OiL7JP8f1TgRWS5RFLxiWHg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Liang Yang , Miquel Raynal , Sasha Levin Subject: [PATCH 5.15 392/779] mtd: rawnand: meson: Fix a potential double free issue Date: Mon, 15 Aug 2022 20:00:36 +0200 Message-Id: <20220815180354.051787381@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET [ Upstream commit ec0da06337751b18f6dee06b6526e0f0d6e80369 ] When meson_nfc_nand_chip_cleanup() is called, it will call: meson_nfc_free_buffer(&meson_chip->nand); nand_cleanup(&meson_chip->nand); nand_cleanup() in turn will call nand_detach() which calls the .detach_chip() which is here meson_nand_detach_chip(). meson_nand_detach_chip() already calls meson_nfc_free_buffer(), so we could double free some memory. Fix it by removing the unneeded explicit call to meson_nfc_free_buffer(). Fixes: 8fae856c5350 ("mtd: rawnand: meson: add support for Amlogic NAND fla= sh controller") Signed-off-by: Christophe JAILLET Acked-by: Liang Yang Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/ec15c358b8063f7c50ff4cd628cf0d2e14e= 43f49.1653064877.git.christophe.jaillet@wanadoo.fr Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/mtd/nand/raw/meson_nand.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson= _nand.c index ac3be92872d0..032180183339 100644 --- a/drivers/mtd/nand/raw/meson_nand.c +++ b/drivers/mtd/nand/raw/meson_nand.c @@ -1307,7 +1307,6 @@ static int meson_nfc_nand_chip_cleanup(struct meson_n= fc *nfc) if (ret) return ret; =20 - meson_nfc_free_buffer(&meson_chip->nand); nand_cleanup(&meson_chip->nand); list_del(&meson_chip->node); } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9601FC25B0E for ; Mon, 15 Aug 2022 19:09:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245707AbiHOTJy (ORCPT ); Mon, 15 Aug 2022 15:09:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343533AbiHOTGe (ORCPT ); Mon, 15 Aug 2022 15: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 19E652CE06; Mon, 15 Aug 2022 11:35: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 7B5E3B81071; Mon, 15 Aug 2022 18:35:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A69EEC433C1; Mon, 15 Aug 2022 18:35:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588501; bh=PJZZ+/e4mIVlgrrPHXuNSVSBGTwOABVk6n+gfozGbhg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XjAuPDmkWNLkqeSiCuc0PWIlWUs3umkLS7NawH7mKS9uw94sJ7V+vbLU72YhYFMU4 zHzsPT6rJ0COt+4czuqKzqzDZa6QkIdN3Jge5p1S3Oi/m1odCeRUJbUOdVywMQt+8f Bs4HvWaF5jR01icXxI5S3AVdwEnPTs8hn1j8VfkU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Frank Rowand , Prakhar Srivastava , Lakshmi Ramasubramanian , Thiago Jung Bauermann , Rob Herring , Ritesh Harjani , Robin Murphy , Vaibhav Jain , Sasha Levin Subject: [PATCH 5.15 393/779] of: check previous kernels ima-kexec-buffer against memory bounds Date: Mon, 15 Aug 2022 20:00:37 +0200 Message-Id: <20220815180354.089279026@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vaibhav Jain [ Upstream commit cbf9c4b9617b6767886a913705ca14b7600c77db ] Presently ima_get_kexec_buffer() doesn't check if the previous kernel's ima-kexec-buffer lies outside the addressable memory range. This can result in a kernel panic if the new kernel is booted with 'mem=3DX' arg and the ima-kexec-buffer was allocated beyond that range by the previous kernel. The panic is usually of the form below: $ sudo kexec --initrd initrd vmlinux --append=3D'mem=3D16G' BUG: Unable to handle kernel data access on read at 0xc000c01fff7f0000 Faulting instruction address: 0xc000000000837974 Oops: Kernel access of bad area, sig: 11 [#1] NIP [c000000000837974] ima_restore_measurement_list+0x94/0x6c0 LR [c00000000083b55c] ima_load_kexec_buffer+0xac/0x160 Call Trace: [c00000000371fa80] [c00000000083b55c] ima_load_kexec_buffer+0xac/0x160 [c00000000371fb00] [c0000000020512c4] ima_init+0x80/0x108 [c00000000371fb70] [c0000000020514dc] init_ima+0x4c/0x120 [c00000000371fbf0] [c000000000012240] do_one_initcall+0x60/0x2c0 [c00000000371fcc0] [c000000002004ad0] kernel_init_freeable+0x344/0x3ec [c00000000371fda0] [c0000000000128a4] kernel_init+0x34/0x1b0 [c00000000371fe10] [c00000000000ce64] ret_from_kernel_thread+0x5c/0x64 Instruction dump: f92100b8 f92100c0 90e10090 910100a0 4182050c 282a0017 3bc00000 40810330 7c0802a6 fb610198 7c9b2378 f80101d0 2c090001 40820614 e9240010 ---[ end trace 0000000000000000 ]--- Fix this issue by checking returned PFN range of previous kernel's ima-kexec-buffer with page_is_ram() to ensure correct memory bounds. Fixes: 467d27824920 ("powerpc: ima: get the kexec buffer passed by the prev= ious kernel") Cc: Frank Rowand Cc: Prakhar Srivastava Cc: Lakshmi Ramasubramanian Cc: Thiago Jung Bauermann Cc: Rob Herring Cc: Ritesh Harjani Cc: Robin Murphy Signed-off-by: Vaibhav Jain Signed-off-by: Rob Herring Link: https://lore.kernel.org/r/20220531041446.3334259-1-vaibhav@linux.ibm.= com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/of/kexec.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/of/kexec.c b/drivers/of/kexec.c index 72c790a3c910..8f9dba11873c 100644 --- a/drivers/of/kexec.c +++ b/drivers/of/kexec.c @@ -125,6 +125,7 @@ int ima_get_kexec_buffer(void **addr, size_t *size) { int ret, len; unsigned long tmp_addr; + unsigned long start_pfn, end_pfn; size_t tmp_size; const void *prop; =20 @@ -139,6 +140,22 @@ int ima_get_kexec_buffer(void **addr, size_t *size) if (ret) return ret; =20 + /* Do some sanity on the returned size for the ima-kexec buffer */ + if (!tmp_size) + return -ENOENT; + + /* + * Calculate the PFNs for the buffer and ensure + * they are with in addressable memory. + */ + start_pfn =3D PHYS_PFN(tmp_addr); + end_pfn =3D PHYS_PFN(tmp_addr + tmp_size - 1); + if (!page_is_ram(start_pfn) || !page_is_ram(end_pfn)) { + pr_warn("IMA buffer at 0x%lx, size =3D 0x%zx beyond memory\n", + tmp_addr, tmp_size); + return -EINVAL; + } + *addr =3D __va(tmp_addr); *size =3D tmp_size; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB86EC25B0E for ; Mon, 15 Aug 2022 19:09:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245665AbiHOTJq (ORCPT ); Mon, 15 Aug 2022 15:09:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343531AbiHOTGd (ORCPT ); Mon, 15 Aug 2022 15:06:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93CDE2CE3F; Mon, 15 Aug 2022 11:35:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 21B54610A1; Mon, 15 Aug 2022 18:35:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5260C433D6; Mon, 15 Aug 2022 18:35:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588504; bh=YeHsT/o+epz24teyQPZKuJBnCqNbhFIRK0I1Mr5QP4M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t7w+5Zzmv5P1Ws5DRhml24A2pZ7sLxzpp20GK3tjle+4RYNp+w1TUibnH4WgG2E+s JHpBu0PSOsDFm5mXSn2Tfk3SArEGzqevmoY+IK+PTFo0imqSPkXoggj4VMA6WXWqzM /rZU84z0MtwfEFUiSEQ+IxCXOOTbDW/zgZx75gHU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quinn Tran , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.15 394/779] scsi: qla2xxx: edif: Reduce Initiator-Initiator thrashing Date: Mon, 15 Aug 2022 20:00:38 +0200 Message-Id: <20220815180354.122563401@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran [ Upstream commit 9c40c36e75ffd49952cd4ead0672defc4b4dbdf7 ] This patch uses GFFID switch command to scan whether remote device is Target or Initiator mode. Based on that info, driver will not pass up Initiator info to authentication application. This helps reduce unnecessary stress for authentication application to deal with unused connections. Link: https://lore.kernel.org/r/20220607044627.19563-2-njavali@marvell.com Fixes: 7ebb336e45ef ("scsi: qla2xxx: edif: Add start + stop bsgs") Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_def.h | 2 + drivers/scsi/qla2xxx/qla_edif.c | 32 ++++++++- drivers/scsi/qla2xxx/qla_gbl.h | 3 +- drivers/scsi/qla2xxx/qla_gs.c | 118 +++++++++++++++++++++++--------- drivers/scsi/qla2xxx/qla_iocb.c | 2 +- 5 files changed, 120 insertions(+), 37 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 76427c8780f5..883b3fb07c2c 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -3201,6 +3201,8 @@ struct ct_sns_rsp { #define GFF_NVME_OFFSET 23 /* type =3D 28h */ struct { uint8_t fc4_features[128]; +#define FC4_FF_TARGET BIT_0 +#define FC4_FF_INITIATOR BIT_1 } gff_id; struct { uint8_t reserved; diff --git a/drivers/scsi/qla2xxx/qla_edif.c b/drivers/scsi/qla2xxx/qla_edi= f.c index e40b9cc38214..e42141635377 100644 --- a/drivers/scsi/qla2xxx/qla_edif.c +++ b/drivers/scsi/qla2xxx/qla_edif.c @@ -517,16 +517,28 @@ qla_edif_app_start(scsi_qla_host_t *vha, struct bsg_j= ob *bsg_job) if (atomic_read(&vha->loop_state) =3D=3D LOOP_DOWN) break; =20 - fcport->edif.app_started =3D 1; fcport->login_retry =3D vha->hw->login_retry_count; =20 - /* no activity */ fcport->edif.app_stop =3D 0; + fcport->edif.app_sess_online =3D 0; + fcport->edif.app_started =3D 1; + + if (fcport->scan_state !=3D QLA_FCPORT_FOUND) + continue; + + if (fcport->port_type =3D=3D FCT_UNKNOWN && + !fcport->fc4_features) + rval =3D qla24xx_async_gffid(vha, fcport, true); + + if (!rval && !(fcport->fc4_features & FC4_FF_TARGET || + fcport->port_type & (FCT_TARGET|FCT_NVME_TARGET))) + continue; + + rval =3D 0; =20 ql_dbg(ql_dbg_edif, vha, 0x911e, "%s wwpn %8phC calling qla_edif_reset_auth_wait\n", __func__, fcport->port_name); - fcport->edif.app_sess_online =3D 0; qlt_schedule_sess_for_deletion(fcport); qla_edif_sa_ctl_init(vha, fcport); } @@ -884,6 +896,20 @@ qla_edif_app_getfcinfo(scsi_qla_host_t *vha, struct bs= g_job *bsg_job) app_reply->ports[pcnt].rekey_count =3D fcport->edif.rekey_cnt; =20 + if (fcport->scan_state !=3D QLA_FCPORT_FOUND) + continue; + + if (fcport->port_type =3D=3D FCT_UNKNOWN && !fcport->fc4_features) + rval =3D qla24xx_async_gffid(vha, fcport, true); + + if (!rval && + !(fcport->fc4_features & FC4_FF_TARGET || + fcport->port_type & + (FCT_TARGET | FCT_NVME_TARGET))) + continue; + + rval =3D 0; + app_reply->ports[pcnt].remote_type =3D VND_CMD_RTYPE_UNKNOWN; if (fcport->port_type & (FCT_NVME_TARGET | FCT_TARGET)) diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index 83912787fa2e..2f6afdbd2dfa 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -334,6 +334,7 @@ extern int qla24xx_configure_prot_mode(srb_t *, uint16_= t *); extern int qla24xx_issue_sa_replace_iocb(scsi_qla_host_t *vha, struct qla_work_evt *e); void qla2x00_sp_release(struct kref *kref); +void qla2x00_els_dcmd2_iocb_timeout(void *data); =20 /* * Global Function Prototypes in qla_mbx.c source file. @@ -722,7 +723,7 @@ int qla24xx_async_gpsc(scsi_qla_host_t *, fc_port_t *); void qla24xx_handle_gpsc_event(scsi_qla_host_t *, struct event_arg *); int qla2x00_mgmt_svr_login(scsi_qla_host_t *); void qla24xx_handle_gffid_event(scsi_qla_host_t *vha, struct event_arg *ea= ); -int qla24xx_async_gffid(scsi_qla_host_t *vha, fc_port_t *fcport); +int qla24xx_async_gffid(scsi_qla_host_t *vha, fc_port_t *fcport, bool); int qla24xx_async_gpnft(scsi_qla_host_t *, u8, srb_t *); void qla24xx_async_gpnft_done(scsi_qla_host_t *, srb_t *); void qla24xx_async_gnnft_done(scsi_qla_host_t *, srb_t *); diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c index c54011510b6a..f89911beaade 100644 --- a/drivers/scsi/qla2xxx/qla_gs.c +++ b/drivers/scsi/qla2xxx/qla_gs.c @@ -3276,19 +3276,12 @@ int qla24xx_async_gpnid(scsi_qla_host_t *vha, port_= id_t *id) return rval; } =20 -void qla24xx_handle_gffid_event(scsi_qla_host_t *vha, struct event_arg *ea) -{ - fc_port_t *fcport =3D ea->fcport; - - qla24xx_post_gnl_work(vha, fcport); -} =20 void qla24xx_async_gffid_sp_done(srb_t *sp, int res) { struct scsi_qla_host *vha =3D sp->vha; fc_port_t *fcport =3D sp->fcport; struct ct_sns_rsp *ct_rsp; - struct event_arg ea; uint8_t fc4_scsi_feat; uint8_t fc4_nvme_feat; =20 @@ -3296,10 +3289,10 @@ void qla24xx_async_gffid_sp_done(srb_t *sp, int res) "Async done-%s res %x ID %x. %8phC\n", sp->name, res, fcport->d_id.b24, fcport->port_name); =20 - fcport->flags &=3D ~FCF_ASYNC_SENT; - ct_rsp =3D &fcport->ct_desc.ct_sns->p.rsp; + ct_rsp =3D sp->u.iocb_cmd.u.ctarg.rsp; fc4_scsi_feat =3D ct_rsp->rsp.gff_id.fc4_features[GFF_FCP_SCSI_OFFSET]; fc4_nvme_feat =3D ct_rsp->rsp.gff_id.fc4_features[GFF_NVME_OFFSET]; + sp->rc =3D res; =20 /* * FC-GS-7, 5.2.3.12 FC-4 Features - format @@ -3320,24 +3313,42 @@ void qla24xx_async_gffid_sp_done(srb_t *sp, int res) } } =20 - memset(&ea, 0, sizeof(ea)); - ea.sp =3D sp; - ea.fcport =3D sp->fcport; - ea.rc =3D res; + if (sp->flags & SRB_WAKEUP_ON_COMP) { + complete(sp->comp); + } else { + if (sp->u.iocb_cmd.u.ctarg.req) { + dma_free_coherent(&vha->hw->pdev->dev, + sp->u.iocb_cmd.u.ctarg.req_allocated_size, + sp->u.iocb_cmd.u.ctarg.req, + sp->u.iocb_cmd.u.ctarg.req_dma); + sp->u.iocb_cmd.u.ctarg.req =3D NULL; + } =20 - qla24xx_handle_gffid_event(vha, &ea); - /* ref: INIT */ - kref_put(&sp->cmd_kref, qla2x00_sp_release); + if (sp->u.iocb_cmd.u.ctarg.rsp) { + dma_free_coherent(&vha->hw->pdev->dev, + sp->u.iocb_cmd.u.ctarg.rsp_allocated_size, + sp->u.iocb_cmd.u.ctarg.rsp, + sp->u.iocb_cmd.u.ctarg.rsp_dma); + sp->u.iocb_cmd.u.ctarg.rsp =3D NULL; + } + + /* ref: INIT */ + kref_put(&sp->cmd_kref, qla2x00_sp_release); + /* we should not be here */ + dump_stack(); + } } =20 /* Get FC4 Feature with Nport ID. */ -int qla24xx_async_gffid(scsi_qla_host_t *vha, fc_port_t *fcport) +int qla24xx_async_gffid(scsi_qla_host_t *vha, fc_port_t *fcport, bool wait) { int rval =3D QLA_FUNCTION_FAILED; struct ct_sns_req *ct_req; srb_t *sp; + DECLARE_COMPLETION_ONSTACK(comp); =20 - if (!vha->flags.online || (fcport->flags & FCF_ASYNC_SENT)) + /* this routine does not have handling for no wait */ + if (!vha->flags.online || !wait) return rval; =20 /* ref: INIT */ @@ -3345,43 +3356,86 @@ int qla24xx_async_gffid(scsi_qla_host_t *vha, fc_po= rt_t *fcport) if (!sp) return rval; =20 - fcport->flags |=3D FCF_ASYNC_SENT; sp->type =3D SRB_CT_PTHRU_CMD; sp->name =3D "gffid"; sp->gen1 =3D fcport->rscn_gen; sp->gen2 =3D fcport->login_gen; qla2x00_init_async_sp(sp, qla2x00_get_async_timeout(vha) + 2, qla24xx_async_gffid_sp_done); + sp->comp =3D ∁ + sp->u.iocb_cmd.timeout =3D qla2x00_els_dcmd2_iocb_timeout; + + if (wait) + sp->flags =3D SRB_WAKEUP_ON_COMP; + + sp->u.iocb_cmd.u.ctarg.req_allocated_size =3D sizeof(struct ct_sns_pkt); + sp->u.iocb_cmd.u.ctarg.req =3D dma_alloc_coherent(&vha->hw->pdev->dev, + sp->u.iocb_cmd.u.ctarg.req_allocated_size, + &sp->u.iocb_cmd.u.ctarg.req_dma, + GFP_KERNEL); + if (!sp->u.iocb_cmd.u.ctarg.req) { + ql_log(ql_log_warn, vha, 0xd041, + "%s: Failed to allocate ct_sns request.\n", + __func__); + goto done_free_sp; + } + + sp->u.iocb_cmd.u.ctarg.rsp_allocated_size =3D sizeof(struct ct_sns_pkt); + sp->u.iocb_cmd.u.ctarg.rsp =3D dma_alloc_coherent(&vha->hw->pdev->dev, + sp->u.iocb_cmd.u.ctarg.rsp_allocated_size, + &sp->u.iocb_cmd.u.ctarg.rsp_dma, + GFP_KERNEL); + if (!sp->u.iocb_cmd.u.ctarg.req) { + ql_log(ql_log_warn, vha, 0xd041, + "%s: Failed to allocate ct_sns request.\n", + __func__); + goto done_free_sp; + } =20 /* CT_IU preamble */ - ct_req =3D qla2x00_prep_ct_req(fcport->ct_desc.ct_sns, GFF_ID_CMD, - GFF_ID_RSP_SIZE); + ct_req =3D qla2x00_prep_ct_req(sp->u.iocb_cmd.u.ctarg.req, GFF_ID_CMD, GF= F_ID_RSP_SIZE); =20 ct_req->req.gff_id.port_id[0] =3D fcport->d_id.b.domain; ct_req->req.gff_id.port_id[1] =3D fcport->d_id.b.area; ct_req->req.gff_id.port_id[2] =3D fcport->d_id.b.al_pa; =20 - sp->u.iocb_cmd.u.ctarg.req =3D fcport->ct_desc.ct_sns; - sp->u.iocb_cmd.u.ctarg.req_dma =3D fcport->ct_desc.ct_sns_dma; - sp->u.iocb_cmd.u.ctarg.rsp =3D fcport->ct_desc.ct_sns; - sp->u.iocb_cmd.u.ctarg.rsp_dma =3D fcport->ct_desc.ct_sns_dma; sp->u.iocb_cmd.u.ctarg.req_size =3D GFF_ID_REQ_SIZE; sp->u.iocb_cmd.u.ctarg.rsp_size =3D GFF_ID_RSP_SIZE; sp->u.iocb_cmd.u.ctarg.nport_handle =3D NPH_SNS; =20 - ql_dbg(ql_dbg_disc, vha, 0x2132, - "Async-%s hdl=3D%x %8phC.\n", sp->name, - sp->handle, fcport->port_name); - rval =3D qla2x00_start_sp(sp); - if (rval !=3D QLA_SUCCESS) + + if (rval !=3D QLA_SUCCESS) { + rval =3D QLA_FUNCTION_FAILED; goto done_free_sp; + } else { + ql_dbg(ql_dbg_disc, vha, 0x3074, + "Async-%s hdl=3D%x portid %06x\n", + sp->name, sp->handle, fcport->d_id.b24); + } + + wait_for_completion(sp->comp); + rval =3D sp->rc; =20 - return rval; done_free_sp: + if (sp->u.iocb_cmd.u.ctarg.req) { + dma_free_coherent(&vha->hw->pdev->dev, + sp->u.iocb_cmd.u.ctarg.req_allocated_size, + sp->u.iocb_cmd.u.ctarg.req, + sp->u.iocb_cmd.u.ctarg.req_dma); + sp->u.iocb_cmd.u.ctarg.req =3D NULL; + } + + if (sp->u.iocb_cmd.u.ctarg.rsp) { + dma_free_coherent(&vha->hw->pdev->dev, + sp->u.iocb_cmd.u.ctarg.rsp_allocated_size, + sp->u.iocb_cmd.u.ctarg.rsp, + sp->u.iocb_cmd.u.ctarg.rsp_dma); + sp->u.iocb_cmd.u.ctarg.rsp =3D NULL; + } + /* ref: INIT */ kref_put(&sp->cmd_kref, qla2x00_sp_release); - fcport->flags &=3D ~FCF_ASYNC_SENT; return rval; } =20 diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_ioc= b.c index 606228f4a8b5..7ff2d9c84bde 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -2819,7 +2819,7 @@ qla24xx_els_logo_iocb(srb_t *sp, struct els_entry_24x= x *els_iocb) sp->vha->qla_stats.control_requests++; } =20 -static void +void qla2x00_els_dcmd2_iocb_timeout(void *data) { srb_t *sp =3D data; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7D59C00140 for ; Mon, 15 Aug 2022 19:09:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245685AbiHOTJu (ORCPT ); Mon, 15 Aug 2022 15:09:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343537AbiHOTGe (ORCPT ); Mon, 15 Aug 2022 15:06: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 B87904F18A; Mon, 15 Aug 2022 11:35: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 0B6D0B8105D; Mon, 15 Aug 2022 18:35:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14424C433C1; Mon, 15 Aug 2022 18:35:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588507; bh=xuBhzV4jFujLSQZDG0nTbqRsXfUJtHiN4aWTe+yiPow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zdfv9y/FVl7WqxznSHJIdSYn13LxpUwJ5+MtsDq+w+cx7j6S9k6H8736stQBR4dHS 9FlWnNl+Hjj+AGpBBpxKo5TlPM9JM3ZeKYyBhj8N4aggSEcU54H9o82FM7S6OpQ/K3 KnVTfxCU7ZuMl4XUZ81fUdrYnHckpuyDGrkWFD7k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quinn Tran , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.15 395/779] scsi: qla2xxx: edif: Fix potential stuck session in sa update Date: Mon, 15 Aug 2022 20:00:39 +0200 Message-Id: <20220815180354.155378571@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran [ Upstream commit e0fb8ce2bb9e52c846e54ad2c58b5b7beb13eb09 ] When a thread is in the process of reestablish a session, a flag is set to prevent multiple threads/triggers from doing the same task. This flag was left on, and any attempt to relogin was locked out. Clear this flag if the attempt has failed. Link: https://lore.kernel.org/r/20220607044627.19563-6-njavali@marvell.com Fixes: dd30706e73b7 ("scsi: qla2xxx: edif: Add key update") Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_edif.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_edif.c b/drivers/scsi/qla2xxx/qla_edi= f.c index e42141635377..4be876dd9f6b 100644 --- a/drivers/scsi/qla2xxx/qla_edif.c +++ b/drivers/scsi/qla2xxx/qla_edif.c @@ -2187,6 +2187,7 @@ edif_doorbell_show(struct device *dev, struct device_= attribute *attr, =20 static void qla_noop_sp_done(srb_t *sp, int res) { + sp->fcport->flags &=3D ~(FCF_ASYNC_SENT | FCF_ASYNC_ACTIVE); /* ref: INIT */ kref_put(&sp->cmd_kref, qla2x00_sp_release); } @@ -2211,7 +2212,8 @@ qla24xx_issue_sa_replace_iocb(scsi_qla_host_t *vha, s= truct qla_work_evt *e) if (!sa_ctl) { ql_dbg(ql_dbg_edif, vha, 0x70e6, "sa_ctl allocation failed\n"); - return -ENOMEM; + rval =3D -ENOMEM; + goto done; } =20 fcport =3D sa_ctl->fcport; @@ -2221,7 +2223,8 @@ qla24xx_issue_sa_replace_iocb(scsi_qla_host_t *vha, s= truct qla_work_evt *e) if (!sp) { ql_dbg(ql_dbg_edif, vha, 0x70e6, "SRB allocation failed\n"); - return -ENOMEM; + rval =3D -ENOMEM; + goto done; } =20 fcport->flags |=3D FCF_ASYNC_SENT; @@ -2250,9 +2253,17 @@ qla24xx_issue_sa_replace_iocb(scsi_qla_host_t *vha, = struct qla_work_evt *e) =20 rval =3D qla2x00_start_sp(sp); =20 - if (rval !=3D QLA_SUCCESS) + if (rval !=3D QLA_SUCCESS) { rval =3D QLA_FUNCTION_FAILED; + goto done_free_sp; + } =20 + return rval; +done_free_sp: + kref_put(&sp->cmd_kref, qla2x00_sp_release); + fcport->flags &=3D ~FCF_ASYNC_SENT; +done: + fcport->flags &=3D ~FCF_ASYNC_ACTIVE; return rval; } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86D0DC00140 for ; Mon, 15 Aug 2022 19:09:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343517AbiHOTJ5 (ORCPT ); Mon, 15 Aug 2022 15:09:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343549AbiHOTGg (ORCPT ); Mon, 15 Aug 2022 15: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 50A654F18F; Mon, 15 Aug 2022 11:35: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 F0DD8B8106C; Mon, 15 Aug 2022 18:35:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47C5EC433C1; Mon, 15 Aug 2022 18:35:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588510; bh=FA8gCMNgw+Mhv8s7WRCL66F4pG7UoLvoA7yC6pWc+/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wXV1JQf+/RuQ/yWpK/w8F+D3fYivlgYMtfzG1Pq9PfEZuOeHniuiue+nWB3wJs34V gToPxMUJK5YyBjYVUm7If+n3Rj/wYOQfys434DVdW+NYKZc1jid8edVhCY1fDQy0oR m/7taGHUrzJvdTB+WBSb507uitHSSfBuoX3qB4QQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Himanshu Madhani , Quinn Tran , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.15 396/779] scsi: qla2xxx: edif: Reduce connection thrash Date: Mon, 15 Aug 2022 20:00:40 +0200 Message-Id: <20220815180354.201904358@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran [ Upstream commit 91f6f5fbe87ba834133fcc61d34881cb8ec9e518 ] On ipsec start by remote port, target port may use RSCN to trigger initiator to relogin. If driver is already in the process of a relogin, then ignore the RSCN and allow the current relogin to continue. This reduces thrashing of the connection. Link: https://lore.kernel.org/r/20211026115412.27691-10-njavali@marvell.com Reviewed-by: Himanshu Madhani Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_attr.c | 7 ++++++- drivers/scsi/qla2xxx/qla_edif.h | 4 ++++ drivers/scsi/qla2xxx/qla_init.c | 24 ++++++++++++++++++++++-- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_att= r.c index d3534e7f2d21..bd4ebc1b5c1e 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c @@ -2754,7 +2754,12 @@ qla2x00_terminate_rport_io(struct fc_rport *rport) if (fcport->loop_id !=3D FC_NO_LOOP_ID) fcport->logout_on_delete =3D 1; =20 - qlt_schedule_sess_for_deletion(fcport); + if (!EDIF_NEGOTIATION_PENDING(fcport)) { + ql_dbg(ql_dbg_disc, fcport->vha, 0x911e, + "%s %d schedule session deletion\n", __func__, + __LINE__); + qlt_schedule_sess_for_deletion(fcport); + } } else { qla2x00_port_logout(fcport->vha, fcport); } diff --git a/drivers/scsi/qla2xxx/qla_edif.h b/drivers/scsi/qla2xxx/qla_edi= f.h index 32800bfb32a3..2517005fb08c 100644 --- a/drivers/scsi/qla2xxx/qla_edif.h +++ b/drivers/scsi/qla2xxx/qla_edif.h @@ -133,4 +133,8 @@ struct enode { _s->disc_state =3D=3D DSC_DELETED || \ !_s->edif.app_sess_online)) =20 +#define EDIF_NEGOTIATION_PENDING(_fcport) \ + ((_fcport->vha.e_dbell.db_flags & EDB_ACTIVE) && \ + (_fcport->disc_state =3D=3D DSC_LOGIN_AUTH_PEND)) + #endif /* __QLA_EDIF_H */ diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_ini= t.c index be150fc76dba..09ddaa8cb653 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -1825,8 +1825,28 @@ void qla2x00_handle_rscn(scsi_qla_host_t *vha, struc= t event_arg *ea) fcport->d_id.b24, fcport->port_name); return; } - fcport->scan_needed =3D 1; - fcport->rscn_gen++; + + if (vha->hw->flags.edif_enabled && vha->e_dbell.db_flags & EDB_ACTIVE) { + /* + * On ipsec start by remote port, Target port + * may use RSCN to trigger initiator to + * relogin. If driver is already in the + * process of a relogin, then ignore the RSCN + * and allow the current relogin to continue. + * This reduces thrashing of the connection. + */ + if (atomic_read(&fcport->state) =3D=3D FCS_ONLINE) { + /* + * If state =3D online, then set scan_needed=3D1 to do relogin. + * Otherwise we're already in the middle of a relogin + */ + fcport->scan_needed =3D 1; + fcport->rscn_gen++; + } + } else { + fcport->scan_needed =3D 1; + fcport->rscn_gen++; + } } break; case RSCN_AREA_ADDR: --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E5D8C00140 for ; Mon, 15 Aug 2022 19:10:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343693AbiHOTKK (ORCPT ); Mon, 15 Aug 2022 15:10:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343582AbiHOTGl (ORCPT ); Mon, 15 Aug 2022 15:06:41 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E5812DD; Mon, 15 Aug 2022 11:35: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 55FFFCE1263; Mon, 15 Aug 2022 18:35:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4396DC433D6; Mon, 15 Aug 2022 18:35:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588513; bh=vpR8qTRcA4MkElrs8I2tta6kS+EFC94wwfhoVNxAppY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YSC1GEaOcs9AciEP863pTUj6lIg06pT63EH2Cmxu6+n3vHYGDsjIV5UbRzlcsq2t8 X21mbyZpYIOqcwmrAGgtmbKK52a0EZcURD0iJSapB3XsOTUAovuDfJxr90wMZaY2z9 hjAMpWtDSXp88PxiJIiGE8Q7ebteoTHm3bFVSGaw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Himanshu Madhani , Quinn Tran , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.15 397/779] scsi: qla2xxx: edif: Fix inconsistent check of db_flags Date: Mon, 15 Aug 2022 20:00:41 +0200 Message-Id: <20220815180354.241161666@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran [ Upstream commit 36f468bfe98c7de7916ab3391ee5dd6fd2549979 ] db_flags field is a bit field. Replace value check with bit flag check. Link: https://lore.kernel.org/r/20211026115412.27691-12-njavali@marvell.com Reviewed-by: Himanshu Madhani Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_edif.c | 26 +++++++++++++------------- drivers/scsi/qla2xxx/qla_edif.h | 7 +++++-- drivers/scsi/qla2xxx/qla_init.c | 13 ++++++------- drivers/scsi/qla2xxx/qla_iocb.c | 3 +-- drivers/scsi/qla2xxx/qla_target.c | 2 +- 5 files changed, 26 insertions(+), 25 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_edif.c b/drivers/scsi/qla2xxx/qla_edi= f.c index 4be876dd9f6b..bdcc38bd955a 100644 --- a/drivers/scsi/qla2xxx/qla_edif.c +++ b/drivers/scsi/qla2xxx/qla_edif.c @@ -218,7 +218,7 @@ fc_port_t *fcport) "%s edif not enabled\n", __func__); goto done; } - if (vha->e_dbell.db_flags !=3D EDB_ACTIVE) { + if (DBELL_INACTIVE(vha)) { ql_dbg(ql_dbg_edif, vha, 0x09102, "%s doorbell not enabled\n", __func__); goto done; @@ -482,9 +482,9 @@ qla_edif_app_start(scsi_qla_host_t *vha, struct bsg_job= *bsg_job) ql_dbg(ql_dbg_edif, vha, 0x911d, "%s app_vid=3D%x app_start_flags %x\n", __func__, appstart.app_info.app_vid, appstart.app_start_flags); =20 - if (vha->e_dbell.db_flags !=3D EDB_ACTIVE) { + if (DBELL_INACTIVE(vha)) { /* mark doorbell as active since an app is now present */ - vha->e_dbell.db_flags =3D EDB_ACTIVE; + vha->e_dbell.db_flags |=3D EDB_ACTIVE; } else { ql_dbg(ql_dbg_edif, vha, 0x911e, "%s doorbell already active\n", __func__); @@ -1306,7 +1306,7 @@ qla24xx_sadb_update(struct bsg_job *bsg_job) goto done; } =20 - if (vha->e_dbell.db_flags !=3D EDB_ACTIVE) { + if (DBELL_INACTIVE(vha)) { ql_log(ql_log_warn, vha, 0x70a1, "App not started\n"); rval =3D -EIO; SET_DID_STATUS(bsg_reply->result, DID_ERROR); @@ -1813,7 +1813,7 @@ qla_els_reject_iocb(scsi_qla_host_t *vha, struct qla_= qpair *qp, void qla_edb_init(scsi_qla_host_t *vha) { - if (vha->e_dbell.db_flags =3D=3D EDB_ACTIVE) { + if (DBELL_ACTIVE(vha)) { /* list already init'd - error */ ql_dbg(ql_dbg_edif, vha, 0x09102, "edif db already initialized, cannot reinit\n"); @@ -1856,7 +1856,7 @@ static void qla_edb_clear(scsi_qla_host_t *vha, port_= id_t portid) port_id_t sid; LIST_HEAD(edb_list); =20 - if (vha->e_dbell.db_flags !=3D EDB_ACTIVE) { + if (DBELL_INACTIVE(vha)) { /* doorbell list not enabled */ ql_dbg(ql_dbg_edif, vha, 0x09102, "%s doorbell not enabled\n", __func__); @@ -1908,7 +1908,7 @@ qla_edb_stop(scsi_qla_host_t *vha) unsigned long flags; struct edb_node *node, *q; =20 - if (vha->e_dbell.db_flags !=3D EDB_ACTIVE) { + if (DBELL_INACTIVE(vha)) { /* doorbell list not enabled */ ql_dbg(ql_dbg_edif, vha, 0x09102, "%s doorbell not enabled\n", __func__); @@ -1959,7 +1959,7 @@ qla_edb_node_add(scsi_qla_host_t *vha, struct edb_nod= e *ptr) { unsigned long flags; =20 - if (vha->e_dbell.db_flags !=3D EDB_ACTIVE) { + if (DBELL_INACTIVE(vha)) { /* doorbell list not enabled */ ql_dbg(ql_dbg_edif, vha, 0x09102, "%s doorbell not enabled\n", __func__); @@ -1990,7 +1990,7 @@ qla_edb_eventcreate(scsi_qla_host_t *vha, uint32_t db= type, return; } =20 - if (vha->e_dbell.db_flags !=3D EDB_ACTIVE) { + if (DBELL_INACTIVE(vha)) { if (fcport) fcport->edif.auth_state =3D dbtype; /* doorbell list not enabled */ @@ -2085,7 +2085,7 @@ qla_edif_timer(scsi_qla_host_t *vha) struct qla_hw_data *ha =3D vha->hw; =20 if (!vha->vp_idx && N2N_TOPO(ha) && ha->flags.n2n_fw_acc_sec) { - if (vha->e_dbell.db_flags !=3D EDB_ACTIVE && + if (DBELL_INACTIVE(vha) && ha->edif_post_stop_cnt_down) { ha->edif_post_stop_cnt_down--; =20 @@ -2123,7 +2123,7 @@ edif_doorbell_show(struct device *dev, struct device_= attribute *attr, sz =3D 256; =20 /* stop new threads from waiting if we're not init'd */ - if (vha->e_dbell.db_flags !=3D EDB_ACTIVE) { + if (DBELL_INACTIVE(vha)) { ql_dbg(ql_dbg_edif + ql_dbg_verbose, vha, 0x09122, "%s error - edif db not enabled\n", __func__); return 0; @@ -2480,7 +2480,7 @@ void qla24xx_auth_els(scsi_qla_host_t *vha, void **pk= t, struct rsp_que **rsp) =20 fcport =3D qla2x00_find_fcport_by_pid(host, &purex->pur_info.pur_sid); =20 - if (host->e_dbell.db_flags !=3D EDB_ACTIVE || + if (DBELL_INACTIVE(vha) || (fcport && EDIF_SESSION_DOWN(fcport))) { ql_dbg(ql_dbg_edif, host, 0x0910c, "%s e_dbell.db_flags =3D%x %06x\n", __func__, host->e_dbell.db_flags, @@ -3506,7 +3506,7 @@ int qla_edif_process_els(scsi_qla_host_t *vha, struct= bsg_job *bsg_job) =20 void qla_edif_sess_down(struct scsi_qla_host *vha, struct fc_port *sess) { - if (sess->edif.app_sess_online && vha->e_dbell.db_flags & EDB_ACTIVE) { + if (sess->edif.app_sess_online && DBELL_ACTIVE(vha)) { ql_dbg(ql_dbg_disc, vha, 0xf09c, "%s: sess %8phN send port_offline event\n", __func__, sess->port_name); diff --git a/drivers/scsi/qla2xxx/qla_edif.h b/drivers/scsi/qla2xxx/qla_edi= f.h index 2517005fb08c..a965ca8e47ce 100644 --- a/drivers/scsi/qla2xxx/qla_edif.h +++ b/drivers/scsi/qla2xxx/qla_edif.h @@ -41,9 +41,12 @@ struct pur_core { }; =20 enum db_flags_t { - EDB_ACTIVE =3D 0x1, + EDB_ACTIVE =3D BIT_0, }; =20 +#define DBELL_ACTIVE(_v) (_v->e_dbell.db_flags & EDB_ACTIVE) +#define DBELL_INACTIVE(_v) (!(_v->e_dbell.db_flags & EDB_ACTIVE)) + struct edif_dbell { enum db_flags_t db_flags; spinlock_t db_lock; @@ -134,7 +137,7 @@ struct enode { !_s->edif.app_sess_online)) =20 #define EDIF_NEGOTIATION_PENDING(_fcport) \ - ((_fcport->vha.e_dbell.db_flags & EDB_ACTIVE) && \ + (DBELL_ACTIVE(_fcport->vha) && \ (_fcport->disc_state =3D=3D DSC_LOGIN_AUTH_PEND)) =20 #endif /* __QLA_EDIF_H */ diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_ini= t.c index 09ddaa8cb653..2bed5050bcaf 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -341,7 +341,7 @@ qla2x00_async_login(struct scsi_qla_host *vha, fc_port_= t *fcport, lio->u.logio.flags |=3D SRB_LOGIN_PRLI_ONLY; } else { if (vha->hw->flags.edif_enabled && - vha->e_dbell.db_flags & EDB_ACTIVE) { + DBELL_ACTIVE(vha)) { lio->u.logio.flags |=3D (SRB_LOGIN_FCSP | SRB_LOGIN_SKIP_PRLI); ql_dbg(ql_dbg_disc, vha, 0x2072, @@ -881,7 +881,7 @@ static void qla24xx_handle_gnl_done_event(scsi_qla_host= _t *vha, break; case DSC_LS_PLOGI_COMP: if (vha->hw->flags.edif_enabled && - vha->e_dbell.db_flags & EDB_ACTIVE) { + DBELL_ACTIVE(vha)) { /* check to see if App support secure or not */ qla24xx_post_gpdb_work(vha, fcport, 0); break; @@ -1477,7 +1477,7 @@ static int qla_chk_secure_login(scsi_qla_host_t *vha,= fc_port_t *fcport, qla2x00_post_aen_work(vha, FCH_EVT_PORT_ONLINE, fcport->d_id.b24); =20 - if (vha->e_dbell.db_flags =3D=3D EDB_ACTIVE) { + if (DBELL_ACTIVE(vha)) { ql_dbg(ql_dbg_disc, vha, 0x20ef, "%s %d %8phC EDIF: post DB_AUTH: AUTH needed\n", __func__, __LINE__, fcport->port_name); @@ -1826,7 +1826,7 @@ void qla2x00_handle_rscn(scsi_qla_host_t *vha, struct= event_arg *ea) return; } =20 - if (vha->hw->flags.edif_enabled && vha->e_dbell.db_flags & EDB_ACTIVE) { + if (vha->hw->flags.edif_enabled && DBELL_ACTIVE(vha)) { /* * On ipsec start by remote port, Target port * may use RSCN to trigger initiator to @@ -4266,7 +4266,7 @@ qla24xx_update_fw_options(scsi_qla_host_t *vha) * fw shal not send PRLI after PLOGI Acc */ if (ha->flags.edif_enabled && - vha->e_dbell.db_flags & EDB_ACTIVE) { + DBELL_ACTIVE(vha)) { ha->fw_options[3] |=3D BIT_15; ha->flags.n2n_fw_acc_sec =3D 1; } else { @@ -5424,8 +5424,7 @@ qla2x00_configure_loop(scsi_qla_host_t *vha) * use link up to wake up app to get ready for * authentication. */ - if (ha->flags.edif_enabled && - !(vha->e_dbell.db_flags & EDB_ACTIVE)) + if (ha->flags.edif_enabled && DBELL_INACTIVE(vha)) qla2x00_post_aen_work(vha, FCH_EVT_LINKUP, ha->link_data_rate); =20 diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_ioc= b.c index 7ff2d9c84bde..46c879923da1 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -3065,8 +3065,7 @@ qla24xx_els_dcmd2_iocb(scsi_qla_host_t *vha, int els_= opcode, elsio->u.els_plogi.els_cmd =3D els_opcode; elsio->u.els_plogi.els_plogi_pyld->opcode =3D els_opcode; =20 - if (els_opcode =3D=3D ELS_DCMD_PLOGI && vha->hw->flags.edif_enabled && - vha->e_dbell.db_flags & EDB_ACTIVE) { + if (els_opcode =3D=3D ELS_DCMD_PLOGI && DBELL_ACTIVE(vha)) { struct fc_els_flogi *p =3D ptr; =20 p->fl_csp.sp_features |=3D cpu_to_be16(FC_SP_FT_SEC); diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_t= arget.c index ae5eaa4a9283..7ab3c9e4d478 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -4815,7 +4815,7 @@ static int qlt_handle_login(struct scsi_qla_host *vha, } =20 if (vha->hw->flags.edif_enabled) { - if (!(vha->e_dbell.db_flags & EDB_ACTIVE)) { + if (DBELL_INACTIVE(vha)) { ql_dbg(ql_dbg_disc, vha, 0xffff, "%s %d Term INOT due to app not started lid=3D%d, NportID %06X ", __func__, __LINE__, loop_id, port_id.b24); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2FC51C00140 for ; Mon, 15 Aug 2022 19:10:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343700AbiHOTKQ (ORCPT ); Mon, 15 Aug 2022 15:10:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343583AbiHOTGl (ORCPT ); Mon, 15 Aug 2022 15:06:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E0752F1; Mon, 15 Aug 2022 11:35: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 2F6ED6111E; Mon, 15 Aug 2022 18:35:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 288DFC433D6; Mon, 15 Aug 2022 18:35:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588516; bh=OXU6gWN+TFhf/Eb7663ju9r2gZoBdA9HTNpedrm1o+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bEpay/RxhWowvAPJRy/tK830BTo5dntv2aS0jfZ8nLfOX9eZI9/KF4bpnpBxn7Bde tgaLfYX5TOVou8iHWluEd9KPfgYxVu169vvyWJ0jMP5wUeIR7BRN17D7WYbit1Jua3 WT9pT/Roc2VmURvJtwN56zc7lJ3WqSbxV/2ZuQaQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quinn Tran , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.15 398/779] scsi: qla2xxx: edif: Synchronize NPIV deletion with authentication application Date: Mon, 15 Aug 2022 20:00:42 +0200 Message-Id: <20220815180354.283823621@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran [ Upstream commit cf79716e6636400ae38c37bc8a652b1e522abbba ] Notify authentication application of a NPIV deletion event is about to occur. This allows app to perform cleanup. Link: https://lore.kernel.org/r/20220607044627.19563-7-njavali@marvell.com Fixes: 9efea843a906 ("scsi: qla2xxx: edif: Add detection of secure device") Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_edif_bsg.h | 2 ++ drivers/scsi/qla2xxx/qla_mid.c | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/qla2xxx/qla_edif_bsg.h b/drivers/scsi/qla2xxx/qla= _edif_bsg.h index 53026d82ebff..af9f1ffb1e4a 100644 --- a/drivers/scsi/qla2xxx/qla_edif_bsg.h +++ b/drivers/scsi/qla2xxx/qla_edif_bsg.h @@ -217,4 +217,6 @@ struct auth_complete_cmd { =20 #define RX_DELAY_DELETE_TIMEOUT 20 =20 +#define FCH_EVT_VENDOR_UNIQUE_VPORT_DOWN 1 + #endif /* QLA_EDIF_BSG_H */ diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c index e6b5c4ccce97..eb43a5f1b399 100644 --- a/drivers/scsi/qla2xxx/qla_mid.c +++ b/drivers/scsi/qla2xxx/qla_mid.c @@ -166,9 +166,13 @@ qla24xx_disable_vp(scsi_qla_host_t *vha) int ret =3D QLA_SUCCESS; fc_port_t *fcport; =20 - if (vha->hw->flags.edif_enabled) + if (vha->hw->flags.edif_enabled) { + if (DBELL_ACTIVE(vha)) + qla2x00_post_aen_work(vha, FCH_EVT_VENDOR_UNIQUE, + FCH_EVT_VENDOR_UNIQUE_VPORT_DOWN); /* delete sessions and flush sa_indexes */ qla2x00_wait_for_sess_deletion(vha); + } =20 if (vha->hw->flags.fw_started) ret =3D qla24xx_control_vp(vha, VCE_COMMAND_DISABLE_VPS_LOGO_ALL); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5739DC00140 for ; Mon, 15 Aug 2022 19:07:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245503AbiHOTHZ (ORCPT ); Mon, 15 Aug 2022 15:07:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245699AbiHOTCh (ORCPT ); Mon, 15 Aug 2022 15:02: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 487FD357DE; Mon, 15 Aug 2022 11:33: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 EB415B8106C; Mon, 15 Aug 2022 18:33:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5750CC433D6; Mon, 15 Aug 2022 18:33:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588423; bh=xfN3aMUT72GVuYA0umVk3VuFaMgbIjj+rzjPO5QTWwk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s5Ggvkf4lIJuQH8ZrftclfNj+Hir2PXCA+j4+167GUuVVsGoHPeefyqvv/46uDMjO kGujbaptCYG5/GDwLfi5gBWpE2f2/xG4iX1BOdOO83eMbezow+xhyCL3g6J7PshTMs PftPoRyoNUAXrolULPCtftLolbSnTd01GYx8brpc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quinn Tran , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.15 399/779] scsi: qla2xxx: edif: Add retry for ELS passthrough Date: Mon, 15 Aug 2022 20:00:43 +0200 Message-Id: <20220815180354.323284746@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran [ Upstream commit 0b3f3143d473b489a7aa0779c43bcdb344bd3014 ] Relating to EDIF, when sending IKE message, updating key or deleting key, driver can encounter IOCB queue full. Add additional retries to reduce higher level recovery. Link: https://lore.kernel.org/r/20220607044627.19563-8-njavali@marvell.com Fixes: dd30706e73b7 ("scsi: qla2xxx: edif: Add key update") Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_edif.c | 52 +++++++++++++++++++++++---------- drivers/scsi/qla2xxx/qla_os.c | 2 +- 2 files changed, 38 insertions(+), 16 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_edif.c b/drivers/scsi/qla2xxx/qla_edi= f.c index bdcc38bd955a..ee8e1ae2c300 100644 --- a/drivers/scsi/qla2xxx/qla_edif.c +++ b/drivers/scsi/qla2xxx/qla_edif.c @@ -1274,6 +1274,8 @@ qla24xx_check_sadb_avail_slot(struct bsg_job *bsg_job= , fc_port_t *fcport, =20 #define QLA_SA_UPDATE_FLAGS_RX_KEY 0x0 #define QLA_SA_UPDATE_FLAGS_TX_KEY 0x2 +#define EDIF_MSLEEP_INTERVAL 100 +#define EDIF_RETRY_COUNT 50 =20 int qla24xx_sadb_update(struct bsg_job *bsg_job) @@ -1286,7 +1288,7 @@ qla24xx_sadb_update(struct bsg_job *bsg_job) struct edif_list_entry *edif_entry =3D NULL; int found =3D 0; int rval =3D 0; - int result =3D 0; + int result =3D 0, cnt; struct qla_sa_update_frame sa_frame; struct srb_iocb *iocb_cmd; port_id_t portid; @@ -1527,11 +1529,23 @@ qla24xx_sadb_update(struct bsg_job *bsg_job) sp->done =3D qla2x00_bsg_job_done; iocb_cmd =3D &sp->u.iocb_cmd; iocb_cmd->u.sa_update.sa_frame =3D sa_frame; - + cnt =3D 0; +retry: rval =3D qla2x00_start_sp(sp); - if (rval !=3D QLA_SUCCESS) { + switch (rval) { + case QLA_SUCCESS: + break; + case EAGAIN: + msleep(EDIF_MSLEEP_INTERVAL); + cnt++; + if (cnt < EDIF_RETRY_COUNT) + goto retry; + + fallthrough; + default: ql_log(ql_dbg_edif, vha, 0x70e3, - "qla2x00_start_sp failed=3D%d.\n", rval); + "%s qla2x00_start_sp failed=3D%d.\n", + __func__, rval); =20 qla2x00_rel_sp(sp); rval =3D -EIO; @@ -2254,7 +2268,6 @@ qla24xx_issue_sa_replace_iocb(scsi_qla_host_t *vha, s= truct qla_work_evt *e) rval =3D qla2x00_start_sp(sp); =20 if (rval !=3D QLA_SUCCESS) { - rval =3D QLA_FUNCTION_FAILED; goto done_free_sp; } =20 @@ -3383,7 +3396,7 @@ int qla_edif_process_els(scsi_qla_host_t *vha, struct= bsg_job *bsg_job) fc_port_t *fcport =3D NULL; struct qla_hw_data *ha =3D vha->hw; srb_t *sp; - int rval =3D (DID_ERROR << 16); + int rval =3D (DID_ERROR << 16), cnt; port_id_t d_id; struct qla_bsg_auth_els_request *p =3D (struct qla_bsg_auth_els_request *)bsg_job->request; @@ -3474,17 +3487,26 @@ int qla_edif_process_els(scsi_qla_host_t *vha, stru= ct bsg_job *bsg_job) sp->free =3D qla2x00_bsg_sp_free; sp->done =3D qla2x00_bsg_job_done; =20 + cnt =3D 0; +retry: rval =3D qla2x00_start_sp(sp); - - ql_dbg(ql_dbg_edif, vha, 0x700a, - "%s %s %8phN xchg %x ctlflag %x hdl %x reqlen %xh bsg ptr %p\n", - __func__, sc_to_str(p->e.sub_cmd), fcport->port_name, - p->e.extra_rx_xchg_address, p->e.extra_control_flags, - sp->handle, sp->remap.req.len, bsg_job); - - if (rval !=3D QLA_SUCCESS) { + switch (rval) { + case QLA_SUCCESS: + ql_dbg(ql_dbg_edif, vha, 0x700a, + "%s %s %8phN xchg %x ctlflag %x hdl %x reqlen %xh bsg ptr %p\n", + __func__, sc_to_str(p->e.sub_cmd), fcport->port_name, + p->e.extra_rx_xchg_address, p->e.extra_control_flags, + sp->handle, sp->remap.req.len, bsg_job); + break; + case EAGAIN: + msleep(EDIF_MSLEEP_INTERVAL); + cnt++; + if (cnt < EDIF_RETRY_COUNT) + goto retry; + fallthrough; + default: ql_log(ql_log_warn, vha, 0x700e, - "qla2x00_start_sp failed =3D %d\n", rval); + "%s qla2x00_start_sp failed =3D %d\n", __func__, rval); SET_DID_STATUS(bsg_reply->result, DID_IMM_RETRY); rval =3D -EIO; goto done_free_remap_rsp; diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index e683b1c01c9f..e87ad7e0dc94 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -5466,7 +5466,7 @@ qla2x00_do_work(struct scsi_qla_host *vha) e->u.fcport.fcport, false); break; case QLA_EVT_SA_REPLACE: - qla24xx_issue_sa_replace_iocb(vha, e); + rc =3D qla24xx_issue_sa_replace_iocb(vha, e); break; } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97D72C00140 for ; Mon, 15 Aug 2022 19:07:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245566AbiHOTHh (ORCPT ); Mon, 15 Aug 2022 15:07:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237723AbiHOTCj (ORCPT ); Mon, 15 Aug 2022 15:02:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FE0E357EB; Mon, 15 Aug 2022 11:33: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 06411B8105D; Mon, 15 Aug 2022 18:33:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DFB0C433D6; Mon, 15 Aug 2022 18:33:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588426; bh=tdcSelFG26Y1HtLRZkbyLpaO2q+Kbsv+mVSzTz4ioLw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a9etoUh/9Vvt9QLz7I+74KQcPHNSo3SU3/ITm9j0vx0olJzqHmKwCNDKllz0ht8nx WITG8TcsABWinQnr22YwZPaF43QHTPf478x66caxsLNwCb7JNSxbiyAyxrBEFnkona p5IwaGG7TQZJQJ3EeABcFy6fpAqxsTsI2rR3uXS8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quinn Tran , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.15 400/779] scsi: qla2xxx: edif: Fix n2n discovery issue with secure target Date: Mon, 15 Aug 2022 20:00:44 +0200 Message-Id: <20220815180354.362622953@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran [ Upstream commit 789d54a4178634850e441f60c0326124138e7269 ] User failed to see disk via n2n topology. Driver used up all login retries before authentication application started. When authentication application started, driver did not have enough login retries to connect securely. On app_start, driver will reset the login retry attempt count. Link: https://lore.kernel.org/r/20220607044627.19563-10-njavali@marvell.com Fixes: 4de067e5df12 ("scsi: qla2xxx: edif: Add N2N support for EDIF") Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_edif.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/qla2xxx/qla_edif.c b/drivers/scsi/qla2xxx/qla_edi= f.c index ee8e1ae2c300..8be282339fdd 100644 --- a/drivers/scsi/qla2xxx/qla_edif.c +++ b/drivers/scsi/qla2xxx/qla_edif.c @@ -491,6 +491,9 @@ qla_edif_app_start(scsi_qla_host_t *vha, struct bsg_job= *bsg_job) } =20 if (N2N_TOPO(vha->hw)) { + list_for_each_entry_safe(fcport, tf, &vha->vp_fcports, list) + fcport->n2n_link_reset_cnt =3D 0; + if (vha->hw->flags.n2n_fw_acc_sec) set_bit(N2N_LINK_RESET, &vha->dpc_flags); else --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34875C00140 for ; Mon, 15 Aug 2022 19:07:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245559AbiHOTHa (ORCPT ); Mon, 15 Aug 2022 15:07:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60434 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245707AbiHOTCi (ORCPT ); Mon, 15 Aug 2022 15:02:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBC8A3718D; Mon, 15 Aug 2022 11:33: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 57AA260F7A; Mon, 15 Aug 2022 18:33:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 600BDC433D6; Mon, 15 Aug 2022 18:33:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588429; bh=b1vhEVSzLT806KV0vZY9uvNMldcF7FVJvXU+LO0wV90=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pDP2R12R+TLQCdb7+TbwM6YgeVwZft9KyuxLI3Bgq3b3t4460Hwif9T/7lKD2magi H7u7X9q1FIkFbvMEcjEDSC0dp1vqBPY4yD1AbyeO8LX082bJ0kOyGG7HHUN0Fwc7ji M7hEn4C15YHRAePn2fEma8mFMNGQ9Tyq+Ld2/7iM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quinn Tran , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.15 401/779] scsi: qla2xxx: edif: Fix n2n login retry for secure device Date: Mon, 15 Aug 2022 20:00:45 +0200 Message-Id: <20220815180354.412093581@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran [ Upstream commit aec55325ddec975216119da000092cb8664a3399 ] After initiator has burned up all login retries, target authentication application begins to run. This triggers a link bounce on target side. Initiator will attempt another login. Due to N2N, the PRLI [nvme | fcp] can fail because of the mode mismatch with target. This patch add a few more login retries to revive the connection. Link: https://lore.kernel.org/r/20220607044627.19563-11-njavali@marvell.com Fixes: 4de067e5df12 ("scsi: qla2xxx: edif: Add N2N support for EDIF") Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_init.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_ini= t.c index 2bed5050bcaf..49cfe8c9f3bb 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -2125,6 +2125,13 @@ qla24xx_handle_prli_done_event(struct scsi_qla_host = *vha, struct event_arg *ea) } =20 if (N2N_TOPO(vha->hw)) { + if (ea->fcport->n2n_link_reset_cnt =3D=3D + vha->hw->login_retry_count && + ea->fcport->flags & FCF_FCSP_DEVICE) { + /* remote authentication app just started */ + ea->fcport->n2n_link_reset_cnt =3D 0; + } + if (ea->fcport->n2n_link_reset_cnt < vha->hw->login_retry_count) { ea->fcport->n2n_link_reset_cnt++; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B99BC00140 for ; Mon, 15 Aug 2022 19:07:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245578AbiHOTHk (ORCPT ); Mon, 15 Aug 2022 15:07:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244851AbiHOTCn (ORCPT ); Mon, 15 Aug 2022 15:02:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 471702CCB9; Mon, 15 Aug 2022 11:33: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 4F87361043; Mon, 15 Aug 2022 18:33:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B9C3C433D6; Mon, 15 Aug 2022 18:33:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588432; bh=YxRgMpnmW13UinbSczL9GR6bz05U+c6SlFeFp8aplWg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OfRn1enTXNTaqxfhg5VQt3YzHBe8hv2PzqneB+h3NB79QfBj/kH33nvzB7scnljtO YaGBesI19hQoCrUNmD+l2oalTuUsMUN49bNODmsgHJYmYoweWAZFtfbuMEDH75IJmw yhJvynJ53iUsrJT4KH9nSPh2IoxDhL8SAQjPzgSM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Levitsky , Sean Christopherson , "Maciej S. Szmigiero" , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.15 402/779] KVM: SVM: Unwind "speculative" RIP advancement if INTn injection "fails" Date: Mon, 15 Aug 2022 20:00:46 +0200 Message-Id: <20220815180354.461143334@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson [ Upstream commit cd9e6da8048c5b40315ee2d929b6230ce1252c3c ] Unwind the RIP advancement done by svm_queue_exception() when injecting an INT3 ultimately "fails" due to the CPU encountering a VM-Exit while vectoring the injected event, even if the exception reported by the CPU isn't the same event that was injected. If vectoring INT3 encounters an exception, e.g. #NP, and vectoring the #NP encounters an intercepted exception, e.g. #PF when KVM is using shadow paging, then the #NP will be reported as the event that was in-progress. Note, this is still imperfect, as it will get a false positive if the INT3 is cleanly injected, no VM-Exit occurs before the IRET from the INT3 handler in the guest, the instruction following the INT3 generates an exception (directly or indirectly), _and_ vectoring that exception encounters an exception that is intercepted by KVM. The false positives could theoretically be solved by further analyzing the vectoring event, e.g. by comparing the error code against the expected error code were an exception to occur when vectoring the original injected exception, but SVM without NRIPS is a complete disaster, trying to make it 100% correct is a waste of time. Reviewed-by: Maxim Levitsky Fixes: 66b7138f9136 ("KVM: SVM: Emulate nRIP feature when reinjecting INT3") Signed-off-by: Sean Christopherson Signed-off-by: Maciej S. Szmigiero Message-Id: <450133cf0a026cb9825a2ff55d02cb136a1cb111.1651440202.git.maciej= .szmigiero@oracle.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/x86/kvm/svm/svm.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index b001f7d94d1d..05d76832362d 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -3680,6 +3680,18 @@ static void svm_complete_interrupts(struct kvm_vcpu = *vcpu) vector =3D exitintinfo & SVM_EXITINTINFO_VEC_MASK; type =3D exitintinfo & SVM_EXITINTINFO_TYPE_MASK; =20 + /* + * If NextRIP isn't enabled, KVM must manually advance RIP prior to + * injecting the soft exception/interrupt. That advancement needs to + * be unwound if vectoring didn't complete. Note, the _new_ event may + * not be the injected event, e.g. if KVM injected an INTn, the INTn + * hit a #NP in the guest, and the #NP encountered a #PF, the #NP will + * be the reported vectored event, but RIP still needs to be unwound. + */ + if (int3_injected && type =3D=3D SVM_EXITINTINFO_TYPE_EXEPT && + kvm_is_linear_rip(vcpu, svm->int3_rip)) + kvm_rip_write(vcpu, kvm_rip_read(vcpu) - int3_injected); + switch (type) { case SVM_EXITINTINFO_TYPE_NMI: vcpu->arch.nmi_injected =3D true; @@ -3693,16 +3705,11 @@ static void svm_complete_interrupts(struct kvm_vcpu= *vcpu) =20 /* * In case of software exceptions, do not reinject the vector, - * but re-execute the instruction instead. Rewind RIP first - * if we emulated INT3 before. + * but re-execute the instruction instead. */ - if (kvm_exception_is_soft(vector)) { - if (vector =3D=3D BP_VECTOR && int3_injected && - kvm_is_linear_rip(vcpu, svm->int3_rip)) - kvm_rip_write(vcpu, - kvm_rip_read(vcpu) - int3_injected); + if (kvm_exception_is_soft(vector)) break; - } + if (exitintinfo & SVM_EXITINTINFO_VALID_ERR) { u32 err =3D svm->vmcb->control.exit_int_info_err; kvm_requeue_exception_e(vcpu, vector, err); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98BCDC25B0E for ; Mon, 15 Aug 2022 19:07:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245597AbiHOTHo (ORCPT ); Mon, 15 Aug 2022 15:07:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245001AbiHOTDG (ORCPT ); Mon, 15 Aug 2022 15:03:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7022C37193; Mon, 15 Aug 2022 11:33: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 E3682B8105D; Mon, 15 Aug 2022 18:33:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BACAC433D6; Mon, 15 Aug 2022 18:33:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588435; bh=4cVpYbMaOLnwvVrSAlEAPQ/lSB/ciAKciQ+78iytvp0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M7AXN2wti+viPJEvfYiBQn4vxf23Sm8H0RP6meWH3H7Rh7Bd1GhknWvEaCmNbGjpk mbvMYitG8triHkuvs5QFV9A1h/J5PTADlsyuxv2arEBoVcG3zs8QTm1S2e5Q1MA66D aPpCEfSV5a7r1boYyNW/pFB8z3jOAyiY1LjdXCNc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxim Levitsky , Sean Christopherson , "Maciej S. Szmigiero" , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.15 403/779] KVM: SVM: Stuff next_rip on emulated INT3 injection if NRIPS is supported Date: Mon, 15 Aug 2022 20:00:47 +0200 Message-Id: <20220815180354.511102787@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson [ Upstream commit 3741aec4c38fa4123ab08ae552f05366d4fd05d8 ] If NRIPS is supported in hardware but disabled in KVM, set next_rip to the next RIP when advancing RIP as part of emulating INT3 injection. There is no flag to tell the CPU that KVM isn't using next_rip, and so leaving next_rip is left as is will result in the CPU pushing garbage onto the stack when vectoring the injected event. Reviewed-by: Maxim Levitsky Fixes: 66b7138f9136 ("KVM: SVM: Emulate nRIP feature when reinjecting INT3") Signed-off-by: Sean Christopherson Signed-off-by: Maciej S. Szmigiero Message-Id: Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/x86/kvm/svm/svm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index 05d76832362d..2947e3c965e3 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -394,6 +394,10 @@ static void svm_queue_exception(struct kvm_vcpu *vcpu) */ (void)skip_emulated_instruction(vcpu); rip =3D kvm_rip_read(vcpu); + + if (boot_cpu_has(X86_FEATURE_NRIPS)) + svm->vmcb->control.next_rip =3D rip; + svm->int3_rip =3D rip + svm->vmcb->save.cs.base; svm->int3_injected =3D rip - old_rip; } @@ -3683,7 +3687,7 @@ static void svm_complete_interrupts(struct kvm_vcpu *= vcpu) /* * If NextRIP isn't enabled, KVM must manually advance RIP prior to * injecting the soft exception/interrupt. That advancement needs to - * be unwound if vectoring didn't complete. Note, the _new_ event may + * be unwound if vectoring didn't complete. Note, the new event may * not be the injected event, e.g. if KVM injected an INTn, the INTn * hit a #NP in the guest, and the #NP encountered a #PF, the #NP will * be the reported vectored event, but RIP still needs to be unwound. --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83492C25B08 for ; Mon, 15 Aug 2022 19:07:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245620AbiHOTHs (ORCPT ); Mon, 15 Aug 2022 15:07:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245030AbiHOTDH (ORCPT ); Mon, 15 Aug 2022 15:03:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B41452CDC7; Mon, 15 Aug 2022 11:33: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 5083C61043; Mon, 15 Aug 2022 18:33:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49BB6C433C1; Mon, 15 Aug 2022 18:33:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588438; bh=Y2JRNAOW2EOmlGoFTTcKC2KjNshzPUJ73cPXUm8YcIo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w+zSYFwNs0mUGAPvTgg41OkjqA43EhOtgB0/TNCw2cA9axzGqFLJ5xy5k+XgF38rv zM3QrI0x89MblcyMQt2YIY3vLJitPNTHMKicTsEnjTZxURfz6qfZabKG33OxONXKuW /uCiMSSrz4Dlx/ljhlMuAS1Oy+rBp7NyomO0ZlOM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chanho Park , Krzysztof Kozlowski , Vinod Koul , Sasha Levin Subject: [PATCH 5.15 404/779] phy: samsung: exynosautov9-ufs: correct TSRV register configurations Date: Mon, 15 Aug 2022 20:00:48 +0200 Message-Id: <20220815180354.553241587@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chanho Park [ Upstream commit f7fdc4db071f7ee7d408ea3f083222a060c76623 ] For exynos auto v9's UFS MPHY, We should use 0x50 offset of TSRV register configurations. So, it must be s/PHY_TRSV_REG_CFG/PHY_TRSV_REG_CFG_AUTOV9/g Fixes: d64519249e1d ("phy: samsung-ufs: support exynosauto ufs phy driver") Signed-off-by: Chanho Park Acked-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220603050536.61957-1-chanho61.park@samsun= g.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/phy/samsung/phy-exynosautov9-ufs.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/phy/samsung/phy-exynosautov9-ufs.c b/drivers/phy/samsu= ng/phy-exynosautov9-ufs.c index 36398a15c2db..d043dfdb598a 100644 --- a/drivers/phy/samsung/phy-exynosautov9-ufs.c +++ b/drivers/phy/samsung/phy-exynosautov9-ufs.c @@ -31,22 +31,22 @@ static const struct samsung_ufs_phy_cfg exynosautov9_pr= e_init_cfg[] =3D { PHY_COMN_REG_CFG(0x023, 0xc0, PWR_MODE_ANY), PHY_COMN_REG_CFG(0x023, 0x00, PWR_MODE_ANY), =20 - PHY_TRSV_REG_CFG(0x042, 0x5d, PWR_MODE_ANY), - PHY_TRSV_REG_CFG(0x043, 0x80, PWR_MODE_ANY), + PHY_TRSV_REG_CFG_AUTOV9(0x042, 0x5d, PWR_MODE_ANY), + PHY_TRSV_REG_CFG_AUTOV9(0x043, 0x80, PWR_MODE_ANY), =20 END_UFS_PHY_CFG, }; =20 /* Calibration for HS mode series A/B */ static const struct samsung_ufs_phy_cfg exynosautov9_pre_pwr_hs_cfg[] =3D { - PHY_TRSV_REG_CFG(0x032, 0xbc, PWR_MODE_HS_ANY), - PHY_TRSV_REG_CFG(0x03c, 0x7f, PWR_MODE_HS_ANY), - PHY_TRSV_REG_CFG(0x048, 0xc0, PWR_MODE_HS_ANY), + PHY_TRSV_REG_CFG_AUTOV9(0x032, 0xbc, PWR_MODE_HS_ANY), + PHY_TRSV_REG_CFG_AUTOV9(0x03c, 0x7f, PWR_MODE_HS_ANY), + PHY_TRSV_REG_CFG_AUTOV9(0x048, 0xc0, PWR_MODE_HS_ANY), =20 - PHY_TRSV_REG_CFG(0x04a, 0x00, PWR_MODE_HS_G3_SER_B), - PHY_TRSV_REG_CFG(0x04b, 0x10, PWR_MODE_HS_G1_SER_B | - PWR_MODE_HS_G3_SER_B), - PHY_TRSV_REG_CFG(0x04d, 0x63, PWR_MODE_HS_G3_SER_B), + PHY_TRSV_REG_CFG_AUTOV9(0x04a, 0x00, PWR_MODE_HS_G3_SER_B), + PHY_TRSV_REG_CFG_AUTOV9(0x04b, 0x10, PWR_MODE_HS_G1_SER_B | + PWR_MODE_HS_G3_SER_B), + PHY_TRSV_REG_CFG_AUTOV9(0x04d, 0x63, PWR_MODE_HS_G3_SER_B), =20 END_UFS_PHY_CFG, }; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D53BAC00140 for ; Mon, 15 Aug 2022 19:08:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245687AbiHOTH7 (ORCPT ); Mon, 15 Aug 2022 15:07:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245106AbiHOTD1 (ORCPT ); Mon, 15 Aug 2022 15:03:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2531E2C676; Mon, 15 Aug 2022 11:34: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 8C5AD610A1; Mon, 15 Aug 2022 18:34:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74EB2C433C1; Mon, 15 Aug 2022 18:34:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588441; bh=PlyDoyIsXaRnZKrDQ6XhQ9WgrMtaT+erM0DDzUfZZb8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aqmY4rY2r7UfBZY3BG1c6fBv2nBdyZy7VXH+MJ9b5riOH8uqhWX013a+vWlQj+O/9 fccfQUo2M1szyExAEAqxXbNGpchI4p+QxZkXMn/6HJxu+ws5301JGDoD/6Cfp9Dad6 shZSXt8epfhwP9lHnxtkTOsYmKOlOjXLrQbQZuSE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Bjorn Helgaas , Rob Herring , Sasha Levin Subject: [PATCH 5.15 405/779] PCI: microchip: Fix refcount leak in mc_pcie_init_irq_domains() Date: Mon, 15 Aug 2022 20:00:49 +0200 Message-Id: <20220815180354.593267517@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit f030304fdeb87ec8f1b518c73703214aec6cc24a ] of_get_next_child() returns a node pointer with refcount incremented, so we should use of_node_put() on it when we don't need it anymore. mc_pcie_init_irq_domains() only calls of_node_put() in the normal path, missing it in some error paths. Add missing of_node_put() to avoid refcount leak. Fixes: 6f15a9c9f941 ("PCI: microchip: Add Microchip PolarFire PCIe controll= er driver") Link: https://lore.kernel.org/r/20220605055123.59127-1-linmq006@gmail.com Signed-off-by: Miaoqian Lin Signed-off-by: Bjorn Helgaas Reviewed-by: Rob Herring Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/pci/controller/pcie-microchip-host.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/pci/controller/pcie-microchip-host.c b/drivers/pci/con= troller/pcie-microchip-host.c index fa209ad067bf..6e8a6540b377 100644 --- a/drivers/pci/controller/pcie-microchip-host.c +++ b/drivers/pci/controller/pcie-microchip-host.c @@ -894,6 +894,7 @@ static int mc_pcie_init_irq_domains(struct mc_port *por= t) &event_domain_ops, port); if (!port->event_domain) { dev_err(dev, "failed to get event domain\n"); + of_node_put(pcie_intc_node); return -ENOMEM; } =20 @@ -903,6 +904,7 @@ static int mc_pcie_init_irq_domains(struct mc_port *por= t) &intx_domain_ops, port); if (!port->intx_domain) { dev_err(dev, "failed to get an INTx IRQ domain\n"); + of_node_put(pcie_intc_node); return -ENOMEM; } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72E09C00140 for ; Mon, 15 Aug 2022 19:08:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245712AbiHOTID (ORCPT ); Mon, 15 Aug 2022 15:08:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245199AbiHOTDq (ORCPT ); Mon, 15 Aug 2022 15:03:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1B124D83B; Mon, 15 Aug 2022 11:34: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 5945FB81081; Mon, 15 Aug 2022 18:34:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BF52C433D6; Mon, 15 Aug 2022 18:34:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588445; bh=aUBihyxrfQBqUNzsva5Gk6hgJt80ouxsOvTzdpdnTTQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U5V+hnc4C5YqxMtQ6IYALZfKp13QrVqPjB+J/ax80KdDNcZ3rTH/hqkKtTOw6XPIz m0iLE5ePSdFIQ/OdvntEEVJIDiZRdedHdRPacpMYGn0vp/qOaQNGEbLbOi6EAAoxDz uqVMRNi0MJviljmU4paeUXMNCeP3c4NFuozEhWpQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Bjorn Helgaas , Vidya Sagar , Sasha Levin Subject: [PATCH 5.15 406/779] PCI: tegra194: Fix PM error handling in tegra_pcie_config_ep() Date: Mon, 15 Aug 2022 20:00:50 +0200 Message-Id: <20220815180354.641999133@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit e8fbd344a5ea62663554b8546b6bf9f88b93785a ] pm_runtime_enable() will increase power disable depth. If dw_pcie_ep_init() fails, we should use pm_runtime_disable() to balance it with pm_runtime_enable(). Add missing pm_runtime_disable() for tegra_pcie_config_ep(). Fixes: c57247f940e8 ("PCI: tegra: Add support for PCIe endpoint mode in Teg= ra194") Link: https://lore.kernel.org/r/20220602031910.55859-1-linmq006@gmail.com Signed-off-by: Miaoqian Lin Signed-off-by: Bjorn Helgaas Reviewed-by: Vidya Sagar Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/pci/controller/dwc/pcie-tegra194.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/contr= oller/dwc/pcie-tegra194.c index 904976913081..98da2578e4db 100644 --- a/drivers/pci/controller/dwc/pcie-tegra194.c +++ b/drivers/pci/controller/dwc/pcie-tegra194.c @@ -1951,6 +1951,7 @@ static int tegra_pcie_config_ep(struct tegra_pcie_dw = *pcie, if (ret) { dev_err(dev, "Failed to initialize DWC Endpoint subsystem: %d\n", ret); + pm_runtime_disable(dev); return ret; } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4DFFBC00140 for ; Mon, 15 Aug 2022 19:08:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245726AbiHOTIK (ORCPT ); Mon, 15 Aug 2022 15:08:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240625AbiHOTEQ (ORCPT ); Mon, 15 Aug 2022 15:04:16 -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 3BFEC4E60E; Mon, 15 Aug 2022 11:34: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 783E0B8105D; Mon, 15 Aug 2022 18:34:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0E45C433D7; Mon, 15 Aug 2022 18:34:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588448; bh=ZWJtKv6jVkqiridAY8cXFrzdiuW3E35fs+WyaR0mDGI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DqrLD14r6WVJ7VaaPADkEpcqWJB82LCj3NBk0vvOx9DBCnK0rrcMYtnEHDkW0cqOO x6e3ZmUtuNMK+OwBV34PX6UnFzgw2zHbEaxTySfUEL7QHk2jtP55FCdKSKUQfQ0mbG 2DGL0/pqSBP5EmA4uo6ECklywAeiNMgf/VJRg+qs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Harshit Mogalapalli , Jiri Kosina , Sasha Levin Subject: [PATCH 5.15 407/779] HID: cp2112: prevent a buffer overflow in cp2112_xfer() Date: Mon, 15 Aug 2022 20:00:51 +0200 Message-Id: <20220815180354.689728618@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Harshit Mogalapalli [ Upstream commit 381583845d19cb4bd21c8193449385f3fefa9caf ] Smatch warnings: drivers/hid/hid-cp2112.c:793 cp2112_xfer() error: __memcpy() 'data->block[1]' too small (33 vs 255) drivers/hid/hid-cp2112.c:793 cp2112_xfer() error: __memcpy() 'buf' too small (64 vs 255) The 'read_length' variable is provided by 'data->block[0]' which comes from user and it(read_length) can take a value between 0-255. Add an upper bound to 'read_length' variable to prevent a buffer overflow in memcpy(). Fixes: 542134c0375b ("HID: cp2112: Fix I2C_BLOCK_DATA transactions") Signed-off-by: Harshit Mogalapalli Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/hid/hid-cp2112.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c index 477baa30889c..172f20e88c6c 100644 --- a/drivers/hid/hid-cp2112.c +++ b/drivers/hid/hid-cp2112.c @@ -788,6 +788,11 @@ static int cp2112_xfer(struct i2c_adapter *adap, u16 a= ddr, data->word =3D le16_to_cpup((__le16 *)buf); break; case I2C_SMBUS_I2C_BLOCK_DATA: + if (read_length > I2C_SMBUS_BLOCK_MAX) { + ret =3D -EINVAL; + goto power_normal; + } + memcpy(data->block + 1, buf, read_length); break; case I2C_SMBUS_BLOCK_DATA: --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2AAF0C00140 for ; Mon, 15 Aug 2022 19:08:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245741AbiHOTIO (ORCPT ); Mon, 15 Aug 2022 15:08:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239742AbiHOTER (ORCPT ); Mon, 15 Aug 2022 15:04:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0740371AD; Mon, 15 Aug 2022 11:34: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 F197E6105C; Mon, 15 Aug 2022 18:34:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBABAC433C1; Mon, 15 Aug 2022 18:34:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588451; bh=zUlcBjt3sYFgyUmwRf5ZWSN61dwFobVQH7Z7LAAaPPQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q+8KaSTOAJ1vHJKb7d1v/Txyr9hgsW7reaybDamM36xe/HB0XW3Ojbhvu5QcQJaE6 0+XproB/f3gcqubXKvWAj5/ReM0VXscQwh6b14ffqUuTg20xQ0BR7kQ6UJyKd02eCm u4+1tfivIpUoVRlJAFjxgTWxSsByA0hw2fSQTUXY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Duoming Zhou , Miquel Raynal , Sasha Levin Subject: [PATCH 5.15 408/779] mtd: sm_ftl: Fix deadlock caused by cancel_work_sync in sm_release Date: Mon, 15 Aug 2022 20:00:52 +0200 Message-Id: <20220815180354.730635359@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Duoming Zhou [ Upstream commit a61528d997619a518ee8c51cf0ef0513021afaff ] There is a deadlock between sm_release and sm_cache_flush_work which is a work item. The cancel_work_sync in sm_release will not return until sm_cache_flush_work is finished. If we hold mutex_lock and use cancel_work_sync to wait the work item to finish, the work item also requires mutex_lock. As a result, the sm_release will be blocked forever. The race condition is shown below: (Thread 1) | (Thread 2) sm_release | mutex_lock(&ftl->mutex) | sm_cache_flush_work | mutex_lock(&ftl->mutex) cancel_work_sync | ... This patch moves del_timer_sync and cancel_work_sync out of mutex_lock in order to mitigate deadlock. Fixes: 7d17c02a01a1 ("mtd: Add new SmartMedia/xD FTL") Signed-off-by: Duoming Zhou Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220524044841.10517-1-duoming@zju.= edu.cn Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/mtd/sm_ftl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/sm_ftl.c b/drivers/mtd/sm_ftl.c index 0cff2cda1b5a..7f955fade838 100644 --- a/drivers/mtd/sm_ftl.c +++ b/drivers/mtd/sm_ftl.c @@ -1111,9 +1111,9 @@ static void sm_release(struct mtd_blktrans_dev *dev) { struct sm_ftl *ftl =3D dev->priv; =20 - mutex_lock(&ftl->mutex); del_timer_sync(&ftl->timer); cancel_work_sync(&ftl->flush_work); + mutex_lock(&ftl->mutex); sm_cache_flush(ftl); mutex_unlock(&ftl->mutex); } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9EF4C00140 for ; Mon, 15 Aug 2022 19:08:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343495AbiHOTI1 (ORCPT ); Mon, 15 Aug 2022 15:08:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245169AbiHOTF1 (ORCPT ); Mon, 15 Aug 2022 15:05:27 -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 735394E61D; Mon, 15 Aug 2022 11:34: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 B634BB8106E; Mon, 15 Aug 2022 18:34:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B2A5C433C1; Mon, 15 Aug 2022 18:34:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588457; bh=NsVV9z4D0is7Au0wRGSembh84gMxq1mQKQCq5GKTZn0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wv/WH8yZSevlB/tfcROOCMr8tE8zbpqabGziU/Rq6YWLBiagrK2QPu8qsHcM5XS3e ca5kjSeFSm7N4NdLqACUbhw0Cbslr3+snm6W31m7Fm5M4XtQ1J+gOj98MQd6PwISJI 0wmiIXn2kxhB5AxofDdLL1R0eem9K85MwDZn1gD8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Linus Walleij , Miquel Raynal , Sasha Levin Subject: [PATCH 5.15 409/779] mtd: partitions: Fix refcount leak in parse_redboot_of Date: Mon, 15 Aug 2022 20:00:53 +0200 Message-Id: <20220815180354.765046404@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 9f7e62815cf3cbbcb1b8cb21649fb4dfdb3aa016 ] of_get_child_by_name() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: 237960880960 ("mtd: partitions: redboot: seek fis-index-block in the= right node") Signed-off-by: Miaoqian Lin Reviewed-by: Linus Walleij Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220526110652.64849-1-linmq006@gma= il.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/mtd/parsers/redboot.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mtd/parsers/redboot.c b/drivers/mtd/parsers/redboot.c index feb44a573d44..a16b42a88581 100644 --- a/drivers/mtd/parsers/redboot.c +++ b/drivers/mtd/parsers/redboot.c @@ -58,6 +58,7 @@ static void parse_redboot_of(struct mtd_info *master) return; =20 ret =3D of_property_read_u32(npart, "fis-index-block", &dirblock); + of_node_put(npart); if (ret) return; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31165C00140 for ; Mon, 15 Aug 2022 19:08:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343503AbiHOTId (ORCPT ); Mon, 15 Aug 2022 15:08:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245117AbiHOTF0 (ORCPT ); Mon, 15 Aug 2022 15:05:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 039314E612; Mon, 15 Aug 2022 11:34:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2562C6111E; Mon, 15 Aug 2022 18:34:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2ED77C4314A; Mon, 15 Aug 2022 18:34:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588460; bh=9u+RPsdKAXeHUNT7S87LWCUibPX9fT0Xx0jOa0D91Us=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2pDXpvL+eCK8hLIOxmLCaCWTUqPOSDLHRS26bm73fq4iGU+Eu8B8FgetglIVOVjuj SZL+3tG5IdHvQJmyeJQkQi51j58LM2oMXAUk9dsr6evVPMZSS0r0s3+SW+fABlnL2a 4iAcAg9bxShs0fWFVebXkQSKgtEK+t0h974qCgCY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Miquel Raynal , Sasha Levin Subject: [PATCH 5.15 410/779] mtd: parsers: ofpart: Fix refcount leak in bcm4908_partitions_fw_offset Date: Mon, 15 Aug 2022 20:00:54 +0200 Message-Id: <20220815180354.803350491@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit e607879b0da18c451de5e91daf239cc2f2f8ff2d ] of_find_node_by_path() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: bb17230c61a6 ("mtd: parsers: ofpart: support BCM4908 fixed partition= s") Signed-off-by: Miaoqian Lin Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220605070726.5979-1-linmq006@gmai= l.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/mtd/parsers/ofpart_bcm4908.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mtd/parsers/ofpart_bcm4908.c b/drivers/mtd/parsers/ofp= art_bcm4908.c index 0eddef4c198e..bb072a0940e4 100644 --- a/drivers/mtd/parsers/ofpart_bcm4908.c +++ b/drivers/mtd/parsers/ofpart_bcm4908.c @@ -35,12 +35,15 @@ static long long bcm4908_partitions_fw_offset(void) err =3D kstrtoul(s + len + 1, 0, &offset); if (err) { pr_err("failed to parse %s\n", s + len + 1); + of_node_put(root); return err; } =20 + of_node_put(root); return offset << 10; } =20 + of_node_put(root); return -ENOENT; } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08353C00140 for ; Mon, 15 Aug 2022 19:08:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343514AbiHOTIk (ORCPT ); Mon, 15 Aug 2022 15:08:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245506AbiHOTFr (ORCPT ); Mon, 15 Aug 2022 15:05:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A34072AE23; Mon, 15 Aug 2022 11:34: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 3C7E761043; Mon, 15 Aug 2022 18:34:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D305C433C1; Mon, 15 Aug 2022 18:34:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588463; bh=CXgv/mwnDeY7ZKskEA+lAuZOc1xXfXxQx4KsFMlI+pU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wYh4tP7XRCvnzI4QnxxNrQNwcBbIwNTju1L3if2oMj65lfrk6s6uyxu+A7rv00O02 yxUDo/GLCWX67NofGoV+LLZJwLwg3zlcQQosrN1ZB2Fff/2JCN8IH2lvtW+ZBSu/XI P2+kTM6AslLo8sNazHEURxi4GG1CfyAs2N4fMX5k= 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?= , Miquel Raynal , Sasha Levin Subject: [PATCH 5.15 411/779] mtd: st_spi_fsm: Add a clk_disable_unprepare() in .probe()s error path Date: Mon, 15 Aug 2022 20:00:55 +0200 Message-Id: <20220815180354.841549079@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Uwe Kleine-K=C3=B6nig [ Upstream commit 28607b426c3d050714f250d0faeb99d2e9106e90 ] For all but one error path clk_disable_unprepare() is already there. Add it to the one location where it's missing. Fixes: 481815a6193b ("mtd: st_spi_fsm: Handle clk_prepare_enable/clk_disabl= e_unprepare.") Fixes: 69d5af8d016c ("mtd: st_spi_fsm: Obtain and use EMI clock") Signed-off-by: Uwe Kleine-K=C3=B6nig Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220607152458.232847-2-u.kleine-ko= enig@pengutronix.de Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/mtd/devices/st_spi_fsm.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_= fsm.c index 983999c020d6..48bda2dd1bb5 100644 --- a/drivers/mtd/devices/st_spi_fsm.c +++ b/drivers/mtd/devices/st_spi_fsm.c @@ -2115,10 +2115,12 @@ static int stfsm_probe(struct platform_device *pdev) (long long)fsm->mtd.size, (long long)(fsm->mtd.size >> 20), fsm->mtd.erasesize, (fsm->mtd.erasesize >> 10)); =20 - return mtd_device_register(&fsm->mtd, NULL, 0); - + ret =3D mtd_device_register(&fsm->mtd, NULL, 0); + if (ret) { err_clk_unprepare: - clk_disable_unprepare(fsm->clk); + clk_disable_unprepare(fsm->clk); + } + return ret; } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0C8BC00140 for ; Mon, 15 Aug 2022 19:10:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343688AbiHOTKD (ORCPT ); Mon, 15 Aug 2022 15:10:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245530AbiHOTFs (ORCPT ); Mon, 15 Aug 2022 15:05:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9666237197; Mon, 15 Aug 2022 11:34: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 3AFA3B81081; Mon, 15 Aug 2022 18:34:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83AA8C433D7; Mon, 15 Aug 2022 18:34:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588466; bh=nU4IgZFphg6AoJaV+SrFVf3iKL/JaX8zy6tYKTj6tXc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PYt+gip9PTveLGstnxXginz+3wLmAnKFEO6vH6uUMZBuaYqgE5Q8MRUqVc4Kd+WEl FOmsatQ4hmHIrYOJQqoa2Ge67hGSM8iGqoSCkuAMTRpTLXfFFDv/QJc/SBndMg3q3S QPOGkmrJBxMZQiyzeVJpgl/ipY3LYTfwWcET4G6g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Bjorn Helgaas , Miles Chen , Jianjun Wang , Sasha Levin Subject: [PATCH 5.15 412/779] PCI: mediatek-gen3: Fix refcount leak in mtk_pcie_init_irq_domains() Date: Mon, 15 Aug 2022 20:00:56 +0200 Message-Id: <20220815180354.881759498@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit bf038503d5fe90189743124233fe7aeb0984e961 ] of_get_child_by_name() returns a node pointer with refcount incremented, so we should use of_node_put() on it when we don't need it anymore. Add missing of_node_put() to avoid refcount leak. Fixes: 814cceebba9b ("PCI: mediatek-gen3: Add INTx support") Link: https://lore.kernel.org/r/20220601041259.56185-1-linmq006@gmail.com Signed-off-by: Miaoqian Lin Signed-off-by: Bjorn Helgaas Reviewed-by: Miles Chen Acked-by: Jianjun Wang Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/pci/controller/pcie-mediatek-gen3.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/pci/controller/pcie-mediatek-gen3.c b/drivers/pci/cont= roller/pcie-mediatek-gen3.c index 21207df680cc..36c8702439e9 100644 --- a/drivers/pci/controller/pcie-mediatek-gen3.c +++ b/drivers/pci/controller/pcie-mediatek-gen3.c @@ -600,7 +600,8 @@ static int mtk_pcie_init_irq_domains(struct mtk_pcie_po= rt *port) &intx_domain_ops, port); if (!port->intx_domain) { dev_err(dev, "failed to create INTx IRQ domain\n"); - return -ENODEV; + ret =3D -ENODEV; + goto out_put_node; } =20 /* Setup MSI */ @@ -623,6 +624,7 @@ static int mtk_pcie_init_irq_domains(struct mtk_pcie_po= rt *port) goto err_msi_domain; } =20 + of_node_put(intc_node); return 0; =20 err_msi_domain: @@ -630,6 +632,8 @@ static int mtk_pcie_init_irq_domains(struct mtk_pcie_po= rt *port) err_msi_bottom_domain: irq_domain_remove(port->intx_domain); =20 +out_put_node: + of_node_put(intc_node); return ret; } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 869EEC00140 for ; Mon, 15 Aug 2022 19:08:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343524AbiHOTIn (ORCPT ); Mon, 15 Aug 2022 15:08:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245552AbiHOTFv (ORCPT ); Mon, 15 Aug 2022 15:05:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5C6E4E630; Mon, 15 Aug 2022 11:34: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 67014B8105D; Mon, 15 Aug 2022 18:34:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A963BC43149; Mon, 15 Aug 2022 18:34:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588470; bh=TjKyMTkzWKBt/qcDkt9DfobjGM3oD7+51Yp1Uk0EBIg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZGI9Dp49PU1acouyelUMrQxQPOtdHyw+rGyHwDf2kTHrIkAg2tZTVTWdfOOgaMAEt ypQ94DU/i8BDhD31aalGCSeHzPnxD0C9IAJ+ztCpuVdxK6h9Ik0e3Um4dvmjq/sUs2 GaKldeN3qdcvixtTDP171m1fuP4c1OPqNesWTHI8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Rix , Xu Yilun , Marco Pagani , Sasha Levin Subject: [PATCH 5.15 413/779] fpga: altera-pr-ip: fix unsigned comparison with less than zero Date: Mon, 15 Aug 2022 20:00:57 +0200 Message-Id: <20220815180354.912809045@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Pagani [ Upstream commit 2df84a757d87fd62869fc401119d429735377ec5 ] Fix the "comparison with less than zero" warning reported by cppcheck for the unsigned (size_t) parameter count of the alt_pr_fpga_write() function. Fixes: d201cc17a8a3 ("fpga pr ip: Core driver support for Altera Partial Re= configuration IP") Reviewed-by: Tom Rix Acked-by: Xu Yilun Signed-off-by: Marco Pagani Link: https://lore.kernel.org/r/20220609140520.42662-1-marpagan@redhat.com Signed-off-by: Xu Yilun Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/fpga/altera-pr-ip-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/fpga/altera-pr-ip-core.c b/drivers/fpga/altera-pr-ip-c= ore.c index dfdf21ed34c4..c24b6fb2d7c3 100644 --- a/drivers/fpga/altera-pr-ip-core.c +++ b/drivers/fpga/altera-pr-ip-core.c @@ -108,7 +108,7 @@ static int alt_pr_fpga_write(struct fpga_manager *mgr, = const char *buf, u32 *buffer_32 =3D (u32 *)buf; size_t i =3D 0; =20 - if (count <=3D 0) + if (!count) return -EINVAL; =20 /* Write out the complete 32-bit chunks */ --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90E47C00140 for ; Mon, 15 Aug 2022 19:08:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343548AbiHOTIv (ORCPT ); Mon, 15 Aug 2022 15:08:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245595AbiHOTFy (ORCPT ); Mon, 15 Aug 2022 15: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 DFF684E63F; Mon, 15 Aug 2022 11:34: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 8CA41B81072; Mon, 15 Aug 2022 18:34:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C77FEC433C1; Mon, 15 Aug 2022 18:34:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588473; bh=0e2tt6DrrV1ZWC1oY7l9p4t3b8AMy0FXCj2qQ2cAlz0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yn0NA9uHvjU7UbjePtyKQhCWqzQoRSmaV9HT2hO8WJ6FOdY+3tJcH5jUOKnvUM17i N0bG/BAlxqC4RTqL9UH9u1VTCyLHdvkDXHZqx9s86JCr6FHyYzyhgwjLZhKuDYl2uV EPXKkVNNb24NB0krCzWvRzHRzWMwfHfm0HfvQp/I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern , Miaoqian Lin , Sasha Levin Subject: [PATCH 5.15 414/779] usb: host: Fix refcount leak in ehci_hcd_ppc_of_probe Date: Mon, 15 Aug 2022 20:00:58 +0200 Message-Id: <20220815180354.963152535@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit b5c5b13cb45e2c88181308186b0001992cb41954 ] of_find_compatible_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when done. Add missing of_node_put() to avoid refcount leak. Fixes: 796bcae7361c ("USB: powerpc: Workaround for the PPC440EPX USBH_23 er= rata [take 3]") Acked-by: Alan Stern Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220602110849.58549-1-linmq006@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/usb/host/ehci-ppc-of.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/host/ehci-ppc-of.c b/drivers/usb/host/ehci-ppc-of.c index 6bbaee74f7e7..28a19693c19f 100644 --- a/drivers/usb/host/ehci-ppc-of.c +++ b/drivers/usb/host/ehci-ppc-of.c @@ -148,6 +148,7 @@ static int ehci_hcd_ppc_of_probe(struct platform_device= *op) } else { ehci->has_amcc_usb23 =3D 1; } + of_node_put(np); } =20 if (of_get_property(dn, "big-endian", NULL)) { --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD662C25B0E for ; Mon, 15 Aug 2022 19:09:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343575AbiHOTI7 (ORCPT ); Mon, 15 Aug 2022 15:08:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245660AbiHOTGC (ORCPT ); Mon, 15 Aug 2022 15:06: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 F22A64E84B; Mon, 15 Aug 2022 11:34: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 AB89BB8106C; Mon, 15 Aug 2022 18:34:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1237C433D6; Mon, 15 Aug 2022 18:34:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588476; bh=bzFVUVkb0hL4tUDIprYYW0i2vps8384MfZ5C8L4/c+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fizCgBQQCFR855xgKGxmmkD6t/hnYlzILT+9YbPSe66wrUFoGpl/2Ye7czR3qlH5M ev1D/q88KRDU9IRy4eyqOSHlU/px7dZaXX1SIUpWOvlHmcDH8drq8J+6UoVYXVSAef 2ZOY0AC6OdSQNED/UWjFNjWbM244emDn2n6czQ+E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern , Miaoqian Lin , Sasha Levin Subject: [PATCH 5.15 415/779] usb: ohci-nxp: Fix refcount leak in ohci_hcd_nxp_probe Date: Mon, 15 Aug 2022 20:00:59 +0200 Message-Id: <20220815180355.002184956@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 302970b4cad3ebfda2c05ce06c322ccdc447d17e ] of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: 73108aa90cbf ("USB: ohci-nxp: Use isp1301 driver") Acked-by: Alan Stern Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220603141231.979-1-linmq006@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/usb/host/ohci-nxp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c index 85878e8ad331..106a6bcefb08 100644 --- a/drivers/usb/host/ohci-nxp.c +++ b/drivers/usb/host/ohci-nxp.c @@ -164,6 +164,7 @@ static int ohci_hcd_nxp_probe(struct platform_device *p= dev) } =20 isp1301_i2c_client =3D isp1301_get_client(isp1301_node); + of_node_put(isp1301_node); if (!isp1301_i2c_client) return -EPROBE_DEFER; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 51335C00140 for ; Mon, 15 Aug 2022 19:09:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343588AbiHOTJD (ORCPT ); Mon, 15 Aug 2022 15:09:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245661AbiHOTGC (ORCPT ); Mon, 15 Aug 2022 15:06:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE2892AE34; Mon, 15 Aug 2022 11:34: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 35FE460EEB; Mon, 15 Aug 2022 18:34:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2716FC433D6; Mon, 15 Aug 2022 18:34:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588479; bh=EcUvy+smFVPTh8JUSsq735qQGj5yBc0Qafrep4g1ZEg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GYtv6I+/A/9m6IAq4C/KsHwa9mQQSQbxHdXYSEPU991p4GmSpU5UVmcEB8GmOzJxt iF0BK9QqhJj8pj8vFjXumeBv5ufIZqIXAYfoJ90DF4SpsAjIhDYlel+u6C6YndZNK6 T7Keffv5+Fbvnxv8UBivry9ziFhbWZQIOVNHBsjo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tang Bin , Sasha Levin Subject: [PATCH 5.15 416/779] usb: gadget: tegra-xudc: Fix error check in tegra_xudc_powerdomain_init() Date: Mon, 15 Aug 2022 20:01:00 +0200 Message-Id: <20220815180355.045543943@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tang Bin [ Upstream commit f08aa7c80dac27ee00fa6827f447597d2fba5465 ] dev_pm_domain_attach_by_name() may return NULL in some cases, so IS_ERR() doesn't meet the requirements. Thus fix it. Fixes: 49db427232fe ("usb: gadget: Add UDC driver for tegra XUSB device mod= e controller") Signed-off-by: Tang Bin Link: https://lore.kernel.org/r/20220525135332.23144-1-tangbin@cmss.chinamo= bile.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/usb/gadget/udc/tegra-xudc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/gadget/udc/tegra-xudc.c b/drivers/usb/gadget/udc/t= egra-xudc.c index be76f891b9c5..cb4ddfa52cb0 100644 --- a/drivers/usb/gadget/udc/tegra-xudc.c +++ b/drivers/usb/gadget/udc/tegra-xudc.c @@ -3689,15 +3689,15 @@ static int tegra_xudc_powerdomain_init(struct tegra= _xudc *xudc) int err; =20 xudc->genpd_dev_device =3D dev_pm_domain_attach_by_name(dev, "dev"); - if (IS_ERR(xudc->genpd_dev_device)) { - err =3D PTR_ERR(xudc->genpd_dev_device); + if (IS_ERR_OR_NULL(xudc->genpd_dev_device)) { + err =3D PTR_ERR(xudc->genpd_dev_device) ? : -ENODATA; dev_err(dev, "failed to get device power domain: %d\n", err); return err; } =20 xudc->genpd_dev_ss =3D dev_pm_domain_attach_by_name(dev, "ss"); - if (IS_ERR(xudc->genpd_dev_ss)) { - err =3D PTR_ERR(xudc->genpd_dev_ss); + if (IS_ERR_OR_NULL(xudc->genpd_dev_ss)) { + err =3D PTR_ERR(xudc->genpd_dev_ss) ? : -ENODATA; dev_err(dev, "failed to get SuperSpeed power domain: %d\n", err); return err; } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2134CC00140 for ; Mon, 15 Aug 2022 19:09:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245533AbiHOTJH (ORCPT ); Mon, 15 Aug 2022 15:09:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245675AbiHOTGD (ORCPT ); Mon, 15 Aug 2022 15:06:03 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2796637F96; Mon, 15 Aug 2022 11:34: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 78A86CE125C; Mon, 15 Aug 2022 18:34:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 530B1C433D7; Mon, 15 Aug 2022 18:34:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588482; bh=2iiww0YZVx3IsAfXGgFTGknilWMD0Hkj0gj15HbjlMg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kiLSSLT55mZSkfR1A0k4Oo6FCx8lbsMnmAuphoEhjb/RcpzMfMV62kdiRo9BD+yoB gzRfy8aTICj4SpX6LJj3o/FEf0LVRW3JSU4GNABekvl2aMz3x2R6Vi4WsGXcswp0Yj JNuTc3PZ9OtM7s7MKFrhSzOGlYW3Zl3uTQ2aDPi0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tang Bin , Sasha Levin Subject: [PATCH 5.15 417/779] usb: xhci: tegra: Fix error check Date: Mon, 15 Aug 2022 20:01:01 +0200 Message-Id: <20220815180355.086689663@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tang Bin [ Upstream commit 18fc7c435be3f17ea26a21b2e2312fcb9088e01f ] In the function tegra_xusb_powerdomain_init(), dev_pm_domain_attach_by_name() may return NULL in some cases, so IS_ERR() doesn't meet the requirements. Thus fix it. Fixes: 6494a9ad86de ("usb: xhci: tegra: Add genpd support") Signed-off-by: Tang Bin Link: https://lore.kernel.org/r/20220524121404.18376-1-tangbin@cmss.chinamo= bile.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/usb/host/xhci-tegra.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c index 996958a6565c..bdb776553826 100644 --- a/drivers/usb/host/xhci-tegra.c +++ b/drivers/usb/host/xhci-tegra.c @@ -1010,15 +1010,15 @@ static int tegra_xusb_powerdomain_init(struct devic= e *dev, int err; =20 tegra->genpd_dev_host =3D dev_pm_domain_attach_by_name(dev, "xusb_host"); - if (IS_ERR(tegra->genpd_dev_host)) { - err =3D PTR_ERR(tegra->genpd_dev_host); + if (IS_ERR_OR_NULL(tegra->genpd_dev_host)) { + err =3D PTR_ERR(tegra->genpd_dev_host) ? : -ENODATA; dev_err(dev, "failed to get host pm-domain: %d\n", err); return err; } =20 tegra->genpd_dev_ss =3D dev_pm_domain_attach_by_name(dev, "xusb_ss"); - if (IS_ERR(tegra->genpd_dev_ss)) { - err =3D PTR_ERR(tegra->genpd_dev_ss); + if (IS_ERR_OR_NULL(tegra->genpd_dev_ss)) { + err =3D PTR_ERR(tegra->genpd_dev_ss) ? : -ENODATA; dev_err(dev, "failed to get superspeed pm-domain: %d\n", err); return err; } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40BEDC00140 for ; Mon, 15 Aug 2022 19:09:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245544AbiHOTJP (ORCPT ); Mon, 15 Aug 2022 15:09:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245724AbiHOTGJ (ORCPT ); Mon, 15 Aug 2022 15:06: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 50ABD39B84; Mon, 15 Aug 2022 11:34: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 7A138610A4; Mon, 15 Aug 2022 18:34:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79E12C433C1; Mon, 15 Aug 2022 18:34:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588485; bh=nm4OJZwJEZv1pIUYaeMBoUGeJreDgEESneK9E8E3b3k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sKdlEJhNFvP323RDwTZqZ+JXSA/zlg7Tkp+Pa0UkM9A1/q12QwxdFxSitlkOtBn6i blDIByiCiDINRiHzkqDNloh8yB2XT049BteJosQXkVvFb8GZ2DEoYjEoay9ozXzTVB dYh8fUMbUvhwNxcurrFAxxPaSkFLzFqQ8ccxD7Jk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manoj Basapathi , Subash Abhinov Kasiviswanathan , Pablo Neira Ayuso , netfilter-devel@vger.kernel.org, Thomas Gleixner , Sasha Levin Subject: [PATCH 5.15 418/779] netfilter: xtables: Bring SPDX identifier back Date: Mon, 15 Aug 2022 20:01:02 +0200 Message-Id: <20220815180355.133254650@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Thomas Gleixner [ Upstream commit 20646f5b1e798bcc20044ae90ac3702f177bf254 ] Commit e2be04c7f995 ("License cleanup: add SPDX license identifier to uapi header files with a license") added the correct SPDX identifier to include/uapi/linux/netfilter/xt_IDLETIMER.h. A subsequent commit removed it for no reason and reintroduced the UAPI license incorrectness as the file is now missing the UAPI exception again. Add it back and remove the GPLv2 boilerplate while at it. Fixes: 68983a354a65 ("netfilter: xtables: Add snapshot of hardidletimer tar= get") Cc: Manoj Basapathi Cc: Subash Abhinov Kasiviswanathan Cc: Pablo Neira Ayuso Cc: netfilter-devel@vger.kernel.org Signed-off-by: Thomas Gleixner Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- include/uapi/linux/netfilter/xt_IDLETIMER.h | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/include/uapi/linux/netfilter/xt_IDLETIMER.h b/include/uapi/lin= ux/netfilter/xt_IDLETIMER.h index 49ddcdc61c09..7bfb31a66fc9 100644 --- a/include/uapi/linux/netfilter/xt_IDLETIMER.h +++ b/include/uapi/linux/netfilter/xt_IDLETIMER.h @@ -1,6 +1,5 @@ +/* SPDX-License-Identifier: GPL-2.0-only WITH Linux-syscall-note */ /* - * linux/include/linux/netfilter/xt_IDLETIMER.h - * * Header file for Xtables timer target module. * * Copyright (C) 2004, 2010 Nokia Corporation @@ -10,20 +9,6 @@ * by Luciano Coelho * * Contact: Luciano Coelho - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * version 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA */ =20 #ifndef _XT_IDLETIMER_H --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5197C00140 for ; Mon, 15 Aug 2022 19:09:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245636AbiHOTJh (ORCPT ); Mon, 15 Aug 2022 15:09:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343510AbiHOTGa (ORCPT ); Mon, 15 Aug 2022 15:06:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C9032CDFB; Mon, 15 Aug 2022 11:34:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 567CCB8106E; Mon, 15 Aug 2022 18:34:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BB11C433D7; Mon, 15 Aug 2022 18:34:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588492; bh=NC1nKvc8kEpbiH7rSDeGi+lF3xfb0imrip35sYfoFgk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=olB7AW4uX5/0tzQ6mHHR7AYCDA4bf3dY4nQWPiliqypdKViRcOaPlYN1QosXcDk2+ 2LAMhgIqC0LUWS5/vX7ybSHnemfBZY6/lAn3Pgt/C/9NCLRPHvPFQOFE8T0hD4bWaD qw4AUsnV4mXaKGUSdj/NMAMoT0lShUdO3Llgg5KM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Himanshu Madhani , Quinn Tran , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.15 419/779] scsi: qla2xxx: edif: Send LOGO for unexpected IKE message Date: Mon, 15 Aug 2022 20:01:03 +0200 Message-Id: <20220815180355.180044534@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran [ Upstream commit 2b659ed67a12f39f56d8dcad9b5d5a74d67c01b3 ] If the session is down and the local port continues to receive AUTH ELS messages, the driver needs to send back LOGO so that the remote device knows to tear down its session. Terminate and clean up the AUTH ELS exchange followed by a passthrough LOGO. Link: https://lore.kernel.org/r/20220608115849.16693-3-njavali@marvell.com Fixes: 225479296c4f ("scsi: qla2xxx: edif: Reject AUTH ELS on session down") Reviewed-by: Himanshu Madhani Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_edif.c | 19 +++++++++++++++++-- drivers/scsi/qla2xxx/qla_fw.h | 2 +- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_edif.c b/drivers/scsi/qla2xxx/qla_edi= f.c index 8be282339fdd..69f8d16effa6 100644 --- a/drivers/scsi/qla2xxx/qla_edif.c +++ b/drivers/scsi/qla2xxx/qla_edif.c @@ -2496,8 +2496,7 @@ void qla24xx_auth_els(scsi_qla_host_t *vha, void **pk= t, struct rsp_que **rsp) =20 fcport =3D qla2x00_find_fcport_by_pid(host, &purex->pur_info.pur_sid); =20 - if (DBELL_INACTIVE(vha) || - (fcport && EDIF_SESSION_DOWN(fcport))) { + if (DBELL_INACTIVE(vha)) { ql_dbg(ql_dbg_edif, host, 0x0910c, "%s e_dbell.db_flags =3D%x %06x\n", __func__, host->e_dbell.db_flags, fcport ? fcport->d_id.b24 : 0); @@ -2507,6 +2506,22 @@ void qla24xx_auth_els(scsi_qla_host_t *vha, void **p= kt, struct rsp_que **rsp) return; } =20 + if (fcport && EDIF_SESSION_DOWN(fcport)) { + ql_dbg(ql_dbg_edif, host, 0x13b6, + "%s terminate exchange. Send logo to 0x%x\n", + __func__, a.did.b24); + + a.tx_byte_count =3D a.tx_len =3D 0; + a.tx_addr =3D 0; + a.control_flags =3D EPD_RX_XCHG; /* EPD_RX_XCHG =3D terminate cmd */ + qla_els_reject_iocb(host, (*rsp)->qpair, &a); + qla_enode_free(host, ptr); + /* send logo to let remote port knows to tear down session */ + fcport->send_els_logo =3D 1; + qlt_schedule_sess_for_deletion(fcport); + return; + } + /* add the local enode to the list */ qla_enode_add(host, ptr); =20 diff --git a/drivers/scsi/qla2xxx/qla_fw.h b/drivers/scsi/qla2xxx/qla_fw.h index 073d06e88c58..6faf7533958f 100644 --- a/drivers/scsi/qla2xxx/qla_fw.h +++ b/drivers/scsi/qla2xxx/qla_fw.h @@ -807,7 +807,7 @@ struct els_entry_24xx { #define EPD_ELS_COMMAND (0 << 13) #define EPD_ELS_ACC (1 << 13) #define EPD_ELS_RJT (2 << 13) -#define EPD_RX_XCHG (3 << 13) +#define EPD_RX_XCHG (3 << 13) /* terminate exchange */ #define ECF_CLR_PASSTHRU_PEND BIT_12 #define ECF_INCL_FRAME_HDR BIT_11 #define ECF_SEC_LOGIN BIT_3 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BEF12C00140 for ; Mon, 15 Aug 2022 19:09:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343636AbiHOTJb (ORCPT ); Mon, 15 Aug 2022 15:09:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343508AbiHOTG3 (ORCPT ); Mon, 15 Aug 2022 15:06:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDF364E86F; Mon, 15 Aug 2022 11:34:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6F026B81072; Mon, 15 Aug 2022 18:34:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3FE7C433D6; Mon, 15 Aug 2022 18:34:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588495; bh=TerHaN3ULsneVuFYUiA0zlYmlhU/YrtLSc3KhLzTd38=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iyhKuI/3mNcREr5HbdX5gzDoYZnQvl8KWkGPaGU2cF2OwkMpnXM063rCl9RtOdutG mL2n4TwogcekqfEpErYuhhLlSSZLqQ56M5C4ueyOjK4a9XaoU4cMG2cGqkUsiYONCC AqMRX261IS3q5ZBaPfP82gFGy7P1hHhr5ZVPP2e8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Himanshu Madhani , Quinn Tran , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.15 420/779] scsi: qla2xxx: edif: Reduce disruption due to multiple app start Date: Mon, 15 Aug 2022 20:01:04 +0200 Message-Id: <20220815180355.218496980@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran [ Upstream commit 0dbfce5255fe8d069a1a3b712a25b263264cfa58 ] Multiple app start can trigger a session bounce. Make driver skip over session teardown if app start is seen more than once. Link: https://lore.kernel.org/r/20220608115849.16693-4-njavali@marvell.com Fixes: 7ebb336e45ef ("scsi: qla2xxx: edif: Add start + stop bsgs") Reviewed-by: Himanshu Madhani Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_edif.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_edif.c b/drivers/scsi/qla2xxx/qla_edi= f.c index 69f8d16effa6..f7953ce17678 100644 --- a/drivers/scsi/qla2xxx/qla_edif.c +++ b/drivers/scsi/qla2xxx/qla_edif.c @@ -486,8 +486,7 @@ qla_edif_app_start(scsi_qla_host_t *vha, struct bsg_job= *bsg_job) /* mark doorbell as active since an app is now present */ vha->e_dbell.db_flags |=3D EDB_ACTIVE; } else { - ql_dbg(ql_dbg_edif, vha, 0x911e, "%s doorbell already active\n", - __func__); + goto out; } =20 if (N2N_TOPO(vha->hw)) { @@ -555,6 +554,7 @@ qla_edif_app_start(scsi_qla_host_t *vha, struct bsg_job= *bsg_job) __func__); } =20 +out: appreply.host_support_edif =3D vha->hw->flags.edif_enabled; appreply.edif_enode_active =3D vha->pur_cinfo.enode_flags; appreply.edif_edb_active =3D vha->e_dbell.db_flags; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80562C282E7 for ; Mon, 15 Aug 2022 19:10:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343682AbiHOTKB (ORCPT ); Mon, 15 Aug 2022 15:10:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343554AbiHOTGh (ORCPT ); Mon, 15 Aug 2022 15:06:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DD664E87B; Mon, 15 Aug 2022 11:34:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A3579610AA; Mon, 15 Aug 2022 18:34:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4889C433D6; Mon, 15 Aug 2022 18:34:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588498; bh=VYd2+ukN06xBcoLLYYMIChMdyu1WQeTPutYHfew0D6w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WeWwiSI1GN3THRh3LQGAnVPH0z6mRmP//fSkYi5FzIR9CwmK39FbKDzXSGFg33JDQ lCVhKHjWk7ZE/QD2m8jKEwW5IFl5lDz93F0H1/DMCbD2fe4xyt+Wn9LJjmHP8lKbgn kQqRH1Huavk7zVziRG60AxzU7xGm4F7HgrMcs5Ko= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Himanshu Madhani , Quinn Tran , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.15 421/779] scsi: qla2xxx: edif: Fix no login after app start Date: Mon, 15 Aug 2022 20:01:05 +0200 Message-Id: <20220815180355.256894426@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran [ Upstream commit 24c796098f5395477f7f7ebf8e24f3f08a139f71 ] The scenario is this: User loaded driver but has not started authentication app. All sessions to secure device will exhaust all login attempts, fail, and in stay in deleted state. Then some time later the app is started. The driver will replenish the login retry count, trigger delete to prepare for secure login. After deletion, relogin is triggered. For the session that is already deleted, the delete trigger is a no-op. If none of the sessions trigger a relogin, no progress is made. Add a relogin trigger. Link: https://lore.kernel.org/r/20220608115849.16693-5-njavali@marvell.com Fixes: 7ebb336e45ef ("scsi: qla2xxx: edif: Add start + stop bsgs") Reviewed-by: Himanshu Madhani Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_edif.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/qla2xxx/qla_edif.c b/drivers/scsi/qla2xxx/qla_edi= f.c index f7953ce17678..c0971888a0a1 100644 --- a/drivers/scsi/qla2xxx/qla_edif.c +++ b/drivers/scsi/qla2xxx/qla_edif.c @@ -544,6 +544,7 @@ qla_edif_app_start(scsi_qla_host_t *vha, struct bsg_job= *bsg_job) qlt_schedule_sess_for_deletion(fcport); qla_edif_sa_ctl_init(vha, fcport); } + set_bit(RELOGIN_NEEDED, &vha->dpc_flags); } =20 if (vha->pur_cinfo.enode_flags !=3D ENODE_ACTIVE) { --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C606C00140 for ; Mon, 15 Aug 2022 19:14:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344031AbiHOTOm (ORCPT ); Mon, 15 Aug 2022 15:14:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344006AbiHOTLc (ORCPT ); Mon, 15 Aug 2022 15:11:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A524F4F69F; Mon, 15 Aug 2022 11:37: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 AB974B81082; Mon, 15 Aug 2022 18:37:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01FB9C433C1; Mon, 15 Aug 2022 18:37:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588622; bh=dGIhvIVlTqjvge9VTLyUtZVpVLlYTitEQSS0D6+X9eo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z3S0XcFJ652j5o7+wk2yG82Mz0mUXJzkk6dW7R2SrzZOMfQazLIFnFMPhTmiATydE oQqj16zsxDveZK02srQY3l/5suEl9UOQuHk6LgJgXXlsBBN/9ZGqEmrUD/FhmNK1Vm jM0vhU+YoGtmxcIhtDRWmYeOwCAYbBexAsshSukU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Himanshu Madhani , Quinn Tran , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.15 422/779] scsi: qla2xxx: edif: Tear down session if keys have been removed Date: Mon, 15 Aug 2022 20:01:06 +0200 Message-Id: <20220815180355.297007226@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran [ Upstream commit d7e2e4a68fc047a025afcd200e6b7e1fbc8b1999 ] If all keys for a session have been deleted, trigger a session teardown. Link: https://lore.kernel.org/r/20220608115849.16693-6-njavali@marvell.com Fixes: dd30706e73b7 ("scsi: qla2xxx: edif: Add key update") Reviewed-by: Himanshu Madhani Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_def.h | 5 +++++ drivers/scsi/qla2xxx/qla_isr.c | 1 + 2 files changed, 6 insertions(+) diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h index 883b3fb07c2c..4fc289815ccb 100644 --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -2158,6 +2158,11 @@ typedef struct { #define CS_IOCB_ERROR 0x31 /* Generic error for IOCB request failure */ #define CS_REJECT_RECEIVED 0x4E /* Reject received */ +#define CS_EDIF_AUTH_ERROR 0x63 /* decrypt error */ +#define CS_EDIF_PAD_LEN_ERROR 0x65 /* pad > frame size, not 4byte align */ +#define CS_EDIF_INV_REQ 0x66 /* invalid request */ +#define CS_EDIF_SPI_ERROR 0x67 /* rx frame unable to locate sa */ +#define CS_EDIF_HDR_ERROR 0x69 /* data frame !=3D expected len */ #define CS_BAD_PAYLOAD 0x80 /* Driver defined */ #define CS_UNKNOWN 0x81 /* Driver defined */ #define CS_RETRY 0x82 /* Driver defined */ diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c index c3711ab68c3d..c41a965eb4a7 100644 --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -3420,6 +3420,7 @@ qla2x00_status_entry(scsi_qla_host_t *vha, struct rsp= _que *rsp, void *pkt) case CS_PORT_UNAVAILABLE: case CS_TIMEOUT: case CS_RESET: + case CS_EDIF_INV_REQ: =20 /* * We are going to have the fc class block the rport --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB429C00140 for ; Mon, 15 Aug 2022 19:10:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229995AbiHOTK1 (ORCPT ); Mon, 15 Aug 2022 15:10:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245210AbiHOTHA (ORCPT ); Mon, 15 Aug 2022 15:07: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 F3C266407; Mon, 15 Aug 2022 11:35: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 37FEE60FFD; Mon, 15 Aug 2022 18:35:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FF1DC433D6; Mon, 15 Aug 2022 18:35:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588522; bh=eX2NWuVLWaciWJvUAx+ClV4nlqaFeBff3kQfbkpS6UI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VP1MW0VaxTeTrX/msowzlsYpLsnLwIm4MT8C4aJiyuuBbeY3USSw8uxzhJ9PFdm/r +3tct63QBkS4H8NsEN2gSYDcfMv3bbK1OI221eRkLg4EX4RYEwKICPiyY49V57PujF hzdEAuMs0YIDlaFzhFXCSVNNpp/ROKDF0Yd3RanE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Himanshu Madhani , Quinn Tran , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.15 423/779] scsi: qla2xxx: edif: Fix session thrash Date: Mon, 15 Aug 2022 20:01:07 +0200 Message-Id: <20220815180355.341190515@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran [ Upstream commit a8fdfb0b39c2b31722c70bdf2272b949d5af4b7b ] Current code prematurely sends out PRLI before authentication application has given the OK to do so. This causes PRLI failure and session teardown. Prevents PRLI from going out before authentication app gives the OK. Link: https://lore.kernel.org/r/20220608115849.16693-7-njavali@marvell.com Fixes: 91f6f5fbe87b ("scsi: qla2xxx: edif: Reduce connection thrash") Reviewed-by: Himanshu Madhani Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_edif.c | 2 +- drivers/scsi/qla2xxx/qla_edif.h | 4 ++++ drivers/scsi/qla2xxx/qla_init.c | 10 +++++++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_edif.c b/drivers/scsi/qla2xxx/qla_edi= f.c index c0971888a0a1..8e9237434e8b 100644 --- a/drivers/scsi/qla2xxx/qla_edif.c +++ b/drivers/scsi/qla2xxx/qla_edif.c @@ -3437,7 +3437,7 @@ int qla_edif_process_els(scsi_qla_host_t *vha, struct= bsg_job *bsg_job) if (qla_bsg_check(vha, bsg_job, fcport)) return 0; =20 - if (fcport->loop_id =3D=3D FC_NO_LOOP_ID) { + if (EDIF_SESS_DELETE(fcport)) { ql_dbg(ql_dbg_edif, vha, 0x910d, "%s ELS code %x, no loop id.\n", __func__, bsg_request->rqst_data.r_els.els_code); diff --git a/drivers/scsi/qla2xxx/qla_edif.h b/drivers/scsi/qla2xxx/qla_edi= f.h index a965ca8e47ce..b9cedf6defd9 100644 --- a/drivers/scsi/qla2xxx/qla_edif.h +++ b/drivers/scsi/qla2xxx/qla_edif.h @@ -140,4 +140,8 @@ struct enode { (DBELL_ACTIVE(_fcport->vha) && \ (_fcport->disc_state =3D=3D DSC_LOGIN_AUTH_PEND)) =20 +#define EDIF_SESS_DELETE(_s) \ + (qla_ini_mode_enabled(_s->vha) && (_s->disc_state =3D=3D DSC_DELETE_PEND = || \ + _s->disc_state =3D=3D DSC_DELETED)) + #endif /* __QLA_EDIF_H */ diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_ini= t.c index 49cfe8c9f3bb..edc29d6ebb28 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -1764,8 +1764,16 @@ int qla24xx_fcport_handle_login(struct scsi_qla_host= *vha, fc_port_t *fcport) break; =20 case DSC_LOGIN_PEND: - if (fcport->fw_login_state =3D=3D DSC_LS_PLOGI_COMP) + if (vha->hw->flags.edif_enabled) + break; + + if (fcport->fw_login_state =3D=3D DSC_LS_PLOGI_COMP) { + ql_dbg(ql_dbg_disc, vha, 0x2118, + "%s %d %8phC post %s PRLI\n", + __func__, __LINE__, fcport->port_name, + NVME_TARGET(vha->hw, fcport) ? "NVME" : "FC"); qla24xx_post_prli_work(vha, fcport); + } break; =20 case DSC_UPD_FCPORT: --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0F36C00140 for ; Mon, 15 Aug 2022 19:12:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343766AbiHOTM5 (ORCPT ); Mon, 15 Aug 2022 15:12:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343597AbiHOTJH (ORCPT ); Mon, 15 Aug 2022 15:09:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B83440BDD; Mon, 15 Aug 2022 11:35: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 9A17460FB8; Mon, 15 Aug 2022 18:35:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8692FC433C1; Mon, 15 Aug 2022 18:35:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588556; bh=hTRS1tqejUoIqcG1ti54Lman6PjQTp4st0trKhr/PfE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ji2ocTmXyjsK6i4uYsRXOtTdo/zUkMY8PZCzXDrMkztOfXbZM9i2z1cwL+amL+jtQ qNXcLKTT6AU9hOyv8+Fpdhav83MDoCNCdimiXCOS5EpGFcCLUmjvD0mtQGG+8Je08w ef+rc7Jg4tf4N0p5oB+S0D1FxN7JuQJwlDcUxpQI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Himanshu Madhani , Quinn Tran , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.15 424/779] scsi: qla2xxx: edif: Fix no logout on delete for N2N Date: Mon, 15 Aug 2022 20:01:08 +0200 Message-Id: <20220815180355.383340875@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran [ Upstream commit ec538eb838f334453b10e7e9b260f0c358018a37 ] The driver failed to send implicit logout on session delete. For edif, this failed to flush any lingering SA index in FW. Set a flag to turn on implicit logout early in the session recovery to make sure the logout will go out in case of error. Link: https://lore.kernel.org/r/20220608115849.16693-8-njavali@marvell.com Fixes: 4de067e5df12 ("scsi: qla2xxx: edif: Add N2N support for EDIF") Reviewed-by: Himanshu Madhani Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_iocb.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_ioc= b.c index 46c879923da1..42ce4e1fe744 100644 --- a/drivers/scsi/qla2xxx/qla_iocb.c +++ b/drivers/scsi/qla2xxx/qla_iocb.c @@ -2882,6 +2882,9 @@ static void qla2x00_els_dcmd2_sp_done(srb_t *sp, int = res) sp->name, res, sp->handle, fcport->d_id.b24, fcport->port_name); =20 fcport->flags &=3D ~(FCF_ASYNC_SENT|FCF_ASYNC_ACTIVE); + /* For edif, set logout on delete to ensure any residual key from FW is f= lushed.*/ + fcport->logout_on_delete =3D 1; + fcport->chip_reset =3D vha->hw->base_qpair->chip_reset; =20 if (sp->flags & SRB_WAKEUP_ON_COMP) complete(&lio->u.els_plogi.comp); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F14BC00140 for ; Mon, 15 Aug 2022 19:13:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343935AbiHOTNq (ORCPT ); Mon, 15 Aug 2022 15:13:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343701AbiHOTKR (ORCPT ); Mon, 15 Aug 2022 15:10:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 553452D1DA; Mon, 15 Aug 2022 11:36: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 029BCB80F99; Mon, 15 Aug 2022 18:36:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40D37C433D6; Mon, 15 Aug 2022 18:36:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588590; bh=ERRidEaSPf8YlJJ5Z2ddvXrwawPyaJ/IhkO6FODEPfM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EWpMSKWO0VDEg2GVH1RPXnGUjA3RYF777zt1QwjLra4H0vKBeKyPje5Khu7hXPndD cuN4kw0ZVvSxV79Hd5NdwtVtFPhSynRktpGlg5HsEWZM6klDHW64YG/OP7niWHpCTy OF8WGv3+EcogplEPs1pzf1qBO7/8zNCTO9XOGSb8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jagath Jog J , Andy Shevchenko , Jonathan Cameron , Sasha Levin Subject: [PATCH 5.15 425/779] iio: accel: bma400: Fix the scale min and max macro values Date: Mon, 15 Aug 2022 20:01:09 +0200 Message-Id: <20220815180355.429923382@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jagath Jog J [ Upstream commit 747c7cf1592e226d40543231b26502b332d0ea2f ] Changing the scale macro values to match the bma400 sensitivity for 1 LSB of all the available ranges. Fixes: 465c811f1f20 ("iio: accel: Add driver for the BMA400") Signed-off-by: Jagath Jog J Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/20220505133021.22362-2-jagathjog1996@gmail.= com Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/iio/accel/bma400.h | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/iio/accel/bma400.h b/drivers/iio/accel/bma400.h index 5ad10db9819f..416090c6b1e8 100644 --- a/drivers/iio/accel/bma400.h +++ b/drivers/iio/accel/bma400.h @@ -83,8 +83,27 @@ #define BMA400_ACC_ODR_MIN_WHOLE_HZ 25 #define BMA400_ACC_ODR_MIN_HZ 12 =20 -#define BMA400_SCALE_MIN 38357 -#define BMA400_SCALE_MAX 306864 +/* + * BMA400_SCALE_MIN macro value represents m/s^2 for 1 LSB before + * converting to micro values for +-2g range. + * + * For +-2g - 1 LSB =3D 0.976562 milli g =3D 0.009576 m/s^2 + * For +-4g - 1 LSB =3D 1.953125 milli g =3D 0.019153 m/s^2 + * For +-16g - 1 LSB =3D 7.8125 milli g =3D 0.076614 m/s^2 + * + * The raw value which is used to select the different ranges is determined + * by the first bit set position from the scale value, so BMA400_SCALE_MIN + * should be odd. + * + * Scale values for +-2g, +-4g, +-8g and +-16g are populated into bma400_s= cales + * array by left shifting BMA400_SCALE_MIN. + * e.g.: + * To select +-2g =3D 9577 << 0 =3D raw value to write is 0. + * To select +-8g =3D 9577 << 2 =3D raw value to write is 2. + * To select +-16g =3D 9577 << 3 =3D raw value to write is 3. + */ +#define BMA400_SCALE_MIN 9577 +#define BMA400_SCALE_MAX 76617 =20 #define BMA400_NUM_REGULATORS 2 #define BMA400_VDD_REGULATOR 0 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83F93C00140 for ; Mon, 15 Aug 2022 19:14:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343980AbiHOTOH (ORCPT ); Mon, 15 Aug 2022 15:14:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343772AbiHOTK6 (ORCPT ); Mon, 15 Aug 2022 15:10:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D4872D1E3; Mon, 15 Aug 2022 11:36:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 541C760FB8; Mon, 15 Aug 2022 18:36:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41674C433C1; Mon, 15 Aug 2022 18:36:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588603; bh=pI3uyNduvYYNnsYaeYnXFlhkj0Ht3FhepAR6bPI7eQ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tYEGzWJYyFlg+MIO3ruwqeuS84hgjISWBrIS6T+/cggt8pklQnTToz4HYkdCju7qn LC0dVgfYvEKly+6d6J65x00kSUOSPbnhkduS7PafSes202cZwxf/9k7kWisvs8ZMRM rVvkdQFRmAHwvOVAz/QrHIZ+IWrUAk4mnTFwBhAQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rajat Jain , Matthias Kaehlcke , Hsin-Yi Wang , Tzung-Bi Shih , Guenter Roeck , Evan Green , Stephen Boyd , Sasha Levin Subject: [PATCH 5.15 426/779] platform/chrome: cros_ec: Always expose last resume result Date: Mon, 15 Aug 2022 20:01:10 +0200 Message-Id: <20220815180355.475816065@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stephen Boyd [ Upstream commit 74bb746407bf0d7c7d126c7731dbcd66d467619b ] The last resume result exposing logic in cros_ec_sleep_event() incorrectly requires S0ix support, which doesn't work on ARM based systems where S0ix doesn't exist. That's because cros_ec_sleep_event() only reports the last resume result when the EC indicates the last sleep event was an S0ix resume. On ARM systems, the last sleep event is always S3 resume, but the EC can still detect sleep hang events in case some other part of the AP is blocking sleep. Always expose the last resume result if the EC supports it so that this works on all devices regardless of S0ix support. This fixes sleep hang detection on ARM based chromebooks like Trogdor. Cc: Rajat Jain Cc: Matthias Kaehlcke Cc: Hsin-Yi Wang Cc: Tzung-Bi Shih Reviewed-by: Guenter Roeck Reviewed-by: Evan Green Fixes: 7235560ac77a ("platform/chrome: Add support for v1 of host sleep eve= nt") Signed-off-by: Stephen Boyd Signed-off-by: Tzung-Bi Shih Link: https://lore.kernel.org/r/20220614075726.2729987-1-swboyd@chromium.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/platform/chrome/cros_ec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/platform/chrome/cros_ec.c b/drivers/platform/chrome/cr= os_ec.c index ff2a24b0c611..4f0390b10cd3 100644 --- a/drivers/platform/chrome/cros_ec.c +++ b/drivers/platform/chrome/cros_ec.c @@ -135,16 +135,16 @@ static int cros_ec_sleep_event(struct cros_ec_device = *ec_dev, u8 sleep_event) buf.msg.command =3D EC_CMD_HOST_SLEEP_EVENT; =20 ret =3D cros_ec_cmd_xfer_status(ec_dev, &buf.msg); - - /* For now, report failure to transition to S0ix with a warning. */ + /* Report failure to transition to system wide suspend with a warning. */ if (ret >=3D 0 && ec_dev->host_sleep_v1 && - (sleep_event =3D=3D HOST_SLEEP_EVENT_S0IX_RESUME)) { + (sleep_event =3D=3D HOST_SLEEP_EVENT_S0IX_RESUME || + sleep_event =3D=3D HOST_SLEEP_EVENT_S3_RESUME)) { ec_dev->last_resume_result =3D buf.u.resp1.resume_response.sleep_transitions; =20 WARN_ONCE(buf.u.resp1.resume_response.sleep_transitions & EC_HOST_RESUME_SLEEP_TIMEOUT, - "EC detected sleep transition timeout. Total slp_s0 transitions: %d", + "EC detected sleep transition timeout. Total sleep transitions: %d", buf.u.resp1.resume_response.sleep_transitions & EC_HOST_RESUME_SLEEP_TRANSITIONS_MASK); } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95814C00140 for ; Mon, 15 Aug 2022 19:14:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344002AbiHOTOT (ORCPT ); Mon, 15 Aug 2022 15:14:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343804AbiHOTLC (ORCPT ); Mon, 15 Aug 2022 15:11:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C685A3B949; Mon, 15 Aug 2022 11:36: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 5E26260FB8; Mon, 15 Aug 2022 18:36:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53329C433D7; Mon, 15 Aug 2022 18:36:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588606; bh=YqIxZSsdNXUztsVh8JPPQDHD7xEhPBvc3CkVBWgVj+I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GA0oE4icEmEq0XZMN6fEhBTlHGWZ9EWgXfDq0eIImrKFQJzGTXqaWjlhRnb76rc60 3eUn4JfuKdz0w8NRJGZhi4wnTH/9Rtonrbs7fOkKHnAEN0GlY9Y4ERwik0evCEilIl h6X+FIVquRq67aqq8vouvhqcbaJbIqOFdeATc2gY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jagath Jog J , Andy Shevchenko , Jonathan Cameron , Sasha Levin Subject: [PATCH 5.15 427/779] iio: accel: bma400: Reordering of header files Date: Mon, 15 Aug 2022 20:01:11 +0200 Message-Id: <20220815180355.525516121@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jagath Jog J [ Upstream commit 1bd2dc6ea863690aee5c45ebf09c9194c7a42c0d ] Reordering of header files and removing the iio/sysfs.h since custom attributes are not being used in the driver. Signed-off-by: Jagath Jog J Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/20220505133021.22362-3-jagathjog1996@gmail.= com Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/iio/accel/bma400_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/iio/accel/bma400_core.c b/drivers/iio/accel/bma400_cor= e.c index 21520e022a21..7e6598534650 100644 --- a/drivers/iio/accel/bma400_core.c +++ b/drivers/iio/accel/bma400_core.c @@ -13,14 +13,14 @@ =20 #include #include -#include -#include #include #include #include #include #include =20 +#include + #include "bma400.h" =20 /* --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 882C3C00140 for ; Mon, 15 Aug 2022 19:15:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344079AbiHOTPW (ORCPT ); Mon, 15 Aug 2022 15:15:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343860AbiHOTLJ (ORCPT ); Mon, 15 Aug 2022 15:11:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8AA742ACD; Mon, 15 Aug 2022 11:36: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 3A924B8105D; Mon, 15 Aug 2022 18:36:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7EB9FC433C1; Mon, 15 Aug 2022 18:36:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588610; bh=SsESgowbU490/ite9UQJ2/VF8eHcvsf//IiX5TmCguU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nfc/ts6qw0Ik6sZfiVTCkqozNTC4Obcx5fKFrWp1n+kAgFv+kAkBTBX/l4r2PLBJd +NfufzRoWawcTr16r63iH/9PlfONhz8vJrU0P6RDr7loi15QWDGfRqXhTe3nz+CcDU Z/csyi1C3py9qrJ5KzZCSA+8eO+ZQBt+93+ignrA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rex-BC Chen , Chen-Yu Tsai , AngeloGioacchino Del Regno , "=?UTF-8?q?N=C3=ADcolas=20F . =20R . =20A . =20Prado?=" , Stephen Boyd , Sasha Levin Subject: [PATCH 5.15 428/779] clk: mediatek: reset: Fix written reset bit offset Date: Mon, 15 Aug 2022 20:01:12 +0200 Message-Id: <20220815180355.565929729@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rex-BC Chen [ Upstream commit edabcf71d100fd433a0fc2d0c97057c446c33b2a ] Original assert/deassert bit is BIT(0), but it's more resonable to modify them to BIT(id % 32) which is based on id. This patch will not influence any previous driver because the reset is only used for thermal. The id (MT8183_INFRACFG_AO_THERM_SW_RST) is 0. Fixes: 64ebb57a3df6 ("clk: reset: Modify reset-controller driver") Signed-off-by: Rex-BC Chen Reviewed-by: Chen-Yu Tsai Reviewed-by: AngeloGioacchino Del Regno Reviewed-by: N=C3=ADcolas F. R. A. Prado Tested-by: N=C3=ADcolas F. R. A. Prado Link: https://lore.kernel.org/r/20220523093346.28493-3-rex-bc.chen@mediatek= .com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/clk/mediatek/reset.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/clk/mediatek/reset.c b/drivers/clk/mediatek/reset.c index e562dc3c10a4..d311da574499 100644 --- a/drivers/clk/mediatek/reset.c +++ b/drivers/clk/mediatek/reset.c @@ -25,7 +25,7 @@ static int mtk_reset_assert_set_clr(struct reset_controll= er_dev *rcdev, struct mtk_reset *data =3D container_of(rcdev, struct mtk_reset, rcdev); unsigned int reg =3D data->regofs + ((id / 32) << 4); =20 - return regmap_write(data->regmap, reg, 1); + return regmap_write(data->regmap, reg, BIT(id % 32)); } =20 static int mtk_reset_deassert_set_clr(struct reset_controller_dev *rcdev, @@ -34,7 +34,7 @@ static int mtk_reset_deassert_set_clr(struct reset_contro= ller_dev *rcdev, struct mtk_reset *data =3D container_of(rcdev, struct mtk_reset, rcdev); unsigned int reg =3D data->regofs + ((id / 32) << 4) + 0x4; =20 - return regmap_write(data->regmap, reg, 1); + return regmap_write(data->regmap, reg, BIT(id % 32)); } =20 static int mtk_reset_assert(struct reset_controller_dev *rcdev, --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CEA4DC00140 for ; Mon, 15 Aug 2022 19:14:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239874AbiHOTOX (ORCPT ); Mon, 15 Aug 2022 15:14:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343877AbiHOTLL (ORCPT ); Mon, 15 Aug 2022 15:11:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79F1847B92; Mon, 15 Aug 2022 11:36: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 BEACB610A4; Mon, 15 Aug 2022 18:36:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7E89C433B5; Mon, 15 Aug 2022 18:36:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588613; bh=AoWZxuR6WXPi8Pqjbv7dEunLrV46Cyhu9vllKRjqP4s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f8cJ2wSiItzkzeAtjpykZeLIaFg6n0s/AW9e39IORCKVcPugAvyAfzMHm/B05H9Gk GdpwL2CdmUJEl74gWo1jw3sA6zQWb0movJtjjtO29xjym4+oC00LPmiMp+82JPKyu+ KpDu1tGgcPmLprob4iyC7s9Kk4YnCS3bKVhH8XUg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaohe Lin , Jerome Glisse , Alistair Popple , Jason Gunthorpe , Ralph Campbell , Andrew Morton , Sasha Levin Subject: [PATCH 5.15 429/779] lib/test_hmm: avoid accessing uninitialized pages Date: Mon, 15 Aug 2022 20:01:13 +0200 Message-Id: <20220815180355.612757882@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaohe Lin [ Upstream commit ed913b055a74b723976f8e885a3395162a0371e6 ] If make_device_exclusive_range() fails or returns pages marked for exclusive access less than required, remaining fields of pages will left uninitialized. So dmirror_atomic_map() will access those yet uninitialized fields of pages. To fix it, do dmirror_atomic_map() iff all pages are marked for exclusive access (we will break if mapped is less than required anyway) so we won't access those uninitialized fields of pages. Link: https://lkml.kernel.org/r/20220609130835.35110-1-linmiaohe@huawei.com Fixes: b659baea7546 ("mm: selftests for exclusive device memory") Signed-off-by: Miaohe Lin Cc: Jerome Glisse Cc: Alistair Popple Cc: Jason Gunthorpe Cc: Ralph Campbell Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- lib/test_hmm.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/test_hmm.c b/lib/test_hmm.c index ac794e354069..a89cb4281c9d 100644 --- a/lib/test_hmm.c +++ b/lib/test_hmm.c @@ -731,7 +731,7 @@ static int dmirror_exclusive(struct dmirror *dmirror, =20 mmap_read_lock(mm); for (addr =3D start; addr < end; addr =3D next) { - unsigned long mapped; + unsigned long mapped =3D 0; int i; =20 if (end < addr + (ARRAY_SIZE(pages) << PAGE_SHIFT)) @@ -740,7 +740,13 @@ static int dmirror_exclusive(struct dmirror *dmirror, next =3D addr + (ARRAY_SIZE(pages) << PAGE_SHIFT); =20 ret =3D make_device_exclusive_range(mm, addr, next, pages, NULL); - mapped =3D dmirror_atomic_map(addr, next, pages, dmirror); + /* + * Do dmirror_atomic_map() iff all pages are marked for + * exclusive access to avoid accessing uninitialized + * fields of pages. + */ + if (ret =3D=3D (next - addr) >> PAGE_SHIFT) + mapped =3D dmirror_atomic_map(addr, next, pages, dmirror); for (i =3D 0; i < ret; i++) { if (pages[i]) { unlock_page(pages[i]); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 119DCC00140 for ; Mon, 15 Aug 2022 19:14:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232952AbiHOTO2 (ORCPT ); Mon, 15 Aug 2022 15:14:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343943AbiHOTLW (ORCPT ); Mon, 15 Aug 2022 15: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 9EC614F1A6; Mon, 15 Aug 2022 11:36: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 B436161129; Mon, 15 Aug 2022 18:36:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A192AC433C1; Mon, 15 Aug 2022 18:36:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588616; bh=acG0Ir6mHP3cYPb/vZ/vXu97MaHwAxbCdXUpZ4Qddbk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=whiN8ivJh0UCVHBN7EmezDholctLQ/Laa1bdXxwqJf2upmeJ8maSNMWpsZdYhsxU5 PTb8VE3FeZ2k/TVn4OaGIOt2Dsv3VbuWTFJW+3/IgslWBTV+IuNl+aVmBOunrTK3eW sGv4fDL5aLZwi36OMT412Lp85FEsPbClXYJ+pJxg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Bjorn Helgaas , Dan Williams , Sasha Levin Subject: [PATCH 5.15 430/779] memremap: remove support for external pgmap refcounts Date: Mon, 15 Aug 2022 20:01:14 +0200 Message-Id: <20220815180355.666680477@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 b80892ca022e9eb484771a66eb68e12364695a2a ] No driver is left using the external pgmap refcount, so remove the code to support it. Signed-off-by: Christoph Hellwig Acked-by: Bjorn Helgaas Link: https://lore.kernel.org/r/20211028151017.50234-1-hch@lst.de Signed-off-by: Dan Williams Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/pci/p2pdma.c | 2 +- include/linux/memremap.h | 18 ++-------- mm/memremap.c | 59 +++++++------------------------ tools/testing/nvdimm/test/iomap.c | 43 +++++++--------------- 4 files changed, 28 insertions(+), 94 deletions(-) diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c index 50cdde3e9a8b..316fd2f44df4 100644 --- a/drivers/pci/p2pdma.c +++ b/drivers/pci/p2pdma.c @@ -219,7 +219,7 @@ int pci_p2pdma_add_resource(struct pci_dev *pdev, int b= ar, size_t size, error =3D gen_pool_add_owner(p2pdma->pool, (unsigned long)addr, pci_bus_address(pdev, bar) + offset, range_len(&pgmap->range), dev_to_node(&pdev->dev), - pgmap->ref); + &pgmap->ref); if (error) goto pages_free; =20 diff --git a/include/linux/memremap.h b/include/linux/memremap.h index c0e9d35889e8..a8bc588fe7aa 100644 --- a/include/linux/memremap.h +++ b/include/linux/memremap.h @@ -72,16 +72,6 @@ struct dev_pagemap_ops { */ void (*page_free)(struct page *page); =20 - /* - * Transition the refcount in struct dev_pagemap to the dead state. - */ - void (*kill)(struct dev_pagemap *pgmap); - - /* - * Wait for refcount in struct dev_pagemap to be idle and reap it. - */ - void (*cleanup)(struct dev_pagemap *pgmap); - /* * Used for private (un-addressable) device memory only. Must migrate * the page back to a CPU accessible page. @@ -95,8 +85,7 @@ struct dev_pagemap_ops { * struct dev_pagemap - metadata for ZONE_DEVICE mappings * @altmap: pre-allocated/reserved memory for vmemmap allocations * @ref: reference count that pins the devm_memremap_pages() mapping - * @internal_ref: internal reference if @ref is not provided by the caller - * @done: completion for @internal_ref + * @done: completion for @ref * @type: memory type: see MEMORY_* in memory_hotplug.h * @flags: PGMAP_* flags to specify defailed behavior * @ops: method table @@ -109,8 +98,7 @@ struct dev_pagemap_ops { */ struct dev_pagemap { struct vmem_altmap altmap; - struct percpu_ref *ref; - struct percpu_ref internal_ref; + struct percpu_ref ref; struct completion done; enum memory_type type; unsigned int flags; @@ -191,7 +179,7 @@ static inline unsigned long memremap_compat_align(void) static inline void put_dev_pagemap(struct dev_pagemap *pgmap) { if (pgmap) - percpu_ref_put(pgmap->ref); + percpu_ref_put(&pgmap->ref); } =20 #endif /* _LINUX_MEMREMAP_H_ */ diff --git a/mm/memremap.c b/mm/memremap.c index e77487375c8e..a638a27d89f5 100644 --- a/mm/memremap.c +++ b/mm/memremap.c @@ -112,30 +112,6 @@ static unsigned long pfn_next(unsigned long pfn) #define for_each_device_pfn(pfn, map, i) \ for (pfn =3D pfn_first(map, i); pfn < pfn_end(map, i); pfn =3D pfn_next(p= fn)) =20 -static void dev_pagemap_kill(struct dev_pagemap *pgmap) -{ - if (pgmap->ops && pgmap->ops->kill) - pgmap->ops->kill(pgmap); - else - percpu_ref_kill(pgmap->ref); -} - -static void dev_pagemap_cleanup(struct dev_pagemap *pgmap) -{ - if (pgmap->ops && pgmap->ops->cleanup) { - pgmap->ops->cleanup(pgmap); - } else { - wait_for_completion(&pgmap->done); - percpu_ref_exit(pgmap->ref); - } - /* - * Undo the pgmap ref assignment for the internal case as the - * caller may re-enable the same pgmap. - */ - if (pgmap->ref =3D=3D &pgmap->internal_ref) - pgmap->ref =3D NULL; -} - static void pageunmap_range(struct dev_pagemap *pgmap, int range_id) { struct range *range =3D &pgmap->ranges[range_id]; @@ -167,11 +143,12 @@ void memunmap_pages(struct dev_pagemap *pgmap) unsigned long pfn; int i; =20 - dev_pagemap_kill(pgmap); + percpu_ref_kill(&pgmap->ref); for (i =3D 0; i < pgmap->nr_range; i++) for_each_device_pfn(pfn, pgmap, i) put_page(pfn_to_page(pfn)); - dev_pagemap_cleanup(pgmap); + wait_for_completion(&pgmap->done); + percpu_ref_exit(&pgmap->ref); =20 for (i =3D 0; i < pgmap->nr_range; i++) pageunmap_range(pgmap, i); @@ -188,8 +165,7 @@ static void devm_memremap_pages_release(void *data) =20 static void dev_pagemap_percpu_release(struct percpu_ref *ref) { - struct dev_pagemap *pgmap =3D - container_of(ref, struct dev_pagemap, internal_ref); + struct dev_pagemap *pgmap =3D container_of(ref, struct dev_pagemap, ref); =20 complete(&pgmap->done); } @@ -295,8 +271,8 @@ static int pagemap_range(struct dev_pagemap *pgmap, str= uct mhp_params *params, memmap_init_zone_device(&NODE_DATA(nid)->node_zones[ZONE_DEVICE], PHYS_PFN(range->start), PHYS_PFN(range_len(range)), pgmap); - percpu_ref_get_many(pgmap->ref, pfn_end(pgmap, range_id) - - pfn_first(pgmap, range_id)); + percpu_ref_get_many(&pgmap->ref, + pfn_end(pgmap, range_id) - pfn_first(pgmap, range_id)); return 0; =20 err_add_memory: @@ -362,22 +338,11 @@ void *memremap_pages(struct dev_pagemap *pgmap, int n= id) break; } =20 - if (!pgmap->ref) { - if (pgmap->ops && (pgmap->ops->kill || pgmap->ops->cleanup)) - return ERR_PTR(-EINVAL); - - init_completion(&pgmap->done); - error =3D percpu_ref_init(&pgmap->internal_ref, - dev_pagemap_percpu_release, 0, GFP_KERNEL); - if (error) - return ERR_PTR(error); - pgmap->ref =3D &pgmap->internal_ref; - } else { - if (!pgmap->ops || !pgmap->ops->kill || !pgmap->ops->cleanup) { - WARN(1, "Missing reference count teardown definition\n"); - return ERR_PTR(-EINVAL); - } - } + init_completion(&pgmap->done); + error =3D percpu_ref_init(&pgmap->ref, dev_pagemap_percpu_release, 0, + GFP_KERNEL); + if (error) + return ERR_PTR(error); =20 devmap_managed_enable_get(pgmap); =20 @@ -486,7 +451,7 @@ struct dev_pagemap *get_dev_pagemap(unsigned long pfn, /* fall back to slow path lookup */ rcu_read_lock(); pgmap =3D xa_load(&pgmap_array, PHYS_PFN(phys)); - if (pgmap && !percpu_ref_tryget_live(pgmap->ref)) + if (pgmap && !percpu_ref_tryget_live(&pgmap->ref)) pgmap =3D NULL; rcu_read_unlock(); =20 diff --git a/tools/testing/nvdimm/test/iomap.c b/tools/testing/nvdimm/test/= iomap.c index ed563bdd88f3..b752ce47ead3 100644 --- a/tools/testing/nvdimm/test/iomap.c +++ b/tools/testing/nvdimm/test/iomap.c @@ -100,25 +100,17 @@ static void nfit_test_kill(void *_pgmap) { struct dev_pagemap *pgmap =3D _pgmap; =20 - WARN_ON(!pgmap || !pgmap->ref); - - if (pgmap->ops && pgmap->ops->kill) - pgmap->ops->kill(pgmap); - else - percpu_ref_kill(pgmap->ref); - - if (pgmap->ops && pgmap->ops->cleanup) { - pgmap->ops->cleanup(pgmap); - } else { - wait_for_completion(&pgmap->done); - percpu_ref_exit(pgmap->ref); - } + WARN_ON(!pgmap); + + percpu_ref_kill(&pgmap->ref); + + wait_for_completion(&pgmap->done); + percpu_ref_exit(&pgmap->ref); } =20 static void dev_pagemap_percpu_release(struct percpu_ref *ref) { - struct dev_pagemap *pgmap =3D - container_of(ref, struct dev_pagemap, internal_ref); + struct dev_pagemap *pgmap =3D container_of(ref, struct dev_pagemap, ref); =20 complete(&pgmap->done); } @@ -132,22 +124,11 @@ void *__wrap_devm_memremap_pages(struct device *dev, = struct dev_pagemap *pgmap) if (!nfit_res) return devm_memremap_pages(dev, pgmap); =20 - if (!pgmap->ref) { - if (pgmap->ops && (pgmap->ops->kill || pgmap->ops->cleanup)) - return ERR_PTR(-EINVAL); - - init_completion(&pgmap->done); - error =3D percpu_ref_init(&pgmap->internal_ref, - dev_pagemap_percpu_release, 0, GFP_KERNEL); - if (error) - return ERR_PTR(error); - pgmap->ref =3D &pgmap->internal_ref; - } else { - if (!pgmap->ops || !pgmap->ops->kill || !pgmap->ops->cleanup) { - WARN(1, "Missing reference count teardown definition\n"); - return ERR_PTR(-EINVAL); - } - } + init_completion(&pgmap->done); + error =3D percpu_ref_init(&pgmap->ref, dev_pagemap_percpu_release, 0, + GFP_KERNEL); + if (error) + return ERR_PTR(error); =20 error =3D devm_add_action_or_reset(dev, nfit_test_kill, pgmap); if (error) --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E149CC00140 for ; Mon, 15 Aug 2022 19:14:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344020AbiHOTOe (ORCPT ); Mon, 15 Aug 2022 15:14:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343947AbiHOTLY (ORCPT ); Mon, 15 Aug 2022 15:11:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD33C4F1BE; Mon, 15 Aug 2022 11:37:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DA16861120; Mon, 15 Aug 2022 18:36:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4FCAC433C1; Mon, 15 Aug 2022 18:36:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588619; bh=ok122iydLCawAKzOmxzxOc64Y/ddZl/jPVv7UsppXHY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uiBZJgsSClJ1ehsujimquuyrTAJFGfa3nPZUwbNcnM8+E7k6HgDLgicnfKsIXbmPf SkAp41tE1ep02eCnAMubjUAXkrq3ccqQSYLlNSW+l4ZyoAPqsPcnoG4jyNLy9cy9JL T9GBTJTVQpRY8YlSRJRXaFVtgk7BK7zWRJH3HBqQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaohe Lin , Dan Williams , Andrew Morton , Sasha Levin Subject: [PATCH 5.15 431/779] mm/memremap: fix memunmap_pages() race with get_dev_pagemap() Date: Mon, 15 Aug 2022 20:01:15 +0200 Message-Id: <20220815180355.705093723@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaohe Lin [ Upstream commit 1e57ffb6e3fd9583268c6462c4e3853575b21701 ] Think about the below scene: CPU1 CPU2 memunmap_pages percpu_ref_exit __percpu_ref_exit free_percpu(percpu_count); /* percpu_count is freed here! */ get_dev_pagemap xa_load(&pgmap_array, PHYS_PFN(phys)) /* pgmap still in the pgmap_array */ percpu_ref_tryget_live(&pgmap->ref) if __ref_is_percpu /* __PERCPU_REF_ATOMIC_DEAD not set yet */ this_cpu_inc(*percpu_count) /* access freed percpu_count here! */ ref->percpu_count_ptr =3D __PERCPU_REF_ATOMIC_DEAD; /* too late... */ pageunmap_range To fix the issue, do percpu_ref_exit() after pgmap_array is emptied. So we won't do percpu_ref_tryget_live() against a being freed percpu_ref. Link: https://lkml.kernel.org/r/20220609121305.2508-1-linmiaohe@huawei.com Fixes: b7b3c01b1915 ("mm/memremap_pages: support multiple ranges per invoca= tion") Signed-off-by: Miaohe Lin Cc: Dan Williams Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- mm/memremap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/memremap.c b/mm/memremap.c index a638a27d89f5..8d743cbc2964 100644 --- a/mm/memremap.c +++ b/mm/memremap.c @@ -148,10 +148,10 @@ void memunmap_pages(struct dev_pagemap *pgmap) for_each_device_pfn(pfn, pgmap, i) put_page(pfn_to_page(pfn)); wait_for_completion(&pgmap->done); - percpu_ref_exit(&pgmap->ref); =20 for (i =3D 0; i < pgmap->nr_range; i++) pageunmap_range(pgmap, i); + percpu_ref_exit(&pgmap->ref); =20 WARN_ONCE(pgmap->altmap.alloc, "failed to free all reserved pages\n"); devmap_managed_enable_put(pgmap); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31876C00140 for ; Mon, 15 Aug 2022 19:10:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343715AbiHOTKf (ORCPT ); Mon, 15 Aug 2022 15:10:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245416AbiHOTHT (ORCPT ); Mon, 15 Aug 2022 15:07:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 360AEB4A8; Mon, 15 Aug 2022 11:35: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 538A761019; Mon, 15 Aug 2022 18:35:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E4A5C433C1; Mon, 15 Aug 2022 18:35:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588525; bh=cBQfniI4oyotMAIDfEeA5mZb0s7lj68v4X9HLUHZcQ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2tPkL/CTUpyfxiWPLUXPy0pHBI0m2pmLpUsKFcp18A6BzA+KRQ6/91ASDc54xJant mXQuAkKnfJokEREM2GroBGcp5KSaFISAp0MLYpiSq1pT3sIrRaa59Ccxg5eHb/HF4X OxxOLkrCZiXb1RB+E2DDdocdwWyoMJ7lFKFBNgps= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.15 432/779] KVM: Dont set Accessed/Dirty bits for ZERO_PAGE Date: Mon, 15 Aug 2022 20:01:16 +0200 Message-Id: <20220815180355.752261884@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson [ Upstream commit a1040b0d42acf69bb4f6dbdc54c2dcd78eea1de5 ] Don't set Accessed/Dirty bits for a struct page with PG_reserved set, i.e. don't set A/D bits for the ZERO_PAGE. The ZERO_PAGE (or pages depending on the architecture) should obviously never be written, and similarly there's no point in marking it accessed as the page will never be swapped out or reclaimed. The comment in page-flags.h is quite clear that PG_reserved pages should be managed only by their owner, and strictly following that mandate also simplifies KVM's logic. Fixes: 7df003c85218 ("KVM: fix overflow of zero page refcount with ksm runn= ing") Signed-off-by: Sean Christopherson Message-Id: <20220429010416.2788472-4-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- virt/kvm/kvm_main.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 0816b8018cde..251b4143f505 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -2762,16 +2762,28 @@ void kvm_release_pfn_dirty(kvm_pfn_t pfn) } EXPORT_SYMBOL_GPL(kvm_release_pfn_dirty); =20 +static bool kvm_is_ad_tracked_pfn(kvm_pfn_t pfn) +{ + if (!pfn_valid(pfn)) + return false; + + /* + * Per page-flags.h, pages tagged PG_reserved "should in general not be + * touched (e.g. set dirty) except by its owner". + */ + return !PageReserved(pfn_to_page(pfn)); +} + void kvm_set_pfn_dirty(kvm_pfn_t pfn) { - if (!kvm_is_reserved_pfn(pfn) && !kvm_is_zone_device_pfn(pfn)) + if (kvm_is_ad_tracked_pfn(pfn)) SetPageDirty(pfn_to_page(pfn)); } EXPORT_SYMBOL_GPL(kvm_set_pfn_dirty); =20 void kvm_set_pfn_accessed(kvm_pfn_t pfn) { - if (!kvm_is_reserved_pfn(pfn) && !kvm_is_zone_device_pfn(pfn)) + if (kvm_is_ad_tracked_pfn(pfn)) mark_page_accessed(pfn_to_page(pfn)); } EXPORT_SYMBOL_GPL(kvm_set_pfn_accessed); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7511BC00140 for ; Mon, 15 Aug 2022 19:10:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343721AbiHOTKi (ORCPT ); Mon, 15 Aug 2022 15:10:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245591AbiHOTHo (ORCPT ); Mon, 15 Aug 2022 15:07:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67AEAEE05; Mon, 15 Aug 2022 11:35: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 28E9061120; Mon, 15 Aug 2022 18:35:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 311EAC433C1; Mon, 15 Aug 2022 18:35:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588528; bh=Q/tETnobzZqDR+69uGKPP1XKeVrj0B67172MBzgR9fI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lmKkjuiAuBafGcQmQboOroVB96ULjw7/1Y/fQBXwuy08X7AYBYf0WAOPO4+CvtLwa pkpYcyaHiJiyAjOkl+gRFNJLxqVd5qRALgs2UpG6cEnCrREU23e+d5PkPwGoWDsgdp B5e2GOhP01WrEnzbhe+1bKo8LsgqLUSN4d9yOV8g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Jonas=20Dre=C3=9Fler?= , Kalle Valo , Sasha Levin Subject: [PATCH 5.15 433/779] mwifiex: Ignore BTCOEX events from the 88W8897 firmware Date: Mon, 15 Aug 2022 20:01:17 +0200 Message-Id: <20220815180355.792123787@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jonas Dre=C3=9Fler [ Upstream commit 84d94e16efa268e4f2887d858cd67ee37b870f25 ] The firmware of the 88W8897 PCIe+USB card sends those events very unreliably, sometimes bluetooth together with 2.4ghz-wifi is used and no COEX event comes in, and sometimes bluetooth is disabled but the coexistance mode doesn't get disabled. This means we sometimes end up capping the rx/tx window size while bluetooth is not enabled anymore, artifically limiting wifi speeds even though bluetooth is not being used. Since we can't fix the firmware, let's just ignore those events on the 88W8897 device. From some Wireshark capture sessions it seems that the Windows driver also doesn't change the rx/tx window sizes when bluetooth gets enabled or disabled, so this is fairly consistent with the Windows driver. Signed-off-by: Jonas Dre=C3=9Fler Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20211103205827.14559-1-verdre@v0yd.nl Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/wireless/marvell/mwifiex/main.h | 2 ++ drivers/net/wireless/marvell/mwifiex/pcie.c | 3 +++ drivers/net/wireless/marvell/mwifiex/sta_event.c | 3 +++ 3 files changed, 8 insertions(+) diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wire= less/marvell/mwifiex/main.h index 5923c5c14c8d..f4e3dce10d65 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -1054,6 +1054,8 @@ struct mwifiex_adapter { void *devdump_data; int devdump_len; struct timer_list devdump_timer; + + bool ignore_btcoex_events; }; =20 void mwifiex_process_tx_queue(struct mwifiex_adapter *adapter); diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wire= less/marvell/mwifiex/pcie.c index c3f5583ea70d..d5fb29400bad 100644 --- a/drivers/net/wireless/marvell/mwifiex/pcie.c +++ b/drivers/net/wireless/marvell/mwifiex/pcie.c @@ -3152,6 +3152,9 @@ static int mwifiex_init_pcie(struct mwifiex_adapter *= adapter) if (ret) goto err_alloc_buffers; =20 + if (pdev->device =3D=3D PCIE_DEVICE_ID_MARVELL_88W8897) + adapter->ignore_btcoex_events =3D true; + return 0; =20 err_alloc_buffers: diff --git a/drivers/net/wireless/marvell/mwifiex/sta_event.c b/drivers/net= /wireless/marvell/mwifiex/sta_event.c index 2b2e6e0166e1..7d42c5d2dbf6 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_event.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_event.c @@ -1062,6 +1062,9 @@ int mwifiex_process_sta_event(struct mwifiex_private = *priv) break; case EVENT_BT_COEX_WLAN_PARA_CHANGE: dev_dbg(adapter->dev, "EVENT: BT coex wlan param update\n"); + if (adapter->ignore_btcoex_events) + break; + mwifiex_bt_coex_wlan_param_update_event(priv, adapter->event_skb); break; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3AFBFC00140 for ; Mon, 15 Aug 2022 19:12:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343733AbiHOTKt (ORCPT ); Mon, 15 Aug 2022 15:10:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231804AbiHOTHz (ORCPT ); Mon, 15 Aug 2022 15:07:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFFF2DFD1; Mon, 15 Aug 2022 11:35: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 2898F610A1; Mon, 15 Aug 2022 18:35:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22935C433D6; Mon, 15 Aug 2022 18:35:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588531; bh=UJmj70UkTXQqR5y3KxZmXyg0OVX1VaFNENqu9maiEBU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eoXKQdLDyTuXVoPqzTDO6gTbMFGDSVErer1ex26ATdgtjLpWo+NgyMcIMwF1SRQrF xQ4m3sziZWy3G7qLFfWYZDoGH1lCmYxceauu19nV/fmaOaGBNldok9ekyK514T2ynv tQoIkdEqanzlAl3Bwyg5ZS49CZ8Xa2B37Lvpc/eI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Norris , Duoming Zhou , Sasha Levin Subject: [PATCH 5.15 434/779] mwifiex: fix sleep in atomic context bugs caused by dev_coredumpv Date: Mon, 15 Aug 2022 20:01:18 +0200 Message-Id: <20220815180355.839961911@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Duoming Zhou [ Upstream commit a52ed4866d2b90dd5e4ae9dabd453f3ed8fa3cbc ] There are sleep in atomic context bugs when uploading device dump data in mwifiex. The root cause is that dev_coredumpv could not be used in atomic contexts, because it calls dev_set_name which include operations that may sleep. The call tree shows execution paths that could lead to bugs: (Interrupt context) fw_dump_timer_fn mwifiex_upload_device_dump dev_coredumpv(..., GFP_KERNEL) dev_coredumpm() kzalloc(sizeof(*devcd), gfp); //may sleep dev_set_name kobject_set_name_vargs kvasprintf_const(GFP_KERNEL, ...); //may sleep kstrdup(s, GFP_KERNEL); //may sleep The corresponding fail log is shown below: [ 135.275938] usb 1-1: =3D=3D mwifiex dump information to /sys/class/devco= redump start [ 135.281029] BUG: sleeping function called from invalid context at includ= e/linux/sched/mm.h:265 ... [ 135.293613] Call Trace: [ 135.293613] [ 135.293613] dump_stack_lvl+0x57/0x7d [ 135.293613] __might_resched.cold+0x138/0x173 [ 135.293613] ? dev_coredumpm+0xca/0x2e0 [ 135.293613] kmem_cache_alloc_trace+0x189/0x1f0 [ 135.293613] ? devcd_match_failing+0x30/0x30 [ 135.293613] dev_coredumpm+0xca/0x2e0 [ 135.293613] ? devcd_freev+0x10/0x10 [ 135.293613] dev_coredumpv+0x1c/0x20 [ 135.293613] ? devcd_match_failing+0x30/0x30 [ 135.293613] mwifiex_upload_device_dump+0x65/0xb0 [ 135.293613] ? mwifiex_dnld_fw+0x1b0/0x1b0 [ 135.293613] call_timer_fn+0x122/0x3d0 [ 135.293613] ? msleep_interruptible+0xb0/0xb0 [ 135.293613] ? lock_downgrade+0x3c0/0x3c0 [ 135.293613] ? __next_timer_interrupt+0x13c/0x160 [ 135.293613] ? lockdep_hardirqs_on_prepare+0xe/0x220 [ 135.293613] ? mwifiex_dnld_fw+0x1b0/0x1b0 [ 135.293613] __run_timers.part.0+0x3f8/0x540 [ 135.293613] ? call_timer_fn+0x3d0/0x3d0 [ 135.293613] ? arch_restore_msi_irqs+0x10/0x10 [ 135.293613] ? lapic_next_event+0x31/0x40 [ 135.293613] run_timer_softirq+0x4f/0xb0 [ 135.293613] __do_softirq+0x1c2/0x651 ... [ 135.293613] RIP: 0010:default_idle+0xb/0x10 [ 135.293613] RSP: 0018:ffff888006317e68 EFLAGS: 00000246 [ 135.293613] RAX: ffffffff82ad8d10 RBX: ffff888006301cc0 RCX: ffffffff82a= c90e1 [ 135.293613] RDX: ffffed100d9ff1b4 RSI: ffffffff831ad140 RDI: ffffffff82a= d8f20 [ 135.293613] RBP: 0000000000000003 R08: 0000000000000000 R09: ffff88806cf= f8d9b [ 135.293613] R10: ffffed100d9ff1b3 R11: 0000000000000001 R12: ffffffff845= 93410 [ 135.293613] R13: 0000000000000000 R14: 0000000000000000 R15: 1ffff11000c= 62fd2 ... [ 135.389205] usb 1-1: =3D=3D mwifiex dump information to /sys/class/devco= redump end This patch uses delayed work to replace timer and moves the operations that may sleep into a delayed work in order to mitigate bugs, it was tested on Marvell 88W8801 chip whose port is usb and the firmware is usb8801_uapsta.bin. The following is the result after using delayed work to replace timer. [ 134.936453] usb 1-1: =3D=3D mwifiex dump information to /sys/class/devco= redump start [ 135.043344] usb 1-1: =3D=3D mwifiex dump information to /sys/class/devco= redump end As we can see, there is no bug now. Fixes: f5ecd02a8b20 ("mwifiex: device dump support for usb interface") Reviewed-by: Brian Norris Signed-off-by: Duoming Zhou Link: https://lore.kernel.org/r/b63b77fc84ed3e8a6bef02378e17c7c71a0bc3be.16= 54569290.git.duoming@zju.edu.cn Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/wireless/marvell/mwifiex/init.c | 9 +++++---- drivers/net/wireless/marvell/mwifiex/main.h | 3 ++- drivers/net/wireless/marvell/mwifiex/sta_event.c | 6 +++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/init.c b/drivers/net/wire= less/marvell/mwifiex/init.c index f006a3d72b40..e5bb240eb3ed 100644 --- a/drivers/net/wireless/marvell/mwifiex/init.c +++ b/drivers/net/wireless/marvell/mwifiex/init.c @@ -63,9 +63,10 @@ static void wakeup_timer_fn(struct timer_list *t) adapter->if_ops.card_reset(adapter); } =20 -static void fw_dump_timer_fn(struct timer_list *t) +static void fw_dump_work(struct work_struct *work) { - struct mwifiex_adapter *adapter =3D from_timer(adapter, t, devdump_timer); + struct mwifiex_adapter *adapter =3D + container_of(work, struct mwifiex_adapter, devdump_work.work); =20 mwifiex_upload_device_dump(adapter); } @@ -321,7 +322,7 @@ static void mwifiex_init_adapter(struct mwifiex_adapter= *adapter) adapter->active_scan_triggered =3D false; timer_setup(&adapter->wakeup_timer, wakeup_timer_fn, 0); adapter->devdump_len =3D 0; - timer_setup(&adapter->devdump_timer, fw_dump_timer_fn, 0); + INIT_DELAYED_WORK(&adapter->devdump_work, fw_dump_work); } =20 /* @@ -400,7 +401,7 @@ static void mwifiex_adapter_cleanup(struct mwifiex_adapter *adapter) { del_timer(&adapter->wakeup_timer); - del_timer_sync(&adapter->devdump_timer); + cancel_delayed_work_sync(&adapter->devdump_work); mwifiex_cancel_all_pending_cmd(adapter); wake_up_interruptible(&adapter->cmd_wait_q.wait); wake_up_interruptible(&adapter->hs_activate_wait_q); diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wire= less/marvell/mwifiex/main.h index f4e3dce10d65..3357cb7a5230 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -49,6 +49,7 @@ #include #include #include +#include =20 #include "decl.h" #include "ioctl.h" @@ -1053,7 +1054,7 @@ struct mwifiex_adapter { /* Device dump data/length */ void *devdump_data; int devdump_len; - struct timer_list devdump_timer; + struct delayed_work devdump_work; =20 bool ignore_btcoex_events; }; diff --git a/drivers/net/wireless/marvell/mwifiex/sta_event.c b/drivers/net= /wireless/marvell/mwifiex/sta_event.c index 7d42c5d2dbf6..4d93386494c5 100644 --- a/drivers/net/wireless/marvell/mwifiex/sta_event.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_event.c @@ -623,8 +623,8 @@ mwifiex_fw_dump_info_event(struct mwifiex_private *priv, * transmission event get lost, in this cornel case, * user would still get partial of the dump. */ - mod_timer(&adapter->devdump_timer, - jiffies + msecs_to_jiffies(MWIFIEX_TIMER_10S)); + schedule_delayed_work(&adapter->devdump_work, + msecs_to_jiffies(MWIFIEX_TIMER_10S)); } =20 /* Overflow check */ @@ -643,7 +643,7 @@ mwifiex_fw_dump_info_event(struct mwifiex_private *priv, return; =20 upload_dump: - del_timer_sync(&adapter->devdump_timer); + cancel_delayed_work_sync(&adapter->devdump_work); mwifiex_upload_device_dump(adapter); } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1F0EC3F6B0 for ; Mon, 15 Aug 2022 19:12:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239776AbiHOTMR (ORCPT ); Mon, 15 Aug 2022 15:12:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245713AbiHOTID (ORCPT ); Mon, 15 Aug 2022 15:08:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 851ED101EF; Mon, 15 Aug 2022 11:35:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B1B9360FFD; Mon, 15 Aug 2022 18:35:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB0A4C433C1; Mon, 15 Aug 2022 18:35:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588535; bh=F95PSIpBk6avvNgsm9Kq89di+aGOxNqnEsA06KSo27c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IVUlc8fl8YoVehIDzBW58z3wE2Xxj9NY3UkC/OyLFdP19xsTy8m7GMNx16HVkyB29 EPwulJz6jxqaSQ2eJInWcLx9EOhq93Wb9HVsmxKhBHZ351Zhy7eA+OZyOzBx6BAO7E s5JpnoisnOkUG5mDjurHSRxOkFAMPgj5k6vdA10Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nilesh Javali , Mike Christie , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.15 435/779] scsi: iscsi: Allow iscsi_if_stop_conn() to be called from kernel Date: Mon, 15 Aug 2022 20:01:19 +0200 Message-Id: <20220815180355.880296578@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mike Christie [ Upstream commit 3328333b47f4163504267440ec0a36087a407a5f ] iscsi_if_stop_conn() is only called from the userspace interface but in a subsequent commit we will want to call it from the kernel interface to allow drivers like qedi to remove sessions from inside the kernel during shutdown. This removes the iscsi_uevent code from iscsi_if_stop_conn() so we can call it in a new helper. Link: https://lore.kernel.org/r/20220616222738.5722-3-michael.christie@orac= le.com Tested-by: Nilesh Javali Reviewed-by: Nilesh Javali Signed-off-by: Mike Christie Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/scsi_transport_iscsi.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transp= ort_iscsi.c index 5947b9d5746e..671a03b80c30 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -2283,16 +2283,8 @@ static void iscsi_if_disconnect_bound_ep(struct iscs= i_cls_conn *conn, } } =20 -static int iscsi_if_stop_conn(struct iscsi_transport *transport, - struct iscsi_uevent *ev) +static int iscsi_if_stop_conn(struct iscsi_cls_conn *conn, int flag) { - int flag =3D ev->u.stop_conn.flag; - struct iscsi_cls_conn *conn; - - conn =3D iscsi_conn_lookup(ev->u.stop_conn.sid, ev->u.stop_conn.cid); - if (!conn) - return -EINVAL; - ISCSI_DBG_TRANS_CONN(conn, "iscsi if conn stop.\n"); /* * If this is a termination we have to call stop_conn with that flag @@ -3739,7 +3731,12 @@ static int iscsi_if_transport_conn(struct iscsi_tran= sport *transport, case ISCSI_UEVENT_DESTROY_CONN: return iscsi_if_destroy_conn(transport, ev); case ISCSI_UEVENT_STOP_CONN: - return iscsi_if_stop_conn(transport, ev); + conn =3D iscsi_conn_lookup(ev->u.stop_conn.sid, + ev->u.stop_conn.cid); + if (!conn) + return -EINVAL; + + return iscsi_if_stop_conn(conn, ev->u.stop_conn.flag); } =20 /* --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA49CC00140 for ; Mon, 15 Aug 2022 19:12:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245411AbiHOTMK (ORCPT ); Mon, 15 Aug 2022 15:12:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245709AbiHOTID (ORCPT ); Mon, 15 Aug 2022 15:08: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 8F55713F59; Mon, 15 Aug 2022 11:35:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3D4D8B8105D; Mon, 15 Aug 2022 18:35:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EB27C433D6; Mon, 15 Aug 2022 18:35:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588538; bh=pbYCv6RDEGne8eUViBB7ET6jX4ALDR2TU5wIWds9bLk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TgawMHvQfACAUno4lXbX7krSyeDpm/V9dbtS8kxk5EWkVTR2nX07Y/jrAPdzVyf3t QeqQCw2vi+ssSyPcalggOr/WKzs9s/W37lBhsFOjsD1J502wPP5QnLSEKCzibhfIN/ O61fcsYYERL/OpdmPX+KuO5PRQ0u57qesBD2wdQM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nilesh Javali , Mike Christie , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.15 436/779] scsi: iscsi: Add helper to remove a session from the kernel Date: Mon, 15 Aug 2022 20:01:20 +0200 Message-Id: <20220815180355.926740196@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mike Christie [ Upstream commit bb42856bfd54fda1cbc7c470fcf5db1596938f4f ] During qedi shutdown we need to stop the iSCSI layer from sending new nops as pings and from responding to target ones and make sure there is no running connection cleanups. Commit d1f2ce77638d ("scsi: qedi: Fix host removal with running sessions") converted the driver to use the libicsi helper to drive session removal, so the above issues could be handled. The problem is that during system shutdown iscsid will not be running so when we try to remove the root session we will hang waiting for userspace to reply. Add a helper that will drive the destruction of sessions like these during system shutdown. Link: https://lore.kernel.org/r/20220616222738.5722-5-michael.christie@orac= le.com Tested-by: Nilesh Javali Reviewed-by: Nilesh Javali Signed-off-by: Mike Christie Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/scsi_transport_iscsi.c | 49 +++++++++++++++++++++++++++++ include/scsi/scsi_transport_iscsi.h | 1 + 2 files changed, 50 insertions(+) diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transp= ort_iscsi.c index 671a03b80c30..f46ae5391758 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -2360,6 +2360,55 @@ static void iscsi_cleanup_conn_work_fn(struct work_s= truct *work) ISCSI_DBG_TRANS_CONN(conn, "cleanup done.\n"); } =20 +static int iscsi_iter_force_destroy_conn_fn(struct device *dev, void *data) +{ + struct iscsi_transport *transport; + struct iscsi_cls_conn *conn; + + if (!iscsi_is_conn_dev(dev)) + return 0; + + conn =3D iscsi_dev_to_conn(dev); + transport =3D conn->transport; + + if (READ_ONCE(conn->state) !=3D ISCSI_CONN_DOWN) + iscsi_if_stop_conn(conn, STOP_CONN_TERM); + + transport->destroy_conn(conn); + return 0; +} + +/** + * iscsi_force_destroy_session - destroy a session from the kernel + * @session: session to destroy + * + * Force the destruction of a session from the kernel. This should only be + * used when userspace is no longer running during system shutdown. + */ +void iscsi_force_destroy_session(struct iscsi_cls_session *session) +{ + struct iscsi_transport *transport =3D session->transport; + unsigned long flags; + + WARN_ON_ONCE(system_state =3D=3D SYSTEM_RUNNING); + + spin_lock_irqsave(&sesslock, flags); + if (list_empty(&session->sess_list)) { + spin_unlock_irqrestore(&sesslock, flags); + /* + * Conn/ep is already freed. Session is being torn down via + * async path. For shutdown we don't care about it so return. + */ + return; + } + spin_unlock_irqrestore(&sesslock, flags); + + device_for_each_child(&session->dev, NULL, + iscsi_iter_force_destroy_conn_fn); + transport->destroy_session(session); +} +EXPORT_SYMBOL_GPL(iscsi_force_destroy_session); + void iscsi_free_session(struct iscsi_cls_session *session) { ISCSI_DBG_TRANS_SESSION(session, "Freeing session\n"); diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transp= ort_iscsi.h index 3ecf9702287b..0f2f149ad916 100644 --- a/include/scsi/scsi_transport_iscsi.h +++ b/include/scsi/scsi_transport_iscsi.h @@ -441,6 +441,7 @@ extern struct iscsi_cls_session *iscsi_create_session(s= truct Scsi_Host *shost, struct iscsi_transport *t, int dd_size, unsigned int target_id); +extern void iscsi_force_destroy_session(struct iscsi_cls_session *session); extern void iscsi_remove_session(struct iscsi_cls_session *session); extern void iscsi_free_session(struct iscsi_cls_session *session); extern struct iscsi_cls_conn *iscsi_create_conn(struct iscsi_cls_session *= sess, --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44C51C25B08 for ; Mon, 15 Aug 2022 19:12:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343564AbiHOTM3 (ORCPT ); Mon, 15 Aug 2022 15:12:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343528AbiHOTIo (ORCPT ); Mon, 15 Aug 2022 15:08: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 E274927B04; Mon, 15 Aug 2022 11:35: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 7CF86B80F99; Mon, 15 Aug 2022 18:35:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 928F3C433D6; Mon, 15 Aug 2022 18:35:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588541; bh=wsvOfBT7zwazJEVPwXKfVdFmoSLEK5mtwrZNp4XqzgU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RM+J5ofAxnr1UzQ+ZHJW0WPQuqnT+yaYFK8bg4h8+9tkyOvqsgpJkxtNbAIRIzpvJ su5Jdr8mB1Rt2rVqQTvuIGn7dFIh7PjTdxqM+f8tONIWACBS96RWPGIUkLzfxJrCFV /mpapbBVe/wuhjaJ0yCbJ+EgLiS+n2joI+wHlSTM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nilesh Javali , Lee Duncan , Mike Christie , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.15 437/779] scsi: iscsi: Fix session removal on shutdown Date: Mon, 15 Aug 2022 20:01:21 +0200 Message-Id: <20220815180355.959434818@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mike Christie [ Upstream commit 31500e902759322ba3c64b60dabae2704e738df8 ] When the system is shutting down, iscsid is not running so we will not get a response to the ISCSI_ERR_INVALID_HOST error event. The system shutdown will then hang waiting on userspace to remove the session. This has libiscsi force the destruction of the session from the kernel when iscsi_host_remove() is called from a driver's shutdown callout. This fixes a regression added in qedi boot with commit d1f2ce77638d ("scsi: qedi: Fix host removal with running sessions") which made qedi use the common session removal function that waits on userspace instead of rolling its own kernel based removal. Link: https://lore.kernel.org/r/20220616222738.5722-7-michael.christie@orac= le.com Fixes: d1f2ce77638d ("scsi: qedi: Fix host removal with running sessions") Tested-by: Nilesh Javali Reviewed-by: Lee Duncan Reviewed-by: Nilesh Javali Signed-off-by: Mike Christie Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/infiniband/ulp/iser/iscsi_iser.c | 4 ++-- drivers/scsi/be2iscsi/be_main.c | 2 +- drivers/scsi/bnx2i/bnx2i_iscsi.c | 2 +- drivers/scsi/cxgbi/libcxgbi.c | 2 +- drivers/scsi/iscsi_tcp.c | 4 ++-- drivers/scsi/libiscsi.c | 9 +++++++-- drivers/scsi/qedi/qedi_main.c | 9 ++++++--- include/scsi/libiscsi.h | 2 +- 8 files changed, 21 insertions(+), 13 deletions(-) diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/= ulp/iser/iscsi_iser.c index 776e46ee95da..ef2d165d15a8 100644 --- a/drivers/infiniband/ulp/iser/iscsi_iser.c +++ b/drivers/infiniband/ulp/iser/iscsi_iser.c @@ -584,7 +584,7 @@ iscsi_iser_session_destroy(struct iscsi_cls_session *cl= s_session) struct Scsi_Host *shost =3D iscsi_session_to_shost(cls_session); =20 iscsi_session_teardown(cls_session); - iscsi_host_remove(shost); + iscsi_host_remove(shost, false); iscsi_host_free(shost); } =20 @@ -702,7 +702,7 @@ iscsi_iser_session_create(struct iscsi_endpoint *ep, return cls_session; =20 remove_host: - iscsi_host_remove(shost); + iscsi_host_remove(shost, false); free_host: iscsi_host_free(shost); return NULL; diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_mai= n.c index e70f69f791db..7974c1326d46 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c @@ -5741,7 +5741,7 @@ static void beiscsi_remove(struct pci_dev *pcidev) cancel_work_sync(&phba->sess_work); =20 beiscsi_iface_destroy_default(phba); - iscsi_host_remove(phba->shost); + iscsi_host_remove(phba->shost, false); beiscsi_disable_port(phba, 1); =20 /* after cancelling boot_work */ diff --git a/drivers/scsi/bnx2i/bnx2i_iscsi.c b/drivers/scsi/bnx2i/bnx2i_is= csi.c index 2e5241d12dc3..85b5aca4b497 100644 --- a/drivers/scsi/bnx2i/bnx2i_iscsi.c +++ b/drivers/scsi/bnx2i/bnx2i_iscsi.c @@ -909,7 +909,7 @@ void bnx2i_free_hba(struct bnx2i_hba *hba) { struct Scsi_Host *shost =3D hba->shost; =20 - iscsi_host_remove(shost); + iscsi_host_remove(shost, false); INIT_LIST_HEAD(&hba->ep_ofld_list); INIT_LIST_HEAD(&hba->ep_active_list); INIT_LIST_HEAD(&hba->ep_destroy_list); diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c index 4365d52c6430..32abdf0fa9aa 100644 --- a/drivers/scsi/cxgbi/libcxgbi.c +++ b/drivers/scsi/cxgbi/libcxgbi.c @@ -328,7 +328,7 @@ void cxgbi_hbas_remove(struct cxgbi_device *cdev) chba =3D cdev->hbas[i]; if (chba) { cdev->hbas[i] =3D NULL; - iscsi_host_remove(chba->shost); + iscsi_host_remove(chba->shost, false); pci_dev_put(cdev->pdev); iscsi_host_free(chba->shost); } diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 1bc37593c88f..0e52c6499eaf 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -898,7 +898,7 @@ iscsi_sw_tcp_session_create(struct iscsi_endpoint *ep, = uint16_t cmds_max, remove_session: iscsi_session_teardown(cls_session); remove_host: - iscsi_host_remove(shost); + iscsi_host_remove(shost, false); free_host: iscsi_host_free(shost); return NULL; @@ -915,7 +915,7 @@ static void iscsi_sw_tcp_session_destroy(struct iscsi_c= ls_session *cls_session) iscsi_tcp_r2tpool_free(cls_session->dd_data); iscsi_session_teardown(cls_session); =20 - iscsi_host_remove(shost); + iscsi_host_remove(shost, false); iscsi_host_free(shost); } =20 diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index 0f2c7098f9d6..78de36250b31 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c @@ -2830,11 +2830,12 @@ static void iscsi_notify_host_removed(struct iscsi_= cls_session *cls_session) /** * iscsi_host_remove - remove host and sessions * @shost: scsi host + * @is_shutdown: true if called from a driver shutdown callout * * If there are any sessions left, this will initiate the removal and wait * for the completion. */ -void iscsi_host_remove(struct Scsi_Host *shost) +void iscsi_host_remove(struct Scsi_Host *shost, bool is_shutdown) { struct iscsi_host *ihost =3D shost_priv(shost); unsigned long flags; @@ -2843,7 +2844,11 @@ void iscsi_host_remove(struct Scsi_Host *shost) ihost->state =3D ISCSI_HOST_REMOVED; spin_unlock_irqrestore(&ihost->lock, flags); =20 - iscsi_host_for_each_session(shost, iscsi_notify_host_removed); + if (!is_shutdown) + iscsi_host_for_each_session(shost, iscsi_notify_host_removed); + else + iscsi_host_for_each_session(shost, iscsi_force_destroy_session); + wait_event_interruptible(ihost->session_removal_wq, ihost->num_sessions =3D=3D 0); if (signal_pending(current)) diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c index e6dc0b495a82..a117d11f2b07 100644 --- a/drivers/scsi/qedi/qedi_main.c +++ b/drivers/scsi/qedi/qedi_main.c @@ -2417,9 +2417,12 @@ static void __qedi_remove(struct pci_dev *pdev, int = mode) int rval; u16 retry =3D 10; =20 - if (mode =3D=3D QEDI_MODE_NORMAL || mode =3D=3D QEDI_MODE_SHUTDOWN) { - iscsi_host_remove(qedi->shost); + if (mode =3D=3D QEDI_MODE_NORMAL) + iscsi_host_remove(qedi->shost, false); + else if (mode =3D=3D QEDI_MODE_SHUTDOWN) + iscsi_host_remove(qedi->shost, true); =20 + if (mode =3D=3D QEDI_MODE_NORMAL || mode =3D=3D QEDI_MODE_SHUTDOWN) { if (qedi->tmf_thread) { flush_workqueue(qedi->tmf_thread); destroy_workqueue(qedi->tmf_thread); @@ -2796,7 +2799,7 @@ static int __qedi_probe(struct pci_dev *pdev, int mod= e) #ifdef CONFIG_DEBUG_FS qedi_dbg_host_exit(&qedi->dbg_ctx); #endif - iscsi_host_remove(qedi->shost); + iscsi_host_remove(qedi->shost, false); stop_iscsi_func: qedi_ops->stop(qedi->cdev); stop_slowpath: diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 6ad01d7de480..a071f6ffd7fa 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h @@ -400,7 +400,7 @@ extern int iscsi_host_add(struct Scsi_Host *shost, stru= ct device *pdev); extern struct Scsi_Host *iscsi_host_alloc(struct scsi_host_template *sht, int dd_data_size, bool xmit_can_sleep); -extern void iscsi_host_remove(struct Scsi_Host *shost); +extern void iscsi_host_remove(struct Scsi_Host *shost, bool is_shutdown); extern void iscsi_host_free(struct Scsi_Host *shost); extern int iscsi_target_alloc(struct scsi_target *starget); extern int iscsi_host_get_max_scsi_cmds(struct Scsi_Host *shost, --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9BB2C25B0E for ; Mon, 15 Aug 2022 19:12:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343533AbiHOTMT (ORCPT ); Mon, 15 Aug 2022 15:12:19 -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 S1343526AbiHOTIo (ORCPT ); Mon, 15 Aug 2022 15:08:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D65A32CE1E; Mon, 15 Aug 2022 11:35:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 845C7B8106E; Mon, 15 Aug 2022 18:35:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CB7C1C433D6; Mon, 15 Aug 2022 18:35:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588544; bh=qRTREeEHk8pjX8nfKjCM7hmtg0ZqboyJcs0/DE6qmb8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=deL8kb7H5xHkTTg+sHd48nbAvRdyO3py3OkpC17e3uimaIgigdivsxNJWIqAkYeEX stMCiF5IrIAqwBD39sCqaAbRf72rpYtAB50Zyip6d4swBxfwoyJ3y6508GMF+y1Xx5 aWaIHVLiLGI5I/fzVmV64XQotQsMGg+yfKpDoFLo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manivannan Sadhasivam , Serge Semin , Frank Li , Bjorn Helgaas , Vinod Koul , Sasha Levin Subject: [PATCH 5.15 438/779] dmaengine: dw-edma: Fix eDMA Rd/Wr-channels and DMA-direction semantics Date: Mon, 15 Aug 2022 20:01:22 +0200 Message-Id: <20220815180355.998630436@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Serge Semin [ Upstream commit c1e33979171da63cf47e56243ccb8ba82363c7d3 ] In accordance with [1, 2] the DW eDMA controller has been created to be part of the DW PCIe Root Port and DW PCIe End-point controllers and to offload the transferring of large blocks of data between application and remote PCIe domains leaving the system CPU free for other tasks. In the first case (eDMA being part of DW PCIe Root Port) the eDMA controller is always accessible via the CPU DBI interface and never over the PCIe wire. The latter case is more complex. Depending on the DW PCIe End-Point IP-core synthesize parameters it's possible to have the eDMA registers accessible not only from the application CPU side, but also via mapping the eDMA CSRs over a dedicated endpoint BAR. So based on the specifics denoted above the eDMA driver is supposed to support two types of the DMA controller setups: 1) eDMA embedded into the DW PCIe Root Port/End-point and accessible over the local CPU from the application side. 2) eDMA embedded into the DW PCIe End-point and accessible via the PCIe wire with MWr/MRd TLPs generated by the CPU PCIe host controller. Since the CPU memory resides different sides in these cases the semantics of the MEM_TO_DEV and DEV_TO_MEM operations is flipped with respect to the Tx and Rx DMA channels. So MEM_TO_DEV/DEV_TO_MEM corresponds to the Tx/Rx channels in setup 1) and to the Rx/Tx channels in case of setup 2). The DW eDMA driver has supported the case 2) since e63d79d1ffcd ("dmaengine: Add Synopsys eDMA IP core driver") in the framework of the drivers/dma/dw-edma/dw-edma-pcie.c driver. The case 1) support was added later by bd96f1b2f43a ("dmaengine: dw-edma: support local dma device transfer semantics"). Afterwards the driver was supposed to cover the both possible eDMA setups, but the latter commit turned out to be not fully correct. The problem was that the commit together with the new functionality support also changed the channel direction semantics so the eDMA Read-channel (corresponding to the DMA_DEV_TO_MEM direction for case 1) now uses the sgl/cyclic base addresses as the Source addresses of the DMA transfers and dma_slave_config.dst_addr as the Destination address of the DMA transfers. Similarly the eDMA Write-channel (corresponding to the DMA_MEM_TO_DEV direction for case 1) now uses dma_slave_config.src_addr as a source address of the DMA transfers and sgl/cyclic base address as the Destination address of the DMA transfers. This contradicts the logic of the DMA-interface, which implies that DEV side is supposed to belong to the PCIe device memory and MEM - to the CPU/Application memory. Indeed it seems irrational to have the SG-list defined in the PCIe bus space, while expecting a contiguous buffer allocated in the CPU memory. Moreover the passed SG-list and cyclic DMA buffers are supposed to be mapped in a way so to be seen by the DW eDMA Application (CPU) interface. So in order to have the correct DW eDMA interface we need to invert the eDMA Rd/Wr-channels and DMA-slave directions semantics by selecting the src/dst addresses based on the DMA transfer direction instead of using the channel direction capability. [1] DesignWare Cores PCI Express Controller Databook - DWC PCIe Root Port, v.5.40a, March 2019, p.1092 [2] DesignWare Cores PCI Express Controller Databook - DWC PCIe Endpoint, v.5.40a, March 2019, p.1189 Co-developed-by: Manivannan Sadhasivam Fixes: bd96f1b2f43a ("dmaengine: dw-edma: support local dma device transfer= semantics") Link: https://lore.kernel.org/r/20220524152159.2370739-7-Frank.Li@nxp.com Tested-by: Manivannan Sadhasivam Signed-off-by: Manivannan Sadhasivam Signed-off-by: Serge Semin Signed-off-by: Frank Li Signed-off-by: Bjorn Helgaas Acked-By: Vinod Koul Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/dma/dw-edma/dw-edma-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/dw-edma/dw-edma-core.c b/drivers/dma/dw-edma/dw-ed= ma-core.c index 53289927dd0d..36b3fe1b6b0f 100644 --- a/drivers/dma/dw-edma/dw-edma-core.c +++ b/drivers/dma/dw-edma/dw-edma-core.c @@ -424,7 +424,7 @@ dw_edma_device_transfer(struct dw_edma_transfer *xfer) chunk->ll_region.sz +=3D burst->sz; desc->alloc_sz +=3D burst->sz; =20 - if (chan->dir =3D=3D EDMA_DIR_WRITE) { + if (dir =3D=3D DMA_DEV_TO_MEM) { burst->sar =3D src_addr; if (xfer->type =3D=3D EDMA_XFER_CYCLIC) { burst->dar =3D xfer->xfer.cyclic.paddr; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8B82C25B08 for ; Mon, 15 Aug 2022 19:12:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343646AbiHOTMf (ORCPT ); Mon, 15 Aug 2022 15:12:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343561AbiHOTIw (ORCPT ); Mon, 15 Aug 2022 15:08:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C36D39BBF; Mon, 15 Aug 2022 11:35: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 8883CB8105C; Mon, 15 Aug 2022 18:35:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D24E6C433C1; Mon, 15 Aug 2022 18:35:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588547; bh=oN4SatVjTHyC2dGIr0dnQaeRRTBhraK/hcKFR13JZp0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZvUcyCd8nUKOSkQzLZSlsgYzXikv9/oXgiHHAAMo5c+FmV3/BPoahrzmQv9tH0vvu v0HPERDQmDHhKLq/KY3NW+fCRafTSn7yZ5GMb3zcBoxxCAkqdRUUmIWxyuhFem1mtQ yI0kpy0Q/xwFF0JYArWwsGtXQ2PsqirkjYvjlY/M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Brown , Miquel Raynal , Sasha Levin Subject: [PATCH 5.15 439/779] mtd: dataflash: Add SPI ID table Date: Mon, 15 Aug 2022 20:01:23 +0200 Message-Id: <20220815180356.039213941@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 ac4f83482afbfd927d0fe118151b747cf175e724 ] Currently autoloading for SPI devices does not use the DT ID table, it uses SPI modalises. Supporting OF modalises is going to be difficult if not impractical, an attempt was made but has been reverted, so ensure that module autoloading works for this driver by adding an id_table listing the SPI IDs for everything. Fixes: 96c8395e2166 ("spi: Revert modalias changes") Signed-off-by: Mark Brown Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20220620152313.708768-1-broonie@ker= nel.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/mtd/devices/mtd_dataflash.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_= dataflash.c index 2b317ed6c103..9c714c982c6e 100644 --- a/drivers/mtd/devices/mtd_dataflash.c +++ b/drivers/mtd/devices/mtd_dataflash.c @@ -112,6 +112,13 @@ static const struct of_device_id dataflash_dt_ids[] = =3D { MODULE_DEVICE_TABLE(of, dataflash_dt_ids); #endif =20 +static const struct spi_device_id dataflash_spi_ids[] =3D { + { .name =3D "at45", }, + { .name =3D "dataflash", }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(spi, dataflash_spi_ids); + /* .......................................................................= .. */ =20 /* @@ -938,6 +945,7 @@ static struct spi_driver dataflash_driver =3D { =20 .probe =3D dataflash_probe, .remove =3D dataflash_remove, + .id_table =3D dataflash_spi_ids, =20 /* FIXME: investigate suspend and resume... */ }; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29798C25B0E for ; Mon, 15 Aug 2022 19:12:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343674AbiHOTMn (ORCPT ); Mon, 15 Aug 2022 15:12:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343566AbiHOTIx (ORCPT ); Mon, 15 Aug 2022 15:08:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 224DF3A48B; Mon, 15 Aug 2022 11:35: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 B24AD61019; Mon, 15 Aug 2022 18:35:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9897C433D6; Mon, 15 Aug 2022 18:35:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588550; bh=UOH6REFJS8cP2N9uoUPHkUleTOhh+U4QEU+B7D5bc6k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RkyV/sWJBq+vPHoF7tJ+w0a3ll7Vx3kBE7IwBztFmXUA0uztoy0O+4Re6wrUBEvN1 cdpVjkk+NbcXQgNzJl8NC9xQIj7nmmop8SSOEd5s0xOxM70eb7lnJKt5ivPoyCowwO Bp5lSWBSbs/LLlTFMccWa9QlN68EvD1pOAwnwFLE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Zapolskiy , Bryan ODonoghue , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 440/779] clk: qcom: camcc-sm8250: Fix halt on boot by reducing drivers init level Date: Mon, 15 Aug 2022 20:01:24 +0200 Message-Id: <20220815180356.077869635@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Zapolskiy [ Upstream commit c4f40351901a10cd662ac2c081396d8fb04f584d ] Access to I/O of SM8250 camera clock controller IP depends on enabled GCC_CAMERA_AHB_CLK clock supplied by global clock controller, the latter one is inited on subsys level, so, to satisfy the dependency, it would make sense to deprive the init level of camcc-sm8250 driver. If both drivers are compiled as built-in, there is a change that a board won't boot up due to a race, which happens on the same init level. Fixes: 5d66ca79b58c ("clk: qcom: Add camera clock controller driver for SM8= 250") Signed-off-by: Vladimir Zapolskiy Reviewed-by: Bryan O'Donoghue Tested-by: Bryan O'Donoghue Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220518103554.949511-1-vladimir.zapolskiy@= linaro.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/clk/qcom/camcc-sm8250.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/clk/qcom/camcc-sm8250.c b/drivers/clk/qcom/camcc-sm825= 0.c index 439eaafdcc86..ae4e9774f36e 100644 --- a/drivers/clk/qcom/camcc-sm8250.c +++ b/drivers/clk/qcom/camcc-sm8250.c @@ -2440,17 +2440,7 @@ static struct platform_driver cam_cc_sm8250_driver = =3D { }, }; =20 -static int __init cam_cc_sm8250_init(void) -{ - return platform_driver_register(&cam_cc_sm8250_driver); -} -subsys_initcall(cam_cc_sm8250_init); - -static void __exit cam_cc_sm8250_exit(void) -{ - platform_driver_unregister(&cam_cc_sm8250_driver); -} -module_exit(cam_cc_sm8250_exit); +module_platform_driver(cam_cc_sm8250_driver); =20 MODULE_DESCRIPTION("QTI CAMCC SM8250 Driver"); MODULE_LICENSE("GPL v2"); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3ADE3C00140 for ; Mon, 15 Aug 2022 19:12:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343747AbiHOTMw (ORCPT ); Mon, 15 Aug 2022 15:12:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240959AbiHOTI7 (ORCPT ); Mon, 15 Aug 2022 15:08:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC18C6443; Mon, 15 Aug 2022 11:35: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 88F3961024; Mon, 15 Aug 2022 18:35:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92EDAC433D6; Mon, 15 Aug 2022 18:35:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588552; bh=BxLSowCUd+gDlvDoIK2xP9edGBiTg8HchpI/r7K7JdA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FWrSeIKm1DRs8AQfMPDZFylEMsohmwA/LY7ySUj/qaHtUNyg4FgeU0IPsSkYEP5bF +7WoxbP56Fqoby85OK740ehx1Ftu1gIVLbMBSNV9jKiZrVK7YGZKs5+8Ddi9d6Zqyl VzvdLHmbTx+TDqTryH0d336pQD7RNqq7Unayl6es= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Sasha Levin Subject: [PATCH 5.15 441/779] misc: rtsx: Fix an error handling path in rtsx_pci_probe() Date: Mon, 15 Aug 2022 20:01:25 +0200 Message-Id: <20220815180356.115558709@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET [ Upstream commit 44fd1917314e9d4f53dd95dd65df1c152f503d3a ] If an error occurs after a successful idr_alloc() call, the corresponding resource must be released with idr_remove() as already done in the .remove function. Update the error handling path to add the missing idr_remove() call. Fixes: ada8a8a13b13 ("mfd: Add realtek pcie card reader driver") Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/e8dc41716cbf52fb37a12e70d8972848e69df6d6.16= 55271216.git.christophe.jaillet@wanadoo.fr Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/misc/cardreader/rtsx_pcr.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/misc/cardreader/rtsx_pcr.c b/drivers/misc/cardreader/r= tsx_pcr.c index 5121edb0d9ef..62fdbbd55e74 100644 --- a/drivers/misc/cardreader/rtsx_pcr.c +++ b/drivers/misc/cardreader/rtsx_pcr.c @@ -1581,7 +1581,7 @@ static int rtsx_pci_probe(struct pci_dev *pcidev, pcr->remap_addr =3D ioremap(base, len); if (!pcr->remap_addr) { ret =3D -ENOMEM; - goto free_handle; + goto free_idr; } =20 pcr->rtsx_resv_buf =3D dma_alloc_coherent(&(pcidev->dev), @@ -1651,6 +1651,10 @@ static int rtsx_pci_probe(struct pci_dev *pcidev, pcr->rtsx_resv_buf, pcr->rtsx_resv_buf_addr); unmap: iounmap(pcr->remap_addr); +free_idr: + spin_lock(&rtsx_pci_lock); + idr_remove(&rtsx_pci_idr, pcr->id); + spin_unlock(&rtsx_pci_lock); free_handle: kfree(handle); free_pcr: --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABBBFC00140 for ; Mon, 15 Aug 2022 19:13:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343810AbiHOTNH (ORCPT ); Mon, 15 Aug 2022 15:13:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343642AbiHOTJd (ORCPT ); Mon, 15 Aug 2022 15:09: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 A9D553AB39; Mon, 15 Aug 2022 11:36: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 38FB3B8105C; Mon, 15 Aug 2022 18:36:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 997B5C433C1; Mon, 15 Aug 2022 18:35:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588559; bh=kwLftpPksccLdgPVi4mk+ncE1FaBf/9Mc/y7vIkfBOM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0rOVNpY/jlnPnxwpVPcawREXafvmfQqTDQd/OMoRx6bBfJgqHgUWQyOmzx3hSb5Ti fNw9XDyjsnFLOwcTgBOj4HAwz+sEr51/6wkcbez6hKo3gUMrAq22M9mM9hgxeRQLmQ sbhtdHhNA3HPnm0r0Ep5YErsafYFcXORe2ra7AZI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Wensheng , Sasha Levin Subject: [PATCH 5.15 442/779] driver core: fix potential deadlock in __driver_attach Date: Mon, 15 Aug 2022 20:01:26 +0200 Message-Id: <20220815180356.162883318@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhang Wensheng [ Upstream commit 70fe758352cafdee72a7b13bf9db065f9613ced8 ] In __driver_attach function, There are also AA deadlock problem, like the commit b232b02bf3c2 ("driver core: fix deadlock in __device_attach"). stack like commit b232b02bf3c2 ("driver core: fix deadlock in __device_attach"). list below: In __driver_attach function, The lock holding logic is as follows: ... __driver_attach if (driver_allows_async_probing(drv)) device_lock(dev) // get lock dev async_schedule_dev(__driver_attach_async_helper, dev); // func async_schedule_node async_schedule_node_domain(func) entry =3D kzalloc(sizeof(struct async_entry), GFP_ATOMIC); /* when fail or work limit, sync to execute func, but __driver_attach_async_helper will get lock dev as will, which will lead to A-A deadlock. */ if (!entry || atomic_read(&entry_count) > MAX_WORK) { func; else queue_work_node(node, system_unbound_wq, &entry->work) device_unlock(dev) As above show, when it is allowed to do async probes, because of out of memory or work limit, async work is not be allowed, to do sync execute instead. it will lead to A-A deadlock because of __driver_attach_async_helper getting lock dev. Reproduce: and it can be reproduce by make the condition (if (!entry || atomic_read(&entry_count) > MAX_WORK)) untenable, like below: [ 370.785650] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. [ 370.787154] task:swapper/0 state:D stack: 0 pid: 1 ppid: 0 flags:0x00004000 [ 370.788865] Call Trace: [ 370.789374] [ 370.789841] __schedule+0x482/0x1050 [ 370.790613] schedule+0x92/0x1a0 [ 370.791290] schedule_preempt_disabled+0x2c/0x50 [ 370.792256] __mutex_lock.isra.0+0x757/0xec0 [ 370.793158] __mutex_lock_slowpath+0x1f/0x30 [ 370.794079] mutex_lock+0x50/0x60 [ 370.794795] __device_driver_lock+0x2f/0x70 [ 370.795677] ? driver_probe_device+0xd0/0xd0 [ 370.796576] __driver_attach_async_helper+0x1d/0xd0 [ 370.797318] ? driver_probe_device+0xd0/0xd0 [ 370.797957] async_schedule_node_domain+0xa5/0xc0 [ 370.798652] async_schedule_node+0x19/0x30 [ 370.799243] __driver_attach+0x246/0x290 [ 370.799828] ? driver_allows_async_probing+0xa0/0xa0 [ 370.800548] bus_for_each_dev+0x9d/0x130 [ 370.801132] driver_attach+0x22/0x30 [ 370.801666] bus_add_driver+0x290/0x340 [ 370.802246] driver_register+0x88/0x140 [ 370.802817] ? virtio_scsi_init+0x116/0x116 [ 370.803425] scsi_register_driver+0x1a/0x30 [ 370.804057] init_sd+0x184/0x226 [ 370.804533] do_one_initcall+0x71/0x3a0 [ 370.805107] kernel_init_freeable+0x39a/0x43a [ 370.805759] ? rest_init+0x150/0x150 [ 370.806283] kernel_init+0x26/0x230 [ 370.806799] ret_from_fork+0x1f/0x30 To fix the deadlock, move the async_schedule_dev outside device_lock, as we can see, in async_schedule_node_domain, the parameter of queue_work_node is system_unbound_wq, so it can accept concurrent operations. which will also not change the code logic, and will not lead to deadlock. Fixes: ef0ff68351be ("driver core: Probe devices asynchronously instead of = the driver") Signed-off-by: Zhang Wensheng Link: https://lore.kernel.org/r/20220622074327.497102-1-zhangwensheng5@huaw= ei.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/base/dd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 76ded601d0c1..70e9ee8a10f7 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c @@ -1094,6 +1094,7 @@ static void __driver_attach_async_helper(void *_dev, = async_cookie_t cookie) static int __driver_attach(struct device *dev, void *data) { struct device_driver *drv =3D data; + bool async =3D false; int ret; =20 /* @@ -1132,9 +1133,11 @@ static int __driver_attach(struct device *dev, void = *data) if (!dev->driver) { get_device(dev); dev->p->async_driver =3D drv; - async_schedule_dev(__driver_attach_async_helper, dev); + async =3D true; } device_unlock(dev); + if (async) + async_schedule_dev(__driver_attach_async_helper, dev); return 0; } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A76AC00140 for ; Mon, 15 Aug 2022 19:13:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343836AbiHOTNL (ORCPT ); Mon, 15 Aug 2022 15:13:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343641AbiHOTJd (ORCPT ); Mon, 15 Aug 2022 15:09:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 653F62B189; Mon, 15 Aug 2022 11:36: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 00CB661019; Mon, 15 Aug 2022 18:36:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 775B0C433D6; Mon, 15 Aug 2022 18:36:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588562; bh=8yMkKzhaIIy3DNw9qsKXKinY89NRF/Ka1TXvMtoYgLo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xvsLAWMSXZsnkROXT9v7EjLUDEFv4tVXziIdsN8G4mLlzfXju93ihoRn6f/rEWM58 PkrB+jjRigIPmi9gRzK47A6YAz/PhSXs0O1QI/k1MktV/K3b+/TDG2gaH47MbJNf0k A9frfXdE9HEiEEdhIHUafTYCg6WChk9BgoJDzr/I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ansuel Smith , Dmitry Baryshkov , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 443/779] clk: qcom: clk-krait: unlock spin after mux completion Date: Mon, 15 Aug 2022 20:01:27 +0200 Message-Id: <20220815180356.203257575@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ansuel Smith [ Upstream commit df83d2c9e72910416f650ade1e07cc314ff02731 ] Unlock spinlock after the mux switch is completed to prevent any corner case of mux request while the switch still needs to be done. Fixes: 4d7dc77babfe ("clk: qcom: Add support for Krait clocks") Signed-off-by: Ansuel Smith Reviewed-by: Dmitry Baryshkov Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220430054458.31321-3-ansuelsmth@gmail.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/clk/qcom/clk-krait.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/clk/qcom/clk-krait.c b/drivers/clk/qcom/clk-krait.c index 59f1af415b58..90046428693c 100644 --- a/drivers/clk/qcom/clk-krait.c +++ b/drivers/clk/qcom/clk-krait.c @@ -32,11 +32,16 @@ static void __krait_mux_set_sel(struct krait_mux_clk *m= ux, int sel) regval |=3D (sel & mux->mask) << (mux->shift + LPL_SHIFT); } krait_set_l2_indirect_reg(mux->offset, regval); - spin_unlock_irqrestore(&krait_clock_reg_lock, flags); =20 /* Wait for switch to complete. */ mb(); udelay(1); + + /* + * Unlock now to make sure the mux register is not + * modified while switching to the new parent. + */ + spin_unlock_irqrestore(&krait_clock_reg_lock, flags); } =20 static int krait_mux_set_parent(struct clk_hw *hw, u8 index) --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A708C25B0E for ; Mon, 15 Aug 2022 19:13:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343795AbiHOTNA (ORCPT ); Mon, 15 Aug 2022 15:13:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343647AbiHOTJe (ORCPT ); Mon, 15 Aug 2022 15:09: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 5AD1B3AE43; Mon, 15 Aug 2022 11:36: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 EA3E261024; Mon, 15 Aug 2022 18:36:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF8F9C433C1; Mon, 15 Aug 2022 18:36:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588565; bh=wtp6p6RMN1MZpTJuYtBu272z3ieJ8QwXzu/VzXe3Qcw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=udD5nvO1FSDPcLLgHJTCKNHIgVzu4CU/yuTW5hy3tNb/It8XgMxfcqmleaS8Rc8rW pCKJ2f9HO7ocizvGYpox2LOHhMukpB4dnwrQPruYS7LdtOI+LyEO9uPDNbdPlQVkjr 13OiVduCg6tE9RCXJ+cx9blGXBcXpm6RHCrNYXrc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rob Herring , Krzysztof Kozlowski , devicetree@vger.kernel.org, Bryan ODonoghue , Krzysztof Kozlowski , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 444/779] clk: qcom: gcc-msm8939: Add missing SYSTEM_MM_NOC_BFDCD_CLK_SRC Date: Mon, 15 Aug 2022 20:01:28 +0200 Message-Id: <20220815180356.249628154@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bryan O'Donoghue [ Upstream commit 07e7fcf1714c5f9930ad27613fea940aedba68da ] When adding in the indexes for this clock-controller we missed SYSTEM_MM_NOC_BFDCD_CLK_SRC. Add it in now. Fixes: 4c71d6abc4fc ("clk: qcom: Add DT bindings for MSM8939 GCC") Cc: Rob Herring Cc: Krzysztof Kozlowski Cc: devicetree@vger.kernel.org Signed-off-by: Bryan O'Donoghue Acked-by: Krzysztof Kozlowski Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220504163835.40130-2-bryan.odonoghue@lina= ro.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- include/dt-bindings/clock/qcom,gcc-msm8939.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/dt-bindings/clock/qcom,gcc-msm8939.h b/include/dt-bind= ings/clock/qcom,gcc-msm8939.h index 0634467c4ce5..2d545ed0d35a 100644 --- a/include/dt-bindings/clock/qcom,gcc-msm8939.h +++ b/include/dt-bindings/clock/qcom,gcc-msm8939.h @@ -192,6 +192,7 @@ #define GCC_VENUS0_CORE0_VCODEC0_CLK 183 #define GCC_VENUS0_CORE1_VCODEC0_CLK 184 #define GCC_OXILI_TIMER_CLK 185 +#define SYSTEM_MM_NOC_BFDCD_CLK_SRC 186 =20 /* Indexes for GDSCs */ #define BIMC_GDSC 0 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96802C00140 for ; Mon, 15 Aug 2022 19:13:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343848AbiHOTNQ (ORCPT ); Mon, 15 Aug 2022 15:13:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343653AbiHOTJg (ORCPT ); Mon, 15 Aug 2022 15:09:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E0CA2AE6; Mon, 15 Aug 2022 11:36:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CD1BC60FB8; Mon, 15 Aug 2022 18:36:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8E29C433D6; Mon, 15 Aug 2022 18:36:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588569; bh=LReIQ89/CnA3hqpuGEtuig0bfblqLBYyZyH7Eeo99iI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UbvuNJsF2AuDcM0yb4vj/+LicC6Jt5DaC/yIHKtSCsnDHPQbS0QYKUtyWg3t/fvMw xFijbbIZYJUT3IukWNtQHF8OUXlZqHEtk8uV2n7VK+TPEzLBEIJ1Ndq5zUf+7juj/7 NoqhpahkKeiEbeNdLRSqMWMEtTquTgAX2ESZz7pU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bryan ODonoghue , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 445/779] clk: qcom: gcc-msm8939: Fix bimc_ddr_clk_src rcgr base address Date: Mon, 15 Aug 2022 20:01:29 +0200 Message-Id: <20220815180356.293797225@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bryan O'Donoghue [ Upstream commit 63d42708320d6d2ca9ed505123d50ff4a542c36f ] Reviewing qcom docs for the 8939 we can see the command rcgr is pointing to the wrong address. bimc_ddr_clk_src_rcgr is @ 0x01832024 not 0x01832004. Fixes: 1664014e4679 ("clk: qcom: gcc-msm8939: Add MSM8939 Generic Clock Con= troller") Signed-off-by: Bryan O'Donoghue Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220504163835.40130-3-bryan.odonoghue@lina= ro.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/clk/qcom/gcc-msm8939.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/qcom/gcc-msm8939.c b/drivers/clk/qcom/gcc-msm8939.c index 39ebb443ae3d..31568658d23d 100644 --- a/drivers/clk/qcom/gcc-msm8939.c +++ b/drivers/clk/qcom/gcc-msm8939.c @@ -632,7 +632,7 @@ static struct clk_rcg2 system_noc_bfdcd_clk_src =3D { }; =20 static struct clk_rcg2 bimc_ddr_clk_src =3D { - .cmd_rcgr =3D 0x32004, + .cmd_rcgr =3D 0x32024, .hid_width =3D 5, .parent_map =3D gcc_xo_gpll0_bimc_map, .clkr.hw.init =3D &(struct clk_init_data){ --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69D97C25B08 for ; Mon, 15 Aug 2022 19:13:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343857AbiHOTNT (ORCPT ); Mon, 15 Aug 2022 15:13:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343656AbiHOTJs (ORCPT ); Mon, 15 Aug 2022 15:09:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C07FE18358; Mon, 15 Aug 2022 11:36: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 85485B8105C; Mon, 15 Aug 2022 18:36:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3011C433C1; Mon, 15 Aug 2022 18:36:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588572; bh=/EF4z/uxQCTHAXnRvEbMiDLRJBQ1km36r9FTaXO2r6g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jhjOeEHMCBEo7v/3+xz/btrQjlzfQRC6IGVPhxQ++1yOOFRF7M8UigstjJ5ZJ9RkJ Y+NnogTfWeWZUkOcaHFO0x4dWC62VB8VV0Z5Q/lEkJ6JgFrzjt5mOt3onYm0oUDW62 T4R0QxrySX7SGrDZcLrr+DIGwfjtDSqVUvkyrMlI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bryan ODonoghue , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 446/779] clk: qcom: gcc-msm8939: Add missing system_mm_noc_bfdcd_clk_src Date: Mon, 15 Aug 2022 20:01:30 +0200 Message-Id: <20220815180356.333258001@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bryan O'Donoghue [ Upstream commit dd363e2f7196278e7a30f509a0e8a841cb763b14 ] The msm8939 has an additional higher operating point for the multi-media peripherals. The higher throughput MM componets operate off of the system-mm noc not the system noc. system_mm_noc_bfdcd_clk_src is the source clock for the higher frequency capable system noc mm. Maximum frequency for the MM SNOC is 400 MHz. Fixes: 1664014e4679 ("clk: qcom: gcc-msm8939: Add MSM8939 Generic Clock Con= troller") Signed-off-by: Bryan O'Donoghue Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220504163835.40130-4-bryan.odonoghue@lina= ro.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/clk/qcom/gcc-msm8939.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/clk/qcom/gcc-msm8939.c b/drivers/clk/qcom/gcc-msm8939.c index 31568658d23d..12bab9067ea8 100644 --- a/drivers/clk/qcom/gcc-msm8939.c +++ b/drivers/clk/qcom/gcc-msm8939.c @@ -644,6 +644,18 @@ static struct clk_rcg2 bimc_ddr_clk_src =3D { }, }; =20 +static struct clk_rcg2 system_mm_noc_bfdcd_clk_src =3D { + .cmd_rcgr =3D 0x2600c, + .hid_width =3D 5, + .parent_map =3D gcc_xo_gpll0_gpll6a_map, + .clkr.hw.init =3D &(struct clk_init_data){ + .name =3D "system_mm_noc_bfdcd_clk_src", + .parent_data =3D gcc_xo_gpll0_gpll6a_parent_data, + .num_parents =3D 3, + .ops =3D &clk_rcg2_ops, + }, +}; + static const struct freq_tbl ftbl_gcc_camss_ahb_clk[] =3D { F(40000000, P_GPLL0, 10, 1, 2), F(80000000, P_GPLL0, 10, 0, 0), @@ -3623,6 +3635,7 @@ static struct clk_regmap *gcc_msm8939_clocks[] =3D { [GPLL2_VOTE] =3D &gpll2_vote, [PCNOC_BFDCD_CLK_SRC] =3D &pcnoc_bfdcd_clk_src.clkr, [SYSTEM_NOC_BFDCD_CLK_SRC] =3D &system_noc_bfdcd_clk_src.clkr, + [SYSTEM_MM_NOC_BFDCD_CLK_SRC] =3D &system_mm_noc_bfdcd_clk_src.clkr, [CAMSS_AHB_CLK_SRC] =3D &camss_ahb_clk_src.clkr, [APSS_AHB_CLK_SRC] =3D &apss_ahb_clk_src.clkr, [CSI0_CLK_SRC] =3D &csi0_clk_src.clkr, --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 615B3C00140 for ; Mon, 15 Aug 2022 19:13:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343884AbiHOTN1 (ORCPT ); Mon, 15 Aug 2022 15:13:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245705AbiHOTJw (ORCPT ); Mon, 15 Aug 2022 15:09:52 -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 E55DF2D1C6; Mon, 15 Aug 2022 11:36: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 9CBAFB80F99; Mon, 15 Aug 2022 18:36:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE04BC433C1; Mon, 15 Aug 2022 18:36:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588575; bh=z2ppMhTPiC/F2H1GoH0DGMhpTjqq0uo0VJ7PpbIH8zo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cXy/SueMBG9/LI8Gexhl7oFL9RGvvLqRC21j1cZuIM32YcCStv/e/54x3q4nfKgEt OLVYl0nCFNyScpDp8Rq+Haks0wgZzIveIRw/9Ef4zdC01X05pZsAlUdoTzNePR/TC/ cK3MbgBBUJXF+fzsp3Dez9mTVmWGwhBSTkXfjjK4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bryan ODonoghue , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 447/779] clk: qcom: gcc-msm8939: Point MM peripherals to system_mm_noc clock Date: Mon, 15 Aug 2022 20:01:31 +0200 Message-Id: <20220815180356.384075666@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bryan O'Donoghue [ Upstream commit 05eed0990927aa9634682fec58660e30f7b7ae30 ] Qcom docs indciate the following peripherals operating from System NOC MM not from System NOC clocks. - MDP - VFE - JPEGe - Venus Switch over the relevant parent pointers. Fixes: 1664014e4679 ("clk: qcom: gcc-msm8939: Add MSM8939 Generic Clock Con= troller") Signed-off-by: Bryan O'Donoghue Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220504163835.40130-5-bryan.odonoghue@lina= ro.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/clk/qcom/gcc-msm8939.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/clk/qcom/gcc-msm8939.c b/drivers/clk/qcom/gcc-msm8939.c index 12bab9067ea8..c7377ec0f423 100644 --- a/drivers/clk/qcom/gcc-msm8939.c +++ b/drivers/clk/qcom/gcc-msm8939.c @@ -2453,7 +2453,7 @@ static struct clk_branch gcc_camss_jpeg_axi_clk =3D { .hw.init =3D &(struct clk_init_data){ .name =3D "gcc_camss_jpeg_axi_clk", .parent_data =3D &(const struct clk_parent_data){ - .hw =3D &system_noc_bfdcd_clk_src.clkr.hw, + .hw =3D &system_mm_noc_bfdcd_clk_src.clkr.hw, }, .num_parents =3D 1, .flags =3D CLK_SET_RATE_PARENT, @@ -2657,7 +2657,7 @@ static struct clk_branch gcc_camss_vfe_axi_clk =3D { .hw.init =3D &(struct clk_init_data){ .name =3D "gcc_camss_vfe_axi_clk", .parent_data =3D &(const struct clk_parent_data){ - .hw =3D &system_noc_bfdcd_clk_src.clkr.hw, + .hw =3D &system_mm_noc_bfdcd_clk_src.clkr.hw, }, .num_parents =3D 1, .flags =3D CLK_SET_RATE_PARENT, @@ -2813,7 +2813,7 @@ static struct clk_branch gcc_mdss_axi_clk =3D { .hw.init =3D &(struct clk_init_data){ .name =3D "gcc_mdss_axi_clk", .parent_data =3D &(const struct clk_parent_data){ - .hw =3D &system_noc_bfdcd_clk_src.clkr.hw, + .hw =3D &system_mm_noc_bfdcd_clk_src.clkr.hw, }, .num_parents =3D 1, .flags =3D CLK_SET_RATE_PARENT, @@ -3205,7 +3205,7 @@ static struct clk_branch gcc_mdp_tbu_clk =3D { .hw.init =3D &(struct clk_init_data){ .name =3D "gcc_mdp_tbu_clk", .parent_data =3D &(const struct clk_parent_data){ - .hw =3D &system_noc_bfdcd_clk_src.clkr.hw, + .hw =3D &system_mm_noc_bfdcd_clk_src.clkr.hw, }, .num_parents =3D 1, .flags =3D CLK_SET_RATE_PARENT, @@ -3223,7 +3223,7 @@ static struct clk_branch gcc_venus_tbu_clk =3D { .hw.init =3D &(struct clk_init_data){ .name =3D "gcc_venus_tbu_clk", .parent_data =3D &(const struct clk_parent_data){ - .hw =3D &system_noc_bfdcd_clk_src.clkr.hw, + .hw =3D &system_mm_noc_bfdcd_clk_src.clkr.hw, }, .num_parents =3D 1, .flags =3D CLK_SET_RATE_PARENT, @@ -3241,7 +3241,7 @@ static struct clk_branch gcc_vfe_tbu_clk =3D { .hw.init =3D &(struct clk_init_data){ .name =3D "gcc_vfe_tbu_clk", .parent_data =3D &(const struct clk_parent_data){ - .hw =3D &system_noc_bfdcd_clk_src.clkr.hw, + .hw =3D &system_mm_noc_bfdcd_clk_src.clkr.hw, }, .num_parents =3D 1, .flags =3D CLK_SET_RATE_PARENT, @@ -3259,7 +3259,7 @@ static struct clk_branch gcc_jpeg_tbu_clk =3D { .hw.init =3D &(struct clk_init_data){ .name =3D "gcc_jpeg_tbu_clk", .parent_data =3D &(const struct clk_parent_data){ - .hw =3D &system_noc_bfdcd_clk_src.clkr.hw, + .hw =3D &system_mm_noc_bfdcd_clk_src.clkr.hw, }, .num_parents =3D 1, .flags =3D CLK_SET_RATE_PARENT, @@ -3496,7 +3496,7 @@ static struct clk_branch gcc_venus0_axi_clk =3D { .hw.init =3D &(struct clk_init_data){ .name =3D "gcc_venus0_axi_clk", .parent_data =3D &(const struct clk_parent_data){ - .hw =3D &system_noc_bfdcd_clk_src.clkr.hw, + .hw =3D &system_mm_noc_bfdcd_clk_src.clkr.hw, }, .num_parents =3D 1, .flags =3D CLK_SET_RATE_PARENT, --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90C9CC25B08 for ; Mon, 15 Aug 2022 19:13:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343879AbiHOTNW (ORCPT ); Mon, 15 Aug 2022 15:13:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343667AbiHOTJx (ORCPT ); Mon, 15 Aug 2022 15:09:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2832E2B194; Mon, 15 Aug 2022 11:36:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D69F3B8105D; Mon, 15 Aug 2022 18:36:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 133EFC433C1; Mon, 15 Aug 2022 18:36:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588578; bh=VRjsAXF3WC4tJ6gSQwHyFOt8YAAM7NKxdLNNLzkDUzQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U3S4xFfFVE2yonKGTEx7alKfWrgoaSJA9HT229xX/O1/az09MyTj8s2kcqDdBUkJe TDLk4BigsPsrLtSTJoCf2LFG2RpowZ04Rjesg+0DyLxNFf2IkLhuwVYiaD3TQ1omA2 oFNfhinyD4VJeorISxzCjw3tDM097i2Tzyqyg8Hg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Shtylyov , Mathias Nyman , Sasha Levin Subject: [PATCH 5.15 448/779] usb: host: xhci: use snprintf() in xhci_decode_trb() Date: Mon, 15 Aug 2022 20:01:32 +0200 Message-Id: <20220815180356.429769912@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sergey Shtylyov [ Upstream commit 1ce69c35b86038dd11d3a6115a04501c5b89a940 ] Commit cbf286e8ef83 ("xhci: fix unsafe memory usage in xhci tracing") apparently missed one sprintf() call in xhci_decode_trb() -- replace it with the snprintf() call as well... Found by Linux Verification Center (linuxtesting.org) with the SVACE static analysis tool. Fixes: cbf286e8ef83 ("xhci: fix unsafe memory usage in xhci tracing") Signed-off-by: Sergey Shtylyov Signed-off-by: Mathias Nyman Link: https://lore.kernel.org/r/20220630124645.1805902-2-mathias.nyman@linu= x.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/usb/host/xhci.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 79fa34f1e31c..101f1956a96c 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -2395,7 +2395,7 @@ static inline const char *xhci_decode_trb(char *str, = size_t size, field3 & TRB_CYCLE ? 'C' : 'c'); break; case TRB_STOP_RING: - sprintf(str, + snprintf(str, size, "%s: slot %d sp %d ep %d flags %c", xhci_trb_type_string(type), TRB_TO_SLOT_ID(field3), --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC6A4C00140 for ; Mon, 15 Aug 2022 19:13:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343904AbiHOTNh (ORCPT ); Mon, 15 Aug 2022 15:13:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241407AbiHOTJ4 (ORCPT ); Mon, 15 Aug 2022 15:09:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C900EE1C; Mon, 15 Aug 2022 11:36: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 C540DB8105D; Mon, 15 Aug 2022 18:36:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2711FC433C1; Mon, 15 Aug 2022 18:36:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588581; bh=9x+bpN8wLnOjkwbTRQPKw8W/hBE2mJhuV0IMW/PEOQI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AS8tG0p3jli8Tw7jmRQPqUWPQAhxly1Eb3TzZsafisIEqeqs3yVntgBqLE71l4d45 BcQl5fdqoNclYMso2PcIrJNzQwpfFT4BqUun6p3X3Y2tcGKvvUokExFnlDwxORfPqF HaRByIgh2aM9wZNBtqUCX8nu2sdxi4D6pnt3Z9zE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jenny Hack , Bob Pearson , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.15 449/779] RDMA/rxe: Fix deadlock in rxe_do_local_ops() Date: Mon, 15 Aug 2022 20:01:33 +0200 Message-Id: <20220815180356.477304299@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bob Pearson [ Upstream commit 7cb33d1bc1ac8e51fd88928f96674d392f8e07c4 ] When a local operation (invalidate mr, reg mr, bind mw) is finished there will be no ack packet coming from a responder to cause the wqe to be completed. This may happen anyway if a subsequent wqe performs IO. Currently if the wqe is signalled the completer tasklet is scheduled immediately but not otherwise. This leads to a deadlock if the next wqe has the fence bit set in send flags and the operation is not signalled. This patch removes the condition that the wqe must be signalled in order to schedule the completer tasklet which is the simplest fix for this deadlock and is fairly low cost. This is the analog for local operations of always setting the ackreq bit in all last or only request packets even if the operation is not signalled. Link: https://lore.kernel.org/r/20220523223251.15350-1-rpearsonhpe@gmail.com Reported-by: Jenny Hack Fixes: c1a411268a4b ("RDMA/rxe: Move local ops to subroutine") Signed-off-by: Bob Pearson Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/infiniband/sw/rxe/rxe_req.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rx= e/rxe_req.c index 7812e3d6a6c2..4ea9319f0d52 100644 --- a/drivers/infiniband/sw/rxe/rxe_req.c +++ b/drivers/infiniband/sw/rxe/rxe_req.c @@ -612,9 +612,11 @@ static int rxe_do_local_ops(struct rxe_qp *qp, struct = rxe_send_wqe *wqe) wqe->status =3D IB_WC_SUCCESS; qp->req.wqe_index =3D next_index(qp->sq.queue, qp->req.wqe_index); =20 - if ((wqe->wr.send_flags & IB_SEND_SIGNALED) || - qp->sq_sig_type =3D=3D IB_SIGNAL_ALL_WR) - rxe_run_task(&qp->comp.task, 1); + /* There is no ack coming for local work requests + * which can lead to a deadlock. So go ahead and complete + * it now. + */ + rxe_run_task(&qp->comp.task, 1); =20 return 0; } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1EBB3C00140 for ; Mon, 15 Aug 2022 19:13:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239753AbiHOTNc (ORCPT ); Mon, 15 Aug 2022 15:13:32 -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 S1343675AbiHOTJ5 (ORCPT ); Mon, 15 Aug 2022 15:09:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2107D2CDD6; Mon, 15 Aug 2022 11:36: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 CCC23B8105D; Mon, 15 Aug 2022 18:36:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3726AC433C1; Mon, 15 Aug 2022 18:36:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588584; bh=EIFqnLnUM23Nz1J6+mXn0fbS1tnry5gPG/oOFxiGxUU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e1/yCgLhmWutZu19siYp4F544lJrMUP/yrjZMS9ZFXl7tETGcXlujBlpIaz8f0Hga NHRpCwpcE8h6HpXc4bdbmtYZNvt13G5kO05OGWNOgU9tJURcEttqSG8C6pyq4QJhJS Hfmkk+rib9IN79F2v/6Jb6o7skBeRrYVKN6GNx+g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Marko , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 450/779] clk: qcom: ipq8074: fix NSS core PLL-s Date: Mon, 15 Aug 2022 20:01:34 +0200 Message-Id: <20220815180356.507479205@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Robert Marko [ Upstream commit ca41ec1b30434636c56c5600b24a8d964d359d9c ] Like in IPQ6018 the NSS related Alpha PLL-s require initial configuration to work. So, obtain the regmap that is required for the Alpha PLL configuration and thus utilize the qcom_cc_really_probe() as we already have the regmap. Then utilize the Alpha PLL configs from the downstream QCA 5.4 based kernel to configure them. This fixes the UBI32 and NSS crypto PLL-s failing to get enabled by the kernel. Fixes: b8e7e519625f ("clk: qcom: ipq8074: add remaining PLL=E2=80=99s") Signed-off-by: Robert Marko Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220515210048.483898-1-robimarko@gmail.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/clk/qcom/gcc-ipq8074.c | 39 +++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/drivers/clk/qcom/gcc-ipq8074.c b/drivers/clk/qcom/gcc-ipq8074.c index 541016db3c4b..1a5141da7e23 100644 --- a/drivers/clk/qcom/gcc-ipq8074.c +++ b/drivers/clk/qcom/gcc-ipq8074.c @@ -4371,6 +4371,33 @@ static struct clk_branch gcc_pcie0_axi_s_bridge_clk = =3D { }, }; =20 +static const struct alpha_pll_config ubi32_pll_config =3D { + .l =3D 0x4e, + .config_ctl_val =3D 0x200d4aa8, + .config_ctl_hi_val =3D 0x3c2, + .main_output_mask =3D BIT(0), + .aux_output_mask =3D BIT(1), + .pre_div_val =3D 0x0, + .pre_div_mask =3D BIT(12), + .post_div_val =3D 0x0, + .post_div_mask =3D GENMASK(9, 8), +}; + +static const struct alpha_pll_config nss_crypto_pll_config =3D { + .l =3D 0x3e, + .alpha =3D 0x0, + .alpha_hi =3D 0x80, + .config_ctl_val =3D 0x4001055b, + .main_output_mask =3D BIT(0), + .pre_div_val =3D 0x0, + .pre_div_mask =3D GENMASK(14, 12), + .post_div_val =3D 0x1 << 8, + .post_div_mask =3D GENMASK(11, 8), + .vco_mask =3D GENMASK(21, 20), + .vco_val =3D 0x0, + .alpha_en_mask =3D BIT(24), +}; + static struct clk_hw *gcc_ipq8074_hws[] =3D { &gpll0_out_main_div2.hw, &gpll6_out_main_div2.hw, @@ -4772,7 +4799,17 @@ static const struct qcom_cc_desc gcc_ipq8074_desc = =3D { =20 static int gcc_ipq8074_probe(struct platform_device *pdev) { - return qcom_cc_probe(pdev, &gcc_ipq8074_desc); + struct regmap *regmap; + + regmap =3D qcom_cc_map(pdev, &gcc_ipq8074_desc); + if (IS_ERR(regmap)) + return PTR_ERR(regmap); + + clk_alpha_pll_configure(&ubi32_pll_main, regmap, &ubi32_pll_config); + clk_alpha_pll_configure(&nss_crypto_pll_main, regmap, + &nss_crypto_pll_config); + + return qcom_cc_really_probe(pdev, &gcc_ipq8074_desc, regmap); } =20 static struct platform_driver gcc_ipq8074_driver =3D { --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 869E0C00140 for ; Mon, 15 Aug 2022 19:13:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343921AbiHOTNk (ORCPT ); Mon, 15 Aug 2022 15:13:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343695AbiHOTKO (ORCPT ); Mon, 15 Aug 2022 15:10:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A296B2D1C8; Mon, 15 Aug 2022 11:36:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3EE3960FB8; Mon, 15 Aug 2022 18:36:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47EFFC433D6; Mon, 15 Aug 2022 18:36:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588587; bh=Sl8pAt6Q0dhidSZAmwSvNFkkV5IgZon/SaDP+uWCIr0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n/p9KiYjA2mTR37XWRlF3GObNNJ8fTQ8rRQMo+v8xF/Po//H96Sae4HEMZydrO7il gj1lwT9MpHmOanrYd2MUeE9WU+odIt/D/NQKOZtc6bKPtY94Mrc8ZC2xzUINBtn3NA vYr7jCEAkTDSMdWYaFo1ymo9crl7U0syRKd4JRmY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Marko , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 451/779] clk: qcom: ipq8074: SW workaround for UBI32 PLL lock Date: Mon, 15 Aug 2022 20:01:35 +0200 Message-Id: <20220815180356.556661797@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Robert Marko [ Upstream commit 3401ea2856ef84f39b75f0dc5ebcaeda81cb90ec ] UBI32 Huayra PLL fails to lock in 5 us in some SoC silicon and thus it will cause the wait_for_pll() to timeout and thus return the error indicating that the PLL failed to lock. This is bug in Huayra PLL HW for which SW workaround is to set bit 26 of TEST_CTL register. This is ported from the QCA 5.4 based downstream kernel. Fixes: b8e7e519625f ("clk: qcom: ipq8074: add remaining PLL=E2=80=99s") Signed-off-by: Robert Marko Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220515210048.483898-2-robimarko@gmail.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/clk/qcom/gcc-ipq8074.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/clk/qcom/gcc-ipq8074.c b/drivers/clk/qcom/gcc-ipq8074.c index 1a5141da7e23..b4291ba53c78 100644 --- a/drivers/clk/qcom/gcc-ipq8074.c +++ b/drivers/clk/qcom/gcc-ipq8074.c @@ -4805,6 +4805,9 @@ static int gcc_ipq8074_probe(struct platform_device *= pdev) if (IS_ERR(regmap)) return PTR_ERR(regmap); =20 + /* SW Workaround for UBI32 Huayra PLL */ + regmap_update_bits(regmap, 0x2501c, BIT(26), BIT(26)); + clk_alpha_pll_configure(&ubi32_pll_main, regmap, &ubi32_pll_config); clk_alpha_pll_configure(&nss_crypto_pll_main, regmap, &nss_crypto_pll_config); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 664BCC00140 for ; Mon, 15 Aug 2022 19:13:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343615AbiHOTNv (ORCPT ); Mon, 15 Aug 2022 15:13:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343709AbiHOTK2 (ORCPT ); Mon, 15 Aug 2022 15:10:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05E522D1D8; Mon, 15 Aug 2022 11:36: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 98A9D60FB8; Mon, 15 Aug 2022 18:36:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84CD1C433C1; Mon, 15 Aug 2022 18:36:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588594; bh=exXlSyE6+QPcILp+nxmGivamKTdZ39q0PQQr8Zupu9E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jE4UzM3JyTGJ504jj4TbUoIhNPw6u59odD6woCLwfGIUhHHGKRq0E7kEBjXXEN8wu lszX1F3fGUV0+jg213OK5XAToL6kwrEUtvUbSAQ8FP6o/DVXdcfosyGj5cwt4a0Ru2 XPb1j415DnhCdA9g/u70eygLHwBgpdl9aT3Mw8S0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Marko , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 452/779] clk: qcom: ipq8074: fix NSS port frequency tables Date: Mon, 15 Aug 2022 20:01:36 +0200 Message-Id: <20220815180356.604886648@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Robert Marko [ Upstream commit 0e9e61a2815b5cd34f1b495b2d72e8127ce9b794 ] NSS port 5 and 6 frequency tables are currently broken and are causing a wide ranges of issue like 1G not working at all on port 6 or port 5 being clocked with 312 instead of 125 MHz as UNIPHY1 gets selected. So, update the frequency tables with the ones from the downstream QCA 5.4 based kernel which has already fixed this. Fixes: 7117a51ed303 ("clk: qcom: ipq8074: add NSS ethernet port clocks") Signed-off-by: Robert Marko Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220515210048.483898-3-robimarko@gmail.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/clk/qcom/gcc-ipq8074.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/clk/qcom/gcc-ipq8074.c b/drivers/clk/qcom/gcc-ipq8074.c index b4291ba53c78..f1017f2e61bd 100644 --- a/drivers/clk/qcom/gcc-ipq8074.c +++ b/drivers/clk/qcom/gcc-ipq8074.c @@ -1788,8 +1788,10 @@ static struct clk_regmap_div nss_port4_tx_div_clk_sr= c =3D { static const struct freq_tbl ftbl_nss_port5_rx_clk_src[] =3D { F(19200000, P_XO, 1, 0, 0), F(25000000, P_UNIPHY1_RX, 12.5, 0, 0), + F(25000000, P_UNIPHY0_RX, 5, 0, 0), F(78125000, P_UNIPHY1_RX, 4, 0, 0), F(125000000, P_UNIPHY1_RX, 2.5, 0, 0), + F(125000000, P_UNIPHY0_RX, 1, 0, 0), F(156250000, P_UNIPHY1_RX, 2, 0, 0), F(312500000, P_UNIPHY1_RX, 1, 0, 0), { } @@ -1828,8 +1830,10 @@ static struct clk_regmap_div nss_port5_rx_div_clk_sr= c =3D { static const struct freq_tbl ftbl_nss_port5_tx_clk_src[] =3D { F(19200000, P_XO, 1, 0, 0), F(25000000, P_UNIPHY1_TX, 12.5, 0, 0), + F(25000000, P_UNIPHY0_TX, 5, 0, 0), F(78125000, P_UNIPHY1_TX, 4, 0, 0), F(125000000, P_UNIPHY1_TX, 2.5, 0, 0), + F(125000000, P_UNIPHY0_TX, 1, 0, 0), F(156250000, P_UNIPHY1_TX, 2, 0, 0), F(312500000, P_UNIPHY1_TX, 1, 0, 0), { } @@ -1867,8 +1871,10 @@ static struct clk_regmap_div nss_port5_tx_div_clk_sr= c =3D { =20 static const struct freq_tbl ftbl_nss_port6_rx_clk_src[] =3D { F(19200000, P_XO, 1, 0, 0), + F(25000000, P_UNIPHY2_RX, 5, 0, 0), F(25000000, P_UNIPHY2_RX, 12.5, 0, 0), F(78125000, P_UNIPHY2_RX, 4, 0, 0), + F(125000000, P_UNIPHY2_RX, 1, 0, 0), F(125000000, P_UNIPHY2_RX, 2.5, 0, 0), F(156250000, P_UNIPHY2_RX, 2, 0, 0), F(312500000, P_UNIPHY2_RX, 1, 0, 0), @@ -1907,8 +1913,10 @@ static struct clk_regmap_div nss_port6_rx_div_clk_sr= c =3D { =20 static const struct freq_tbl ftbl_nss_port6_tx_clk_src[] =3D { F(19200000, P_XO, 1, 0, 0), + F(25000000, P_UNIPHY2_TX, 5, 0, 0), F(25000000, P_UNIPHY2_TX, 12.5, 0, 0), F(78125000, P_UNIPHY2_TX, 4, 0, 0), + F(125000000, P_UNIPHY2_TX, 1, 0, 0), F(125000000, P_UNIPHY2_TX, 2.5, 0, 0), F(156250000, P_UNIPHY2_TX, 2, 0, 0), F(312500000, P_UNIPHY2_TX, 1, 0, 0), --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9CA0C25B0E for ; Mon, 15 Aug 2022 19:13:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343597AbiHOTN5 (ORCPT ); Mon, 15 Aug 2022 15:13:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343752AbiHOTKz (ORCPT ); Mon, 15 Aug 2022 15:10:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CA323AE69; Mon, 15 Aug 2022 11:36: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 C7F4D61024; Mon, 15 Aug 2022 18:36:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AAF77C433D7; Mon, 15 Aug 2022 18:36:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588597; bh=SBzQteFzmwAx5cbaMvhguyziPkBKT50j+fZw3n8Q/0I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RjMQpC5lWLzWRJr5nbrUXPy1R99xVDO0CjFyRbjFLaC5pWTv7Lb544GZVgUVHRj3B bx6vS4U3T36KUInWWJxJgVcsV6UdUpuagvV+C7vLfJl7iX7jIE1c6B2/Du0us8azMH Q5eH98Fy9NXTx8TKovTw0uaHgjZA3bpIE9Id5rTs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Marko , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 453/779] clk: qcom: ipq8074: set BRANCH_HALT_DELAY flag for UBI clocks Date: Mon, 15 Aug 2022 20:01:37 +0200 Message-Id: <20220815180356.644761729@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Robert Marko [ Upstream commit 2bd357e698207e2e65db03007e4be65bf9d6a7b3 ] Currently, attempting to enable the UBI clocks will cause the stuck at off warning to be printed and clk_enable will fail. [ 14.936694] gcc_ubi1_ahb_clk status stuck at 'off' Downstream 5.4 QCA kernel has fixed this by seting the BRANCH_HALT_DELAY flag on UBI clocks, so lets do the same. Fixes: 5736294aef83 ("clk: qcom: ipq8074: add NSS clocks") Signed-off-by: Robert Marko Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220515210048.483898-6-robimarko@gmail.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/clk/qcom/gcc-ipq8074.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/clk/qcom/gcc-ipq8074.c b/drivers/clk/qcom/gcc-ipq8074.c index f1017f2e61bd..2c2ecfc5e61f 100644 --- a/drivers/clk/qcom/gcc-ipq8074.c +++ b/drivers/clk/qcom/gcc-ipq8074.c @@ -3354,6 +3354,7 @@ static struct clk_branch gcc_nssnoc_ubi1_ahb_clk =3D { =20 static struct clk_branch gcc_ubi0_ahb_clk =3D { .halt_reg =3D 0x6820c, + .halt_check =3D BRANCH_HALT_DELAY, .clkr =3D { .enable_reg =3D 0x6820c, .enable_mask =3D BIT(0), @@ -3371,6 +3372,7 @@ static struct clk_branch gcc_ubi0_ahb_clk =3D { =20 static struct clk_branch gcc_ubi0_axi_clk =3D { .halt_reg =3D 0x68200, + .halt_check =3D BRANCH_HALT_DELAY, .clkr =3D { .enable_reg =3D 0x68200, .enable_mask =3D BIT(0), @@ -3388,6 +3390,7 @@ static struct clk_branch gcc_ubi0_axi_clk =3D { =20 static struct clk_branch gcc_ubi0_nc_axi_clk =3D { .halt_reg =3D 0x68204, + .halt_check =3D BRANCH_HALT_DELAY, .clkr =3D { .enable_reg =3D 0x68204, .enable_mask =3D BIT(0), @@ -3405,6 +3408,7 @@ static struct clk_branch gcc_ubi0_nc_axi_clk =3D { =20 static struct clk_branch gcc_ubi0_core_clk =3D { .halt_reg =3D 0x68210, + .halt_check =3D BRANCH_HALT_DELAY, .clkr =3D { .enable_reg =3D 0x68210, .enable_mask =3D BIT(0), @@ -3422,6 +3426,7 @@ static struct clk_branch gcc_ubi0_core_clk =3D { =20 static struct clk_branch gcc_ubi0_mpt_clk =3D { .halt_reg =3D 0x68208, + .halt_check =3D BRANCH_HALT_DELAY, .clkr =3D { .enable_reg =3D 0x68208, .enable_mask =3D BIT(0), @@ -3439,6 +3444,7 @@ static struct clk_branch gcc_ubi0_mpt_clk =3D { =20 static struct clk_branch gcc_ubi1_ahb_clk =3D { .halt_reg =3D 0x6822c, + .halt_check =3D BRANCH_HALT_DELAY, .clkr =3D { .enable_reg =3D 0x6822c, .enable_mask =3D BIT(0), @@ -3456,6 +3462,7 @@ static struct clk_branch gcc_ubi1_ahb_clk =3D { =20 static struct clk_branch gcc_ubi1_axi_clk =3D { .halt_reg =3D 0x68220, + .halt_check =3D BRANCH_HALT_DELAY, .clkr =3D { .enable_reg =3D 0x68220, .enable_mask =3D BIT(0), @@ -3473,6 +3480,7 @@ static struct clk_branch gcc_ubi1_axi_clk =3D { =20 static struct clk_branch gcc_ubi1_nc_axi_clk =3D { .halt_reg =3D 0x68224, + .halt_check =3D BRANCH_HALT_DELAY, .clkr =3D { .enable_reg =3D 0x68224, .enable_mask =3D BIT(0), @@ -3490,6 +3498,7 @@ static struct clk_branch gcc_ubi1_nc_axi_clk =3D { =20 static struct clk_branch gcc_ubi1_core_clk =3D { .halt_reg =3D 0x68230, + .halt_check =3D BRANCH_HALT_DELAY, .clkr =3D { .enable_reg =3D 0x68230, .enable_mask =3D BIT(0), @@ -3507,6 +3516,7 @@ static struct clk_branch gcc_ubi1_core_clk =3D { =20 static struct clk_branch gcc_ubi1_mpt_clk =3D { .halt_reg =3D 0x68228, + .halt_check =3D BRANCH_HALT_DELAY, .clkr =3D { .enable_reg =3D 0x68228, .enable_mask =3D BIT(0), --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76314C00140 for ; Mon, 15 Aug 2022 19:14:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343968AbiHOTOD (ORCPT ); Mon, 15 Aug 2022 15:14:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56520 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343758AbiHOTKz (ORCPT ); Mon, 15 Aug 2022 15:10:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6098D3AE6D; Mon, 15 Aug 2022 11:36: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 F03E261024; Mon, 15 Aug 2022 18:36:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9C14C433D6; Mon, 15 Aug 2022 18:36:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588600; bh=eR0tZIvRvaH/L5ucyop9lSP+vc7zcIFE4nTjR/Nsrr4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q+UU1v5WoKpOJ58l1MyGDUCi1GYwKDjIKP4b8IvIREru9x5Em4zH+Ji354WCpt7nf yMyqCAyaayEEkNI320qhZu9NlxXPgOEu/kj1P5vso+ofcBxyxUcKpggMJB7AaOgB57 CnM9sqEjn2Xb52s7DNhPZbsNNdLKT6wEYPpESjkw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Zapolskiy , Robert Foss , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 454/779] clk: qcom: camcc-sdm845: Fix topology around titan_top power domain Date: Mon, 15 Aug 2022 20:01:38 +0200 Message-Id: <20220815180356.688792751@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Zapolskiy [ Upstream commit 103dd2338bbff567bce7acd00fc5a09c806b38ec ] On SDM845 two found VFE GDSC power domains shall not be operated, if titan top is turned off, thus the former power domains will be set as subdomains by a GDSC registration routine. Fixes: 78412c262004 ("clk: qcom: Add camera clock controller driver for SDM= 845") Signed-off-by: Vladimir Zapolskiy Reviewed-by: Robert Foss Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220519214133.1728979-2-vladimir.zapolskiy= @linaro.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/clk/qcom/camcc-sdm845.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/clk/qcom/camcc-sdm845.c b/drivers/clk/qcom/camcc-sdm84= 5.c index 1b2cefef7431..a8a2cfa83290 100644 --- a/drivers/clk/qcom/camcc-sdm845.c +++ b/drivers/clk/qcom/camcc-sdm845.c @@ -1521,6 +1521,8 @@ static struct clk_branch cam_cc_sys_tmr_clk =3D { }, }; =20 +static struct gdsc titan_top_gdsc; + static struct gdsc bps_gdsc =3D { .gdscr =3D 0x6004, .pd =3D { @@ -1554,6 +1556,7 @@ static struct gdsc ife_0_gdsc =3D { .name =3D "ife_0_gdsc", }, .flags =3D POLL_CFG_GDSCR, + .parent =3D &titan_top_gdsc.pd, .pwrsts =3D PWRSTS_OFF_ON, }; =20 @@ -1563,6 +1566,7 @@ static struct gdsc ife_1_gdsc =3D { .name =3D "ife_1_gdsc", }, .flags =3D POLL_CFG_GDSCR, + .parent =3D &titan_top_gdsc.pd, .pwrsts =3D PWRSTS_OFF_ON, }; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 291E7C00140 for ; Mon, 15 Aug 2022 19:21:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244544AbiHOTUd (ORCPT ); Mon, 15 Aug 2022 15:20:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344764AbiHOTR0 (ORCPT ); Mon, 15 Aug 2022 15:17: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 6FF625508D; Mon, 15 Aug 2022 11:38: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 7D93161135; Mon, 15 Aug 2022 18:38:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6EA01C433D6; Mon, 15 Aug 2022 18:38:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588725; bh=Ykk3jmbFM3PJt62sxcizrmy6rHAzlSYX/3dokANt3sM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pGcvSHxeC++8hJW4OX92m7u80PA0coMnm71gsrfNgRUl2nI22bPGwez1RSkdN+qvH ZY2fm8kKhUeiPgJBWPUbmVlpcYjNu5YWUT8DeePQYOG+n6A26VnsUo/BcBNFw0fQd0 uUe5JHvSFsRLCSW3Cv+mXDMR7hVumwLc4LCrrCps= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Zapolskiy , Robert Foss , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 455/779] clk: qcom: camcc-sm8250: Fix topology around titan_top power domain Date: Mon, 15 Aug 2022 20:01:39 +0200 Message-Id: <20220815180356.727742293@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Zapolskiy [ Upstream commit f8acf01a6a4f84baf05181e24bd48def4ba23f5b ] On SM8250 two found VFE GDSC power domains shall not be operated, if titan top is turned off, thus the former power domains will be set as subdomains by a GDSC registration routine. Fixes: 5d66ca79b58c ("clk: qcom: Add camera clock controller driver for SM8= 250") Signed-off-by: Vladimir Zapolskiy Reviewed-by: Robert Foss Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220519214133.1728979-3-vladimir.zapolskiy= @linaro.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/clk/qcom/camcc-sm8250.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/clk/qcom/camcc-sm8250.c b/drivers/clk/qcom/camcc-sm825= 0.c index ae4e9774f36e..9b32c56a5bc5 100644 --- a/drivers/clk/qcom/camcc-sm8250.c +++ b/drivers/clk/qcom/camcc-sm8250.c @@ -2205,6 +2205,8 @@ static struct clk_branch cam_cc_sleep_clk =3D { }, }; =20 +static struct gdsc titan_top_gdsc; + static struct gdsc bps_gdsc =3D { .gdscr =3D 0x7004, .pd =3D { @@ -2238,6 +2240,7 @@ static struct gdsc ife_0_gdsc =3D { .name =3D "ife_0_gdsc", }, .flags =3D POLL_CFG_GDSCR, + .parent =3D &titan_top_gdsc.pd, .pwrsts =3D PWRSTS_OFF_ON, }; =20 @@ -2247,6 +2250,7 @@ static struct gdsc ife_1_gdsc =3D { .name =3D "ife_1_gdsc", }, .flags =3D POLL_CFG_GDSCR, + .parent =3D &titan_top_gdsc.pd, .pwrsts =3D PWRSTS_OFF_ON, }; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DB26C00140 for ; Mon, 15 Aug 2022 19:14:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344025AbiHOTOi (ORCPT ); Mon, 15 Aug 2022 15:14:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344009AbiHOTLc (ORCPT ); Mon, 15 Aug 2022 15:11: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 735634F6B0; Mon, 15 Aug 2022 11:37: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 877EA61129; Mon, 15 Aug 2022 18:37:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 154D7C433C1; Mon, 15 Aug 2022 18:37:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588625; bh=v64i6dmRBj8u32VbpRKaEevUZlvMU/3S5m501PN/vcQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DS53cLCAPXeWJ5nzHvT5ncptVOfBjOtIcDse9+Bwz7GCFBSIyDlDbqCxqBDDevKC/ yEXXlEHmVNtNdocMuwL/+AIn6XwBSoNx9L/zanKOEoPbDeK1PB+3M9hnTYKjTXMjWT g3ph5uxk8R7gzfQdqZn5wDsv1zi2QtS4C139ducY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nikita Travkin , Stephen Boyd , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 456/779] clk: qcom: clk-rcg2: Fail Duty-Cycle configuration if MND divider is not enabled. Date: Mon, 15 Aug 2022 20:01:40 +0200 Message-Id: <20220815180356.768074660@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nikita Travkin [ Upstream commit bdafb609c3bb848d710ad9cd4debd2ee9d6a4049 ] In cases when MND is not enabled (e.g. when only Half Integer Divider is used), setting D registers makes no effect. Fail instead of making ineffective write. Fixes: 7f891faf596e ("clk: qcom: clk-rcg2: Add support for duty-cycle for R= CG") Signed-off-by: Nikita Travkin Reviewed-by: Stephen Boyd Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220612145955.385787-2-nikita@trvn.ru Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/clk/qcom/clk-rcg2.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c index f675fd969c4d..ebdbc842b98a 100644 --- a/drivers/clk/qcom/clk-rcg2.c +++ b/drivers/clk/qcom/clk-rcg2.c @@ -405,7 +405,7 @@ static int clk_rcg2_get_duty_cycle(struct clk_hw *hw, s= truct clk_duty *duty) static int clk_rcg2_set_duty_cycle(struct clk_hw *hw, struct clk_duty *dut= y) { struct clk_rcg2 *rcg =3D to_clk_rcg2(hw); - u32 notn_m, n, m, d, not2d, mask, duty_per; + u32 notn_m, n, m, d, not2d, mask, duty_per, cfg; int ret; =20 /* Duty-cycle cannot be modified for non-MND RCGs */ @@ -416,6 +416,11 @@ static int clk_rcg2_set_duty_cycle(struct clk_hw *hw, = struct clk_duty *duty) =20 regmap_read(rcg->clkr.regmap, RCG_N_OFFSET(rcg), ¬n_m); regmap_read(rcg->clkr.regmap, RCG_M_OFFSET(rcg), &m); + regmap_read(rcg->clkr.regmap, RCG_CFG_OFFSET(rcg), &cfg); + + /* Duty-cycle cannot be modified if MND divider is in bypass mode. */ + if (!(cfg & CFG_MODE_MASK)) + return -EINVAL; =20 n =3D (~(notn_m) + m) & mask; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7219C25B08 for ; Mon, 15 Aug 2022 19:19:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345154AbiHOTSU (ORCPT ); Mon, 15 Aug 2022 15:18:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343826AbiHOTO2 (ORCPT ); Mon, 15 Aug 2022 15:14: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 7AD8552451; Mon, 15 Aug 2022 11:37: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 8CD87610A4; Mon, 15 Aug 2022 18:37:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8798FC433C1; Mon, 15 Aug 2022 18:37:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588659; bh=Mg6Sn5bolJ4oeV46nSR5Urbra1kdWde0bOoiAeU8fPc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K97TVZ8a1cOzE/nsWec7dpKNX/akZV3tYdMkVU5REpn9db0qoZVFZL3oP2Py4FyDg aYP0uMz9NTWTG7BbaUsPvEXnzxPREUD6NxZKZ3YSmnOJc3+SrFUaba82oMJ5P70f8Z QqiHCdAI8jqbeCCidyBiTwPxoAVQPIBT06LU5+x0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nikita Travkin , Stephen Boyd , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 457/779] clk: qcom: clk-rcg2: Make sure to not write d=0 to the NMD register Date: Mon, 15 Aug 2022 20:01:41 +0200 Message-Id: <20220815180356.812632127@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nikita Travkin [ Upstream commit d0696770cef35a1fd16ea2167e2198c18aa6fbfe ] Sometimes calculation of d value may result in 0 because of the rounding after integer division. This causes the following error: [ 113.969689] camss_gp1_clk_src: rcg didn't update its configuration. [ 113.969754] WARNING: CPU: 3 PID: 35 at drivers/clk/qcom/clk-rcg2.c:122 u= pdate_config+0xc8/0xdc Make sure that D value is never zero. Fixes: 7f891faf596e ("clk: qcom: clk-rcg2: Add support for duty-cycle for R= CG") Signed-off-by: Nikita Travkin Reviewed-by: Stephen Boyd Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220612145955.385787-3-nikita@trvn.ru Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/clk/qcom/clk-rcg2.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c index ebdbc842b98a..c3823cc32edc 100644 --- a/drivers/clk/qcom/clk-rcg2.c +++ b/drivers/clk/qcom/clk-rcg2.c @@ -13,6 +13,7 @@ #include #include #include +#include #include =20 #include @@ -429,9 +430,11 @@ static int clk_rcg2_set_duty_cycle(struct clk_hw *hw, = struct clk_duty *duty) /* Calculate 2d value */ d =3D DIV_ROUND_CLOSEST(n * duty_per * 2, 100); =20 - /* Check bit widths of 2d. If D is too big reduce duty cycle. */ - if (d > mask) - d =3D mask; + /* + * Check bit widths of 2d. If D is too big reduce duty cycle. + * Also make sure it is never zero. + */ + d =3D clamp_val(d, 1, mask); =20 if ((d / 2) > (n - m)) d =3D (n - m) * 2; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1AB20C00140 for ; Mon, 15 Aug 2022 19:20:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344074AbiHOTT6 (ORCPT ); Mon, 15 Aug 2022 15:19:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344553AbiHOTQz (ORCPT ); Mon, 15 Aug 2022 15: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 665D63C157; Mon, 15 Aug 2022 11:38:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 76C0D61024; Mon, 15 Aug 2022 18:38:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63BE0C433C1; Mon, 15 Aug 2022 18:38:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588694; bh=Gz8bGqYoi8le6+ilC4kLA6XP+cBNj1tuSsvPN4O29SM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BiAgI2KfpapIIdPbA1ZT8cC2w9ho2lontdlsPj+yn8XQjO+LIWOi1RAozEbvHNcyF LyqwOBIHaNLIyrju1nThdfuHmsD7KPIAThS1b6x9V2uFqbJigIWfiQoUzKv3AqKug5 R2dAZNIZsT0OKeLinmB8+SQDZsFuI5cJ0pmZn69o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tianyu Li , Arnd Bergmann , Mark Rutland , Andrew Morton , Sasha Levin Subject: [PATCH 5.15 458/779] mm/mempolicy: fix get_nodes out of bound access Date: Mon, 15 Aug 2022 20:01:42 +0200 Message-Id: <20220815180356.852822996@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tianyu Li [ Upstream commit 000eca5d044d1ee23b4ca311793cf3fc528da6c6 ] When user specified more nodes than supported, get_nodes will access nmask array out of bounds. Link: https://lkml.kernel.org/r/20220601093211.2970565-1-tianyu.li@arm.com Fixes: e130242dc351 ("mm: simplify compat numa syscalls") Signed-off-by: Tianyu Li Cc: Arnd Bergmann Cc: Mark Rutland Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- mm/mempolicy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/mempolicy.c b/mm/mempolicy.c index 9db0158155e1..4472be6f123d 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c @@ -1389,7 +1389,7 @@ static int get_nodes(nodemask_t *nodes, const unsigne= d long __user *nmask, unsigned long bits =3D min_t(unsigned long, maxnode, BITS_PER_LONG); unsigned long t; =20 - if (get_bitmap(&t, &nmask[maxnode / BITS_PER_LONG], bits)) + if (get_bitmap(&t, &nmask[(maxnode - 1) / BITS_PER_LONG], bits)) return -EFAULT; =20 if (maxnode - bits >=3D MAX_NUMNODES) { --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77428C00140 for ; Mon, 15 Aug 2022 19:20:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244355AbiHOTUI (ORCPT ); Mon, 15 Aug 2022 15:20:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344570AbiHOTRC (ORCPT ); Mon, 15 Aug 2022 15:17:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 325A454669; Mon, 15 Aug 2022 11:38: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 A41316113C; Mon, 15 Aug 2022 18:38:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 716ADC433C1; Mon, 15 Aug 2022 18:38:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588707; bh=mccXJfaUGltowdpiIPhn0T+HvkdePsdRvpdZGS56ANw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XoN0YsjsaQD2qEujmqTficc8eO4dMUlDxPXweL+h7tzsCghCM5aNBqePcB6Pgd9eC 4j2HSkJBa1hoc3Qr8y8rFpkb+QRfvS99UDbFjQ/Vcs/DSVK0x5+MDwnWwdS0BTsvf7 20EZwV5cuO0eYCSdpMnPl9iB4ZNOrPO7IXQ6lSQ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manivannan Sadhasivam , Serge Semin , Bjorn Helgaas , Rob Herring , Sasha Levin Subject: [PATCH 5.15 459/779] PCI: dwc: Stop link on host_init errors and de-initialization Date: Mon, 15 Aug 2022 20:01:43 +0200 Message-Id: <20220815180356.903092606@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Serge Semin [ Upstream commit 113fa857b74c947137d845e7e635afcf6a59c43a ] It's logically correct to undo everything that was done when an error is discovered or in the corresponding cleanup counterpart. Otherwise the host controller will be left in an undetermined state. Since the link is set up in the host_init method, deactivate it there in the cleanup-on-error block and stop the link in the antagonistic routine - dw_pcie_host_deinit(). Link deactivation is platform-specific and should be implemented in dw_pcie_ops.stop_link(). Fixes: 886a9c134755 ("PCI: dwc: Move link handling into common code") Link: https://lore.kernel.org/r/20220624143428.8334-2-Sergey.Semin@baikalel= ectronics.ru Tested-by: Manivannan Sadhasivam Signed-off-by: Serge Semin Signed-off-by: Bjorn Helgaas Reviewed-by: Manivannan Sadhasivam Reviewed-by: Rob Herring Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- .../pci/controller/dwc/pcie-designware-host.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pc= i/controller/dwc/pcie-designware-host.c index bc0807fe3fc3..3200e906bcda 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -414,8 +414,14 @@ int dw_pcie_host_init(struct pcie_port *pp) bridge->sysdata =3D pp; =20 ret =3D pci_host_probe(bridge); - if (!ret) - return 0; + if (ret) + goto err_stop_link; + + return 0; + +err_stop_link: + if (pci->ops && pci->ops->stop_link) + pci->ops->stop_link(pci); =20 err_free_msi: if (pp->has_msi_ctrl) @@ -426,8 +432,14 @@ EXPORT_SYMBOL_GPL(dw_pcie_host_init); =20 void dw_pcie_host_deinit(struct pcie_port *pp) { + struct dw_pcie *pci =3D to_dw_pcie_from_pp(pp); + pci_stop_root_bus(pp->bridge->bus); pci_remove_root_bus(pp->bridge->bus); + + if (pci->ops && pci->ops->stop_link) + pci->ops->stop_link(pci); + if (pp->has_msi_ctrl) dw_pcie_free_msi(pp); } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41A20C2BB9D for ; Mon, 15 Aug 2022 19:21:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344691AbiHOTV2 (ORCPT ); Mon, 15 Aug 2022 15:21:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344671AbiHOTRP (ORCPT ); Mon, 15 Aug 2022 15:17:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A05054C84; Mon, 15 Aug 2022 11:38:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8EEC3B81088; Mon, 15 Aug 2022 18:38:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB7D6C433D6; Mon, 15 Aug 2022 18:38:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588710; bh=pVRim+6E89HAx+8iXj8cTuxT/+QM7V//8BQlXrCmF1M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=snI6ZeNC6F+Gl5DoKZ/EV8uICRjWuifyU3eE057U6vtByJuTNvylnIpFrYWRbUk8+ GvJA08Ps7Oj9QOBs4IbL+KHHU4FUZAjy1xfZFDpbwqkIUuC9p4ywY76x8QiOX94q82 mag98wBUnMk/VdOAtPEJ8u9YbQa+1CRQlx5jzGo4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manivannan Sadhasivam , Serge Semin , Bjorn Helgaas , Rob Herring , Sasha Levin Subject: [PATCH 5.15 460/779] PCI: dwc: Add unroll iATU space support to dw_pcie_disable_atu() Date: Mon, 15 Aug 2022 20:01:44 +0200 Message-Id: <20220815180356.947745102@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Serge Semin [ Upstream commit d1cf738f2b65a5640234e1da90a68d3523fbed83 ] dw_pcie_disable_atu() was introduced by f8aed6ec624f ("PCI: dwc: designware: Add EP mode support") and supported only the viewport version of the iATU CSRs. DW PCIe IP cores v4.80a and newer also support unrolled iATU/eDMA space. Callers of dw_pcie_disable_atu(), including pci_epc_ops.clear_bar(), pci_epc_ops.unmap_addr(), and dw_pcie_setup_rc(), don't work correctly when it is enabled. Add dw_pcie_disable_atu() support for controllers with unrolled iATU CSRs enabled. [bhelgaas: commit log] Fixes: f8aed6ec624f ("PCI: dwc: designware: Add EP mode support") Link: https://lore.kernel.org/r/20220624143428.8334-3-Sergey.Semin@baikalel= ectronics.ru Tested-by: Manivannan Sadhasivam Signed-off-by: Serge Semin Signed-off-by: Bjorn Helgaas Reviewed-by: Manivannan Sadhasivam Reviewed-by: Rob Herring Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/pci/controller/dwc/pcie-designware.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/con= troller/dwc/pcie-designware.c index 3254f60d1713..ff74ddf2cc35 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -491,7 +491,7 @@ int dw_pcie_prog_inbound_atu(struct dw_pcie *pci, u8 fu= nc_no, int index, void dw_pcie_disable_atu(struct dw_pcie *pci, int index, enum dw_pcie_region_type type) { - int region; + u32 region; =20 switch (type) { case DW_PCIE_REGION_INBOUND: @@ -504,8 +504,18 @@ void dw_pcie_disable_atu(struct dw_pcie *pci, int inde= x, return; } =20 - dw_pcie_writel_dbi(pci, PCIE_ATU_VIEWPORT, region | index); - dw_pcie_writel_dbi(pci, PCIE_ATU_CR2, ~(u32)PCIE_ATU_ENABLE); + if (pci->iatu_unroll_enabled) { + if (region =3D=3D PCIE_ATU_REGION_INBOUND) { + dw_pcie_writel_ib_unroll(pci, index, PCIE_ATU_UNR_REGION_CTRL2, + ~(u32)PCIE_ATU_ENABLE); + } else { + dw_pcie_writel_ob_unroll(pci, index, PCIE_ATU_UNR_REGION_CTRL2, + ~(u32)PCIE_ATU_ENABLE); + } + } else { + dw_pcie_writel_dbi(pci, PCIE_ATU_VIEWPORT, region | index); + dw_pcie_writel_dbi(pci, PCIE_ATU_CR2, ~(u32)PCIE_ATU_ENABLE); + } } =20 int dw_pcie_wait_for_link(struct dw_pcie *pci) --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33458C2BBC5 for ; Mon, 15 Aug 2022 19:21:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344648AbiHOTV0 (ORCPT ); Mon, 15 Aug 2022 15:21:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344665AbiHOTRO (ORCPT ); Mon, 15 Aug 2022 15:17:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD00E3C8D5; Mon, 15 Aug 2022 11:38:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0620C61024; Mon, 15 Aug 2022 18:38:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E56CBC433D6; Mon, 15 Aug 2022 18:38:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588713; bh=zQsLFdj2P+OSam3i5qL4NMoAljPhyjGZE2whu/cO+EA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k7bjfWJyzpoq/dMS2yTUYfOt+NnQhllx1lvhXN2cKV2YD/wcimsfp2Y4PErqlRf4a w92bVE2kuhd8NjZg4nXn284JOLtR6Sy18o+nuUEuLDW6COLeanp+RtpCHa9mO70PU2 fpltHwaS2YW/mXDKxzh37+4FOe3Go6albetBRN68= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manivannan Sadhasivam , Serge Semin , Bjorn Helgaas , Rob Herring , Sasha Levin Subject: [PATCH 5.15 461/779] PCI: dwc: Disable outbound windows only for controllers using iATU Date: Mon, 15 Aug 2022 20:01:45 +0200 Message-Id: <20220815180356.999594058@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Serge Semin [ Upstream commit d60a2e281e9de2b2f67343b2e39417ca0f4fd54e ] Some DWC-based controllers (e.g., pcie-al.c and pci-keystone.c, identified by the fact that they override the default dw_child_pcie_ops) use their own address translation approach instead of the DWC internal ATU (iATU). For those controllers, skip disabling the iATU outbound windows. [bhelgaas: commit log, update multiple window comment] Fixes: 458ad06c4cdd ("PCI: dwc: Ensure all outbound ATU windows are reset") Link: https://lore.kernel.org/r/20220624143428.8334-4-Sergey.Semin@baikalel= ectronics.ru Tested-by: Manivannan Sadhasivam Signed-off-by: Serge Semin Signed-off-by: Bjorn Helgaas Reviewed-by: Manivannan Sadhasivam Reviewed-by: Rob Herring Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/pci/controller/dwc/pcie-designware-host.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-host.c b/drivers/pc= i/controller/dwc/pcie-designware-host.c index 3200e906bcda..7cd4593ad12f 100644 --- a/drivers/pci/controller/dwc/pcie-designware-host.c +++ b/drivers/pci/controller/dwc/pcie-designware-host.c @@ -536,7 +536,6 @@ static struct pci_ops dw_pcie_ops =3D { =20 void dw_pcie_setup_rc(struct pcie_port *pp) { - int i; u32 val, ctrl, num_ctrls; struct dw_pcie *pci =3D to_dw_pcie_from_pp(pp); =20 @@ -588,19 +587,22 @@ void dw_pcie_setup_rc(struct pcie_port *pp) PCI_COMMAND_MASTER | PCI_COMMAND_SERR; dw_pcie_writel_dbi(pci, PCI_COMMAND, val); =20 - /* Ensure all outbound windows are disabled so there are multiple matches= */ - for (i =3D 0; i < pci->num_ob_windows; i++) - dw_pcie_disable_atu(pci, i, DW_PCIE_REGION_OUTBOUND); - /* * If the platform provides its own child bus config accesses, it means * the platform uses its own address translation component rather than * ATU, so we should not program the ATU here. */ if (pp->bridge->child_ops =3D=3D &dw_child_pcie_ops) { - int atu_idx =3D 0; + int i, atu_idx =3D 0; struct resource_entry *entry; =20 + /* + * Disable all outbound windows to make sure a transaction + * can't match multiple windows. + */ + for (i =3D 0; i < pci->num_ob_windows; i++) + dw_pcie_disable_atu(pci, i, DW_PCIE_REGION_OUTBOUND); + /* Get last memory resource entry */ resource_list_for_each_entry(entry, &pp->bridge->windows) { if (resource_type(entry->res) !=3D IORESOURCE_MEM) --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0BAFDC25B0E for ; Mon, 15 Aug 2022 19:20:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244752AbiHOTUP (ORCPT ); Mon, 15 Aug 2022 15:20:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344696AbiHOTRS (ORCPT ); Mon, 15 Aug 2022 15:17:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D2DC54C9F; Mon, 15 Aug 2022 11:38: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 C8F93B80F99; Mon, 15 Aug 2022 18:38:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B88DC433C1; Mon, 15 Aug 2022 18:38:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588716; bh=j9cFBdaPFd8ff95OK8Y7irow2Itk18MHI9eSz8eZUic=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pb4Qm8nJRp2LiARQoGj89YTeDHCehwnW9YhSK0RL5RO/ODxNaXefwGDpCMPoZw5ut kNQRzECyoewX9CK7fiVbMiGW5iXFZYXDmDieTCf/8R3rBYNdBb4HV5y1HDlb4Iebaa 6jRGq2IpuP11Sg5CMswSIEW15U49rAGpZMsp6Lt0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manivannan Sadhasivam , Serge Semin , Bjorn Helgaas , Rob Herring , Sasha Levin Subject: [PATCH 5.15 462/779] PCI: dwc: Set INCREASE_REGION_SIZE flag based on limit address Date: Mon, 15 Aug 2022 20:01:46 +0200 Message-Id: <20220815180357.050342804@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Serge Semin [ Upstream commit 777e7c3ab73036105e6fc4a67ed950179dbffbab ] We program the 64-bit ATU limit address (in PCIE_ATU_LIMIT/ PCIE_ATU_UPPER_LIMIT or PCIE_ATU_UNR_LOWER_LIMIT/PCIE_ATU_UNR_UPPER_LIMIT), but in addition, the PCIE_ATU_INCREASE_REGION_SIZE bit must be set if the upper 32 bits of the limit address differ from the upper 32 bits of the base address (see [1,2]). 5b4cf0f65324 ("PCI: dwc: Add upper limit address for outbound iATU") set PCIE_ATU_INCREASE_REGION_SIZE, but only when the *size* was greater than 4GB. It did not set it when a smaller region crossed a 4GB boundary, e.g., [mem 0x0_f0000000-0x1_0fffffff]. Set PCIE_ATU_INCREASE_REGION_SIZE whenever PCIE_ATU_UPPER_LIMIT is greater than PCIE_ATU_UPPER_BASE. [1] DesignWare Cores PCI Express Controller Databook - DWC PCIe Root Port, v5.40a, March 2019, fig.3-36, p.175 [2] DesignWare Cores PCI Express Controller Databook - DWC PCIe Root Port, v5.40a, March 2019, fig.3-37, p.176 [bhelgaas: commit log] Fixes: 5b4cf0f65324 ("PCI: dwc: Add upper limit address for outbound iATU") Link: https://lore.kernel.org/r/20220624143428.8334-5-Sergey.Semin@baikalel= ectronics.ru Tested-by: Manivannan Sadhasivam Signed-off-by: Serge Semin Signed-off-by: Bjorn Helgaas Reviewed-by: Manivannan Sadhasivam Reviewed-by: Rob Herring Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/pci/controller/dwc/pcie-designware.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/con= troller/dwc/pcie-designware.c index ff74ddf2cc35..e863cc2f1e1d 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -287,8 +287,8 @@ static void dw_pcie_prog_outbound_atu_unroll(struct dw_= pcie *pci, u8 func_no, dw_pcie_writel_ob_unroll(pci, index, PCIE_ATU_UNR_UPPER_TARGET, upper_32_bits(pci_addr)); val =3D type | PCIE_ATU_FUNC_NUM(func_no); - val =3D upper_32_bits(size - 1) ? - val | PCIE_ATU_INCREASE_REGION_SIZE : val; + if (upper_32_bits(limit_addr) > upper_32_bits(cpu_addr)) + val |=3D PCIE_ATU_INCREASE_REGION_SIZE; if (pci->version =3D=3D 0x490A) val =3D dw_pcie_enable_ecrc(val); dw_pcie_writel_ob_unroll(pci, index, PCIE_ATU_UNR_REGION_CTRL1, val); @@ -315,6 +315,7 @@ static void __dw_pcie_prog_outbound_atu(struct dw_pcie = *pci, u8 func_no, u64 pci_addr, u64 size) { u32 retries, val; + u64 limit_addr; =20 if (pci->ops && pci->ops->cpu_addr_fixup) cpu_addr =3D pci->ops->cpu_addr_fixup(pci, cpu_addr); @@ -325,6 +326,8 @@ static void __dw_pcie_prog_outbound_atu(struct dw_pcie = *pci, u8 func_no, return; } =20 + limit_addr =3D cpu_addr + size - 1; + dw_pcie_writel_dbi(pci, PCIE_ATU_VIEWPORT, PCIE_ATU_REGION_OUTBOUND | index); dw_pcie_writel_dbi(pci, PCIE_ATU_LOWER_BASE, @@ -332,17 +335,18 @@ static void __dw_pcie_prog_outbound_atu(struct dw_pci= e *pci, u8 func_no, dw_pcie_writel_dbi(pci, PCIE_ATU_UPPER_BASE, upper_32_bits(cpu_addr)); dw_pcie_writel_dbi(pci, PCIE_ATU_LIMIT, - lower_32_bits(cpu_addr + size - 1)); + lower_32_bits(limit_addr)); if (pci->version >=3D 0x460A) dw_pcie_writel_dbi(pci, PCIE_ATU_UPPER_LIMIT, - upper_32_bits(cpu_addr + size - 1)); + upper_32_bits(limit_addr)); dw_pcie_writel_dbi(pci, PCIE_ATU_LOWER_TARGET, lower_32_bits(pci_addr)); dw_pcie_writel_dbi(pci, PCIE_ATU_UPPER_TARGET, upper_32_bits(pci_addr)); val =3D type | PCIE_ATU_FUNC_NUM(func_no); - val =3D ((upper_32_bits(size - 1)) && (pci->version >=3D 0x460A)) ? - val | PCIE_ATU_INCREASE_REGION_SIZE : val; + if (upper_32_bits(limit_addr) > upper_32_bits(cpu_addr) && + pci->version >=3D 0x460A) + val |=3D PCIE_ATU_INCREASE_REGION_SIZE; if (pci->version =3D=3D 0x490A) val =3D dw_pcie_enable_ecrc(val); dw_pcie_writel_dbi(pci, PCIE_ATU_CR1, val); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BBB12C00140 for ; Mon, 15 Aug 2022 19:20:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245054AbiHOTUT (ORCPT ); Mon, 15 Aug 2022 15:20:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344724AbiHOTRV (ORCPT ); Mon, 15 Aug 2022 15:17:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEAB654CB4; Mon, 15 Aug 2022 11:38: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 EE314B8108B; Mon, 15 Aug 2022 18:38:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46AA5C433C1; Mon, 15 Aug 2022 18:38:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588719; bh=LOhZuZOT14v6tsIvogwRH0JGe5CzZZhO9MHqkTTLQm4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QZD7eDmgKkQxbpkrlpHN0CFp+aY9WxGUPVGlAmrlYaiC5Rfxp2PORD8NyvzcRAv74 MbYIUqE0KdFFl0su/20KQ7nA2tJWbDrWgK1RfOOJRBS5CGHCewGVrJ7uUy49gCPAI3 zHTzBOCbhP837qVBKUSImamv0XCDISf2zSmfde1k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manivannan Sadhasivam , Serge Semin , Bjorn Helgaas , Rob Herring , Sasha Levin Subject: [PATCH 5.15 463/779] PCI: dwc: Deallocate EPC memory on dw_pcie_ep_init() errors Date: Mon, 15 Aug 2022 20:01:47 +0200 Message-Id: <20220815180357.090644892@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Serge Semin [ Upstream commit 8161e9626b50892eaedbd8070ecb1586ecedb109 ] If dw_pcie_ep_init() fails to perform any action after the EPC memory is initialized and the MSI memory region is allocated, the latter parts won't be undone thus causing a memory leak. Add a cleanup-on-error path to fix these leaks. [bhelgaas: commit log] Fixes: 2fd0c9d966cc ("PCI: designware-ep: Pre-allocate memory for MSI in dw= _pcie_ep_init") Link: https://lore.kernel.org/r/20220624143428.8334-6-Sergey.Semin@baikalel= ectronics.ru Tested-by: Manivannan Sadhasivam Signed-off-by: Serge Semin Signed-off-by: Bjorn Helgaas Reviewed-by: Rob Herring Reviewed-by: Manivannan Sadhasivam Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- .../pci/controller/dwc/pcie-designware-ep.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/= controller/dwc/pcie-designware-ep.c index 998b698f4085..2af4ed90e12b 100644 --- a/drivers/pci/controller/dwc/pcie-designware-ep.c +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c @@ -777,8 +777,9 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep) ep->msi_mem =3D pci_epc_mem_alloc_addr(epc, &ep->msi_mem_phys, epc->mem->window.page_size); if (!ep->msi_mem) { + ret =3D -ENOMEM; dev_err(dev, "Failed to reserve memory for MSI/MSI-X\n"); - return -ENOMEM; + goto err_exit_epc_mem; } =20 if (ep->ops->get_features) { @@ -787,6 +788,19 @@ int dw_pcie_ep_init(struct dw_pcie_ep *ep) return 0; } =20 - return dw_pcie_ep_init_complete(ep); + ret =3D dw_pcie_ep_init_complete(ep); + if (ret) + goto err_free_epc_mem; + + return 0; + +err_free_epc_mem: + pci_epc_mem_free_addr(epc, ep->msi_mem_phys, ep->msi_mem, + epc->mem->window.page_size); + +err_exit_epc_mem: + pci_epc_mem_exit(epc); + + return ret; } EXPORT_SYMBOL_GPL(dw_pcie_ep_init); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C113C00140 for ; Mon, 15 Aug 2022 19:20:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244001AbiHOTU2 (ORCPT ); Mon, 15 Aug 2022 15:20:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344730AbiHOTRX (ORCPT ); Mon, 15 Aug 2022 15:17:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7164E3C8ED; Mon, 15 Aug 2022 11:38:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4FE4860FBA; Mon, 15 Aug 2022 18:38:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FF1BC433C1; Mon, 15 Aug 2022 18:38:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588722; bh=hQuQPiWue9/Tz9DD8DLI6oIL8XseOvRSRPmKO4kuJvU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MRbrj+9IF8usyO/N7AigyVHd5g6vTOXg+cs1oZPje5jrz0qWYps1Q5MgpmSg+jhzx eCpnP/EyAg4l8Zmv8tnAgFhV2XPw4UNz4C0nvwLqhDZVx3vEyqn8bglVjVTAnCuUO0 Gqap1WRmny4w4JwlLtRtnqMtQLsU0V8k5XLmmD7I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Semin , Bjorn Helgaas , Vidya Sagar , Rob Herring , Manivannan Sadhasivam , Sasha Levin Subject: [PATCH 5.15 464/779] PCI: dwc: Always enable CDM check if "snps,enable-cdm-check" exists Date: Mon, 15 Aug 2022 20:01:48 +0200 Message-Id: <20220815180357.130710783@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Serge Semin [ Upstream commit ec7b952f453ce7eabe7e1bea584626934d44f668 ] If the "snps,enable-cdm-check" property exists, we should enable the CDM check. But previously dw_pcie_setup() could exit before doing so if the "num-lanes" property was absent or invalid. Move the CDM enable earlier so we do it regardless of whether "num-lanes" is present. [bhelgaas: commit log] Fixes: 07f123def73e ("PCI: dwc: Add support to enable CDM register check") Link: https://lore.kernel.org/r/20220624143428.8334-7-Sergey.Semin@baikalel= ectronics.ru Signed-off-by: Serge Semin Signed-off-by: Bjorn Helgaas Reviewed-by: Vidya Sagar Reviewed-by: Rob Herring Reviewed-by: Manivannan Sadhasivam Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/pci/controller/dwc/pcie-designware.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-designware.c b/drivers/pci/con= troller/dwc/pcie-designware.c index e863cc2f1e1d..e408ebf5bd73 100644 --- a/drivers/pci/controller/dwc/pcie-designware.c +++ b/drivers/pci/controller/dwc/pcie-designware.c @@ -739,6 +739,13 @@ void dw_pcie_setup(struct dw_pcie *pci) val |=3D PORT_LINK_DLL_LINK_EN; dw_pcie_writel_dbi(pci, PCIE_PORT_LINK_CONTROL, val); =20 + if (of_property_read_bool(np, "snps,enable-cdm-check")) { + val =3D dw_pcie_readl_dbi(pci, PCIE_PL_CHK_REG_CONTROL_STATUS); + val |=3D PCIE_PL_CHK_REG_CHK_REG_CONTINUOUS | + PCIE_PL_CHK_REG_CHK_REG_START; + dw_pcie_writel_dbi(pci, PCIE_PL_CHK_REG_CONTROL_STATUS, val); + } + of_property_read_u32(np, "num-lanes", &pci->num_lanes); if (!pci->num_lanes) { dev_dbg(pci->dev, "Using h/w default number of lanes\n"); @@ -785,11 +792,4 @@ void dw_pcie_setup(struct dw_pcie *pci) break; } dw_pcie_writel_dbi(pci, PCIE_LINK_WIDTH_SPEED_CONTROL, val); - - if (of_property_read_bool(np, "snps,enable-cdm-check")) { - val =3D dw_pcie_readl_dbi(pci, PCIE_PL_CHK_REG_CONTROL_STATUS); - val |=3D PCIE_PL_CHK_REG_CHK_REG_CONTINUOUS | - PCIE_PL_CHK_REG_CHK_REG_START; - dw_pcie_writel_dbi(pci, PCIE_PL_CHK_REG_CONTROL_STATUS, val); - } } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89456C00140 for ; Mon, 15 Aug 2022 19:14:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343875AbiHOTOr (ORCPT ); Mon, 15 Aug 2022 15:14:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344084AbiHOTLl (ORCPT ); Mon, 15 Aug 2022 15:11: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 A82AE5004C; Mon, 15 Aug 2022 11:37: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 CE821610A4; Mon, 15 Aug 2022 18:37:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD37EC433C1; Mon, 15 Aug 2022 18:37:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588629; bh=yg6v+E6w4tYGmjS7g1TgMXBUqPL+Zz2rnmZLUdugTHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nXgjMYpJscj2GnOr8+zjsjOpu31nCSQyVF4q/jFNbxbxiQJPFW9WnDHIt+pWUCTkS C+X1woBd5nQtHohzPeS9Dfb4l2BCkd8BWIFp3/kyCd3hcXvrKK9cQSD5Sy8DQc6XBY 2pfJTN/Em5JyM4auErsgGMUwWiESmuY4iVDEoiUA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pierre-Louis Bossart , Rander Wang , Bard Liao , Vinod Koul , Sasha Levin Subject: [PATCH 5.15 465/779] soundwire: bus_type: fix remove and shutdown support Date: Mon, 15 Aug 2022 20:01:49 +0200 Message-Id: <20220815180357.179148072@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pierre-Louis Bossart [ Upstream commit df6407782964dc7e35ad84230abb38f46314b245 ] The bus sdw_drv_remove() and sdw_drv_shutdown() helpers are used conditionally, if the driver provides these routines. These helpers already test if the driver provides a .remove or .shutdown callback, so there's no harm in invoking the sdw_drv_remove() and sdw_drv_shutdown() unconditionally. In addition, the current code is imbalanced with dev_pm_domain_attach() called from sdw_drv_probe(), but dev_pm_domain_detach() called from sdw_drv_remove() only if the driver provides a .remove callback. Fixes: 9251345dca24b ("soundwire: Add SoundWire bus type") Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Signed-off-by: Bard Liao Link: https://lore.kernel.org/r/20220610015105.25987-1-yung-chuan.liao@linu= x.intel.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/soundwire/bus_type.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/soundwire/bus_type.c b/drivers/soundwire/bus_type.c index 893296f3fe39..b81e04dd3a9f 100644 --- a/drivers/soundwire/bus_type.c +++ b/drivers/soundwire/bus_type.c @@ -193,12 +193,8 @@ int __sdw_register_driver(struct sdw_driver *drv, stru= ct module *owner) =20 drv->driver.owner =3D owner; drv->driver.probe =3D sdw_drv_probe; - - if (drv->remove) - drv->driver.remove =3D sdw_drv_remove; - - if (drv->shutdown) - drv->driver.shutdown =3D sdw_drv_shutdown; + drv->driver.remove =3D sdw_drv_remove; + drv->driver.shutdown =3D sdw_drv_shutdown; =20 return driver_register(&drv->driver); } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20CA5C25B0E for ; Mon, 15 Aug 2022 19:15:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344056AbiHOTO6 (ORCPT ); Mon, 15 Aug 2022 15:14:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344137AbiHOTLs (ORCPT ); Mon, 15 Aug 2022 15:11:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A82750186; Mon, 15 Aug 2022 11:37: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 9A61AB81081; Mon, 15 Aug 2022 18:37:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D278FC433D6; Mon, 15 Aug 2022 18:37:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588632; bh=p0shUOBpkaD98IZHfAVdHJOn3OC0BCG1WGaTCxc9Fas=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wRWnkObCAFmYbJaPrItZgK/wepdi+evx/ygrIn8HHpmpTcHxeBQDMvLLHTeZiQXP6 X/CF80UU33GFehaaEvM6pVDX21W8/ZX6zbRIRYh23oJYPAafP12el/QgVjUMWlLYSU jg24wJ8peACQ+88Q7vdYQgARL40/VVz/YJYuShG4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pierre-Louis Bossart , Rander Wang , Ranjani Sridharan , Bard Liao , =?UTF-8?q?P=C3=A9ter=20Ujfalusi?= , Vinod Koul , Sasha Levin Subject: [PATCH 5.15 466/779] soundwire: revisit driver bind/unbind and callbacks Date: Mon, 15 Aug 2022 20:01:50 +0200 Message-Id: <20220815180357.217899135@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pierre-Louis Bossart [ Upstream commit bd29c00edd0a5dac8b6e7332bb470cd50f92e893 ] In the SoundWire probe, we store a pointer from the driver ops into the 'slave' structure. This can lead to kernel oopses when unbinding codec drivers, e.g. with the following sequence to remove machine driver and codec driver. /sbin/modprobe -r snd_soc_sof_sdw /sbin/modprobe -r snd_soc_rt711 The full details can be found in the BugLink below, for reference the two following examples show different cases of driver ops/callbacks being invoked after the driver .remove(). kernel: BUG: kernel NULL pointer dereference, address: 0000000000000150 kernel: Workqueue: events cdns_update_slave_status_work [soundwire_cadence] kernel: RIP: 0010:mutex_lock+0x19/0x30 kernel: Call Trace: kernel: ? sdw_handle_slave_status+0x426/0xe00 [soundwire_bus 94ff184bf3985= 70c3f8ff7efe9e32529f532e4ae] kernel: ? newidle_balance+0x26a/0x400 kernel: ? cdns_update_slave_status_work+0x1e9/0x200 [soundwire_cadence 1bc= f98eebe5ba9833cd433323769ac923c9c6f82] kernel: BUG: unable to handle page fault for address: ffffffffc07654c8 kernel: Workqueue: pm pm_runtime_work kernel: RIP: 0010:sdw_bus_prep_clk_stop+0x6f/0x160 [soundwire_bus] kernel: Call Trace: kernel: kernel: sdw_cdns_clock_stop+0xb5/0x1b0 [soundwire_cadence 1bcf98eebe5ba983= 3cd433323769ac923c9c6f82] kernel: intel_suspend_runtime+0x5f/0x120 [soundwire_intel aca858f7c87048d3= 152a4a41bb68abb9b663a1dd] kernel: ? dpm_sysfs_remove+0x60/0x60 This was not detected earlier in Intel tests since the tests first remove the parent PCI device and shut down the bus. The sequence above is a corner case which keeps the bus operational but without a driver bound. While trying to solve this kernel oopses, it became clear that the existing SoundWire bus does not deal well with the unbind case. Commit 528be501b7d4a ("soundwire: sdw_slave: add probe_complete structure a= nd new fields") added a 'probed' status variable and a 'probe_complete' struct completion. This status is however not reset on remove and likewise the 'probe complete' is not re-initialized, so the bind/unbind/bind test cases would fail. The timeout used before the 'update_status' callback was also a bad idea in hindsight, there should really be no timing assumption as to if and when a driver is bound to a device. An initial draft was based on device_lock() and device_unlock() was tested. This proved too complicated, with deadlocks created during the suspend-resume sequences, which also use the same device_lock/unlock() as the bind/unbind sequences. On a CometLake device, a bad DSDT/BIOS caused spurious resumes and the use of device_lock() caused hangs during suspend. After multiple weeks or testing and painful reverse-engineering of deadlocks on different devices, we looked for alternatives that did not interfere with the device core. A bus notifier was used successfully to keep track of DRIVER_BOUND and DRIVER_UNBIND events. This solved the bind-unbind-bind case in tests, but it can still be defeated with a theoretical corner case where the memory is freed by a .remove while the callback is in use. The notifier only helps make sure the driver callbacks are valid, but not that the memory allocated in probe remains valid while the callbacks are invoked. This patch suggests the introduction of a new 'sdw_dev_lock' mutex protecting probe/remove and all driver callbacks. Since this mutex is 'local' to SoundWire only, it does not interfere with existing locks and does not create deadlocks. In addition, this patch removes the 'probe_complete' completion, instead we directly invoke the 'update_status' from the probe routine. That removes any sort of timing dependency and a much better support for the device/driver model, the driver could be bound before the bus started, or eons after the bus started and the hardware would be properly initialized in all cases. BugLink: https://github.com/thesofproject/linux/issues/3531 Fixes: 56d4fe31af77 ("soundwire: Add MIPI DisCo property helpers") Fixes: 528be501b7d4a ("soundwire: sdw_slave: add probe_complete structure a= nd new fields") Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Reviewed-by: Ranjani Sridharan Reviewed-by: Bard Liao Reviewed-by: P=C3=A9ter Ujfalusi Link: https://lore.kernel.org/r/20220621225641.221170-2-pierre-louis.bossar= t@linux.intel.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/soundwire/bus.c | 75 ++++++++++++++++++++--------------- drivers/soundwire/bus_type.c | 30 +++++++++++--- drivers/soundwire/slave.c | 3 +- drivers/soundwire/stream.c | 53 ++++++++++++++++--------- include/linux/soundwire/sdw.h | 6 +-- 5 files changed, 106 insertions(+), 61 deletions(-) diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c index 67369e941d0d..b7cdfa65157c 100644 --- a/drivers/soundwire/bus.c +++ b/drivers/soundwire/bus.c @@ -7,6 +7,7 @@ #include #include #include +#include #include "bus.h" #include "sysfs_local.h" =20 @@ -846,15 +847,21 @@ static int sdw_slave_clk_stop_callback(struct sdw_sla= ve *slave, enum sdw_clk_stop_mode mode, enum sdw_clk_stop_type type) { - int ret; + int ret =3D 0; =20 - if (slave->ops && slave->ops->clk_stop) { - ret =3D slave->ops->clk_stop(slave, mode, type); - if (ret < 0) - return ret; + mutex_lock(&slave->sdw_dev_lock); + + if (slave->probed) { + struct device *dev =3D &slave->dev; + struct sdw_driver *drv =3D drv_to_sdw_driver(dev->driver); + + if (drv->ops && drv->ops->clk_stop) + ret =3D drv->ops->clk_stop(slave, mode, type); } =20 - return 0; + mutex_unlock(&slave->sdw_dev_lock); + + return ret; } =20 static int sdw_slave_clk_stop_prepare(struct sdw_slave *slave, @@ -1616,14 +1623,24 @@ static int sdw_handle_slave_alerts(struct sdw_slave= *slave) } =20 /* Update the Slave driver */ - if (slave_notify && slave->ops && - slave->ops->interrupt_callback) { - slave_intr.sdca_cascade =3D sdca_cascade; - slave_intr.control_port =3D clear; - memcpy(slave_intr.port, &port_status, - sizeof(slave_intr.port)); - - slave->ops->interrupt_callback(slave, &slave_intr); + if (slave_notify) { + mutex_lock(&slave->sdw_dev_lock); + + if (slave->probed) { + struct device *dev =3D &slave->dev; + struct sdw_driver *drv =3D drv_to_sdw_driver(dev->driver); + + if (drv->ops && drv->ops->interrupt_callback) { + slave_intr.sdca_cascade =3D sdca_cascade; + slave_intr.control_port =3D clear; + memcpy(slave_intr.port, &port_status, + sizeof(slave_intr.port)); + + drv->ops->interrupt_callback(slave, &slave_intr); + } + } + + mutex_unlock(&slave->sdw_dev_lock); } =20 /* Ack interrupt */ @@ -1697,29 +1714,21 @@ static int sdw_handle_slave_alerts(struct sdw_slave= *slave) static int sdw_update_slave_status(struct sdw_slave *slave, enum sdw_slave_status status) { - unsigned long time; + int ret =3D 0; =20 - if (!slave->probed) { - /* - * the slave status update is typically handled in an - * interrupt thread, which can race with the driver - * probe, e.g. when a module needs to be loaded. - * - * make sure the probe is complete before updating - * status. - */ - time =3D wait_for_completion_timeout(&slave->probe_complete, - msecs_to_jiffies(DEFAULT_PROBE_TIMEOUT)); - if (!time) { - dev_err(&slave->dev, "Probe not complete, timed out\n"); - return -ETIMEDOUT; - } + mutex_lock(&slave->sdw_dev_lock); + + if (slave->probed) { + struct device *dev =3D &slave->dev; + struct sdw_driver *drv =3D drv_to_sdw_driver(dev->driver); + + if (drv->ops && drv->ops->update_status) + ret =3D drv->ops->update_status(slave, status); } =20 - if (!slave->ops || !slave->ops->update_status) - return 0; + mutex_unlock(&slave->sdw_dev_lock); =20 - return slave->ops->update_status(slave, status); + return ret; } =20 /** diff --git a/drivers/soundwire/bus_type.c b/drivers/soundwire/bus_type.c index b81e04dd3a9f..04b3529f8929 100644 --- a/drivers/soundwire/bus_type.c +++ b/drivers/soundwire/bus_type.c @@ -98,8 +98,6 @@ static int sdw_drv_probe(struct device *dev) if (!id) return -ENODEV; =20 - slave->ops =3D drv->ops; - /* * attach to power domain but don't turn on (last arg) */ @@ -107,19 +105,23 @@ static int sdw_drv_probe(struct device *dev) if (ret) return ret; =20 + mutex_lock(&slave->sdw_dev_lock); + ret =3D drv->probe(slave, id); if (ret) { name =3D drv->name; if (!name) name =3D drv->driver.name; + mutex_unlock(&slave->sdw_dev_lock); + dev_err(dev, "Probe of %s failed: %d\n", name, ret); dev_pm_domain_detach(dev, false); return ret; } =20 /* device is probed so let's read the properties now */ - if (slave->ops && slave->ops->read_prop) - slave->ops->read_prop(slave); + if (drv->ops && drv->ops->read_prop) + drv->ops->read_prop(slave); =20 /* init the sysfs as we have properties now */ ret =3D sdw_slave_sysfs_init(slave); @@ -139,7 +141,19 @@ static int sdw_drv_probe(struct device *dev) slave->prop.clk_stop_timeout); =20 slave->probed =3D true; - complete(&slave->probe_complete); + + /* + * if the probe happened after the bus was started, notify the codec driv= er + * of the current hardware status to e.g. start the initialization. + * Errors are only logged as warnings to avoid failing the probe. + */ + if (drv->ops && drv->ops->update_status) { + ret =3D drv->ops->update_status(slave, slave->status); + if (ret < 0) + dev_warn(dev, "%s: update_status failed with status %d\n", __func__, re= t); + } + + mutex_unlock(&slave->sdw_dev_lock); =20 dev_dbg(dev, "probe complete\n"); =20 @@ -152,9 +166,15 @@ static int sdw_drv_remove(struct device *dev) struct sdw_driver *drv =3D drv_to_sdw_driver(dev->driver); int ret =3D 0; =20 + mutex_lock(&slave->sdw_dev_lock); + + slave->probed =3D false; + if (drv->remove) ret =3D drv->remove(slave); =20 + mutex_unlock(&slave->sdw_dev_lock); + dev_pm_domain_detach(dev, false); =20 return ret; diff --git a/drivers/soundwire/slave.c b/drivers/soundwire/slave.c index 669d7573320b..25e76b5d4a1a 100644 --- a/drivers/soundwire/slave.c +++ b/drivers/soundwire/slave.c @@ -12,6 +12,7 @@ static void sdw_slave_release(struct device *dev) { struct sdw_slave *slave =3D dev_to_sdw_dev(dev); =20 + mutex_destroy(&slave->sdw_dev_lock); kfree(slave); } =20 @@ -58,9 +59,9 @@ int sdw_slave_add(struct sdw_bus *bus, init_completion(&slave->enumeration_complete); init_completion(&slave->initialization_complete); slave->dev_num =3D 0; - init_completion(&slave->probe_complete); slave->probed =3D false; slave->first_interrupt_done =3D false; + mutex_init(&slave->sdw_dev_lock); =20 for (i =3D 0; i < SDW_MAX_PORTS; i++) init_completion(&slave->port_ready[i]); diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c index 5d4f6b308ef7..ebbe138a5626 100644 --- a/drivers/soundwire/stream.c +++ b/drivers/soundwire/stream.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include "bus.h" =20 @@ -401,20 +402,26 @@ static int sdw_do_port_prep(struct sdw_slave_runtime = *s_rt, struct sdw_prepare_ch prep_ch, enum sdw_port_prep_ops cmd) { - const struct sdw_slave_ops *ops =3D s_rt->slave->ops; - int ret; + int ret =3D 0; + struct sdw_slave *slave =3D s_rt->slave; =20 - if (ops->port_prep) { - ret =3D ops->port_prep(s_rt->slave, &prep_ch, cmd); - if (ret < 0) { - dev_err(&s_rt->slave->dev, - "Slave Port Prep cmd %d failed: %d\n", - cmd, ret); - return ret; + mutex_lock(&slave->sdw_dev_lock); + + if (slave->probed) { + struct device *dev =3D &slave->dev; + struct sdw_driver *drv =3D drv_to_sdw_driver(dev->driver); + + if (drv->ops && drv->ops->port_prep) { + ret =3D drv->ops->port_prep(slave, &prep_ch, cmd); + if (ret < 0) + dev_err(dev, "Slave Port Prep cmd %d failed: %d\n", + cmd, ret); } } =20 - return 0; + mutex_unlock(&slave->sdw_dev_lock); + + return ret; } =20 static int sdw_prep_deprep_slave_ports(struct sdw_bus *bus, @@ -578,7 +585,7 @@ static int sdw_notify_config(struct sdw_master_runtime = *m_rt) struct sdw_slave_runtime *s_rt; struct sdw_bus *bus =3D m_rt->bus; struct sdw_slave *slave; - int ret =3D 0; + int ret; =20 if (bus->ops->set_bus_conf) { ret =3D bus->ops->set_bus_conf(bus, &bus->params); @@ -589,17 +596,27 @@ static int sdw_notify_config(struct sdw_master_runtim= e *m_rt) list_for_each_entry(s_rt, &m_rt->slave_rt_list, m_rt_node) { slave =3D s_rt->slave; =20 - if (slave->ops->bus_config) { - ret =3D slave->ops->bus_config(slave, &bus->params); - if (ret < 0) { - dev_err(bus->dev, "Notify Slave: %d failed\n", - slave->dev_num); - return ret; + mutex_lock(&slave->sdw_dev_lock); + + if (slave->probed) { + struct device *dev =3D &slave->dev; + struct sdw_driver *drv =3D drv_to_sdw_driver(dev->driver); + + if (drv->ops && drv->ops->bus_config) { + ret =3D drv->ops->bus_config(slave, &bus->params); + if (ret < 0) { + dev_err(dev, "Notify Slave: %d failed\n", + slave->dev_num); + mutex_unlock(&slave->sdw_dev_lock); + return ret; + } } } + + mutex_unlock(&slave->sdw_dev_lock); } =20 - return ret; + return 0; } =20 /** diff --git a/include/linux/soundwire/sdw.h b/include/linux/soundwire/sdw.h index 76ce3f3ac0f2..bf6f0decb3f6 100644 --- a/include/linux/soundwire/sdw.h +++ b/include/linux/soundwire/sdw.h @@ -646,9 +646,6 @@ struct sdw_slave_ops { * @dev_num: Current Device Number, values can be 0 or dev_num_sticky * @dev_num_sticky: one-time static Device Number assigned by Bus * @probed: boolean tracking driver state - * @probe_complete: completion utility to control potential races - * on startup between driver probe/initialization and SoundWire - * Slave state changes/implementation-defined interrupts * @enumeration_complete: completion utility to control potential races * on startup between device enumeration and read/write access to the * Slave device @@ -663,6 +660,7 @@ struct sdw_slave_ops { * for a Slave happens for the first time after enumeration * @is_mockup_device: status flag used to squelch errors in the command/co= ntrol * protocol for SoundWire mockup devices + * @sdw_dev_lock: mutex used to protect callbacks/remove races */ struct sdw_slave { struct sdw_slave_id id; @@ -680,12 +678,12 @@ struct sdw_slave { u16 dev_num; u16 dev_num_sticky; bool probed; - struct completion probe_complete; struct completion enumeration_complete; struct completion initialization_complete; u32 unattach_request; bool first_interrupt_done; bool is_mockup_device; + struct mutex sdw_dev_lock; /* protect callbacks/remove races */ }; =20 #define dev_to_sdw_dev(_dev) container_of(_dev, struct sdw_slave, dev) --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31111C00140 for ; Mon, 15 Aug 2022 19:14:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242737AbiHOTOz (ORCPT ); Mon, 15 Aug 2022 15:14:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344143AbiHOTLu (ORCPT ); Mon, 15 Aug 2022 15:11:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AA1150188; Mon, 15 Aug 2022 11:37: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 D6D866113C; Mon, 15 Aug 2022 18:37:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDF8CC4314B; Mon, 15 Aug 2022 18:37:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588635; bh=XaMbj9V8F6cyjECBekjmkj0GXiceZTtqfdngt5Y36Lg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eZV4FbM4ENjF7vSQCfyutLbQAf6JlnATwPA1XE6KisXZuIecQ/EIFrjhPj0PvVq2y ijtreCzYRjoMm6AVvYI6qaQQb1e7iPBpfezj701wefV9OIzT09Xmjkxkh3EVDMEWQe TlfUwMZs2zCJOJEGM5HWnpStSkyhOLa2cxMNwzro= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quentin Perret , Marc Zyngier , Sasha Levin Subject: [PATCH 5.15 467/779] KVM: arm64: Dont return from void function Date: Mon, 15 Aug 2022 20:01:51 +0200 Message-Id: <20220815180357.260035085@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Perret [ Upstream commit 1c3ace2b8b3995d3213c5e2d2aca01a0577a3b0f ] Although harmless, the return statement in kvm_unexpected_el2_exception is rather confusing as the function itself has a void return type. The C standard is also pretty clear that "A return statement with an expression shall not appear in a function whose return type is void". Given that this return statement does not seem to add any actual value, let's not pointlessly violate the standard. Build-tested with GCC 10 and CLANG 13 for good measure, the disassembled code is identical with or without the return statement. Fixes: e9ee186bb735 ("KVM: arm64: Add kvm_extable for vaxorcism code") Signed-off-by: Quentin Perret Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20220705142310.3847918-1-qperret@google.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm64/kvm/hyp/nvhe/switch.c | 2 +- arch/arm64/kvm/hyp/vhe/switch.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kvm/hyp/nvhe/switch.c b/arch/arm64/kvm/hyp/nvhe/swi= tch.c index a34b01cc8ab9..4db5409f40c4 100644 --- a/arch/arm64/kvm/hyp/nvhe/switch.c +++ b/arch/arm64/kvm/hyp/nvhe/switch.c @@ -279,5 +279,5 @@ void __noreturn hyp_panic(void) =20 asmlinkage void kvm_unexpected_el2_exception(void) { - return __kvm_unexpected_el2_exception(); + __kvm_unexpected_el2_exception(); } diff --git a/arch/arm64/kvm/hyp/vhe/switch.c b/arch/arm64/kvm/hyp/vhe/switc= h.c index d88d3c143a73..813e6e2178c1 100644 --- a/arch/arm64/kvm/hyp/vhe/switch.c +++ b/arch/arm64/kvm/hyp/vhe/switch.c @@ -220,5 +220,5 @@ void __noreturn hyp_panic(void) =20 asmlinkage void kvm_unexpected_el2_exception(void) { - return __kvm_unexpected_el2_exception(); + __kvm_unexpected_el2_exception(); } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1C1BC00140 for ; Mon, 15 Aug 2022 19:15:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344085AbiHOTP2 (ORCPT ); Mon, 15 Aug 2022 15:15:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344175AbiHOTLy (ORCPT ); Mon, 15 Aug 2022 15:11:54 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80BFF501B9; Mon, 15 Aug 2022 11:37:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 95998B81082; Mon, 15 Aug 2022 18:37:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6C38C433D7; Mon, 15 Aug 2022 18:37:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588638; bh=N3qyH8pGWQC5ePmuhX+7tI2CgB4S9Qep2kWgA+wiwOI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OD5MI6sUqQZ4lyiBUL514vQ9H35/P3bZlWIxj0zrboqzAoCNTeQHgPuqeLdWpzDQ0 l2Cd0b5xwhhETT8xaM2qz39je8LsE4JwZS2+KzJY0QagJaj6pvfNwppuP2jn6j93ps TjAhaMcisxaQ0rs+vWgf/GLWWQ5LAURKWnITHyww= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Viacheslav Mitrofanov , Vinod Koul , Sasha Levin Subject: [PATCH 5.15 468/779] dmaengine: sf-pdma: Add multithread support for a DMA channel Date: Mon, 15 Aug 2022 20:01:52 +0200 Message-Id: <20220815180357.300353993@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Viacheslav Mitrofanov [ Upstream commit b2cc5c465c2cb8ab697c3fd6583c614e3f6cfbcc ] When we get a DMA channel and try to use it in multiple threads it will cause oops and hanging the system. % echo 64 > /sys/module/dmatest/parameters/threads_per_chan % echo 10000 > /sys/module/dmatest/parameters/iterations % echo 1 > /sys/module/dmatest/parameters/run [ 89.480664] Unable to handle kernel NULL pointer dereference at virtual address 00000000000000a0 [ 89.488725] Oops [#1] [ 89.494708] CPU: 2 PID: 1008 Comm: dma0chan0-copy0 Not tainted 5.17.0-rc5 [ 89.509385] epc : vchan_find_desc+0x32/0x46 [ 89.513553] ra : sf_pdma_tx_status+0xca/0xd6 This happens because of data race. Each thread rewrite channels's descriptor as soon as device_prep_dma_memcpy() is called. It leads to the situation when the driver thinks that it uses right descriptor that actually is freed or substituted for other one. With current fixes a descriptor changes its value only when it has been used. A new descriptor is acquired from vc->desc_issued queue that is already filled with descriptors that are ready to be sent. Threads have no direct access to DMA channel descriptor. Now it is just possible to queue a descriptor for further processing. Fixes: 6973886ad58e ("dmaengine: sf-pdma: add platform DMA support for HiFi= ve Unleashed A00") Signed-off-by: Viacheslav Mitrofanov Link: https://lore.kernel.org/r/20220701082942.12835-1-v.v.mitrofanov@yadro= .com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/dma/sf-pdma/sf-pdma.c | 44 ++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/drivers/dma/sf-pdma/sf-pdma.c b/drivers/dma/sf-pdma/sf-pdma.c index f12606aeff87..ab0ad7a2f201 100644 --- a/drivers/dma/sf-pdma/sf-pdma.c +++ b/drivers/dma/sf-pdma/sf-pdma.c @@ -52,16 +52,6 @@ static inline struct sf_pdma_desc *to_sf_pdma_desc(struc= t virt_dma_desc *vd) static struct sf_pdma_desc *sf_pdma_alloc_desc(struct sf_pdma_chan *chan) { struct sf_pdma_desc *desc; - unsigned long flags; - - spin_lock_irqsave(&chan->lock, flags); - - if (chan->desc && !chan->desc->in_use) { - spin_unlock_irqrestore(&chan->lock, flags); - return chan->desc; - } - - spin_unlock_irqrestore(&chan->lock, flags); =20 desc =3D kzalloc(sizeof(*desc), GFP_NOWAIT); if (!desc) @@ -111,7 +101,6 @@ sf_pdma_prep_dma_memcpy(struct dma_chan *dchan, dma_add= r_t dest, dma_addr_t src, desc->async_tx =3D vchan_tx_prep(&chan->vchan, &desc->vdesc, flags); =20 spin_lock_irqsave(&chan->vchan.lock, iflags); - chan->desc =3D desc; sf_pdma_fill_desc(desc, dest, src, len); spin_unlock_irqrestore(&chan->vchan.lock, iflags); =20 @@ -170,11 +159,17 @@ static size_t sf_pdma_desc_residue(struct sf_pdma_cha= n *chan, unsigned long flags; u64 residue =3D 0; struct sf_pdma_desc *desc; - struct dma_async_tx_descriptor *tx; + struct dma_async_tx_descriptor *tx =3D NULL; =20 spin_lock_irqsave(&chan->vchan.lock, flags); =20 - tx =3D &chan->desc->vdesc.tx; + list_for_each_entry(vd, &chan->vchan.desc_submitted, node) + if (vd->tx.cookie =3D=3D cookie) + tx =3D &vd->tx; + + if (!tx) + goto out; + if (cookie =3D=3D tx->chan->completed_cookie) goto out; =20 @@ -241,6 +236,19 @@ static void sf_pdma_enable_request(struct sf_pdma_chan= *chan) writel(v, regs->ctrl); } =20 +static struct sf_pdma_desc *sf_pdma_get_first_pending_desc(struct sf_pdma_= chan *chan) +{ + struct virt_dma_chan *vchan =3D &chan->vchan; + struct virt_dma_desc *vdesc; + + if (list_empty(&vchan->desc_issued)) + return NULL; + + vdesc =3D list_first_entry(&vchan->desc_issued, struct virt_dma_desc, nod= e); + + return container_of(vdesc, struct sf_pdma_desc, vdesc); +} + static void sf_pdma_xfer_desc(struct sf_pdma_chan *chan) { struct sf_pdma_desc *desc =3D chan->desc; @@ -268,8 +276,11 @@ static void sf_pdma_issue_pending(struct dma_chan *dch= an) =20 spin_lock_irqsave(&chan->vchan.lock, flags); =20 - if (vchan_issue_pending(&chan->vchan) && chan->desc) + if (!chan->desc && vchan_issue_pending(&chan->vchan)) { + /* vchan_issue_pending has made a check that desc in not NULL */ + chan->desc =3D sf_pdma_get_first_pending_desc(chan); sf_pdma_xfer_desc(chan); + } =20 spin_unlock_irqrestore(&chan->vchan.lock, flags); } @@ -298,6 +309,11 @@ static void sf_pdma_donebh_tasklet(struct tasklet_stru= ct *t) spin_lock_irqsave(&chan->vchan.lock, flags); list_del(&chan->desc->vdesc.node); vchan_cookie_complete(&chan->desc->vdesc); + + chan->desc =3D sf_pdma_get_first_pending_desc(chan); + if (chan->desc) + sf_pdma_xfer_desc(chan); + spin_unlock_irqrestore(&chan->vchan.lock, flags); } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4EC20C25B0E for ; Mon, 15 Aug 2022 19:15:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344067AbiHOTPM (ORCPT ); Mon, 15 Aug 2022 15:15:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344160AbiHOTLw (ORCPT ); Mon, 15 Aug 2022 15:11:52 -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 EDB5450718; Mon, 15 Aug 2022 11:37: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 15F7360FC4; Mon, 15 Aug 2022 18:37:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D8C6C433D7; Mon, 15 Aug 2022 18:37:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588641; bh=sT5pL6cUl6cZxcolgG5Lty5iulljWSDOK+DQZab1v8I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gZgpwNRGPncyC6KhrIjcPYPe3zAxzX+xdVQrwrIGuna5I/8smZg4k2ozEFtpEFw17 GT9dvyKe4g7x9EtjFaIv8DAZ7wWe1yngtxzkHfBeQLY8QWkoox1owL6h+Butq8FHWR B6zOzPCMjbV076VTBuYMnpsBA5mIKeSgF9tB//iI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shunsuke Mie , Bjorn Helgaas , Kishon Vijay Abraham I , Sasha Levin Subject: [PATCH 5.15 469/779] PCI: endpoint: Dont stop controller when unbinding endpoint function Date: Mon, 15 Aug 2022 20:01:53 +0200 Message-Id: <20220815180357.348803001@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shunsuke Mie [ Upstream commit 1bc2b7bfba6e2f64edf5e246f3af2967261f6c3d ] Unbinding an endpoint function from the endpoint controller shouldn't stop the controller. This is especially a problem for multi-function endpoints where other endpoints may still be active. Don't stop the controller when unbinding one of its endpoints. Normally the controller is stopped via configfs. Fixes: 349e7a85b25f ("PCI: endpoint: functions: Add an EP function to test = PCI") Link: https://lore.kernel.org/r/20220622040924.113279-1-mie@igel.co.jp Signed-off-by: Shunsuke Mie Signed-off-by: Bjorn Helgaas Acked-by: Kishon Vijay Abraham I Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/pci/endpoint/functions/pci-epf-test.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/en= dpoint/functions/pci-epf-test.c index 5b833f00e980..a5ed779b0a51 100644 --- a/drivers/pci/endpoint/functions/pci-epf-test.c +++ b/drivers/pci/endpoint/functions/pci-epf-test.c @@ -627,7 +627,6 @@ static void pci_epf_test_unbind(struct pci_epf *epf) =20 cancel_delayed_work(&epf_test->cmd_handler); pci_epf_test_clean_dma_chan(epf_test); - pci_epc_stop(epc); for (bar =3D 0; bar < PCI_STD_NUM_BARS; bar++) { epf_bar =3D &epf->bar[bar]; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 891AEC00140 for ; Mon, 15 Aug 2022 19:18:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344102AbiHOTPi (ORCPT ); Mon, 15 Aug 2022 15:15:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343801AbiHOTNB (ORCPT ); Mon, 15 Aug 2022 15:13:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 486A95073C; Mon, 15 Aug 2022 11:37: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 320A0610A4; Mon, 15 Aug 2022 18:37:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 388B6C433C1; Mon, 15 Aug 2022 18:37:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588644; bh=8UyRwPRI9GXPc89UbffERA3S7rsrfc9rjDhGIYxXX4k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HtpJOKshq3UzQwEAIJZ3iqX2HGjcz/lxOPHrgWrz72lOAUsyabGZjUZBAbM/vaZBn aRwcKS8qb30lg8VF11/7bL0fhU91VQpl1lv77vB5qpMXKBtdRkesw8eYVQjQMBC84e T8dLyxpyqyw28zyjaZIZTbYLbJ9fEp3ByDpgw0AQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.15 470/779] scsi: qla2xxx: Check correct variable in qla24xx_async_gffid() Date: Mon, 15 Aug 2022 20:01:54 +0200 Message-Id: <20220815180357.386650944@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter [ Upstream commit 7c33e477bd883f79cccec418980cb8f7f2d50347 ] There is a copy and paste bug here. It should check ".rsp" instead of ".req". The error message is copy and pasted as well so update that too. Link: https://lore.kernel.org/r/YrK1A/t3L6HKnswO@kili Fixes: 9c40c36e75ff ("scsi: qla2xxx: edif: Reduce Initiator-Initiator thras= hing") Signed-off-by: Dan Carpenter Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_gs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c index f89911beaade..2c49f12078ac 100644 --- a/drivers/scsi/qla2xxx/qla_gs.c +++ b/drivers/scsi/qla2xxx/qla_gs.c @@ -3385,9 +3385,9 @@ int qla24xx_async_gffid(scsi_qla_host_t *vha, fc_port= _t *fcport, bool wait) sp->u.iocb_cmd.u.ctarg.rsp_allocated_size, &sp->u.iocb_cmd.u.ctarg.rsp_dma, GFP_KERNEL); - if (!sp->u.iocb_cmd.u.ctarg.req) { + if (!sp->u.iocb_cmd.u.ctarg.rsp) { ql_log(ql_log_warn, vha, 0xd041, - "%s: Failed to allocate ct_sns request.\n", + "%s: Failed to allocate ct_sns response.\n", __func__); goto done_free_sp; } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 571FCC00140 for ; Mon, 15 Aug 2022 19:15:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240572AbiHOTPe (ORCPT ); Mon, 15 Aug 2022 15:15:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343765AbiHOTM5 (ORCPT ); Mon, 15 Aug 2022 15:12:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 024CB3C161; Mon, 15 Aug 2022 11:37: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 DD075B81084; Mon, 15 Aug 2022 18:37:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49787C433C1; Mon, 15 Aug 2022 18:37:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588647; bh=49uVIo5yxX6YOHCXdzDZ21EmAzU5bpz2xA4aVGHhjq0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DGAHdoc+p2cIhGncnPv+8SkxqWklJhf/rdmN5GB1wLSdSwuh9auqSdMhIkvx1iKCs UYUHo+NyG3KBQYIcaq7TVrMHyozeb6Sc1cX3J1VpHqRgbBZqTzCCkMCgdcdXEdi8HY CneIOYxFMVHaNdasn3LY681aLw5Nzt0Ro2GRzMec= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , Christophe JAILLET , Alexander Shishkin , Sasha Levin Subject: [PATCH 5.15 471/779] intel_th: Fix a resource leak in an error handling path Date: Mon, 15 Aug 2022 20:01:55 +0200 Message-Id: <20220815180357.417846191@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET [ Upstream commit 086c28ab7c5699256aced0049aae9c42f1410313 ] If an error occurs after calling 'pci_alloc_irq_vectors()', 'pci_free_irq_vectors()' must be called as already done in the remove function. Fixes: 7b7036d47c35 ("intel_th: pci: Use MSI interrupt signalling") Reviewed-by: Andy Shevchenko Signed-off-by: Christophe JAILLET Signed-off-by: Alexander Shishkin Link: https://lore.kernel.org/r/20220705082637.59979-2-alexander.shishkin@l= inux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/hwtracing/intel_th/pci.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/intel_th/pci.c b/drivers/hwtracing/intel_th/= pci.c index 7da4f298ed01..fcd0aca75007 100644 --- a/drivers/hwtracing/intel_th/pci.c +++ b/drivers/hwtracing/intel_th/pci.c @@ -100,8 +100,10 @@ static int intel_th_pci_probe(struct pci_dev *pdev, } =20 th =3D intel_th_alloc(&pdev->dev, drvdata, resource, r); - if (IS_ERR(th)) - return PTR_ERR(th); + if (IS_ERR(th)) { + err =3D PTR_ERR(th); + goto err_free_irq; + } =20 th->activate =3D intel_th_pci_activate; th->deactivate =3D intel_th_pci_deactivate; @@ -109,6 +111,10 @@ static int intel_th_pci_probe(struct pci_dev *pdev, pci_set_master(pdev); =20 return 0; + +err_free_irq: + pci_free_irq_vectors(pdev); + return err; } =20 static void intel_th_pci_remove(struct pci_dev *pdev) --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 120CDC25B0E for ; Mon, 15 Aug 2022 19:18:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344122AbiHOTPt (ORCPT ); Mon, 15 Aug 2022 15:15:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59070 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343790AbiHOTNA (ORCPT ); Mon, 15 Aug 2022 15:13: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 7C9E651429; Mon, 15 Aug 2022 11:37: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 3C54F6113D; Mon, 15 Aug 2022 18:37:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4224DC433D7; Mon, 15 Aug 2022 18:37:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588650; bh=Vi5nOn57Hq/yjy93n2CxGZ9yBwsNUVNFG9Sh/CociKg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EuNWWr5BoPdv9NymjfIOHdAs+hnZ4rZwQoF8Lh1bfBKOxw98gJYqKVA/zjAJTO0ul tD0XQd/2SAFhC0NnmipAjL0joFrzfqclxU/oyJWAaJYs30gxe84rRI1TN2zVjbOYbu 6MqG/wCC6AShyXlPSyK8TQzNH+6otCOzAuHdJ6I0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , Jiasheng Jiang , Alexander Shishkin , Sasha Levin Subject: [PATCH 5.15 472/779] intel_th: msu-sink: Potential dereference of null pointer Date: Mon, 15 Aug 2022 20:01:56 +0200 Message-Id: <20220815180357.464305629@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiasheng Jiang [ Upstream commit 82f76a4a720791d889de775b5f7541d601efc8bd ] The return value of dma_alloc_coherent() needs to be checked. To avoid use of null pointer in sg_set_buf() in case of the failure of alloc. Fixes: f220df66f676 ("intel_th: msu-sink: An example msu buffer "sink"") Reviewed-by: Andy Shevchenko Signed-off-by: Jiasheng Jiang Signed-off-by: Alexander Shishkin Link: https://lore.kernel.org/r/20220705082637.59979-3-alexander.shishkin@l= inux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/hwtracing/intel_th/msu-sink.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/hwtracing/intel_th/msu-sink.c b/drivers/hwtracing/inte= l_th/msu-sink.c index 2c7f5116be12..891b28ea25fe 100644 --- a/drivers/hwtracing/intel_th/msu-sink.c +++ b/drivers/hwtracing/intel_th/msu-sink.c @@ -71,6 +71,9 @@ static int msu_sink_alloc_window(void *data, struct sg_ta= ble **sgt, size_t size) block =3D dma_alloc_coherent(priv->dev->parent->parent, PAGE_SIZE, &sg_dma_address(sg_ptr), GFP_KERNEL); + if (!block) + return -ENOMEM; + sg_set_buf(sg_ptr, block, PAGE_SIZE); } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC3BDC00140 for ; Mon, 15 Aug 2022 19:18:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344204AbiHOTQH (ORCPT ); Mon, 15 Aug 2022 15:16:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241407AbiHOTNi (ORCPT ); Mon, 15 Aug 2022 15:13:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EF1C51A17; Mon, 15 Aug 2022 11:37: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 9574760FC4; Mon, 15 Aug 2022 18:37:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96941C433C1; Mon, 15 Aug 2022 18:37:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588654; bh=0RS1MmN86UN8i8zMV6nez1c6juO8rb3/MzSELu75oQs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yXCbIHLW23xNZasefVzcR2ce4671xRPR+00MMaMGxel6uzRBgD33td8wD5Xw59RII tbfhZ6lY+9agXCCBPx3IanFKWPrZ5z0hx0/MbVp9xFN3uSxvjqoYKfApsoIj4CVp4m o30XJgi+EBKcGUVezkG3pS60E8KDuVafvAXiqkoE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , Alexander Shishkin , Sasha Levin Subject: [PATCH 5.15 473/779] intel_th: msu: Fix vmalloced buffers Date: Mon, 15 Aug 2022 20:01:57 +0200 Message-Id: <20220815180357.503818464@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Shishkin [ Upstream commit ac12ad3ccf6d386e64a9d6a890595a2509d24edd ] After commit f5ff79fddf0e ("dma-mapping: remove CONFIG_DMA_REMAP") there's a chance of DMA buffer getting allocated via vmalloc(), which messes up the mmapping code: > RIP: msc_mmap_fault [intel_th_msu] > Call Trace: > > __do_fault > do_fault ... Fix this by accounting for vmalloc possibility. Fixes: ba39bd830605 ("intel_th: msu: Switch over to scatterlist") Reviewed-by: Andy Shevchenko Signed-off-by: Alexander Shishkin Link: https://lore.kernel.org/r/20220705082637.59979-4-alexander.shishkin@l= inux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/hwtracing/intel_th/msu.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/hwtracing/intel_th/msu.c b/drivers/hwtracing/intel_th/= msu.c index 432ade0842f6..d95d916b4682 100644 --- a/drivers/hwtracing/intel_th/msu.c +++ b/drivers/hwtracing/intel_th/msu.c @@ -1069,6 +1069,16 @@ msc_buffer_set_uc(struct msc *msc) {} static inline void msc_buffer_set_wb(struct msc *msc) {} #endif /* CONFIG_X86 */ =20 +static struct page *msc_sg_page(struct scatterlist *sg) +{ + void *addr =3D sg_virt(sg); + + if (is_vmalloc_addr(addr)) + return vmalloc_to_page(addr); + + return sg_page(sg); +} + /** * msc_buffer_win_alloc() - alloc a window for a multiblock mode * @msc: MSC device @@ -1139,7 +1149,7 @@ static void __msc_buffer_win_free(struct msc *msc, st= ruct msc_window *win) int i; =20 for_each_sg(win->sgt->sgl, sg, win->nr_segs, i) { - struct page *page =3D sg_page(sg); + struct page *page =3D msc_sg_page(sg); =20 page->mapping =3D NULL; dma_free_coherent(msc_dev(win->msc)->parent->parent, PAGE_SIZE, @@ -1403,7 +1413,7 @@ static struct page *msc_buffer_get_page(struct msc *m= sc, unsigned long pgoff) pgoff -=3D win->pgoff; =20 for_each_sg(win->sgt->sgl, sg, win->nr_segs, blk) { - struct page *page =3D sg_page(sg); + struct page *page =3D msc_sg_page(sg); size_t pgsz =3D PFN_DOWN(sg->length); =20 if (pgoff < pgsz) --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A395C25B0E for ; Mon, 15 Aug 2022 19:19:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241407AbiHOTSR (ORCPT ); Mon, 15 Aug 2022 15:18:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343785AbiHOTOH (ORCPT ); Mon, 15 Aug 2022 15:14:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC74051421; Mon, 15 Aug 2022 11:37: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 37A17B81081; Mon, 15 Aug 2022 18:37:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90728C433D6; Mon, 15 Aug 2022 18:37:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588657; bh=X3qPuLav52OOzYvZwltcATXGFNNz09hxt2osJYcE06Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h6hIDkD3nK0mZnygtbMiU0U6tsmIYQB1c3f8e1vo1SDrBeCAvr+Ak3l9LxEP5fnyJ qxuxbjtyOYA0vtlIw1HesNUhoVe2sy6t/0qoBuzVbmFaIAxnKvEMiUbmGy3tclu+6Z 4sFwMZ38FKHWTyRKG8g5SXZu2eeD+B7b2sk0gNcw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Carlos Llamas , Sasha Levin Subject: [PATCH 5.15 474/779] binder: fix redefinition of seq_file attributes Date: Mon, 15 Aug 2022 20:01:58 +0200 Message-Id: <20220815180357.535529555@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Carlos Llamas [ Upstream commit b7e241bbff24f9e106bf616408fd58bcedc44bae ] The patchset in [1] exported some definitions to binder_internal.h in order to make the debugfs entries such as 'stats' and 'transaction_log' available in a binderfs instance. However, the DEFINE_SHOW_ATTRIBUTE macro expands into a static function/variable pair, which in turn get redefined each time a source file includes this internal header. This problem was made evident after a report from the kernel test robot where several W=3D1 build warnings are seen in downstream kernels. See the following example: include/../drivers/android/binder_internal.h:111:23: warning: 'binder_sta= ts_fops' defined but not used [-Wunused-const-variable=3D] 111 | DEFINE_SHOW_ATTRIBUTE(binder_stats); | ^~~~~~~~~~~~ include/linux/seq_file.h:174:37: note: in definition of macro 'DEFINE_SHO= W_ATTRIBUTE' 174 | static const struct file_operations __name ## _fops =3D { = \ | ^~~~~~ This patch fixes the above issues by moving back the definitions into binder.c and instead creates an array of the debugfs entries which is more convenient to share with binderfs and iterate through. [1] https://lore.kernel.org/all/20190903161655.107408-1-hridya@google.com/ Fixes: 0e13e452dafc ("binder: Add stats, state and transactions files") Fixes: 03e2e07e3814 ("binder: Make transaction_log available in binderfs") Reported-by: kernel test robot Signed-off-by: Carlos Llamas Link: https://lore.kernel.org/r/20220701182041.2134313-1-cmllamas@google.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/android/binder.c | 114 +++++++++++++++++++++--------- drivers/android/binder_internal.h | 46 +++--------- drivers/android/binderfs.c | 47 +++--------- 3 files changed, 100 insertions(+), 107 deletions(-) diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 99ae919255f4..56a2387656a0 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -170,8 +170,32 @@ static inline void binder_stats_created(enum binder_st= at_types type) atomic_inc(&binder_stats.obj_created[type]); } =20 -struct binder_transaction_log binder_transaction_log; -struct binder_transaction_log binder_transaction_log_failed; +struct binder_transaction_log_entry { + int debug_id; + int debug_id_done; + int call_type; + int from_proc; + int from_thread; + int target_handle; + int to_proc; + int to_thread; + int to_node; + int data_size; + int offsets_size; + int return_error_line; + uint32_t return_error; + uint32_t return_error_param; + char context_name[BINDERFS_MAX_NAME + 1]; +}; + +struct binder_transaction_log { + atomic_t cur; + bool full; + struct binder_transaction_log_entry entry[32]; +}; + +static struct binder_transaction_log binder_transaction_log; +static struct binder_transaction_log binder_transaction_log_failed; =20 static struct binder_transaction_log_entry *binder_transaction_log_add( struct binder_transaction_log *log) @@ -5801,8 +5825,7 @@ static void print_binder_proc_stats(struct seq_file *= m, print_binder_stats(m, " ", &proc->stats); } =20 - -int binder_state_show(struct seq_file *m, void *unused) +static int state_show(struct seq_file *m, void *unused) { struct binder_proc *proc; struct binder_node *node; @@ -5841,7 +5864,7 @@ int binder_state_show(struct seq_file *m, void *unuse= d) return 0; } =20 -int binder_stats_show(struct seq_file *m, void *unused) +static int stats_show(struct seq_file *m, void *unused) { struct binder_proc *proc; =20 @@ -5857,7 +5880,7 @@ int binder_stats_show(struct seq_file *m, void *unuse= d) return 0; } =20 -int binder_transactions_show(struct seq_file *m, void *unused) +static int transactions_show(struct seq_file *m, void *unused) { struct binder_proc *proc; =20 @@ -5913,7 +5936,7 @@ static void print_binder_transaction_log_entry(struct= seq_file *m, "\n" : " (incomplete)\n"); } =20 -int binder_transaction_log_show(struct seq_file *m, void *unused) +static int transaction_log_show(struct seq_file *m, void *unused) { struct binder_transaction_log *log =3D m->private; unsigned int log_cur =3D atomic_read(&log->cur); @@ -5945,6 +5968,45 @@ const struct file_operations binder_fops =3D { .release =3D binder_release, }; =20 +DEFINE_SHOW_ATTRIBUTE(state); +DEFINE_SHOW_ATTRIBUTE(stats); +DEFINE_SHOW_ATTRIBUTE(transactions); +DEFINE_SHOW_ATTRIBUTE(transaction_log); + +const struct binder_debugfs_entry binder_debugfs_entries[] =3D { + { + .name =3D "state", + .mode =3D 0444, + .fops =3D &state_fops, + .data =3D NULL, + }, + { + .name =3D "stats", + .mode =3D 0444, + .fops =3D &stats_fops, + .data =3D NULL, + }, + { + .name =3D "transactions", + .mode =3D 0444, + .fops =3D &transactions_fops, + .data =3D NULL, + }, + { + .name =3D "transaction_log", + .mode =3D 0444, + .fops =3D &transaction_log_fops, + .data =3D &binder_transaction_log, + }, + { + .name =3D "failed_transaction_log", + .mode =3D 0444, + .fops =3D &transaction_log_fops, + .data =3D &binder_transaction_log_failed, + }, + {} /* terminator */ +}; + static int __init init_binder_device(const char *name) { int ret; @@ -5990,36 +6052,18 @@ static int __init binder_init(void) atomic_set(&binder_transaction_log_failed.cur, ~0U); =20 binder_debugfs_dir_entry_root =3D debugfs_create_dir("binder", NULL); - if (binder_debugfs_dir_entry_root) + if (binder_debugfs_dir_entry_root) { + const struct binder_debugfs_entry *db_entry; + + binder_for_each_debugfs_entry(db_entry) + debugfs_create_file(db_entry->name, + db_entry->mode, + binder_debugfs_dir_entry_root, + db_entry->data, + db_entry->fops); + binder_debugfs_dir_entry_proc =3D debugfs_create_dir("proc", binder_debugfs_dir_entry_root); - - if (binder_debugfs_dir_entry_root) { - debugfs_create_file("state", - 0444, - binder_debugfs_dir_entry_root, - NULL, - &binder_state_fops); - debugfs_create_file("stats", - 0444, - binder_debugfs_dir_entry_root, - NULL, - &binder_stats_fops); - debugfs_create_file("transactions", - 0444, - binder_debugfs_dir_entry_root, - NULL, - &binder_transactions_fops); - debugfs_create_file("transaction_log", - 0444, - binder_debugfs_dir_entry_root, - &binder_transaction_log, - &binder_transaction_log_fops); - debugfs_create_file("failed_transaction_log", - 0444, - binder_debugfs_dir_entry_root, - &binder_transaction_log_failed, - &binder_transaction_log_fops); } =20 if (!IS_ENABLED(CONFIG_ANDROID_BINDERFS) && diff --git a/drivers/android/binder_internal.h b/drivers/android/binder_int= ernal.h index d6b6b8cb7346..1ade9799c8d5 100644 --- a/drivers/android/binder_internal.h +++ b/drivers/android/binder_internal.h @@ -107,41 +107,19 @@ static inline int __init init_binderfs(void) } #endif =20 -int binder_stats_show(struct seq_file *m, void *unused); -DEFINE_SHOW_ATTRIBUTE(binder_stats); - -int binder_state_show(struct seq_file *m, void *unused); -DEFINE_SHOW_ATTRIBUTE(binder_state); - -int binder_transactions_show(struct seq_file *m, void *unused); -DEFINE_SHOW_ATTRIBUTE(binder_transactions); - -int binder_transaction_log_show(struct seq_file *m, void *unused); -DEFINE_SHOW_ATTRIBUTE(binder_transaction_log); - -struct binder_transaction_log_entry { - int debug_id; - int debug_id_done; - int call_type; - int from_proc; - int from_thread; - int target_handle; - int to_proc; - int to_thread; - int to_node; - int data_size; - int offsets_size; - int return_error_line; - uint32_t return_error; - uint32_t return_error_param; - char context_name[BINDERFS_MAX_NAME + 1]; +struct binder_debugfs_entry { + const char *name; + umode_t mode; + const struct file_operations *fops; + void *data; }; =20 -struct binder_transaction_log { - atomic_t cur; - bool full; - struct binder_transaction_log_entry entry[32]; -}; +extern const struct binder_debugfs_entry binder_debugfs_entries[]; + +#define binder_for_each_debugfs_entry(entry) \ + for ((entry) =3D binder_debugfs_entries; \ + (entry)->name; \ + (entry)++) =20 enum binder_stat_types { BINDER_STAT_PROC, @@ -575,6 +553,4 @@ struct binder_object { }; }; =20 -extern struct binder_transaction_log binder_transaction_log; -extern struct binder_transaction_log binder_transaction_log_failed; #endif /* _LINUX_BINDER_INTERNAL_H */ diff --git a/drivers/android/binderfs.c b/drivers/android/binderfs.c index e3605cdd4335..6d717ed76766 100644 --- a/drivers/android/binderfs.c +++ b/drivers/android/binderfs.c @@ -621,6 +621,7 @@ static int init_binder_features(struct super_block *sb) static int init_binder_logs(struct super_block *sb) { struct dentry *binder_logs_root_dir, *dentry, *proc_log_dir; + const struct binder_debugfs_entry *db_entry; struct binderfs_info *info; int ret =3D 0; =20 @@ -631,43 +632,15 @@ static int init_binder_logs(struct super_block *sb) goto out; } =20 - dentry =3D binderfs_create_file(binder_logs_root_dir, "stats", - &binder_stats_fops, NULL); - if (IS_ERR(dentry)) { - ret =3D PTR_ERR(dentry); - goto out; - } - - dentry =3D binderfs_create_file(binder_logs_root_dir, "state", - &binder_state_fops, NULL); - if (IS_ERR(dentry)) { - ret =3D PTR_ERR(dentry); - goto out; - } - - dentry =3D binderfs_create_file(binder_logs_root_dir, "transactions", - &binder_transactions_fops, NULL); - if (IS_ERR(dentry)) { - ret =3D PTR_ERR(dentry); - goto out; - } - - dentry =3D binderfs_create_file(binder_logs_root_dir, - "transaction_log", - &binder_transaction_log_fops, - &binder_transaction_log); - if (IS_ERR(dentry)) { - ret =3D PTR_ERR(dentry); - goto out; - } - - dentry =3D binderfs_create_file(binder_logs_root_dir, - "failed_transaction_log", - &binder_transaction_log_fops, - &binder_transaction_log_failed); - if (IS_ERR(dentry)) { - ret =3D PTR_ERR(dentry); - goto out; + binder_for_each_debugfs_entry(db_entry) { + dentry =3D binderfs_create_file(binder_logs_root_dir, + db_entry->name, + db_entry->fops, + db_entry->data); + if (IS_ERR(dentry)) { + ret =3D PTR_ERR(dentry); + goto out; + } } =20 proc_log_dir =3D binderfs_create_dir(binder_logs_root_dir, "proc"); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3DF75C00140 for ; Mon, 15 Aug 2022 19:18:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231573AbiHOTSZ (ORCPT ); Mon, 15 Aug 2022 15:18:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343762AbiHOTNz (ORCPT ); Mon, 15 Aug 2022 15:13:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CA3E52472; Mon, 15 Aug 2022 11:37: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 9DBC66114B; Mon, 15 Aug 2022 18:37:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B8E5C433C1; Mon, 15 Aug 2022 18:37:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588663; bh=boHXcxQtTXBVil/aIoI4ARENch7agbweuVxDGPVujyU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h/QnyFkBWlmuDGE0HhgweblroMhsxbI33v0RG7jGfQUGLt0Ccb+kWPJ5fmADMELnC Iy9IcQ1rbK3VSLC3KMeHgJNtWeHkrxpR4QzJkIrRmhC4wEY7LNMWq0SHLgtOusVG/X AC69kBE0Fr7f0QdGVBEIkphedfT3E/GnF9T3rYJw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Duoming Zhou , Sasha Levin Subject: [PATCH 5.15 475/779] staging: rtl8192u: Fix sleep in atomic context bug in dm_fsync_timer_callback Date: Mon, 15 Aug 2022 20:01:59 +0200 Message-Id: <20220815180357.584037574@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Duoming Zhou [ Upstream commit 6a0c054930d554ad8f8044ef1fc856d9da391c81 ] There are sleep in atomic context bugs when dm_fsync_timer_callback is executing. The root cause is that the memory allocation functions with GFP_KERNEL or GFP_NOIO parameters are called in dm_fsync_timer_callback which is a timer handler. The call paths that could trigger bugs are shown below: (interrupt context) dm_fsync_timer_callback write_nic_byte kzalloc(sizeof(data), GFP_KERNEL); //may sleep usb_control_msg kmalloc(.., GFP_NOIO); //may sleep write_nic_dword kzalloc(sizeof(data), GFP_KERNEL); //may sleep usb_control_msg kmalloc(.., GFP_NOIO); //may sleep This patch uses delayed work to replace timer and moves the operations that may sleep into the delayed work in order to mitigate bugs. Fixes: 8fc8598e61f6 ("Staging: Added Realtek rtl8192u driver to staging") Signed-off-by: Duoming Zhou Link: https://lore.kernel.org/r/20220710103002.63283-1-duoming@zju.edu.cn Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/staging/rtl8192u/r8192U.h | 2 +- drivers/staging/rtl8192u/r8192U_dm.c | 38 +++++++++++++--------------- drivers/staging/rtl8192u/r8192U_dm.h | 2 +- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U.h b/drivers/staging/rtl8192u/r= 8192U.h index 4013107cd93a..a23d6d41de9d 100644 --- a/drivers/staging/rtl8192u/r8192U.h +++ b/drivers/staging/rtl8192u/r8192U.h @@ -1013,7 +1013,7 @@ typedef struct r8192_priv { bool bis_any_nonbepkts; bool bcurrent_turbo_EDCA; bool bis_cur_rdlstate; - struct timer_list fsync_timer; + struct delayed_work fsync_work; bool bfsync_processing; /* 500ms Fsync timer is active or not */ u32 rate_record; u32 rateCountDiffRecord; diff --git a/drivers/staging/rtl8192u/r8192U_dm.c b/drivers/staging/rtl8192= u/r8192U_dm.c index 725bf5ca9e34..0fcfcaa6500b 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.c +++ b/drivers/staging/rtl8192u/r8192U_dm.c @@ -2578,19 +2578,20 @@ static void dm_init_fsync(struct net_device *dev) priv->ieee80211->fsync_seconddiff_ratethreshold =3D 200; priv->ieee80211->fsync_state =3D Default_Fsync; priv->framesyncMonitor =3D 1; /* current default 0xc38 monitor on */ - timer_setup(&priv->fsync_timer, dm_fsync_timer_callback, 0); + INIT_DELAYED_WORK(&priv->fsync_work, dm_fsync_work_callback); } =20 static void dm_deInit_fsync(struct net_device *dev) { struct r8192_priv *priv =3D ieee80211_priv(dev); =20 - del_timer_sync(&priv->fsync_timer); + cancel_delayed_work_sync(&priv->fsync_work); } =20 -void dm_fsync_timer_callback(struct timer_list *t) +void dm_fsync_work_callback(struct work_struct *work) { - struct r8192_priv *priv =3D from_timer(priv, t, fsync_timer); + struct r8192_priv *priv =3D + container_of(work, struct r8192_priv, fsync_work.work); struct net_device *dev =3D priv->ieee80211->dev; u32 rate_index, rate_count =3D 0, rate_count_diff =3D 0; bool bSwitchFromCountDiff =3D false; @@ -2657,17 +2658,16 @@ void dm_fsync_timer_callback(struct timer_list *t) } } if (bDoubleTimeInterval) { - if (timer_pending(&priv->fsync_timer)) - del_timer_sync(&priv->fsync_timer); - priv->fsync_timer.expires =3D jiffies + - msecs_to_jiffies(priv->ieee80211->fsync_time_interval*priv->ieee80211-= >fsync_multiple_timeinterval); - add_timer(&priv->fsync_timer); + cancel_delayed_work_sync(&priv->fsync_work); + schedule_delayed_work(&priv->fsync_work, + msecs_to_jiffies(priv + ->ieee80211->fsync_time_interval * + priv->ieee80211->fsync_multiple_timeinterval)); } else { - if (timer_pending(&priv->fsync_timer)) - del_timer_sync(&priv->fsync_timer); - priv->fsync_timer.expires =3D jiffies + - msecs_to_jiffies(priv->ieee80211->fsync_time_interval); - add_timer(&priv->fsync_timer); + cancel_delayed_work_sync(&priv->fsync_work); + schedule_delayed_work(&priv->fsync_work, + msecs_to_jiffies(priv + ->ieee80211->fsync_time_interval)); } } else { /* Let Register return to default value; */ @@ -2695,7 +2695,7 @@ static void dm_EndSWFsync(struct net_device *dev) struct r8192_priv *priv =3D ieee80211_priv(dev); =20 RT_TRACE(COMP_HALDM, "%s\n", __func__); - del_timer_sync(&(priv->fsync_timer)); + cancel_delayed_work_sync(&priv->fsync_work); =20 /* Let Register return to default value; */ if (priv->bswitch_fsync) { @@ -2736,11 +2736,9 @@ static void dm_StartSWFsync(struct net_device *dev) if (priv->ieee80211->fsync_rate_bitmap & rateBitmap) priv->rate_record +=3D priv->stats.received_rate_histogram[1][rateIndex= ]; } - if (timer_pending(&priv->fsync_timer)) - del_timer_sync(&priv->fsync_timer); - priv->fsync_timer.expires =3D jiffies + - msecs_to_jiffies(priv->ieee80211->fsync_time_interval); - add_timer(&priv->fsync_timer); + cancel_delayed_work_sync(&priv->fsync_work); + schedule_delayed_work(&priv->fsync_work, + msecs_to_jiffies(priv->ieee80211->fsync_time_interval)); =20 write_nic_dword(dev, rOFDM0_RxDetector2, 0x465c12cd); } diff --git a/drivers/staging/rtl8192u/r8192U_dm.h b/drivers/staging/rtl8192= u/r8192U_dm.h index 0b2a1c688597..2159018b4e38 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.h +++ b/drivers/staging/rtl8192u/r8192U_dm.h @@ -166,7 +166,7 @@ void dm_force_tx_fw_info(struct net_device *dev, void dm_init_edca_turbo(struct net_device *dev); void dm_rf_operation_test_callback(unsigned long data); void dm_rf_pathcheck_workitemcallback(struct work_struct *work); -void dm_fsync_timer_callback(struct timer_list *t); +void dm_fsync_work_callback(struct work_struct *work); void dm_cck_txpower_adjust(struct net_device *dev, bool binch14); void dm_shadow_init(struct net_device *dev); void dm_initialize_txpower_tracking(struct net_device *dev); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC869C00140 for ; Mon, 15 Aug 2022 19:18:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244753AbiHOTSh (ORCPT ); Mon, 15 Aug 2022 15:18:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344110AbiHOTPp (ORCPT ); Mon, 15 Aug 2022 15:15:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F4EE3C8C5; Mon, 15 Aug 2022 11:37: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 E14F961124; Mon, 15 Aug 2022 18:37:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CCA99C4314B; Mon, 15 Aug 2022 18:37:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588666; bh=23kjo+ZyjcPrClieeyY9KVDu2cu6m5ks6/6ZF6W79Iw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wTagRhAYFTtG0MPnQ/s/l/zuhpanh8GzeFyneKEKiBginfrSt1CoRS7HIWPRL4qu4 Adk/RsC7PhA7EB2aCbbX5UZrYUug3POc1BTgmCRVuHw1d58UrNkV++7iHE8PvfCA+n KNC9MM8fO8BKdAeDUChbXFSvV8gKzEtx1mLyuAd8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Ulf Hansson , Sasha Levin Subject: [PATCH 5.15 476/779] mmc: sdhci-of-esdhc: Fix refcount leak in esdhc_signal_voltage_switch Date: Mon, 15 Aug 2022 20:02:00 +0200 Message-Id: <20220815180357.629409233@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit b5899a3e2f783a27b268e38d37f9b24c71bddf45 ] of_find_matching_node() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. of_node_put() checks null pointer. Fixes: ea35645a3c66 ("mmc: sdhci-of-esdhc: add support for signal voltage s= witch") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220523144255.10310-1-linmq006@gmail.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/mmc/host/sdhci-of-esdhc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-= esdhc.c index 0f3658b36513..04a37fd137ee 100644 --- a/drivers/mmc/host/sdhci-of-esdhc.c +++ b/drivers/mmc/host/sdhci-of-esdhc.c @@ -904,6 +904,7 @@ static int esdhc_signal_voltage_switch(struct mmc_host = *mmc, scfg_node =3D of_find_matching_node(NULL, scfg_device_ids); if (scfg_node) scfg_base =3D of_iomap(scfg_node, 0); + of_node_put(scfg_node); if (scfg_base) { sdhciovselcr =3D SDHCIOVSELCR_TGLEN | SDHCIOVSELCR_VSELVAL; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B2B1C2BB41 for ; Mon, 15 Aug 2022 19:18:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343885AbiHOTS3 (ORCPT ); Mon, 15 Aug 2022 15:18:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344099AbiHOTPi (ORCPT ); Mon, 15 Aug 2022 15:15:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 109AA52DD8; Mon, 15 Aug 2022 11:37: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 A94DAB81081; Mon, 15 Aug 2022 18:37:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02D32C4314B; Mon, 15 Aug 2022 18:37:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588669; bh=dtE/VDMmk74avq+YClQMceAC7eWhmIxaLz/G5hJIfkY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2cJd6GOqD8xM3dQTlsXtXscR42vK8txQtnjZtv9sZEAXET3g9sTIVk3qd1v8ZIqtG au0zRcyvRQQbcCr8OSmHvGcecp+QlTS7VUzhNDOB26kdzEwP8inx3wn6mQ9lVlWGKp 4jBHjypS2EJ+Gr7FzmmcT3K4OGWnHKvs0/CA+BIw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Fabio Estevam , Ulf Hansson , Sasha Levin Subject: [PATCH 5.15 477/779] mmc: mxcmmc: Silence a clang warning Date: Mon, 15 Aug 2022 20:02:01 +0200 Message-Id: <20220815180357.661053375@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 7dc65e3c0ef4b746a583b7c58f99873fddf5ccfa ] Change the of_device_get_match_data() cast to (uintptr_t) to silence the following clang warning: drivers/mmc/host/mxcmmc.c:1028:18: warning: cast to smaller integer type 'e= num mxcmci_type' from 'const void *' [-Wvoid-pointer-to-enum-cast] Reported-by: kernel test robot Fixes: 8223e885e74b ("mmc: mxc: Convert the driver to DT-only") Signed-off-by: Fabio Estevam Link: https://lore.kernel.org/r/20220526010022.1163483-1-festevam@gmail.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/mmc/host/mxcmmc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mmc/host/mxcmmc.c b/drivers/mmc/host/mxcmmc.c index 2fe6fcdbb1b3..9bf95ba217fa 100644 --- a/drivers/mmc/host/mxcmmc.c +++ b/drivers/mmc/host/mxcmmc.c @@ -1025,7 +1025,7 @@ static int mxcmci_probe(struct platform_device *pdev) mmc->max_req_size =3D mmc->max_blk_size * mmc->max_blk_count; mmc->max_seg_size =3D mmc->max_req_size; =20 - host->devtype =3D (enum mxcmci_type)of_device_get_match_data(&pdev->dev); + host->devtype =3D (uintptr_t)of_device_get_match_data(&pdev->dev); =20 /* adjust max_segs after devtype detection */ if (!is_mpc512x_mmc(host)) --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56257C25B08 for ; Mon, 15 Aug 2022 19:19:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244830AbiHOTTC (ORCPT ); Mon, 15 Aug 2022 15:19:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344319AbiHOTQW (ORCPT ); Mon, 15 Aug 2022 15:16: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 C01CD52DFB; Mon, 15 Aug 2022 11:37: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 DCDC3B81085; Mon, 15 Aug 2022 18:37:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D3DFC433D6; Mon, 15 Aug 2022 18:37:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588672; bh=6mHqTLvsLe9gEjJsECa4NskXIAM/yP00pb612SforuM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xwty51L+3TcJnmwUMFzWp5y4HfEyu2Wis/PRfB35jfo4fhdBvG0KMzo+6ZYEXYNNW ldmpLVyiy8uMRuqpI7RoXTZ6w06VYku2A3Uf7yUIFAP5Hu40RlJFDYfIljhO9QGSVV jCMQgT0qqN63J9qw63EnNpIIiFwsArYvvYKXEdew= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Machek , Lad Prabhakar , Geert Uytterhoeven , Wolfram Sang , Ulf Hansson , Sasha Levin Subject: [PATCH 5.15 478/779] mmc: renesas_sdhi: Get the reset handle early in the probe Date: Mon, 15 Aug 2022 20:02:02 +0200 Message-Id: <20220815180357.702831259@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 0dac1e498f8130fdacfdd5289e3a7ac87ec1b9ad ] In case of devm_reset_control_get_optional_exclusive() failure we returned directly instead of jumping to the error path to roll back initialization. This patch moves devm_reset_control_get_optional_exclusive() early in the probe so that we have the reset handle prior to initialization of the hardware. Fixes: b4d86f37eacb7 ("mmc: renesas_sdhi: do hard reset if possible") Reported-by: Pavel Machek Signed-off-by: Lad Prabhakar Reviewed-by: Geert Uytterhoeven Reviewed-by: Wolfram Sang Link: https://lore.kernel.org/r/20220624181438.4355-2-prabhakar.mahadev-lad= .rj@bp.renesas.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/mmc/host/renesas_sdhi_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesa= s_sdhi_core.c index ae689bf54686..791e180a0617 100644 --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -925,6 +925,10 @@ int renesas_sdhi_probe(struct platform_device *pdev, if (IS_ERR(priv->clk_cd)) priv->clk_cd =3D NULL; =20 + priv->rstc =3D devm_reset_control_get_optional_exclusive(&pdev->dev, NULL= ); + if (IS_ERR(priv->rstc)) + return PTR_ERR(priv->rstc); + priv->pinctrl =3D devm_pinctrl_get(&pdev->dev); if (!IS_ERR(priv->pinctrl)) { priv->pins_default =3D pinctrl_lookup_state(priv->pinctrl, @@ -1013,10 +1017,6 @@ int renesas_sdhi_probe(struct platform_device *pdev, if (ret) goto efree; =20 - priv->rstc =3D devm_reset_control_get_optional_exclusive(&pdev->dev, NULL= ); - if (IS_ERR(priv->rstc)) - return PTR_ERR(priv->rstc); - ver =3D sd_ctrl_read16(host, CTL_VERSION); /* GEN2_SDR104 is first known SDHI to use 32bit block count */ if (ver < SDHI_VER_GEN2_SDR104 && mmc_data->max_blk_count > U16_MAX) --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F95BC282E7 for ; Mon, 15 Aug 2022 19:19:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245065AbiHOTTG (ORCPT ); Mon, 15 Aug 2022 15:19:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344337AbiHOTQ0 (ORCPT ); Mon, 15 Aug 2022 15:16: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 65EE252E52; Mon, 15 Aug 2022 11:37: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 678B961024; Mon, 15 Aug 2022 18:37:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58657C433C1; Mon, 15 Aug 2022 18:37:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588675; bh=4Y9obJ3d9SzWV7e3qd/6vTgE2ysm+GKbDTXk7kI8D4Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gU+awE9MwapkVU0fJUiGdlf+m0e6faptFX3YLpwCwQ640DHO59BteMe3zyZlDQFCC BCrOYhzlO9zhHxLY6SdOpuRxPIMN6CcCHwH0wTs2v/kfYbf3zNhbUFW0GD6Dd5Alrf GNdd+tUahAOS0laR74LTBYPgP1h5vapJHIXgH7VI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Ulf Hansson , Sasha Levin Subject: [PATCH 5.15 479/779] memstick/ms_block: Fix some incorrect memory allocation Date: Mon, 15 Aug 2022 20:02:03 +0200 Message-Id: <20220815180357.742528393@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET [ Upstream commit 2e531bc3e0d86362fcd8a577b3278d9ef3cc2ba0 ] Some functions of the bitmap API take advantage of the fact that a bitmap is an array of long. So, to make sure this assertion is correct, allocate bitmaps with bitmap_zalloc() instead of kzalloc()+hand-computed number of bytes. While at it, also use bitmap_free() instead of kfree() to keep the semantic. Fixes: 0ab30494bc4f ("memstick: add support for legacy memorysticks") Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/dbf633c48c24ae6d95f852557e8d8b3bbdef65fe.16= 56155715.git.christophe.jaillet@wanadoo.fr Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/memstick/core/ms_block.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/memstick/core/ms_block.c b/drivers/memstick/core/ms_bl= ock.c index 487e4cc2951e..7275217e485e 100644 --- a/drivers/memstick/core/ms_block.c +++ b/drivers/memstick/core/ms_block.c @@ -1341,17 +1341,17 @@ static int msb_ftl_initialize(struct msb_data *msb) msb->zone_count =3D msb->block_count / MS_BLOCKS_IN_ZONE; msb->logical_block_count =3D msb->zone_count * 496 - 2; =20 - msb->used_blocks_bitmap =3D kzalloc(msb->block_count / 8, GFP_KERNEL); - msb->erased_blocks_bitmap =3D kzalloc(msb->block_count / 8, GFP_KERNEL); + msb->used_blocks_bitmap =3D bitmap_zalloc(msb->block_count, GFP_KERNEL); + msb->erased_blocks_bitmap =3D bitmap_zalloc(msb->block_count, GFP_KERNEL); msb->lba_to_pba_table =3D kmalloc_array(msb->logical_block_count, sizeof(u16), GFP_KERNEL); =20 if (!msb->used_blocks_bitmap || !msb->lba_to_pba_table || !msb->erased_blocks_bitmap) { - kfree(msb->used_blocks_bitmap); + bitmap_free(msb->used_blocks_bitmap); + bitmap_free(msb->erased_blocks_bitmap); kfree(msb->lba_to_pba_table); - kfree(msb->erased_blocks_bitmap); return -ENOMEM; } =20 @@ -1962,7 +1962,7 @@ static int msb_bd_open(struct block_device *bdev, fmo= de_t mode) static void msb_data_clear(struct msb_data *msb) { kfree(msb->boot_page); - kfree(msb->used_blocks_bitmap); + bitmap_free(msb->used_blocks_bitmap); kfree(msb->lba_to_pba_table); kfree(msb->cache); msb->card =3D NULL; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CD9BBC25B0E for ; Mon, 15 Aug 2022 19:18:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343942AbiHOTSn (ORCPT ); Mon, 15 Aug 2022 15:18:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344296AbiHOTQS (ORCPT ); Mon, 15 Aug 2022 15:16:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 852323C152; Mon, 15 Aug 2022 11:38:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7A4BC61124; Mon, 15 Aug 2022 18:37:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6978DC433C1; Mon, 15 Aug 2022 18:37:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588678; bh=T9beneGmNTE1bc1SIe7uSeF7u3ye+KG+gZabQacfRmI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0ylK/uzf/lQZFfxXTPsl9zS8HZYcGpvglRm/Ep9OnQSmj6NbpemxIQIMhUPvBIwO5 YV9mZcQ+9Cw54wryWV0DuDKqEJJQK8JzX8oBR3FIRLg59KgBUfvygmqPfYdA52EqVq 7FoLEaSpRfikREZRuUtGL4gxhY94A2eg4k2ZoyxI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Ulf Hansson , Sasha Levin Subject: [PATCH 5.15 480/779] memstick/ms_block: Fix a memory leak Date: Mon, 15 Aug 2022 20:02:04 +0200 Message-Id: <20220815180357.777685721@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET [ Upstream commit 54eb7a55be6779c4d0c25eaf5056498a28595049 ] 'erased_blocks_bitmap' is never freed. As it is allocated at the same time as 'used_blocks_bitmap', it is likely that it should be freed also at the same time. Add the corresponding bitmap_free() in msb_data_clear(). Fixes: 0ab30494bc4f ("memstick: add support for legacy memorysticks") Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/b3b78926569445962ea5c3b6e9102418a9effb88.16= 56155715.git.christophe.jaillet@wanadoo.fr Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/memstick/core/ms_block.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/memstick/core/ms_block.c b/drivers/memstick/core/ms_bl= ock.c index 7275217e485e..f854822f84d6 100644 --- a/drivers/memstick/core/ms_block.c +++ b/drivers/memstick/core/ms_block.c @@ -1963,6 +1963,7 @@ static void msb_data_clear(struct msb_data *msb) { kfree(msb->boot_page); bitmap_free(msb->used_blocks_bitmap); + bitmap_free(msb->erased_blocks_bitmap); kfree(msb->lba_to_pba_table); kfree(msb->cache); msb->card =3D NULL; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCEAFC00140 for ; Mon, 15 Aug 2022 19:19:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245644AbiHOTTN (ORCPT ); Mon, 15 Aug 2022 15:19:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59116 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344332AbiHOTQZ (ORCPT ); Mon, 15 Aug 2022 15: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 EFF3752FC1; Mon, 15 Aug 2022 11:38:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 52D34B8108B; Mon, 15 Aug 2022 18:38:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93F63C433B5; Mon, 15 Aug 2022 18:38:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588682; bh=Gz2Jr+pS+jA08IitzJi1AbwCWv5VZEhjC2YGN6UtlOw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EnjMv/B60cdFrhJ4MVeoiZrPcIyRxcpJ1mHewJJoj/ab8HRSh+hwjKMsYudBTF0ZN 25fnz5uyIqU0N+WnbXGA+35dR8wlBoFVRlRz/0ZhXgpVtXnShs9Vk2tqTdEiiMYKXD 3jPH/yJKGxStEiO3V4+6czkzL46b7YApLtLujph0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eugen Hristev , Karl Olsen , Adrian Hunter , Ulf Hansson , Sasha Levin Subject: [PATCH 5.15 481/779] mmc: sdhci-of-at91: fix set_uhs_signaling rewriting of MC1R Date: Mon, 15 Aug 2022 20:02:05 +0200 Message-Id: <20220815180357.816841310@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eugen Hristev [ Upstream commit 5987e6ded29d52e42fc7b06aa575c60a25eee38e ] In set_uhs_signaling, the DDR bit is being set by fully writing the MC1R register. This can lead to accidental erase of certain bits in this register. Avoid this by doing a read-modify-write operation. Fixes: d0918764c17b ("mmc: sdhci-of-at91: fix MMC_DDR_52 timing selection") Signed-off-by: Eugen Hristev Tested-by: Karl Olsen Acked-by: Adrian Hunter Link: https://lore.kernel.org/r/20220630090926.15061-1-eugen.hristev@microc= hip.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/mmc/host/sdhci-of-at91.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/sdhci-of-at91.c b/drivers/mmc/host/sdhci-of-a= t91.c index d1a1c548c515..0452c312b65e 100644 --- a/drivers/mmc/host/sdhci-of-at91.c +++ b/drivers/mmc/host/sdhci-of-at91.c @@ -100,8 +100,13 @@ static void sdhci_at91_set_clock(struct sdhci_host *ho= st, unsigned int clock) static void sdhci_at91_set_uhs_signaling(struct sdhci_host *host, unsigned int timing) { - if (timing =3D=3D MMC_TIMING_MMC_DDR52) - sdhci_writeb(host, SDMMC_MC1R_DDR, SDMMC_MC1R); + u8 mc1r; + + if (timing =3D=3D MMC_TIMING_MMC_DDR52) { + mc1r =3D sdhci_readb(host, SDMMC_MC1R); + mc1r |=3D SDMMC_MC1R_DDR; + sdhci_writeb(host, mc1r, SDMMC_MC1R); + } sdhci_set_uhs_signaling(host, timing); } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D0F8C00140 for ; Mon, 15 Aug 2022 19:19:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233200AbiHOTS5 (ORCPT ); Mon, 15 Aug 2022 15:18:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344307AbiHOTQU (ORCPT ); Mon, 15 Aug 2022 15: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 9A54752FD5; Mon, 15 Aug 2022 11:38: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 B972161143; Mon, 15 Aug 2022 18:38:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBFC6C433D6; Mon, 15 Aug 2022 18:38:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588685; bh=drjjw1OcmSZKyXWnDea21kgHQ4W665P0NdF114hFKv8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K+8nLpS3NJEymhs4GQb7goDIIG1z7kYnGfMSVwqNoGKLC52L3Mrdz65TzM/WqUXdZ 9/avVJUHR080yk3ZdLQErnOx2bMCT0QmKSO3SqpJdkv18CY+J+pzZ5Bl3nnzt/nI4T riPracJA9cfjLv5JYif2JIS/u6LZi0HHWTBTFx78= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Rob Herring , Sasha Levin , Miaoqian Lin Subject: [PATCH 5.15 482/779] of: device: Fix missing of_node_put() in of_dma_set_restricted_buffer Date: Mon, 15 Aug 2022 20:02:06 +0200 Message-Id: <20220815180357.856053649@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit d17e37c41b7ed38459957a5d2968ba61516fd5c2 ] We should use of_node_put() for the reference 'node' returned by of_parse_phandle() which will increase the refcount. Fixes: fec9b625095f ("of: Add plumbing for restricted DMA pool") Co-authored-by: Miaoqian Lin Signed-off-by: Liang He Signed-off-by: Rob Herring Link: https://lore.kernel.org/r/20220702014449.263772-1-windhl@126.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/of/device.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/of/device.c b/drivers/of/device.c index b0800c260f64..45335fe523f7 100644 --- a/drivers/of/device.c +++ b/drivers/of/device.c @@ -81,8 +81,11 @@ of_dma_set_restricted_buffer(struct device *dev, struct = device_node *np) * restricted-dma-pool region is allowed. */ if (of_device_is_compatible(node, "restricted-dma-pool") && - of_device_is_available(node)) + of_device_is_available(node)) { + of_node_put(node); break; + } + of_node_put(node); } =20 /* --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B917C25B08 for ; Mon, 15 Aug 2022 19:19:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244732AbiHOTTS (ORCPT ); Mon, 15 Aug 2022 15:19:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344384AbiHOTQf (ORCPT ); Mon, 15 Aug 2022 15: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 4768E53D13; Mon, 15 Aug 2022 11:38: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 88DB3B81084; Mon, 15 Aug 2022 18:38:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0E32C433D6; Mon, 15 Aug 2022 18:38:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588688; bh=pB7zu3RI90l0HgRwOw3iQx+aw/N8WeopjvTODowc39M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n0Vz+PsIbOFGhL+qY1/Anxxyi/KUhBEPhmV5ghsq5kkCKNnL8IAjewHI3FGtWX/8W S9qY3ByMKKQ5azyYk2t9rTnRfJZzOSExdGTG0cIivqPKmOjeTvrjl4VFQQnwGzNkyj Bxqk07ollZ1QITn0SHOf0bttCavn9OJI2L4qkB1A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christian Loehle , Adrian Hunter , Avri Altman , Ulf Hansson , Sasha Levin Subject: [PATCH 5.15 483/779] mmc: block: Add single read for 4k sector cards Date: Mon, 15 Aug 2022 20:02:07 +0200 Message-Id: <20220815180357.905457608@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Loehle [ Upstream commit b3fa3e6dccc465969721b8bd2824213bd235efeb ] Cards with 4k native sector size may only be read 4k-aligned, accommodate for this in the single read recovery and use it. Fixes: 81196976ed946 (mmc: block: Add blk-mq support) Signed-off-by: Christian Loehle Acked-by: Adrian Hunter Reviewed-by: Avri Altman Link: https://lore.kernel.org/r/cf4f316274c5474586d0d99b17db4a4c@hyperstone= .com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/mmc/core/block.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index a196116444a3..3222a9d0c245 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -175,7 +175,7 @@ static inline int mmc_blk_part_switch(struct mmc_card *= card, unsigned int part_type); static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, struct mmc_card *card, - int disable_multi, + int recovery_mode, struct mmc_queue *mq); static void mmc_blk_hsq_req_done(struct mmc_request *mrq); =20 @@ -1285,7 +1285,7 @@ static void mmc_blk_eval_resp_error(struct mmc_blk_re= quest *brq) } =20 static void mmc_blk_data_prep(struct mmc_queue *mq, struct mmc_queue_req *= mqrq, - int disable_multi, bool *do_rel_wr_p, + int recovery_mode, bool *do_rel_wr_p, bool *do_data_tag_p) { struct mmc_blk_data *md =3D mq->blkdata; @@ -1351,12 +1351,12 @@ static void mmc_blk_data_prep(struct mmc_queue *mq,= struct mmc_queue_req *mqrq, brq->data.blocks--; =20 /* - * After a read error, we redo the request one sector + * After a read error, we redo the request one (native) sector * at a time in order to accurately determine which * sectors can be read successfully. */ - if (disable_multi) - brq->data.blocks =3D 1; + if (recovery_mode) + brq->data.blocks =3D queue_physical_block_size(mq->queue) >> 9; =20 /* * Some controllers have HW issues while operating @@ -1573,7 +1573,7 @@ static int mmc_blk_cqe_issue_rw_rq(struct mmc_queue *= mq, struct request *req) =20 static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, struct mmc_card *card, - int disable_multi, + int recovery_mode, struct mmc_queue *mq) { u32 readcmd, writecmd; @@ -1582,7 +1582,7 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *= mqrq, struct mmc_blk_data *md =3D mq->blkdata; bool do_rel_wr, do_data_tag; =20 - mmc_blk_data_prep(mq, mqrq, disable_multi, &do_rel_wr, &do_data_tag); + mmc_blk_data_prep(mq, mqrq, recovery_mode, &do_rel_wr, &do_data_tag); =20 brq->mrq.cmd =3D &brq->cmd; =20 @@ -1673,7 +1673,7 @@ static int mmc_blk_fix_state(struct mmc_card *card, s= truct request *req) =20 #define MMC_READ_SINGLE_RETRIES 2 =20 -/* Single sector read during recovery */ +/* Single (native) sector read during recovery */ static void mmc_blk_read_single(struct mmc_queue *mq, struct request *req) { struct mmc_queue_req *mqrq =3D req_to_mmc_queue_req(req); @@ -1681,6 +1681,7 @@ static void mmc_blk_read_single(struct mmc_queue *mq,= struct request *req) struct mmc_card *card =3D mq->card; struct mmc_host *host =3D card->host; blk_status_t error =3D BLK_STS_OK; + size_t bytes_per_read =3D queue_physical_block_size(mq->queue); =20 do { u32 status; @@ -1715,13 +1716,13 @@ static void mmc_blk_read_single(struct mmc_queue *m= q, struct request *req) else error =3D BLK_STS_OK; =20 - } while (blk_update_request(req, error, 512)); + } while (blk_update_request(req, error, bytes_per_read)); =20 return; =20 error_exit: mrq->data->bytes_xfered =3D 0; - blk_update_request(req, BLK_STS_IOERR, 512); + blk_update_request(req, BLK_STS_IOERR, bytes_per_read); /* Let it try the remaining request again */ if (mqrq->retries > MMC_MAX_RETRIES - 1) mqrq->retries =3D MMC_MAX_RETRIES - 1; @@ -1862,10 +1863,9 @@ static void mmc_blk_mq_rw_recovery(struct mmc_queue = *mq, struct request *req) return; } =20 - /* FIXME: Missing single sector read for large sector size */ - if (!mmc_large_sector(card) && rq_data_dir(req) =3D=3D READ && - brq->data.blocks > 1) { - /* Read one sector at a time */ + if (rq_data_dir(req) =3D=3D READ && brq->data.blocks > + queue_physical_block_size(mq->queue) >> 9) { + /* Read one (native) sector at a time */ mmc_blk_read_single(mq, req); return; } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28BF4C25B0E for ; Mon, 15 Aug 2022 19:19:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343732AbiHOTTX (ORCPT ); Mon, 15 Aug 2022 15:19:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344436AbiHOTQn (ORCPT ); Mon, 15 Aug 2022 15:16:43 -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 BB7373B948; Mon, 15 Aug 2022 11:38: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 495876113C; Mon, 15 Aug 2022 18:38:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38CA2C433D6; Mon, 15 Aug 2022 18:38:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588691; bh=Ga/6TRQVXydterssJTD+D053cn3SGBoDDM0IrgKoMtE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OFNnCEYGSsG0mlMu330pIrDa5w7TLer4Tg6DUvJnAb4Ki/lo5UwaY3BWb1tOx+W6g x7xeqiQv/ET2IiFgM5DrS30grsxcWm9ZqvD6jEgJJayg7I52AhZf/+7Bm1NQGuA9cL prkwztBQHbb1cq7k5Ty5HIp9Ub3a3QtRoLSRNPUk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Claudio Imbrenda , Janosch Frank , Sasha Levin Subject: [PATCH 5.15 484/779] KVM: s390: pv: leak the topmost page table when destroy fails Date: Mon, 15 Aug 2022 20:02:08 +0200 Message-Id: <20220815180357.953709589@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Claudio Imbrenda [ Upstream commit faa2f72cb3569256480c5540d242c84e99965160 ] Each secure guest must have a unique ASCE (address space control element); we must avoid that new guests use the same page for their ASCE, to avoid errors. Since the ASCE mostly consists of the address of the topmost page table (plus some flags), we must not return that memory to the pool unless the ASCE is no longer in use. Only a successful Destroy Secure Configuration UVC will make the ASCE reusable again. If the Destroy Configuration UVC fails, the ASCE cannot be reused for a secure guest (either for the ASCE or for other memory areas). To avoid a collision, it must not be used again. This is a permanent error and the page becomes in practice unusable, so we set it aside and leak it. On failure we already leak other memory that belongs to the ultravisor (i.e. the variable and base storage for a guest) and not leaking the topmost page table was an oversight. This error (and thus the leakage) should not happen unless the hardware is broken or KVM has some unknown serious bug. Signed-off-by: Claudio Imbrenda Fixes: 29b40f105ec8d55 ("KVM: s390: protvirt: Add initial vm and cpu lifecy= cle handling") Reviewed-by: Janosch Frank Link: https://lore.kernel.org/r/20220628135619.32410-2-imbrenda@linux.ibm.c= om Message-Id: <20220628135619.32410-2-imbrenda@linux.ibm.com> Signed-off-by: Janosch Frank Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/s390/include/asm/gmap.h | 2 + arch/s390/kvm/pv.c | 9 ++-- arch/s390/mm/gmap.c | 86 ++++++++++++++++++++++++++++++++++++ 3 files changed, 94 insertions(+), 3 deletions(-) diff --git a/arch/s390/include/asm/gmap.h b/arch/s390/include/asm/gmap.h index 40264f60b0da..f4073106e1f3 100644 --- a/arch/s390/include/asm/gmap.h +++ b/arch/s390/include/asm/gmap.h @@ -148,4 +148,6 @@ void gmap_sync_dirty_log_pmd(struct gmap *gmap, unsigne= d long dirty_bitmap[4], unsigned long gaddr, unsigned long vmaddr); int gmap_mark_unmergeable(void); void s390_reset_acc(struct mm_struct *mm); +void s390_unlist_old_asce(struct gmap *gmap); +int s390_replace_asce(struct gmap *gmap); #endif /* _ASM_S390_GMAP_H */ diff --git a/arch/s390/kvm/pv.c b/arch/s390/kvm/pv.c index 00d272d134c2..b906658ffc2e 100644 --- a/arch/s390/kvm/pv.c +++ b/arch/s390/kvm/pv.c @@ -168,10 +168,13 @@ int kvm_s390_pv_deinit_vm(struct kvm *kvm, u16 *rc, u= 16 *rrc) atomic_set(&kvm->mm->context.is_protected, 0); KVM_UV_EVENT(kvm, 3, "PROTVIRT DESTROY VM: rc %x rrc %x", *rc, *rrc); WARN_ONCE(cc, "protvirt destroy vm failed rc %x rrc %x", *rc, *rrc); - /* Inteded memory leak on "impossible" error */ - if (!cc) + /* Intended memory leak on "impossible" error */ + if (!cc) { kvm_s390_pv_dealloc_vm(kvm); - return cc ? -EIO : 0; + return 0; + } + s390_replace_asce(kvm->arch.gmap); + return -EIO; } =20 int kvm_s390_pv_init_vm(struct kvm *kvm, u16 *rc, u16 *rrc) diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c index 4ce3a2f01c91..ff40bf92db43 100644 --- a/arch/s390/mm/gmap.c +++ b/arch/s390/mm/gmap.c @@ -2726,3 +2726,89 @@ void s390_reset_acc(struct mm_struct *mm) mmput(mm); } EXPORT_SYMBOL_GPL(s390_reset_acc); + +/** + * s390_unlist_old_asce - Remove the topmost level of page tables from the + * list of page tables of the gmap. + * @gmap: the gmap whose table is to be removed + * + * On s390x, KVM keeps a list of all pages containing the page tables of t= he + * gmap (the CRST list). This list is used at tear down time to free all + * pages that are now not needed anymore. + * + * This function removes the topmost page of the tree (the one pointed to = by + * the ASCE) from the CRST list. + * + * This means that it will not be freed when the VM is torn down, and needs + * to be handled separately by the caller, unless a leak is actually + * intended. Notice that this function will only remove the page from the + * list, the page will still be used as a top level page table (and ASCE). + */ +void s390_unlist_old_asce(struct gmap *gmap) +{ + struct page *old; + + old =3D virt_to_page(gmap->table); + spin_lock(&gmap->guest_table_lock); + list_del(&old->lru); + /* + * Sometimes the topmost page might need to be "removed" multiple + * times, for example if the VM is rebooted into secure mode several + * times concurrently, or if s390_replace_asce fails after calling + * s390_remove_old_asce and is attempted again later. In that case + * the old asce has been removed from the list, and therefore it + * will not be freed when the VM terminates, but the ASCE is still + * in use and still pointed to. + * A subsequent call to replace_asce will follow the pointer and try + * to remove the same page from the list again. + * Therefore it's necessary that the page of the ASCE has valid + * pointers, so list_del can work (and do nothing) without + * dereferencing stale or invalid pointers. + */ + INIT_LIST_HEAD(&old->lru); + spin_unlock(&gmap->guest_table_lock); +} +EXPORT_SYMBOL_GPL(s390_unlist_old_asce); + +/** + * s390_replace_asce - Try to replace the current ASCE of a gmap with a co= py + * @gmap: the gmap whose ASCE needs to be replaced + * + * If the allocation of the new top level page table fails, the ASCE is not + * replaced. + * In any case, the old ASCE is always removed from the gmap CRST list. + * Therefore the caller has to make sure to save a pointer to it + * beforehand, unless a leak is actually intended. + */ +int s390_replace_asce(struct gmap *gmap) +{ + unsigned long asce; + struct page *page; + void *table; + + s390_unlist_old_asce(gmap); + + page =3D alloc_pages(GFP_KERNEL_ACCOUNT, CRST_ALLOC_ORDER); + if (!page) + return -ENOMEM; + table =3D page_to_virt(page); + memcpy(table, gmap->table, 1UL << (CRST_ALLOC_ORDER + PAGE_SHIFT)); + + /* + * The caller has to deal with the old ASCE, but here we make sure + * the new one is properly added to the CRST list, so that + * it will be freed when the VM is torn down. + */ + spin_lock(&gmap->guest_table_lock); + list_add(&page->lru, &gmap->crst_list); + spin_unlock(&gmap->guest_table_lock); + + /* Set new table origin while preserving existing ASCE control bits */ + asce =3D (gmap->asce & ~_ASCE_ORIGIN) | __pa(table); + WRITE_ONCE(gmap->asce, asce); + WRITE_ONCE(gmap->mm->context.gmap_asce, asce); + WRITE_ONCE(gmap->table, table); + + return 0; +} +EXPORT_SYMBOL_GPL(s390_replace_asce); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 237E9C25B08 for ; Mon, 15 Aug 2022 19:19:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343738AbiHOTTl (ORCPT ); Mon, 15 Aug 2022 15:19:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344504AbiHOTQu (ORCPT ); Mon, 15 Aug 2022 15:16:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2B6B2DAAE; Mon, 15 Aug 2022 11:38: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 8842060FB8; Mon, 15 Aug 2022 18:38:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D66DC433C1; Mon, 15 Aug 2022 18:38:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588697; bh=TSsNCgelctt+58xqKftZUVvkb58cH3/mqhqsM63/6wk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ImZRJ3G5vhtua67goD7jj1CBoVJna/WDec7uV68lAIN8pVYf4pOQIXLGRXI6IEs62 FrcXZarGpoQ5mFzIWjJr0pEOG3u6kqyMGWqBqiuovoy82xFzRKSH6E5IgTpxu7Dras I3L2coBYEGkHgv0NXQFQ6ebMhwiwkbXPzRq2FNUo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Roese , Bjorn Helgaas , =?UTF-8?q?Pali=20Roh=C3=A1r?= , "Rafael J. Wysocki" , Bharat Kumar Gogada , Michal Simek , Yao Hongbo , Naveen Naidu , Sasha Levin Subject: [PATCH 5.15 485/779] PCI/portdrv: Dont disable AER reporting in get_port_device_capability() Date: Mon, 15 Aug 2022 20:02:09 +0200 Message-Id: <20220815180357.995081206@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stefan Roese [ Upstream commit 8795e182b02dc87e343c79e73af6b8b7f9c5e635 ] AER reporting is currently disabled in the DevCtl registers of all non Root Port PCIe devices on systems using pcie_ports_native || host->native_aer, disabling AER completely in such systems. This is because 2bd50dd800b5 ("PCI: PCIe: Disable PCIe port services during port initialization"), added a call to pci_disable_pcie_error_reporting() *after* the AER setup was completed for the PCIe device tree. Here a longer analysis about the current status of AER enabling / disabling upon bootup provided by Bjorn: pcie_portdrv_probe pcie_port_device_register get_port_device_capability pci_disable_pcie_error_reporting clear CERE NFERE FERE URRE # <-- disable for RP USP= DSP pcie_device_init device_register # new AER service device aer_probe aer_enable_rootport # RP only set_downstream_devices_error_reporting set_device_error_reporting # self (RP) if (RP || USP || DSP) pci_enable_pcie_error_reporting set CERE NFERE FERE URRE # <-- enable for RP pci_walk_bus set_device_error_reporting if (RP || USP || DSP) pci_enable_pcie_error_reporting set CERE NFERE FERE URRE # <-- enable for USP DSP In a typical Root Port -> Endpoint hierarchy, the above: - Disables Error Reporting for the Root Port, - Enables Error Reporting for the Root Port, - Does NOT enable Error Reporting for the Endpoint because it is not a Root Port or Switch Port. In a deeper Root Port -> Upstream Switch Port -> Downstream Switch Port -> Endpoint hierarchy: - Disables Error Reporting for the Root Port, - Enables Error Reporting for the Root Port, - Enables Error Reporting for both Switch Ports, - Does NOT enable Error Reporting for the Endpoint because it is not a Root Port or Switch Port, - Disables Error Reporting for the Switch Ports when pcie_portdrv_probe() claims them. AER does not re-enable it because these are not Root Ports. Remove this call to pci_disable_pcie_error_reporting() from get_port_device_capability(), leaving the already enabled AER configuration intact. With this change, AER is enabled in the Root Port and the PCIe switch upstream and downstream ports. Only the PCIe Endpoints don't have AER enabled yet. A follow-up patch will take care of this Endpoint enabling. Fixes: 2bd50dd800b5 ("PCI: PCIe: Disable PCIe port services during port ini= tialization") Link: https://lore.kernel.org/r/20220125071820.2247260-3-sr@denx.de Signed-off-by: Stefan Roese Signed-off-by: Bjorn Helgaas Reviewed-by: Pali Roh=C3=A1r Cc: Rafael J. Wysocki Cc: Bharat Kumar Gogada Cc: Michal Simek Cc: Yao Hongbo Cc: Naveen Naidu Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/pci/pcie/portdrv_core.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_cor= e.c index 604feeb84ee4..1ac7fec47d6f 100644 --- a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c @@ -222,15 +222,8 @@ static int get_port_device_capability(struct pci_dev *= dev) =20 #ifdef CONFIG_PCIEAER if (dev->aer_cap && pci_aer_available() && - (pcie_ports_native || host->native_aer)) { + (pcie_ports_native || host->native_aer)) services |=3D PCIE_PORT_SERVICE_AER; - - /* - * Disable AER on this port in case it's been enabled by the - * BIOS (the AER service driver will enable it when necessary). - */ - pci_disable_pcie_error_reporting(dev); - } #endif =20 /* Root Ports and Root Complex Event Collectors may generate PMEs */ --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A0C9C00140 for ; Mon, 15 Aug 2022 19:19:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343592AbiHOTT3 (ORCPT ); Mon, 15 Aug 2022 15:19:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344497AbiHOTQt (ORCPT ); Mon, 15 Aug 2022 15:16:49 -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 1ABD954643; Mon, 15 Aug 2022 11:38: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 sin.source.kernel.org (Postfix) with ESMTPS id 5C0FACE1269; Mon, 15 Aug 2022 18:38:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53D33C433C1; Mon, 15 Aug 2022 18:38:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588700; bh=lSXbZ6qrGUKW9VxbcJdngjcM0H6A8XryCFumpFITXWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WtdN5FzKHMba66ojOEFT6/HnALk357adhWFIPcyoJYCFVk4uuM0YtLmQz/U9wmKn7 vY/xknEEUu6ByBQ36dESKIbGCNzqCGnAksKWQQvTd8Nxp5Oce/580zPDW81m1JtIhM LKI9NZjcxPhsxlncjpgDBVHJn+RTOX7KrNyU3tK8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christian Marangi , Bjorn Helgaas , Sasha Levin Subject: [PATCH 5.15 486/779] PCI: qcom: Set up rev 2.1.0 PARF_PHY before enabling clocks Date: Mon, 15 Aug 2022 20:02:10 +0200 Message-Id: <20220815180358.032735981@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Marangi [ Upstream commit 38f897ae3d44900f627cad708a15db498ce2ca31 ] We currently enable clocks BEFORE we write to PARF_PHY_CTRL reg to enable clocks and resets. This causes the driver to never set to a ready state with the error 'Phy link never came up'. This is caused by the PHY clock getting enabled before setting the required bits in the PARF regs. A workaround for this was set but with this new discovery we can drop the workaround and use a proper solution to the problem by just enabling the clock only AFTER the PARF_PHY_CTRL bit is set. This correctly sets up the PCIe link and makes it usable even when a bootloader leaves the PCIe link in an undefined state. Fixes: 82a823833f4e ("PCI: qcom: Add Qualcomm PCIe controller driver") Link: https://lore.kernel.org/r/20220708222743.27019-1-ansuelsmth@gmail.com Signed-off-by: Christian Marangi Signed-off-by: Bjorn Helgaas Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/pci/controller/dwc/pcie-qcom.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controlle= r/dwc/pcie-qcom.c index b139a2e4af12..45210c6380b1 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -325,8 +325,6 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pcie) reset_control_assert(res->ext_reset); reset_control_assert(res->phy_reset); =20 - writel(1, pcie->parf + PCIE20_PARF_PHY_CTRL); - ret =3D regulator_bulk_enable(ARRAY_SIZE(res->supplies), res->supplies); if (ret < 0) { dev_err(dev, "cannot enable regulators\n"); @@ -369,15 +367,15 @@ static int qcom_pcie_init_2_1_0(struct qcom_pcie *pci= e) goto err_deassert_axi; } =20 - ret =3D clk_bulk_prepare_enable(ARRAY_SIZE(res->clks), res->clks); - if (ret) - goto err_clks; - /* enable PCIe clocks and resets */ val =3D readl(pcie->parf + PCIE20_PARF_PHY_CTRL); val &=3D ~BIT(0); writel(val, pcie->parf + PCIE20_PARF_PHY_CTRL); =20 + ret =3D clk_bulk_prepare_enable(ARRAY_SIZE(res->clks), res->clks); + if (ret) + goto err_clks; + if (of_device_is_compatible(node, "qcom,pcie-ipq8064") || of_device_is_compatible(node, "qcom,pcie-ipq8064-v2")) { writel(PCS_DEEMPH_TX_DEEMPH_GEN1(24) | --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88FFDC00140 for ; Mon, 15 Aug 2022 19:19:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344148AbiHOTTr (ORCPT ); Mon, 15 Aug 2022 15:19:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344530AbiHOTQx (ORCPT ); Mon, 15 Aug 2022 15:16:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35FE45464E; Mon, 15 Aug 2022 11:38: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 1F748B81081; Mon, 15 Aug 2022 18:38:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38D98C433D6; Mon, 15 Aug 2022 18:38:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588703; bh=wYG8/+iJBFUffvlOg0M3StmDyPYkTXDDtClCklYvrSA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BaespXlP8u2tyq0djkr03KBRVj7aVljXmCXim+X0GDmlkHFADY9mhvdvF1Oj6NsCI JopBLBFK1m7QNsO6s402TY65LPKJLAAq+XczZTtUyfDChs6wKnd7eyrGZF39hFlwo3 74X7x/v+Hb9AYRy47bk8REzXwpKyf9PDjUt9PO7U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Scott Benesh , Scott Teel , Mike McGowen , Kevin Barnett , Mahesh Rajashekhara , Don Brace , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.15 487/779] scsi: smartpqi: Fix DMA direction for RAID requests Date: Mon, 15 Aug 2022 20:02:11 +0200 Message-Id: <20220815180358.080884043@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mahesh Rajashekhara [ Upstream commit 69695aeaa6621bc49cdd7a8e5a8d1042461e496e ] Correct a SOP READ and WRITE DMA flags for some requests. This update corrects DMA direction issues with SCSI commands removed from the controller's internal lookup table. Currently, SCSI READ BLOCK LIMITS (0x5) was removed from the controller lookup table and exposed a DMA direction flag issue. SCSI READ BLOCK LIMITS was recently removed from our controller lookup table so the controller uses the respective IU flag field to set the DMA data direction. Since the DMA direction is incorrect the FW never completes the request causing a hang. Some SCSI commands which use SCSI READ BLOCK LIMITS * sg_map * mt -f /dev/stX status After updating controller firmware, users may notice their tape units failing. This patch resolves the issue. Also, the AIO path DMA direction is correct. The DMA direction flag is a day-one bug with no reported BZ. Fixes: 6c223761eb54 ("smartpqi: initial commit of Microsemi smartpqi driver= ") Link: https://lore.kernel.org/r/165730605618.177165.9054223644512926624.stg= it@brunhilda Reviewed-by: Scott Benesh Reviewed-by: Scott Teel Reviewed-by: Mike McGowen Reviewed-by: Kevin Barnett Signed-off-by: Mahesh Rajashekhara Signed-off-by: Don Brace Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/smartpqi/smartpqi_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/= smartpqi_init.c index 2e690d8a3444..e3d8de1159b5 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c @@ -5310,10 +5310,10 @@ static int pqi_raid_submit_scsi_cmd_with_io_request( } =20 switch (scmd->sc_data_direction) { - case DMA_TO_DEVICE: + case DMA_FROM_DEVICE: request->data_direction =3D SOP_READ_FLAG; break; - case DMA_FROM_DEVICE: + case DMA_TO_DEVICE: request->data_direction =3D SOP_WRITE_FLAG; break; case DMA_NONE: --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04118C25B0E for ; Mon, 15 Aug 2022 19:24:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245229AbiHOTYg (ORCPT ); Mon, 15 Aug 2022 15:24:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245060AbiHOTWb (ORCPT ); Mon, 15 Aug 2022 15:22:31 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6633B59270; Mon, 15 Aug 2022 11:40: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 2AA2BCE1268; Mon, 15 Aug 2022 18:40:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12EC6C433C1; Mon, 15 Aug 2022 18:40:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588835; bh=+xyQPqQ4x+0wzOxEiX4hNX96Q1C0zM0bt8z0jZmfowU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nFlCN/iCs2uPBGH1OWBJ6YDKyCfbxQHxKYTmzgSOtoPpyeck72cldVaoKwILAObyf ls4nzzVUsTum6F3ryevDrfqpha9s8e5o3sl0CLlZuV+0OucHecdeSKKhTGr4NNWmcf O2XLbZsQEzcV87WLmrl14VHD3YIt4CIXSsa4M/i0= 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.15 488/779] xtensa: iss/network: provide release() callback Date: Mon, 15 Aug 2022 20:02:12 +0200 Message-Id: <20220815180358.122109382@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 8864fb8359682912ee99235db7db916733a1fd7b ] Provide release() callback for the platform device embedded into struct iss_net_private and registered in the iss_net_configure so that platform_device_unregister could be called for it. Signed-off-by: Max Filippov Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/xtensa/platforms/iss/network.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/arch/xtensa/platforms/iss/network.c b/arch/xtensa/platforms/is= s/network.c index 4986226a5ab2..4801df4e73e1 100644 --- a/arch/xtensa/platforms/iss/network.c +++ b/arch/xtensa/platforms/iss/network.c @@ -502,6 +502,15 @@ static const struct net_device_ops iss_netdev_ops =3D { .ndo_set_rx_mode =3D iss_net_set_multicast_list, }; =20 +static void iss_net_pdev_release(struct device *dev) +{ + struct platform_device *pdev =3D to_platform_device(dev); + struct iss_net_private *lp =3D + container_of(pdev, struct iss_net_private, pdev); + + free_netdev(lp->dev); +} + static int iss_net_configure(int index, char *init) { struct net_device *dev; @@ -558,6 +567,7 @@ static int iss_net_configure(int index, char *init) =20 lp->pdev.id =3D index; lp->pdev.name =3D DRIVER_NAME; + lp->pdev.dev.release =3D iss_net_pdev_release; platform_device_register(&lp->pdev); SET_NETDEV_DEV(dev, &lp->pdev.dev); =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7375FC25B0E for ; Mon, 15 Aug 2022 19:21:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343909AbiHOTUh (ORCPT ); Mon, 15 Aug 2022 15:20:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344802AbiHOTRa (ORCPT ); Mon, 15 Aug 2022 15: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 2BBE4550AD; Mon, 15 Aug 2022 11:38: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 924FCB8105C; Mon, 15 Aug 2022 18:38:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C6258C433C1; Mon, 15 Aug 2022 18:38:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588729; bh=Ec5/oyhb00vaR4L1rErP9tSGFiWzLz6wckzSUZUh9pY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EKvcyYVNqLnvbBNboXL6aPeEihDSKypkeC0gS8nHpjvsSW6F65BmjdCTSAKtt7Jn/ IIy6Ll8JdI9ynBwnHGGmO11FDUzc3OsxebOqn/IGRWH+onOGag/fcGpQL9cuvAfoDk LD6WeS71lzrUvRyfK1+K/HDFSNu9qVprHaFyrKRE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Yang Yingliang , Max Filippov , Sasha Levin Subject: [PATCH 5.15 489/779] xtensa: iss: fix handling error cases in iss_net_configure() Date: Mon, 15 Aug 2022 20:02:13 +0200 Message-Id: <20220815180358.171051787@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 628ccfc8f5f79dd548319408fcc53949fe97b258 ] The 'pdev' and 'netdev' need to be released in error cases of iss_net_configure(). Change the return type of iss_net_configure() to void, because it's not used. Fixes: 7282bee78798 ("[PATCH] xtensa: Architecture support for Tensilica Xt= ensa Part 8") Reported-by: Hulk Robot Signed-off-by: Yang Yingliang Signed-off-by: Max Filippov Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/xtensa/platforms/iss/network.c | 32 ++++++++++++++--------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/arch/xtensa/platforms/iss/network.c b/arch/xtensa/platforms/is= s/network.c index 4801df4e73e1..08d70c868c13 100644 --- a/arch/xtensa/platforms/iss/network.c +++ b/arch/xtensa/platforms/iss/network.c @@ -511,16 +511,15 @@ static void iss_net_pdev_release(struct device *dev) free_netdev(lp->dev); } =20 -static int iss_net_configure(int index, char *init) +static void iss_net_configure(int index, char *init) { struct net_device *dev; struct iss_net_private *lp; - int err; =20 dev =3D alloc_etherdev(sizeof(*lp)); if (dev =3D=3D NULL) { pr_err("eth_configure: failed to allocate device\n"); - return 1; + return; } =20 /* Initialize private element. */ @@ -549,7 +548,7 @@ static int iss_net_configure(int index, char *init) if (!tuntap_probe(lp, index, init)) { pr_err("%s: invalid arguments. Skipping device!\n", dev->name); - goto errout; + goto err_free_netdev; } =20 pr_info("Netdevice %d (%pM)\n", index, dev->dev_addr); @@ -557,7 +556,8 @@ static int iss_net_configure(int index, char *init) /* sysfs register */ =20 if (!driver_registered) { - platform_driver_register(&iss_net_driver); + if (platform_driver_register(&iss_net_driver)) + goto err_free_netdev; driver_registered =3D 1; } =20 @@ -568,7 +568,8 @@ static int iss_net_configure(int index, char *init) lp->pdev.id =3D index; lp->pdev.name =3D DRIVER_NAME; lp->pdev.dev.release =3D iss_net_pdev_release; - platform_device_register(&lp->pdev); + if (platform_device_register(&lp->pdev)) + goto err_free_netdev; SET_NETDEV_DEV(dev, &lp->pdev.dev); =20 dev->netdev_ops =3D &iss_netdev_ops; @@ -577,23 +578,20 @@ static int iss_net_configure(int index, char *init) dev->irq =3D -1; =20 rtnl_lock(); - err =3D register_netdevice(dev); - rtnl_unlock(); - - if (err) { + if (register_netdevice(dev)) { + rtnl_unlock(); pr_err("%s: error registering net device!\n", dev->name); - /* XXX: should we call ->remove() here? */ - free_netdev(dev); - return 1; + platform_device_unregister(&lp->pdev); + return; } + rtnl_unlock(); =20 timer_setup(&lp->tl, iss_net_user_timer_expire, 0); =20 - return 0; + return; =20 -errout: - /* FIXME: unregister; free, etc.. */ - return -EIO; +err_free_netdev: + free_netdev(dev); } =20 /* -----------------------------------------------------------------------= -- */ --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8330BC00140 for ; Mon, 15 Aug 2022 19:21:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344788AbiHOTVj (ORCPT ); Mon, 15 Aug 2022 15:21:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345052AbiHOTSC (ORCPT ); Mon, 15 Aug 2022 15:18:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E927956BA2; Mon, 15 Aug 2022 11:39: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 3EFD2B81082; Mon, 15 Aug 2022 18:39:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 826A6C433D7; Mon, 15 Aug 2022 18:39:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588764; bh=TAuUMR7MhN059r8wH39ZJ2WwqdyBclsgrNGwmEPdtag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TXXqmpbtb7SL9OBYzWbxI1vBluuofNkCrFVllicmUQbd/+EpdzvQa4FemYMmQepNT bo6YmzwTUEtRrCmpjpQOJdMKo/T4FBdgGExOu+x/+aSruqw4b/EGz7buQ+ksbebi2W RHgcm8UkzRYfPxUq18GMJvLmz/Li92Apy+9Zrxyo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Raviteja Garimella , Felipe Balbi , linux-usb@vger.kernel.org, Randy Dunlap , Sasha Levin Subject: [PATCH 5.15 490/779] usb: gadget: udc: amd5536 depends on HAS_DMA Date: Mon, 15 Aug 2022 20:02:14 +0200 Message-Id: <20220815180358.203350793@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Randy Dunlap [ Upstream commit 8097cf2fb3b2205257f1c76f4808e3398d66b6d9 ] USB_AMD5536UDC should depend on HAS_DMA since it selects USB_SNP_CORE, which depends on HAS_DMA and since 'select' does not follow any dependency chains. Fixes this kconfig warning: WARNING: unmet direct dependencies detected for USB_SNP_CORE Depends on [n]: USB_SUPPORT [=3Dy] && USB_GADGET [=3Dy] && (USB_AMD5536UD= C [=3Dy] || USB_SNP_UDC_PLAT [=3Dn]) && HAS_DMA [=3Dn] Selected by [y]: - USB_AMD5536UDC [=3Dy] && USB_SUPPORT [=3Dy] && USB_GADGET [=3Dy] && USB= _PCI [=3Dy] Fixes: 97b3ffa233b9 ("usb: gadget: udc: amd5536: split core and PCI layer") Cc: Raviteja Garimella Cc: Felipe Balbi Cc: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman Signed-off-by: Randy Dunlap Link: https://lore.kernel.org/r/20220709013601.7536-1-rdunlap@infradead.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/usb/gadget/udc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/gadget/udc/Kconfig b/drivers/usb/gadget/udc/Kconfig index 69394dc1cdfb..2cdd37be165a 100644 --- a/drivers/usb/gadget/udc/Kconfig +++ b/drivers/usb/gadget/udc/Kconfig @@ -311,7 +311,7 @@ source "drivers/usb/gadget/udc/bdc/Kconfig" =20 config USB_AMD5536UDC tristate "AMD5536 UDC" - depends on USB_PCI + depends on USB_PCI && HAS_DMA select USB_SNP_CORE help The AMD5536 UDC is part of the AMD Geode CS5536, an x86 southbridge. --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD1FFC25B08 for ; Mon, 15 Aug 2022 19:23:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244816AbiHOTXU (ORCPT ); Mon, 15 Aug 2022 15:23:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344221AbiHOTUq (ORCPT ); Mon, 15 Aug 2022 15:20: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 D051759264; Mon, 15 Aug 2022 11:40: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 EF3E9B81085; Mon, 15 Aug 2022 18:40:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2EAEAC433C1; Mon, 15 Aug 2022 18:39:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588800; bh=O4SfQ5D1AyxFTpjpSClFOyGOYUOzakR3Z6tmmpcgcDA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L5nHUFxIGKThQNMn4Fdn1twwlH0yeNhOFoeMqQ6pqf3GVxgEjYSFQvFnEJy7uXhbB jJRgTmO0DLd8rRRh6ntxxE9XwzIJtukaDFppT5gKjwtrbylWmZLcCJVmBiEFyEzr9O KsTYTflxyrdOTjK/Axq29ctq8xNH/i96ciOE+x+8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Sasha Levin Subject: [PATCH 5.15 491/779] usb: aspeed-vhub: Fix refcount leak bug in ast_vhub_init_desc() Date: Mon, 15 Aug 2022 20:02:15 +0200 Message-Id: <20220815180358.252561345@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 220fafb4ed04187e9c17be4152da5a7f2ffbdd8c ] We should call of_node_put() for the reference returned by of_get_child_by_name() which has increased the refcount. Fixes: 30d2617fd7ed ("usb: gadget: aspeed: allow to set usb strings in devi= ce tree") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220713120528.368168-1-windhl@126.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/usb/gadget/udc/aspeed-vhub/hub.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/udc/aspeed-vhub/hub.c b/drivers/usb/gadget/= udc/aspeed-vhub/hub.c index b9960fdd8a51..16a12d2d492e 100644 --- a/drivers/usb/gadget/udc/aspeed-vhub/hub.c +++ b/drivers/usb/gadget/udc/aspeed-vhub/hub.c @@ -1028,8 +1028,10 @@ static int ast_vhub_init_desc(struct ast_vhub *vhub) /* Initialize vhub String Descriptors. */ INIT_LIST_HEAD(&vhub->vhub_str_desc); desc_np =3D of_get_child_by_name(vhub_np, "vhub-strings"); - if (desc_np) + if (desc_np) { ret =3D ast_vhub_of_parse_str_desc(vhub, desc_np); + of_node_put(desc_np); + } else ret =3D ast_vhub_str_alloc_add(vhub, &ast_vhub_strings); =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F6E8C00140 for ; Mon, 15 Aug 2022 19:23:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244352AbiHOTXz (ORCPT ); Mon, 15 Aug 2022 15:23:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344520AbiHOTVQ (ORCPT ); Mon, 15 Aug 2022 15:21:16 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 048A0266E; Mon, 15 Aug 2022 11:40: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 05AFBB8108E; Mon, 15 Aug 2022 18:40:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CFD2C433C1; Mon, 15 Aug 2022 18:40:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588816; bh=bsGw4uDMs8FsR5eOfmnOT1bUWxKV1Eav05971gcZtZs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h65dcFq7F/M4WPNgidBQ7zCQdbqAAd71W4UCsI6Q1SK8sW9BpnhH4U/nJUQM+dN2d 11/d5k5RzT+UHn5lR2zscreQyhDCD05qSaSsS2Ahkhx6u9ctWeUeiK2X5GITI7QRjK +Yxm3TTJnLVv8hZ94ERoSw8Ic+ZQH6QJFsNZPcNw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thinh Nguyen , Sasha Levin Subject: [PATCH 5.15 492/779] usb: dwc3: core: Deprecate GCTL.CORESOFTRESET Date: Mon, 15 Aug 2022 20:02:16 +0200 Message-Id: <20220815180358.302886615@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Thinh Nguyen [ Upstream commit afbd04e66e5d16ca3c7ea2e3c56eca25558eacf3 ] Synopsys IP DWC_usb32 and DWC_usb31 version 1.90a and above deprecated GCTL.CORESOFTRESET. The DRD mode switching flow is updated to remove the GCTL soft reset. Add version checks to prevent using deprecated setting in mode switching flow. Signed-off-by: Thinh Nguyen Link: https://lore.kernel.org/r/9df529fde6e55f5508321b6bc26e92848044ef2b.16= 55338967.git.Thinh.Nguyen@synopsys.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/usb/dwc3/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 5cb1350ec66d..8adb26599797 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -159,7 +159,8 @@ static void __dwc3_set_mode(struct work_struct *work) } =20 /* For DRD host or device mode only */ - if (dwc->desired_dr_role !=3D DWC3_GCTL_PRTCAP_OTG) { + if ((DWC3_IP_IS(DWC3) || DWC3_VER_IS_PRIOR(DWC31, 190A)) && + dwc->desired_dr_role !=3D DWC3_GCTL_PRTCAP_OTG) { reg =3D dwc3_readl(dwc->regs, DWC3_GCTL); reg |=3D DWC3_GCTL_CORESOFTRESET; dwc3_writel(dwc->regs, DWC3_GCTL, reg); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC0CCC00140 for ; Mon, 15 Aug 2022 19:24:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244218AbiHOTYD (ORCPT ); Mon, 15 Aug 2022 15:24:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344631AbiHOTVZ (ORCPT ); Mon, 15 Aug 2022 15:21: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 ADBBE646F; Mon, 15 Aug 2022 11:40: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 9B55861154; Mon, 15 Aug 2022 18:40:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95C5DC433D6; Mon, 15 Aug 2022 18:40:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588820; bh=sk4lIZvVGOueaKj0wAzDD6CxUXQdfitup2cyTbAEu54=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G2Vd0YFGRN0SGKtGr8UCqXeFlFd05KzdVyLkYvJzMsDpbzSO9vVirmqiDeLL0Src9 zSIKF15PusoMgaN98/2tp+DiGYNcE4w1+XWRg1vUt1hbBvjPkHH2IRYyOu6jp7OY8l MzIRsKcTaH4NOV7jf+6j2rPdLRfSsl2TnI+ObH3w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rohith Kollalsi , Sasha Levin Subject: [PATCH 5.15 493/779] usb: dwc3: core: Do not perform GCTL_CORE_SOFTRESET during bootup Date: Mon, 15 Aug 2022 20:02:17 +0200 Message-Id: <20220815180358.345485471@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rohith Kollalsi [ Upstream commit 07903626d98853e605fe63e5ce149f1b7314bbea ] According to the programming guide, it is recommended to perform a GCTL_CORE_SOFTRESET only when switching the mode from device to host or host to device. However, it is found that during bootup when __dwc3_set_mode() is called for the first time, GCTL_CORESOFTRESET is done with suspendable bit(BIT 17) of DWC3_GUSB3PIPECTL set. This some times leads to issues like controller going into bad state and controller registers reading value zero. Until GCTL_CORESOFTRESET is done and run/stop bit is set core initialization is not complete. Setting suspendable bit of DWC3_GUSB3PIPECTL and then performing GCTL_CORESOFTRESET is therefore not recommended. Avoid this by only performing the reset if current_dr_role is set, that is, when doing subsequent role switching. Fixes: f88359e1588b ("usb: dwc3: core: Do core softreset when switch mode") Signed-off-by: Rohith Kollalsi Link: https://lore.kernel.org/r/20220714045625.20377-1-quic_rkollals@quicin= c.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/usb/dwc3/core.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 8adb26599797..cfac5503aa66 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -158,9 +158,13 @@ static void __dwc3_set_mode(struct work_struct *work) break; } =20 - /* For DRD host or device mode only */ - if ((DWC3_IP_IS(DWC3) || DWC3_VER_IS_PRIOR(DWC31, 190A)) && - dwc->desired_dr_role !=3D DWC3_GCTL_PRTCAP_OTG) { + /* + * When current_dr_role is not set, there's no role switching. + * Only perform GCTL.CoreSoftReset when there's DRD role switching. + */ + if (dwc->current_dr_role && ((DWC3_IP_IS(DWC3) || + DWC3_VER_IS_PRIOR(DWC31, 190A)) && + dwc->desired_dr_role !=3D DWC3_GCTL_PRTCAP_OTG)) { reg =3D dwc3_readl(dwc->regs, DWC3_GCTL); reg |=3D DWC3_GCTL_CORESOFTRESET; dwc3_writel(dwc->regs, DWC3_GCTL, reg); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D463C00140 for ; Mon, 15 Aug 2022 19:24:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244488AbiHOTYJ (ORCPT ); Mon, 15 Aug 2022 15:24:09 -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 S1344714AbiHOTV3 (ORCPT ); Mon, 15 Aug 2022 15:21:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2246A2A42C; Mon, 15 Aug 2022 11:40:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6450AB81082; Mon, 15 Aug 2022 18:40:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96E4EC433D6; Mon, 15 Aug 2022 18:40:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588823; bh=aYrQtE/WimhVTbkxIpPXoPN1X7OpyaVXaJOaKkmQQ0Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ah28mLwNZ/59TcJ9sI4Sey+EKyY4oYqoVRoemh5WFwRihGXWTrImMAdIQkT2F/9l2 Y0x/5teXKPF37ZSU29RFGCu+wLgaVOdP3K/4AkuWpwmGtujTnQz8QSVpVSIIh/PCW/ TnCbvIBOS/0j1RNUu1/vx18z4DlABPBvScFb03Zo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrew Halaney , Johan Hovold , Sasha Levin Subject: [PATCH 5.15 494/779] usb: dwc3: qcom: fix missing optional irq warnings Date: Mon, 15 Aug 2022 20:02:18 +0200 Message-Id: <20220815180358.396095189@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 [ Upstream commit 69bb3520db7cecbccc9e497fc568fa5465c9d43f ] Not all platforms have all of the four currently supported wakeup interrupts so use the optional irq helpers when looking up interrupts to avoid printing error messages when an optional interrupt is not found: dwc3-qcom a6f8800.usb: error -ENXIO: IRQ hs_phy_irq not found Fixes: a4333c3a6ba9 ("usb: dwc3: Add Qualcomm DWC3 glue driver") Reviewed-by: Andrew Halaney Signed-off-by: Johan Hovold Link: https://lore.kernel.org/r/20220713131340.29401-4-johan+linaro@kernel.= org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/usb/dwc3/dwc3-qcom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c index b81a9e1c1315..873bf5041117 100644 --- a/drivers/usb/dwc3/dwc3-qcom.c +++ b/drivers/usb/dwc3/dwc3-qcom.c @@ -443,9 +443,9 @@ static int dwc3_qcom_get_irq(struct platform_device *pd= ev, int ret; =20 if (np) - ret =3D platform_get_irq_byname(pdev_irq, name); + ret =3D platform_get_irq_byname_optional(pdev_irq, name); else - ret =3D platform_get_irq(pdev_irq, num); + ret =3D platform_get_irq_optional(pdev_irq, num); =20 return ret; } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30B9DC00140 for ; Mon, 15 Aug 2022 19:24:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244838AbiHOTYT (ORCPT ); Mon, 15 Aug 2022 15:24:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344772AbiHOTVi (ORCPT ); Mon, 15 Aug 2022 15:21: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 7673C326D2; Mon, 15 Aug 2022 11:40: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 7D810B8108E; Mon, 15 Aug 2022 18:40:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBE69C433D6; Mon, 15 Aug 2022 18:40:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588826; bh=imMcvGzzPpr3rWTwGM7Bb11ZJvZPVZIPQT6qdLY3okI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QgGRwVDaooqf8DiQKtQYlFkuAJuL6t/Idse9qy1MRDyQ7y2wausnk0x32go4XpQED hIZ1HprnyPbUvVVTyXp+SABhlabQ4B8PmkOEyu+nql4RPgrob0WaE8APq90Bt7/GNY i34bb0pDmLfR2SRz5gxU1E6oSPCkTqIHZpz+oUtE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Semin , Dan Carpenter , Sasha Levin Subject: [PATCH 5.15 495/779] eeprom: idt_89hpesx: uninitialized data in idt_dbgfs_csr_write() Date: Mon, 15 Aug 2022 20:02:19 +0200 Message-Id: <20220815180358.445525049@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter [ Upstream commit 71d46f1ff2212ced4852c7e77c5176382a1bdcec ] The simple_write_to_buffer() function will return positive/success if it is able to write a single byte anywhere within the buffer. However that potentially leaves a lot of the buffer uninitialized. In this code it's better to return 0 if the offset is non-zero. This code is not written to support partial writes. And then return -EFAULT if the buffer is not completely initialized. Fixes: cfad6425382e ("eeprom: Add IDT 89HPESx EEPROM/CSR driver") Reviewed-by: Serge Semin Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/Ysg1Pu/nzSMe3r1q@kili Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/misc/eeprom/idt_89hpesx.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/misc/eeprom/idt_89hpesx.c b/drivers/misc/eeprom/idt_89= hpesx.c index b0cff4b152da..7f430742ce2b 100644 --- a/drivers/misc/eeprom/idt_89hpesx.c +++ b/drivers/misc/eeprom/idt_89hpesx.c @@ -909,14 +909,18 @@ static ssize_t idt_dbgfs_csr_write(struct file *filep= , const char __user *ubuf, u32 csraddr, csrval; char *buf; =20 + if (*offp) + return 0; + /* Copy data from User-space */ buf =3D kmalloc(count + 1, GFP_KERNEL); if (!buf) return -ENOMEM; =20 - ret =3D simple_write_to_buffer(buf, count, offp, ubuf, count); - if (ret < 0) + if (copy_from_user(buf, ubuf, count)) { + ret =3D -EFAULT; goto free_buf; + } buf[count] =3D 0; =20 /* Find position of colon in the buffer */ --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0EE59C00140 for ; Mon, 15 Aug 2022 19:24:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244951AbiHOTYW (ORCPT ); Mon, 15 Aug 2022 15:24:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344800AbiHOTVk (ORCPT ); Mon, 15 Aug 2022 15:21:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9968B39B80; Mon, 15 Aug 2022 11:40: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 B99EFB81092; Mon, 15 Aug 2022 18:40:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC08EC433D6; Mon, 15 Aug 2022 18:40:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588829; bh=wh6oA0bfx8XoMes9N0kUyWQLjD1kB7YEXaTdqVFx3jM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KSpg9xf1W0QEnDsCGNbPn/naDn4ceV+PszL6WIDBU0eoL2lkPc1NHQbaWV++J+Fop GNJGlm23oP5cfl++iAOk6pyERnZQAnc3FCkD1Ua8NZR9T/6NPYISzfzs+Wg1nMftNs SUjX2RQBEzhQ/rlDnDURU7CG5vJe8vY0pM1IPPD4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fabrice Gasnier , Vinod Koul , Sasha Levin Subject: [PATCH 5.15 496/779] phy: stm32: fix error return in stm32_usbphyc_phy_init Date: Mon, 15 Aug 2022 20:02:20 +0200 Message-Id: <20220815180358.486937276@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Fabrice Gasnier [ Upstream commit 32b378a9179ae4db61cfc5d502717214e6cd1e1c ] Error code is overridden, in case the PLL doesn't lock. So, the USB initialization can continue. This leads to a platform freeze. This can be avoided by returning proper error code to avoid USB probe freezing the platform. It also displays proper errors in log. Fixes: 5b1af71280ab ("phy: stm32: rework PLL Lock detection") Signed-off-by: Fabrice Gasnier Link: https://lore.kernel.org/r/20220713133953.595134-1-fabrice.gasnier@fos= s.st.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/phy/st/phy-stm32-usbphyc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/phy/st/phy-stm32-usbphyc.c b/drivers/phy/st/phy-stm32-= usbphyc.c index da05642d3bd4..cd0747ab6267 100644 --- a/drivers/phy/st/phy-stm32-usbphyc.c +++ b/drivers/phy/st/phy-stm32-usbphyc.c @@ -279,7 +279,9 @@ static int stm32_usbphyc_phy_init(struct phy *phy) return 0; =20 pll_disable: - return stm32_usbphyc_pll_disable(usbphyc); + stm32_usbphyc_pll_disable(usbphyc); + + return ret; } =20 static int stm32_usbphyc_phy_exit(struct phy *phy) --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24961C00140 for ; Mon, 15 Aug 2022 19:24:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244261AbiHOTY3 (ORCPT ); Mon, 15 Aug 2022 15:24:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243891AbiHOTVm (ORCPT ); Mon, 15 Aug 2022 15:21:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F13B43D5BD; Mon, 15 Aug 2022 11:40:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 02746611B9; Mon, 15 Aug 2022 18:40:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A554C433D7; Mon, 15 Aug 2022 18:40:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588832; bh=QZTpeShZqGomUhO9hz65Uhh5sjEr5H4rDMz0+UZAq88=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m5/6W4AttMb90ruu57Ar4Ot0LtrpWM0q5RuI76rS2izJ3ffoRbRUrRUXWfWaSxHmN HdPytH5C+BwNZ2C9O5NcuVvktwWvXR4RSG7gAx8Skpd/ZuSmYrLEuRp/vFLwyapuRe oTCoBp+0JxRBkOc7423zuwpCQiVwc125phb0rUuw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Laurent Pinchart , Peng Fan , Georgi Djakov , Sasha Levin Subject: [PATCH 5.15 497/779] interconnect: imx: fix max_node_id Date: Mon, 15 Aug 2022 20:02:21 +0200 Message-Id: <20220815180358.518025334@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peng Fan [ Upstream commit bd734481e172b4827af09c9ab06c51d2ab7201e6 ] max_node_id not equal to the ARRAY_SIZE of node array, need increase 1, otherwise xlate will fail for the last entry. And rename max_node_id to num_nodes to reflect the reality. Fixes: f0d8048525d7d ("interconnect: Add imx core driver") Reviewed-by: Laurent Pinchart Signed-off-by: Peng Fan Link: https://lore.kernel.org/r/20220703091132.1412063-5-peng.fan@oss.nxp.c= om Signed-off-by: Georgi Djakov Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/interconnect/imx/imx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/interconnect/imx/imx.c b/drivers/interconnect/imx/imx.c index c770951a909c..aabd9edf2ef7 100644 --- a/drivers/interconnect/imx/imx.c +++ b/drivers/interconnect/imx/imx.c @@ -226,16 +226,16 @@ int imx_icc_register(struct platform_device *pdev, struct device *dev =3D &pdev->dev; struct icc_onecell_data *data; struct icc_provider *provider; - int max_node_id; + int num_nodes; int ret; =20 /* icc_onecell_data is indexed by node_id, unlike nodes param */ - max_node_id =3D get_max_node_id(nodes, nodes_count); - data =3D devm_kzalloc(dev, struct_size(data, nodes, max_node_id), + num_nodes =3D get_max_node_id(nodes, nodes_count) + 1; + data =3D devm_kzalloc(dev, struct_size(data, nodes, num_nodes), GFP_KERNEL); if (!data) return -ENOMEM; - data->num_nodes =3D max_node_id; + data->num_nodes =3D num_nodes; =20 provider =3D devm_kzalloc(dev, sizeof(*provider), GFP_KERNEL); if (!provider) --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8367FC3F6B0 for ; Mon, 15 Aug 2022 19:21:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344179AbiHOTUo (ORCPT ); Mon, 15 Aug 2022 15:20:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344848AbiHOTRf (ORCPT ); Mon, 15 Aug 2022 15:17:35 -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 56C7B3CBCD; Mon, 15 Aug 2022 11:38: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 sin.source.kernel.org (Postfix) with ESMTPS id 4AF0CCE1255; Mon, 15 Aug 2022 18:38:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16758C433C1; Mon, 15 Aug 2022 18:38:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588732; bh=hwUVotYLPPfsowZItZNAHswZcEHPnU+JPQbbWO55Yh0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GRlBNkgwFOU3dOB4Q5GkBBmQasZewk6GLGEOsd0hHO6Peb1c9AyqaJmq7xx3ZQrUP n4mrjw8LPbvImb1GHIpZh/2oOQbKWiPaoY/kOR87INEVUgKO8zrgTitNnOaI3OxOoZ DHb/L3a5xROLz/vJTFO2FfFptMFX66gNHbqcnNIg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Christopher Obbard , Richard Weinberger , Sasha Levin Subject: [PATCH 5.15 498/779] um: random: Dont initialise hwrng struct with zero Date: Mon, 15 Aug 2022 20:02:22 +0200 Message-Id: <20220815180358.557509500@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christopher Obbard [ Upstream commit 9e70cbd11b03889c92462cf52edb2bd023c798fa ] Initialising the hwrng struct with zeros causes a compile-time sparse warning: $ ARCH=3Dum make -j10 W=3D1 C=3D1 CF=3D'-fdiagnostic-prefix -D__CHECK_ENDI= AN__' ... CHECK arch/um/drivers/random.c arch/um/drivers/random.c:31:31: sparse: warning: Using plain integer as NU= LL pointer Fix the warning by not initialising the hwrng struct with zeros as it is initialised anyway during module init. Fixes: 72d3e093afae ("um: random: Register random as hwrng-core device") Reported-by: kernel test robot Signed-off-by: Christopher Obbard Signed-off-by: Richard Weinberger Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/um/drivers/random.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/um/drivers/random.c b/arch/um/drivers/random.c index 433a3f8f2ef3..32b3341fe970 100644 --- a/arch/um/drivers/random.c +++ b/arch/um/drivers/random.c @@ -28,7 +28,7 @@ * protects against a module being loaded twice at the same time. */ static int random_fd =3D -1; -static struct hwrng hwrng =3D { 0, }; +static struct hwrng hwrng; static DECLARE_COMPLETION(have_data); =20 static int rng_dev_read(struct hwrng *rng, void *buf, size_t max, bool blo= ck) --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B61A5C28B2B for ; Mon, 15 Aug 2022 19:21:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344281AbiHOTUz (ORCPT ); Mon, 15 Aug 2022 15:20:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344883AbiHOTRn (ORCPT ); Mon, 15 Aug 2022 15:17: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 E4BF3558DA; Mon, 15 Aug 2022 11:38: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 CB801B81081; Mon, 15 Aug 2022 18:38:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24C39C433D6; Mon, 15 Aug 2022 18:38:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588735; bh=pIzzsxQZ0lTJl48X9dv6tsuNTaxcxVQ8obhY4NcL4Zk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Eh700bd0hfxiym7P+8+FSAeoyDbrrYRtrHw2iZ54C+6qLydip11tl/4bHs5z6ddm7 Eg6OFuPPmL4HS63/gnp4FOMeousnGi8vDNCevJ9n8cC/lV+ni71StE0UURJehmaUTP eyG4No2alXjJRsLR2irqHuu49MPCCkCEeXc5PZ2s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bartosz Sobczak , Mustafa Ismail , Shiraz Saleem , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.15 499/779] RDMA/irdma: Fix a window for use-after-free Date: Mon, 15 Aug 2022 20:02:23 +0200 Message-Id: <20220815180358.597414952@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mustafa Ismail [ Upstream commit 8ecef7890b3aea78c8bbb501a4b5b8134367b821 ] During a destroy CQ an interrupt may cause processing of a CQE after CQ resources are freed by irdma_cq_free_rsrc(). Fix this by moving the call to irdma_cq_free_rsrc() after the irdma_sc_cleanup_ceqes(), which is called under the cq_lock. Fixes: b48c24c2d710 ("RDMA/irdma: Implement device supported verb APIs") Link: https://lore.kernel.org/r/20220705230815.265-6-shiraz.saleem@intel.com Signed-off-by: Bartosz Sobczak Signed-off-by: Mustafa Ismail Signed-off-by: Shiraz Saleem Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/infiniband/hw/irdma/verbs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/irdma/verbs.c b/drivers/infiniband/hw/ir= dma/verbs.c index 0eef46428691..cac4fb228b9b 100644 --- a/drivers/infiniband/hw/irdma/verbs.c +++ b/drivers/infiniband/hw/irdma/verbs.c @@ -1759,11 +1759,11 @@ static int irdma_destroy_cq(struct ib_cq *ib_cq, st= ruct ib_udata *udata) spin_unlock_irqrestore(&iwcq->lock, flags); =20 irdma_cq_wq_destroy(iwdev->rf, cq); - irdma_cq_free_rsrc(iwdev->rf, iwcq); =20 spin_lock_irqsave(&iwceq->ce_lock, flags); irdma_sc_cleanup_ceqes(cq, ceq); spin_unlock_irqrestore(&iwceq->ce_lock, flags); + irdma_cq_free_rsrc(iwdev->rf, iwcq); =20 return 0; } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53643C32757 for ; Mon, 15 Aug 2022 19:21:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344729AbiHOTVc (ORCPT ); Mon, 15 Aug 2022 15:21:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344889AbiHOTRo (ORCPT ); Mon, 15 Aug 2022 15:17: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 3FA1C558F0; Mon, 15 Aug 2022 11:39: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 3E7EFB8105C; Mon, 15 Aug 2022 18:39:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C767C433D6; Mon, 15 Aug 2022 18:38:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588739; bh=FO5FuCDiC+4i1yKpY0Hw5oLucabGxrGAshN1rPgeW9Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ftqvrhWQq/57D1DJOK7zLRyWOyFsNva/7EpMHYmN/6N3CsJALhdp1JOf2Wkm1kEsP +zhDMPUcP7qogys0Ow3Y/8y7L3Phz5yHzAkLAYRNpIQawybvAJ845IIql+BdRwvAeL 8yvOTBZ6nUL3ta9DlkN/biB4PWQtBvi3s2gdpRp8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mustafa Ismail , Shiraz Saleem , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.15 500/779] RDMA/irdma: Fix VLAN connection with wildcard address Date: Mon, 15 Aug 2022 20:02:24 +0200 Message-Id: <20220815180358.640355015@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mustafa Ismail [ Upstream commit 82ab2b52654c43ba24a3f6603fec40874cc5a7e5 ] When an application listens on a wildcard address, and there are VLAN and non-VLAN IP addresses, iWARP connection establishemnt can fail if the listen node VLAN ID does not match. Fix this by checking the vlan_id only if not a wildcard listen node. Fixes: 146b9756f14c ("RDMA/irdma: Add connection manager") Link: https://lore.kernel.org/r/20220705230815.265-7-shiraz.saleem@intel.com Signed-off-by: Mustafa Ismail Signed-off-by: Shiraz Saleem Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/infiniband/hw/irdma/cm.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/hw/irdma/cm.c b/drivers/infiniband/hw/irdma= /cm.c index 60d4e9c151ff..b08c67bb264c 100644 --- a/drivers/infiniband/hw/irdma/cm.c +++ b/drivers/infiniband/hw/irdma/cm.c @@ -1477,12 +1477,13 @@ irdma_find_listener(struct irdma_cm_core *cm_core, = u32 *dst_addr, u16 dst_port, list_for_each_entry (listen_node, &cm_core->listen_list, list) { memcpy(listen_addr, listen_node->loc_addr, sizeof(listen_addr)); listen_port =3D listen_node->loc_port; + if (listen_port !=3D dst_port || + !(listener_state & listen_node->listener_state)) + continue; /* compare node pair, return node handle if a match */ - if ((!memcmp(listen_addr, dst_addr, sizeof(listen_addr)) || - !memcmp(listen_addr, ip_zero, sizeof(listen_addr))) && - listen_port =3D=3D dst_port && - vlan_id =3D=3D listen_node->vlan_id && - (listener_state & listen_node->listener_state)) { + if (!memcmp(listen_addr, ip_zero, sizeof(listen_addr)) || + (!memcmp(listen_addr, dst_addr, sizeof(listen_addr)) && + vlan_id =3D=3D listen_node->vlan_id)) { refcount_inc(&listen_node->refcnt); spin_unlock_irqrestore(&cm_core->listen_list_lock, flags); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D541DC2BB41 for ; Mon, 15 Aug 2022 19:21:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344376AbiHOTVD (ORCPT ); Mon, 15 Aug 2022 15:21:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344947AbiHOTRv (ORCPT ); Mon, 15 Aug 2022 15:17: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 3C6FD558FB; Mon, 15 Aug 2022 11:39: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 337FFB81088; Mon, 15 Aug 2022 18:39:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8341BC433D6; Mon, 15 Aug 2022 18:39:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588742; bh=1/L9E/HWhXwNZo+8775NT4/HZHMFFz51S99HxU4lLJE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D3BrnLtWY4eYoSl18ZFtbAnspZbCAv2cCqgaM/2JPNOTmZiRXcgGZB4vn56ddxSxB OG1tcoGqQU3I2oIgyEAF8le5AtdwvjQySi+uwUFzA+Hfy5M5tNuJU8hOFs6HEYm+J8 F3lGP6Pb/dPfuANSKopwo66PVAsazr0iiKHqCAFo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mustafa Ismail , Shiraz Saleem , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.15 501/779] RDMA/irdma: Fix setting of QP context err_rq_idx_valid field Date: Mon, 15 Aug 2022 20:02:25 +0200 Message-Id: <20220815180358.690324779@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mustafa Ismail [ Upstream commit 3a844596ed71b7c12ac602f6f6b7b0f17e4d6a90 ] Setting err_rq_idx_valid field in QP context when the AE source of the AEQE is not associated with an RQ causes the firmware flush to fail. Set err_rq_idx_valid field in QP context only if it is associated with an RQ. Additionally, cleanup the redundant setting of this field in irdma_process_aeq. Fixes: 44d9e52977a1 ("RDMA/irdma: Implement device initialization definitio= ns") Link: https://lore.kernel.org/r/20220705230815.265-8-shiraz.saleem@intel.com Signed-off-by: Mustafa Ismail Signed-off-by: Shiraz Saleem Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/infiniband/hw/irdma/hw.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/infiniband/hw/irdma/hw.c b/drivers/infiniband/hw/irdma= /hw.c index 4f763e552eae..3d5d3f8d5ded 100644 --- a/drivers/infiniband/hw/irdma/hw.c +++ b/drivers/infiniband/hw/irdma/hw.c @@ -257,10 +257,6 @@ static void irdma_process_aeq(struct irdma_pci_f *rf) iwqp->last_aeq =3D info->ae_id; spin_unlock_irqrestore(&iwqp->lock, flags); ctx_info =3D &iwqp->ctx_info; - if (rdma_protocol_roce(&iwqp->iwdev->ibdev, 1)) - ctx_info->roce_info->err_rq_idx_valid =3D true; - else - ctx_info->iwarp_info->err_rq_idx_valid =3D true; } else { if (info->ae_id !=3D IRDMA_AE_CQ_OPERATION_ERROR) continue; @@ -370,16 +366,12 @@ static void irdma_process_aeq(struct irdma_pci_f *rf) case IRDMA_AE_LCE_FUNCTION_CATASTROPHIC: case IRDMA_AE_LCE_CQ_CATASTROPHIC: case IRDMA_AE_UDA_XMIT_DGRAM_TOO_LONG: - if (rdma_protocol_roce(&iwdev->ibdev, 1)) - ctx_info->roce_info->err_rq_idx_valid =3D false; - else - ctx_info->iwarp_info->err_rq_idx_valid =3D false; - fallthrough; default: ibdev_err(&iwdev->ibdev, "abnormal ae_id =3D 0x%x bool qp=3D%d qp_id = =3D %d\n", info->ae_id, info->qp, info->qp_cq_id); if (rdma_protocol_roce(&iwdev->ibdev, 1)) { - if (!info->sq && ctx_info->roce_info->err_rq_idx_valid) { + ctx_info->roce_info->err_rq_idx_valid =3D info->rq; + if (info->rq) { ctx_info->roce_info->err_rq_idx =3D info->wqe_idx; irdma_sc_qp_setctx_roce(&iwqp->sc_qp, iwqp->host_ctx.va, ctx_info); @@ -388,7 +380,8 @@ static void irdma_process_aeq(struct irdma_pci_f *rf) irdma_cm_disconn(iwqp); break; } - if (!info->sq && ctx_info->iwarp_info->err_rq_idx_valid) { + ctx_info->iwarp_info->err_rq_idx_valid =3D info->rq; + if (info->rq) { ctx_info->iwarp_info->err_rq_idx =3D info->wqe_idx; ctx_info->tcp_info_valid =3D false; ctx_info->iwarp_info_valid =3D true; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6B30C282E7 for ; Mon, 15 Aug 2022 19:21:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344336AbiHOTU7 (ORCPT ); Mon, 15 Aug 2022 15:20:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344926AbiHOTRt (ORCPT ); Mon, 15 Aug 2022 15:17:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50EE4564C5; Mon, 15 Aug 2022 11:39: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 896F761120; Mon, 15 Aug 2022 18:39:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8EB05C433D6; Mon, 15 Aug 2022 18:39:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588745; bh=JKHcDBZsZRMwwOITBiCJ9ZA2CMg2W48vTA7rzjDmilU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JUzFYUBrIJVBaAXl0HhFe3+zPpZg9cKOhCHaKA2cazn/2u4ILfnn5qR5UzklQkNtb Htmd/N4JV8RDMSWX+ZpIu2uhrRnRPIUTtX7Joipr26ntXs7E2KRyt3+C8KdZ1da5Md 7BxDLHYC63ksEjdV8wSHsuQIZm5vFjvEkaksaHnk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, jinpu.wang@ionos.com, Md Haris Iqbal , Aleksei Marov , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.15 502/779] RDMA/rtrs-srv: Fix modinfo output for stringify Date: Mon, 15 Aug 2022 20:02:26 +0200 Message-Id: <20220815180358.721711054@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jack Wang [ Upstream commit ed6e53820ee4f68ed927de17e5675ff2a07a47e2 ] stringify works with define, not enum. Fixes: 91fddedd439c ("RDMA/rtrs: private headers with rtrs protocol structs= and helpers") Cc: jinpu.wang@ionos.com Link: https://lore.kernel.org/r/20220712103113.617754-2-haris.iqbal@ionos.c= om Signed-off-by: Jack Wang Signed-off-by: Md Haris Iqbal Reviewed-by: Aleksei Marov Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/infiniband/ulp/rtrs/rtrs-pri.h | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-pri.h b/drivers/infiniband/ul= p/rtrs/rtrs-pri.h index d12ddfa50747..e39267bccce8 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-pri.h +++ b/drivers/infiniband/ulp/rtrs/rtrs-pri.h @@ -23,6 +23,17 @@ #define RTRS_PROTO_VER_STRING __stringify(RTRS_PROTO_VER_MAJOR) "." \ __stringify(RTRS_PROTO_VER_MINOR) =20 +/* + * Max IB immediate data size is 2^28 (MAX_IMM_PAYL_BITS) + * and the minimum chunk size is 4096 (2^12). + * So the maximum sess_queue_depth is 65536 (2^16) in theory. + * But mempool_create, create_qp and ib_post_send fail with + * "cannot allocate memory" error if sess_queue_depth is too big. + * Therefore the pratical max value of sess_queue_depth is + * somewhere between 1 and 65534 and it depends on the system. + */ +#define MAX_SESS_QUEUE_DEPTH 65535 + enum rtrs_imm_const { MAX_IMM_TYPE_BITS =3D 4, MAX_IMM_TYPE_MASK =3D ((1 << MAX_IMM_TYPE_BITS) - 1), @@ -46,16 +57,6 @@ enum { =20 MAX_PATHS_NUM =3D 128, =20 - /* - * Max IB immediate data size is 2^28 (MAX_IMM_PAYL_BITS) - * and the minimum chunk size is 4096 (2^12). - * So the maximum sess_queue_depth is 65536 (2^16) in theory. - * But mempool_create, create_qp and ib_post_send fail with - * "cannot allocate memory" error if sess_queue_depth is too big. - * Therefore the pratical max value of sess_queue_depth is - * somewhere between 1 and 65534 and it depends on the system. - */ - MAX_SESS_QUEUE_DEPTH =3D 65535, MIN_CHUNK_SIZE =3D 8192, =20 RTRS_HB_INTERVAL_MS =3D 5000, --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9CB6C28B2C for ; Mon, 15 Aug 2022 19:21:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344416AbiHOTVH (ORCPT ); Mon, 15 Aug 2022 15:21:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344975AbiHOTRy (ORCPT ); Mon, 15 Aug 2022 15:17:54 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71551564E1; Mon, 15 Aug 2022 11:39: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 BEEB3CE1253; Mon, 15 Aug 2022 18:39:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8CD21C433C1; Mon, 15 Aug 2022 18:39:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588749; bh=4QTy4VuNrwHbm6F9nK5OsrjmKkU9hM9GD3lZEJ/H5jM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V+t4GyKuTa4WkToCH5DYkHGvUO6igRPxxk37bsVPmlVEP0chvZlsL48V4+tki55Ap Nsckdf7mU52cxmMAo0lNYKUiC0qThDaquCIXji7ww3ltz06JD14ZGsFRRPjdP8C/OT hQgdAAx1i78qKh0vpgYZljBSlqP2/AKQNsK66kVo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jack Wang , Gioh Kim , Md Haris Iqbal , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.15 503/779] RDMA/rtrs: Fix warning when use poll mode on client side. Date: Mon, 15 Aug 2022 20:02:27 +0200 Message-Id: <20220815180358.762412809@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jack Wang [ Upstream commit 4b6afe9bc955bee44c0527005c3fb0edac91ac30 ] When testing with poll mode, it will fail and lead to warning below on client side: $ echo "sessname=3Dbla path=3Dgid:fe80::2:c903:4e:d0b3@gid:fe80::2:c903:8:c= a17 device_path=3D/dev/nullb2 nr_poll_queues=3D-1" | \ sudo tee /sys/devices/virtual/rnbd-client/ctl/map_device rnbd_client L597: Mapping device /dev/nullb2 on session bla, (access_mode: = rw, nr_poll_queues: 8) WARNING: CPU: 3 PID: 9886 at drivers/infiniband/core/cq.c:447 ib_cq_pool_ge= t+0x26f/0x2a0 [ib_core] The problem is in case of poll queue, we need to still call ib_alloc_cq/ib_free_cq, we can't use cq_poll api for poll queue. As both client and server use shared function from rtrs, set irq_con_num to con_num on server side, which is number of total connection of the session, this way we can differ if the rtrs_con requires pollqueue. Following up patches will replace the duplicate code with helpers. Link: https://lore.kernel.org/r/20210922125333.351454-4-haris.iqbal@ionos.c= om Signed-off-by: Jack Wang Reviewed-by: Gioh Kim Signed-off-by: Md Haris Iqbal Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/infiniband/ulp/rtrs/rtrs-srv.c | 1 + drivers/infiniband/ulp/rtrs/rtrs.c | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.c b/drivers/infiniband/ul= p/rtrs/rtrs-srv.c index 716ef7b23558..078a1cbac90c 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c @@ -1766,6 +1766,7 @@ static struct rtrs_srv_sess *__alloc_sess(struct rtrs= _srv *srv, strscpy(sess->s.sessname, str, sizeof(sess->s.sessname)); =20 sess->s.con_num =3D con_num; + sess->s.irq_con_num =3D con_num; sess->s.recon_cnt =3D recon_cnt; uuid_copy(&sess->s.uuid, uuid); spin_lock_init(&sess->state_lock); diff --git a/drivers/infiniband/ulp/rtrs/rtrs.c b/drivers/infiniband/ulp/rt= rs/rtrs.c index ca542e477d38..9bc323490ce3 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs.c +++ b/drivers/infiniband/ulp/rtrs/rtrs.c @@ -228,7 +228,12 @@ static int create_cq(struct rtrs_con *con, int cq_vect= or, int nr_cqe, struct rdma_cm_id *cm_id =3D con->cm_id; struct ib_cq *cq; =20 - cq =3D ib_cq_pool_get(cm_id->device, nr_cqe, cq_vector, poll_ctx); + if (con->cid >=3D con->sess->irq_con_num) + cq =3D ib_alloc_cq(cm_id->device, con, nr_cqe, cq_vector, + poll_ctx); + else + cq =3D ib_cq_pool_get(cm_id->device, nr_cqe, cq_vector, poll_ctx); + if (IS_ERR(cq)) { rtrs_err(con->sess, "Creating completion queue failed, errno: %ld\n", PTR_ERR(cq)); @@ -283,7 +288,10 @@ int rtrs_cq_qp_create(struct rtrs_sess *sess, struct r= trs_con *con, err =3D create_qp(con, sess->dev->ib_pd, max_send_wr, max_recv_wr, max_send_sge); if (err) { - ib_cq_pool_put(con->cq, con->nr_cqe); + if (con->cid >=3D con->sess->irq_con_num) + ib_free_cq(con->cq); + else + ib_cq_pool_put(con->cq, con->nr_cqe); con->cq =3D NULL; return err; } @@ -300,7 +308,10 @@ void rtrs_cq_qp_destroy(struct rtrs_con *con) con->qp =3D NULL; } if (con->cq) { - ib_cq_pool_put(con->cq, con->nr_cqe); + if (con->cid >=3D con->sess->irq_con_num) + ib_free_cq(con->cq); + else + ib_cq_pool_put(con->cq, con->nr_cqe); con->cq =3D NULL; } } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04FD3C2BB43 for ; Mon, 15 Aug 2022 19:21:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344457AbiHOTVN (ORCPT ); Mon, 15 Aug 2022 15:21:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344992AbiHOTR4 (ORCPT ); Mon, 15 Aug 2022 15:17: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 BA6AD564E7; Mon, 15 Aug 2022 11:39: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 7A3CCB81082; Mon, 15 Aug 2022 18:39:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B77B0C433C1; Mon, 15 Aug 2022 18:39:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588752; bh=cJvvpw2V2WkYkJe0YiSF1JkxT/yfNnJe/ox30DG6VCI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PGoCZv2IuFWV70AqKazG5nqSaDLy/4It6sCP91Un3b5qo4TX40yPjE/d5+KyJW/OS xcYNLTYba3HBtk38AfytSMpZynq1rx1IkWU0P33VnVMD8POFaxuxHgsEfM/XrfzwRy ZwLhC4FVqoNuIAdNR47KmVcNbSzsMUk4bT6E1pIU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jack Wang , Md Haris Iqbal , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.15 504/779] RDMA/rtrs: Replace duplicate check with is_pollqueue helper Date: Mon, 15 Aug 2022 20:02:28 +0200 Message-Id: <20220815180358.809789868@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jack Wang [ Upstream commit 36332ded46b6292296bc7170fada6e238a0802cc ] if (con->cid >=3D con->sess->irq_con_num) check can be replaced with a is_pollqueue helper. Link: https://lore.kernel.org/r/20210922125333.351454-5-haris.iqbal@ionos.c= om Signed-off-by: Jack Wang Signed-off-by: Md Haris Iqbal Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/infiniband/ulp/rtrs/rtrs.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs.c b/drivers/infiniband/ulp/rt= rs/rtrs.c index 9bc323490ce3..ac83cd97f838 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs.c +++ b/drivers/infiniband/ulp/rtrs/rtrs.c @@ -222,13 +222,18 @@ static void qp_event_handler(struct ib_event *ev, voi= d *ctx) } } =20 +static bool is_pollqueue(struct rtrs_con *con) +{ + return con->cid >=3D con->sess->irq_con_num; +} + static int create_cq(struct rtrs_con *con, int cq_vector, int nr_cqe, enum ib_poll_context poll_ctx) { struct rdma_cm_id *cm_id =3D con->cm_id; struct ib_cq *cq; =20 - if (con->cid >=3D con->sess->irq_con_num) + if (is_pollqueue(con)) cq =3D ib_alloc_cq(cm_id->device, con, nr_cqe, cq_vector, poll_ctx); else @@ -288,7 +293,7 @@ int rtrs_cq_qp_create(struct rtrs_sess *sess, struct rt= rs_con *con, err =3D create_qp(con, sess->dev->ib_pd, max_send_wr, max_recv_wr, max_send_sge); if (err) { - if (con->cid >=3D con->sess->irq_con_num) + if (is_pollqueue(con)) ib_free_cq(con->cq); else ib_cq_pool_put(con->cq, con->nr_cqe); @@ -308,7 +313,7 @@ void rtrs_cq_qp_destroy(struct rtrs_con *con) con->qp =3D NULL; } if (con->cq) { - if (con->cid >=3D con->sess->irq_con_num) + if (is_pollqueue(con)) ib_free_cq(con->cq); else ib_cq_pool_put(con->cq, con->nr_cqe); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14457C2BB47 for ; Mon, 15 Aug 2022 19:21:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344546AbiHOTVT (ORCPT ); Mon, 15 Aug 2022 15:21:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345009AbiHOTR6 (ORCPT ); Mon, 15 Aug 2022 15:17:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 821E63CBEF; Mon, 15 Aug 2022 11:39: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 197C06117E; Mon, 15 Aug 2022 18:39:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 064E4C433D6; Mon, 15 Aug 2022 18:39:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588755; bh=cCMBIrlmKSsmRED1fe2ktHHoOIacQ+aXMVE7OR2xu+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Egx++DMcR6J8zE3b/c7vivqQFalAm2UvffHPgv4dFSn7w5v04fOnFN4mVco2w0h9d x3xayqCNjmEdq1p7VpWWOegGSBQ/34pAUyWwBfxJ/m0e6E2hOZO6rtof5HD3r98et1 oLgK9m2JrQLSNC0T0TeDjRzWrkP8tUzgj8qqizCs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jack Wang , Md Haris Iqbal , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.15 505/779] RDMA/rtrs: Introduce destroy_cq helper Date: Mon, 15 Aug 2022 20:02:29 +0200 Message-Id: <20220815180358.854001258@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Md Haris Iqbal [ Upstream commit 6f5649afd3984e35c4b862a05c4511c6d18b27af ] The same code snip used twice, to avoid duplicate, replace it with a destroy_cq helper. Link: https://lore.kernel.org/r/20210922125333.351454-6-haris.iqbal@ionos.c= om Signed-off-by: Jack Wang Signed-off-by: Md Haris Iqbal Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/infiniband/ulp/rtrs/rtrs.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs.c b/drivers/infiniband/ulp/rt= rs/rtrs.c index ac83cd97f838..37952c8e768c 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs.c +++ b/drivers/infiniband/ulp/rtrs/rtrs.c @@ -279,6 +279,17 @@ static int create_qp(struct rtrs_con *con, struct ib_p= d *pd, return ret; } =20 +static void destroy_cq(struct rtrs_con *con) +{ + if (con->cq) { + if (is_pollqueue(con)) + ib_free_cq(con->cq); + else + ib_cq_pool_put(con->cq, con->nr_cqe); + } + con->cq =3D NULL; +} + int rtrs_cq_qp_create(struct rtrs_sess *sess, struct rtrs_con *con, u32 max_send_sge, int cq_vector, int nr_cqe, u32 max_send_wr, u32 max_recv_wr, @@ -293,11 +304,7 @@ int rtrs_cq_qp_create(struct rtrs_sess *sess, struct r= trs_con *con, err =3D create_qp(con, sess->dev->ib_pd, max_send_wr, max_recv_wr, max_send_sge); if (err) { - if (is_pollqueue(con)) - ib_free_cq(con->cq); - else - ib_cq_pool_put(con->cq, con->nr_cqe); - con->cq =3D NULL; + destroy_cq(con); return err; } con->sess =3D sess; @@ -312,13 +319,7 @@ void rtrs_cq_qp_destroy(struct rtrs_con *con) rdma_destroy_qp(con->cm_id); con->qp =3D NULL; } - if (con->cq) { - if (is_pollqueue(con)) - ib_free_cq(con->cq); - else - ib_cq_pool_put(con->cq, con->nr_cqe); - con->cq =3D NULL; - } + destroy_cq(con); } EXPORT_SYMBOL_GPL(rtrs_cq_qp_destroy); =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A8EFC32764 for ; Mon, 15 Aug 2022 19:21:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344502AbiHOTVQ (ORCPT ); Mon, 15 Aug 2022 15:21:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345013AbiHOTR6 (ORCPT ); Mon, 15 Aug 2022 15:17:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D45683CBC9; Mon, 15 Aug 2022 11:39: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 27AAE60EEB; Mon, 15 Aug 2022 18:39:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22703C433C1; Mon, 15 Aug 2022 18:39:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588758; bh=me+uVPTFhaXSsPHbDKu2J3u0dmD1ACILvwldhii9Rro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qhE7xj1qrckUzp6/JtwZgYKh6SxpPZhx/Eh4phWtNg5c9fc8MOzVwuXjnJnvd5rrA RiJepeE0X6sZkievcn/wLxrZ0L2r0Hr0mjwULVgYSssGuJv3IFKaZeo1MKEYtEt9WG 0ChAJqrEvnKM4kVSWlSO3T2qwHPSrUGOSt1pJGWA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Md Haris Iqbal , Gioh Kim , Aleksei Marov , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.15 506/779] RDMA/rtrs: Do not allow sessname to contain special symbols / and . Date: Mon, 15 Aug 2022 20:02:30 +0200 Message-Id: <20220815180358.892721182@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Md Haris Iqbal [ Upstream commit dea7bb3ad3e08f96815330f88a62c24d7a9dacae ] Allowing these characters in sessname can lead to unexpected results, particularly because / is used as a separator between files in a path, and . points to the current directory. Link: https://lore.kernel.org/r/20210922125333.351454-7-haris.iqbal@ionos.c= om Signed-off-by: Md Haris Iqbal Reviewed-by: Gioh Kim Reviewed-by: Aleksei Marov Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 6 ++++++ drivers/infiniband/ulp/rtrs/rtrs-srv.c | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ul= p/rtrs/rtrs-clt.c index a23438bacf12..be96701cf281 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c @@ -2790,6 +2790,12 @@ struct rtrs_clt *rtrs_clt_open(struct rtrs_clt_ops *= ops, struct rtrs_clt *clt; int err, i; =20 + if (strchr(sessname, '/') || strchr(sessname, '.')) { + pr_err("sessname cannot contain / and .\n"); + err =3D -EINVAL; + goto out; + } + clt =3D alloc_clt(sessname, paths_num, port, pdu_sz, ops->priv, ops->link_ev, reconnect_delay_sec, diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.c b/drivers/infiniband/ul= p/rtrs/rtrs-srv.c index 078a1cbac90c..7df71f8cf149 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c @@ -803,6 +803,11 @@ static int process_info_req(struct rtrs_srv_con *con, return err; } =20 + if (strchr(msg->sessname, '/') || strchr(msg->sessname, '.')) { + rtrs_err(s, "sessname cannot contain / and .\n"); + return -EINVAL; + } + if (exist_sessname(sess->srv->ctx, msg->sessname, &sess->srv->paths_uuid)) { rtrs_err(s, "sessname is duplicated: %s\n", msg->sessname); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C806DC25B0E for ; Mon, 15 Aug 2022 19:22:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244981AbiHOTWH (ORCPT ); Mon, 15 Aug 2022 15:22:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345028AbiHOTSA (ORCPT ); Mon, 15 Aug 2022 15:18:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EC1A2B198; Mon, 15 Aug 2022 11:39: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 55AE461185; Mon, 15 Aug 2022 18:39:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1BD4BC433B5; Mon, 15 Aug 2022 18:39:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588761; bh=0enAtisZHnTgdJpmSOmGCffS0I8fopq9HDOkb+WOo6k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wcG4N95JEYtlzxCM15KwfMqdOLv654zOv0IrhMtoXcpOFkpkzVPvDrfdRC+XJHzWy a6fCkzR1TZ77khhjLMrwX0M1Tv6z9RGe7imdxQB1znkSOEIsBz9UTchAq56zKuFtrZ iAql2DgEkbWYx8C/rxNETtCv+x6eUhZ2dlkLUAvM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vaishali Thakkar , Jack Wang , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.15 507/779] RDMA/rtrs: Rename rtrs_sess to rtrs_path Date: Mon, 15 Aug 2022 20:02:31 +0200 Message-Id: <20220815180358.926443664@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vaishali Thakkar [ Upstream commit d9372794717f44b6e746d8fbab66763b6d753e71 ] rtrs_sess is in fact a path. This makes it confusing and difficult to get into the code. So let's rename the structure and related use cases of it. Coccinelle was used to do the transformation for most of the occurrences and remaining ones were handled manually. Link: https://lore.kernel.org/r/20220105180708.7774-2-jinpu.wang@ionos.com Signed-off-by: Vaishali Thakkar Signed-off-by: Jack Wang Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/infiniband/ulp/rtrs/rtrs-clt-stats.c | 4 +- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 66 ++++++------- drivers/infiniband/ulp/rtrs/rtrs-clt.h | 4 +- drivers/infiniband/ulp/rtrs/rtrs-pri.h | 14 +-- drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c | 6 +- drivers/infiniband/ulp/rtrs/rtrs-srv.c | 46 ++++----- drivers/infiniband/ulp/rtrs/rtrs-srv.h | 2 +- drivers/infiniband/ulp/rtrs/rtrs.c | 98 ++++++++++---------- 8 files changed, 120 insertions(+), 120 deletions(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt-stats.c b/drivers/infinib= and/ulp/rtrs/rtrs-clt-stats.c index 5e780bdd763d..40b4d6dd4924 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt-stats.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt-stats.c @@ -13,7 +13,7 @@ =20 void rtrs_clt_update_wc_stats(struct rtrs_clt_con *con) { - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.sess); + struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); struct rtrs_clt_stats *stats =3D sess->stats; struct rtrs_clt_stats_pcpu *s; int cpu; @@ -174,7 +174,7 @@ static inline void rtrs_clt_update_rdma_stats(struct rt= rs_clt_stats *stats, void rtrs_clt_update_all_stats(struct rtrs_clt_io_req *req, int dir) { struct rtrs_clt_con *con =3D req->con; - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.sess); + struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); struct rtrs_clt_stats *stats =3D sess->stats; unsigned int len; =20 diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ul= p/rtrs/rtrs-clt.c index be96701cf281..5e73127f2adc 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c @@ -298,7 +298,7 @@ static bool rtrs_clt_change_state_from_to(struct rtrs_c= lt_sess *sess, =20 static void rtrs_rdma_error_recovery(struct rtrs_clt_con *con) { - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.sess); + struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); =20 if (rtrs_clt_change_state_from_to(sess, RTRS_CLT_CONNECTED, @@ -330,7 +330,7 @@ static void rtrs_clt_fast_reg_done(struct ib_cq *cq, st= ruct ib_wc *wc) struct rtrs_clt_con *con =3D to_clt_con(wc->qp->qp_context); =20 if (wc->status !=3D IB_WC_SUCCESS) { - rtrs_err(con->c.sess, "Failed IB_WR_REG_MR: %s\n", + rtrs_err(con->c.path, "Failed IB_WR_REG_MR: %s\n", ib_wc_status_msg(wc->status)); rtrs_rdma_error_recovery(con); } @@ -350,7 +350,7 @@ static void rtrs_clt_inv_rkey_done(struct ib_cq *cq, st= ruct ib_wc *wc) struct rtrs_clt_con *con =3D to_clt_con(wc->qp->qp_context); =20 if (wc->status !=3D IB_WC_SUCCESS) { - rtrs_err(con->c.sess, "Failed IB_WR_LOCAL_INV: %s\n", + rtrs_err(con->c.path, "Failed IB_WR_LOCAL_INV: %s\n", ib_wc_status_msg(wc->status)); rtrs_rdma_error_recovery(con); } @@ -387,7 +387,7 @@ static void complete_rdma_req(struct rtrs_clt_io_req *r= eq, int errno, return; if (WARN_ON(!req->con)) return; - sess =3D to_clt_sess(con->c.sess); + sess =3D to_clt_sess(con->c.path); =20 if (req->sg_cnt) { if (req->dir =3D=3D DMA_FROM_DEVICE && req->need_inv) { @@ -417,7 +417,7 @@ static void complete_rdma_req(struct rtrs_clt_io_req *r= eq, int errno, refcount_inc(&req->ref); err =3D rtrs_inv_rkey(req); if (err) { - rtrs_err(con->c.sess, "Send INV WR key=3D%#x: %d\n", + rtrs_err(con->c.path, "Send INV WR key=3D%#x: %d\n", req->mr->rkey, err); } else if (can_wait) { wait_for_completion(&req->inv_comp); @@ -445,7 +445,7 @@ static void complete_rdma_req(struct rtrs_clt_io_req *r= eq, int errno, req->con =3D NULL; =20 if (errno) { - rtrs_err_rl(con->c.sess, "IO request failed: error=3D%d path=3D%s [%s:%u= ] notify=3D%d\n", + rtrs_err_rl(con->c.path, "IO request failed: error=3D%d path=3D%s [%s:%u= ] notify=3D%d\n", errno, kobject_name(&sess->kobj), sess->hca_name, sess->hca_port, notify); } @@ -459,12 +459,12 @@ static int rtrs_post_send_rdma(struct rtrs_clt_con *c= on, struct rtrs_rbuf *rbuf, u32 off, u32 imm, struct ib_send_wr *wr) { - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.sess); + struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); enum ib_send_flags flags; struct ib_sge sge; =20 if (!req->sg_size) { - rtrs_wrn(con->c.sess, + rtrs_wrn(con->c.path, "Doing RDMA Write failed, no data supplied\n"); return -EINVAL; } @@ -507,21 +507,21 @@ static void rtrs_clt_recv_done(struct rtrs_clt_con *c= on, struct ib_wc *wc) { struct rtrs_iu *iu; int err; - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.sess); + struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); =20 WARN_ON((sess->flags & RTRS_MSG_NEW_RKEY_F) =3D=3D 0); iu =3D container_of(wc->wr_cqe, struct rtrs_iu, cqe); err =3D rtrs_iu_post_recv(&con->c, iu); if (err) { - rtrs_err(con->c.sess, "post iu failed %d\n", err); + rtrs_err(con->c.path, "post iu failed %d\n", err); rtrs_rdma_error_recovery(con); } } =20 static void rtrs_clt_rkey_rsp_done(struct rtrs_clt_con *con, struct ib_wc = *wc) { - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.sess); + struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); struct rtrs_msg_rkey_rsp *msg; u32 imm_type, imm_payload; bool w_inval =3D false; @@ -534,7 +534,7 @@ static void rtrs_clt_rkey_rsp_done(struct rtrs_clt_con = *con, struct ib_wc *wc) iu =3D container_of(wc->wr_cqe, struct rtrs_iu, cqe); =20 if (wc->byte_len < sizeof(*msg)) { - rtrs_err(con->c.sess, "rkey response is malformed: size %d\n", + rtrs_err(con->c.path, "rkey response is malformed: size %d\n", wc->byte_len); goto out; } @@ -600,7 +600,7 @@ static int rtrs_post_recv_empty_x2(struct rtrs_con *con= , struct ib_cqe *cqe) static void rtrs_clt_rdma_done(struct ib_cq *cq, struct ib_wc *wc) { struct rtrs_clt_con *con =3D to_clt_con(wc->qp->qp_context); - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.sess); + struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); u32 imm_type, imm_payload; bool w_inval =3D false; int err; @@ -646,7 +646,7 @@ static void rtrs_clt_rdma_done(struct ib_cq *cq, struct= ib_wc *wc) if (sess->flags & RTRS_MSG_NEW_RKEY_F) return rtrs_clt_recv_done(con, wc); } else { - rtrs_wrn(con->c.sess, "Unknown IMM type %u\n", + rtrs_wrn(con->c.path, "Unknown IMM type %u\n", imm_type); } if (w_inval) @@ -658,7 +658,7 @@ static void rtrs_clt_rdma_done(struct ib_cq *cq, struct= ib_wc *wc) else err =3D rtrs_post_recv_empty(&con->c, &io_comp_cqe); if (err) { - rtrs_err(con->c.sess, "rtrs_post_recv_empty(): %d\n", + rtrs_err(con->c.path, "rtrs_post_recv_empty(): %d\n", err); rtrs_rdma_error_recovery(con); } @@ -693,7 +693,7 @@ static void rtrs_clt_rdma_done(struct ib_cq *cq, struct= ib_wc *wc) static int post_recv_io(struct rtrs_clt_con *con, size_t q_size) { int err, i; - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.sess); + struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); =20 for (i =3D 0; i < q_size; i++) { if (sess->flags & RTRS_MSG_NEW_RKEY_F) { @@ -1013,7 +1013,7 @@ static int rtrs_post_rdma_write_sg(struct rtrs_clt_co= n *con, u32 size, u32 imm, struct ib_send_wr *wr, struct ib_send_wr *tail) { - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.sess); + struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); struct ib_sge *sge =3D req->sge; enum ib_send_flags flags; struct scatterlist *sg; @@ -1074,7 +1074,7 @@ static int rtrs_map_sg_fr(struct rtrs_clt_io_req *req= , size_t count) static int rtrs_clt_write_req(struct rtrs_clt_io_req *req) { struct rtrs_clt_con *con =3D req->con; - struct rtrs_sess *s =3D con->c.sess; + struct rtrs_path *s =3D con->c.path; struct rtrs_clt_sess *sess =3D to_clt_sess(s); struct rtrs_msg_rdma_write *msg; =20 @@ -1168,7 +1168,7 @@ static int rtrs_clt_write_req(struct rtrs_clt_io_req = *req) static int rtrs_clt_read_req(struct rtrs_clt_io_req *req) { struct rtrs_clt_con *con =3D req->con; - struct rtrs_sess *s =3D con->c.sess; + struct rtrs_path *s =3D con->c.path; struct rtrs_clt_sess *sess =3D to_clt_sess(s); struct rtrs_msg_rdma_read *msg; struct rtrs_ib_dev *dev =3D sess->s.dev; @@ -1601,7 +1601,7 @@ static int create_con(struct rtrs_clt_sess *sess, uns= igned int cid) /* Map first two connections to the first CPU */ con->cpu =3D (cid ? cid - 1 : 0) % nr_cpu_ids; con->c.cid =3D cid; - con->c.sess =3D &sess->s; + con->c.path =3D &sess->s; /* Align with srv, init as 1 */ atomic_set(&con->c.wr_cnt, 1); mutex_init(&con->con_mutex); @@ -1613,7 +1613,7 @@ static int create_con(struct rtrs_clt_sess *sess, uns= igned int cid) =20 static void destroy_con(struct rtrs_clt_con *con) { - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.sess); + struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); =20 sess->s.con[con->c.cid] =3D NULL; mutex_destroy(&con->con_mutex); @@ -1622,7 +1622,7 @@ static void destroy_con(struct rtrs_clt_con *con) =20 static int create_con_cq_qp(struct rtrs_clt_con *con) { - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.sess); + struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); u32 max_send_wr, max_recv_wr, cq_num, max_send_sge, wr_limit; int err, cq_vector; struct rtrs_msg_rkey_rsp *rsp; @@ -1711,7 +1711,7 @@ static int create_con_cq_qp(struct rtrs_clt_con *con) =20 static void destroy_con_cq_qp(struct rtrs_clt_con *con) { - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.sess); + struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); =20 /* * Be careful here: destroy_con_cq_qp() can be called even @@ -1745,7 +1745,7 @@ static void destroy_cm(struct rtrs_clt_con *con) =20 static int rtrs_rdma_addr_resolved(struct rtrs_clt_con *con) { - struct rtrs_sess *s =3D con->c.sess; + struct rtrs_path *s =3D con->c.path; int err; =20 mutex_lock(&con->con_mutex); @@ -1764,7 +1764,7 @@ static int rtrs_rdma_addr_resolved(struct rtrs_clt_co= n *con) =20 static int rtrs_rdma_route_resolved(struct rtrs_clt_con *con) { - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.sess); + struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); struct rtrs_clt *clt =3D sess->clt; struct rtrs_msg_conn_req msg; struct rdma_conn_param param; @@ -1799,7 +1799,7 @@ static int rtrs_rdma_route_resolved(struct rtrs_clt_c= on *con) static int rtrs_rdma_conn_established(struct rtrs_clt_con *con, struct rdma_cm_event *ev) { - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.sess); + struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); struct rtrs_clt *clt =3D sess->clt; const struct rtrs_msg_conn_rsp *msg; u16 version, queue_depth; @@ -1887,7 +1887,7 @@ static int rtrs_rdma_conn_established(struct rtrs_clt= _con *con, =20 static inline void flag_success_on_conn(struct rtrs_clt_con *con) { - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.sess); + struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); =20 atomic_inc(&sess->connected_cnt); con->cm_err =3D 1; @@ -1896,7 +1896,7 @@ static inline void flag_success_on_conn(struct rtrs_c= lt_con *con) static int rtrs_rdma_conn_rejected(struct rtrs_clt_con *con, struct rdma_cm_event *ev) { - struct rtrs_sess *s =3D con->c.sess; + struct rtrs_path *s =3D con->c.path; const struct rtrs_msg_conn_rsp *msg; const char *rej_msg; int status, errno; @@ -1937,7 +1937,7 @@ static inline void flag_error_on_conn(struct rtrs_clt= _con *con, int cm_err) if (con->cm_err =3D=3D 1) { struct rtrs_clt_sess *sess; =20 - sess =3D to_clt_sess(con->c.sess); + sess =3D to_clt_sess(con->c.path); if (atomic_dec_and_test(&sess->connected_cnt)) =20 wake_up(&sess->state_wq); @@ -1949,7 +1949,7 @@ static int rtrs_clt_rdma_cm_handler(struct rdma_cm_id= *cm_id, struct rdma_cm_event *ev) { struct rtrs_clt_con *con =3D cm_id->context; - struct rtrs_sess *s =3D con->c.sess; + struct rtrs_path *s =3D con->c.path; struct rtrs_clt_sess *sess =3D to_clt_sess(s); int cm_err =3D 0; =20 @@ -2020,7 +2020,7 @@ static int rtrs_clt_rdma_cm_handler(struct rdma_cm_id= *cm_id, =20 static int create_cm(struct rtrs_clt_con *con) { - struct rtrs_sess *s =3D con->c.sess; + struct rtrs_path *s =3D con->c.path; struct rtrs_clt_sess *sess =3D to_clt_sess(s); struct rdma_cm_id *cm_id; int err; @@ -2375,7 +2375,7 @@ static int init_conns(struct rtrs_clt_sess *sess) static void rtrs_clt_info_req_done(struct ib_cq *cq, struct ib_wc *wc) { struct rtrs_clt_con *con =3D to_clt_con(wc->qp->qp_context); - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.sess); + struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); struct rtrs_iu *iu; =20 iu =3D container_of(wc->wr_cqe, struct rtrs_iu, cqe); @@ -2456,7 +2456,7 @@ static int process_info_rsp(struct rtrs_clt_sess *ses= s, static void rtrs_clt_info_rsp_done(struct ib_cq *cq, struct ib_wc *wc) { struct rtrs_clt_con *con =3D to_clt_con(wc->qp->qp_context); - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.sess); + struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); struct rtrs_msg_info_rsp *msg; enum rtrs_clt_state state; struct rtrs_iu *iu; diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.h b/drivers/infiniband/ul= p/rtrs/rtrs-clt.h index 9dc819885ec7..d616f325bc40 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.h +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.h @@ -125,7 +125,7 @@ struct rtrs_rbuf { }; =20 struct rtrs_clt_sess { - struct rtrs_sess s; + struct rtrs_path s; struct rtrs_clt *clt; wait_queue_head_t state_wq; enum rtrs_clt_state state; @@ -186,7 +186,7 @@ static inline struct rtrs_clt_con *to_clt_con(struct rt= rs_con *c) return container_of(c, struct rtrs_clt_con, c); } =20 -static inline struct rtrs_clt_sess *to_clt_sess(struct rtrs_sess *s) +static inline struct rtrs_clt_sess *to_clt_sess(struct rtrs_path *s) { return container_of(s, struct rtrs_clt_sess, s); } diff --git a/drivers/infiniband/ulp/rtrs/rtrs-pri.h b/drivers/infiniband/ul= p/rtrs/rtrs-pri.h index e39267bccce8..fad06c707b9b 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-pri.h +++ b/drivers/infiniband/ulp/rtrs/rtrs-pri.h @@ -91,7 +91,7 @@ struct rtrs_ib_dev { }; =20 struct rtrs_con { - struct rtrs_sess *sess; + struct rtrs_path *path; struct ib_qp *qp; struct ib_cq *cq; struct rdma_cm_id *cm_id; @@ -101,7 +101,7 @@ struct rtrs_con { atomic_t sq_wr_avail; }; =20 -struct rtrs_sess { +struct rtrs_path { struct list_head entry; struct sockaddr_storage dst_addr; struct sockaddr_storage src_addr; @@ -314,19 +314,19 @@ int rtrs_iu_post_rdma_write_imm(struct rtrs_con *con,= struct rtrs_iu *iu, =20 int rtrs_post_recv_empty(struct rtrs_con *con, struct ib_cqe *cqe); =20 -int rtrs_cq_qp_create(struct rtrs_sess *sess, struct rtrs_con *con, +int rtrs_cq_qp_create(struct rtrs_path *path, struct rtrs_con *con, u32 max_send_sge, int cq_vector, int nr_cqe, u32 max_send_wr, u32 max_recv_wr, enum ib_poll_context poll_ctx); void rtrs_cq_qp_destroy(struct rtrs_con *con); =20 -void rtrs_init_hb(struct rtrs_sess *sess, struct ib_cqe *cqe, +void rtrs_init_hb(struct rtrs_path *path, struct ib_cqe *cqe, unsigned int interval_ms, unsigned int missed_max, void (*err_handler)(struct rtrs_con *con), struct workqueue_struct *wq); -void rtrs_start_hb(struct rtrs_sess *sess); -void rtrs_stop_hb(struct rtrs_sess *sess); -void rtrs_send_hb_ack(struct rtrs_sess *sess); +void rtrs_start_hb(struct rtrs_path *path); +void rtrs_stop_hb(struct rtrs_path *path); +void rtrs_send_hb_ack(struct rtrs_path *path); =20 void rtrs_rdma_dev_pd_init(enum ib_pd_flags pd_flags, struct rtrs_rdma_dev_pd *pool); diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c b/drivers/infinib= and/ulp/rtrs/rtrs-srv-sysfs.c index 20efd44297fb..aedddc416003 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c @@ -37,7 +37,7 @@ static ssize_t rtrs_srv_disconnect_store(struct kobject *= kobj, const char *buf, size_t count) { struct rtrs_srv_sess *sess; - struct rtrs_sess *s; + struct rtrs_path *s; char str[MAXHOSTNAMELEN]; =20 sess =3D container_of(kobj, struct rtrs_srv_sess, kobj); @@ -230,7 +230,7 @@ static struct kobj_type ktype_stats =3D { static int rtrs_srv_create_stats_files(struct rtrs_srv_sess *sess) { int err; - struct rtrs_sess *s =3D &sess->s; + struct rtrs_path *s =3D &sess->s; =20 err =3D kobject_init_and_add(&sess->stats->kobj_stats, &ktype_stats, &sess->kobj, "stats"); @@ -258,7 +258,7 @@ static int rtrs_srv_create_stats_files(struct rtrs_srv_= sess *sess) int rtrs_srv_create_sess_files(struct rtrs_srv_sess *sess) { struct rtrs_srv *srv =3D sess->srv; - struct rtrs_sess *s =3D &sess->s; + struct rtrs_path *s =3D &sess->s; char str[NAME_MAX]; int err; struct rtrs_addr path =3D { diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.c b/drivers/infiniband/ul= p/rtrs/rtrs-srv.c index 7df71f8cf149..de4f214233b6 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c @@ -62,7 +62,7 @@ static inline struct rtrs_srv_con *to_srv_con(struct rtrs= _con *c) return container_of(c, struct rtrs_srv_con, c); } =20 -static inline struct rtrs_srv_sess *to_srv_sess(struct rtrs_sess *s) +static inline struct rtrs_srv_sess *to_srv_sess(struct rtrs_path *s) { return container_of(s, struct rtrs_srv_sess, s); } @@ -180,7 +180,7 @@ static inline void rtrs_srv_put_ops_ids(struct rtrs_srv= _sess *sess) static void rtrs_srv_reg_mr_done(struct ib_cq *cq, struct ib_wc *wc) { struct rtrs_srv_con *con =3D to_srv_con(wc->qp->qp_context); - struct rtrs_sess *s =3D con->c.sess; + struct rtrs_path *s =3D con->c.path; struct rtrs_srv_sess *sess =3D to_srv_sess(s); =20 if (wc->status !=3D IB_WC_SUCCESS) { @@ -197,7 +197,7 @@ static struct ib_cqe local_reg_cqe =3D { =20 static int rdma_write_sg(struct rtrs_srv_op *id) { - struct rtrs_sess *s =3D id->con->c.sess; + struct rtrs_path *s =3D id->con->c.path; struct rtrs_srv_sess *sess =3D to_srv_sess(s); dma_addr_t dma_addr =3D sess->dma_addr[id->msg_id]; struct rtrs_srv_mr *srv_mr; @@ -341,7 +341,7 @@ static int rdma_write_sg(struct rtrs_srv_op *id) static int send_io_resp_imm(struct rtrs_srv_con *con, struct rtrs_srv_op *= id, int errno) { - struct rtrs_sess *s =3D con->c.sess; + struct rtrs_path *s =3D con->c.path; struct rtrs_srv_sess *sess =3D to_srv_sess(s); struct ib_send_wr inv_wr, *wr =3D NULL; struct ib_rdma_wr imm_wr; @@ -482,14 +482,14 @@ bool rtrs_srv_resp_rdma(struct rtrs_srv_op *id, int s= tatus) { struct rtrs_srv_sess *sess; struct rtrs_srv_con *con; - struct rtrs_sess *s; + struct rtrs_path *s; int err; =20 if (WARN_ON(!id)) return true; =20 con =3D id->con; - s =3D con->c.sess; + s =3D con->c.path; sess =3D to_srv_sess(s); =20 id->status =3D status; @@ -564,7 +564,7 @@ static void unmap_cont_bufs(struct rtrs_srv_sess *sess) static int map_cont_bufs(struct rtrs_srv_sess *sess) { struct rtrs_srv *srv =3D sess->srv; - struct rtrs_sess *ss =3D &sess->s; + struct rtrs_path *ss =3D &sess->s; int i, mri, err, mrs_num; unsigned int chunk_bits; int chunks_per_mr =3D 1; @@ -677,7 +677,7 @@ static int map_cont_bufs(struct rtrs_srv_sess *sess) =20 static void rtrs_srv_hb_err_handler(struct rtrs_con *c) { - close_sess(to_srv_sess(c->sess)); + close_sess(to_srv_sess(c->path)); } =20 static void rtrs_srv_init_hb(struct rtrs_srv_sess *sess) @@ -702,7 +702,7 @@ static void rtrs_srv_stop_hb(struct rtrs_srv_sess *sess) static void rtrs_srv_info_rsp_done(struct ib_cq *cq, struct ib_wc *wc) { struct rtrs_srv_con *con =3D to_srv_con(wc->qp->qp_context); - struct rtrs_sess *s =3D con->c.sess; + struct rtrs_path *s =3D con->c.path; struct rtrs_srv_sess *sess =3D to_srv_sess(s); struct rtrs_iu *iu; =20 @@ -788,7 +788,7 @@ static int rtrs_rdma_do_reject(struct rdma_cm_id *cm_id= , int errno); static int process_info_req(struct rtrs_srv_con *con, struct rtrs_msg_info_req *msg) { - struct rtrs_sess *s =3D con->c.sess; + struct rtrs_path *s =3D con->c.path; struct rtrs_srv_sess *sess =3D to_srv_sess(s); struct ib_send_wr *reg_wr =3D NULL; struct rtrs_msg_info_rsp *rsp; @@ -889,7 +889,7 @@ static int process_info_req(struct rtrs_srv_con *con, static void rtrs_srv_info_req_done(struct ib_cq *cq, struct ib_wc *wc) { struct rtrs_srv_con *con =3D to_srv_con(wc->qp->qp_context); - struct rtrs_sess *s =3D con->c.sess; + struct rtrs_path *s =3D con->c.path; struct rtrs_srv_sess *sess =3D to_srv_sess(s); struct rtrs_msg_info_req *msg; struct rtrs_iu *iu; @@ -932,7 +932,7 @@ static void rtrs_srv_info_req_done(struct ib_cq *cq, st= ruct ib_wc *wc) =20 static int post_recv_info_req(struct rtrs_srv_con *con) { - struct rtrs_sess *s =3D con->c.sess; + struct rtrs_path *s =3D con->c.path; struct rtrs_srv_sess *sess =3D to_srv_sess(s); struct rtrs_iu *rx_iu; int err; @@ -969,7 +969,7 @@ static int post_recv_io(struct rtrs_srv_con *con, size_= t q_size) static int post_recv_sess(struct rtrs_srv_sess *sess) { struct rtrs_srv *srv =3D sess->srv; - struct rtrs_sess *s =3D &sess->s; + struct rtrs_path *s =3D &sess->s; size_t q_size; int err, cid; =20 @@ -993,7 +993,7 @@ static void process_read(struct rtrs_srv_con *con, struct rtrs_msg_rdma_read *msg, u32 buf_id, u32 off) { - struct rtrs_sess *s =3D con->c.sess; + struct rtrs_path *s =3D con->c.path; struct rtrs_srv_sess *sess =3D to_srv_sess(s); struct rtrs_srv *srv =3D sess->srv; struct rtrs_srv_ctx *ctx =3D srv->ctx; @@ -1051,7 +1051,7 @@ static void process_write(struct rtrs_srv_con *con, struct rtrs_msg_rdma_write *req, u32 buf_id, u32 off) { - struct rtrs_sess *s =3D con->c.sess; + struct rtrs_path *s =3D con->c.path; struct rtrs_srv_sess *sess =3D to_srv_sess(s); struct rtrs_srv *srv =3D sess->srv; struct rtrs_srv_ctx *ctx =3D srv->ctx; @@ -1102,7 +1102,7 @@ static void process_write(struct rtrs_srv_con *con, static void process_io_req(struct rtrs_srv_con *con, void *msg, u32 id, u32 off) { - struct rtrs_sess *s =3D con->c.sess; + struct rtrs_path *s =3D con->c.path; struct rtrs_srv_sess *sess =3D to_srv_sess(s); struct rtrs_msg_rdma_hdr *hdr; unsigned int type; @@ -1137,7 +1137,7 @@ static void rtrs_srv_inv_rkey_done(struct ib_cq *cq, = struct ib_wc *wc) struct rtrs_srv_mr *mr =3D container_of(wc->wr_cqe, typeof(*mr), inv_cqe); struct rtrs_srv_con *con =3D to_srv_con(wc->qp->qp_context); - struct rtrs_sess *s =3D con->c.sess; + struct rtrs_path *s =3D con->c.path; struct rtrs_srv_sess *sess =3D to_srv_sess(s); struct rtrs_srv *srv =3D sess->srv; u32 msg_id, off; @@ -1194,7 +1194,7 @@ static void rtrs_rdma_process_wr_wait_list(struct rtr= s_srv_con *con) static void rtrs_srv_rdma_done(struct ib_cq *cq, struct ib_wc *wc) { struct rtrs_srv_con *con =3D to_srv_con(wc->qp->qp_context); - struct rtrs_sess *s =3D con->c.sess; + struct rtrs_path *s =3D con->c.path; struct rtrs_srv_sess *sess =3D to_srv_sess(s); struct rtrs_srv *srv =3D sess->srv; u32 imm_type, imm_payload; @@ -1633,7 +1633,7 @@ static int create_con(struct rtrs_srv_sess *sess, unsigned int cid) { struct rtrs_srv *srv =3D sess->srv; - struct rtrs_sess *s =3D &sess->s; + struct rtrs_path *s =3D &sess->s; struct rtrs_srv_con *con; =20 u32 cq_num, max_send_wr, max_recv_wr, wr_limit; @@ -1648,7 +1648,7 @@ static int create_con(struct rtrs_srv_sess *sess, spin_lock_init(&con->rsp_wr_wait_lock); INIT_LIST_HEAD(&con->rsp_wr_wait_list); con->c.cm_id =3D cm_id; - con->c.sess =3D &sess->s; + con->c.path =3D &sess->s; con->c.cid =3D cid; atomic_set(&con->c.wr_cnt, 1); wr_limit =3D sess->s.dev->ib_dev->attrs.max_qp_wr; @@ -1859,7 +1859,7 @@ static int rtrs_rdma_connect(struct rdma_cm_id *cm_id, mutex_lock(&srv->paths_mutex); sess =3D __find_sess(srv, &msg->sess_uuid); if (sess) { - struct rtrs_sess *s =3D &sess->s; + struct rtrs_path *s =3D &sess->s; =20 /* Session already holds a reference */ put_srv(srv); @@ -1938,12 +1938,12 @@ static int rtrs_srv_rdma_cm_handler(struct rdma_cm_= id *cm_id, struct rdma_cm_event *ev) { struct rtrs_srv_sess *sess =3D NULL; - struct rtrs_sess *s =3D NULL; + struct rtrs_path *s =3D NULL; =20 if (ev->event !=3D RDMA_CM_EVENT_CONNECT_REQUEST) { struct rtrs_con *c =3D cm_id->context; =20 - s =3D c->sess; + s =3D c->path; sess =3D to_srv_sess(s); } =20 diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.h b/drivers/infiniband/ul= p/rtrs/rtrs-srv.h index 9d8d2a91a235..f0fbd8bf8871 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-srv.h +++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.h @@ -72,7 +72,7 @@ struct rtrs_srv_mr { }; =20 struct rtrs_srv_sess { - struct rtrs_sess s; + struct rtrs_path s; struct rtrs_srv *srv; struct work_struct close_work; enum rtrs_srv_state state; diff --git a/drivers/infiniband/ulp/rtrs/rtrs.c b/drivers/infiniband/ulp/rt= rs/rtrs.c index 37952c8e768c..4da889103a5f 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs.c +++ b/drivers/infiniband/ulp/rtrs/rtrs.c @@ -69,16 +69,16 @@ EXPORT_SYMBOL_GPL(rtrs_iu_free); =20 int rtrs_iu_post_recv(struct rtrs_con *con, struct rtrs_iu *iu) { - struct rtrs_sess *sess =3D con->sess; + struct rtrs_path *path =3D con->path; struct ib_recv_wr wr; struct ib_sge list; =20 list.addr =3D iu->dma_addr; list.length =3D iu->size; - list.lkey =3D sess->dev->ib_pd->local_dma_lkey; + list.lkey =3D path->dev->ib_pd->local_dma_lkey; =20 if (list.length =3D=3D 0) { - rtrs_wrn(con->sess, + rtrs_wrn(con->path, "Posting receive work request failed, sg list is empty\n"); return -EINVAL; } @@ -126,7 +126,7 @@ static int rtrs_post_send(struct ib_qp *qp, struct ib_s= end_wr *head, int rtrs_iu_post_send(struct rtrs_con *con, struct rtrs_iu *iu, size_t siz= e, struct ib_send_wr *head) { - struct rtrs_sess *sess =3D con->sess; + struct rtrs_path *path =3D con->path; struct ib_send_wr wr; struct ib_sge list; =20 @@ -135,7 +135,7 @@ int rtrs_iu_post_send(struct rtrs_con *con, struct rtrs= _iu *iu, size_t size, =20 list.addr =3D iu->dma_addr; list.length =3D size; - list.lkey =3D sess->dev->ib_pd->local_dma_lkey; + list.lkey =3D path->dev->ib_pd->local_dma_lkey; =20 wr =3D (struct ib_send_wr) { .wr_cqe =3D &iu->cqe, @@ -188,11 +188,11 @@ static int rtrs_post_rdma_write_imm_empty(struct rtrs= _con *con, struct ib_send_wr *head) { struct ib_rdma_wr wr; - struct rtrs_sess *sess =3D con->sess; + struct rtrs_path *path =3D con->path; enum ib_send_flags sflags; =20 atomic_dec_if_positive(&con->sq_wr_avail); - sflags =3D (atomic_inc_return(&con->wr_cnt) % sess->signal_interval) ? + sflags =3D (atomic_inc_return(&con->wr_cnt) % path->signal_interval) ? 0 : IB_SEND_SIGNALED; =20 wr =3D (struct ib_rdma_wr) { @@ -211,12 +211,12 @@ static void qp_event_handler(struct ib_event *ev, voi= d *ctx) =20 switch (ev->event) { case IB_EVENT_COMM_EST: - rtrs_info(con->sess, "QP event %s (%d) received\n", + rtrs_info(con->path, "QP event %s (%d) received\n", ib_event_msg(ev->event), ev->event); rdma_notify(con->cm_id, IB_EVENT_COMM_EST); break; default: - rtrs_info(con->sess, "Unhandled QP event %s (%d) received\n", + rtrs_info(con->path, "Unhandled QP event %s (%d) received\n", ib_event_msg(ev->event), ev->event); break; } @@ -224,7 +224,7 @@ static void qp_event_handler(struct ib_event *ev, void = *ctx) =20 static bool is_pollqueue(struct rtrs_con *con) { - return con->cid >=3D con->sess->irq_con_num; + return con->cid >=3D con->path->irq_con_num; } =20 static int create_cq(struct rtrs_con *con, int cq_vector, int nr_cqe, @@ -240,7 +240,7 @@ static int create_cq(struct rtrs_con *con, int cq_vecto= r, int nr_cqe, cq =3D ib_cq_pool_get(cm_id->device, nr_cqe, cq_vector, poll_ctx); =20 if (IS_ERR(cq)) { - rtrs_err(con->sess, "Creating completion queue failed, errno: %ld\n", + rtrs_err(con->path, "Creating completion queue failed, errno: %ld\n", PTR_ERR(cq)); return PTR_ERR(cq); } @@ -271,7 +271,7 @@ static int create_qp(struct rtrs_con *con, struct ib_pd= *pd, =20 ret =3D rdma_create_qp(cm_id, pd, &init_attr); if (ret) { - rtrs_err(con->sess, "Creating QP failed, err: %d\n", ret); + rtrs_err(con->path, "Creating QP failed, err: %d\n", ret); return ret; } con->qp =3D cm_id->qp; @@ -290,7 +290,7 @@ static void destroy_cq(struct rtrs_con *con) con->cq =3D NULL; } =20 -int rtrs_cq_qp_create(struct rtrs_sess *sess, struct rtrs_con *con, +int rtrs_cq_qp_create(struct rtrs_path *path, struct rtrs_con *con, u32 max_send_sge, int cq_vector, int nr_cqe, u32 max_send_wr, u32 max_recv_wr, enum ib_poll_context poll_ctx) @@ -301,13 +301,13 @@ int rtrs_cq_qp_create(struct rtrs_sess *sess, struct = rtrs_con *con, if (err) return err; =20 - err =3D create_qp(con, sess->dev->ib_pd, max_send_wr, max_recv_wr, + err =3D create_qp(con, path->dev->ib_pd, max_send_wr, max_recv_wr, max_send_sge); if (err) { destroy_cq(con); return err; } - con->sess =3D sess; + con->path =3D path; =20 return 0; } @@ -323,24 +323,24 @@ void rtrs_cq_qp_destroy(struct rtrs_con *con) } EXPORT_SYMBOL_GPL(rtrs_cq_qp_destroy); =20 -static void schedule_hb(struct rtrs_sess *sess) +static void schedule_hb(struct rtrs_path *path) { - queue_delayed_work(sess->hb_wq, &sess->hb_dwork, - msecs_to_jiffies(sess->hb_interval_ms)); + queue_delayed_work(path->hb_wq, &path->hb_dwork, + msecs_to_jiffies(path->hb_interval_ms)); } =20 -void rtrs_send_hb_ack(struct rtrs_sess *sess) +void rtrs_send_hb_ack(struct rtrs_path *path) { - struct rtrs_con *usr_con =3D sess->con[0]; + struct rtrs_con *usr_con =3D path->con[0]; u32 imm; int err; =20 imm =3D rtrs_to_imm(RTRS_HB_ACK_IMM, 0); - err =3D rtrs_post_rdma_write_imm_empty(usr_con, sess->hb_cqe, imm, + err =3D rtrs_post_rdma_write_imm_empty(usr_con, path->hb_cqe, imm, NULL); if (err) { - rtrs_err(sess, "send HB ACK failed, errno: %d\n", err); - sess->hb_err_handler(usr_con); + rtrs_err(path, "send HB ACK failed, errno: %d\n", err); + path->hb_err_handler(usr_con); return; } } @@ -349,63 +349,63 @@ EXPORT_SYMBOL_GPL(rtrs_send_hb_ack); static void hb_work(struct work_struct *work) { struct rtrs_con *usr_con; - struct rtrs_sess *sess; + struct rtrs_path *path; u32 imm; int err; =20 - sess =3D container_of(to_delayed_work(work), typeof(*sess), hb_dwork); - usr_con =3D sess->con[0]; + path =3D container_of(to_delayed_work(work), typeof(*path), hb_dwork); + usr_con =3D path->con[0]; =20 - if (sess->hb_missed_cnt > sess->hb_missed_max) { - rtrs_err(sess, "HB missed max reached.\n"); - sess->hb_err_handler(usr_con); + if (path->hb_missed_cnt > path->hb_missed_max) { + rtrs_err(path, "HB missed max reached.\n"); + path->hb_err_handler(usr_con); return; } - if (sess->hb_missed_cnt++) { + if (path->hb_missed_cnt++) { /* Reschedule work without sending hb */ - schedule_hb(sess); + schedule_hb(path); return; } =20 - sess->hb_last_sent =3D ktime_get(); + path->hb_last_sent =3D ktime_get(); =20 imm =3D rtrs_to_imm(RTRS_HB_MSG_IMM, 0); - err =3D rtrs_post_rdma_write_imm_empty(usr_con, sess->hb_cqe, imm, + err =3D rtrs_post_rdma_write_imm_empty(usr_con, path->hb_cqe, imm, NULL); if (err) { - rtrs_err(sess, "HB send failed, errno: %d\n", err); - sess->hb_err_handler(usr_con); + rtrs_err(path, "HB send failed, errno: %d\n", err); + path->hb_err_handler(usr_con); return; } =20 - schedule_hb(sess); + schedule_hb(path); } =20 -void rtrs_init_hb(struct rtrs_sess *sess, struct ib_cqe *cqe, +void rtrs_init_hb(struct rtrs_path *path, struct ib_cqe *cqe, unsigned int interval_ms, unsigned int missed_max, void (*err_handler)(struct rtrs_con *con), struct workqueue_struct *wq) { - sess->hb_cqe =3D cqe; - sess->hb_interval_ms =3D interval_ms; - sess->hb_err_handler =3D err_handler; - sess->hb_wq =3D wq; - sess->hb_missed_max =3D missed_max; - sess->hb_missed_cnt =3D 0; - INIT_DELAYED_WORK(&sess->hb_dwork, hb_work); + path->hb_cqe =3D cqe; + path->hb_interval_ms =3D interval_ms; + path->hb_err_handler =3D err_handler; + path->hb_wq =3D wq; + path->hb_missed_max =3D missed_max; + path->hb_missed_cnt =3D 0; + INIT_DELAYED_WORK(&path->hb_dwork, hb_work); } EXPORT_SYMBOL_GPL(rtrs_init_hb); =20 -void rtrs_start_hb(struct rtrs_sess *sess) +void rtrs_start_hb(struct rtrs_path *path) { - schedule_hb(sess); + schedule_hb(path); } EXPORT_SYMBOL_GPL(rtrs_start_hb); =20 -void rtrs_stop_hb(struct rtrs_sess *sess) +void rtrs_stop_hb(struct rtrs_path *path) { - cancel_delayed_work_sync(&sess->hb_dwork); - sess->hb_missed_cnt =3D 0; + cancel_delayed_work_sync(&path->hb_dwork); + path->hb_missed_cnt =3D 0; } EXPORT_SYMBOL_GPL(rtrs_stop_hb); =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8102C282E7 for ; Mon, 15 Aug 2022 19:21:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243843AbiHOTVv (ORCPT ); Mon, 15 Aug 2022 15:21:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345090AbiHOTSG (ORCPT ); Mon, 15 Aug 2022 15:18:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45FEF56B9E; Mon, 15 Aug 2022 11:39: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 D201AB8106C; Mon, 15 Aug 2022 18:39:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACB92C4347C; Mon, 15 Aug 2022 18:39:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588768; bh=e3P9U3xf5GR5yElDPV4z2Sc7JZMhhxhffM7ZNlCg6XQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CjWNR0VebzXjNYRbqgccKuyPVtT5GCHA7xuugZeknWt+wVK3JyUkjEf5Wc6+0AI6B hr56CLHjKcdx8QipBqBlryR7SHNsWJZ66umT3fKINJ/PT8D8wVWXdpvpTeMjxUImqE 6zp6Vc9GpKpWPI85f76wlFbfN/lQBEVjqSG7aU1w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vaishali Thakkar , Jack Wang , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.15 508/779] RDMA/rtrs-srv: Rename rtrs_srv_sess to rtrs_srv_path Date: Mon, 15 Aug 2022 20:02:32 +0200 Message-Id: <20220815180358.977178471@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vaishali Thakkar [ Upstream commit ae4c81644e9105d9f7f713bb0d444737bb6a0cf1 ] rtrs_srv_sess is used for paths and not sessions on the server side. This creates confusion so let's rename it to rtrs_srv_path. Also, rename related variables and functions. Coccinelle is used to do the transformations for most of the occurrences and remaining ones were handled manually. Link: https://lore.kernel.org/r/20220105180708.7774-3-jinpu.wang@ionos.com Signed-off-by: Vaishali Thakkar Signed-off-by: Jack Wang Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/block/rnbd/rnbd-srv.c | 12 +- drivers/infiniband/ulp/rtrs/rtrs-pri.h | 2 +- drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c | 119 ++-- drivers/infiniband/ulp/rtrs/rtrs-srv.c | 627 ++++++++++--------- drivers/infiniband/ulp/rtrs/rtrs-srv.h | 10 +- drivers/infiniband/ulp/rtrs/rtrs.h | 3 +- 6 files changed, 392 insertions(+), 381 deletions(-) diff --git a/drivers/block/rnbd/rnbd-srv.c b/drivers/block/rnbd/rnbd-srv.c index aafecfe97055..1ba1a93a6fe7 100644 --- a/drivers/block/rnbd/rnbd-srv.c +++ b/drivers/block/rnbd/rnbd-srv.c @@ -266,12 +266,12 @@ static void destroy_sess(struct rnbd_srv_session *srv= _sess) static int create_sess(struct rtrs_srv *rtrs) { struct rnbd_srv_session *srv_sess; - char sessname[NAME_MAX]; + char pathname[NAME_MAX]; int err; =20 - err =3D rtrs_srv_get_sess_name(rtrs, sessname, sizeof(sessname)); + err =3D rtrs_srv_get_path_name(rtrs, pathname, sizeof(pathname)); if (err) { - pr_err("rtrs_srv_get_sess_name(%s): %d\n", sessname, err); + pr_err("rtrs_srv_get_path_name(%s): %d\n", pathname, err); =20 return err; } @@ -284,8 +284,8 @@ static int create_sess(struct rtrs_srv *rtrs) offsetof(struct rnbd_dev_blk_io, bio), BIOSET_NEED_BVECS); if (err) { - pr_err("Allocating srv_session for session %s failed\n", - sessname); + pr_err("Allocating srv_session for path %s failed\n", + pathname); kfree(srv_sess); return err; } @@ -298,7 +298,7 @@ static int create_sess(struct rtrs_srv *rtrs) mutex_unlock(&sess_lock); =20 srv_sess->rtrs =3D rtrs; - strscpy(srv_sess->sessname, sessname, sizeof(srv_sess->sessname)); + strscpy(srv_sess->sessname, pathname, sizeof(srv_sess->sessname)); =20 rtrs_srv_set_sess_priv(rtrs, srv_sess); =20 diff --git a/drivers/infiniband/ulp/rtrs/rtrs-pri.h b/drivers/infiniband/ul= p/rtrs/rtrs-pri.h index fad06c707b9b..412cf5ce3e7c 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-pri.h +++ b/drivers/infiniband/ulp/rtrs/rtrs-pri.h @@ -234,7 +234,7 @@ struct rtrs_msg_conn_rsp { */ struct rtrs_msg_info_req { __le16 type; - u8 sessname[NAME_MAX]; + u8 pathname[NAME_MAX]; u8 reserved[15]; }; =20 diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c b/drivers/infinib= and/ulp/rtrs/rtrs-srv-sysfs.c index aedddc416003..309080184aac 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c @@ -15,10 +15,10 @@ =20 static void rtrs_srv_release(struct kobject *kobj) { - struct rtrs_srv_sess *sess; + struct rtrs_srv_path *srv_path; =20 - sess =3D container_of(kobj, struct rtrs_srv_sess, kobj); - kfree(sess); + srv_path =3D container_of(kobj, struct rtrs_srv_path, kobj); + kfree(srv_path); } =20 static struct kobj_type ktype =3D { @@ -36,24 +36,25 @@ static ssize_t rtrs_srv_disconnect_store(struct kobject= *kobj, struct kobj_attribute *attr, const char *buf, size_t count) { - struct rtrs_srv_sess *sess; + struct rtrs_srv_path *srv_path; struct rtrs_path *s; char str[MAXHOSTNAMELEN]; =20 - sess =3D container_of(kobj, struct rtrs_srv_sess, kobj); - s =3D &sess->s; + srv_path =3D container_of(kobj, struct rtrs_srv_path, kobj); + s =3D &srv_path->s; if (!sysfs_streq(buf, "1")) { rtrs_err(s, "%s: invalid value: '%s'\n", attr->attr.name, buf); return -EINVAL; } =20 - sockaddr_to_str((struct sockaddr *)&sess->s.dst_addr, str, sizeof(str)); + sockaddr_to_str((struct sockaddr *)&srv_path->s.dst_addr, str, + sizeof(str)); =20 rtrs_info(s, "disconnect for path %s requested\n", str); /* first remove sysfs itself to avoid deadlock */ - sysfs_remove_file_self(&sess->kobj, &attr->attr); - close_sess(sess); + sysfs_remove_file_self(&srv_path->kobj, &attr->attr); + close_path(srv_path); =20 return count; } @@ -66,11 +67,11 @@ static ssize_t rtrs_srv_hca_port_show(struct kobject *k= obj, struct kobj_attribute *attr, char *page) { - struct rtrs_srv_sess *sess; + struct rtrs_srv_path *srv_path; struct rtrs_con *usr_con; =20 - sess =3D container_of(kobj, typeof(*sess), kobj); - usr_con =3D sess->s.con[0]; + srv_path =3D container_of(kobj, typeof(*srv_path), kobj); + usr_con =3D srv_path->s.con[0]; =20 return sysfs_emit(page, "%u\n", usr_con->cm_id->port_num); } @@ -82,11 +83,11 @@ static ssize_t rtrs_srv_hca_name_show(struct kobject *k= obj, struct kobj_attribute *attr, char *page) { - struct rtrs_srv_sess *sess; + struct rtrs_srv_path *srv_path; =20 - sess =3D container_of(kobj, struct rtrs_srv_sess, kobj); + srv_path =3D container_of(kobj, struct rtrs_srv_path, kobj); =20 - return sysfs_emit(page, "%s\n", sess->s.dev->ib_dev->name); + return sysfs_emit(page, "%s\n", srv_path->s.dev->ib_dev->name); } =20 static struct kobj_attribute rtrs_srv_hca_name_attr =3D @@ -96,11 +97,11 @@ static ssize_t rtrs_srv_src_addr_show(struct kobject *k= obj, struct kobj_attribute *attr, char *page) { - struct rtrs_srv_sess *sess; + struct rtrs_srv_path *srv_path; int cnt; =20 - sess =3D container_of(kobj, struct rtrs_srv_sess, kobj); - cnt =3D sockaddr_to_str((struct sockaddr *)&sess->s.dst_addr, + srv_path =3D container_of(kobj, struct rtrs_srv_path, kobj); + cnt =3D sockaddr_to_str((struct sockaddr *)&srv_path->s.dst_addr, page, PAGE_SIZE); return cnt + scnprintf(page + cnt, PAGE_SIZE - cnt, "\n"); } @@ -112,11 +113,11 @@ static ssize_t rtrs_srv_dst_addr_show(struct kobject = *kobj, struct kobj_attribute *attr, char *page) { - struct rtrs_srv_sess *sess; + struct rtrs_srv_path *srv_path; int len; =20 - sess =3D container_of(kobj, struct rtrs_srv_sess, kobj); - len =3D sockaddr_to_str((struct sockaddr *)&sess->s.src_addr, page, + srv_path =3D container_of(kobj, struct rtrs_srv_path, kobj); + len =3D sockaddr_to_str((struct sockaddr *)&srv_path->s.src_addr, page, PAGE_SIZE); len +=3D sysfs_emit_at(page, len, "\n"); return len; @@ -125,7 +126,7 @@ static ssize_t rtrs_srv_dst_addr_show(struct kobject *k= obj, static struct kobj_attribute rtrs_srv_dst_addr_attr =3D __ATTR(dst_addr, 0444, rtrs_srv_dst_addr_show, NULL); =20 -static struct attribute *rtrs_srv_sess_attrs[] =3D { +static struct attribute *rtrs_srv_path_attrs[] =3D { &rtrs_srv_hca_name_attr.attr, &rtrs_srv_hca_port_attr.attr, &rtrs_srv_src_addr_attr.attr, @@ -134,8 +135,8 @@ static struct attribute *rtrs_srv_sess_attrs[] =3D { NULL, }; =20 -static const struct attribute_group rtrs_srv_sess_attr_group =3D { - .attrs =3D rtrs_srv_sess_attrs, +static const struct attribute_group rtrs_srv_path_attr_group =3D { + .attrs =3D rtrs_srv_path_attrs, }; =20 STAT_ATTR(struct rtrs_srv_stats, rdma, @@ -151,9 +152,9 @@ static const struct attribute_group rtrs_srv_stats_attr= _group =3D { .attrs =3D rtrs_srv_stats_attrs, }; =20 -static int rtrs_srv_create_once_sysfs_root_folders(struct rtrs_srv_sess *s= ess) +static int rtrs_srv_create_once_sysfs_root_folders(struct rtrs_srv_path *s= rv_path) { - struct rtrs_srv *srv =3D sess->srv; + struct rtrs_srv *srv =3D srv_path->srv; int err =3D 0; =20 mutex_lock(&srv->paths_mutex); @@ -164,7 +165,7 @@ static int rtrs_srv_create_once_sysfs_root_folders(stru= ct rtrs_srv_sess *sess) goto unlock; } srv->dev.class =3D rtrs_dev_class; - err =3D dev_set_name(&srv->dev, "%s", sess->s.sessname); + err =3D dev_set_name(&srv->dev, "%s", srv_path->s.sessname); if (err) goto unlock; =20 @@ -196,9 +197,9 @@ static int rtrs_srv_create_once_sysfs_root_folders(stru= ct rtrs_srv_sess *sess) } =20 static void -rtrs_srv_destroy_once_sysfs_root_folders(struct rtrs_srv_sess *sess) +rtrs_srv_destroy_once_sysfs_root_folders(struct rtrs_srv_path *srv_path) { - struct rtrs_srv *srv =3D sess->srv; + struct rtrs_srv *srv =3D srv_path->srv; =20 mutex_lock(&srv->paths_mutex); if (!--srv->dev_ref) { @@ -213,7 +214,7 @@ rtrs_srv_destroy_once_sysfs_root_folders(struct rtrs_sr= v_sess *sess) } } =20 -static void rtrs_srv_sess_stats_release(struct kobject *kobj) +static void rtrs_srv_path_stats_release(struct kobject *kobj) { struct rtrs_srv_stats *stats; =20 @@ -224,22 +225,22 @@ static void rtrs_srv_sess_stats_release(struct kobjec= t *kobj) =20 static struct kobj_type ktype_stats =3D { .sysfs_ops =3D &kobj_sysfs_ops, - .release =3D rtrs_srv_sess_stats_release, + .release =3D rtrs_srv_path_stats_release, }; =20 -static int rtrs_srv_create_stats_files(struct rtrs_srv_sess *sess) +static int rtrs_srv_create_stats_files(struct rtrs_srv_path *srv_path) { int err; - struct rtrs_path *s =3D &sess->s; + struct rtrs_path *s =3D &srv_path->s; =20 - err =3D kobject_init_and_add(&sess->stats->kobj_stats, &ktype_stats, - &sess->kobj, "stats"); + err =3D kobject_init_and_add(&srv_path->stats->kobj_stats, &ktype_stats, + &srv_path->kobj, "stats"); if (err) { rtrs_err(s, "kobject_init_and_add(): %d\n", err); - kobject_put(&sess->stats->kobj_stats); + kobject_put(&srv_path->stats->kobj_stats); return err; } - err =3D sysfs_create_group(&sess->stats->kobj_stats, + err =3D sysfs_create_group(&srv_path->stats->kobj_stats, &rtrs_srv_stats_attr_group); if (err) { rtrs_err(s, "sysfs_create_group(): %d\n", err); @@ -249,64 +250,64 @@ static int rtrs_srv_create_stats_files(struct rtrs_sr= v_sess *sess) return 0; =20 err: - kobject_del(&sess->stats->kobj_stats); - kobject_put(&sess->stats->kobj_stats); + kobject_del(&srv_path->stats->kobj_stats); + kobject_put(&srv_path->stats->kobj_stats); =20 return err; } =20 -int rtrs_srv_create_sess_files(struct rtrs_srv_sess *sess) +int rtrs_srv_create_path_files(struct rtrs_srv_path *srv_path) { - struct rtrs_srv *srv =3D sess->srv; - struct rtrs_path *s =3D &sess->s; + struct rtrs_srv *srv =3D srv_path->srv; + struct rtrs_path *s =3D &srv_path->s; char str[NAME_MAX]; int err; struct rtrs_addr path =3D { - .src =3D &sess->s.dst_addr, - .dst =3D &sess->s.src_addr, + .src =3D &srv_path->s.dst_addr, + .dst =3D &srv_path->s.src_addr, }; =20 rtrs_addr_to_str(&path, str, sizeof(str)); - err =3D rtrs_srv_create_once_sysfs_root_folders(sess); + err =3D rtrs_srv_create_once_sysfs_root_folders(srv_path); if (err) return err; =20 - err =3D kobject_init_and_add(&sess->kobj, &ktype, srv->kobj_paths, + err =3D kobject_init_and_add(&srv_path->kobj, &ktype, srv->kobj_paths, "%s", str); if (err) { rtrs_err(s, "kobject_init_and_add(): %d\n", err); goto destroy_root; } - err =3D sysfs_create_group(&sess->kobj, &rtrs_srv_sess_attr_group); + err =3D sysfs_create_group(&srv_path->kobj, &rtrs_srv_path_attr_group); if (err) { rtrs_err(s, "sysfs_create_group(): %d\n", err); goto put_kobj; } - err =3D rtrs_srv_create_stats_files(sess); + err =3D rtrs_srv_create_stats_files(srv_path); if (err) goto remove_group; =20 return 0; =20 remove_group: - sysfs_remove_group(&sess->kobj, &rtrs_srv_sess_attr_group); + sysfs_remove_group(&srv_path->kobj, &rtrs_srv_path_attr_group); put_kobj: - kobject_del(&sess->kobj); + kobject_del(&srv_path->kobj); destroy_root: - kobject_put(&sess->kobj); - rtrs_srv_destroy_once_sysfs_root_folders(sess); + kobject_put(&srv_path->kobj); + rtrs_srv_destroy_once_sysfs_root_folders(srv_path); =20 return err; } =20 -void rtrs_srv_destroy_sess_files(struct rtrs_srv_sess *sess) +void rtrs_srv_destroy_path_files(struct rtrs_srv_path *srv_path) { - if (sess->kobj.state_in_sysfs) { - kobject_del(&sess->stats->kobj_stats); - kobject_put(&sess->stats->kobj_stats); - sysfs_remove_group(&sess->kobj, &rtrs_srv_sess_attr_group); - kobject_put(&sess->kobj); + if (srv_path->kobj.state_in_sysfs) { + kobject_del(&srv_path->stats->kobj_stats); + kobject_put(&srv_path->stats->kobj_stats); + sysfs_remove_group(&srv_path->kobj, &rtrs_srv_path_attr_group); + kobject_put(&srv_path->kobj); =20 - rtrs_srv_destroy_once_sysfs_root_folders(sess); + rtrs_srv_destroy_once_sysfs_root_folders(srv_path); } } diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.c b/drivers/infiniband/ul= p/rtrs/rtrs-srv.c index de4f214233b6..1ca31b919e98 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-srv.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.c @@ -62,19 +62,19 @@ static inline struct rtrs_srv_con *to_srv_con(struct rt= rs_con *c) return container_of(c, struct rtrs_srv_con, c); } =20 -static inline struct rtrs_srv_sess *to_srv_sess(struct rtrs_path *s) +static inline struct rtrs_srv_path *to_srv_path(struct rtrs_path *s) { - return container_of(s, struct rtrs_srv_sess, s); + return container_of(s, struct rtrs_srv_path, s); } =20 -static bool rtrs_srv_change_state(struct rtrs_srv_sess *sess, +static bool rtrs_srv_change_state(struct rtrs_srv_path *srv_path, enum rtrs_srv_state new_state) { enum rtrs_srv_state old_state; bool changed =3D false; =20 - spin_lock_irq(&sess->state_lock); - old_state =3D sess->state; + spin_lock_irq(&srv_path->state_lock); + old_state =3D srv_path->state; switch (new_state) { case RTRS_SRV_CONNECTED: if (old_state =3D=3D RTRS_SRV_CONNECTING) @@ -93,8 +93,8 @@ static bool rtrs_srv_change_state(struct rtrs_srv_sess *s= ess, break; } if (changed) - sess->state =3D new_state; - spin_unlock_irq(&sess->state_lock); + srv_path->state =3D new_state; + spin_unlock_irq(&srv_path->state_lock); =20 return changed; } @@ -106,16 +106,16 @@ static void free_id(struct rtrs_srv_op *id) kfree(id); } =20 -static void rtrs_srv_free_ops_ids(struct rtrs_srv_sess *sess) +static void rtrs_srv_free_ops_ids(struct rtrs_srv_path *srv_path) { - struct rtrs_srv *srv =3D sess->srv; + struct rtrs_srv *srv =3D srv_path->srv; int i; =20 - if (sess->ops_ids) { + if (srv_path->ops_ids) { for (i =3D 0; i < srv->queue_depth; i++) - free_id(sess->ops_ids[i]); - kfree(sess->ops_ids); - sess->ops_ids =3D NULL; + free_id(srv_path->ops_ids[i]); + kfree(srv_path->ops_ids); + srv_path->ops_ids =3D NULL; } } =20 @@ -127,21 +127,24 @@ static struct ib_cqe io_comp_cqe =3D { =20 static inline void rtrs_srv_inflight_ref_release(struct percpu_ref *ref) { - struct rtrs_srv_sess *sess =3D container_of(ref, struct rtrs_srv_sess, id= s_inflight_ref); + struct rtrs_srv_path *srv_path =3D container_of(ref, + struct rtrs_srv_path, + ids_inflight_ref); =20 - percpu_ref_exit(&sess->ids_inflight_ref); - complete(&sess->complete_done); + percpu_ref_exit(&srv_path->ids_inflight_ref); + complete(&srv_path->complete_done); } =20 -static int rtrs_srv_alloc_ops_ids(struct rtrs_srv_sess *sess) +static int rtrs_srv_alloc_ops_ids(struct rtrs_srv_path *srv_path) { - struct rtrs_srv *srv =3D sess->srv; + struct rtrs_srv *srv =3D srv_path->srv; struct rtrs_srv_op *id; int i, ret; =20 - sess->ops_ids =3D kcalloc(srv->queue_depth, sizeof(*sess->ops_ids), - GFP_KERNEL); - if (!sess->ops_ids) + srv_path->ops_ids =3D kcalloc(srv->queue_depth, + sizeof(*srv_path->ops_ids), + GFP_KERNEL); + if (!srv_path->ops_ids) goto err; =20 for (i =3D 0; i < srv->queue_depth; ++i) { @@ -149,44 +152,44 @@ static int rtrs_srv_alloc_ops_ids(struct rtrs_srv_ses= s *sess) if (!id) goto err; =20 - sess->ops_ids[i] =3D id; + srv_path->ops_ids[i] =3D id; } =20 - ret =3D percpu_ref_init(&sess->ids_inflight_ref, + ret =3D percpu_ref_init(&srv_path->ids_inflight_ref, rtrs_srv_inflight_ref_release, 0, GFP_KERNEL); if (ret) { pr_err("Percpu reference init failed\n"); goto err; } - init_completion(&sess->complete_done); + init_completion(&srv_path->complete_done); =20 return 0; =20 err: - rtrs_srv_free_ops_ids(sess); + rtrs_srv_free_ops_ids(srv_path); return -ENOMEM; } =20 -static inline void rtrs_srv_get_ops_ids(struct rtrs_srv_sess *sess) +static inline void rtrs_srv_get_ops_ids(struct rtrs_srv_path *srv_path) { - percpu_ref_get(&sess->ids_inflight_ref); + percpu_ref_get(&srv_path->ids_inflight_ref); } =20 -static inline void rtrs_srv_put_ops_ids(struct rtrs_srv_sess *sess) +static inline void rtrs_srv_put_ops_ids(struct rtrs_srv_path *srv_path) { - percpu_ref_put(&sess->ids_inflight_ref); + percpu_ref_put(&srv_path->ids_inflight_ref); } =20 static void rtrs_srv_reg_mr_done(struct ib_cq *cq, struct ib_wc *wc) { struct rtrs_srv_con *con =3D to_srv_con(wc->qp->qp_context); struct rtrs_path *s =3D con->c.path; - struct rtrs_srv_sess *sess =3D to_srv_sess(s); + struct rtrs_srv_path *srv_path =3D to_srv_path(s); =20 if (wc->status !=3D IB_WC_SUCCESS) { rtrs_err(s, "REG MR failed: %s\n", ib_wc_status_msg(wc->status)); - close_sess(sess); + close_path(srv_path); return; } } @@ -198,8 +201,8 @@ static struct ib_cqe local_reg_cqe =3D { static int rdma_write_sg(struct rtrs_srv_op *id) { struct rtrs_path *s =3D id->con->c.path; - struct rtrs_srv_sess *sess =3D to_srv_sess(s); - dma_addr_t dma_addr =3D sess->dma_addr[id->msg_id]; + struct rtrs_srv_path *srv_path =3D to_srv_path(s); + dma_addr_t dma_addr =3D srv_path->dma_addr[id->msg_id]; struct rtrs_srv_mr *srv_mr; struct ib_send_wr inv_wr; struct ib_rdma_wr imm_wr; @@ -233,7 +236,7 @@ static int rdma_write_sg(struct rtrs_srv_op *id) return -EINVAL; } =20 - plist->lkey =3D sess->s.dev->ib_pd->local_dma_lkey; + plist->lkey =3D srv_path->s.dev->ib_pd->local_dma_lkey; offset +=3D plist->length; =20 wr->wr.sg_list =3D plist; @@ -284,7 +287,7 @@ static int rdma_write_sg(struct rtrs_srv_op *id) if (always_invalidate) { struct rtrs_msg_rkey_rsp *msg; =20 - srv_mr =3D &sess->mrs[id->msg_id]; + srv_mr =3D &srv_path->mrs[id->msg_id]; rwr.wr.opcode =3D IB_WR_REG_MR; rwr.wr.wr_cqe =3D &local_reg_cqe; rwr.wr.num_sge =3D 0; @@ -300,11 +303,11 @@ static int rdma_write_sg(struct rtrs_srv_op *id) =20 list.addr =3D srv_mr->iu->dma_addr; list.length =3D sizeof(*msg); - list.lkey =3D sess->s.dev->ib_pd->local_dma_lkey; + list.lkey =3D srv_path->s.dev->ib_pd->local_dma_lkey; imm_wr.wr.sg_list =3D &list; imm_wr.wr.num_sge =3D 1; imm_wr.wr.opcode =3D IB_WR_SEND_WITH_IMM; - ib_dma_sync_single_for_device(sess->s.dev->ib_dev, + ib_dma_sync_single_for_device(srv_path->s.dev->ib_dev, srv_mr->iu->dma_addr, srv_mr->iu->size, DMA_TO_DEVICE); } else { @@ -317,7 +320,7 @@ static int rdma_write_sg(struct rtrs_srv_op *id) 0, need_inval)); =20 imm_wr.wr.wr_cqe =3D &io_comp_cqe; - ib_dma_sync_single_for_device(sess->s.dev->ib_dev, dma_addr, + ib_dma_sync_single_for_device(srv_path->s.dev->ib_dev, dma_addr, offset, DMA_BIDIRECTIONAL); =20 err =3D ib_post_send(id->con->c.qp, &id->tx_wr.wr, NULL); @@ -342,7 +345,7 @@ static int send_io_resp_imm(struct rtrs_srv_con *con, s= truct rtrs_srv_op *id, int errno) { struct rtrs_path *s =3D con->c.path; - struct rtrs_srv_sess *sess =3D to_srv_sess(s); + struct rtrs_srv_path *srv_path =3D to_srv_path(s); struct ib_send_wr inv_wr, *wr =3D NULL; struct ib_rdma_wr imm_wr; struct ib_reg_wr rwr; @@ -402,7 +405,7 @@ static int send_io_resp_imm(struct rtrs_srv_con *con, s= truct rtrs_srv_op *id, struct ib_sge list; struct rtrs_msg_rkey_rsp *msg; =20 - srv_mr =3D &sess->mrs[id->msg_id]; + srv_mr =3D &srv_path->mrs[id->msg_id]; rwr.wr.next =3D &imm_wr.wr; rwr.wr.opcode =3D IB_WR_REG_MR; rwr.wr.wr_cqe =3D &local_reg_cqe; @@ -419,11 +422,11 @@ static int send_io_resp_imm(struct rtrs_srv_con *con,= struct rtrs_srv_op *id, =20 list.addr =3D srv_mr->iu->dma_addr; list.length =3D sizeof(*msg); - list.lkey =3D sess->s.dev->ib_pd->local_dma_lkey; + list.lkey =3D srv_path->s.dev->ib_pd->local_dma_lkey; imm_wr.wr.sg_list =3D &list; imm_wr.wr.num_sge =3D 1; imm_wr.wr.opcode =3D IB_WR_SEND_WITH_IMM; - ib_dma_sync_single_for_device(sess->s.dev->ib_dev, + ib_dma_sync_single_for_device(srv_path->s.dev->ib_dev, srv_mr->iu->dma_addr, srv_mr->iu->size, DMA_TO_DEVICE); } else { @@ -444,11 +447,11 @@ static int send_io_resp_imm(struct rtrs_srv_con *con,= struct rtrs_srv_op *id, return err; } =20 -void close_sess(struct rtrs_srv_sess *sess) +void close_path(struct rtrs_srv_path *srv_path) { - if (rtrs_srv_change_state(sess, RTRS_SRV_CLOSING)) - queue_work(rtrs_wq, &sess->close_work); - WARN_ON(sess->state !=3D RTRS_SRV_CLOSING); + if (rtrs_srv_change_state(srv_path, RTRS_SRV_CLOSING)) + queue_work(rtrs_wq, &srv_path->close_work); + WARN_ON(srv_path->state !=3D RTRS_SRV_CLOSING); } =20 static inline const char *rtrs_srv_state_str(enum rtrs_srv_state state) @@ -480,7 +483,7 @@ static inline const char *rtrs_srv_state_str(enum rtrs_= srv_state state) */ bool rtrs_srv_resp_rdma(struct rtrs_srv_op *id, int status) { - struct rtrs_srv_sess *sess; + struct rtrs_srv_path *srv_path; struct rtrs_srv_con *con; struct rtrs_path *s; int err; @@ -490,25 +493,25 @@ bool rtrs_srv_resp_rdma(struct rtrs_srv_op *id, int s= tatus) =20 con =3D id->con; s =3D con->c.path; - sess =3D to_srv_sess(s); + srv_path =3D to_srv_path(s); =20 id->status =3D status; =20 - if (sess->state !=3D RTRS_SRV_CONNECTED) { + if (srv_path->state !=3D RTRS_SRV_CONNECTED) { rtrs_err_rl(s, - "Sending I/O response failed, session %s is disconnected, sess sta= te %s\n", - kobject_name(&sess->kobj), - rtrs_srv_state_str(sess->state)); + "Sending I/O response failed, server path %s is disconnected, path= state %s\n", + kobject_name(&srv_path->kobj), + rtrs_srv_state_str(srv_path->state)); goto out; } if (always_invalidate) { - struct rtrs_srv_mr *mr =3D &sess->mrs[id->msg_id]; + struct rtrs_srv_mr *mr =3D &srv_path->mrs[id->msg_id]; =20 ib_update_fast_reg_key(mr->mr, ib_inc_rkey(mr->mr->rkey)); } if (atomic_sub_return(1, &con->c.sq_wr_avail) < 0) { - rtrs_err(s, "IB send queue full: sess=3D%s cid=3D%d\n", - kobject_name(&sess->kobj), + rtrs_err(s, "IB send queue full: srv_path=3D%s cid=3D%d\n", + kobject_name(&srv_path->kobj), con->c.cid); atomic_add(1, &con->c.sq_wr_avail); spin_lock(&con->rsp_wr_wait_lock); @@ -523,12 +526,12 @@ bool rtrs_srv_resp_rdma(struct rtrs_srv_op *id, int s= tatus) err =3D rdma_write_sg(id); =20 if (err) { - rtrs_err_rl(s, "IO response failed: %d: sess=3D%s\n", err, - kobject_name(&sess->kobj)); - close_sess(sess); + rtrs_err_rl(s, "IO response failed: %d: srv_path=3D%s\n", err, + kobject_name(&srv_path->kobj)); + close_path(srv_path); } out: - rtrs_srv_put_ops_ids(sess); + rtrs_srv_put_ops_ids(srv_path); return true; } EXPORT_SYMBOL(rtrs_srv_resp_rdma); @@ -544,27 +547,27 @@ void rtrs_srv_set_sess_priv(struct rtrs_srv *srv, voi= d *priv) } EXPORT_SYMBOL(rtrs_srv_set_sess_priv); =20 -static void unmap_cont_bufs(struct rtrs_srv_sess *sess) +static void unmap_cont_bufs(struct rtrs_srv_path *srv_path) { int i; =20 - for (i =3D 0; i < sess->mrs_num; i++) { + for (i =3D 0; i < srv_path->mrs_num; i++) { struct rtrs_srv_mr *srv_mr; =20 - srv_mr =3D &sess->mrs[i]; - rtrs_iu_free(srv_mr->iu, sess->s.dev->ib_dev, 1); + srv_mr =3D &srv_path->mrs[i]; + rtrs_iu_free(srv_mr->iu, srv_path->s.dev->ib_dev, 1); ib_dereg_mr(srv_mr->mr); - ib_dma_unmap_sg(sess->s.dev->ib_dev, srv_mr->sgt.sgl, + ib_dma_unmap_sg(srv_path->s.dev->ib_dev, srv_mr->sgt.sgl, srv_mr->sgt.nents, DMA_BIDIRECTIONAL); sg_free_table(&srv_mr->sgt); } - kfree(sess->mrs); + kfree(srv_path->mrs); } =20 -static int map_cont_bufs(struct rtrs_srv_sess *sess) +static int map_cont_bufs(struct rtrs_srv_path *srv_path) { - struct rtrs_srv *srv =3D sess->srv; - struct rtrs_path *ss =3D &sess->s; + struct rtrs_srv *srv =3D srv_path->srv; + struct rtrs_path *ss =3D &srv_path->s; int i, mri, err, mrs_num; unsigned int chunk_bits; int chunks_per_mr =3D 1; @@ -581,19 +584,19 @@ static int map_cont_bufs(struct rtrs_srv_sess *sess) mrs_num =3D srv->queue_depth; } else { chunks_per_mr =3D - sess->s.dev->ib_dev->attrs.max_fast_reg_page_list_len; + srv_path->s.dev->ib_dev->attrs.max_fast_reg_page_list_len; mrs_num =3D DIV_ROUND_UP(srv->queue_depth, chunks_per_mr); chunks_per_mr =3D DIV_ROUND_UP(srv->queue_depth, mrs_num); } =20 - sess->mrs =3D kcalloc(mrs_num, sizeof(*sess->mrs), GFP_KERNEL); - if (!sess->mrs) + srv_path->mrs =3D kcalloc(mrs_num, sizeof(*srv_path->mrs), GFP_KERNEL); + if (!srv_path->mrs) return -ENOMEM; =20 - sess->mrs_num =3D mrs_num; + srv_path->mrs_num =3D mrs_num; =20 for (mri =3D 0; mri < mrs_num; mri++) { - struct rtrs_srv_mr *srv_mr =3D &sess->mrs[mri]; + struct rtrs_srv_mr *srv_mr =3D &srv_path->mrs[mri]; struct sg_table *sgt =3D &srv_mr->sgt; struct scatterlist *s; struct ib_mr *mr; @@ -612,13 +615,13 @@ static int map_cont_bufs(struct rtrs_srv_sess *sess) sg_set_page(s, srv->chunks[chunks + i], max_chunk_size, 0); =20 - nr =3D ib_dma_map_sg(sess->s.dev->ib_dev, sgt->sgl, + nr =3D ib_dma_map_sg(srv_path->s.dev->ib_dev, sgt->sgl, sgt->nents, DMA_BIDIRECTIONAL); if (nr < sgt->nents) { err =3D nr < 0 ? nr : -EINVAL; goto free_sg; } - mr =3D ib_alloc_mr(sess->s.dev->ib_pd, IB_MR_TYPE_MEM_REG, + mr =3D ib_alloc_mr(srv_path->s.dev->ib_pd, IB_MR_TYPE_MEM_REG, sgt->nents); if (IS_ERR(mr)) { err =3D PTR_ERR(mr); @@ -634,7 +637,7 @@ static int map_cont_bufs(struct rtrs_srv_sess *sess) if (always_invalidate) { srv_mr->iu =3D rtrs_iu_alloc(1, sizeof(struct rtrs_msg_rkey_rsp), - GFP_KERNEL, sess->s.dev->ib_dev, + GFP_KERNEL, srv_path->s.dev->ib_dev, DMA_TO_DEVICE, rtrs_srv_rdma_done); if (!srv_mr->iu) { err =3D -ENOMEM; @@ -644,7 +647,7 @@ static int map_cont_bufs(struct rtrs_srv_sess *sess) } /* Eventually dma addr for each chunk can be cached */ for_each_sg(sgt->sgl, s, sgt->orig_nents, i) - sess->dma_addr[chunks + i] =3D sg_dma_address(s); + srv_path->dma_addr[chunks + i] =3D sg_dma_address(s); =20 ib_update_fast_reg_key(mr, ib_inc_rkey(mr->rkey)); srv_mr->mr =3D mr; @@ -652,75 +655,75 @@ static int map_cont_bufs(struct rtrs_srv_sess *sess) continue; err: while (mri--) { - srv_mr =3D &sess->mrs[mri]; + srv_mr =3D &srv_path->mrs[mri]; sgt =3D &srv_mr->sgt; mr =3D srv_mr->mr; - rtrs_iu_free(srv_mr->iu, sess->s.dev->ib_dev, 1); + rtrs_iu_free(srv_mr->iu, srv_path->s.dev->ib_dev, 1); dereg_mr: ib_dereg_mr(mr); unmap_sg: - ib_dma_unmap_sg(sess->s.dev->ib_dev, sgt->sgl, + ib_dma_unmap_sg(srv_path->s.dev->ib_dev, sgt->sgl, sgt->nents, DMA_BIDIRECTIONAL); free_sg: sg_free_table(sgt); } - kfree(sess->mrs); + kfree(srv_path->mrs); =20 return err; } =20 chunk_bits =3D ilog2(srv->queue_depth - 1) + 1; - sess->mem_bits =3D (MAX_IMM_PAYL_BITS - chunk_bits); + srv_path->mem_bits =3D (MAX_IMM_PAYL_BITS - chunk_bits); =20 return 0; } =20 static void rtrs_srv_hb_err_handler(struct rtrs_con *c) { - close_sess(to_srv_sess(c->path)); + close_path(to_srv_path(c->path)); } =20 -static void rtrs_srv_init_hb(struct rtrs_srv_sess *sess) +static void rtrs_srv_init_hb(struct rtrs_srv_path *srv_path) { - rtrs_init_hb(&sess->s, &io_comp_cqe, + rtrs_init_hb(&srv_path->s, &io_comp_cqe, RTRS_HB_INTERVAL_MS, RTRS_HB_MISSED_MAX, rtrs_srv_hb_err_handler, rtrs_wq); } =20 -static void rtrs_srv_start_hb(struct rtrs_srv_sess *sess) +static void rtrs_srv_start_hb(struct rtrs_srv_path *srv_path) { - rtrs_start_hb(&sess->s); + rtrs_start_hb(&srv_path->s); } =20 -static void rtrs_srv_stop_hb(struct rtrs_srv_sess *sess) +static void rtrs_srv_stop_hb(struct rtrs_srv_path *srv_path) { - rtrs_stop_hb(&sess->s); + rtrs_stop_hb(&srv_path->s); } =20 static void rtrs_srv_info_rsp_done(struct ib_cq *cq, struct ib_wc *wc) { struct rtrs_srv_con *con =3D to_srv_con(wc->qp->qp_context); struct rtrs_path *s =3D con->c.path; - struct rtrs_srv_sess *sess =3D to_srv_sess(s); + struct rtrs_srv_path *srv_path =3D to_srv_path(s); struct rtrs_iu *iu; =20 iu =3D container_of(wc->wr_cqe, struct rtrs_iu, cqe); - rtrs_iu_free(iu, sess->s.dev->ib_dev, 1); + rtrs_iu_free(iu, srv_path->s.dev->ib_dev, 1); =20 if (wc->status !=3D IB_WC_SUCCESS) { rtrs_err(s, "Sess info response send failed: %s\n", ib_wc_status_msg(wc->status)); - close_sess(sess); + close_path(srv_path); return; } WARN_ON(wc->opcode !=3D IB_WC_SEND); } =20 -static void rtrs_srv_sess_up(struct rtrs_srv_sess *sess) +static void rtrs_srv_path_up(struct rtrs_srv_path *srv_path) { - struct rtrs_srv *srv =3D sess->srv; + struct rtrs_srv *srv =3D srv_path->srv; struct rtrs_srv_ctx *ctx =3D srv->ctx; int up; =20 @@ -731,18 +734,18 @@ static void rtrs_srv_sess_up(struct rtrs_srv_sess *se= ss) mutex_unlock(&srv->paths_ev_mutex); =20 /* Mark session as established */ - sess->established =3D true; + srv_path->established =3D true; } =20 -static void rtrs_srv_sess_down(struct rtrs_srv_sess *sess) +static void rtrs_srv_path_down(struct rtrs_srv_path *srv_path) { - struct rtrs_srv *srv =3D sess->srv; + struct rtrs_srv *srv =3D srv_path->srv; struct rtrs_srv_ctx *ctx =3D srv->ctx; =20 - if (!sess->established) + if (!srv_path->established) return; =20 - sess->established =3D false; + srv_path->established =3D false; mutex_lock(&srv->paths_ev_mutex); WARN_ON(!srv->paths_up); if (--srv->paths_up =3D=3D 0) @@ -750,11 +753,11 @@ static void rtrs_srv_sess_down(struct rtrs_srv_sess *= sess) mutex_unlock(&srv->paths_ev_mutex); } =20 -static bool exist_sessname(struct rtrs_srv_ctx *ctx, - const char *sessname, const uuid_t *path_uuid) +static bool exist_pathname(struct rtrs_srv_ctx *ctx, + const char *pathname, const uuid_t *path_uuid) { struct rtrs_srv *srv; - struct rtrs_srv_sess *sess; + struct rtrs_srv_path *srv_path; bool found =3D false; =20 mutex_lock(&ctx->srv_mutex); @@ -767,9 +770,9 @@ static bool exist_sessname(struct rtrs_srv_ctx *ctx, continue; } =20 - list_for_each_entry(sess, &srv->paths_list, s.entry) { - if (strlen(sess->s.sessname) =3D=3D strlen(sessname) && - !strcmp(sess->s.sessname, sessname)) { + list_for_each_entry(srv_path, &srv->paths_list, s.entry) { + if (strlen(srv_path->s.sessname) =3D=3D strlen(pathname) && + !strcmp(srv_path->s.sessname, pathname)) { found =3D true; break; } @@ -782,14 +785,14 @@ static bool exist_sessname(struct rtrs_srv_ctx *ctx, return found; } =20 -static int post_recv_sess(struct rtrs_srv_sess *sess); +static int post_recv_path(struct rtrs_srv_path *srv_path); static int rtrs_rdma_do_reject(struct rdma_cm_id *cm_id, int errno); =20 static int process_info_req(struct rtrs_srv_con *con, struct rtrs_msg_info_req *msg) { struct rtrs_path *s =3D con->c.path; - struct rtrs_srv_sess *sess =3D to_srv_sess(s); + struct rtrs_srv_path *srv_path =3D to_srv_path(s); struct ib_send_wr *reg_wr =3D NULL; struct rtrs_msg_info_rsp *rsp; struct rtrs_iu *tx_iu; @@ -797,31 +800,32 @@ static int process_info_req(struct rtrs_srv_con *con, int mri, err; size_t tx_sz; =20 - err =3D post_recv_sess(sess); + err =3D post_recv_path(srv_path); if (err) { - rtrs_err(s, "post_recv_sess(), err: %d\n", err); + rtrs_err(s, "post_recv_path(), err: %d\n", err); return err; } =20 - if (strchr(msg->sessname, '/') || strchr(msg->sessname, '.')) { - rtrs_err(s, "sessname cannot contain / and .\n"); + if (strchr(msg->pathname, '/') || strchr(msg->pathname, '.')) { + rtrs_err(s, "pathname cannot contain / and .\n"); return -EINVAL; } =20 - if (exist_sessname(sess->srv->ctx, - msg->sessname, &sess->srv->paths_uuid)) { - rtrs_err(s, "sessname is duplicated: %s\n", msg->sessname); + if (exist_pathname(srv_path->srv->ctx, + msg->pathname, &srv_path->srv->paths_uuid)) { + rtrs_err(s, "pathname is duplicated: %s\n", msg->pathname); return -EPERM; } - strscpy(sess->s.sessname, msg->sessname, sizeof(sess->s.sessname)); + strscpy(srv_path->s.sessname, msg->pathname, + sizeof(srv_path->s.sessname)); =20 - rwr =3D kcalloc(sess->mrs_num, sizeof(*rwr), GFP_KERNEL); + rwr =3D kcalloc(srv_path->mrs_num, sizeof(*rwr), GFP_KERNEL); if (!rwr) return -ENOMEM; =20 tx_sz =3D sizeof(*rsp); - tx_sz +=3D sizeof(rsp->desc[0]) * sess->mrs_num; - tx_iu =3D rtrs_iu_alloc(1, tx_sz, GFP_KERNEL, sess->s.dev->ib_dev, + tx_sz +=3D sizeof(rsp->desc[0]) * srv_path->mrs_num; + tx_iu =3D rtrs_iu_alloc(1, tx_sz, GFP_KERNEL, srv_path->s.dev->ib_dev, DMA_TO_DEVICE, rtrs_srv_info_rsp_done); if (!tx_iu) { err =3D -ENOMEM; @@ -830,10 +834,10 @@ static int process_info_req(struct rtrs_srv_con *con, =20 rsp =3D tx_iu->buf; rsp->type =3D cpu_to_le16(RTRS_MSG_INFO_RSP); - rsp->sg_cnt =3D cpu_to_le16(sess->mrs_num); + rsp->sg_cnt =3D cpu_to_le16(srv_path->mrs_num); =20 - for (mri =3D 0; mri < sess->mrs_num; mri++) { - struct ib_mr *mr =3D sess->mrs[mri].mr; + for (mri =3D 0; mri < srv_path->mrs_num; mri++) { + struct ib_mr *mr =3D srv_path->mrs[mri].mr; =20 rsp->desc[mri].addr =3D cpu_to_le64(mr->iova); rsp->desc[mri].key =3D cpu_to_le32(mr->rkey); @@ -854,13 +858,13 @@ static int process_info_req(struct rtrs_srv_con *con, reg_wr =3D &rwr[mri].wr; } =20 - err =3D rtrs_srv_create_sess_files(sess); + err =3D rtrs_srv_create_path_files(srv_path); if (err) goto iu_free; - kobject_get(&sess->kobj); - get_device(&sess->srv->dev); - rtrs_srv_change_state(sess, RTRS_SRV_CONNECTED); - rtrs_srv_start_hb(sess); + kobject_get(&srv_path->kobj); + get_device(&srv_path->srv->dev); + rtrs_srv_change_state(srv_path, RTRS_SRV_CONNECTED); + rtrs_srv_start_hb(srv_path); =20 /* * We do not account number of established connections at the current @@ -868,9 +872,10 @@ static int process_info_req(struct rtrs_srv_con *con, * all connections are successfully established. Thus, simply notify * listener with a proper event if we are the first path. */ - rtrs_srv_sess_up(sess); + rtrs_srv_path_up(srv_path); =20 - ib_dma_sync_single_for_device(sess->s.dev->ib_dev, tx_iu->dma_addr, + ib_dma_sync_single_for_device(srv_path->s.dev->ib_dev, + tx_iu->dma_addr, tx_iu->size, DMA_TO_DEVICE); =20 /* Send info response */ @@ -878,7 +883,7 @@ static int process_info_req(struct rtrs_srv_con *con, if (err) { rtrs_err(s, "rtrs_iu_post_send(), err: %d\n", err); iu_free: - rtrs_iu_free(tx_iu, sess->s.dev->ib_dev, 1); + rtrs_iu_free(tx_iu, srv_path->s.dev->ib_dev, 1); } rwr_free: kfree(rwr); @@ -890,7 +895,7 @@ static void rtrs_srv_info_req_done(struct ib_cq *cq, st= ruct ib_wc *wc) { struct rtrs_srv_con *con =3D to_srv_con(wc->qp->qp_context); struct rtrs_path *s =3D con->c.path; - struct rtrs_srv_sess *sess =3D to_srv_sess(s); + struct rtrs_srv_path *srv_path =3D to_srv_path(s); struct rtrs_msg_info_req *msg; struct rtrs_iu *iu; int err; @@ -910,7 +915,7 @@ static void rtrs_srv_info_req_done(struct ib_cq *cq, st= ruct ib_wc *wc) wc->byte_len); goto close; } - ib_dma_sync_single_for_cpu(sess->s.dev->ib_dev, iu->dma_addr, + ib_dma_sync_single_for_cpu(srv_path->s.dev->ib_dev, iu->dma_addr, iu->size, DMA_FROM_DEVICE); msg =3D iu->buf; if (le16_to_cpu(msg->type) !=3D RTRS_MSG_INFO_REQ) { @@ -923,22 +928,22 @@ static void rtrs_srv_info_req_done(struct ib_cq *cq, = struct ib_wc *wc) goto close; =20 out: - rtrs_iu_free(iu, sess->s.dev->ib_dev, 1); + rtrs_iu_free(iu, srv_path->s.dev->ib_dev, 1); return; close: - close_sess(sess); + close_path(srv_path); goto out; } =20 static int post_recv_info_req(struct rtrs_srv_con *con) { struct rtrs_path *s =3D con->c.path; - struct rtrs_srv_sess *sess =3D to_srv_sess(s); + struct rtrs_srv_path *srv_path =3D to_srv_path(s); struct rtrs_iu *rx_iu; int err; =20 rx_iu =3D rtrs_iu_alloc(1, sizeof(struct rtrs_msg_info_req), - GFP_KERNEL, sess->s.dev->ib_dev, + GFP_KERNEL, srv_path->s.dev->ib_dev, DMA_FROM_DEVICE, rtrs_srv_info_req_done); if (!rx_iu) return -ENOMEM; @@ -946,7 +951,7 @@ static int post_recv_info_req(struct rtrs_srv_con *con) err =3D rtrs_iu_post_recv(&con->c, rx_iu); if (err) { rtrs_err(s, "rtrs_iu_post_recv(), err: %d\n", err); - rtrs_iu_free(rx_iu, sess->s.dev->ib_dev, 1); + rtrs_iu_free(rx_iu, srv_path->s.dev->ib_dev, 1); return err; } =20 @@ -966,20 +971,20 @@ static int post_recv_io(struct rtrs_srv_con *con, siz= e_t q_size) return 0; } =20 -static int post_recv_sess(struct rtrs_srv_sess *sess) +static int post_recv_path(struct rtrs_srv_path *srv_path) { - struct rtrs_srv *srv =3D sess->srv; - struct rtrs_path *s =3D &sess->s; + struct rtrs_srv *srv =3D srv_path->srv; + struct rtrs_path *s =3D &srv_path->s; size_t q_size; int err, cid; =20 - for (cid =3D 0; cid < sess->s.con_num; cid++) { + for (cid =3D 0; cid < srv_path->s.con_num; cid++) { if (cid =3D=3D 0) q_size =3D SERVICE_CON_QUEUE_DEPTH; else q_size =3D srv->queue_depth; =20 - err =3D post_recv_io(to_srv_con(sess->s.con[cid]), q_size); + err =3D post_recv_io(to_srv_con(srv_path->s.con[cid]), q_size); if (err) { rtrs_err(s, "post_recv_io(), err: %d\n", err); return err; @@ -994,8 +999,8 @@ static void process_read(struct rtrs_srv_con *con, u32 buf_id, u32 off) { struct rtrs_path *s =3D con->c.path; - struct rtrs_srv_sess *sess =3D to_srv_sess(s); - struct rtrs_srv *srv =3D sess->srv; + struct rtrs_srv_path *srv_path =3D to_srv_path(s); + struct rtrs_srv *srv =3D srv_path->srv; struct rtrs_srv_ctx *ctx =3D srv->ctx; struct rtrs_srv_op *id; =20 @@ -1003,10 +1008,10 @@ static void process_read(struct rtrs_srv_con *con, void *data; int ret; =20 - if (sess->state !=3D RTRS_SRV_CONNECTED) { + if (srv_path->state !=3D RTRS_SRV_CONNECTED) { rtrs_err_rl(s, "Processing read request failed, session is disconnected, sess st= ate %s\n", - rtrs_srv_state_str(sess->state)); + rtrs_srv_state_str(srv_path->state)); return; } if (msg->sg_cnt !=3D 1 && msg->sg_cnt !=3D 0) { @@ -1014,9 +1019,9 @@ static void process_read(struct rtrs_srv_con *con, "Processing read request failed, invalid message\n"); return; } - rtrs_srv_get_ops_ids(sess); - rtrs_srv_update_rdma_stats(sess->stats, off, READ); - id =3D sess->ops_ids[buf_id]; + rtrs_srv_get_ops_ids(srv_path); + rtrs_srv_update_rdma_stats(srv_path->stats, off, READ); + id =3D srv_path->ops_ids[buf_id]; id->con =3D con; id->dir =3D READ; id->msg_id =3D buf_id; @@ -1042,9 +1047,9 @@ static void process_read(struct rtrs_srv_con *con, rtrs_err_rl(s, "Sending err msg for failed RDMA-Write-Req failed, msg_id %d, err:= %d\n", buf_id, ret); - close_sess(sess); + close_path(srv_path); } - rtrs_srv_put_ops_ids(sess); + rtrs_srv_put_ops_ids(srv_path); } =20 static void process_write(struct rtrs_srv_con *con, @@ -1052,8 +1057,8 @@ static void process_write(struct rtrs_srv_con *con, u32 buf_id, u32 off) { struct rtrs_path *s =3D con->c.path; - struct rtrs_srv_sess *sess =3D to_srv_sess(s); - struct rtrs_srv *srv =3D sess->srv; + struct rtrs_srv_path *srv_path =3D to_srv_path(s); + struct rtrs_srv *srv =3D srv_path->srv; struct rtrs_srv_ctx *ctx =3D srv->ctx; struct rtrs_srv_op *id; =20 @@ -1061,15 +1066,15 @@ static void process_write(struct rtrs_srv_con *con, void *data; int ret; =20 - if (sess->state !=3D RTRS_SRV_CONNECTED) { + if (srv_path->state !=3D RTRS_SRV_CONNECTED) { rtrs_err_rl(s, "Processing write request failed, session is disconnected, sess s= tate %s\n", - rtrs_srv_state_str(sess->state)); + rtrs_srv_state_str(srv_path->state)); return; } - rtrs_srv_get_ops_ids(sess); - rtrs_srv_update_rdma_stats(sess->stats, off, WRITE); - id =3D sess->ops_ids[buf_id]; + rtrs_srv_get_ops_ids(srv_path); + rtrs_srv_update_rdma_stats(srv_path->stats, off, WRITE); + id =3D srv_path->ops_ids[buf_id]; id->con =3D con; id->dir =3D WRITE; id->msg_id =3D buf_id; @@ -1094,20 +1099,21 @@ static void process_write(struct rtrs_srv_con *con, rtrs_err_rl(s, "Processing write request failed, sending I/O response failed, msg= _id %d, err: %d\n", buf_id, ret); - close_sess(sess); + close_path(srv_path); } - rtrs_srv_put_ops_ids(sess); + rtrs_srv_put_ops_ids(srv_path); } =20 static void process_io_req(struct rtrs_srv_con *con, void *msg, u32 id, u32 off) { struct rtrs_path *s =3D con->c.path; - struct rtrs_srv_sess *sess =3D to_srv_sess(s); + struct rtrs_srv_path *srv_path =3D to_srv_path(s); struct rtrs_msg_rdma_hdr *hdr; unsigned int type; =20 - ib_dma_sync_single_for_cpu(sess->s.dev->ib_dev, sess->dma_addr[id], + ib_dma_sync_single_for_cpu(srv_path->s.dev->ib_dev, + srv_path->dma_addr[id], max_chunk_size, DMA_BIDIRECTIONAL); hdr =3D msg; type =3D le16_to_cpu(hdr->type); @@ -1129,7 +1135,7 @@ static void process_io_req(struct rtrs_srv_con *con, = void *msg, return; =20 err: - close_sess(sess); + close_path(srv_path); } =20 static void rtrs_srv_inv_rkey_done(struct ib_cq *cq, struct ib_wc *wc) @@ -1138,15 +1144,15 @@ static void rtrs_srv_inv_rkey_done(struct ib_cq *cq= , struct ib_wc *wc) container_of(wc->wr_cqe, typeof(*mr), inv_cqe); struct rtrs_srv_con *con =3D to_srv_con(wc->qp->qp_context); struct rtrs_path *s =3D con->c.path; - struct rtrs_srv_sess *sess =3D to_srv_sess(s); - struct rtrs_srv *srv =3D sess->srv; + struct rtrs_srv_path *srv_path =3D to_srv_path(s); + struct rtrs_srv *srv =3D srv_path->srv; u32 msg_id, off; void *data; =20 if (wc->status !=3D IB_WC_SUCCESS) { rtrs_err(s, "Failed IB_WR_LOCAL_INV: %s\n", ib_wc_status_msg(wc->status)); - close_sess(sess); + close_path(srv_path); } msg_id =3D mr->msg_id; off =3D mr->msg_off; @@ -1195,8 +1201,8 @@ static void rtrs_srv_rdma_done(struct ib_cq *cq, stru= ct ib_wc *wc) { struct rtrs_srv_con *con =3D to_srv_con(wc->qp->qp_context); struct rtrs_path *s =3D con->c.path; - struct rtrs_srv_sess *sess =3D to_srv_sess(s); - struct rtrs_srv *srv =3D sess->srv; + struct rtrs_srv_path *srv_path =3D to_srv_path(s); + struct rtrs_srv *srv =3D srv_path->srv; u32 imm_type, imm_payload; int err; =20 @@ -1206,7 +1212,7 @@ static void rtrs_srv_rdma_done(struct ib_cq *cq, stru= ct ib_wc *wc) "%s (wr_cqe: %p, type: %d, vendor_err: 0x%x, len: %u)\n", ib_wc_status_msg(wc->status), wc->wr_cqe, wc->opcode, wc->vendor_err, wc->byte_len); - close_sess(sess); + close_path(srv_path); } return; } @@ -1222,7 +1228,7 @@ static void rtrs_srv_rdma_done(struct ib_cq *cq, stru= ct ib_wc *wc) err =3D rtrs_post_recv_empty(&con->c, &io_comp_cqe); if (err) { rtrs_err(s, "rtrs_post_recv(), err: %d\n", err); - close_sess(sess); + close_path(srv_path); break; } rtrs_from_imm(be32_to_cpu(wc->ex.imm_data), @@ -1231,16 +1237,16 @@ static void rtrs_srv_rdma_done(struct ib_cq *cq, st= ruct ib_wc *wc) u32 msg_id, off; void *data; =20 - msg_id =3D imm_payload >> sess->mem_bits; - off =3D imm_payload & ((1 << sess->mem_bits) - 1); + msg_id =3D imm_payload >> srv_path->mem_bits; + off =3D imm_payload & ((1 << srv_path->mem_bits) - 1); if (msg_id >=3D srv->queue_depth || off >=3D max_chunk_size) { rtrs_err(s, "Wrong msg_id %u, off %u\n", msg_id, off); - close_sess(sess); + close_path(srv_path); return; } if (always_invalidate) { - struct rtrs_srv_mr *mr =3D &sess->mrs[msg_id]; + struct rtrs_srv_mr *mr =3D &srv_path->mrs[msg_id]; =20 mr->msg_off =3D off; mr->msg_id =3D msg_id; @@ -1248,7 +1254,7 @@ static void rtrs_srv_rdma_done(struct ib_cq *cq, stru= ct ib_wc *wc) if (err) { rtrs_err(s, "rtrs_post_recv(), err: %d\n", err); - close_sess(sess); + close_path(srv_path); break; } } else { @@ -1257,10 +1263,10 @@ static void rtrs_srv_rdma_done(struct ib_cq *cq, st= ruct ib_wc *wc) } } else if (imm_type =3D=3D RTRS_HB_MSG_IMM) { WARN_ON(con->c.cid); - rtrs_send_hb_ack(&sess->s); + rtrs_send_hb_ack(&srv_path->s); } else if (imm_type =3D=3D RTRS_HB_ACK_IMM) { WARN_ON(con->c.cid); - sess->s.hb_missed_cnt =3D 0; + srv_path->s.hb_missed_cnt =3D 0; } else { rtrs_wrn(s, "Unknown IMM type %u\n", imm_type); } @@ -1284,22 +1290,23 @@ static void rtrs_srv_rdma_done(struct ib_cq *cq, st= ruct ib_wc *wc) } =20 /** - * rtrs_srv_get_sess_name() - Get rtrs_srv peer hostname. + * rtrs_srv_get_path_name() - Get rtrs_srv peer hostname. * @srv: Session - * @sessname: Sessname buffer + * @pathname: Pathname buffer * @len: Length of sessname buffer */ -int rtrs_srv_get_sess_name(struct rtrs_srv *srv, char *sessname, size_t le= n) +int rtrs_srv_get_path_name(struct rtrs_srv *srv, char *pathname, + size_t len) { - struct rtrs_srv_sess *sess; + struct rtrs_srv_path *srv_path; int err =3D -ENOTCONN; =20 mutex_lock(&srv->paths_mutex); - list_for_each_entry(sess, &srv->paths_list, s.entry) { - if (sess->state !=3D RTRS_SRV_CONNECTED) + list_for_each_entry(srv_path, &srv->paths_list, s.entry) { + if (srv_path->state !=3D RTRS_SRV_CONNECTED) continue; - strscpy(sessname, sess->s.sessname, - min_t(size_t, sizeof(sess->s.sessname), len)); + strscpy(pathname, srv_path->s.sessname, + min_t(size_t, sizeof(srv_path->s.sessname), len)); err =3D 0; break; } @@ -1307,7 +1314,7 @@ int rtrs_srv_get_sess_name(struct rtrs_srv *srv, char= *sessname, size_t len) =20 return err; } -EXPORT_SYMBOL(rtrs_srv_get_sess_name); +EXPORT_SYMBOL(rtrs_srv_get_path_name); =20 /** * rtrs_srv_get_queue_depth() - Get rtrs_srv qdepth. @@ -1319,22 +1326,22 @@ int rtrs_srv_get_queue_depth(struct rtrs_srv *srv) } EXPORT_SYMBOL(rtrs_srv_get_queue_depth); =20 -static int find_next_bit_ring(struct rtrs_srv_sess *sess) +static int find_next_bit_ring(struct rtrs_srv_path *srv_path) { - struct ib_device *ib_dev =3D sess->s.dev->ib_dev; + struct ib_device *ib_dev =3D srv_path->s.dev->ib_dev; int v; =20 - v =3D cpumask_next(sess->cur_cq_vector, &cq_affinity_mask); + v =3D cpumask_next(srv_path->cur_cq_vector, &cq_affinity_mask); if (v >=3D nr_cpu_ids || v >=3D ib_dev->num_comp_vectors) v =3D cpumask_first(&cq_affinity_mask); return v; } =20 -static int rtrs_srv_get_next_cq_vector(struct rtrs_srv_sess *sess) +static int rtrs_srv_get_next_cq_vector(struct rtrs_srv_path *srv_path) { - sess->cur_cq_vector =3D find_next_bit_ring(sess); + srv_path->cur_cq_vector =3D find_next_bit_ring(srv_path); =20 - return sess->cur_cq_vector; + return srv_path->cur_cq_vector; } =20 static void rtrs_srv_dev_release(struct device *dev) @@ -1439,22 +1446,22 @@ static void put_srv(struct rtrs_srv *srv) } =20 static void __add_path_to_srv(struct rtrs_srv *srv, - struct rtrs_srv_sess *sess) + struct rtrs_srv_path *srv_path) { - list_add_tail(&sess->s.entry, &srv->paths_list); + list_add_tail(&srv_path->s.entry, &srv->paths_list); srv->paths_num++; WARN_ON(srv->paths_num >=3D MAX_PATHS_NUM); } =20 -static void del_path_from_srv(struct rtrs_srv_sess *sess) +static void del_path_from_srv(struct rtrs_srv_path *srv_path) { - struct rtrs_srv *srv =3D sess->srv; + struct rtrs_srv *srv =3D srv_path->srv; =20 if (WARN_ON(!srv)) return; =20 mutex_lock(&srv->paths_mutex); - list_del(&sess->s.entry); + list_del(&srv_path->s.entry); WARN_ON(!srv->paths_num); srv->paths_num--; mutex_unlock(&srv->paths_mutex); @@ -1487,44 +1494,44 @@ static int sockaddr_cmp(const struct sockaddr *a, c= onst struct sockaddr *b) static bool __is_path_w_addr_exists(struct rtrs_srv *srv, struct rdma_addr *addr) { - struct rtrs_srv_sess *sess; + struct rtrs_srv_path *srv_path; =20 - list_for_each_entry(sess, &srv->paths_list, s.entry) - if (!sockaddr_cmp((struct sockaddr *)&sess->s.dst_addr, + list_for_each_entry(srv_path, &srv->paths_list, s.entry) + if (!sockaddr_cmp((struct sockaddr *)&srv_path->s.dst_addr, (struct sockaddr *)&addr->dst_addr) && - !sockaddr_cmp((struct sockaddr *)&sess->s.src_addr, + !sockaddr_cmp((struct sockaddr *)&srv_path->s.src_addr, (struct sockaddr *)&addr->src_addr)) return true; =20 return false; } =20 -static void free_sess(struct rtrs_srv_sess *sess) +static void free_path(struct rtrs_srv_path *srv_path) { - if (sess->kobj.state_in_sysfs) { - kobject_del(&sess->kobj); - kobject_put(&sess->kobj); + if (srv_path->kobj.state_in_sysfs) { + kobject_del(&srv_path->kobj); + kobject_put(&srv_path->kobj); } else { - kfree(sess->stats); - kfree(sess); + kfree(srv_path->stats); + kfree(srv_path); } } =20 static void rtrs_srv_close_work(struct work_struct *work) { - struct rtrs_srv_sess *sess; + struct rtrs_srv_path *srv_path; struct rtrs_srv_con *con; int i; =20 - sess =3D container_of(work, typeof(*sess), close_work); + srv_path =3D container_of(work, typeof(*srv_path), close_work); =20 - rtrs_srv_destroy_sess_files(sess); - rtrs_srv_stop_hb(sess); + rtrs_srv_destroy_path_files(srv_path); + rtrs_srv_stop_hb(srv_path); =20 - for (i =3D 0; i < sess->s.con_num; i++) { - if (!sess->s.con[i]) + for (i =3D 0; i < srv_path->s.con_num; i++) { + if (!srv_path->s.con[i]) continue; - con =3D to_srv_con(sess->s.con[i]); + con =3D to_srv_con(srv_path->s.con[i]); rdma_disconnect(con->c.cm_id); ib_drain_qp(con->c.qp); } @@ -1533,41 +1540,41 @@ static void rtrs_srv_close_work(struct work_struct = *work) * Degrade ref count to the usual model with a single shared * atomic_t counter */ - percpu_ref_kill(&sess->ids_inflight_ref); + percpu_ref_kill(&srv_path->ids_inflight_ref); =20 /* Wait for all completion */ - wait_for_completion(&sess->complete_done); + wait_for_completion(&srv_path->complete_done); =20 /* Notify upper layer if we are the last path */ - rtrs_srv_sess_down(sess); + rtrs_srv_path_down(srv_path); =20 - unmap_cont_bufs(sess); - rtrs_srv_free_ops_ids(sess); + unmap_cont_bufs(srv_path); + rtrs_srv_free_ops_ids(srv_path); =20 - for (i =3D 0; i < sess->s.con_num; i++) { - if (!sess->s.con[i]) + for (i =3D 0; i < srv_path->s.con_num; i++) { + if (!srv_path->s.con[i]) continue; - con =3D to_srv_con(sess->s.con[i]); + con =3D to_srv_con(srv_path->s.con[i]); rtrs_cq_qp_destroy(&con->c); rdma_destroy_id(con->c.cm_id); kfree(con); } - rtrs_ib_dev_put(sess->s.dev); + rtrs_ib_dev_put(srv_path->s.dev); =20 - del_path_from_srv(sess); - put_srv(sess->srv); - sess->srv =3D NULL; - rtrs_srv_change_state(sess, RTRS_SRV_CLOSED); + del_path_from_srv(srv_path); + put_srv(srv_path->srv); + srv_path->srv =3D NULL; + rtrs_srv_change_state(srv_path, RTRS_SRV_CLOSED); =20 - kfree(sess->dma_addr); - kfree(sess->s.con); - free_sess(sess); + kfree(srv_path->dma_addr); + kfree(srv_path->s.con); + free_path(srv_path); } =20 -static int rtrs_rdma_do_accept(struct rtrs_srv_sess *sess, +static int rtrs_rdma_do_accept(struct rtrs_srv_path *srv_path, struct rdma_cm_id *cm_id) { - struct rtrs_srv *srv =3D sess->srv; + struct rtrs_srv *srv =3D srv_path->srv; struct rtrs_msg_conn_rsp msg; struct rdma_conn_param param; int err; @@ -1615,25 +1622,25 @@ static int rtrs_rdma_do_reject(struct rdma_cm_id *c= m_id, int errno) return errno; } =20 -static struct rtrs_srv_sess * -__find_sess(struct rtrs_srv *srv, const uuid_t *sess_uuid) +static struct rtrs_srv_path * +__find_path(struct rtrs_srv *srv, const uuid_t *sess_uuid) { - struct rtrs_srv_sess *sess; + struct rtrs_srv_path *srv_path; =20 - list_for_each_entry(sess, &srv->paths_list, s.entry) { - if (uuid_equal(&sess->s.uuid, sess_uuid)) - return sess; + list_for_each_entry(srv_path, &srv->paths_list, s.entry) { + if (uuid_equal(&srv_path->s.uuid, sess_uuid)) + return srv_path; } =20 return NULL; } =20 -static int create_con(struct rtrs_srv_sess *sess, +static int create_con(struct rtrs_srv_path *srv_path, struct rdma_cm_id *cm_id, unsigned int cid) { - struct rtrs_srv *srv =3D sess->srv; - struct rtrs_path *s =3D &sess->s; + struct rtrs_srv *srv =3D srv_path->srv; + struct rtrs_path *s =3D &srv_path->s; struct rtrs_srv_con *con; =20 u32 cq_num, max_send_wr, max_recv_wr, wr_limit; @@ -1648,10 +1655,10 @@ static int create_con(struct rtrs_srv_sess *sess, spin_lock_init(&con->rsp_wr_wait_lock); INIT_LIST_HEAD(&con->rsp_wr_wait_list); con->c.cm_id =3D cm_id; - con->c.path =3D &sess->s; + con->c.path =3D &srv_path->s; con->c.cid =3D cid; atomic_set(&con->c.wr_cnt, 1); - wr_limit =3D sess->s.dev->ib_dev->attrs.max_qp_wr; + wr_limit =3D srv_path->s.dev->ib_dev->attrs.max_qp_wr; =20 if (con->c.cid =3D=3D 0) { /* @@ -1684,10 +1691,10 @@ static int create_con(struct rtrs_srv_sess *sess, } cq_num =3D max_send_wr + max_recv_wr; atomic_set(&con->c.sq_wr_avail, max_send_wr); - cq_vector =3D rtrs_srv_get_next_cq_vector(sess); + cq_vector =3D rtrs_srv_get_next_cq_vector(srv_path); =20 /* TODO: SOFTIRQ can be faster, but be careful with softirq context */ - err =3D rtrs_cq_qp_create(&sess->s, &con->c, 1, cq_vector, cq_num, + err =3D rtrs_cq_qp_create(&srv_path->s, &con->c, 1, cq_vector, cq_num, max_send_wr, max_recv_wr, IB_POLL_WORKQUEUE); if (err) { @@ -1699,8 +1706,8 @@ static int create_con(struct rtrs_srv_sess *sess, if (err) goto free_cqqp; } - WARN_ON(sess->s.con[cid]); - sess->s.con[cid] =3D &con->c; + WARN_ON(srv_path->s.con[cid]); + srv_path->s.con[cid] =3D &con->c; =20 /* * Change context from server to current connection. The other @@ -1719,13 +1726,13 @@ static int create_con(struct rtrs_srv_sess *sess, return err; } =20 -static struct rtrs_srv_sess *__alloc_sess(struct rtrs_srv *srv, +static struct rtrs_srv_path *__alloc_path(struct rtrs_srv *srv, struct rdma_cm_id *cm_id, unsigned int con_num, unsigned int recon_cnt, const uuid_t *uuid) { - struct rtrs_srv_sess *sess; + struct rtrs_srv_path *srv_path; int err =3D -ENOMEM; char str[NAME_MAX]; struct rtrs_addr path; @@ -1739,74 +1746,76 @@ static struct rtrs_srv_sess *__alloc_sess(struct rt= rs_srv *srv, pr_err("Path with same addr exists\n"); goto err; } - sess =3D kzalloc(sizeof(*sess), GFP_KERNEL); - if (!sess) + srv_path =3D kzalloc(sizeof(*srv_path), GFP_KERNEL); + if (!srv_path) goto err; =20 - sess->stats =3D kzalloc(sizeof(*sess->stats), GFP_KERNEL); - if (!sess->stats) + srv_path->stats =3D kzalloc(sizeof(*srv_path->stats), GFP_KERNEL); + if (!srv_path->stats) goto err_free_sess; =20 - sess->stats->sess =3D sess; + srv_path->stats->srv_path =3D srv_path; =20 - sess->dma_addr =3D kcalloc(srv->queue_depth, sizeof(*sess->dma_addr), - GFP_KERNEL); - if (!sess->dma_addr) + srv_path->dma_addr =3D kcalloc(srv->queue_depth, + sizeof(*srv_path->dma_addr), + GFP_KERNEL); + if (!srv_path->dma_addr) goto err_free_stats; =20 - sess->s.con =3D kcalloc(con_num, sizeof(*sess->s.con), GFP_KERNEL); - if (!sess->s.con) + srv_path->s.con =3D kcalloc(con_num, sizeof(*srv_path->s.con), + GFP_KERNEL); + if (!srv_path->s.con) goto err_free_dma_addr; =20 - sess->state =3D RTRS_SRV_CONNECTING; - sess->srv =3D srv; - sess->cur_cq_vector =3D -1; - sess->s.dst_addr =3D cm_id->route.addr.dst_addr; - sess->s.src_addr =3D cm_id->route.addr.src_addr; + srv_path->state =3D RTRS_SRV_CONNECTING; + srv_path->srv =3D srv; + srv_path->cur_cq_vector =3D -1; + srv_path->s.dst_addr =3D cm_id->route.addr.dst_addr; + srv_path->s.src_addr =3D cm_id->route.addr.src_addr; =20 /* temporary until receiving session-name from client */ - path.src =3D &sess->s.src_addr; - path.dst =3D &sess->s.dst_addr; + path.src =3D &srv_path->s.src_addr; + path.dst =3D &srv_path->s.dst_addr; rtrs_addr_to_str(&path, str, sizeof(str)); - strscpy(sess->s.sessname, str, sizeof(sess->s.sessname)); - - sess->s.con_num =3D con_num; - sess->s.irq_con_num =3D con_num; - sess->s.recon_cnt =3D recon_cnt; - uuid_copy(&sess->s.uuid, uuid); - spin_lock_init(&sess->state_lock); - INIT_WORK(&sess->close_work, rtrs_srv_close_work); - rtrs_srv_init_hb(sess); - - sess->s.dev =3D rtrs_ib_dev_find_or_add(cm_id->device, &dev_pd); - if (!sess->s.dev) { + strscpy(srv_path->s.sessname, str, sizeof(srv_path->s.sessname)); + + srv_path->s.con_num =3D con_num; + srv_path->s.irq_con_num =3D con_num; + srv_path->s.recon_cnt =3D recon_cnt; + uuid_copy(&srv_path->s.uuid, uuid); + spin_lock_init(&srv_path->state_lock); + INIT_WORK(&srv_path->close_work, rtrs_srv_close_work); + rtrs_srv_init_hb(srv_path); + + srv_path->s.dev =3D rtrs_ib_dev_find_or_add(cm_id->device, &dev_pd); + if (!srv_path->s.dev) { err =3D -ENOMEM; goto err_free_con; } - err =3D map_cont_bufs(sess); + err =3D map_cont_bufs(srv_path); if (err) goto err_put_dev; =20 - err =3D rtrs_srv_alloc_ops_ids(sess); + err =3D rtrs_srv_alloc_ops_ids(srv_path); if (err) goto err_unmap_bufs; =20 - __add_path_to_srv(srv, sess); + __add_path_to_srv(srv, srv_path); =20 - return sess; + return srv_path; =20 err_unmap_bufs: - unmap_cont_bufs(sess); + unmap_cont_bufs(srv_path); err_put_dev: - rtrs_ib_dev_put(sess->s.dev); + rtrs_ib_dev_put(srv_path->s.dev); err_free_con: - kfree(sess->s.con); + kfree(srv_path->s.con); err_free_dma_addr: - kfree(sess->dma_addr); + kfree(srv_path->dma_addr); err_free_stats: - kfree(sess->stats); + kfree(srv_path->stats); err_free_sess: - kfree(sess); + kfree(srv_path); err: return ERR_PTR(err); } @@ -1816,7 +1825,7 @@ static int rtrs_rdma_connect(struct rdma_cm_id *cm_id, size_t len) { struct rtrs_srv_ctx *ctx =3D cm_id->context; - struct rtrs_srv_sess *sess; + struct rtrs_srv_path *srv_path; struct rtrs_srv *srv; =20 u16 version, con_num, cid; @@ -1857,16 +1866,16 @@ static int rtrs_rdma_connect(struct rdma_cm_id *cm_= id, goto reject_w_err; } mutex_lock(&srv->paths_mutex); - sess =3D __find_sess(srv, &msg->sess_uuid); - if (sess) { - struct rtrs_path *s =3D &sess->s; + srv_path =3D __find_path(srv, &msg->sess_uuid); + if (srv_path) { + struct rtrs_path *s =3D &srv_path->s; =20 /* Session already holds a reference */ put_srv(srv); =20 - if (sess->state !=3D RTRS_SRV_CONNECTING) { + if (srv_path->state !=3D RTRS_SRV_CONNECTING) { rtrs_err(s, "Session in wrong state: %s\n", - rtrs_srv_state_str(sess->state)); + rtrs_srv_state_str(srv_path->state)); mutex_unlock(&srv->paths_mutex); goto reject_w_err; } @@ -1886,19 +1895,19 @@ static int rtrs_rdma_connect(struct rdma_cm_id *cm_= id, goto reject_w_err; } } else { - sess =3D __alloc_sess(srv, cm_id, con_num, recon_cnt, + srv_path =3D __alloc_path(srv, cm_id, con_num, recon_cnt, &msg->sess_uuid); - if (IS_ERR(sess)) { + if (IS_ERR(srv_path)) { mutex_unlock(&srv->paths_mutex); put_srv(srv); - err =3D PTR_ERR(sess); + err =3D PTR_ERR(srv_path); pr_err("RTRS server session allocation failed: %d\n", err); goto reject_w_err; } } - err =3D create_con(sess, cm_id, cid); + err =3D create_con(srv_path, cm_id, cid); if (err) { - rtrs_err((&sess->s), "create_con(), error %d\n", err); + rtrs_err((&srv_path->s), "create_con(), error %d\n", err); rtrs_rdma_do_reject(cm_id, err); /* * Since session has other connections we follow normal way @@ -1907,9 +1916,9 @@ static int rtrs_rdma_connect(struct rdma_cm_id *cm_id, */ goto close_and_return_err; } - err =3D rtrs_rdma_do_accept(sess, cm_id); + err =3D rtrs_rdma_do_accept(srv_path, cm_id); if (err) { - rtrs_err((&sess->s), "rtrs_rdma_do_accept(), error %d\n", err); + rtrs_err((&srv_path->s), "rtrs_rdma_do_accept(), error %d\n", err); rtrs_rdma_do_reject(cm_id, err); /* * Since current connection was successfully added to the @@ -1929,7 +1938,7 @@ static int rtrs_rdma_connect(struct rdma_cm_id *cm_id, =20 close_and_return_err: mutex_unlock(&srv->paths_mutex); - close_sess(sess); + close_path(srv_path); =20 return err; } @@ -1937,14 +1946,14 @@ static int rtrs_rdma_connect(struct rdma_cm_id *cm_= id, static int rtrs_srv_rdma_cm_handler(struct rdma_cm_id *cm_id, struct rdma_cm_event *ev) { - struct rtrs_srv_sess *sess =3D NULL; + struct rtrs_srv_path *srv_path =3D NULL; struct rtrs_path *s =3D NULL; =20 if (ev->event !=3D RDMA_CM_EVENT_CONNECT_REQUEST) { struct rtrs_con *c =3D cm_id->context; =20 s =3D c->path; - sess =3D to_srv_sess(s); + srv_path =3D to_srv_path(s); } =20 switch (ev->event) { @@ -1968,7 +1977,7 @@ static int rtrs_srv_rdma_cm_handler(struct rdma_cm_id= *cm_id, case RDMA_CM_EVENT_ADDR_CHANGE: case RDMA_CM_EVENT_TIMEWAIT_EXIT: case RDMA_CM_EVENT_DEVICE_REMOVAL: - close_sess(sess); + close_path(srv_path); break; default: pr_err("Ignoring unexpected CM event %s, err %d\n", @@ -2176,13 +2185,13 @@ struct rtrs_srv_ctx *rtrs_srv_open(struct rtrs_srv_= ops *ops, u16 port) } EXPORT_SYMBOL(rtrs_srv_open); =20 -static void close_sessions(struct rtrs_srv *srv) +static void close_paths(struct rtrs_srv *srv) { - struct rtrs_srv_sess *sess; + struct rtrs_srv_path *srv_path; =20 mutex_lock(&srv->paths_mutex); - list_for_each_entry(sess, &srv->paths_list, s.entry) - close_sess(sess); + list_for_each_entry(srv_path, &srv->paths_list, s.entry) + close_path(srv_path); mutex_unlock(&srv->paths_mutex); } =20 @@ -2192,7 +2201,7 @@ static void close_ctx(struct rtrs_srv_ctx *ctx) =20 mutex_lock(&ctx->srv_mutex); list_for_each_entry(srv, &ctx->srv_list, ctx_list) - close_sessions(srv); + close_paths(srv); mutex_unlock(&ctx->srv_mutex); flush_workqueue(rtrs_wq); } diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv.h b/drivers/infiniband/ul= p/rtrs/rtrs-srv.h index f0fbd8bf8871..ee3578b9aa01 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-srv.h +++ b/drivers/infiniband/ulp/rtrs/rtrs-srv.h @@ -37,7 +37,7 @@ struct rtrs_srv_stats_rdma_stats { struct rtrs_srv_stats { struct kobject kobj_stats; struct rtrs_srv_stats_rdma_stats rdma_stats; - struct rtrs_srv_sess *sess; + struct rtrs_srv_path *srv_path; }; =20 struct rtrs_srv_con { @@ -71,7 +71,7 @@ struct rtrs_srv_mr { struct rtrs_iu *iu; /* send buffer for new rkey msg */ }; =20 -struct rtrs_srv_sess { +struct rtrs_srv_path { struct rtrs_path s; struct rtrs_srv *srv; struct work_struct close_work; @@ -125,7 +125,7 @@ struct rtrs_srv_ib_ctx { =20 extern struct class *rtrs_dev_class; =20 -void close_sess(struct rtrs_srv_sess *sess); +void close_path(struct rtrs_srv_path *srv_path); =20 static inline void rtrs_srv_update_rdma_stats(struct rtrs_srv_stats *s, size_t size, int d) @@ -143,7 +143,7 @@ ssize_t rtrs_srv_reset_all_help(struct rtrs_srv_stats *= stats, char *page, size_t len); =20 /* functions which are implemented in rtrs-srv-sysfs.c */ -int rtrs_srv_create_sess_files(struct rtrs_srv_sess *sess); -void rtrs_srv_destroy_sess_files(struct rtrs_srv_sess *sess); +int rtrs_srv_create_path_files(struct rtrs_srv_path *srv_path); +void rtrs_srv_destroy_path_files(struct rtrs_srv_path *srv_path); =20 #endif /* RTRS_SRV_H */ diff --git a/drivers/infiniband/ulp/rtrs/rtrs.h b/drivers/infiniband/ulp/rt= rs/rtrs.h index 859c79685daf..9da9202fbee5 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs.h +++ b/drivers/infiniband/ulp/rtrs/rtrs.h @@ -175,7 +175,8 @@ bool rtrs_srv_resp_rdma(struct rtrs_srv_op *id, int err= no); =20 void rtrs_srv_set_sess_priv(struct rtrs_srv *sess, void *priv); =20 -int rtrs_srv_get_sess_name(struct rtrs_srv *sess, char *sessname, size_t l= en); +int rtrs_srv_get_path_name(struct rtrs_srv *sess, char *pathname, + size_t len); =20 int rtrs_srv_get_queue_depth(struct rtrs_srv *sess); =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29144C00140 for ; Mon, 15 Aug 2022 19:22:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244161AbiHOTWB (ORCPT ); Mon, 15 Aug 2022 15:22:01 -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 S1345123AbiHOTSK (ORCPT ); Mon, 15 Aug 2022 15:18:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 913553D596; Mon, 15 Aug 2022 11:39: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 5B180B81084; Mon, 15 Aug 2022 18:39:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40039C433C1; Mon, 15 Aug 2022 18:39:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588772; bh=SiLhXUfK/WppfXJET+Ns4BzruEjYUXQU5bhguteG0oo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lpoKSWdXQ62Z4WHY4vt8iOmVkilFuDfpJskV7Xp1pWi8xbYzZfRviNkj1hqJyE0/K xMCKOTjreIh4paeT1rXi5pS8qYzklnFKwobWZ7ernAo8MGIg3FunNlYYsN2kUgKTZ1 lBf3wRPBRpgsChmqc0x6GolZeBMQRWmUdKAHPQoA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vaishali Thakkar , Jack Wang , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.15 509/779] RDMA/rtrs-clt: Rename rtrs_clt_sess to rtrs_clt_path Date: Mon, 15 Aug 2022 20:02:33 +0200 Message-Id: <20220815180359.020085034@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vaishali Thakkar [ Upstream commit caa84d95c78f35168847e2ab861a3a7f87033d36 ] rtrs_clt_sess is used for paths and not sessions on the client side. This creates confusion so let's rename it to rtrs_clt_path. Also, rename related variables and functions. Coccinelle is used to do the transformations for most of the occurrences and remaining ones were handled manually. Link: https://lore.kernel.org/r/20220105180708.7774-4-jinpu.wang@ionos.com Signed-off-by: Vaishali Thakkar Signed-off-by: Jack Wang Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/infiniband/ulp/rtrs/rtrs-clt-stats.c | 8 +- drivers/infiniband/ulp/rtrs/rtrs-clt-sysfs.c | 123 +-- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 997 ++++++++++--------- drivers/infiniband/ulp/rtrs/rtrs-clt.h | 20 +- drivers/infiniband/ulp/rtrs/rtrs-pri.h | 2 +- drivers/infiniband/ulp/rtrs/rtrs.h | 4 +- 6 files changed, 586 insertions(+), 568 deletions(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt-stats.c b/drivers/infinib= and/ulp/rtrs/rtrs-clt-stats.c index 40b4d6dd4924..e7b57bdfe3ea 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt-stats.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt-stats.c @@ -13,8 +13,8 @@ =20 void rtrs_clt_update_wc_stats(struct rtrs_clt_con *con) { - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); - struct rtrs_clt_stats *stats =3D sess->stats; + struct rtrs_clt_path *clt_path =3D to_clt_path(con->c.path); + struct rtrs_clt_stats *stats =3D clt_path->stats; struct rtrs_clt_stats_pcpu *s; int cpu; =20 @@ -174,8 +174,8 @@ static inline void rtrs_clt_update_rdma_stats(struct rt= rs_clt_stats *stats, void rtrs_clt_update_all_stats(struct rtrs_clt_io_req *req, int dir) { struct rtrs_clt_con *con =3D req->con; - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); - struct rtrs_clt_stats *stats =3D sess->stats; + struct rtrs_clt_path *clt_path =3D to_clt_path(con->c.path); + struct rtrs_clt_stats *stats =3D clt_path->stats; unsigned int len; =20 len =3D req->usr_len + req->data_len; diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt-sysfs.c b/drivers/infinib= and/ulp/rtrs/rtrs-clt-sysfs.c index 4ee592ccf979..dbf9a778c3bd 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt-sysfs.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt-sysfs.c @@ -16,21 +16,21 @@ #define MIN_MAX_RECONN_ATT -1 #define MAX_MAX_RECONN_ATT 9999 =20 -static void rtrs_clt_sess_release(struct kobject *kobj) +static void rtrs_clt_path_release(struct kobject *kobj) { - struct rtrs_clt_sess *sess; + struct rtrs_clt_path *clt_path; =20 - sess =3D container_of(kobj, struct rtrs_clt_sess, kobj); + clt_path =3D container_of(kobj, struct rtrs_clt_path, kobj); =20 - free_sess(sess); + free_path(clt_path); } =20 static struct kobj_type ktype_sess =3D { .sysfs_ops =3D &kobj_sysfs_ops, - .release =3D rtrs_clt_sess_release + .release =3D rtrs_clt_path_release }; =20 -static void rtrs_clt_sess_stats_release(struct kobject *kobj) +static void rtrs_clt_path_stats_release(struct kobject *kobj) { struct rtrs_clt_stats *stats; =20 @@ -43,7 +43,7 @@ static void rtrs_clt_sess_stats_release(struct kobject *k= obj) =20 static struct kobj_type ktype_stats =3D { .sysfs_ops =3D &kobj_sysfs_ops, - .release =3D rtrs_clt_sess_stats_release, + .release =3D rtrs_clt_path_stats_release, }; =20 static ssize_t max_reconnect_attempts_show(struct device *dev, @@ -197,10 +197,10 @@ static DEVICE_ATTR_RW(add_path); static ssize_t rtrs_clt_state_show(struct kobject *kobj, struct kobj_attribute *attr, char *page) { - struct rtrs_clt_sess *sess; + struct rtrs_clt_path *clt_path; =20 - sess =3D container_of(kobj, struct rtrs_clt_sess, kobj); - if (sess->state =3D=3D RTRS_CLT_CONNECTED) + clt_path =3D container_of(kobj, struct rtrs_clt_path, kobj); + if (clt_path->state =3D=3D RTRS_CLT_CONNECTED) return sysfs_emit(page, "connected\n"); =20 return sysfs_emit(page, "disconnected\n"); @@ -219,16 +219,16 @@ static ssize_t rtrs_clt_reconnect_store(struct kobjec= t *kobj, struct kobj_attribute *attr, const char *buf, size_t count) { - struct rtrs_clt_sess *sess; + struct rtrs_clt_path *clt_path; int ret; =20 - sess =3D container_of(kobj, struct rtrs_clt_sess, kobj); + clt_path =3D container_of(kobj, struct rtrs_clt_path, kobj); if (!sysfs_streq(buf, "1")) { - rtrs_err(sess->clt, "%s: unknown value: '%s'\n", + rtrs_err(clt_path->clt, "%s: unknown value: '%s'\n", attr->attr.name, buf); return -EINVAL; } - ret =3D rtrs_clt_reconnect_from_sysfs(sess); + ret =3D rtrs_clt_reconnect_from_sysfs(clt_path); if (ret) return ret; =20 @@ -249,15 +249,15 @@ static ssize_t rtrs_clt_disconnect_store(struct kobje= ct *kobj, struct kobj_attribute *attr, const char *buf, size_t count) { - struct rtrs_clt_sess *sess; + struct rtrs_clt_path *clt_path; =20 - sess =3D container_of(kobj, struct rtrs_clt_sess, kobj); + clt_path =3D container_of(kobj, struct rtrs_clt_path, kobj); if (!sysfs_streq(buf, "1")) { - rtrs_err(sess->clt, "%s: unknown value: '%s'\n", + rtrs_err(clt_path->clt, "%s: unknown value: '%s'\n", attr->attr.name, buf); return -EINVAL; } - rtrs_clt_close_conns(sess, true); + rtrs_clt_close_conns(clt_path, true); =20 return count; } @@ -276,16 +276,16 @@ static ssize_t rtrs_clt_remove_path_store(struct kobj= ect *kobj, struct kobj_attribute *attr, const char *buf, size_t count) { - struct rtrs_clt_sess *sess; + struct rtrs_clt_path *clt_path; int ret; =20 - sess =3D container_of(kobj, struct rtrs_clt_sess, kobj); + clt_path =3D container_of(kobj, struct rtrs_clt_path, kobj); if (!sysfs_streq(buf, "1")) { - rtrs_err(sess->clt, "%s: unknown value: '%s'\n", + rtrs_err(clt_path->clt, "%s: unknown value: '%s'\n", attr->attr.name, buf); return -EINVAL; } - ret =3D rtrs_clt_remove_path_from_sysfs(sess, &attr->attr); + ret =3D rtrs_clt_remove_path_from_sysfs(clt_path, &attr->attr); if (ret) return ret; =20 @@ -328,11 +328,11 @@ static ssize_t rtrs_clt_hca_port_show(struct kobject = *kobj, struct kobj_attribute *attr, char *page) { - struct rtrs_clt_sess *sess; + struct rtrs_clt_path *clt_path; =20 - sess =3D container_of(kobj, typeof(*sess), kobj); + clt_path =3D container_of(kobj, typeof(*clt_path), kobj); =20 - return sysfs_emit(page, "%u\n", sess->hca_port); + return sysfs_emit(page, "%u\n", clt_path->hca_port); } =20 static struct kobj_attribute rtrs_clt_hca_port_attr =3D @@ -342,11 +342,11 @@ static ssize_t rtrs_clt_hca_name_show(struct kobject = *kobj, struct kobj_attribute *attr, char *page) { - struct rtrs_clt_sess *sess; + struct rtrs_clt_path *clt_path; =20 - sess =3D container_of(kobj, struct rtrs_clt_sess, kobj); + clt_path =3D container_of(kobj, struct rtrs_clt_path, kobj); =20 - return sysfs_emit(page, "%s\n", sess->hca_name); + return sysfs_emit(page, "%s\n", clt_path->hca_name); } =20 static struct kobj_attribute rtrs_clt_hca_name_attr =3D @@ -356,12 +356,12 @@ static ssize_t rtrs_clt_cur_latency_show(struct kobje= ct *kobj, struct kobj_attribute *attr, char *page) { - struct rtrs_clt_sess *sess; + struct rtrs_clt_path *clt_path; =20 - sess =3D container_of(kobj, struct rtrs_clt_sess, kobj); + clt_path =3D container_of(kobj, struct rtrs_clt_path, kobj); =20 return sysfs_emit(page, "%lld ns\n", - ktime_to_ns(sess->s.hb_cur_latency)); + ktime_to_ns(clt_path->s.hb_cur_latency)); } =20 static struct kobj_attribute rtrs_clt_cur_latency_attr =3D @@ -371,11 +371,11 @@ static ssize_t rtrs_clt_src_addr_show(struct kobject = *kobj, struct kobj_attribute *attr, char *page) { - struct rtrs_clt_sess *sess; + struct rtrs_clt_path *clt_path; int len; =20 - sess =3D container_of(kobj, struct rtrs_clt_sess, kobj); - len =3D sockaddr_to_str((struct sockaddr *)&sess->s.src_addr, page, + clt_path =3D container_of(kobj, struct rtrs_clt_path, kobj); + len =3D sockaddr_to_str((struct sockaddr *)&clt_path->s.src_addr, page, PAGE_SIZE); len +=3D sysfs_emit_at(page, len, "\n"); return len; @@ -388,11 +388,11 @@ static ssize_t rtrs_clt_dst_addr_show(struct kobject = *kobj, struct kobj_attribute *attr, char *page) { - struct rtrs_clt_sess *sess; + struct rtrs_clt_path *clt_path; int len; =20 - sess =3D container_of(kobj, struct rtrs_clt_sess, kobj); - len =3D sockaddr_to_str((struct sockaddr *)&sess->s.dst_addr, page, + clt_path =3D container_of(kobj, struct rtrs_clt_path, kobj); + len =3D sockaddr_to_str((struct sockaddr *)&clt_path->s.dst_addr, page, PAGE_SIZE); len +=3D sysfs_emit_at(page, len, "\n"); return len; @@ -401,7 +401,7 @@ static ssize_t rtrs_clt_dst_addr_show(struct kobject *k= obj, static struct kobj_attribute rtrs_clt_dst_addr_attr =3D __ATTR(dst_addr, 0444, rtrs_clt_dst_addr_show, NULL); =20 -static struct attribute *rtrs_clt_sess_attrs[] =3D { +static struct attribute *rtrs_clt_path_attrs[] =3D { &rtrs_clt_hca_name_attr.attr, &rtrs_clt_hca_port_attr.attr, &rtrs_clt_src_addr_attr.attr, @@ -414,42 +414,43 @@ static struct attribute *rtrs_clt_sess_attrs[] =3D { NULL, }; =20 -static const struct attribute_group rtrs_clt_sess_attr_group =3D { - .attrs =3D rtrs_clt_sess_attrs, +static const struct attribute_group rtrs_clt_path_attr_group =3D { + .attrs =3D rtrs_clt_path_attrs, }; =20 -int rtrs_clt_create_sess_files(struct rtrs_clt_sess *sess) +int rtrs_clt_create_path_files(struct rtrs_clt_path *clt_path) { - struct rtrs_clt *clt =3D sess->clt; + struct rtrs_clt *clt =3D clt_path->clt; char str[NAME_MAX]; int err; struct rtrs_addr path =3D { - .src =3D &sess->s.src_addr, - .dst =3D &sess->s.dst_addr, + .src =3D &clt_path->s.src_addr, + .dst =3D &clt_path->s.dst_addr, }; =20 rtrs_addr_to_str(&path, str, sizeof(str)); - err =3D kobject_init_and_add(&sess->kobj, &ktype_sess, clt->kobj_paths, + err =3D kobject_init_and_add(&clt_path->kobj, &ktype_sess, + clt->kobj_paths, "%s", str); if (err) { pr_err("kobject_init_and_add: %d\n", err); - kobject_put(&sess->kobj); + kobject_put(&clt_path->kobj); return err; } - err =3D sysfs_create_group(&sess->kobj, &rtrs_clt_sess_attr_group); + err =3D sysfs_create_group(&clt_path->kobj, &rtrs_clt_path_attr_group); if (err) { pr_err("sysfs_create_group(): %d\n", err); goto put_kobj; } - err =3D kobject_init_and_add(&sess->stats->kobj_stats, &ktype_stats, - &sess->kobj, "stats"); + err =3D kobject_init_and_add(&clt_path->stats->kobj_stats, &ktype_stats, + &clt_path->kobj, "stats"); if (err) { pr_err("kobject_init_and_add: %d\n", err); - kobject_put(&sess->stats->kobj_stats); + kobject_put(&clt_path->stats->kobj_stats); goto remove_group; } =20 - err =3D sysfs_create_group(&sess->stats->kobj_stats, + err =3D sysfs_create_group(&clt_path->stats->kobj_stats, &rtrs_clt_stats_attr_group); if (err) { pr_err("failed to create stats sysfs group, err: %d\n", err); @@ -459,25 +460,25 @@ int rtrs_clt_create_sess_files(struct rtrs_clt_sess *= sess) return 0; =20 put_kobj_stats: - kobject_del(&sess->stats->kobj_stats); - kobject_put(&sess->stats->kobj_stats); + kobject_del(&clt_path->stats->kobj_stats); + kobject_put(&clt_path->stats->kobj_stats); remove_group: - sysfs_remove_group(&sess->kobj, &rtrs_clt_sess_attr_group); + sysfs_remove_group(&clt_path->kobj, &rtrs_clt_path_attr_group); put_kobj: - kobject_del(&sess->kobj); - kobject_put(&sess->kobj); + kobject_del(&clt_path->kobj); + kobject_put(&clt_path->kobj); =20 return err; } =20 -void rtrs_clt_destroy_sess_files(struct rtrs_clt_sess *sess, +void rtrs_clt_destroy_path_files(struct rtrs_clt_path *clt_path, const struct attribute *sysfs_self) { - kobject_del(&sess->stats->kobj_stats); - kobject_put(&sess->stats->kobj_stats); + kobject_del(&clt_path->stats->kobj_stats); + kobject_put(&clt_path->stats->kobj_stats); if (sysfs_self) - sysfs_remove_file_self(&sess->kobj, sysfs_self); - kobject_del(&sess->kobj); + sysfs_remove_file_self(&clt_path->kobj, sysfs_self); + kobject_del(&clt_path->kobj); } =20 static struct attribute *rtrs_clt_attrs[] =3D { diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ul= p/rtrs/rtrs-clt.c index 5e73127f2adc..a46ef2821e36 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c @@ -48,12 +48,12 @@ static struct class *rtrs_clt_dev_class; =20 static inline bool rtrs_clt_is_connected(const struct rtrs_clt *clt) { - struct rtrs_clt_sess *sess; + struct rtrs_clt_path *clt_path; bool connected =3D false; =20 rcu_read_lock(); - list_for_each_entry_rcu(sess, &clt->paths_list, s.entry) - connected |=3D READ_ONCE(sess->state) =3D=3D RTRS_CLT_CONNECTED; + list_for_each_entry_rcu(clt_path, &clt->paths_list, s.entry) + connected |=3D READ_ONCE(clt_path->state) =3D=3D RTRS_CLT_CONNECTED; rcu_read_unlock(); =20 return connected; @@ -163,29 +163,29 @@ EXPORT_SYMBOL(rtrs_clt_put_permit); =20 /** * rtrs_permit_to_clt_con() - returns RDMA connection pointer by the permit - * @sess: client session pointer + * @clt_path: client path pointer * @permit: permit for the allocation of the RDMA buffer * Note: * IO connection starts from 1. * 0 connection is for user messages. */ static -struct rtrs_clt_con *rtrs_permit_to_clt_con(struct rtrs_clt_sess *sess, +struct rtrs_clt_con *rtrs_permit_to_clt_con(struct rtrs_clt_path *clt_path, struct rtrs_permit *permit) { int id =3D 0; =20 if (permit->con_type =3D=3D RTRS_IO_CON) - id =3D (permit->cpu_id % (sess->s.irq_con_num - 1)) + 1; + id =3D (permit->cpu_id % (clt_path->s.irq_con_num - 1)) + 1; =20 - return to_clt_con(sess->s.con[id]); + return to_clt_con(clt_path->s.con[id]); } =20 /** * rtrs_clt_change_state() - change the session state through session state * machine. * - * @sess: client session to change the state of. + * @clt_path: client path to change the state of. * @new_state: state to change to. * * returns true if sess's state is changed to new state, otherwise return = false. @@ -193,15 +193,15 @@ struct rtrs_clt_con *rtrs_permit_to_clt_con(struct rt= rs_clt_sess *sess, * Locks: * state_wq lock must be hold. */ -static bool rtrs_clt_change_state(struct rtrs_clt_sess *sess, +static bool rtrs_clt_change_state(struct rtrs_clt_path *clt_path, enum rtrs_clt_state new_state) { enum rtrs_clt_state old_state; bool changed =3D false; =20 - lockdep_assert_held(&sess->state_wq.lock); + lockdep_assert_held(&clt_path->state_wq.lock); =20 - old_state =3D sess->state; + old_state =3D clt_path->state; switch (new_state) { case RTRS_CLT_CONNECTING: switch (old_state) { @@ -275,42 +275,42 @@ static bool rtrs_clt_change_state(struct rtrs_clt_ses= s *sess, break; } if (changed) { - sess->state =3D new_state; - wake_up_locked(&sess->state_wq); + clt_path->state =3D new_state; + wake_up_locked(&clt_path->state_wq); } =20 return changed; } =20 -static bool rtrs_clt_change_state_from_to(struct rtrs_clt_sess *sess, +static bool rtrs_clt_change_state_from_to(struct rtrs_clt_path *clt_path, enum rtrs_clt_state old_state, enum rtrs_clt_state new_state) { bool changed =3D false; =20 - spin_lock_irq(&sess->state_wq.lock); - if (sess->state =3D=3D old_state) - changed =3D rtrs_clt_change_state(sess, new_state); - spin_unlock_irq(&sess->state_wq.lock); + spin_lock_irq(&clt_path->state_wq.lock); + if (clt_path->state =3D=3D old_state) + changed =3D rtrs_clt_change_state(clt_path, new_state); + spin_unlock_irq(&clt_path->state_wq.lock); =20 return changed; } =20 static void rtrs_rdma_error_recovery(struct rtrs_clt_con *con) { - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); + struct rtrs_clt_path *clt_path =3D to_clt_path(con->c.path); =20 - if (rtrs_clt_change_state_from_to(sess, + if (rtrs_clt_change_state_from_to(clt_path, RTRS_CLT_CONNECTED, RTRS_CLT_RECONNECTING)) { - struct rtrs_clt *clt =3D sess->clt; + struct rtrs_clt *clt =3D clt_path->clt; unsigned int delay_ms; =20 /* * Normal scenario, reconnect if we were successfully connected */ delay_ms =3D clt->reconnect_delay_sec * 1000; - queue_delayed_work(rtrs_wq, &sess->reconnect_dwork, + queue_delayed_work(rtrs_wq, &clt_path->reconnect_dwork, msecs_to_jiffies(delay_ms + prandom_u32() % RTRS_RECONNECT_SEED)); } else { @@ -319,7 +319,7 @@ static void rtrs_rdma_error_recovery(struct rtrs_clt_co= n *con) * so notify waiter with error state, waiter is responsible * for cleaning the rest and reconnect if needed. */ - rtrs_clt_change_state_from_to(sess, + rtrs_clt_change_state_from_to(clt_path, RTRS_CLT_CONNECTING, RTRS_CLT_CONNECTING_ERR); } @@ -380,14 +380,14 @@ static void complete_rdma_req(struct rtrs_clt_io_req = *req, int errno, bool notify, bool can_wait) { struct rtrs_clt_con *con =3D req->con; - struct rtrs_clt_sess *sess; + struct rtrs_clt_path *clt_path; int err; =20 if (WARN_ON(!req->in_use)) return; if (WARN_ON(!req->con)) return; - sess =3D to_clt_sess(con->c.path); + clt_path =3D to_clt_path(con->c.path); =20 if (req->sg_cnt) { if (req->dir =3D=3D DMA_FROM_DEVICE && req->need_inv) { @@ -433,21 +433,21 @@ static void complete_rdma_req(struct rtrs_clt_io_req = *req, int errno, if (!refcount_dec_and_test(&req->ref)) return; } - ib_dma_unmap_sg(sess->s.dev->ib_dev, req->sglist, + ib_dma_unmap_sg(clt_path->s.dev->ib_dev, req->sglist, req->sg_cnt, req->dir); } if (!refcount_dec_and_test(&req->ref)) return; if (req->mp_policy =3D=3D MP_POLICY_MIN_INFLIGHT) - atomic_dec(&sess->stats->inflight); + atomic_dec(&clt_path->stats->inflight); =20 req->in_use =3D false; req->con =3D NULL; =20 if (errno) { rtrs_err_rl(con->c.path, "IO request failed: error=3D%d path=3D%s [%s:%u= ] notify=3D%d\n", - errno, kobject_name(&sess->kobj), sess->hca_name, - sess->hca_port, notify); + errno, kobject_name(&clt_path->kobj), clt_path->hca_name, + clt_path->hca_port, notify); } =20 if (notify) @@ -459,7 +459,7 @@ static int rtrs_post_send_rdma(struct rtrs_clt_con *con, struct rtrs_rbuf *rbuf, u32 off, u32 imm, struct ib_send_wr *wr) { - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); + struct rtrs_clt_path *clt_path =3D to_clt_path(con->c.path); enum ib_send_flags flags; struct ib_sge sge; =20 @@ -472,16 +472,17 @@ static int rtrs_post_send_rdma(struct rtrs_clt_con *c= on, /* user data and user message in the first list element */ sge.addr =3D req->iu->dma_addr; sge.length =3D req->sg_size; - sge.lkey =3D sess->s.dev->ib_pd->local_dma_lkey; + sge.lkey =3D clt_path->s.dev->ib_pd->local_dma_lkey; =20 /* * From time to time we have to post signalled sends, * or send queue will fill up and only QP reset can help. */ - flags =3D atomic_inc_return(&con->c.wr_cnt) % sess->s.signal_interval ? + flags =3D atomic_inc_return(&con->c.wr_cnt) % clt_path->s.signal_interval= ? 0 : IB_SEND_SIGNALED; =20 - ib_dma_sync_single_for_device(sess->s.dev->ib_dev, req->iu->dma_addr, + ib_dma_sync_single_for_device(clt_path->s.dev->ib_dev, + req->iu->dma_addr, req->sg_size, DMA_TO_DEVICE); =20 return rtrs_iu_post_rdma_write_imm(&con->c, req->iu, &sge, 1, @@ -489,15 +490,15 @@ static int rtrs_post_send_rdma(struct rtrs_clt_con *c= on, imm, flags, wr, NULL); } =20 -static void process_io_rsp(struct rtrs_clt_sess *sess, u32 msg_id, +static void process_io_rsp(struct rtrs_clt_path *clt_path, u32 msg_id, s16 errno, bool w_inval) { struct rtrs_clt_io_req *req; =20 - if (WARN_ON(msg_id >=3D sess->queue_depth)) + if (WARN_ON(msg_id >=3D clt_path->queue_depth)) return; =20 - req =3D &sess->reqs[msg_id]; + req =3D &clt_path->reqs[msg_id]; /* Drop need_inv if server responded with send with invalidation */ req->need_inv &=3D !w_inval; complete_rdma_req(req, errno, true, false); @@ -507,9 +508,9 @@ static void rtrs_clt_recv_done(struct rtrs_clt_con *con= , struct ib_wc *wc) { struct rtrs_iu *iu; int err; - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); + struct rtrs_clt_path *clt_path =3D to_clt_path(con->c.path); =20 - WARN_ON((sess->flags & RTRS_MSG_NEW_RKEY_F) =3D=3D 0); + WARN_ON((clt_path->flags & RTRS_MSG_NEW_RKEY_F) =3D=3D 0); iu =3D container_of(wc->wr_cqe, struct rtrs_iu, cqe); err =3D rtrs_iu_post_recv(&con->c, iu); @@ -521,7 +522,7 @@ static void rtrs_clt_recv_done(struct rtrs_clt_con *con= , struct ib_wc *wc) =20 static void rtrs_clt_rkey_rsp_done(struct rtrs_clt_con *con, struct ib_wc = *wc) { - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); + struct rtrs_clt_path *clt_path =3D to_clt_path(con->c.path); struct rtrs_msg_rkey_rsp *msg; u32 imm_type, imm_payload; bool w_inval =3D false; @@ -529,7 +530,7 @@ static void rtrs_clt_rkey_rsp_done(struct rtrs_clt_con = *con, struct ib_wc *wc) u32 buf_id; int err; =20 - WARN_ON((sess->flags & RTRS_MSG_NEW_RKEY_F) =3D=3D 0); + WARN_ON((clt_path->flags & RTRS_MSG_NEW_RKEY_F) =3D=3D 0); =20 iu =3D container_of(wc->wr_cqe, struct rtrs_iu, cqe); =20 @@ -538,16 +539,17 @@ static void rtrs_clt_rkey_rsp_done(struct rtrs_clt_co= n *con, struct ib_wc *wc) wc->byte_len); goto out; } - ib_dma_sync_single_for_cpu(sess->s.dev->ib_dev, iu->dma_addr, + ib_dma_sync_single_for_cpu(clt_path->s.dev->ib_dev, iu->dma_addr, iu->size, DMA_FROM_DEVICE); msg =3D iu->buf; if (le16_to_cpu(msg->type) !=3D RTRS_MSG_RKEY_RSP) { - rtrs_err(sess->clt, "rkey response is malformed: type %d\n", + rtrs_err(clt_path->clt, + "rkey response is malformed: type %d\n", le16_to_cpu(msg->type)); goto out; } buf_id =3D le16_to_cpu(msg->buf_id); - if (WARN_ON(buf_id >=3D sess->queue_depth)) + if (WARN_ON(buf_id >=3D clt_path->queue_depth)) goto out; =20 rtrs_from_imm(be32_to_cpu(wc->ex.imm_data), &imm_type, &imm_payload); @@ -560,10 +562,10 @@ static void rtrs_clt_rkey_rsp_done(struct rtrs_clt_co= n *con, struct ib_wc *wc) =20 if (WARN_ON(buf_id !=3D msg_id)) goto out; - sess->rbufs[buf_id].rkey =3D le32_to_cpu(msg->rkey); - process_io_rsp(sess, msg_id, err, w_inval); + clt_path->rbufs[buf_id].rkey =3D le32_to_cpu(msg->rkey); + process_io_rsp(clt_path, msg_id, err, w_inval); } - ib_dma_sync_single_for_device(sess->s.dev->ib_dev, iu->dma_addr, + ib_dma_sync_single_for_device(clt_path->s.dev->ib_dev, iu->dma_addr, iu->size, DMA_FROM_DEVICE); return rtrs_clt_recv_done(con, wc); out: @@ -600,14 +602,14 @@ static int rtrs_post_recv_empty_x2(struct rtrs_con *c= on, struct ib_cqe *cqe) static void rtrs_clt_rdma_done(struct ib_cq *cq, struct ib_wc *wc) { struct rtrs_clt_con *con =3D to_clt_con(wc->qp->qp_context); - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); + struct rtrs_clt_path *clt_path =3D to_clt_path(con->c.path); u32 imm_type, imm_payload; bool w_inval =3D false; int err; =20 if (wc->status !=3D IB_WC_SUCCESS) { if (wc->status !=3D IB_WC_WR_FLUSH_ERR) { - rtrs_err(sess->clt, "RDMA failed: %s\n", + rtrs_err(clt_path->clt, "RDMA failed: %s\n", ib_wc_status_msg(wc->status)); rtrs_rdma_error_recovery(con); } @@ -632,18 +634,18 @@ static void rtrs_clt_rdma_done(struct ib_cq *cq, stru= ct ib_wc *wc) w_inval =3D (imm_type =3D=3D RTRS_IO_RSP_W_INV_IMM); rtrs_from_io_rsp_imm(imm_payload, &msg_id, &err); =20 - process_io_rsp(sess, msg_id, err, w_inval); + process_io_rsp(clt_path, msg_id, err, w_inval); } else if (imm_type =3D=3D RTRS_HB_MSG_IMM) { WARN_ON(con->c.cid); - rtrs_send_hb_ack(&sess->s); - if (sess->flags & RTRS_MSG_NEW_RKEY_F) + rtrs_send_hb_ack(&clt_path->s); + if (clt_path->flags & RTRS_MSG_NEW_RKEY_F) return rtrs_clt_recv_done(con, wc); } else if (imm_type =3D=3D RTRS_HB_ACK_IMM) { WARN_ON(con->c.cid); - sess->s.hb_missed_cnt =3D 0; - sess->s.hb_cur_latency =3D - ktime_sub(ktime_get(), sess->s.hb_last_sent); - if (sess->flags & RTRS_MSG_NEW_RKEY_F) + clt_path->s.hb_missed_cnt =3D 0; + clt_path->s.hb_cur_latency =3D + ktime_sub(ktime_get(), clt_path->s.hb_last_sent); + if (clt_path->flags & RTRS_MSG_NEW_RKEY_F) return rtrs_clt_recv_done(con, wc); } else { rtrs_wrn(con->c.path, "Unknown IMM type %u\n", @@ -670,7 +672,7 @@ static void rtrs_clt_rdma_done(struct ib_cq *cq, struct= ib_wc *wc) WARN_ON(!(wc->wc_flags & IB_WC_WITH_INVALIDATE || wc->wc_flags & IB_WC_WITH_IMM)); WARN_ON(wc->wr_cqe->done !=3D rtrs_clt_rdma_done); - if (sess->flags & RTRS_MSG_NEW_RKEY_F) { + if (clt_path->flags & RTRS_MSG_NEW_RKEY_F) { if (wc->wc_flags & IB_WC_WITH_INVALIDATE) return rtrs_clt_recv_done(con, wc); =20 @@ -685,7 +687,7 @@ static void rtrs_clt_rdma_done(struct ib_cq *cq, struct= ib_wc *wc) break; =20 default: - rtrs_wrn(sess->clt, "Unexpected WC type: %d\n", wc->opcode); + rtrs_wrn(clt_path->clt, "Unexpected WC type: %d\n", wc->opcode); return; } } @@ -693,10 +695,10 @@ static void rtrs_clt_rdma_done(struct ib_cq *cq, stru= ct ib_wc *wc) static int post_recv_io(struct rtrs_clt_con *con, size_t q_size) { int err, i; - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); + struct rtrs_clt_path *clt_path =3D to_clt_path(con->c.path); =20 for (i =3D 0; i < q_size; i++) { - if (sess->flags & RTRS_MSG_NEW_RKEY_F) { + if (clt_path->flags & RTRS_MSG_NEW_RKEY_F) { struct rtrs_iu *iu =3D &con->rsp_ius[i]; =20 err =3D rtrs_iu_post_recv(&con->c, iu); @@ -710,16 +712,16 @@ static int post_recv_io(struct rtrs_clt_con *con, siz= e_t q_size) return 0; } =20 -static int post_recv_sess(struct rtrs_clt_sess *sess) +static int post_recv_path(struct rtrs_clt_path *clt_path) { size_t q_size =3D 0; int err, cid; =20 - for (cid =3D 0; cid < sess->s.con_num; cid++) { + for (cid =3D 0; cid < clt_path->s.con_num; cid++) { if (cid =3D=3D 0) q_size =3D SERVICE_CON_QUEUE_DEPTH; else - q_size =3D sess->queue_depth; + q_size =3D clt_path->queue_depth; =20 /* * x2 for RDMA read responses + FR key invalidations, @@ -727,9 +729,10 @@ static int post_recv_sess(struct rtrs_clt_sess *sess) */ q_size *=3D 2; =20 - err =3D post_recv_io(to_clt_con(sess->s.con[cid]), q_size); + err =3D post_recv_io(to_clt_con(clt_path->s.con[cid]), q_size); if (err) { - rtrs_err(sess->clt, "post_recv_io(), err: %d\n", err); + rtrs_err(clt_path->clt, "post_recv_io(), err: %d\n", + err); return err; } } @@ -741,7 +744,7 @@ struct path_it { int i; struct list_head skip_list; struct rtrs_clt *clt; - struct rtrs_clt_sess *(*next_path)(struct path_it *it); + struct rtrs_clt_path *(*next_path)(struct path_it *it); }; =20 /** @@ -773,10 +776,10 @@ struct path_it { * Locks: * rcu_read_lock() must be hold. */ -static struct rtrs_clt_sess *get_next_path_rr(struct path_it *it) +static struct rtrs_clt_path *get_next_path_rr(struct path_it *it) { - struct rtrs_clt_sess __rcu **ppcpu_path; - struct rtrs_clt_sess *path; + struct rtrs_clt_path __rcu **ppcpu_path; + struct rtrs_clt_path *path; struct rtrs_clt *clt; =20 clt =3D it->clt; @@ -811,26 +814,26 @@ static struct rtrs_clt_sess *get_next_path_rr(struct = path_it *it) * Locks: * rcu_read_lock() must be hold. */ -static struct rtrs_clt_sess *get_next_path_min_inflight(struct path_it *it) +static struct rtrs_clt_path *get_next_path_min_inflight(struct path_it *it) { - struct rtrs_clt_sess *min_path =3D NULL; + struct rtrs_clt_path *min_path =3D NULL; struct rtrs_clt *clt =3D it->clt; - struct rtrs_clt_sess *sess; + struct rtrs_clt_path *clt_path; int min_inflight =3D INT_MAX; int inflight; =20 - list_for_each_entry_rcu(sess, &clt->paths_list, s.entry) { - if (READ_ONCE(sess->state) !=3D RTRS_CLT_CONNECTED) + list_for_each_entry_rcu(clt_path, &clt->paths_list, s.entry) { + if (READ_ONCE(clt_path->state) !=3D RTRS_CLT_CONNECTED) continue; =20 - if (!list_empty(raw_cpu_ptr(sess->mp_skip_entry))) + if (!list_empty(raw_cpu_ptr(clt_path->mp_skip_entry))) continue; =20 - inflight =3D atomic_read(&sess->stats->inflight); + inflight =3D atomic_read(&clt_path->stats->inflight); =20 if (inflight < min_inflight) { min_inflight =3D inflight; - min_path =3D sess; + min_path =3D clt_path; } } =20 @@ -862,26 +865,26 @@ static struct rtrs_clt_sess *get_next_path_min_inflig= ht(struct path_it *it) * Therefore the caller MUST check the returned * path is NULL and trigger the IO error. */ -static struct rtrs_clt_sess *get_next_path_min_latency(struct path_it *it) +static struct rtrs_clt_path *get_next_path_min_latency(struct path_it *it) { - struct rtrs_clt_sess *min_path =3D NULL; + struct rtrs_clt_path *min_path =3D NULL; struct rtrs_clt *clt =3D it->clt; - struct rtrs_clt_sess *sess; + struct rtrs_clt_path *clt_path; ktime_t min_latency =3D KTIME_MAX; ktime_t latency; =20 - list_for_each_entry_rcu(sess, &clt->paths_list, s.entry) { - if (READ_ONCE(sess->state) !=3D RTRS_CLT_CONNECTED) + list_for_each_entry_rcu(clt_path, &clt->paths_list, s.entry) { + if (READ_ONCE(clt_path->state) !=3D RTRS_CLT_CONNECTED) continue; =20 - if (!list_empty(raw_cpu_ptr(sess->mp_skip_entry))) + if (!list_empty(raw_cpu_ptr(clt_path->mp_skip_entry))) continue; =20 - latency =3D sess->s.hb_cur_latency; + latency =3D clt_path->s.hb_cur_latency; =20 if (latency < min_latency) { min_latency =3D latency; - min_path =3D sess; + min_path =3D clt_path; } } =20 @@ -928,7 +931,7 @@ static inline void path_it_deinit(struct path_it *it) * the corresponding buffer of rtrs_iu (req->iu->buf), which later on will * also hold the control message of rtrs. * @req: an io request holding information about IO. - * @sess: client session + * @clt_path: client path * @conf: conformation callback function to notify upper layer. * @permit: permit for allocation of RDMA remote buffer * @priv: private pointer @@ -940,7 +943,7 @@ static inline void path_it_deinit(struct path_it *it) * @dir: direction of the IO. */ static void rtrs_clt_init_req(struct rtrs_clt_io_req *req, - struct rtrs_clt_sess *sess, + struct rtrs_clt_path *clt_path, void (*conf)(void *priv, int errno), struct rtrs_permit *permit, void *priv, const struct kvec *vec, size_t usr_len, @@ -958,13 +961,13 @@ static void rtrs_clt_init_req(struct rtrs_clt_io_req = *req, req->sg_cnt =3D sg_cnt; req->priv =3D priv; req->dir =3D dir; - req->con =3D rtrs_permit_to_clt_con(sess, permit); + req->con =3D rtrs_permit_to_clt_con(clt_path, permit); req->conf =3D conf; req->need_inv =3D false; req->need_inv_comp =3D false; req->inv_errno =3D 0; refcount_set(&req->ref, 1); - req->mp_policy =3D sess->clt->mp_policy; + req->mp_policy =3D clt_path->clt->mp_policy; =20 iov_iter_kvec(&iter, READ, vec, 1, usr_len); len =3D _copy_from_iter(req->iu->buf, usr_len, &iter); @@ -974,7 +977,7 @@ static void rtrs_clt_init_req(struct rtrs_clt_io_req *r= eq, } =20 static struct rtrs_clt_io_req * -rtrs_clt_get_req(struct rtrs_clt_sess *sess, +rtrs_clt_get_req(struct rtrs_clt_path *clt_path, void (*conf)(void *priv, int errno), struct rtrs_permit *permit, void *priv, const struct kvec *vec, size_t usr_len, @@ -983,14 +986,14 @@ rtrs_clt_get_req(struct rtrs_clt_sess *sess, { struct rtrs_clt_io_req *req; =20 - req =3D &sess->reqs[permit->mem_id]; - rtrs_clt_init_req(req, sess, conf, permit, priv, vec, usr_len, + req =3D &clt_path->reqs[permit->mem_id]; + rtrs_clt_init_req(req, clt_path, conf, permit, priv, vec, usr_len, sg, sg_cnt, data_len, dir); return req; } =20 static struct rtrs_clt_io_req * -rtrs_clt_get_copy_req(struct rtrs_clt_sess *alive_sess, +rtrs_clt_get_copy_req(struct rtrs_clt_path *alive_path, struct rtrs_clt_io_req *fail_req) { struct rtrs_clt_io_req *req; @@ -999,8 +1002,8 @@ rtrs_clt_get_copy_req(struct rtrs_clt_sess *alive_sess, .iov_len =3D fail_req->usr_len }; =20 - req =3D &alive_sess->reqs[fail_req->permit->mem_id]; - rtrs_clt_init_req(req, alive_sess, fail_req->conf, fail_req->permit, + req =3D &alive_path->reqs[fail_req->permit->mem_id]; + rtrs_clt_init_req(req, alive_path, fail_req->conf, fail_req->permit, fail_req->priv, &vec, fail_req->usr_len, fail_req->sglist, fail_req->sg_cnt, fail_req->data_len, fail_req->dir); @@ -1013,7 +1016,7 @@ static int rtrs_post_rdma_write_sg(struct rtrs_clt_co= n *con, u32 size, u32 imm, struct ib_send_wr *wr, struct ib_send_wr *tail) { - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); + struct rtrs_clt_path *clt_path =3D to_clt_path(con->c.path); struct ib_sge *sge =3D req->sge; enum ib_send_flags flags; struct scatterlist *sg; @@ -1033,22 +1036,23 @@ static int rtrs_post_rdma_write_sg(struct rtrs_clt_= con *con, for_each_sg(req->sglist, sg, req->sg_cnt, i) { sge[i].addr =3D sg_dma_address(sg); sge[i].length =3D sg_dma_len(sg); - sge[i].lkey =3D sess->s.dev->ib_pd->local_dma_lkey; + sge[i].lkey =3D clt_path->s.dev->ib_pd->local_dma_lkey; } num_sge =3D 1 + req->sg_cnt; } sge[i].addr =3D req->iu->dma_addr; sge[i].length =3D size; - sge[i].lkey =3D sess->s.dev->ib_pd->local_dma_lkey; + sge[i].lkey =3D clt_path->s.dev->ib_pd->local_dma_lkey; =20 /* * From time to time we have to post signalled sends, * or send queue will fill up and only QP reset can help. */ - flags =3D atomic_inc_return(&con->c.wr_cnt) % sess->s.signal_interval ? + flags =3D atomic_inc_return(&con->c.wr_cnt) % clt_path->s.signal_interval= ? 0 : IB_SEND_SIGNALED; =20 - ib_dma_sync_single_for_device(sess->s.dev->ib_dev, req->iu->dma_addr, + ib_dma_sync_single_for_device(clt_path->s.dev->ib_dev, + req->iu->dma_addr, size, DMA_TO_DEVICE); =20 return rtrs_iu_post_rdma_write_imm(&con->c, req->iu, sge, num_sge, @@ -1075,7 +1079,7 @@ static int rtrs_clt_write_req(struct rtrs_clt_io_req = *req) { struct rtrs_clt_con *con =3D req->con; struct rtrs_path *s =3D con->c.path; - struct rtrs_clt_sess *sess =3D to_clt_sess(s); + struct rtrs_clt_path *clt_path =3D to_clt_path(s); struct rtrs_msg_rdma_write *msg; =20 struct rtrs_rbuf *rbuf; @@ -1088,13 +1092,13 @@ static int rtrs_clt_write_req(struct rtrs_clt_io_re= q *req) =20 const size_t tsize =3D sizeof(*msg) + req->data_len + req->usr_len; =20 - if (tsize > sess->chunk_size) { + if (tsize > clt_path->chunk_size) { rtrs_wrn(s, "Write request failed, size too big %zu > %d\n", - tsize, sess->chunk_size); + tsize, clt_path->chunk_size); return -EMSGSIZE; } if (req->sg_cnt) { - count =3D ib_dma_map_sg(sess->s.dev->ib_dev, req->sglist, + count =3D ib_dma_map_sg(clt_path->s.dev->ib_dev, req->sglist, req->sg_cnt, req->dir); if (!count) { rtrs_wrn(s, "Write request failed, map failed\n"); @@ -1111,7 +1115,7 @@ static int rtrs_clt_write_req(struct rtrs_clt_io_req = *req) imm =3D rtrs_to_io_req_imm(imm); buf_id =3D req->permit->mem_id; req->sg_size =3D tsize; - rbuf =3D &sess->rbufs[buf_id]; + rbuf =3D &clt_path->rbufs[buf_id]; =20 if (count) { ret =3D rtrs_map_sg_fr(req, count); @@ -1119,7 +1123,7 @@ static int rtrs_clt_write_req(struct rtrs_clt_io_req = *req) rtrs_err_rl(s, "Write request failed, failed to map fast reg. data, err: %d\n", ret); - ib_dma_unmap_sg(sess->s.dev->ib_dev, req->sglist, + ib_dma_unmap_sg(clt_path->s.dev->ib_dev, req->sglist, req->sg_cnt, req->dir); return ret; } @@ -1153,12 +1157,12 @@ static int rtrs_clt_write_req(struct rtrs_clt_io_re= q *req) if (ret) { rtrs_err_rl(s, "Write request failed: error=3D%d path=3D%s [%s:%u]\n", - ret, kobject_name(&sess->kobj), sess->hca_name, - sess->hca_port); + ret, kobject_name(&clt_path->kobj), clt_path->hca_name, + clt_path->hca_port); if (req->mp_policy =3D=3D MP_POLICY_MIN_INFLIGHT) - atomic_dec(&sess->stats->inflight); + atomic_dec(&clt_path->stats->inflight); if (req->sg_cnt) - ib_dma_unmap_sg(sess->s.dev->ib_dev, req->sglist, + ib_dma_unmap_sg(clt_path->s.dev->ib_dev, req->sglist, req->sg_cnt, req->dir); } =20 @@ -1169,9 +1173,9 @@ static int rtrs_clt_read_req(struct rtrs_clt_io_req *= req) { struct rtrs_clt_con *con =3D req->con; struct rtrs_path *s =3D con->c.path; - struct rtrs_clt_sess *sess =3D to_clt_sess(s); + struct rtrs_clt_path *clt_path =3D to_clt_path(s); struct rtrs_msg_rdma_read *msg; - struct rtrs_ib_dev *dev =3D sess->s.dev; + struct rtrs_ib_dev *dev =3D clt_path->s.dev; =20 struct ib_reg_wr rwr; struct ib_send_wr *wr =3D NULL; @@ -1181,10 +1185,10 @@ static int rtrs_clt_read_req(struct rtrs_clt_io_req= *req) =20 const size_t tsize =3D sizeof(*msg) + req->data_len + req->usr_len; =20 - if (tsize > sess->chunk_size) { + if (tsize > clt_path->chunk_size) { rtrs_wrn(s, "Read request failed, message size is %zu, bigger than CHUNK_SIZE %d\= n", - tsize, sess->chunk_size); + tsize, clt_path->chunk_size); return -EMSGSIZE; } =20 @@ -1254,15 +1258,15 @@ static int rtrs_clt_read_req(struct rtrs_clt_io_req= *req) */ rtrs_clt_update_all_stats(req, READ); =20 - ret =3D rtrs_post_send_rdma(req->con, req, &sess->rbufs[buf_id], + ret =3D rtrs_post_send_rdma(req->con, req, &clt_path->rbufs[buf_id], req->data_len, imm, wr); if (ret) { rtrs_err_rl(s, "Read request failed: error=3D%d path=3D%s [%s:%u]\n", - ret, kobject_name(&sess->kobj), sess->hca_name, - sess->hca_port); + ret, kobject_name(&clt_path->kobj), clt_path->hca_name, + clt_path->hca_port); if (req->mp_policy =3D=3D MP_POLICY_MIN_INFLIGHT) - atomic_dec(&sess->stats->inflight); + atomic_dec(&clt_path->stats->inflight); req->need_inv =3D false; if (req->sg_cnt) ib_dma_unmap_sg(dev->ib_dev, req->sglist, @@ -1280,18 +1284,18 @@ static int rtrs_clt_read_req(struct rtrs_clt_io_req= *req) static int rtrs_clt_failover_req(struct rtrs_clt *clt, struct rtrs_clt_io_req *fail_req) { - struct rtrs_clt_sess *alive_sess; + struct rtrs_clt_path *alive_path; struct rtrs_clt_io_req *req; int err =3D -ECONNABORTED; struct path_it it; =20 rcu_read_lock(); for (path_it_init(&it, clt); - (alive_sess =3D it.next_path(&it)) && it.i < it.clt->paths_num; + (alive_path =3D it.next_path(&it)) && it.i < it.clt->paths_num; it.i++) { - if (READ_ONCE(alive_sess->state) !=3D RTRS_CLT_CONNECTED) + if (READ_ONCE(alive_path->state) !=3D RTRS_CLT_CONNECTED) continue; - req =3D rtrs_clt_get_copy_req(alive_sess, fail_req); + req =3D rtrs_clt_get_copy_req(alive_path, fail_req); if (req->dir =3D=3D DMA_TO_DEVICE) err =3D rtrs_clt_write_req(req); else @@ -1301,7 +1305,7 @@ static int rtrs_clt_failover_req(struct rtrs_clt *clt, continue; } /* Success path */ - rtrs_clt_inc_failover_cnt(alive_sess->stats); + rtrs_clt_inc_failover_cnt(alive_path->stats); break; } path_it_deinit(&it); @@ -1310,16 +1314,16 @@ static int rtrs_clt_failover_req(struct rtrs_clt *c= lt, return err; } =20 -static void fail_all_outstanding_reqs(struct rtrs_clt_sess *sess) +static void fail_all_outstanding_reqs(struct rtrs_clt_path *clt_path) { - struct rtrs_clt *clt =3D sess->clt; + struct rtrs_clt *clt =3D clt_path->clt; struct rtrs_clt_io_req *req; int i, err; =20 - if (!sess->reqs) + if (!clt_path->reqs) return; - for (i =3D 0; i < sess->queue_depth; ++i) { - req =3D &sess->reqs[i]; + for (i =3D 0; i < clt_path->queue_depth; ++i) { + req =3D &clt_path->reqs[i]; if (!req->in_use) continue; =20 @@ -1337,38 +1341,39 @@ static void fail_all_outstanding_reqs(struct rtrs_c= lt_sess *sess) } } =20 -static void free_sess_reqs(struct rtrs_clt_sess *sess) +static void free_path_reqs(struct rtrs_clt_path *clt_path) { struct rtrs_clt_io_req *req; int i; =20 - if (!sess->reqs) + if (!clt_path->reqs) return; - for (i =3D 0; i < sess->queue_depth; ++i) { - req =3D &sess->reqs[i]; + for (i =3D 0; i < clt_path->queue_depth; ++i) { + req =3D &clt_path->reqs[i]; if (req->mr) ib_dereg_mr(req->mr); kfree(req->sge); - rtrs_iu_free(req->iu, sess->s.dev->ib_dev, 1); + rtrs_iu_free(req->iu, clt_path->s.dev->ib_dev, 1); } - kfree(sess->reqs); - sess->reqs =3D NULL; + kfree(clt_path->reqs); + clt_path->reqs =3D NULL; } =20 -static int alloc_sess_reqs(struct rtrs_clt_sess *sess) +static int alloc_path_reqs(struct rtrs_clt_path *clt_path) { struct rtrs_clt_io_req *req; int i, err =3D -ENOMEM; =20 - sess->reqs =3D kcalloc(sess->queue_depth, sizeof(*sess->reqs), - GFP_KERNEL); - if (!sess->reqs) + clt_path->reqs =3D kcalloc(clt_path->queue_depth, + sizeof(*clt_path->reqs), + GFP_KERNEL); + if (!clt_path->reqs) return -ENOMEM; =20 - for (i =3D 0; i < sess->queue_depth; ++i) { - req =3D &sess->reqs[i]; - req->iu =3D rtrs_iu_alloc(1, sess->max_hdr_size, GFP_KERNEL, - sess->s.dev->ib_dev, + for (i =3D 0; i < clt_path->queue_depth; ++i) { + req =3D &clt_path->reqs[i]; + req->iu =3D rtrs_iu_alloc(1, clt_path->max_hdr_size, GFP_KERNEL, + clt_path->s.dev->ib_dev, DMA_TO_DEVICE, rtrs_clt_rdma_done); if (!req->iu) @@ -1378,13 +1383,14 @@ static int alloc_sess_reqs(struct rtrs_clt_sess *se= ss) if (!req->sge) goto out; =20 - req->mr =3D ib_alloc_mr(sess->s.dev->ib_pd, IB_MR_TYPE_MEM_REG, - sess->max_pages_per_mr); + req->mr =3D ib_alloc_mr(clt_path->s.dev->ib_pd, + IB_MR_TYPE_MEM_REG, + clt_path->max_pages_per_mr); if (IS_ERR(req->mr)) { err =3D PTR_ERR(req->mr); req->mr =3D NULL; - pr_err("Failed to alloc sess->max_pages_per_mr %d\n", - sess->max_pages_per_mr); + pr_err("Failed to alloc clt_path->max_pages_per_mr %d\n", + clt_path->max_pages_per_mr); goto out; } =20 @@ -1394,7 +1400,7 @@ static int alloc_sess_reqs(struct rtrs_clt_sess *sess) return 0; =20 out: - free_sess_reqs(sess); + free_path_reqs(clt_path); =20 return err; } @@ -1447,13 +1453,13 @@ static void free_permits(struct rtrs_clt *clt) clt->permits =3D NULL; } =20 -static void query_fast_reg_mode(struct rtrs_clt_sess *sess) +static void query_fast_reg_mode(struct rtrs_clt_path *clt_path) { struct ib_device *ib_dev; u64 max_pages_per_mr; int mr_page_shift; =20 - ib_dev =3D sess->s.dev->ib_dev; + ib_dev =3D clt_path->s.dev->ib_dev; =20 /* * Use the smallest page size supported by the HCA, down to a @@ -1463,24 +1469,24 @@ static void query_fast_reg_mode(struct rtrs_clt_ses= s *sess) mr_page_shift =3D max(12, ffs(ib_dev->attrs.page_size_cap) - 1); max_pages_per_mr =3D ib_dev->attrs.max_mr_size; do_div(max_pages_per_mr, (1ull << mr_page_shift)); - sess->max_pages_per_mr =3D - min3(sess->max_pages_per_mr, (u32)max_pages_per_mr, + clt_path->max_pages_per_mr =3D + min3(clt_path->max_pages_per_mr, (u32)max_pages_per_mr, ib_dev->attrs.max_fast_reg_page_list_len); - sess->clt->max_segments =3D - min(sess->max_pages_per_mr, sess->clt->max_segments); + clt_path->clt->max_segments =3D + min(clt_path->max_pages_per_mr, clt_path->clt->max_segments); } =20 -static bool rtrs_clt_change_state_get_old(struct rtrs_clt_sess *sess, +static bool rtrs_clt_change_state_get_old(struct rtrs_clt_path *clt_path, enum rtrs_clt_state new_state, enum rtrs_clt_state *old_state) { bool changed; =20 - spin_lock_irq(&sess->state_wq.lock); + spin_lock_irq(&clt_path->state_wq.lock); if (old_state) - *old_state =3D sess->state; - changed =3D rtrs_clt_change_state(sess, new_state); - spin_unlock_irq(&sess->state_wq.lock); + *old_state =3D clt_path->state; + changed =3D rtrs_clt_change_state(clt_path, new_state); + spin_unlock_irq(&clt_path->state_wq.lock); =20 return changed; } @@ -1492,9 +1498,9 @@ static void rtrs_clt_hb_err_handler(struct rtrs_con *= c) rtrs_rdma_error_recovery(con); } =20 -static void rtrs_clt_init_hb(struct rtrs_clt_sess *sess) +static void rtrs_clt_init_hb(struct rtrs_clt_path *clt_path) { - rtrs_init_hb(&sess->s, &io_comp_cqe, + rtrs_init_hb(&clt_path->s, &io_comp_cqe, RTRS_HB_INTERVAL_MS, RTRS_HB_MISSED_MAX, rtrs_clt_hb_err_handler, @@ -1504,17 +1510,17 @@ static void rtrs_clt_init_hb(struct rtrs_clt_sess *= sess) static void rtrs_clt_reconnect_work(struct work_struct *work); static void rtrs_clt_close_work(struct work_struct *work); =20 -static struct rtrs_clt_sess *alloc_sess(struct rtrs_clt *clt, +static struct rtrs_clt_path *alloc_path(struct rtrs_clt *clt, const struct rtrs_addr *path, size_t con_num, u32 nr_poll_queues) { - struct rtrs_clt_sess *sess; + struct rtrs_clt_path *clt_path; int err =3D -ENOMEM; int cpu; size_t total_con; =20 - sess =3D kzalloc(sizeof(*sess), GFP_KERNEL); - if (!sess) + clt_path =3D kzalloc(sizeof(*clt_path), GFP_KERNEL); + if (!clt_path) goto err; =20 /* @@ -1522,20 +1528,21 @@ static struct rtrs_clt_sess *alloc_sess(struct rtrs= _clt *clt, * +1: Extra connection for user messages */ total_con =3D con_num + nr_poll_queues + 1; - sess->s.con =3D kcalloc(total_con, sizeof(*sess->s.con), GFP_KERNEL); - if (!sess->s.con) - goto err_free_sess; + clt_path->s.con =3D kcalloc(total_con, sizeof(*clt_path->s.con), + GFP_KERNEL); + if (!clt_path->s.con) + goto err_free_path; =20 - sess->s.con_num =3D total_con; - sess->s.irq_con_num =3D con_num + 1; + clt_path->s.con_num =3D total_con; + clt_path->s.irq_con_num =3D con_num + 1; =20 - sess->stats =3D kzalloc(sizeof(*sess->stats), GFP_KERNEL); - if (!sess->stats) + clt_path->stats =3D kzalloc(sizeof(*clt_path->stats), GFP_KERNEL); + if (!clt_path->stats) goto err_free_con; =20 - mutex_init(&sess->init_mutex); - uuid_gen(&sess->s.uuid); - memcpy(&sess->s.dst_addr, path->dst, + mutex_init(&clt_path->init_mutex); + uuid_gen(&clt_path->s.uuid); + memcpy(&clt_path->s.dst_addr, path->dst, rdma_addr_size((struct sockaddr *)path->dst)); =20 /* @@ -1544,53 +1551,54 @@ static struct rtrs_clt_sess *alloc_sess(struct rtrs= _clt *clt, * the sess->src_addr will contain only zeros, which is then fine. */ if (path->src) - memcpy(&sess->s.src_addr, path->src, + memcpy(&clt_path->s.src_addr, path->src, rdma_addr_size((struct sockaddr *)path->src)); - strscpy(sess->s.sessname, clt->sessname, sizeof(sess->s.sessname)); - sess->clt =3D clt; - sess->max_pages_per_mr =3D RTRS_MAX_SEGMENTS; - init_waitqueue_head(&sess->state_wq); - sess->state =3D RTRS_CLT_CONNECTING; - atomic_set(&sess->connected_cnt, 0); - INIT_WORK(&sess->close_work, rtrs_clt_close_work); - INIT_DELAYED_WORK(&sess->reconnect_dwork, rtrs_clt_reconnect_work); - rtrs_clt_init_hb(sess); - - sess->mp_skip_entry =3D alloc_percpu(typeof(*sess->mp_skip_entry)); - if (!sess->mp_skip_entry) + strscpy(clt_path->s.sessname, clt->sessname, + sizeof(clt_path->s.sessname)); + clt_path->clt =3D clt; + clt_path->max_pages_per_mr =3D RTRS_MAX_SEGMENTS; + init_waitqueue_head(&clt_path->state_wq); + clt_path->state =3D RTRS_CLT_CONNECTING; + atomic_set(&clt_path->connected_cnt, 0); + INIT_WORK(&clt_path->close_work, rtrs_clt_close_work); + INIT_DELAYED_WORK(&clt_path->reconnect_dwork, rtrs_clt_reconnect_work); + rtrs_clt_init_hb(clt_path); + + clt_path->mp_skip_entry =3D alloc_percpu(typeof(*clt_path->mp_skip_entry)= ); + if (!clt_path->mp_skip_entry) goto err_free_stats; =20 for_each_possible_cpu(cpu) - INIT_LIST_HEAD(per_cpu_ptr(sess->mp_skip_entry, cpu)); + INIT_LIST_HEAD(per_cpu_ptr(clt_path->mp_skip_entry, cpu)); =20 - err =3D rtrs_clt_init_stats(sess->stats); + err =3D rtrs_clt_init_stats(clt_path->stats); if (err) goto err_free_percpu; =20 - return sess; + return clt_path; =20 err_free_percpu: - free_percpu(sess->mp_skip_entry); + free_percpu(clt_path->mp_skip_entry); err_free_stats: - kfree(sess->stats); + kfree(clt_path->stats); err_free_con: - kfree(sess->s.con); -err_free_sess: - kfree(sess); + kfree(clt_path->s.con); +err_free_path: + kfree(clt_path); err: return ERR_PTR(err); } =20 -void free_sess(struct rtrs_clt_sess *sess) +void free_path(struct rtrs_clt_path *clt_path) { - free_percpu(sess->mp_skip_entry); - mutex_destroy(&sess->init_mutex); - kfree(sess->s.con); - kfree(sess->rbufs); - kfree(sess); + free_percpu(clt_path->mp_skip_entry); + mutex_destroy(&clt_path->init_mutex); + kfree(clt_path->s.con); + kfree(clt_path->rbufs); + kfree(clt_path); } =20 -static int create_con(struct rtrs_clt_sess *sess, unsigned int cid) +static int create_con(struct rtrs_clt_path *clt_path, unsigned int cid) { struct rtrs_clt_con *con; =20 @@ -1601,28 +1609,28 @@ static int create_con(struct rtrs_clt_sess *sess, u= nsigned int cid) /* Map first two connections to the first CPU */ con->cpu =3D (cid ? cid - 1 : 0) % nr_cpu_ids; con->c.cid =3D cid; - con->c.path =3D &sess->s; + con->c.path =3D &clt_path->s; /* Align with srv, init as 1 */ atomic_set(&con->c.wr_cnt, 1); mutex_init(&con->con_mutex); =20 - sess->s.con[cid] =3D &con->c; + clt_path->s.con[cid] =3D &con->c; =20 return 0; } =20 static void destroy_con(struct rtrs_clt_con *con) { - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); + struct rtrs_clt_path *clt_path =3D to_clt_path(con->c.path); =20 - sess->s.con[con->c.cid] =3D NULL; + clt_path->s.con[con->c.cid] =3D NULL; mutex_destroy(&con->con_mutex); kfree(con); } =20 static int create_con_cq_qp(struct rtrs_clt_con *con) { - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); + struct rtrs_clt_path *clt_path =3D to_clt_path(con->c.path); u32 max_send_wr, max_recv_wr, cq_num, max_send_sge, wr_limit; int err, cq_vector; struct rtrs_msg_rkey_rsp *rsp; @@ -1631,7 +1639,7 @@ static int create_con_cq_qp(struct rtrs_clt_con *con) if (con->c.cid =3D=3D 0) { max_send_sge =3D 1; /* We must be the first here */ - if (WARN_ON(sess->s.dev)) + if (WARN_ON(clt_path->s.dev)) return -EINVAL; =20 /* @@ -1639,16 +1647,16 @@ static int create_con_cq_qp(struct rtrs_clt_con *co= n) * Be careful not to close user connection before ib dev * is gracefully put. */ - sess->s.dev =3D rtrs_ib_dev_find_or_add(con->c.cm_id->device, + clt_path->s.dev =3D rtrs_ib_dev_find_or_add(con->c.cm_id->device, &dev_pd); - if (!sess->s.dev) { - rtrs_wrn(sess->clt, + if (!clt_path->s.dev) { + rtrs_wrn(clt_path->clt, "rtrs_ib_dev_find_get_or_add(): no memory\n"); return -ENOMEM; } - sess->s.dev_ref =3D 1; - query_fast_reg_mode(sess); - wr_limit =3D sess->s.dev->ib_dev->attrs.max_qp_wr; + clt_path->s.dev_ref =3D 1; + query_fast_reg_mode(clt_path); + wr_limit =3D clt_path->s.dev->ib_dev->attrs.max_qp_wr; /* * Two (request + registration) completion for send * Two for recv if always_invalidate is set on server @@ -1665,27 +1673,28 @@ static int create_con_cq_qp(struct rtrs_clt_con *co= n) * This is always true if user connection (cid =3D=3D 0) is * established first. */ - if (WARN_ON(!sess->s.dev)) + if (WARN_ON(!clt_path->s.dev)) return -EINVAL; - if (WARN_ON(!sess->queue_depth)) + if (WARN_ON(!clt_path->queue_depth)) return -EINVAL; =20 - wr_limit =3D sess->s.dev->ib_dev->attrs.max_qp_wr; + wr_limit =3D clt_path->s.dev->ib_dev->attrs.max_qp_wr; /* Shared between connections */ - sess->s.dev_ref++; + clt_path->s.dev_ref++; max_send_wr =3D min_t(int, wr_limit, /* QD * (REQ + RSP + FR REGS or INVS) + drain */ - sess->queue_depth * 3 + 1); + clt_path->queue_depth * 3 + 1); max_recv_wr =3D min_t(int, wr_limit, - sess->queue_depth * 3 + 1); + clt_path->queue_depth * 3 + 1); max_send_sge =3D 2; } atomic_set(&con->c.sq_wr_avail, max_send_wr); cq_num =3D max_send_wr + max_recv_wr; /* alloc iu to recv new rkey reply when server reports flags set */ - if (sess->flags & RTRS_MSG_NEW_RKEY_F || con->c.cid =3D=3D 0) { + if (clt_path->flags & RTRS_MSG_NEW_RKEY_F || con->c.cid =3D=3D 0) { con->rsp_ius =3D rtrs_iu_alloc(cq_num, sizeof(*rsp), - GFP_KERNEL, sess->s.dev->ib_dev, + GFP_KERNEL, + clt_path->s.dev->ib_dev, DMA_FROM_DEVICE, rtrs_clt_rdma_done); if (!con->rsp_ius) @@ -1693,13 +1702,13 @@ static int create_con_cq_qp(struct rtrs_clt_con *co= n) con->queue_num =3D cq_num; } cq_num =3D max_send_wr + max_recv_wr; - cq_vector =3D con->cpu % sess->s.dev->ib_dev->num_comp_vectors; - if (con->c.cid >=3D sess->s.irq_con_num) - err =3D rtrs_cq_qp_create(&sess->s, &con->c, max_send_sge, + cq_vector =3D con->cpu % clt_path->s.dev->ib_dev->num_comp_vectors; + if (con->c.cid >=3D clt_path->s.irq_con_num) + err =3D rtrs_cq_qp_create(&clt_path->s, &con->c, max_send_sge, cq_vector, cq_num, max_send_wr, max_recv_wr, IB_POLL_DIRECT); else - err =3D rtrs_cq_qp_create(&sess->s, &con->c, max_send_sge, + err =3D rtrs_cq_qp_create(&clt_path->s, &con->c, max_send_sge, cq_vector, cq_num, max_send_wr, max_recv_wr, IB_POLL_SOFTIRQ); /* @@ -1711,7 +1720,7 @@ static int create_con_cq_qp(struct rtrs_clt_con *con) =20 static void destroy_con_cq_qp(struct rtrs_clt_con *con) { - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); + struct rtrs_clt_path *clt_path =3D to_clt_path(con->c.path); =20 /* * Be careful here: destroy_con_cq_qp() can be called even @@ -1720,13 +1729,14 @@ static void destroy_con_cq_qp(struct rtrs_clt_con *= con) lockdep_assert_held(&con->con_mutex); rtrs_cq_qp_destroy(&con->c); if (con->rsp_ius) { - rtrs_iu_free(con->rsp_ius, sess->s.dev->ib_dev, con->queue_num); + rtrs_iu_free(con->rsp_ius, clt_path->s.dev->ib_dev, + con->queue_num); con->rsp_ius =3D NULL; con->queue_num =3D 0; } - if (sess->s.dev_ref && !--sess->s.dev_ref) { - rtrs_ib_dev_put(sess->s.dev); - sess->s.dev =3D NULL; + if (clt_path->s.dev_ref && !--clt_path->s.dev_ref) { + rtrs_ib_dev_put(clt_path->s.dev); + clt_path->s.dev =3D NULL; } } =20 @@ -1764,8 +1774,8 @@ static int rtrs_rdma_addr_resolved(struct rtrs_clt_co= n *con) =20 static int rtrs_rdma_route_resolved(struct rtrs_clt_con *con) { - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); - struct rtrs_clt *clt =3D sess->clt; + struct rtrs_clt_path *clt_path =3D to_clt_path(con->c.path); + struct rtrs_clt *clt =3D clt_path->clt; struct rtrs_msg_conn_req msg; struct rdma_conn_param param; =20 @@ -1782,11 +1792,11 @@ static int rtrs_rdma_route_resolved(struct rtrs_clt= _con *con) .magic =3D cpu_to_le16(RTRS_MAGIC), .version =3D cpu_to_le16(RTRS_PROTO_VER), .cid =3D cpu_to_le16(con->c.cid), - .cid_num =3D cpu_to_le16(sess->s.con_num), - .recon_cnt =3D cpu_to_le16(sess->s.recon_cnt), + .cid_num =3D cpu_to_le16(clt_path->s.con_num), + .recon_cnt =3D cpu_to_le16(clt_path->s.recon_cnt), }; - msg.first_conn =3D sess->for_new_clt ? FIRST_CONN : 0; - uuid_copy(&msg.sess_uuid, &sess->s.uuid); + msg.first_conn =3D clt_path->for_new_clt ? FIRST_CONN : 0; + uuid_copy(&msg.sess_uuid, &clt_path->s.uuid); uuid_copy(&msg.paths_uuid, &clt->paths_uuid); =20 err =3D rdma_connect_locked(con->c.cm_id, ¶m); @@ -1799,8 +1809,8 @@ static int rtrs_rdma_route_resolved(struct rtrs_clt_c= on *con) static int rtrs_rdma_conn_established(struct rtrs_clt_con *con, struct rdma_cm_event *ev) { - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); - struct rtrs_clt *clt =3D sess->clt; + struct rtrs_clt_path *clt_path =3D to_clt_path(con->c.path); + struct rtrs_clt *clt =3D clt_path->clt; const struct rtrs_msg_conn_rsp *msg; u16 version, queue_depth; int errno; @@ -1831,31 +1841,32 @@ static int rtrs_rdma_conn_established(struct rtrs_c= lt_con *con, if (con->c.cid =3D=3D 0) { queue_depth =3D le16_to_cpu(msg->queue_depth); =20 - if (sess->queue_depth > 0 && queue_depth !=3D sess->queue_depth) { + if (clt_path->queue_depth > 0 && queue_depth !=3D clt_path->queue_depth)= { rtrs_err(clt, "Error: queue depth changed\n"); =20 /* * Stop any more reconnection attempts */ - sess->reconnect_attempts =3D -1; + clt_path->reconnect_attempts =3D -1; rtrs_err(clt, "Disabling auto-reconnect. Trigger a manual reconnect after issue is r= esolved\n"); return -ECONNRESET; } =20 - if (!sess->rbufs) { - sess->rbufs =3D kcalloc(queue_depth, sizeof(*sess->rbufs), - GFP_KERNEL); - if (!sess->rbufs) + if (!clt_path->rbufs) { + clt_path->rbufs =3D kcalloc(queue_depth, + sizeof(*clt_path->rbufs), + GFP_KERNEL); + if (!clt_path->rbufs) return -ENOMEM; } - sess->queue_depth =3D queue_depth; - sess->s.signal_interval =3D min_not_zero(queue_depth, + clt_path->queue_depth =3D queue_depth; + clt_path->s.signal_interval =3D min_not_zero(queue_depth, (unsigned short) SERVICE_CON_QUEUE_DEPTH); - sess->max_hdr_size =3D le32_to_cpu(msg->max_hdr_size); - sess->max_io_size =3D le32_to_cpu(msg->max_io_size); - sess->flags =3D le32_to_cpu(msg->flags); - sess->chunk_size =3D sess->max_io_size + sess->max_hdr_size; + clt_path->max_hdr_size =3D le32_to_cpu(msg->max_hdr_size); + clt_path->max_io_size =3D le32_to_cpu(msg->max_io_size); + clt_path->flags =3D le32_to_cpu(msg->flags); + clt_path->chunk_size =3D clt_path->max_io_size + clt_path->max_hdr_size; =20 /* * Global IO size is always a minimum. @@ -1866,20 +1877,20 @@ static int rtrs_rdma_conn_established(struct rtrs_c= lt_con *con, * connections in parallel, use lock. */ mutex_lock(&clt->paths_mutex); - clt->queue_depth =3D sess->queue_depth; - clt->max_io_size =3D min_not_zero(sess->max_io_size, + clt->queue_depth =3D clt_path->queue_depth; + clt->max_io_size =3D min_not_zero(clt_path->max_io_size, clt->max_io_size); mutex_unlock(&clt->paths_mutex); =20 /* * Cache the hca_port and hca_name for sysfs */ - sess->hca_port =3D con->c.cm_id->port_num; - scnprintf(sess->hca_name, sizeof(sess->hca_name), - sess->s.dev->ib_dev->name); - sess->s.src_addr =3D con->c.cm_id->route.addr.src_addr; + clt_path->hca_port =3D con->c.cm_id->port_num; + scnprintf(clt_path->hca_name, sizeof(clt_path->hca_name), + clt_path->s.dev->ib_dev->name); + clt_path->s.src_addr =3D con->c.cm_id->route.addr.src_addr; /* set for_new_clt, to allow future reconnect on any path */ - sess->for_new_clt =3D 1; + clt_path->for_new_clt =3D 1; } =20 return 0; @@ -1887,9 +1898,9 @@ static int rtrs_rdma_conn_established(struct rtrs_clt= _con *con, =20 static inline void flag_success_on_conn(struct rtrs_clt_con *con) { - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); + struct rtrs_clt_path *clt_path =3D to_clt_path(con->c.path); =20 - atomic_inc(&sess->connected_cnt); + atomic_inc(&clt_path->connected_cnt); con->cm_err =3D 1; } =20 @@ -1924,23 +1935,23 @@ static int rtrs_rdma_conn_rejected(struct rtrs_clt_= con *con, return -ECONNRESET; } =20 -void rtrs_clt_close_conns(struct rtrs_clt_sess *sess, bool wait) +void rtrs_clt_close_conns(struct rtrs_clt_path *clt_path, bool wait) { - if (rtrs_clt_change_state_get_old(sess, RTRS_CLT_CLOSING, NULL)) - queue_work(rtrs_wq, &sess->close_work); + if (rtrs_clt_change_state_get_old(clt_path, RTRS_CLT_CLOSING, NULL)) + queue_work(rtrs_wq, &clt_path->close_work); if (wait) - flush_work(&sess->close_work); + flush_work(&clt_path->close_work); } =20 static inline void flag_error_on_conn(struct rtrs_clt_con *con, int cm_err) { if (con->cm_err =3D=3D 1) { - struct rtrs_clt_sess *sess; + struct rtrs_clt_path *clt_path; =20 - sess =3D to_clt_sess(con->c.path); - if (atomic_dec_and_test(&sess->connected_cnt)) + clt_path =3D to_clt_path(con->c.path); + if (atomic_dec_and_test(&clt_path->connected_cnt)) =20 - wake_up(&sess->state_wq); + wake_up(&clt_path->state_wq); } con->cm_err =3D cm_err; } @@ -1950,7 +1961,7 @@ static int rtrs_clt_rdma_cm_handler(struct rdma_cm_id= *cm_id, { struct rtrs_clt_con *con =3D cm_id->context; struct rtrs_path *s =3D con->c.path; - struct rtrs_clt_sess *sess =3D to_clt_sess(s); + struct rtrs_clt_path *clt_path =3D to_clt_path(s); int cm_err =3D 0; =20 switch (ev->event) { @@ -1968,7 +1979,7 @@ static int rtrs_clt_rdma_cm_handler(struct rdma_cm_id= *cm_id, * i.e. wake up without state change, but we set cm_err. */ flag_success_on_conn(con); - wake_up(&sess->state_wq); + wake_up(&clt_path->state_wq); return 0; } break; @@ -1997,7 +2008,7 @@ static int rtrs_clt_rdma_cm_handler(struct rdma_cm_id= *cm_id, /* * Device removal is a special case. Queue close and return 0. */ - rtrs_clt_close_conns(sess, false); + rtrs_clt_close_conns(clt_path, false); return 0; default: rtrs_err(s, "Unexpected RDMA CM error (CM event: %s, err: %d)\n", @@ -2021,12 +2032,12 @@ static int rtrs_clt_rdma_cm_handler(struct rdma_cm_= id *cm_id, static int create_cm(struct rtrs_clt_con *con) { struct rtrs_path *s =3D con->c.path; - struct rtrs_clt_sess *sess =3D to_clt_sess(s); + struct rtrs_clt_path *clt_path =3D to_clt_path(s); struct rdma_cm_id *cm_id; int err; =20 cm_id =3D rdma_create_id(&init_net, rtrs_clt_rdma_cm_handler, con, - sess->s.dst_addr.ss_family =3D=3D AF_IB ? + clt_path->s.dst_addr.ss_family =3D=3D AF_IB ? RDMA_PS_IB : RDMA_PS_TCP, IB_QPT_RC); if (IS_ERR(cm_id)) { err =3D PTR_ERR(cm_id); @@ -2042,8 +2053,8 @@ static int create_cm(struct rtrs_clt_con *con) rtrs_err(s, "Set address reuse failed, err: %d\n", err); goto destroy_cm; } - err =3D rdma_resolve_addr(cm_id, (struct sockaddr *)&sess->s.src_addr, - (struct sockaddr *)&sess->s.dst_addr, + err =3D rdma_resolve_addr(cm_id, (struct sockaddr *)&clt_path->s.src_addr, + (struct sockaddr *)&clt_path->s.dst_addr, RTRS_CONNECT_TIMEOUT_MS); if (err) { rtrs_err(s, "Failed to resolve address, err: %d\n", err); @@ -2055,8 +2066,8 @@ static int create_cm(struct rtrs_clt_con *con) * or session state was really changed to error by device removal. */ err =3D wait_event_interruptible_timeout( - sess->state_wq, - con->cm_err || sess->state !=3D RTRS_CLT_CONNECTING, + clt_path->state_wq, + con->cm_err || clt_path->state !=3D RTRS_CLT_CONNECTING, msecs_to_jiffies(RTRS_CONNECT_TIMEOUT_MS)); if (err =3D=3D 0 || err =3D=3D -ERESTARTSYS) { if (err =3D=3D 0) @@ -2068,7 +2079,7 @@ static int create_cm(struct rtrs_clt_con *con) err =3D con->cm_err; goto errr; } - if (READ_ONCE(sess->state) !=3D RTRS_CLT_CONNECTING) { + if (READ_ONCE(clt_path->state) !=3D RTRS_CLT_CONNECTING) { /* Device removal */ err =3D -ECONNABORTED; goto errr; @@ -2087,9 +2098,9 @@ static int create_cm(struct rtrs_clt_con *con) return err; } =20 -static void rtrs_clt_sess_up(struct rtrs_clt_sess *sess) +static void rtrs_clt_path_up(struct rtrs_clt_path *clt_path) { - struct rtrs_clt *clt =3D sess->clt; + struct rtrs_clt *clt =3D clt_path->clt; int up; =20 /* @@ -2113,19 +2124,19 @@ static void rtrs_clt_sess_up(struct rtrs_clt_sess *= sess) mutex_unlock(&clt->paths_ev_mutex); =20 /* Mark session as established */ - sess->established =3D true; - sess->reconnect_attempts =3D 0; - sess->stats->reconnects.successful_cnt++; + clt_path->established =3D true; + clt_path->reconnect_attempts =3D 0; + clt_path->stats->reconnects.successful_cnt++; } =20 -static void rtrs_clt_sess_down(struct rtrs_clt_sess *sess) +static void rtrs_clt_path_down(struct rtrs_clt_path *clt_path) { - struct rtrs_clt *clt =3D sess->clt; + struct rtrs_clt *clt =3D clt_path->clt; =20 - if (!sess->established) + if (!clt_path->established) return; =20 - sess->established =3D false; + clt_path->established =3D false; mutex_lock(&clt->paths_ev_mutex); WARN_ON(!clt->paths_up); if (--clt->paths_up =3D=3D 0) @@ -2133,19 +2144,19 @@ static void rtrs_clt_sess_down(struct rtrs_clt_sess= *sess) mutex_unlock(&clt->paths_ev_mutex); } =20 -static void rtrs_clt_stop_and_destroy_conns(struct rtrs_clt_sess *sess) +static void rtrs_clt_stop_and_destroy_conns(struct rtrs_clt_path *clt_path) { struct rtrs_clt_con *con; unsigned int cid; =20 - WARN_ON(READ_ONCE(sess->state) =3D=3D RTRS_CLT_CONNECTED); + WARN_ON(READ_ONCE(clt_path->state) =3D=3D RTRS_CLT_CONNECTED); =20 /* * Possible race with rtrs_clt_open(), when DEVICE_REMOVAL comes * exactly in between. Start destroying after it finishes. */ - mutex_lock(&sess->init_mutex); - mutex_unlock(&sess->init_mutex); + mutex_lock(&clt_path->init_mutex); + mutex_unlock(&clt_path->init_mutex); =20 /* * All IO paths must observe !CONNECTED state before we @@ -2153,7 +2164,7 @@ static void rtrs_clt_stop_and_destroy_conns(struct rt= rs_clt_sess *sess) */ synchronize_rcu(); =20 - rtrs_stop_hb(&sess->s); + rtrs_stop_hb(&clt_path->s); =20 /* * The order it utterly crucial: firstly disconnect and complete all @@ -2162,15 +2173,15 @@ static void rtrs_clt_stop_and_destroy_conns(struct = rtrs_clt_sess *sess) * eventually notify upper layer about session disconnection. */ =20 - for (cid =3D 0; cid < sess->s.con_num; cid++) { - if (!sess->s.con[cid]) + for (cid =3D 0; cid < clt_path->s.con_num; cid++) { + if (!clt_path->s.con[cid]) break; - con =3D to_clt_con(sess->s.con[cid]); + con =3D to_clt_con(clt_path->s.con[cid]); stop_cm(con); } - fail_all_outstanding_reqs(sess); - free_sess_reqs(sess); - rtrs_clt_sess_down(sess); + fail_all_outstanding_reqs(clt_path); + free_path_reqs(clt_path); + rtrs_clt_path_down(clt_path); =20 /* * Wait for graceful shutdown, namely when peer side invokes @@ -2180,13 +2191,14 @@ static void rtrs_clt_stop_and_destroy_conns(struct = rtrs_clt_sess *sess) * since CM does not fire anything. That is fine, we are not in * hurry. */ - wait_event_timeout(sess->state_wq, !atomic_read(&sess->connected_cnt), + wait_event_timeout(clt_path->state_wq, + !atomic_read(&clt_path->connected_cnt), msecs_to_jiffies(RTRS_CONNECT_TIMEOUT_MS)); =20 - for (cid =3D 0; cid < sess->s.con_num; cid++) { - if (!sess->s.con[cid]) + for (cid =3D 0; cid < clt_path->s.con_num; cid++) { + if (!clt_path->s.con[cid]) break; - con =3D to_clt_con(sess->s.con[cid]); + con =3D to_clt_con(clt_path->s.con[cid]); mutex_lock(&con->con_mutex); destroy_con_cq_qp(con); mutex_unlock(&con->con_mutex); @@ -2195,26 +2207,26 @@ static void rtrs_clt_stop_and_destroy_conns(struct = rtrs_clt_sess *sess) } } =20 -static inline bool xchg_sessions(struct rtrs_clt_sess __rcu **rcu_ppcpu_pa= th, - struct rtrs_clt_sess *sess, - struct rtrs_clt_sess *next) +static inline bool xchg_paths(struct rtrs_clt_path __rcu **rcu_ppcpu_path, + struct rtrs_clt_path *clt_path, + struct rtrs_clt_path *next) { - struct rtrs_clt_sess **ppcpu_path; + struct rtrs_clt_path **ppcpu_path; =20 /* Call cmpxchg() without sparse warnings */ ppcpu_path =3D (typeof(ppcpu_path))rcu_ppcpu_path; - return sess =3D=3D cmpxchg(ppcpu_path, sess, next); + return clt_path =3D=3D cmpxchg(ppcpu_path, clt_path, next); } =20 -static void rtrs_clt_remove_path_from_arr(struct rtrs_clt_sess *sess) +static void rtrs_clt_remove_path_from_arr(struct rtrs_clt_path *clt_path) { - struct rtrs_clt *clt =3D sess->clt; - struct rtrs_clt_sess *next; + struct rtrs_clt *clt =3D clt_path->clt; + struct rtrs_clt_path *next; bool wait_for_grace =3D false; int cpu; =20 mutex_lock(&clt->paths_mutex); - list_del_rcu(&sess->s.entry); + list_del_rcu(&clt_path->s.entry); =20 /* Make sure everybody observes path removal. */ synchronize_rcu(); @@ -2255,7 +2267,7 @@ static void rtrs_clt_remove_path_from_arr(struct rtrs= _clt_sess *sess) * removed. If @sess is the last element, then @next is NULL. */ rcu_read_lock(); - next =3D list_next_or_null_rr_rcu(&clt->paths_list, &sess->s.entry, + next =3D list_next_or_null_rr_rcu(&clt->paths_list, &clt_path->s.entry, typeof(*next), s.entry); rcu_read_unlock(); =20 @@ -2264,11 +2276,11 @@ static void rtrs_clt_remove_path_from_arr(struct rt= rs_clt_sess *sess) * removed, so change the pointer manually. */ for_each_possible_cpu(cpu) { - struct rtrs_clt_sess __rcu **ppcpu_path; + struct rtrs_clt_path __rcu **ppcpu_path; =20 ppcpu_path =3D per_cpu_ptr(clt->pcpu_path, cpu); if (rcu_dereference_protected(*ppcpu_path, - lockdep_is_held(&clt->paths_mutex)) !=3D sess) + lockdep_is_held(&clt->paths_mutex)) !=3D clt_path) /* * synchronize_rcu() was called just after deleting * entry from the list, thus IO code path cannot @@ -2281,7 +2293,7 @@ static void rtrs_clt_remove_path_from_arr(struct rtrs= _clt_sess *sess) * We race with IO code path, which also changes pointer, * thus we have to be careful not to overwrite it. */ - if (xchg_sessions(ppcpu_path, sess, next)) + if (xchg_paths(ppcpu_path, clt_path, next)) /* * @ppcpu_path was successfully replaced with @next, * that means that someone could also pick up the @@ -2296,29 +2308,29 @@ static void rtrs_clt_remove_path_from_arr(struct rt= rs_clt_sess *sess) mutex_unlock(&clt->paths_mutex); } =20 -static void rtrs_clt_add_path_to_arr(struct rtrs_clt_sess *sess) +static void rtrs_clt_add_path_to_arr(struct rtrs_clt_path *clt_path) { - struct rtrs_clt *clt =3D sess->clt; + struct rtrs_clt *clt =3D clt_path->clt; =20 mutex_lock(&clt->paths_mutex); clt->paths_num++; =20 - list_add_tail_rcu(&sess->s.entry, &clt->paths_list); + list_add_tail_rcu(&clt_path->s.entry, &clt->paths_list); mutex_unlock(&clt->paths_mutex); } =20 static void rtrs_clt_close_work(struct work_struct *work) { - struct rtrs_clt_sess *sess; + struct rtrs_clt_path *clt_path; =20 - sess =3D container_of(work, struct rtrs_clt_sess, close_work); + clt_path =3D container_of(work, struct rtrs_clt_path, close_work); =20 - cancel_delayed_work_sync(&sess->reconnect_dwork); - rtrs_clt_stop_and_destroy_conns(sess); - rtrs_clt_change_state_get_old(sess, RTRS_CLT_CLOSED, NULL); + cancel_delayed_work_sync(&clt_path->reconnect_dwork); + rtrs_clt_stop_and_destroy_conns(clt_path); + rtrs_clt_change_state_get_old(clt_path, RTRS_CLT_CLOSED, NULL); } =20 -static int init_conns(struct rtrs_clt_sess *sess) +static int init_conns(struct rtrs_clt_path *clt_path) { unsigned int cid; int err; @@ -2328,31 +2340,31 @@ static int init_conns(struct rtrs_clt_sess *sess) * to avoid clashes with previous sessions not yet closed * sessions on a server side. */ - sess->s.recon_cnt++; + clt_path->s.recon_cnt++; =20 /* Establish all RDMA connections */ - for (cid =3D 0; cid < sess->s.con_num; cid++) { - err =3D create_con(sess, cid); + for (cid =3D 0; cid < clt_path->s.con_num; cid++) { + err =3D create_con(clt_path, cid); if (err) goto destroy; =20 - err =3D create_cm(to_clt_con(sess->s.con[cid])); + err =3D create_cm(to_clt_con(clt_path->s.con[cid])); if (err) { - destroy_con(to_clt_con(sess->s.con[cid])); + destroy_con(to_clt_con(clt_path->s.con[cid])); goto destroy; } } - err =3D alloc_sess_reqs(sess); + err =3D alloc_path_reqs(clt_path); if (err) goto destroy; =20 - rtrs_start_hb(&sess->s); + rtrs_start_hb(&clt_path->s); =20 return 0; =20 destroy: while (cid--) { - struct rtrs_clt_con *con =3D to_clt_con(sess->s.con[cid]); + struct rtrs_clt_con *con =3D to_clt_con(clt_path->s.con[cid]); =20 stop_cm(con); =20 @@ -2367,7 +2379,7 @@ static int init_conns(struct rtrs_clt_sess *sess) * doing rdma_resolve_addr(), switch to CONNECTION_ERR state * manually to keep reconnecting. */ - rtrs_clt_change_state_get_old(sess, RTRS_CLT_CONNECTING_ERR, NULL); + rtrs_clt_change_state_get_old(clt_path, RTRS_CLT_CONNECTING_ERR, NULL); =20 return err; } @@ -2375,31 +2387,32 @@ static int init_conns(struct rtrs_clt_sess *sess) static void rtrs_clt_info_req_done(struct ib_cq *cq, struct ib_wc *wc) { struct rtrs_clt_con *con =3D to_clt_con(wc->qp->qp_context); - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); + struct rtrs_clt_path *clt_path =3D to_clt_path(con->c.path); struct rtrs_iu *iu; =20 iu =3D container_of(wc->wr_cqe, struct rtrs_iu, cqe); - rtrs_iu_free(iu, sess->s.dev->ib_dev, 1); + rtrs_iu_free(iu, clt_path->s.dev->ib_dev, 1); =20 if (wc->status !=3D IB_WC_SUCCESS) { - rtrs_err(sess->clt, "Sess info request send failed: %s\n", + rtrs_err(clt_path->clt, "Path info request send failed: %s\n", ib_wc_status_msg(wc->status)); - rtrs_clt_change_state_get_old(sess, RTRS_CLT_CONNECTING_ERR, NULL); + rtrs_clt_change_state_get_old(clt_path, RTRS_CLT_CONNECTING_ERR, NULL); return; } =20 rtrs_clt_update_wc_stats(con); } =20 -static int process_info_rsp(struct rtrs_clt_sess *sess, +static int process_info_rsp(struct rtrs_clt_path *clt_path, const struct rtrs_msg_info_rsp *msg) { unsigned int sg_cnt, total_len; int i, sgi; =20 sg_cnt =3D le16_to_cpu(msg->sg_cnt); - if (!sg_cnt || (sess->queue_depth % sg_cnt)) { - rtrs_err(sess->clt, "Incorrect sg_cnt %d, is not multiple\n", + if (!sg_cnt || (clt_path->queue_depth % sg_cnt)) { + rtrs_err(clt_path->clt, + "Incorrect sg_cnt %d, is not multiple\n", sg_cnt); return -EINVAL; } @@ -2408,15 +2421,15 @@ static int process_info_rsp(struct rtrs_clt_sess *s= ess, * Check if IB immediate data size is enough to hold the mem_id and * the offset inside the memory chunk. */ - if ((ilog2(sg_cnt - 1) + 1) + (ilog2(sess->chunk_size - 1) + 1) > + if ((ilog2(sg_cnt - 1) + 1) + (ilog2(clt_path->chunk_size - 1) + 1) > MAX_IMM_PAYL_BITS) { - rtrs_err(sess->clt, + rtrs_err(clt_path->clt, "RDMA immediate size (%db) not enough to encode %d buffers of size %d= B\n", - MAX_IMM_PAYL_BITS, sg_cnt, sess->chunk_size); + MAX_IMM_PAYL_BITS, sg_cnt, clt_path->chunk_size); return -EINVAL; } total_len =3D 0; - for (sgi =3D 0, i =3D 0; sgi < sg_cnt && i < sess->queue_depth; sgi++) { + for (sgi =3D 0, i =3D 0; sgi < sg_cnt && i < clt_path->queue_depth; sgi++= ) { const struct rtrs_sg_desc *desc =3D &msg->desc[sgi]; u32 len, rkey; u64 addr; @@ -2427,26 +2440,28 @@ static int process_info_rsp(struct rtrs_clt_sess *s= ess, =20 total_len +=3D len; =20 - if (!len || (len % sess->chunk_size)) { - rtrs_err(sess->clt, "Incorrect [%d].len %d\n", sgi, + if (!len || (len % clt_path->chunk_size)) { + rtrs_err(clt_path->clt, "Incorrect [%d].len %d\n", + sgi, len); return -EINVAL; } - for ( ; len && i < sess->queue_depth; i++) { - sess->rbufs[i].addr =3D addr; - sess->rbufs[i].rkey =3D rkey; + for ( ; len && i < clt_path->queue_depth; i++) { + clt_path->rbufs[i].addr =3D addr; + clt_path->rbufs[i].rkey =3D rkey; =20 - len -=3D sess->chunk_size; - addr +=3D sess->chunk_size; + len -=3D clt_path->chunk_size; + addr +=3D clt_path->chunk_size; } } /* Sanity check */ - if (sgi !=3D sg_cnt || i !=3D sess->queue_depth) { - rtrs_err(sess->clt, "Incorrect sg vector, not fully mapped\n"); + if (sgi !=3D sg_cnt || i !=3D clt_path->queue_depth) { + rtrs_err(clt_path->clt, + "Incorrect sg vector, not fully mapped\n"); return -EINVAL; } - if (total_len !=3D sess->chunk_size * sess->queue_depth) { - rtrs_err(sess->clt, "Incorrect total_len %d\n", total_len); + if (total_len !=3D clt_path->chunk_size * clt_path->queue_depth) { + rtrs_err(clt_path->clt, "Incorrect total_len %d\n", total_len); return -EINVAL; } =20 @@ -2456,7 +2471,7 @@ static int process_info_rsp(struct rtrs_clt_sess *ses= s, static void rtrs_clt_info_rsp_done(struct ib_cq *cq, struct ib_wc *wc) { struct rtrs_clt_con *con =3D to_clt_con(wc->qp->qp_context); - struct rtrs_clt_sess *sess =3D to_clt_sess(con->c.path); + struct rtrs_clt_path *clt_path =3D to_clt_path(con->c.path); struct rtrs_msg_info_rsp *msg; enum rtrs_clt_state state; struct rtrs_iu *iu; @@ -2468,37 +2483,37 @@ static void rtrs_clt_info_rsp_done(struct ib_cq *cq= , struct ib_wc *wc) WARN_ON(con->c.cid); iu =3D container_of(wc->wr_cqe, struct rtrs_iu, cqe); if (wc->status !=3D IB_WC_SUCCESS) { - rtrs_err(sess->clt, "Sess info response recv failed: %s\n", + rtrs_err(clt_path->clt, "Path info response recv failed: %s\n", ib_wc_status_msg(wc->status)); goto out; } WARN_ON(wc->opcode !=3D IB_WC_RECV); =20 if (wc->byte_len < sizeof(*msg)) { - rtrs_err(sess->clt, "Sess info response is malformed: size %d\n", + rtrs_err(clt_path->clt, "Path info response is malformed: size %d\n", wc->byte_len); goto out; } - ib_dma_sync_single_for_cpu(sess->s.dev->ib_dev, iu->dma_addr, + ib_dma_sync_single_for_cpu(clt_path->s.dev->ib_dev, iu->dma_addr, iu->size, DMA_FROM_DEVICE); msg =3D iu->buf; if (le16_to_cpu(msg->type) !=3D RTRS_MSG_INFO_RSP) { - rtrs_err(sess->clt, "Sess info response is malformed: type %d\n", + rtrs_err(clt_path->clt, "Path info response is malformed: type %d\n", le16_to_cpu(msg->type)); goto out; } rx_sz =3D sizeof(*msg); rx_sz +=3D sizeof(msg->desc[0]) * le16_to_cpu(msg->sg_cnt); if (wc->byte_len < rx_sz) { - rtrs_err(sess->clt, "Sess info response is malformed: size %d\n", + rtrs_err(clt_path->clt, "Path info response is malformed: size %d\n", wc->byte_len); goto out; } - err =3D process_info_rsp(sess, msg); + err =3D process_info_rsp(clt_path, msg); if (err) goto out; =20 - err =3D post_recv_sess(sess); + err =3D post_recv_path(clt_path); if (err) goto out; =20 @@ -2506,25 +2521,25 @@ static void rtrs_clt_info_rsp_done(struct ib_cq *cq= , struct ib_wc *wc) =20 out: rtrs_clt_update_wc_stats(con); - rtrs_iu_free(iu, sess->s.dev->ib_dev, 1); - rtrs_clt_change_state_get_old(sess, state, NULL); + rtrs_iu_free(iu, clt_path->s.dev->ib_dev, 1); + rtrs_clt_change_state_get_old(clt_path, state, NULL); } =20 -static int rtrs_send_sess_info(struct rtrs_clt_sess *sess) +static int rtrs_send_path_info(struct rtrs_clt_path *clt_path) { - struct rtrs_clt_con *usr_con =3D to_clt_con(sess->s.con[0]); + struct rtrs_clt_con *usr_con =3D to_clt_con(clt_path->s.con[0]); struct rtrs_msg_info_req *msg; struct rtrs_iu *tx_iu, *rx_iu; size_t rx_sz; int err; =20 rx_sz =3D sizeof(struct rtrs_msg_info_rsp); - rx_sz +=3D sizeof(struct rtrs_sg_desc) * sess->queue_depth; + rx_sz +=3D sizeof(struct rtrs_sg_desc) * clt_path->queue_depth; =20 tx_iu =3D rtrs_iu_alloc(1, sizeof(struct rtrs_msg_info_req), GFP_KERNEL, - sess->s.dev->ib_dev, DMA_TO_DEVICE, + clt_path->s.dev->ib_dev, DMA_TO_DEVICE, rtrs_clt_info_req_done); - rx_iu =3D rtrs_iu_alloc(1, rx_sz, GFP_KERNEL, sess->s.dev->ib_dev, + rx_iu =3D rtrs_iu_alloc(1, rx_sz, GFP_KERNEL, clt_path->s.dev->ib_dev, DMA_FROM_DEVICE, rtrs_clt_info_rsp_done); if (!tx_iu || !rx_iu) { err =3D -ENOMEM; @@ -2533,33 +2548,34 @@ static int rtrs_send_sess_info(struct rtrs_clt_sess= *sess) /* Prepare for getting info response */ err =3D rtrs_iu_post_recv(&usr_con->c, rx_iu); if (err) { - rtrs_err(sess->clt, "rtrs_iu_post_recv(), err: %d\n", err); + rtrs_err(clt_path->clt, "rtrs_iu_post_recv(), err: %d\n", err); goto out; } rx_iu =3D NULL; =20 msg =3D tx_iu->buf; msg->type =3D cpu_to_le16(RTRS_MSG_INFO_REQ); - memcpy(msg->sessname, sess->s.sessname, sizeof(msg->sessname)); + memcpy(msg->pathname, clt_path->s.sessname, sizeof(msg->pathname)); =20 - ib_dma_sync_single_for_device(sess->s.dev->ib_dev, tx_iu->dma_addr, + ib_dma_sync_single_for_device(clt_path->s.dev->ib_dev, + tx_iu->dma_addr, tx_iu->size, DMA_TO_DEVICE); =20 /* Send info request */ err =3D rtrs_iu_post_send(&usr_con->c, tx_iu, sizeof(*msg), NULL); if (err) { - rtrs_err(sess->clt, "rtrs_iu_post_send(), err: %d\n", err); + rtrs_err(clt_path->clt, "rtrs_iu_post_send(), err: %d\n", err); goto out; } tx_iu =3D NULL; =20 /* Wait for state change */ - wait_event_interruptible_timeout(sess->state_wq, - sess->state !=3D RTRS_CLT_CONNECTING, + wait_event_interruptible_timeout(clt_path->state_wq, + clt_path->state !=3D RTRS_CLT_CONNECTING, msecs_to_jiffies( RTRS_CONNECT_TIMEOUT_MS)); - if (READ_ONCE(sess->state) !=3D RTRS_CLT_CONNECTED) { - if (READ_ONCE(sess->state) =3D=3D RTRS_CLT_CONNECTING_ERR) + if (READ_ONCE(clt_path->state) !=3D RTRS_CLT_CONNECTED) { + if (READ_ONCE(clt_path->state) =3D=3D RTRS_CLT_CONNECTING_ERR) err =3D -ECONNRESET; else err =3D -ETIMEDOUT; @@ -2567,82 +2583,82 @@ static int rtrs_send_sess_info(struct rtrs_clt_sess= *sess) =20 out: if (tx_iu) - rtrs_iu_free(tx_iu, sess->s.dev->ib_dev, 1); + rtrs_iu_free(tx_iu, clt_path->s.dev->ib_dev, 1); if (rx_iu) - rtrs_iu_free(rx_iu, sess->s.dev->ib_dev, 1); + rtrs_iu_free(rx_iu, clt_path->s.dev->ib_dev, 1); if (err) /* If we've never taken async path because of malloc problems */ - rtrs_clt_change_state_get_old(sess, RTRS_CLT_CONNECTING_ERR, NULL); + rtrs_clt_change_state_get_old(clt_path, + RTRS_CLT_CONNECTING_ERR, NULL); =20 return err; } =20 /** - * init_sess() - establishes all session connections and does handshake - * @sess: client session. + * init_path() - establishes all path connections and does handshake + * @clt_path: client path. * In case of error full close or reconnect procedure should be taken, * because reconnect or close async works can be started. */ -static int init_sess(struct rtrs_clt_sess *sess) +static int init_path(struct rtrs_clt_path *clt_path) { int err; char str[NAME_MAX]; struct rtrs_addr path =3D { - .src =3D &sess->s.src_addr, - .dst =3D &sess->s.dst_addr, + .src =3D &clt_path->s.src_addr, + .dst =3D &clt_path->s.dst_addr, }; =20 rtrs_addr_to_str(&path, str, sizeof(str)); =20 - mutex_lock(&sess->init_mutex); - err =3D init_conns(sess); + mutex_lock(&clt_path->init_mutex); + err =3D init_conns(clt_path); if (err) { - rtrs_err(sess->clt, + rtrs_err(clt_path->clt, "init_conns() failed: err=3D%d path=3D%s [%s:%u]\n", err, - str, sess->hca_name, sess->hca_port); + str, clt_path->hca_name, clt_path->hca_port); goto out; } - err =3D rtrs_send_sess_info(sess); + err =3D rtrs_send_path_info(clt_path); if (err) { - rtrs_err( - sess->clt, - "rtrs_send_sess_info() failed: err=3D%d path=3D%s [%s:%u]\n", - err, str, sess->hca_name, sess->hca_port); + rtrs_err(clt_path->clt, + "rtrs_send_path_info() failed: err=3D%d path=3D%s [%s:%u]\n", + err, str, clt_path->hca_name, clt_path->hca_port); goto out; } - rtrs_clt_sess_up(sess); + rtrs_clt_path_up(clt_path); out: - mutex_unlock(&sess->init_mutex); + mutex_unlock(&clt_path->init_mutex); =20 return err; } =20 static void rtrs_clt_reconnect_work(struct work_struct *work) { - struct rtrs_clt_sess *sess; + struct rtrs_clt_path *clt_path; struct rtrs_clt *clt; unsigned int delay_ms; int err; =20 - sess =3D container_of(to_delayed_work(work), struct rtrs_clt_sess, - reconnect_dwork); - clt =3D sess->clt; + clt_path =3D container_of(to_delayed_work(work), struct rtrs_clt_path, + reconnect_dwork); + clt =3D clt_path->clt; =20 - if (READ_ONCE(sess->state) !=3D RTRS_CLT_RECONNECTING) + if (READ_ONCE(clt_path->state) !=3D RTRS_CLT_RECONNECTING) return; =20 - if (sess->reconnect_attempts >=3D clt->max_reconnect_attempts) { - /* Close a session completely if max attempts is reached */ - rtrs_clt_close_conns(sess, false); + if (clt_path->reconnect_attempts >=3D clt->max_reconnect_attempts) { + /* Close a path completely if max attempts is reached */ + rtrs_clt_close_conns(clt_path, false); return; } - sess->reconnect_attempts++; + clt_path->reconnect_attempts++; =20 /* Stop everything */ - rtrs_clt_stop_and_destroy_conns(sess); + rtrs_clt_stop_and_destroy_conns(clt_path); msleep(RTRS_RECONNECT_BACKOFF); - if (rtrs_clt_change_state_get_old(sess, RTRS_CLT_CONNECTING, NULL)) { - err =3D init_sess(sess); + if (rtrs_clt_change_state_get_old(clt_path, RTRS_CLT_CONNECTING, NULL)) { + err =3D init_path(clt_path); if (err) goto reconnect_again; } @@ -2650,10 +2666,10 @@ static void rtrs_clt_reconnect_work(struct work_str= uct *work) return; =20 reconnect_again: - if (rtrs_clt_change_state_get_old(sess, RTRS_CLT_RECONNECTING, NULL)) { - sess->stats->reconnects.fail_cnt++; + if (rtrs_clt_change_state_get_old(clt_path, RTRS_CLT_RECONNECTING, NULL))= { + clt_path->stats->reconnects.fail_cnt++; delay_ms =3D clt->reconnect_delay_sec * 1000; - queue_delayed_work(rtrs_wq, &sess->reconnect_dwork, + queue_delayed_work(rtrs_wq, &clt_path->reconnect_dwork, msecs_to_jiffies(delay_ms + prandom_u32() % RTRS_RECONNECT_SEED)); @@ -2762,7 +2778,7 @@ static void free_clt(struct rtrs_clt *clt) } =20 /** - * rtrs_clt_open() - Open a session to an RTRS server + * rtrs_clt_open() - Open a path to an RTRS server * @ops: holds the link event callback and the private pointer. * @sessname: name of the session * @paths: Paths to be established defined by their src and dst addresses @@ -2780,23 +2796,23 @@ static void free_clt(struct rtrs_clt *clt) * Return a valid pointer on success otherwise PTR_ERR. */ struct rtrs_clt *rtrs_clt_open(struct rtrs_clt_ops *ops, - const char *sessname, + const char *pathname, const struct rtrs_addr *paths, size_t paths_num, u16 port, size_t pdu_sz, u8 reconnect_delay_sec, s16 max_reconnect_attempts, u32 nr_poll_queues) { - struct rtrs_clt_sess *sess, *tmp; + struct rtrs_clt_path *clt_path, *tmp; struct rtrs_clt *clt; int err, i; =20 - if (strchr(sessname, '/') || strchr(sessname, '.')) { - pr_err("sessname cannot contain / and .\n"); + if (strchr(pathname, '/') || strchr(pathname, '.')) { + pr_err("pathname cannot contain / and .\n"); err =3D -EINVAL; goto out; } =20 - clt =3D alloc_clt(sessname, paths_num, port, pdu_sz, ops->priv, + clt =3D alloc_clt(pathname, paths_num, port, pdu_sz, ops->priv, ops->link_ev, reconnect_delay_sec, max_reconnect_attempts); @@ -2805,49 +2821,49 @@ struct rtrs_clt *rtrs_clt_open(struct rtrs_clt_ops = *ops, goto out; } for (i =3D 0; i < paths_num; i++) { - struct rtrs_clt_sess *sess; + struct rtrs_clt_path *clt_path; =20 - sess =3D alloc_sess(clt, &paths[i], nr_cpu_ids, + clt_path =3D alloc_path(clt, &paths[i], nr_cpu_ids, nr_poll_queues); - if (IS_ERR(sess)) { - err =3D PTR_ERR(sess); - goto close_all_sess; + if (IS_ERR(clt_path)) { + err =3D PTR_ERR(clt_path); + goto close_all_path; } if (!i) - sess->for_new_clt =3D 1; - list_add_tail_rcu(&sess->s.entry, &clt->paths_list); + clt_path->for_new_clt =3D 1; + list_add_tail_rcu(&clt_path->s.entry, &clt->paths_list); =20 - err =3D init_sess(sess); + err =3D init_path(clt_path); if (err) { - list_del_rcu(&sess->s.entry); - rtrs_clt_close_conns(sess, true); - free_percpu(sess->stats->pcpu_stats); - kfree(sess->stats); - free_sess(sess); - goto close_all_sess; + list_del_rcu(&clt_path->s.entry); + rtrs_clt_close_conns(clt_path, true); + free_percpu(clt_path->stats->pcpu_stats); + kfree(clt_path->stats); + free_path(clt_path); + goto close_all_path; } =20 - err =3D rtrs_clt_create_sess_files(sess); + err =3D rtrs_clt_create_path_files(clt_path); if (err) { - list_del_rcu(&sess->s.entry); - rtrs_clt_close_conns(sess, true); - free_percpu(sess->stats->pcpu_stats); - kfree(sess->stats); - free_sess(sess); - goto close_all_sess; + list_del_rcu(&clt_path->s.entry); + rtrs_clt_close_conns(clt_path, true); + free_percpu(clt_path->stats->pcpu_stats); + kfree(clt_path->stats); + free_path(clt_path); + goto close_all_path; } } err =3D alloc_permits(clt); if (err) - goto close_all_sess; + goto close_all_path; =20 return clt; =20 -close_all_sess: - list_for_each_entry_safe(sess, tmp, &clt->paths_list, s.entry) { - rtrs_clt_destroy_sess_files(sess, NULL); - rtrs_clt_close_conns(sess, true); - kobject_put(&sess->kobj); +close_all_path: + list_for_each_entry_safe(clt_path, tmp, &clt->paths_list, s.entry) { + rtrs_clt_destroy_path_files(clt_path, NULL); + rtrs_clt_close_conns(clt_path, true); + kobject_put(&clt_path->kobj); } rtrs_clt_destroy_sysfs_root(clt); free_clt(clt); @@ -2858,38 +2874,39 @@ struct rtrs_clt *rtrs_clt_open(struct rtrs_clt_ops = *ops, EXPORT_SYMBOL(rtrs_clt_open); =20 /** - * rtrs_clt_close() - Close a session + * rtrs_clt_close() - Close a path * @clt: Session handle. Session is freed upon return. */ void rtrs_clt_close(struct rtrs_clt *clt) { - struct rtrs_clt_sess *sess, *tmp; + struct rtrs_clt_path *clt_path, *tmp; =20 /* Firstly forbid sysfs access */ rtrs_clt_destroy_sysfs_root(clt); =20 /* Now it is safe to iterate over all paths without locks */ - list_for_each_entry_safe(sess, tmp, &clt->paths_list, s.entry) { - rtrs_clt_close_conns(sess, true); - rtrs_clt_destroy_sess_files(sess, NULL); - kobject_put(&sess->kobj); + list_for_each_entry_safe(clt_path, tmp, &clt->paths_list, s.entry) { + rtrs_clt_close_conns(clt_path, true); + rtrs_clt_destroy_path_files(clt_path, NULL); + kobject_put(&clt_path->kobj); } free_permits(clt); free_clt(clt); } EXPORT_SYMBOL(rtrs_clt_close); =20 -int rtrs_clt_reconnect_from_sysfs(struct rtrs_clt_sess *sess) +int rtrs_clt_reconnect_from_sysfs(struct rtrs_clt_path *clt_path) { enum rtrs_clt_state old_state; int err =3D -EBUSY; bool changed; =20 - changed =3D rtrs_clt_change_state_get_old(sess, RTRS_CLT_RECONNECTING, + changed =3D rtrs_clt_change_state_get_old(clt_path, + RTRS_CLT_RECONNECTING, &old_state); if (changed) { - sess->reconnect_attempts =3D 0; - queue_delayed_work(rtrs_wq, &sess->reconnect_dwork, 0); + clt_path->reconnect_attempts =3D 0; + queue_delayed_work(rtrs_wq, &clt_path->reconnect_dwork, 0); } if (changed || old_state =3D=3D RTRS_CLT_RECONNECTING) { /* @@ -2897,15 +2914,15 @@ int rtrs_clt_reconnect_from_sysfs(struct rtrs_clt_s= ess *sess) * execution, so do the flush if we have queued something * right now or work is pending. */ - flush_delayed_work(&sess->reconnect_dwork); - err =3D (READ_ONCE(sess->state) =3D=3D + flush_delayed_work(&clt_path->reconnect_dwork); + err =3D (READ_ONCE(clt_path->state) =3D=3D RTRS_CLT_CONNECTED ? 0 : -ENOTCONN); } =20 return err; } =20 -int rtrs_clt_remove_path_from_sysfs(struct rtrs_clt_sess *sess, +int rtrs_clt_remove_path_from_sysfs(struct rtrs_clt_path *clt_path, const struct attribute *sysfs_self) { enum rtrs_clt_state old_state; @@ -2921,16 +2938,16 @@ int rtrs_clt_remove_path_from_sysfs(struct rtrs_clt= _sess *sess, * removing the path. */ do { - rtrs_clt_close_conns(sess, true); - changed =3D rtrs_clt_change_state_get_old(sess, + rtrs_clt_close_conns(clt_path, true); + changed =3D rtrs_clt_change_state_get_old(clt_path, RTRS_CLT_DEAD, &old_state); } while (!changed && old_state !=3D RTRS_CLT_DEAD); =20 if (changed) { - rtrs_clt_remove_path_from_arr(sess); - rtrs_clt_destroy_sess_files(sess, sysfs_self); - kobject_put(&sess->kobj); + rtrs_clt_remove_path_from_arr(clt_path); + rtrs_clt_destroy_path_files(clt_path, sysfs_self); + kobject_put(&clt_path->kobj); } =20 return 0; @@ -2976,7 +2993,7 @@ int rtrs_clt_request(int dir, struct rtrs_clt_req_ops= *ops, struct scatterlist *sg, unsigned int sg_cnt) { struct rtrs_clt_io_req *req; - struct rtrs_clt_sess *sess; + struct rtrs_clt_path *clt_path; =20 enum dma_data_direction dma_dir; int err =3D -ECONNABORTED, i; @@ -2998,19 +3015,19 @@ int rtrs_clt_request(int dir, struct rtrs_clt_req_o= ps *ops, =20 rcu_read_lock(); for (path_it_init(&it, clt); - (sess =3D it.next_path(&it)) && it.i < it.clt->paths_num; it.i++) { - if (READ_ONCE(sess->state) !=3D RTRS_CLT_CONNECTED) + (clt_path =3D it.next_path(&it)) && it.i < it.clt->paths_num; it.i++= ) { + if (READ_ONCE(clt_path->state) !=3D RTRS_CLT_CONNECTED) continue; =20 - if (usr_len + hdr_len > sess->max_hdr_size) { - rtrs_wrn_rl(sess->clt, + if (usr_len + hdr_len > clt_path->max_hdr_size) { + rtrs_wrn_rl(clt_path->clt, "%s request failed, user message size is %zu and header length %z= u, but max size is %u\n", dir =3D=3D READ ? "Read" : "Write", - usr_len, hdr_len, sess->max_hdr_size); + usr_len, hdr_len, clt_path->max_hdr_size); err =3D -EMSGSIZE; break; } - req =3D rtrs_clt_get_req(sess, ops->conf_fn, permit, ops->priv, + req =3D rtrs_clt_get_req(clt_path, ops->conf_fn, permit, ops->priv, vec, usr_len, sg, sg_cnt, data_len, dma_dir); if (dir =3D=3D READ) @@ -3036,16 +3053,16 @@ int rtrs_clt_rdma_cq_direct(struct rtrs_clt *clt, u= nsigned int index) /* If no path, return -1 for block layer not to try again */ int cnt =3D -1; struct rtrs_con *con; - struct rtrs_clt_sess *sess; + struct rtrs_clt_path *clt_path; struct path_it it; =20 rcu_read_lock(); for (path_it_init(&it, clt); - (sess =3D it.next_path(&it)) && it.i < it.clt->paths_num; it.i++) { - if (READ_ONCE(sess->state) !=3D RTRS_CLT_CONNECTED) + (clt_path =3D it.next_path(&it)) && it.i < it.clt->paths_num; it.i++= ) { + if (READ_ONCE(clt_path->state) !=3D RTRS_CLT_CONNECTED) continue; =20 - con =3D sess->s.con[index + 1]; + con =3D clt_path->s.con[index + 1]; cnt =3D ib_process_cq_direct(con->cq, -1); if (cnt) break; @@ -3083,12 +3100,12 @@ EXPORT_SYMBOL(rtrs_clt_query); int rtrs_clt_create_path_from_sysfs(struct rtrs_clt *clt, struct rtrs_addr *addr) { - struct rtrs_clt_sess *sess; + struct rtrs_clt_path *clt_path; int err; =20 - sess =3D alloc_sess(clt, addr, nr_cpu_ids, 0); - if (IS_ERR(sess)) - return PTR_ERR(sess); + clt_path =3D alloc_path(clt, addr, nr_cpu_ids, 0); + if (IS_ERR(clt_path)) + return PTR_ERR(clt_path); =20 mutex_lock(&clt->paths_mutex); if (clt->paths_num =3D=3D 0) { @@ -3097,7 +3114,7 @@ int rtrs_clt_create_path_from_sysfs(struct rtrs_clt *= clt, * the addition of the first path is like a new session for * the storage server */ - sess->for_new_clt =3D 1; + clt_path->for_new_clt =3D 1; } =20 mutex_unlock(&clt->paths_mutex); @@ -3107,24 +3124,24 @@ int rtrs_clt_create_path_from_sysfs(struct rtrs_clt= *clt, * IO will never grab it. Also it is very important to add * path before init, since init fires LINK_CONNECTED event. */ - rtrs_clt_add_path_to_arr(sess); + rtrs_clt_add_path_to_arr(clt_path); =20 - err =3D init_sess(sess); + err =3D init_path(clt_path); if (err) - goto close_sess; + goto close_path; =20 - err =3D rtrs_clt_create_sess_files(sess); + err =3D rtrs_clt_create_path_files(clt_path); if (err) - goto close_sess; + goto close_path; =20 return 0; =20 -close_sess: - rtrs_clt_remove_path_from_arr(sess); - rtrs_clt_close_conns(sess, true); - free_percpu(sess->stats->pcpu_stats); - kfree(sess->stats); - free_sess(sess); +close_path: + rtrs_clt_remove_path_from_arr(clt_path); + rtrs_clt_close_conns(clt_path, true); + free_percpu(clt_path->stats->pcpu_stats); + kfree(clt_path->stats); + free_path(clt_path); =20 return err; } diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.h b/drivers/infiniband/ul= p/rtrs/rtrs-clt.h index d616f325bc40..7f2a64995fb6 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.h +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.h @@ -124,7 +124,7 @@ struct rtrs_rbuf { u32 rkey; }; =20 -struct rtrs_clt_sess { +struct rtrs_clt_path { struct rtrs_path s; struct rtrs_clt *clt; wait_queue_head_t state_wq; @@ -156,7 +156,7 @@ struct rtrs_clt_sess { struct rtrs_clt { struct list_head paths_list; /* rcu protected list */ size_t paths_num; - struct rtrs_clt_sess + struct rtrs_clt_path __rcu * __percpu *pcpu_path; uuid_t paths_uuid; int paths_up; @@ -186,9 +186,9 @@ static inline struct rtrs_clt_con *to_clt_con(struct rt= rs_con *c) return container_of(c, struct rtrs_clt_con, c); } =20 -static inline struct rtrs_clt_sess *to_clt_sess(struct rtrs_path *s) +static inline struct rtrs_clt_path *to_clt_path(struct rtrs_path *s) { - return container_of(s, struct rtrs_clt_sess, s); + return container_of(s, struct rtrs_clt_path, s); } =20 static inline int permit_size(struct rtrs_clt *clt) @@ -201,16 +201,16 @@ static inline struct rtrs_permit *get_permit(struct r= trs_clt *clt, int idx) return (struct rtrs_permit *)(clt->permits + permit_size(clt) * idx); } =20 -int rtrs_clt_reconnect_from_sysfs(struct rtrs_clt_sess *sess); -void rtrs_clt_close_conns(struct rtrs_clt_sess *sess, bool wait); +int rtrs_clt_reconnect_from_sysfs(struct rtrs_clt_path *path); +void rtrs_clt_close_conns(struct rtrs_clt_path *clt_path, bool wait); int rtrs_clt_create_path_from_sysfs(struct rtrs_clt *clt, struct rtrs_addr *addr); -int rtrs_clt_remove_path_from_sysfs(struct rtrs_clt_sess *sess, +int rtrs_clt_remove_path_from_sysfs(struct rtrs_clt_path *path, const struct attribute *sysfs_self); =20 void rtrs_clt_set_max_reconnect_attempts(struct rtrs_clt *clt, int value); int rtrs_clt_get_max_reconnect_attempts(const struct rtrs_clt *clt); -void free_sess(struct rtrs_clt_sess *sess); +void free_path(struct rtrs_clt_path *clt_path); =20 /* rtrs-clt-stats.c */ =20 @@ -243,8 +243,8 @@ ssize_t rtrs_clt_reset_all_help(struct rtrs_clt_stats *= stats, int rtrs_clt_create_sysfs_root_files(struct rtrs_clt *clt); void rtrs_clt_destroy_sysfs_root(struct rtrs_clt *clt); =20 -int rtrs_clt_create_sess_files(struct rtrs_clt_sess *sess); -void rtrs_clt_destroy_sess_files(struct rtrs_clt_sess *sess, +int rtrs_clt_create_path_files(struct rtrs_clt_path *clt_path); +void rtrs_clt_destroy_path_files(struct rtrs_clt_path *clt_path, const struct attribute *sysfs_self); =20 #endif /* RTRS_CLT_H */ diff --git a/drivers/infiniband/ulp/rtrs/rtrs-pri.h b/drivers/infiniband/ul= p/rtrs/rtrs-pri.h index 412cf5ce3e7c..b69fa1fe9a70 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-pri.h +++ b/drivers/infiniband/ulp/rtrs/rtrs-pri.h @@ -230,7 +230,7 @@ struct rtrs_msg_conn_rsp { /** * struct rtrs_msg_info_req * @type: @RTRS_MSG_INFO_REQ - * @sessname: Session name chosen by client + * @pathname: Path name chosen by client */ struct rtrs_msg_info_req { __le16 type; diff --git a/drivers/infiniband/ulp/rtrs/rtrs.h b/drivers/infiniband/ulp/rt= rs/rtrs.h index 9da9202fbee5..c529b6d63c9a 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs.h +++ b/drivers/infiniband/ulp/rtrs/rtrs.h @@ -53,13 +53,13 @@ struct rtrs_clt_ops { }; =20 struct rtrs_clt *rtrs_clt_open(struct rtrs_clt_ops *ops, - const char *sessname, + const char *pathname, const struct rtrs_addr *paths, size_t path_cnt, u16 port, size_t pdu_sz, u8 reconnect_delay_sec, s16 max_reconnect_attempts, u32 nr_poll_queues); =20 -void rtrs_clt_close(struct rtrs_clt *sess); +void rtrs_clt_close(struct rtrs_clt *clt_path); =20 enum wait_type { RTRS_PERMIT_NOWAIT =3D 0, --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6082C25B0E for ; Mon, 15 Aug 2022 19:21:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244728AbiHOTVz (ORCPT ); Mon, 15 Aug 2022 15:21:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345104AbiHOTSI (ORCPT ); Mon, 15 Aug 2022 15:18:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A258657205; Mon, 15 Aug 2022 11:39: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 D12D96117E; Mon, 15 Aug 2022 18:39:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD08BC433D7; Mon, 15 Aug 2022 18:39:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588775; bh=ASmaNClJYqNypx/Nm3kAFqVjw/VYK1EEuTTTDt/mqJE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ae4VpsGWsH+DvshS42U9szKSwWi7MUpFt0Isn/jwuDLN5ec9xiwfXUgbWVPk+mQT6 xlkCm8EV2DNNV+ui4TyfqNscoOJkI2DR0Zhwg9rOR0huBijxHJFmlcLbnxeh+e+v/n DDZuUDSwmBVL36tk/sI1sH+7i4pYhrl4xGEhhXzA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, jinpu.wang@ionos.com, Md Haris Iqbal , Jason Gunthorpe , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.15 510/779] RDMA/rtrs-clt: Replace list_next_or_null_rr_rcu with an inline function Date: Mon, 15 Aug 2022 20:02:34 +0200 Message-Id: <20220815180359.061708489@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Md Haris Iqbal [ Upstream commit c14adff285ad1bb8eefc5d8fc202ceb1f7e3a2f1 ] removes list_next_or_null_rr_rcu macro to fix below warnings. That macro is used only twice. CHECK:MACRO_ARG_REUSE: Macro argument reuse 'head' - possible side-effects? CHECK:MACRO_ARG_REUSE: Macro argument reuse 'ptr' - possible side-effects? CHECK:MACRO_ARG_REUSE: Macro argument reuse 'memb' - possible side-effects? Replaces that macro with an inline function. Fixes: 6a98d71daea1 ("RDMA/rtrs: client: main functionality") Cc: jinpu.wang@ionos.com Link: https://lore.kernel.org/r/20220712103113.617754-5-haris.iqbal@ionos.c= om Signed-off-by: Md Haris Iqbal Suggested-by: Jason Gunthorpe Signed-off-by: Jack Wang Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/infiniband/ulp/rtrs/rtrs-clt.c | 35 ++++++++++++-------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ul= p/rtrs/rtrs-clt.c index a46ef2821e36..9edbb309b96c 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c @@ -747,25 +747,25 @@ struct path_it { struct rtrs_clt_path *(*next_path)(struct path_it *it); }; =20 -/** - * list_next_or_null_rr_rcu - get next list element in round-robin fashion. +/* + * rtrs_clt_get_next_path_or_null - get clt path from the list or return N= ULL * @head: the head for the list. - * @ptr: the list head to take the next element from. - * @type: the type of the struct this is embedded in. - * @memb: the name of the list_head within the struct. + * @clt_path: The element to take the next clt_path from. * - * Next element returned in round-robin fashion, i.e. head will be skipped, + * Next clt path returned in round-robin fashion, i.e. head will be skippe= d, * but if list is observed as empty, NULL will be returned. * - * This primitive may safely run concurrently with the _rcu list-mutation + * This function may safely run concurrently with the _rcu list-mutation * primitives such as list_add_rcu() as long as it's guarded by rcu_read_l= ock(). */ -#define list_next_or_null_rr_rcu(head, ptr, type, memb) \ -({ \ - list_next_or_null_rcu(head, ptr, type, memb) ?: \ - list_next_or_null_rcu(head, READ_ONCE((ptr)->next), \ - type, memb); \ -}) +static inline struct rtrs_clt_path * +rtrs_clt_get_next_path_or_null(struct list_head *head, struct rtrs_clt_pat= h *clt_path) +{ + return list_next_or_null_rcu(head, &clt_path->s.entry, typeof(*clt_path),= s.entry) ?: + list_next_or_null_rcu(head, + READ_ONCE((&clt_path->s.entry)->next), + typeof(*clt_path), s.entry); +} =20 /** * get_next_path_rr() - Returns path in round-robin fashion. @@ -796,10 +796,8 @@ static struct rtrs_clt_path *get_next_path_rr(struct p= ath_it *it) path =3D list_first_or_null_rcu(&clt->paths_list, typeof(*path), s.entry); else - path =3D list_next_or_null_rr_rcu(&clt->paths_list, - &path->s.entry, - typeof(*path), - s.entry); + path =3D rtrs_clt_get_next_path_or_null(&clt->paths_list, path); + rcu_assign_pointer(*ppcpu_path, path); =20 return path; @@ -2267,8 +2265,7 @@ static void rtrs_clt_remove_path_from_arr(struct rtrs= _clt_path *clt_path) * removed. If @sess is the last element, then @next is NULL. */ rcu_read_lock(); - next =3D list_next_or_null_rr_rcu(&clt->paths_list, &clt_path->s.entry, - typeof(*next), s.entry); + next =3D rtrs_clt_get_next_path_or_null(&clt->paths_list, clt_path); rcu_read_unlock(); =20 /* --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3887C00140 for ; Mon, 15 Aug 2022 19:22:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243861AbiHOTW0 (ORCPT ); Mon, 15 Aug 2022 15:22:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345134AbiHOTSL (ORCPT ); Mon, 15 Aug 2022 15:18: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 5E0A057225; Mon, 15 Aug 2022 11:39:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 95FB7B8106C; Mon, 15 Aug 2022 18:39:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB971C433D7; Mon, 15 Aug 2022 18:39:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588778; bh=uRIcDpi4J9GEUAUfU38PwmHkAVgIHy+LmKqX+Q4ftWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DQUpxkcMMAkhMaRt9EhGSgTtCoCcFc1j4SGFe9ku+KNupGyPMxz5/uOOD9TlsyWj9 i/LARcs3Z+HS1SBJIN89Mz144iEU4r0J+8MDA8xjFRJLu1nJQbCnsg9Blp7jIvssih 8KAKXptvl4rbUAQFZNdZC6R+oicol7XjGAuONhXM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jianglei Nie , =?UTF-8?q?Michal=20Kalderon=C2=A0?= , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.15 511/779] RDMA/qedr: Fix potential memory leak in __qedr_alloc_mr() Date: Mon, 15 Aug 2022 20:02:35 +0200 Message-Id: <20220815180359.091906196@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jianglei Nie [ Upstream commit b3236a64ddd125a455ef5b5316c1b9051b732974 ] __qedr_alloc_mr() allocates a memory chunk for "mr->info.pbl_table" with init_mr_info(). When rdma_alloc_tid() and rdma_register_tid() fail, "mr" is released while "mr->info.pbl_table" is not released, which will lead to a memory leak. We should release the "mr->info.pbl_table" with qedr_free_pbl() when error occurs to fix the memory leak. Fixes: e0290cce6ac0 ("qedr: Add support for memory registeration verbs") Link: https://lore.kernel.org/r/20220714061505.2342759-1-niejianglei2021@16= 3.com Signed-off-by: Jianglei Nie Acked-by: Michal Kalderon=C2=A0 Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/infiniband/hw/qedr/verbs.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qed= r/verbs.c index 49dfedbc5665..bb0c2b93a34d 100644 --- a/drivers/infiniband/hw/qedr/verbs.c +++ b/drivers/infiniband/hw/qedr/verbs.c @@ -3093,7 +3093,7 @@ static struct qedr_mr *__qedr_alloc_mr(struct ib_pd *= ibpd, else DP_ERR(dev, "roce alloc tid returned error %d\n", rc); =20 - goto err0; + goto err1; } =20 /* Index only, 18 bit long, lkey =3D itid << 8 | key */ @@ -3117,7 +3117,7 @@ static struct qedr_mr *__qedr_alloc_mr(struct ib_pd *= ibpd, rc =3D dev->ops->rdma_register_tid(dev->rdma_ctx, &mr->hw_mr); if (rc) { DP_ERR(dev, "roce register tid returned an error %d\n", rc); - goto err1; + goto err2; } =20 mr->ibmr.lkey =3D mr->hw_mr.itid << 8 | mr->hw_mr.key; @@ -3126,8 +3126,10 @@ static struct qedr_mr *__qedr_alloc_mr(struct ib_pd = *ibpd, DP_DEBUG(dev, QEDR_MSG_MR, "alloc frmr: %x\n", mr->ibmr.lkey); return mr; =20 -err1: +err2: dev->ops->rdma_free_tid(dev->rdma_ctx, mr->hw_mr.itid); +err1: + qedr_free_pbl(dev, &mr->info.pbl_info, mr->info.pbl_table); err0: kfree(mr); return ERR_PTR(rc); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B7C0C25B08 for ; Mon, 15 Aug 2022 19:22:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245067AbiHOTWf (ORCPT ); Mon, 15 Aug 2022 15:22:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343790AbiHOTSR (ORCPT ); Mon, 15 Aug 2022 15:18:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FD7A5723A; Mon, 15 Aug 2022 11:39: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 8335061149; Mon, 15 Aug 2022 18:39:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09B30C433D6; Mon, 15 Aug 2022 18:39:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588781; bh=29g+cXVqocYC8eq91Vv4APTPdgmTmZ6/Ot/tHBP7O9s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uNQ7Pgj+w1CqchMNpsYLXQVe+0Z94D2USih8mZJfwB5E++eqHfFP16S30jWDJMjld KmPlTozRUbhDtK90n6i1JFW2ShFqektq6SmobhFXqM0j0/MPlzFBaqgAce2PKROtE4 9KLJFMDx/qwBFByiJzd3pqz72iNmoSgpQWOOBwGc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Haoyue Xu , Wenpeng Liang , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.15 512/779] RDMA/hns: Fix incorrect clearing of interrupt status register Date: Mon, 15 Aug 2022 20:02:36 +0200 Message-Id: <20220815180359.130831478@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Haoyue Xu [ Upstream commit ecb4db5c3590aa956b4b2c352081a5b632d1f9f9 ] The driver will clear all the interrupts in the same area when the driver handles the interrupt of type AEQ overflow. It should only set the interrupt status bit of type AEQ overflow. Fixes: a5073d6054f7 ("RDMA/hns: Add eq support of hip08") Link: https://lore.kernel.org/r/20220714134353.16700-4-liangwenpeng@huawei.= com Signed-off-by: Haoyue Xu Signed-off-by: Wenpeng Liang Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniban= d/hw/hns/hns_roce_hw_v2.c index bf01210c56c2..1dbad159f379 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c @@ -5854,8 +5854,8 @@ static irqreturn_t hns_roce_v2_msix_interrupt_abn(int= irq, void *dev_id) =20 dev_err(dev, "AEQ overflow!\n"); =20 - int_st |=3D 1 << HNS_ROCE_V2_VF_INT_ST_AEQ_OVERFLOW_S; - roce_write(hr_dev, ROCEE_VF_ABN_INT_ST_REG, int_st); + roce_write(hr_dev, ROCEE_VF_ABN_INT_ST_REG, + 1 << HNS_ROCE_V2_VF_INT_ST_AEQ_OVERFLOW_S); =20 /* Set reset level for reset_event() */ if (ops->set_default_reset_request) --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2EB69C00140 for ; Mon, 15 Aug 2022 19:22:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243848AbiHOTWp (ORCPT ); Mon, 15 Aug 2022 15:22:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343877AbiHOTS3 (ORCPT ); Mon, 15 Aug 2022 15:18: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 A46DC3D5A8; Mon, 15 Aug 2022 11:39: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 9909161124; Mon, 15 Aug 2022 18:39:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 90799C433D6; Mon, 15 Aug 2022 18:39:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588785; bh=0r5UkRXI7xlArzqRPjOlHYSsnq34Y04hve0Lm1/L72c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t0aGKtMJqrBNZcgtY1C6lTftFQFHym9aoc64LerXGrSts5HmyMxXUmIqhOfjm42BI 7gG05j30ZsxU9tx7b0CSJiM9gQDNJKZ+ZFj+GkME+gqw810B+TPnQTatJKNDQXtTNi zOJcXOP7e7hwrf92YVh1XzMrNwWM7r6QwHOFfAC8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cheng Xu , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.15 513/779] RDMA/siw: Fix duplicated reported IW_CM_EVENT_CONNECT_REPLY event Date: Mon, 15 Aug 2022 20:02:37 +0200 Message-Id: <20220815180359.175400445@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Cheng Xu [ Upstream commit 3056fc6c32e613b760422b94c7617ac9a24a4721 ] If siw_recv_mpa_rr returns -EAGAIN, it means that the MPA reply hasn't been received completely, and should not report IW_CM_EVENT_CONNECT_REPLY in this case. This may trigger a call trace in iw_cm. A simple way to trigger this: server: ib_send_lat client: ib_send_lat -R The call trace looks like this: kernel BUG at drivers/infiniband/core/iwcm.c:894! invalid opcode: 0000 [#1] PREEMPT SMP NOPTI <...> Workqueue: iw_cm_wq cm_work_handler [iw_cm] Call Trace: cm_work_handler+0x1dd/0x370 [iw_cm] process_one_work+0x1e2/0x3b0 worker_thread+0x49/0x2e0 ? rescuer_thread+0x370/0x370 kthread+0xe5/0x110 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x1f/0x30 Fixes: 6c52fdc244b5 ("rdma/siw: connection management") Link: https://lore.kernel.org/r/dae34b5fd5c2ea2bd9744812c1d2653a34a94c67.16= 57706960.git.chengyou@linux.alibaba.com Signed-off-by: Cheng Xu Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/infiniband/sw/siw/siw_cm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/sw/siw/siw_cm.c b/drivers/infiniband/sw/siw= /siw_cm.c index 18a64ccbb0e5..69d639cab898 100644 --- a/drivers/infiniband/sw/siw/siw_cm.c +++ b/drivers/infiniband/sw/siw/siw_cm.c @@ -725,11 +725,11 @@ static int siw_proc_mpareply(struct siw_cep *cep) enum mpa_v2_ctrl mpa_p2p_mode =3D MPA_V2_RDMA_NO_RTR; =20 rv =3D siw_recv_mpa_rr(cep); - if (rv !=3D -EAGAIN) - siw_cancel_mpatimer(cep); if (rv) goto out_err; =20 + siw_cancel_mpatimer(cep); + rep =3D &cep->mpa.hdr; =20 if (__mpa_rr_revision(rep->params.bits) > MPA_REVISION_2) { @@ -895,7 +895,8 @@ static int siw_proc_mpareply(struct siw_cep *cep) } =20 out_err: - siw_cm_upcall(cep, IW_CM_EVENT_CONNECT_REPLY, -EINVAL); + if (rv !=3D -EAGAIN) + siw_cm_upcall(cep, IW_CM_EVENT_CONNECT_REPLY, -EINVAL); =20 return rv; } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3125C00140 for ; Mon, 15 Aug 2022 19:22:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245437AbiHOTWx (ORCPT ); Mon, 15 Aug 2022 15:22:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344048AbiHOTTF (ORCPT ); Mon, 15 Aug 2022 15:19: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 72F5E5726C; Mon, 15 Aug 2022 11:39: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 BC42861120; Mon, 15 Aug 2022 18:39:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A583AC433D6; Mon, 15 Aug 2022 18:39:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588788; bh=tIJ6+TQwP2JrUVel6DnILhwHXC3k3fA21UUcmj6ctdo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yxgKrLKkX+nCUIRwcAL2kcLw0iKjM5yYPNXWH49PyAknAu1D7tOUVcDY7TFrnzvSk efJVvgHJjOmKINUKpsrY0IxN2AsRJWQbIfMs5ghXBRjic6UqtmhIqMMAroM2QwC1kl Dk4jLM8e09HeDb0SBMb6ZkJMp3PSYzrkbTBV49gs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Douglas Anderson , Gwendal Grignou , Jonathan Cameron , Sasha Levin Subject: [PATCH 5.15 514/779] iio: cros: Register FIFO callback after sensor is registered Date: Mon, 15 Aug 2022 20:02:38 +0200 Message-Id: <20220815180359.220571836@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Gwendal Grignou [ Upstream commit 0b4ae3f6d1210c11f9baf159009c7227eacf90f2 ] Instead of registering callback to process sensor events right at initialization time, wait for the sensor to be register in the iio subsystem. Events can come at probe time (in case the kernel rebooted abruptly without switching the sensor off for instance), and be sent to IIO core before the sensor is fully registered. Fixes: aa984f1ba4a4 ("iio: cros_ec: Register to cros_ec_sensorhub when EC s= upports FIFO") Reported-by: Douglas Anderson Signed-off-by: Gwendal Grignou Reviewed-by: Douglas Anderson Link: https://lore.kernel.org/r/20220711144716.642617-1-gwendal@chromium.org Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/iio/accel/cros_ec_accel_legacy.c | 4 +- .../cros_ec_sensors/cros_ec_lid_angle.c | 4 +- .../common/cros_ec_sensors/cros_ec_sensors.c | 6 +- .../cros_ec_sensors/cros_ec_sensors_core.c | 58 ++++++++++++++----- drivers/iio/light/cros_ec_light_prox.c | 6 +- drivers/iio/pressure/cros_ec_baro.c | 6 +- .../linux/iio/common/cros_ec_sensors_core.h | 7 ++- 7 files changed, 60 insertions(+), 31 deletions(-) diff --git a/drivers/iio/accel/cros_ec_accel_legacy.c b/drivers/iio/accel/c= ros_ec_accel_legacy.c index b6f3471b62dc..3b77fded2dc0 100644 --- a/drivers/iio/accel/cros_ec_accel_legacy.c +++ b/drivers/iio/accel/cros_ec_accel_legacy.c @@ -215,7 +215,7 @@ static int cros_ec_accel_legacy_probe(struct platform_d= evice *pdev) return -ENOMEM; =20 ret =3D cros_ec_sensors_core_init(pdev, indio_dev, true, - cros_ec_sensors_capture, NULL); + cros_ec_sensors_capture); if (ret) return ret; =20 @@ -235,7 +235,7 @@ static int cros_ec_accel_legacy_probe(struct platform_d= evice *pdev) state->sign[CROS_EC_SENSOR_Z] =3D -1; } =20 - return devm_iio_device_register(dev, indio_dev); + return cros_ec_sensors_core_register(dev, indio_dev, NULL); } =20 static struct platform_driver cros_ec_accel_platform_driver =3D { diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_lid_angle.c b/drive= rs/iio/common/cros_ec_sensors/cros_ec_lid_angle.c index af801e203623..02d3cf36acb0 100644 --- a/drivers/iio/common/cros_ec_sensors/cros_ec_lid_angle.c +++ b/drivers/iio/common/cros_ec_sensors/cros_ec_lid_angle.c @@ -97,7 +97,7 @@ static int cros_ec_lid_angle_probe(struct platform_device= *pdev) if (!indio_dev) return -ENOMEM; =20 - ret =3D cros_ec_sensors_core_init(pdev, indio_dev, false, NULL, NULL); + ret =3D cros_ec_sensors_core_init(pdev, indio_dev, false, NULL); if (ret) return ret; =20 @@ -113,7 +113,7 @@ static int cros_ec_lid_angle_probe(struct platform_devi= ce *pdev) if (ret) return ret; =20 - return devm_iio_device_register(dev, indio_dev); + return cros_ec_sensors_core_register(dev, indio_dev, NULL); } =20 static const struct platform_device_id cros_ec_lid_angle_ids[] =3D { diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c b/drivers= /iio/common/cros_ec_sensors/cros_ec_sensors.c index 376a5b30010a..5cce34fdff02 100644 --- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c +++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c @@ -235,8 +235,7 @@ static int cros_ec_sensors_probe(struct platform_device= *pdev) return -ENOMEM; =20 ret =3D cros_ec_sensors_core_init(pdev, indio_dev, true, - cros_ec_sensors_capture, - cros_ec_sensors_push_data); + cros_ec_sensors_capture); if (ret) return ret; =20 @@ -297,7 +296,8 @@ static int cros_ec_sensors_probe(struct platform_device= *pdev) else state->core.read_ec_sensors_data =3D cros_ec_sensors_read_cmd; =20 - return devm_iio_device_register(dev, indio_dev); + return cros_ec_sensors_core_register(dev, indio_dev, + cros_ec_sensors_push_data); } =20 static const struct platform_device_id cros_ec_sensors_ids[] =3D { diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c b/dr= ivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c index 28bde13003b7..b0c1dc8cc4c5 100644 --- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c +++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c @@ -234,21 +234,18 @@ static void cros_ec_sensors_core_clean(void *arg) =20 /** * cros_ec_sensors_core_init() - basic initialization of the core structure - * @pdev: platform device created for the sensors + * @pdev: platform device created for the sensor * @indio_dev: iio device structure of the device * @physical_device: true if the device refers to a physical device * @trigger_capture: function pointer to call buffer is triggered, * for backward compatibility. - * @push_data: function to call when cros_ec_sensorhub receives - * a sample for that sensor. * * Return: 0 on success, -errno on failure. */ int cros_ec_sensors_core_init(struct platform_device *pdev, struct iio_dev *indio_dev, bool physical_device, - cros_ec_sensors_capture_t trigger_capture, - cros_ec_sensorhub_push_data_cb_t push_data) + cros_ec_sensors_capture_t trigger_capture) { struct device *dev =3D &pdev->dev; struct cros_ec_sensors_core_state *state =3D iio_priv(indio_dev); @@ -339,17 +336,6 @@ int cros_ec_sensors_core_init(struct platform_device *= pdev, if (ret) return ret; =20 - ret =3D cros_ec_sensorhub_register_push_data( - sensor_hub, sensor_platform->sensor_num, - indio_dev, push_data); - if (ret) - return ret; - - ret =3D devm_add_action_or_reset( - dev, cros_ec_sensors_core_clean, pdev); - if (ret) - return ret; - /* Timestamp coming from FIFO are in ns since boot. */ ret =3D iio_device_set_clock(indio_dev, CLOCK_BOOTTIME); if (ret) @@ -371,6 +357,46 @@ int cros_ec_sensors_core_init(struct platform_device *= pdev, } EXPORT_SYMBOL_GPL(cros_ec_sensors_core_init); =20 +/** + * cros_ec_sensors_core_register() - Register callback to FIFO and IIO when + * sensor is ready. + * It must be called at the end of the sensor probe routine. + * @dev: device created for the sensor + * @indio_dev: iio device structure of the device + * @push_data: function to call when cros_ec_sensorhub receives + * a sample for that sensor. + * + * Return: 0 on success, -errno on failure. + */ +int cros_ec_sensors_core_register(struct device *dev, + struct iio_dev *indio_dev, + cros_ec_sensorhub_push_data_cb_t push_data) +{ + struct cros_ec_sensor_platform *sensor_platform =3D dev_get_platdata(dev); + struct cros_ec_sensorhub *sensor_hub =3D dev_get_drvdata(dev->parent); + struct platform_device *pdev =3D to_platform_device(dev); + struct cros_ec_dev *ec =3D sensor_hub->ec; + int ret; + + ret =3D devm_iio_device_register(dev, indio_dev); + if (ret) + return ret; + + if (!push_data || + !cros_ec_check_features(ec, EC_FEATURE_MOTION_SENSE_FIFO)) + return 0; + + ret =3D cros_ec_sensorhub_register_push_data( + sensor_hub, sensor_platform->sensor_num, + indio_dev, push_data); + if (ret) + return ret; + + return devm_add_action_or_reset( + dev, cros_ec_sensors_core_clean, pdev); +} +EXPORT_SYMBOL_GPL(cros_ec_sensors_core_register); + /** * cros_ec_motion_send_host_cmd() - send motion sense host command * @state: pointer to state information for device diff --git a/drivers/iio/light/cros_ec_light_prox.c b/drivers/iio/light/cro= s_ec_light_prox.c index de472f23d1cb..16b893bae388 100644 --- a/drivers/iio/light/cros_ec_light_prox.c +++ b/drivers/iio/light/cros_ec_light_prox.c @@ -181,8 +181,7 @@ static int cros_ec_light_prox_probe(struct platform_dev= ice *pdev) return -ENOMEM; =20 ret =3D cros_ec_sensors_core_init(pdev, indio_dev, true, - cros_ec_sensors_capture, - cros_ec_sensors_push_data); + cros_ec_sensors_capture); if (ret) return ret; =20 @@ -240,7 +239,8 @@ static int cros_ec_light_prox_probe(struct platform_dev= ice *pdev) =20 state->core.read_ec_sensors_data =3D cros_ec_sensors_read_cmd; =20 - return devm_iio_device_register(dev, indio_dev); + return cros_ec_sensors_core_register(dev, indio_dev, + cros_ec_sensors_push_data); } =20 static const struct platform_device_id cros_ec_light_prox_ids[] =3D { diff --git a/drivers/iio/pressure/cros_ec_baro.c b/drivers/iio/pressure/cro= s_ec_baro.c index 2f882e109423..0511edbf868d 100644 --- a/drivers/iio/pressure/cros_ec_baro.c +++ b/drivers/iio/pressure/cros_ec_baro.c @@ -138,8 +138,7 @@ static int cros_ec_baro_probe(struct platform_device *p= dev) return -ENOMEM; =20 ret =3D cros_ec_sensors_core_init(pdev, indio_dev, true, - cros_ec_sensors_capture, - cros_ec_sensors_push_data); + cros_ec_sensors_capture); if (ret) return ret; =20 @@ -186,7 +185,8 @@ static int cros_ec_baro_probe(struct platform_device *p= dev) =20 state->core.read_ec_sensors_data =3D cros_ec_sensors_read_cmd; =20 - return devm_iio_device_register(dev, indio_dev); + return cros_ec_sensors_core_register(dev, indio_dev, + cros_ec_sensors_push_data); } =20 static const struct platform_device_id cros_ec_baro_ids[] =3D { diff --git a/include/linux/iio/common/cros_ec_sensors_core.h b/include/linu= x/iio/common/cros_ec_sensors_core.h index c582e1a14232..7b5dbd749995 100644 --- a/include/linux/iio/common/cros_ec_sensors_core.h +++ b/include/linux/iio/common/cros_ec_sensors_core.h @@ -95,8 +95,11 @@ int cros_ec_sensors_read_cmd(struct iio_dev *indio_dev, = unsigned long scan_mask, struct platform_device; int cros_ec_sensors_core_init(struct platform_device *pdev, struct iio_dev *indio_dev, bool physical_device, - cros_ec_sensors_capture_t trigger_capture, - cros_ec_sensorhub_push_data_cb_t push_data); + cros_ec_sensors_capture_t trigger_capture); + +int cros_ec_sensors_core_register(struct device *dev, + struct iio_dev *indio_dev, + cros_ec_sensorhub_push_data_cb_t push_data); =20 irqreturn_t cros_ec_sensors_capture(int irq, void *p); int cros_ec_sensors_push_data(struct iio_dev *indio_dev, --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4462AC00140 for ; Mon, 15 Aug 2022 19:23:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245478AbiHOTXB (ORCPT ); Mon, 15 Aug 2022 15:23:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344097AbiHOTTK (ORCPT ); Mon, 15 Aug 2022 15:19:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EDCB58B4A; Mon, 15 Aug 2022 11:39: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 D18EC61124; Mon, 15 Aug 2022 18:39:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0266C433D6; Mon, 15 Aug 2022 18:39:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588791; bh=gYJQV0CYwkY4S0gra6WnEjPpMfpNO/F+S1Ngd2WqFcI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pc+mVIv6l6IuM6IMdmGBnNZxSy6Hmb9uPmYk+SSYWTiUXaJhu/o0Gec+7A/aGyNyw HYZcFjnVdRRmXqGvQYRkmrRDlOIWrI1PecUY+Vz3DHS8p9EJtsVcfaAGXy+/zygGeU VlZKb8DSo8CnQTHneS2MGrbscCWZYrMOeC4ntSYI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bryan ODonoghue , Konrad Dybcio , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 515/779] clk: qcom: gcc-msm8939: Fix weird field spacing in ftbl_gcc_camss_cci_clk Date: Mon, 15 Aug 2022 20:02:39 +0200 Message-Id: <20220815180359.266599719@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bryan O'Donoghue [ Upstream commit 2bc308ebc453ba22f3f120f777b9ac48f973ee80 ] Adding a new item to this frequency table I see the existing indentation is incorrect. Fixes: 1664014e4679 ("clk: qcom: gcc-msm8939: Add MSM8939 Generic Clock Con= troller") Signed-off-by: Bryan O'Donoghue Reviewed-by: Konrad Dybcio Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220712125922.3461675-2-bryan.odonoghue@li= naro.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/clk/qcom/gcc-msm8939.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/clk/qcom/gcc-msm8939.c b/drivers/clk/qcom/gcc-msm8939.c index c7377ec0f423..de0022e5450d 100644 --- a/drivers/clk/qcom/gcc-msm8939.c +++ b/drivers/clk/qcom/gcc-msm8939.c @@ -1014,7 +1014,7 @@ static struct clk_rcg2 blsp1_uart2_apps_clk_src =3D { }; =20 static const struct freq_tbl ftbl_gcc_camss_cci_clk[] =3D { - F(19200000, P_XO, 1, 0, 0), + F(19200000, P_XO, 1, 0, 0), { } }; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D472BC00140 for ; Mon, 15 Aug 2022 19:23:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242118AbiHOTXH (ORCPT ); Mon, 15 Aug 2022 15:23:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241010AbiHOTTp (ORCPT ); Mon, 15 Aug 2022 15:19:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07D6E58B5D; Mon, 15 Aug 2022 11:39: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 DC54C61120; Mon, 15 Aug 2022 18:39:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC836C433C1; Mon, 15 Aug 2022 18:39:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588794; bh=NnNp7DWWOboATNhkynY0ZdcfWWZJZrnmvFmpd0g1rf4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xDjWHVe3WABOublAsqbMQnnPBrk//L2ECQ5TLhA07jqz8h/8/IrIXC+qFuduO+FUQ u4Zwzp9iGFcOk9Z4mGP26wtBRW9MsG1V1oFJL3oEYMvXc8bl2J9vZBuCcBUmTEOaIF AuI7y6Oj27nrMyvSipaDo1CE1DqB0iX5dLDRFXMM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jianglei Nie , Dennis Dalessandro , Leon Romanovsky , Sasha Levin Subject: [PATCH 5.15 516/779] RDMA/hfi1: fix potential memory leak in setup_base_ctxt() Date: Mon, 15 Aug 2022 20:02:40 +0200 Message-Id: <20220815180359.314220466@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jianglei Nie [ Upstream commit aa2a1df3a2c85f855af7d54466ac10bd48645d63 ] setup_base_ctxt() allocates a memory chunk for uctxt->groups with hfi1_alloc_ctxt_rcv_groups(). When init_user_ctxt() fails, uctxt->groups is not released, which will lead to a memory leak. We should release the uctxt->groups with hfi1_free_ctxt_rcv_groups() when init_user_ctxt() fails. Fixes: e87473bc1b6c ("IB/hfi1: Only set fd pointer when base context is com= pletely initialized") Link: https://lore.kernel.org/r/20220711070718.2318320-1-niejianglei2021@16= 3.com Signed-off-by: Jianglei Nie Acked-by: Dennis Dalessandro Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/infiniband/hw/hfi1/file_ops.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/hfi1/file_ops.c b/drivers/infiniband/hw/= hfi1/file_ops.c index 3ebdd42fec36..686d170a5947 100644 --- a/drivers/infiniband/hw/hfi1/file_ops.c +++ b/drivers/infiniband/hw/hfi1/file_ops.c @@ -1179,8 +1179,10 @@ static int setup_base_ctxt(struct hfi1_filedata *fd, goto done; =20 ret =3D init_user_ctxt(fd, uctxt); - if (ret) + if (ret) { + hfi1_free_ctxt_rcv_groups(uctxt); goto done; + } =20 user_init(uctxt); =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 17394C00140 for ; Mon, 15 Aug 2022 19:23:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245181AbiHOTXM (ORCPT ); Mon, 15 Aug 2022 15:23:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344191AbiHOTUo (ORCPT ); Mon, 15 Aug 2022 15:20:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD0165924F; Mon, 15 Aug 2022 11:40: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 D5085B81081; Mon, 15 Aug 2022 18:39:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19A66C433C1; Mon, 15 Aug 2022 18:39:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588797; bh=eVNSFQCCgEUAUm7PFi237TQ1aoM/mo3n2c1mz17sZIE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w9LR3vjQ51ry9AkiyDPq/L90zp6zdEL4mMuBP4znzD3bPsPwC5FifEHD2Hai2eRJG Uk6uVNeT0yaxUuQUiAurTEQgJo9DH4hME7DrrVeuYkcOJJDEixnPUWh3Yl34In67m/ ARXe8mOW9awYLhemQdnw5RlW1P0gjyrc6ABd4GCQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 5.15 517/779] gpio: gpiolib-of: Fix refcount bugs in of_mm_gpiochip_add_data() Date: Mon, 15 Aug 2022 20:02:41 +0200 Message-Id: <20220815180359.360832783@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 5d07a692f9562f9c06e62cce369e9dd108173a0f ] We should use of_node_get() when a new reference of device_node is created. It is noted that the old reference stored in 'mm_gc->gc.of_node' should also be decreased. This patch is based on the fact that there is a call site in function 'qe_add_gpiochips()' of src file 'drivers\soc\fsl\qe\gpio.c'. In this function, of_mm_gpiochip_add_data() is contained in an iteration of for_each_compatible_node() which will automatically increase and decrease the refcount. So we need additional of_node_get() for the reference escape in of_mm_gpiochip_add_data(). Fixes: a19e3da5bc5f ("of/gpio: Kill of_gpio_chip and add members directly t= o gpio_chip") Signed-off-by: Liang He Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpio/gpiolib-of.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index 66e434f59f60..7a96eb626a08 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -863,7 +863,8 @@ int of_mm_gpiochip_add_data(struct device_node *np, if (mm_gc->save_regs) mm_gc->save_regs(mm_gc); =20 - mm_gc->gc.of_node =3D np; + of_node_put(mm_gc->gc.of_node); + mm_gc->gc.of_node =3D of_node_get(np); =20 ret =3D gpiochip_add_data(gc, data); if (ret) @@ -871,6 +872,7 @@ int of_mm_gpiochip_add_data(struct device_node *np, =20 return 0; err2: + of_node_put(np); iounmap(mm_gc->regs); err1: kfree(gc->label); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7AA23C00140 for ; Mon, 15 Aug 2022 19:23:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245420AbiHOTX2 (ORCPT ); Mon, 15 Aug 2022 15:23:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344259AbiHOTUs (ORCPT ); Mon, 15 Aug 2022 15:20:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C169E59272; Mon, 15 Aug 2022 11:40: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 6D40D611C0; Mon, 15 Aug 2022 18:40:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55B6AC433C1; Mon, 15 Aug 2022 18:40:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588803; bh=AcJrX1xUykEM0PUZFgTpse9dGF07x7CuOQftmr59ePw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dXS6ic29dQJ7WOsGdnlgqqaxbXrhr107upUiwAYAWyV92ryyzFE6+SvzXf6YUcvdY GGbypMxF6ITL0KKAqTktFFGo6wBExa6kxPRpcqcH1BITXMzonG9xf6Wps8tdjuKT48 O0sOR61UtmasABEkw5FDgdHnl7bmx5qLVhnTsoIQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Harshit Mogalapalli , Jiri Kosina , Sasha Levin Subject: [PATCH 5.15 518/779] HID: mcp2221: prevent a buffer overflow in mcp_smbus_write() Date: Mon, 15 Aug 2022 20:02:42 +0200 Message-Id: <20220815180359.400204781@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Harshit Mogalapalli [ Upstream commit 62ac2473553a00229e67bdf3cb023b62cf7f5a9a ] Smatch Warning: drivers/hid/hid-mcp2221.c:388 mcp_smbus_write() error: __memcpy() '&mcp->txbuf[5]' too small (59 vs 255) drivers/hid/hid-mcp2221.c:388 mcp_smbus_write() error: __memcpy() 'buf' too small (34 vs 255) The 'len' variable can take a value between 0-255 as it can come from data->block[0] and it is user data. So add an bound check to prevent a buffer overflow in memcpy(). Fixes: 67a95c21463d ("HID: mcp2221: add usb to i2c-smbus host bridge") Signed-off-by: Harshit Mogalapalli Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/hid/hid-mcp2221.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/hid/hid-mcp2221.c b/drivers/hid/hid-mcp2221.c index 4211b9839209..de52e9f7bb8c 100644 --- a/drivers/hid/hid-mcp2221.c +++ b/drivers/hid/hid-mcp2221.c @@ -385,6 +385,9 @@ static int mcp_smbus_write(struct mcp2221 *mcp, u16 add= r, data_len =3D 7; break; default: + if (len > I2C_SMBUS_BLOCK_MAX) + return -EINVAL; + memcpy(&mcp->txbuf[5], buf, len); data_len =3D len + 5; } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1FFFC00140 for ; Mon, 15 Aug 2022 19:23:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245563AbiHOTXd (ORCPT ); Mon, 15 Aug 2022 15:23:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344350AbiHOTVB (ORCPT ); Mon, 15 Aug 2022 15:21:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C5E6857241; Mon, 15 Aug 2022 11:40: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 6ACCE6117E; Mon, 15 Aug 2022 18:40:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44A35C433D6; Mon, 15 Aug 2022 18:40:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588807; bh=MqgJVKreUtjvSuyszG3RqV1no/q+gQLMEaab0NnhavA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ONp/c1Tc83ovhMCKEJTx6bn3nwdcBNXh+HTK6SgFdMsO07SDpDVY480kkGVjLwPcv 1oesb29wG7NtSiZBgHLnkKQ0spSiR/0ZMp6AQhTx8zCYbyzgZT2V7uyGsRMwMLTKid TQZpCq6MfTB4xZZAyDnfswPQeCawudAzXezpwars= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Basavaraj Natikar , Jiri Kosina , Sasha Levin Subject: [PATCH 5.15 519/779] HID: amd_sfh: Add NULL check for hid device Date: Mon, 15 Aug 2022 20:02:43 +0200 Message-Id: <20220815180359.436246090@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Basavaraj Natikar [ Upstream commit 06aa2a43c307cf4096f422dcb575e5d2913e528f ] On removal of hid device during SFH set report may cause NULL pointer exception. Hence add NULL check for hid device before accessing. Fixes: 4b2c53d93a4b ("SFH:Transport Driver to add support of AMD Sensor Fus= ion Hub (SFH)") Signed-off-by: Basavaraj Natikar Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/hid/amd-sfh-hid/amd_sfh_hid.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_hid.c b/drivers/hid/amd-sfh-hi= d/amd_sfh_hid.c index a4bda2ac713e..3b0615c6aecf 100644 --- a/drivers/hid/amd-sfh-hid/amd_sfh_hid.c +++ b/drivers/hid/amd-sfh-hid/amd_sfh_hid.c @@ -98,11 +98,15 @@ static int amdtp_wait_for_response(struct hid_device *h= id) =20 void amdtp_hid_wakeup(struct hid_device *hid) { - struct amdtp_hid_data *hid_data =3D hid->driver_data; - struct amdtp_cl_data *cli_data =3D hid_data->cli_data; + struct amdtp_hid_data *hid_data; + struct amdtp_cl_data *cli_data; =20 - cli_data->request_done[cli_data->cur_hid_dev] =3D true; - wake_up_interruptible(&hid_data->hid_wait); + if (hid) { + hid_data =3D hid->driver_data; + cli_data =3D hid_data->cli_data; + cli_data->request_done[cli_data->cur_hid_dev] =3D true; + wake_up_interruptible(&hid_data->hid_wait); + } } =20 static struct hid_ll_driver amdtp_hid_ll_driver =3D { --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8404C00140 for ; Mon, 15 Aug 2022 19:23:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241518AbiHOTXo (ORCPT ); Mon, 15 Aug 2022 15:23:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344393AbiHOTVF (ORCPT ); Mon, 15 Aug 2022 15:21: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 AFD1C5A16C; Mon, 15 Aug 2022 11:40: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 99B6161143; Mon, 15 Aug 2022 18:40:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69E84C433C1; Mon, 15 Aug 2022 18:40:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588811; bh=dnDxbrsHDl7j52sf7NppzBaeDhtDkuLyAP/XkSnlv1s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k9l/dmW0gflAk6RD0qqJHbvQc768O5lbz/kY4WHhPYn5ZFFbgH6/MU95MqMRn3K54 +YSvgRTyW80nEQ8uhEI7WhGP9DR8BIJkalkx0jEja2ye5Zx5WILbieF6y2fGFjJW1a sQ2MhiZuiJLarbVzxZBDYEzBFW6WJ7BmBcVw+cus= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Fabio Estevam , Vinod Koul , Sasha Levin Subject: [PATCH 5.15 520/779] dmaengine: imx-dma: Cast of_device_get_match_data() with (uintptr_t) Date: Mon, 15 Aug 2022 20:02:44 +0200 Message-Id: <20220815180359.474639037@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 c3266ee185b59e5aab3e0f982e5b7f95d31555a7 ] Change the of_device_get_match_data() cast to (uintptr_t) to silence the following clang warning: drivers/dma/imx-dma.c:1048:20: warning: cast to smaller integer type 'enum = imx_dma_type' from 'const void *' [-Wvoid-pointer-to-enum-cast] Reported-by: kernel test robot Fixes: 0ab785c894e6 ("dmaengine: imx-dma: Remove unused .id_table") Signed-off-by: Fabio Estevam Link: https://lore.kernel.org/r/20220706111327.940764-1-festevam@gmail.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/dma/imx-dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c index 2ddc31e64db0..da31e73d24d4 100644 --- a/drivers/dma/imx-dma.c +++ b/drivers/dma/imx-dma.c @@ -1047,7 +1047,7 @@ static int __init imxdma_probe(struct platform_device= *pdev) return -ENOMEM; =20 imxdma->dev =3D &pdev->dev; - imxdma->devtype =3D (enum imx_dma_type)of_device_get_match_data(&pdev->de= v); + imxdma->devtype =3D (uintptr_t)of_device_get_match_data(&pdev->dev); =20 res =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); imxdma->base =3D devm_ioremap_resource(&pdev->dev, res); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98E04C00140 for ; Mon, 15 Aug 2022 19:23:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245594AbiHOTXu (ORCPT ); Mon, 15 Aug 2022 15:23:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344499AbiHOTVQ (ORCPT ); Mon, 15 Aug 2022 15:21:16 -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 F0E58B77; Mon, 15 Aug 2022 11:40: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 30713B81082; Mon, 15 Aug 2022 18:40:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C69DC433B5; Mon, 15 Aug 2022 18:40:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588813; bh=sl4Fi1GtVI3xilBeMMiFXxAxo/7l7eg0v2oFNV/ihkA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TyZ0HKj4cteyi7NuonNcqxXVZndXUp8t0E4Fa0E/G3kFhnY9AZKdaaNzKCH6bHoom njvzUnbwEyObiPjWbAEl43Hbx5h7gRAJjqPTs4GcIwteTUyJLvSlJWYm+MtKxjQWvw fyKjl17/kVPYyfd7eb0kObVqVyV3PQztSirFkPf0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Ogness , Petr Mladek , Sasha Levin Subject: [PATCH 5.15 521/779] scripts/gdb: lx-dmesg: read records individually Date: Mon, 15 Aug 2022 20:02:45 +0200 Message-Id: <20220815180359.514327692@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: John Ogness [ Upstream commit deaee2704a157dfcca77301ddaa10c62a9840952 ] For the gdb command lx-dmesg, the entire descriptor, info, and text data regions are read into memory before printing any records. For large kernel log buffers, this not only causes a huge delay before seeing any records, but it may also lead to python errors of too much memory allocation. Rather than reading in all these regions in advance, read them as needed and only read the regions for the particular record that is being printed. The gdb macro "dmesg" in Documentation/admin-guide/kdump/gdbmacros.txt already prints out the kernel log buffer like this. Signed-off-by: John Ogness Signed-off-by: Petr Mladek Link: https://lore.kernel.org/r/874k79c3a9.fsf@jogness.linutronix.de Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- scripts/gdb/linux/dmesg.py | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/scripts/gdb/linux/dmesg.py b/scripts/gdb/linux/dmesg.py index a92c55bd8de5..d5983cf3db7d 100644 --- a/scripts/gdb/linux/dmesg.py +++ b/scripts/gdb/linux/dmesg.py @@ -44,19 +44,17 @@ class LxDmesg(gdb.Command): sz =3D prb_desc_ring_type.get_type().sizeof desc_ring =3D utils.read_memoryview(inf, addr, sz).tobytes() =20 - # read in descriptor array + # read in descriptor count, size, and address off =3D prb_desc_ring_type.get_type()['count_bits'].bitpos // 8 desc_ring_count =3D 1 << utils.read_u32(desc_ring, off) desc_sz =3D prb_desc_type.get_type().sizeof off =3D prb_desc_ring_type.get_type()['descs'].bitpos // 8 - addr =3D utils.read_ulong(desc_ring, off) - descs =3D utils.read_memoryview(inf, addr, desc_sz * desc_ring_cou= nt).tobytes() + desc_addr =3D utils.read_ulong(desc_ring, off) =20 - # read in info array + # read in info size and address info_sz =3D printk_info_type.get_type().sizeof off =3D prb_desc_ring_type.get_type()['infos'].bitpos // 8 - addr =3D utils.read_ulong(desc_ring, off) - infos =3D utils.read_memoryview(inf, addr, info_sz * desc_ring_cou= nt).tobytes() + info_addr =3D utils.read_ulong(desc_ring, off) =20 # read in text data ring structure off =3D printk_ringbuffer_type.get_type()['text_data_ring'].bitpos= // 8 @@ -64,12 +62,11 @@ class LxDmesg(gdb.Command): sz =3D prb_data_ring_type.get_type().sizeof text_data_ring =3D utils.read_memoryview(inf, addr, sz).tobytes() =20 - # read in text data + # read in text data size and address off =3D prb_data_ring_type.get_type()['size_bits'].bitpos // 8 text_data_sz =3D 1 << utils.read_u32(text_data_ring, off) off =3D prb_data_ring_type.get_type()['data'].bitpos // 8 - addr =3D utils.read_ulong(text_data_ring, off) - text_data =3D utils.read_memoryview(inf, addr, text_data_sz).tobyt= es() + text_data_addr =3D utils.read_ulong(text_data_ring, off) =20 counter_off =3D atomic_long_type.get_type()['counter'].bitpos // 8 =20 @@ -102,17 +99,20 @@ class LxDmesg(gdb.Command): desc_off =3D desc_sz * ind info_off =3D info_sz * ind =20 + desc =3D utils.read_memoryview(inf, desc_addr + desc_off, desc= _sz).tobytes() + # skip non-committed record - state =3D 3 & (utils.read_u64(descs, desc_off + sv_off + - counter_off) >> desc_flags_shift) + state =3D 3 & (utils.read_u64(desc, sv_off + counter_off) >> d= esc_flags_shift) if state !=3D desc_committed and state !=3D desc_finalized: if did =3D=3D head_id: break did =3D (did + 1) & desc_id_mask continue =20 - begin =3D utils.read_ulong(descs, desc_off + begin_off) % text= _data_sz - end =3D utils.read_ulong(descs, desc_off + next_off) % text_da= ta_sz + begin =3D utils.read_ulong(desc, begin_off) % text_data_sz + end =3D utils.read_ulong(desc, next_off) % text_data_sz + + info =3D utils.read_memoryview(inf, info_addr + info_off, info= _sz).tobytes() =20 # handle data-less record if begin & 1 =3D=3D 1: @@ -125,16 +125,17 @@ class LxDmesg(gdb.Command): # skip over descriptor id text_start =3D begin + utils.get_long_type().sizeof =20 - text_len =3D utils.read_u16(infos, info_off + len_off) + text_len =3D utils.read_u16(info, len_off) =20 # handle truncated message if end - text_start < text_len: text_len =3D end - text_start =20 - text =3D text_data[text_start:text_start + text_len].decod= e( - encoding=3D'utf8', errors=3D'replace') + text_data =3D utils.read_memoryview(inf, text_data_addr + = text_start, + text_len).tobytes() + text =3D text_data[0:text_len].decode(encoding=3D'utf8', e= rrors=3D'replace') =20 - time_stamp =3D utils.read_u64(infos, info_off + ts_off) + time_stamp =3D utils.read_u64(info, ts_off) =20 for line in text.splitlines(): msg =3D u"[{time:12.6f}] {line}\n".format( --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB921C2BB43 for ; Mon, 15 Aug 2022 19:31:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344427AbiHOTb1 (ORCPT ); Mon, 15 Aug 2022 15:31:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344211AbiHOT0a (ORCPT ); Mon, 15 Aug 2022 15:26:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 876D2167FA; Mon, 15 Aug 2022 11:42: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 D43E661052; Mon, 15 Aug 2022 18:42:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CDD67C433C1; Mon, 15 Aug 2022 18:42:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588945; bh=tcRxpjtw1HiPUhUHNS8nboJEdUsZZ/FIKajP6IXJOMo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KxYWviZtolpHxGscsfgdJe0QzD89ucKpyOUkml0Y9hamqZARHWv2ttkPr4lo745AR IqgKpsS0PlNUeT99zQprhViVD7TnMUciBMliUTXHxtkEhnmqO47GcnnQs86nQT/NLP z57LJZWtq6S65mr9twpg90mCwMBAp89nBmWzA950= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Antonio Borneo , John Ogness , Petr Mladek , Sasha Levin Subject: [PATCH 5.15 522/779] scripts/gdb: fix lx-dmesg on 32 bits arch Date: Mon, 15 Aug 2022 20:02:46 +0200 Message-Id: <20220815180359.562393875@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Antonio Borneo [ Upstream commit e3c8d33e0d62175c31ca7ab7ab01b18f0b6318d3 ] The type atomic_long_t can have size 4 or 8 bytes, depending on CONFIG_64BIT; it's only content, the field 'counter', is either an int or a s64 value. Current code incorrectly uses the fixed size utils.read_u64() to read the field 'counter' inside atomic_long_t. On 32 bits architectures reading the last element 'tail_id' of the struct prb_desc_ring: struct prb_desc_ring { ... atomic_long_t tail_id; }; causes the utils.read_u64() to access outside the boundary of the struct and the gdb command 'lx-dmesg' exits with error: Python Exception : index out of range Error occurred in Python: index out of range Query the really used atomic_long_t counter type size. Link: https://lore.kernel.org/r/20220617143758.137307-1-antonio.borneo@foss= .st.com Fixes: e60768311af8 ("scripts/gdb: update for lockless printk ringbuffer") Signed-off-by: Antonio Borneo [pmladek@suse.com: Query the really used atomic_long_t counter type size] Tested-by: Antonio Borneo Reviewed-by: John Ogness Signed-off-by: Petr Mladek Link: https://lore.kernel.org/r/20220719122831.19890-1-pmladek@suse.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- scripts/gdb/linux/dmesg.py | 9 +++------ scripts/gdb/linux/utils.py | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/scripts/gdb/linux/dmesg.py b/scripts/gdb/linux/dmesg.py index d5983cf3db7d..c771831eb077 100644 --- a/scripts/gdb/linux/dmesg.py +++ b/scripts/gdb/linux/dmesg.py @@ -22,7 +22,6 @@ prb_desc_type =3D utils.CachedType("struct prb_desc") prb_desc_ring_type =3D utils.CachedType("struct prb_desc_ring") prb_data_ring_type =3D utils.CachedType("struct prb_data_ring") printk_ringbuffer_type =3D utils.CachedType("struct printk_ringbuffer") -atomic_long_type =3D utils.CachedType("atomic_long_t") =20 class LxDmesg(gdb.Command): """Print Linux kernel log buffer.""" @@ -68,8 +67,6 @@ class LxDmesg(gdb.Command): off =3D prb_data_ring_type.get_type()['data'].bitpos // 8 text_data_addr =3D utils.read_ulong(text_data_ring, off) =20 - counter_off =3D atomic_long_type.get_type()['counter'].bitpos // 8 - sv_off =3D prb_desc_type.get_type()['state_var'].bitpos // 8 =20 off =3D prb_desc_type.get_type()['text_blk_lpos'].bitpos // 8 @@ -89,9 +86,9 @@ class LxDmesg(gdb.Command): =20 # read in tail and head descriptor ids off =3D prb_desc_ring_type.get_type()['tail_id'].bitpos // 8 - tail_id =3D utils.read_u64(desc_ring, off + counter_off) + tail_id =3D utils.read_atomic_long(desc_ring, off) off =3D prb_desc_ring_type.get_type()['head_id'].bitpos // 8 - head_id =3D utils.read_u64(desc_ring, off + counter_off) + head_id =3D utils.read_atomic_long(desc_ring, off) =20 did =3D tail_id while True: @@ -102,7 +99,7 @@ class LxDmesg(gdb.Command): desc =3D utils.read_memoryview(inf, desc_addr + desc_off, desc= _sz).tobytes() =20 # skip non-committed record - state =3D 3 & (utils.read_u64(desc, sv_off + counter_off) >> d= esc_flags_shift) + state =3D 3 & (utils.read_atomic_long(desc, sv_off) >> desc_fl= ags_shift) if state !=3D desc_committed and state !=3D desc_finalized: if did =3D=3D head_id: break diff --git a/scripts/gdb/linux/utils.py b/scripts/gdb/linux/utils.py index ff7c1799d588..1553f68716cc 100644 --- a/scripts/gdb/linux/utils.py +++ b/scripts/gdb/linux/utils.py @@ -35,13 +35,12 @@ class CachedType: =20 =20 long_type =3D CachedType("long") - +atomic_long_type =3D CachedType("atomic_long_t") =20 def get_long_type(): global long_type return long_type.get_type() =20 - def offset_of(typeobj, field): element =3D gdb.Value(0).cast(typeobj) return int(str(element[field].address).split()[0], 16) @@ -129,6 +128,17 @@ def read_ulong(buffer, offset): else: return read_u32(buffer, offset) =20 +atomic_long_counter_offset =3D atomic_long_type.get_type()['counter'].bitp= os +atomic_long_counter_sizeof =3D atomic_long_type.get_type()['counter'].type= .sizeof + +def read_atomic_long(buffer, offset): + global atomic_long_counter_offset + global atomic_long_counter_sizeof + + if atomic_long_counter_sizeof =3D=3D 8: + return read_u64(buffer, offset + atomic_long_counter_offset) + else: + return read_u32(buffer, offset + atomic_long_counter_offset) =20 target_arch =3D None =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7635BC00140 for ; Mon, 15 Aug 2022 19:24:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245025AbiHOTYv (ORCPT ); Mon, 15 Aug 2022 15:24:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245158AbiHOTWn (ORCPT ); Mon, 15 Aug 2022 15:22: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 5B6615A179; Mon, 15 Aug 2022 11:40:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E0345B81081; Mon, 15 Aug 2022 18:40:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2DB27C433D6; Mon, 15 Aug 2022 18:40:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588838; bh=UmW1dDwj+2KZmvTxLZOreHEXMcT3SnZWcsvpmVelZBw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VtNbrUYg7ZhZW4DUUoZGn9bH+3cGyFtBpSMtnrlEk1RQJs4ecUmX4wPObelb6DQYK l3xZvWppRE4l20Tk5Q/myXcdOi2Evshnuvi+mxAn5aqhY7Obc3eyZ4Y5JjUAf43yrm 5Zv+n5wXD4M6ni2ANO8tiYIlOC0OyhDq9aTPBGWc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bob Pearson , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.15 523/779] RDMA/rxe: Fix mw bind to allow any consumer key portion Date: Mon, 15 Aug 2022 20:02:47 +0200 Message-Id: <20220815180359.612340190@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bob Pearson [ Upstream commit 1603f89935ec86d40a7667e1250392626976ccc2 ] The current implementation of rxe_check_bind_mw() in rxe_mw.c is incorrect since it requires the new key portion provided by the mw consumer to be different than the previous key portion. This is not required by the IBA. Remove the test. Link: https://lore.kernel.org/linux-rdma/fb4614e7-4cac-0dc7-3ef7-766dfd10e8= f2@gmail.com/ Fixes: 32a577b4c3a9 ("Add support for bind MW work requests") Link: https://lore.kernel.org/r/20220714204619.13396-1-rpearsonhpe@gmail.com Signed-off-by: Bob Pearson Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/infiniband/sw/rxe/rxe_mw.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_mw.c b/drivers/infiniband/sw/rxe= /rxe_mw.c index a5e2ea7d80f0..933a0b29275b 100644 --- a/drivers/infiniband/sw/rxe/rxe_mw.c +++ b/drivers/infiniband/sw/rxe/rxe_mw.c @@ -71,8 +71,6 @@ int rxe_dealloc_mw(struct ib_mw *ibmw) static int rxe_check_bind_mw(struct rxe_qp *qp, struct rxe_send_wqe *wqe, struct rxe_mw *mw, struct rxe_mr *mr) { - u32 key =3D wqe->wr.wr.mw.rkey & 0xff; - if (mw->ibmw.type =3D=3D IB_MW_TYPE_1) { if (unlikely(mw->state !=3D RXE_MW_STATE_VALID)) { pr_err_once( @@ -110,11 +108,6 @@ static int rxe_check_bind_mw(struct rxe_qp *qp, struct= rxe_send_wqe *wqe, } } =20 - if (unlikely(key =3D=3D (mw->rkey & 0xff))) { - pr_err_once("attempt to bind MW with same key\n"); - return -EINVAL; - } - /* remaining checks only apply to a nonzero MR */ if (!mr) return 0; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D55CC3F6B0 for ; Mon, 15 Aug 2022 19:29:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245402AbiHOT3G (ORCPT ); Mon, 15 Aug 2022 15:29:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58216 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245158AbiHOTZq (ORCPT ); Mon, 15 Aug 2022 15:25:46 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF4583DF17; Mon, 15 Aug 2022 11:41: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 6FF42B81084; Mon, 15 Aug 2022 18:41:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B526DC433D6; Mon, 15 Aug 2022 18:41:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588871; bh=0rSuf08xxpAs4juZrf9DdyilhYifmFUsrkyHzwVov84=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t+wrWl8B69DrdwxxvJ7hZDxYWd2fEM78hHJDJZbGr1THXLbRJqGWtuOmFmxGlrfM6 3fjjxDf8+xRGbka6Cen0+3xWvTyxE8ZQLuJZI6hJ+T/177HU15K0iDzB3LOC/h1/Xr sCKBYplpabkko6qTi2KIf5BNkUvN173MCN9xJY+0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Robert Richter , Ulf Hansson , Sasha Levin Subject: [PATCH 5.15 524/779] mmc: cavium-octeon: Add of_node_put() when breaking out of loop Date: Mon, 15 Aug 2022 20:02:48 +0200 Message-Id: <20220815180359.662011987@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 19bbb49acf8d7a03cb83e05624363741a4c3ec6f ] In octeon_mmc_probe(), we should call of_node_put() when breaking out of for_each_child_of_node() which has increased and decreased the refcount during each iteration. Fixes: 01d95843335c ("mmc: cavium: Add MMC support for Octeon SOCs.") Signed-off-by: Liang He Acked-by: Robert Richter Link: https://lore.kernel.org/r/20220719095216.1241601-1-windhl@126.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/mmc/host/cavium-octeon.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/mmc/host/cavium-octeon.c b/drivers/mmc/host/cavium-oct= eon.c index 2c4b2df52adb..12dca91a8ef6 100644 --- a/drivers/mmc/host/cavium-octeon.c +++ b/drivers/mmc/host/cavium-octeon.c @@ -277,6 +277,7 @@ static int octeon_mmc_probe(struct platform_device *pde= v) if (ret) { dev_err(&pdev->dev, "Error populating slots\n"); octeon_mmc_set_shared_power(host, 0); + of_node_put(cn); goto error; } i++; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D19B2C00140 for ; Mon, 15 Aug 2022 19:30:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244396AbiHOTab (ORCPT ); Mon, 15 Aug 2022 15:30:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343866AbiHOT0Q (ORCPT ); Mon, 15 Aug 2022 15:26:16 -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 9D69E3F303; Mon, 15 Aug 2022 11:41: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 3A531B81084; Mon, 15 Aug 2022 18:41:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C167C433D7; Mon, 15 Aug 2022 18:41:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588908; bh=njgtn/5vil/3SWQGkDVgSDn7wCT+1DXns7cLGzDpX1I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jy4L6BzHRKvMXthQoXoyn5TY3I+Skzqd9xN8yIMcripYZA9DiLVOou86wIfyFV9on c3XZxusG4YDMprbdnP1VXtW3Z1OV0Rj0OPG6QE70b4k9+KkZXZ/4F3mxoqsm6LksIu 4y+3bKCZKEcgqoTpvDXWVioZ0ky7SzmJEim6u+54= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Robert Richter , Ulf Hansson , Sasha Levin Subject: [PATCH 5.15 525/779] mmc: cavium-thunderx: Add of_node_put() when breaking out of loop Date: Mon, 15 Aug 2022 20:02:49 +0200 Message-Id: <20220815180359.702274616@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 7ee480795e41db314f2c445c65ed854a5d6e8e32 ] In thunder_mmc_probe(), we should call of_node_put() when breaking out of for_each_child_of_node() which has increased and decreased the refcount during each iteration. Fixes: 166bac38c3c5 ("mmc: cavium: Add MMC PCI driver for ThunderX SOCs") Signed-off-by: Liang He Acked-by: Robert Richter Link: https://lore.kernel.org/r/20220719095216.1241601-2-windhl@126.com Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/mmc/host/cavium-thunderx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/cavium-thunderx.c b/drivers/mmc/host/cavium-t= hunderx.c index 76013bbbcff3..202b1d6da678 100644 --- a/drivers/mmc/host/cavium-thunderx.c +++ b/drivers/mmc/host/cavium-thunderx.c @@ -142,8 +142,10 @@ static int thunder_mmc_probe(struct pci_dev *pdev, continue; =20 ret =3D cvm_mmc_of_slot_probe(&host->slot_pdev[i]->dev, host); - if (ret) + if (ret) { + of_node_put(child_node); goto error; + } } i++; } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F7EEC282E7 for ; Mon, 15 Aug 2022 19:31:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343971AbiHOTbD (ORCPT ); Mon, 15 Aug 2022 15:31:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344094AbiHOT0W (ORCPT ); Mon, 15 Aug 2022 15:26:22 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4328B2601; Mon, 15 Aug 2022 11:42: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 sin.source.kernel.org (Postfix) with ESMTPS id ACD28CE126A; Mon, 15 Aug 2022 18:42:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87667C433D7; Mon, 15 Aug 2022 18:42:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588927; bh=LlWXzo+ay1TYd13G3nCLValj8epFIQqO5xQfwJDSVxY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vd5oYoTYrxrVDtFp+0KBU73lpXedw6258QYPK4VKNW5YgiBI1diiyswuEjiqQbYLf JtpJcbkKAT0RJUbuaRbj6jC6dcY/eVf767idWuoql6fgGxwDicGiFAjIUFlJNyJgSq WYaJZJUCcYYRda8tbzHWGD3a8dCdb2KrDwRWSGSc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Artem Borisov , Jiri Kosina , Sasha Levin Subject: [PATCH 5.15 526/779] HID: alps: Declare U1_UNICORN_LEGACY support Date: Mon, 15 Aug 2022 20:02:50 +0200 Message-Id: <20220815180359.750150241@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Artem Borisov [ Upstream commit 1117d182c5d72abd7eb8b7d5e7b8c3373181c3ab ] U1_UNICORN_LEGACY id was added to the driver, but was not declared in the device id table, making it impossible to use. Fixes: 640e403 ("HID: alps: Add AUI1657 device ID") Signed-off-by: Artem Borisov Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/hid/hid-alps.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/hid/hid-alps.c b/drivers/hid/hid-alps.c index 2b986d0dbde4..db146d0f7937 100644 --- a/drivers/hid/hid-alps.c +++ b/drivers/hid/hid-alps.c @@ -830,6 +830,8 @@ static const struct hid_device_id alps_id[] =3D { USB_VENDOR_ID_ALPS_JP, HID_DEVICE_ID_ALPS_U1_DUAL) }, { HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, USB_VENDOR_ID_ALPS_JP, HID_DEVICE_ID_ALPS_U1) }, + { HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, + USB_VENDOR_ID_ALPS_JP, HID_DEVICE_ID_ALPS_U1_UNICORN_LEGACY) }, { HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, USB_VENDOR_ID_ALPS_JP, HID_DEVICE_ID_ALPS_T4_BTNLESS) }, { } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D6D4C2BB41 for ; Mon, 15 Aug 2022 19:31:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344196AbiHOTbM (ORCPT ); Mon, 15 Aug 2022 15:31:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344099AbiHOT0W (ORCPT ); Mon, 15 Aug 2022 15:26: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 7A8CF2634; Mon, 15 Aug 2022 11:42: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 3AF11B8105D; Mon, 15 Aug 2022 18:42:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97AB3C433D6; Mon, 15 Aug 2022 18:42:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588930; bh=KS2OCnk0y2REtlr7azy2kucg/UNHjlyWK1tajYCZUTo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rKyA6ZwJB0gmJXNFNM8iWvgtguUuRYaULfBY3qBPJrUOPGQ90z5KYZpQY/U+Bkm2M nnVr+S8qmSX17yFphvzwOXbEEQ9+TdB+r7yrl0n5IHS1YmKQVBlY1yvKYV6mWCDCvd GKk9q+sqcjx62fGE2t84dMZUb5lo3dGzPyJkSpBo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Md Haris Iqbal , Bob Pearson , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.15 527/779] RDMA/rxe: For invalidate compare according to set keys in mr Date: Mon, 15 Aug 2022 20:02:51 +0200 Message-Id: <20220815180359.799695080@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Md Haris Iqbal [ Upstream commit 174e7b137042f19b5ce88beb4fc0ff4ec6b0c72a ] The 'rkey' input can be an lkey or rkey, and in rxe the lkey or rkey have the same value, including the variant bits. So, if mr->rkey is set, compare the invalidate key with it, otherwise compare with the mr->lkey. Since we already did a lookup on the non-varient bits to get this far, the check's only purpose is to confirm that the wqe has the correct variant bits. Fixes: 001345339f4c ("RDMA/rxe: Separate HW and SW l/rkeys") Link: https://lore.kernel.org/r/20220707073006.328737-1-haris.phnx@gmail.com Signed-off-by: Md Haris Iqbal Reviewed-by: Bob Pearson Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/infiniband/sw/rxe/rxe_loc.h | 2 +- drivers/infiniband/sw/rxe/rxe_mr.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_loc.h b/drivers/infiniband/sw/rx= e/rxe_loc.h index 4fd73b51fabf..21bd969718bd 100644 --- a/drivers/infiniband/sw/rxe/rxe_loc.h +++ b/drivers/infiniband/sw/rxe/rxe_loc.h @@ -85,7 +85,7 @@ struct rxe_mr *lookup_mr(struct rxe_pd *pd, int access, u= 32 key, enum rxe_mr_lookup_type type); int mr_check_range(struct rxe_mr *mr, u64 iova, size_t length); int advance_dma_data(struct rxe_dma_info *dma, unsigned int length); -int rxe_invalidate_mr(struct rxe_qp *qp, u32 rkey); +int rxe_invalidate_mr(struct rxe_qp *qp, u32 key); int rxe_reg_fast_mr(struct rxe_qp *qp, struct rxe_send_wqe *wqe); int rxe_dereg_mr(struct ib_mr *ibmr, struct ib_udata *udata); void rxe_mr_cleanup(struct rxe_pool_entry *arg); diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe= /rxe_mr.c index bedcf15aaea7..7c2e7b291b65 100644 --- a/drivers/infiniband/sw/rxe/rxe_mr.c +++ b/drivers/infiniband/sw/rxe/rxe_mr.c @@ -522,22 +522,22 @@ struct rxe_mr *lookup_mr(struct rxe_pd *pd, int acces= s, u32 key, return mr; } =20 -int rxe_invalidate_mr(struct rxe_qp *qp, u32 rkey) +int rxe_invalidate_mr(struct rxe_qp *qp, u32 key) { struct rxe_dev *rxe =3D to_rdev(qp->ibqp.device); struct rxe_mr *mr; int ret; =20 - mr =3D rxe_pool_get_index(&rxe->mr_pool, rkey >> 8); + mr =3D rxe_pool_get_index(&rxe->mr_pool, key >> 8); if (!mr) { - pr_err("%s: No MR for rkey %#x\n", __func__, rkey); + pr_err("%s: No MR for key %#x\n", __func__, key); ret =3D -EINVAL; goto err; } =20 - if (rkey !=3D mr->rkey) { - pr_err("%s: rkey (%#x) doesn't match mr->rkey (%#x)\n", - __func__, rkey, mr->rkey); + if (mr->rkey ? (key !=3D mr->rkey) : (key !=3D mr->lkey)) { + pr_err("%s: wr key (%#x) doesn't match mr key (%#x)\n", + __func__, key, (mr->rkey ? mr->rkey : mr->lkey)); ret =3D -EINVAL; goto err_drop_ref; } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D74AC28B2B for ; Mon, 15 Aug 2022 19:31:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344136AbiHOTbI (ORCPT ); Mon, 15 Aug 2022 15:31:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344108AbiHOT0X (ORCPT ); Mon, 15 Aug 2022 15:26:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 900A12702; Mon, 15 Aug 2022 11:42: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 4A93FB81084; Mon, 15 Aug 2022 18:42:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A56D4C433D6; Mon, 15 Aug 2022 18:42:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588933; bh=xEf/k7miYj598fvT11oa+UpDHarhQ255uiyXjXf6Mp0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OhLDBv+YZWVby5+22o664BAJQjtVODH5vQkJlmtxYV9l2jsVM4iJjzla0sGmPu0uy ORWCMWa2DAzlQGJyf9137v/vjiVRTO8QkHI5HoVJoFtye8PB8E1CVQ8O4qFBXT/wwZ FfhIMDhzFdRiYDUEX20d3VvOZZzPk7Es9EpLyU0w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vidya Sagar , Bjorn Helgaas , Sasha Levin Subject: [PATCH 5.15 528/779] PCI: tegra194: Fix Root Port interrupt handling Date: Mon, 15 Aug 2022 20:02:52 +0200 Message-Id: <20220815180359.848628295@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vidya Sagar [ Upstream commit 6646e99bcec627e866bc84365af37942c72b4b76 ] As part of Root Port interrupt handling, level-0 register is read first and based on the bits set in that, corresponding level-1 registers are read for further interrupt processing. Since both these values are currently read into the same 'val' variable, checking level-0 bits the second time around is happening on the 'val' variable value of level-1 register contents instead of freshly reading the level-0 value again. Fix by using different variables to store level-0 and level-1 registers contents. Link: https://lore.kernel.org/r/20220721142052.25971-11-vidyas@nvidia.com Fixes: 56e15a238d92 ("PCI: tegra: Add Tegra194 PCIe support") Signed-off-by: Vidya Sagar Signed-off-by: Bjorn Helgaas Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/pci/controller/dwc/pcie-tegra194.c | 46 +++++++++++----------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/contr= oller/dwc/pcie-tegra194.c index 98da2578e4db..ba9f29d6bca1 100644 --- a/drivers/pci/controller/dwc/pcie-tegra194.c +++ b/drivers/pci/controller/dwc/pcie-tegra194.c @@ -352,15 +352,14 @@ static irqreturn_t tegra_pcie_rp_irq_handler(int irq,= void *arg) struct tegra_pcie_dw *pcie =3D arg; struct dw_pcie *pci =3D &pcie->pci; struct pcie_port *pp =3D &pci->pp; - u32 val, tmp; + u32 val, status_l0, status_l1; u16 val_w; =20 - val =3D appl_readl(pcie, APPL_INTR_STATUS_L0); - if (val & APPL_INTR_STATUS_L0_LINK_STATE_INT) { - val =3D appl_readl(pcie, APPL_INTR_STATUS_L1_0_0); - if (val & APPL_INTR_STATUS_L1_0_0_LINK_REQ_RST_NOT_CHGED) { - appl_writel(pcie, val, APPL_INTR_STATUS_L1_0_0); - + status_l0 =3D appl_readl(pcie, APPL_INTR_STATUS_L0); + if (status_l0 & APPL_INTR_STATUS_L0_LINK_STATE_INT) { + status_l1 =3D appl_readl(pcie, APPL_INTR_STATUS_L1_0_0); + appl_writel(pcie, status_l1, APPL_INTR_STATUS_L1_0_0); + if (status_l1 & APPL_INTR_STATUS_L1_0_0_LINK_REQ_RST_NOT_CHGED) { /* SBR & Surprise Link Down WAR */ val =3D appl_readl(pcie, APPL_CAR_RESET_OVRD); val &=3D ~APPL_CAR_RESET_OVRD_CYA_OVERRIDE_CORE_RST_N; @@ -376,15 +375,15 @@ static irqreturn_t tegra_pcie_rp_irq_handler(int irq,= void *arg) } } =20 - if (val & APPL_INTR_STATUS_L0_INT_INT) { - val =3D appl_readl(pcie, APPL_INTR_STATUS_L1_8_0); - if (val & APPL_INTR_STATUS_L1_8_0_AUTO_BW_INT_STS) { + if (status_l0 & APPL_INTR_STATUS_L0_INT_INT) { + status_l1 =3D appl_readl(pcie, APPL_INTR_STATUS_L1_8_0); + if (status_l1 & APPL_INTR_STATUS_L1_8_0_AUTO_BW_INT_STS) { appl_writel(pcie, APPL_INTR_STATUS_L1_8_0_AUTO_BW_INT_STS, APPL_INTR_STATUS_L1_8_0); apply_bad_link_workaround(pp); } - if (val & APPL_INTR_STATUS_L1_8_0_BW_MGT_INT_STS) { + if (status_l1 & APPL_INTR_STATUS_L1_8_0_BW_MGT_INT_STS) { appl_writel(pcie, APPL_INTR_STATUS_L1_8_0_BW_MGT_INT_STS, APPL_INTR_STATUS_L1_8_0); @@ -396,25 +395,24 @@ static irqreturn_t tegra_pcie_rp_irq_handler(int irq,= void *arg) } } =20 - val =3D appl_readl(pcie, APPL_INTR_STATUS_L0); - if (val & APPL_INTR_STATUS_L0_CDM_REG_CHK_INT) { - val =3D appl_readl(pcie, APPL_INTR_STATUS_L1_18); - tmp =3D dw_pcie_readl_dbi(pci, PCIE_PL_CHK_REG_CONTROL_STATUS); - if (val & APPL_INTR_STATUS_L1_18_CDM_REG_CHK_CMPLT) { + if (status_l0 & APPL_INTR_STATUS_L0_CDM_REG_CHK_INT) { + status_l1 =3D appl_readl(pcie, APPL_INTR_STATUS_L1_18); + val =3D dw_pcie_readl_dbi(pci, PCIE_PL_CHK_REG_CONTROL_STATUS); + if (status_l1 & APPL_INTR_STATUS_L1_18_CDM_REG_CHK_CMPLT) { dev_info(pci->dev, "CDM check complete\n"); - tmp |=3D PCIE_PL_CHK_REG_CHK_REG_COMPLETE; + val |=3D PCIE_PL_CHK_REG_CHK_REG_COMPLETE; } - if (val & APPL_INTR_STATUS_L1_18_CDM_REG_CHK_CMP_ERR) { + if (status_l1 & APPL_INTR_STATUS_L1_18_CDM_REG_CHK_CMP_ERR) { dev_err(pci->dev, "CDM comparison mismatch\n"); - tmp |=3D PCIE_PL_CHK_REG_CHK_REG_COMPARISON_ERROR; + val |=3D PCIE_PL_CHK_REG_CHK_REG_COMPARISON_ERROR; } - if (val & APPL_INTR_STATUS_L1_18_CDM_REG_CHK_LOGIC_ERR) { + if (status_l1 & APPL_INTR_STATUS_L1_18_CDM_REG_CHK_LOGIC_ERR) { dev_err(pci->dev, "CDM Logic error\n"); - tmp |=3D PCIE_PL_CHK_REG_CHK_REG_LOGIC_ERROR; + val |=3D PCIE_PL_CHK_REG_CHK_REG_LOGIC_ERROR; } - dw_pcie_writel_dbi(pci, PCIE_PL_CHK_REG_CONTROL_STATUS, tmp); - tmp =3D dw_pcie_readl_dbi(pci, PCIE_PL_CHK_REG_ERR_ADDR); - dev_err(pci->dev, "CDM Error Address Offset =3D 0x%08X\n", tmp); + dw_pcie_writel_dbi(pci, PCIE_PL_CHK_REG_CONTROL_STATUS, val); + val =3D dw_pcie_readl_dbi(pci, PCIE_PL_CHK_REG_ERR_ADDR); + dev_err(pci->dev, "CDM Error Address Offset =3D 0x%08X\n", val); } =20 return IRQ_HANDLED; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A209CC28B2C for ; Mon, 15 Aug 2022 19:31:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344255AbiHOTbT (ORCPT ); Mon, 15 Aug 2022 15:31:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344118AbiHOT0X (ORCPT ); Mon, 15 Aug 2022 15:26: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 245D42BC0; Mon, 15 Aug 2022 11:42: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 B55A361052; Mon, 15 Aug 2022 18:42:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A18CFC433C1; Mon, 15 Aug 2022 18:42:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588936; bh=kz99HwGTJI+6tm6sIsL+QeIuEmX7pI2rcDo8gyOHOpY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x4SPMM5vPhr4u/FtKwtBle++l1TB/rKN4Yi2on7wgFZLyEScayeXsZhsFesMSNZuv vBdtgdCRpZlPb/hTlBd3AmWbtOODYDZIZ/WVZDLyutZrBdDaCIDh+rxdUcvghSicRV KqmsWLAVRx3PiIbM5nec40xPeTqm38hWXluRbBjg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vidya Sagar , Bjorn Helgaas , Sasha Levin Subject: [PATCH 5.15 529/779] PCI: tegra194: Fix link up retry sequence Date: Mon, 15 Aug 2022 20:02:53 +0200 Message-Id: <20220815180359.888134590@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vidya Sagar [ Upstream commit e05fd6ae77c3e2cc0dba283005d24b6d56d2b1fa ] Add the missing DLF capability offset while clearing DL_FEATURE_EXCHANGE_EN bit during link up retry. Link: https://lore.kernel.org/r/20220721142052.25971-15-vidyas@nvidia.com Fixes: 56e15a238d92 ("PCI: tegra: Add Tegra194 PCIe support") Signed-off-by: Vidya Sagar Signed-off-by: Bjorn Helgaas Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/pci/controller/dwc/pcie-tegra194.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/contr= oller/dwc/pcie-tegra194.c index ba9f29d6bca1..bdd84765e646 100644 --- a/drivers/pci/controller/dwc/pcie-tegra194.c +++ b/drivers/pci/controller/dwc/pcie-tegra194.c @@ -978,7 +978,7 @@ static int tegra_pcie_dw_start_link(struct dw_pcie *pci) offset =3D dw_pcie_find_ext_capability(pci, PCI_EXT_CAP_ID_DLF); val =3D dw_pcie_readl_dbi(pci, offset + PCI_DLF_CAP); val &=3D ~PCI_DLF_EXCHANGE_ENABLE; - dw_pcie_writel_dbi(pci, offset, val); + dw_pcie_writel_dbi(pci, offset + PCI_DLF_CAP, val); =20 tegra_pcie_dw_host_init(pp); dw_pcie_setup_rc(pp); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6B11C2BB45 for ; Mon, 15 Aug 2022 19:31:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344337AbiHOTbX (ORCPT ); Mon, 15 Aug 2022 15:31:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344116AbiHOT0X (ORCPT ); Mon, 15 Aug 2022 15:26:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BD3C65E1; Mon, 15 Aug 2022 11:42: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 AAAB460FEE; Mon, 15 Aug 2022 18:42:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADDD4C433D6; Mon, 15 Aug 2022 18:42:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588939; bh=0nQaV3+rrOhMh1mRySeJDS/Al/3mQd4ZX+OAPi1Dh8I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lK70HW0fwLyQvAXnLmVX99kRH6aAqVy1qaZbPTqmk9urSr8PtQzsJutf7HmvwLRPg iCzmYIpX3kmoal0k93KsloMJy7Qp4CvpTOvvRnLHBYH6CGvJJbiTZoR0wCzwjttCFH dhWya5raQEwxZOmaGNC0pBuhc7V/sfydf0VfwlNo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Basavaraj Natikar , Jiri Kosina , Sasha Levin Subject: [PATCH 5.15 530/779] HID: amd_sfh: Handle condition of "no sensors" Date: Mon, 15 Aug 2022 20:02:54 +0200 Message-Id: <20220815180359.938933696@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Basavaraj Natikar [ Upstream commit 5d4d0f15657535f6a122ab26d47230b5c2b944af ] Add a check for num_hid_devices to handle special case the situation of "no sensors". Fixes: 4b2c53d93a4b ("SFH:Transport Driver to add support of AMD Sensor Fus= ion Hub (SFH)") Signed-off-by: Basavaraj Natikar Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/hid/amd-sfh-hid/amd_sfh_client.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_client.c b/drivers/hid/amd-sfh= -hid/amd_sfh_client.c index 6284db50ec9b..ab149b80f86c 100644 --- a/drivers/hid/amd-sfh-hid/amd_sfh_client.c +++ b/drivers/hid/amd-sfh-hid/amd_sfh_client.c @@ -154,6 +154,8 @@ int amd_sfh_hid_client_init(struct amd_mp2_dev *privdat= a) dev =3D &privdata->pdev->dev; =20 cl_data->num_hid_devices =3D amd_mp2_get_sensor_num(privdata, &cl_data->s= ensor_idx[0]); + if (cl_data->num_hid_devices =3D=3D 0) + return -ENODEV; =20 INIT_DELAYED_WORK(&cl_data->work, amd_sfh_work); INIT_DELAYED_WORK(&cl_data->work_buffer, amd_sfh_work_buffer); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0DCCC2BB9D for ; Mon, 15 Aug 2022 19:31:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344487AbiHOTbb (ORCPT ); Mon, 15 Aug 2022 15:31:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344188AbiHOT02 (ORCPT ); Mon, 15 Aug 2022 15:26:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF69513DCA; Mon, 15 Aug 2022 11:42: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 63749B81032; Mon, 15 Aug 2022 18:42:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD046C433D7; Mon, 15 Aug 2022 18:42:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588942; bh=MeUPlhFMZ18TATwQTRvz0Nk1M7Aqj1FMwX20PVHEDmA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y9vCjjw7IAhWV6XCRyk8vyjk3d4FL4XKtctUl+Ugs7F9gJbk6m/ASDcMKvC0XWSLG KvL3gplOAl7ZIWEiCmLbzqBdGsTyoebg9yR3uMSNimurHZ4Twy+NumwhsSi+w/hniA cAsu5BQrEMIaZaf7aC7ykb8mqjzCDVUeac2gpQcs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Sasha Levin Subject: [PATCH 5.15 531/779] USB: serial: fix tty-port initialized comments Date: Mon, 15 Aug 2022 20:02:55 +0200 Message-Id: <20220815180359.984322276@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 [ Upstream commit 688ee1d1785c1359f9040f615dd8e6054962bce2 ] Fix up the tty-port initialized comments which got truncated and obfuscated when replacing the old ASYNCB_INITIALIZED flag. Fixes: d41861ca19c9 ("tty: Replace ASYNC_INITIALIZED bit and update atomica= lly") Reviewed-by: Greg Kroah-Hartman Signed-off-by: Johan Hovold Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/usb/serial/sierra.c | 3 ++- drivers/usb/serial/usb-serial.c | 2 +- drivers/usb/serial/usb_wwan.c | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 9d56138133a9..ef6a2891f290 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c @@ -737,7 +737,8 @@ static void sierra_close(struct usb_serial_port *port) =20 /* * Need to take susp_lock to make sure port is not already being - * resumed, but no need to hold it due to initialized + * resumed, but no need to hold it due to the tty-port initialized + * flag. */ spin_lock_irq(&intfdata->susp_lock); if (--intfdata->open_ports =3D=3D 0) diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-seria= l.c index 090a78c948f2..255fb9583c0a 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c @@ -292,7 +292,7 @@ static int serial_open(struct tty_struct *tty, struct f= ile *filp) * * Shut down a USB serial port. Serialized against activate by the * tport mutex and kept to matching open/close pairs - * of calls by the initialized flag. + * of calls by the tty-port initialized flag. * * Not called if tty is console. */ diff --git a/drivers/usb/serial/usb_wwan.c b/drivers/usb/serial/usb_wwan.c index cb01283d4d15..f21f25a8cf6f 100644 --- a/drivers/usb/serial/usb_wwan.c +++ b/drivers/usb/serial/usb_wwan.c @@ -389,7 +389,8 @@ void usb_wwan_close(struct usb_serial_port *port) =20 /* * Need to take susp_lock to make sure port is not already being - * resumed, but no need to hold it due to initialized + * resumed, but no need to hold it due to the tty-port initialized + * flag. */ spin_lock_irq(&intfdata->susp_lock); if (--intfdata->open_ports =3D=3D 0) --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA759C00140 for ; Mon, 15 Aug 2022 19:25:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243840AbiHOTZM (ORCPT ); Mon, 15 Aug 2022 15:25:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245542AbiHOTXa (ORCPT ); Mon, 15 Aug 2022 15:23:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 904042E9E1; Mon, 15 Aug 2022 11:40: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 DBF21B8108B; Mon, 15 Aug 2022 18:40:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E53AC433D6; Mon, 15 Aug 2022 18:40:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588841; bh=USaoXt23dkPCUkqdy9sXfYf2lS1Nk6uh96T3TB7tnc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=saXLHIrQ9Z71JAe52I8csMcUJvt8yceXzm1+CRZ3nPn9HziAXyLcy20BUWs4eRRGj Wdwogt2wmMJS0wGeoABak3yfo6KIH8udLWh5kXeS+QES5zlwsYL0OpqVEHJvqWFMko BHq9TldlNXYy/LlaxsxUSZCeocEA8BU/ro8zCSbs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Chen , Andrey Strachuk , Sasha Levin Subject: [PATCH 5.15 532/779] usb: cdns3: change place of priv_ep assignment in cdns3_gadget_ep_dequeue(), cdns3_gadget_ep_enable() Date: Mon, 15 Aug 2022 20:02:56 +0200 Message-Id: <20220815180400.033429209@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrey Strachuk [ Upstream commit c3ffc9c4ca44bfe9562166793d133e1fb0630ea6 ] If 'ep' is NULL, result of ep_to_cdns3_ep(ep) is invalid pointer and its dereference with priv_ep->cdns3_dev may cause panic. Found by Linux Verification Center (linuxtesting.org) with SVACE. Fixes: 7733f6c32e36 ("usb: cdns3: Add Cadence USB3 DRD Driver") Acked-by: Peter Chen Signed-off-by: Andrey Strachuk Link: https://lore.kernel.org/r/20220718160052.4188-1-strochuk@ispras.ru Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/usb/cdns3/cdns3-gadget.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gad= get.c index d6d515d598dc..e0cf62e65075 100644 --- a/drivers/usb/cdns3/cdns3-gadget.c +++ b/drivers/usb/cdns3/cdns3-gadget.c @@ -2281,14 +2281,15 @@ static int cdns3_gadget_ep_enable(struct usb_ep *ep, int val; =20 priv_ep =3D ep_to_cdns3_ep(ep); - priv_dev =3D priv_ep->cdns3_dev; - comp_desc =3D priv_ep->endpoint.comp_desc; =20 if (!ep || !desc || desc->bDescriptorType !=3D USB_DT_ENDPOINT) { dev_dbg(priv_dev->dev, "usbss: invalid parameters\n"); return -EINVAL; } =20 + comp_desc =3D priv_ep->endpoint.comp_desc; + priv_dev =3D priv_ep->cdns3_dev; + if (!desc->wMaxPacketSize) { dev_err(priv_dev->dev, "usbss: missing wMaxPacketSize\n"); return -EINVAL; @@ -2596,7 +2597,7 @@ int cdns3_gadget_ep_dequeue(struct usb_ep *ep, struct usb_request *request) { struct cdns3_endpoint *priv_ep =3D ep_to_cdns3_ep(ep); - struct cdns3_device *priv_dev =3D priv_ep->cdns3_dev; + struct cdns3_device *priv_dev; struct usb_request *req, *req_temp; struct cdns3_request *priv_req; struct cdns3_trb *link_trb; @@ -2607,6 +2608,8 @@ int cdns3_gadget_ep_dequeue(struct usb_ep *ep, if (!ep || !request || !ep->desc) return -EINVAL; =20 + priv_dev =3D priv_ep->cdns3_dev; + spin_lock_irqsave(&priv_dev->lock, flags); =20 priv_req =3D to_cdns3_request(request); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AABF4C00140 for ; Mon, 15 Aug 2022 19:25:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244689AbiHOTZb (ORCPT ); Mon, 15 Aug 2022 15:25:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245603AbiHOTXk (ORCPT ); Mon, 15 Aug 2022 15:23: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 C2ED02ED4D; Mon, 15 Aug 2022 11:40: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 1976E6117D; Mon, 15 Aug 2022 18:40:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CFC1C433D7; Mon, 15 Aug 2022 18:40:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588844; bh=gFrUklpuRgI6eVxNJB5v/dnFrPZN8LmmVIzIU24QMHI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FCAUUlDCCf8yaZiM574L7d+ePdAuhie4K3HAtFROh2r8wnQ72QQIaBBfPcc3EMHA5 HtYFt9P5rWUI1OrfmBzIe32+JaHRf/o+x9FUaWiAXY1RzJZXUoE9K/8aTcjj+KXm9w Gw/1Om0xebWyPkmyuMaKj0w17D20JXuQcpsGqYPI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Patrice Chotard , Tudor Ambarus , Alexander Sverdlin , Pratyush Yadav , Sasha Levin Subject: [PATCH 5.15 533/779] mtd: spi-nor: fix spi_nor_spimem_setup_op() call in spi_nor_erase_{sector,chip}() Date: Mon, 15 Aug 2022 20:02:57 +0200 Message-Id: <20220815180400.072136972@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 f8cd9f632f4415b1e8838bdca8ab42cfb37a6584 ] For erase operations, reg_proto must be used as indicated in struct spi_nor description in spi-nor.h. This issue was found when DT property spi-tx-bus-width is set to 4. In this case the spi_mem_op->addr.buswidth is set to 4 for erase command which is not correct. Tested on stm32mp157c-ev1 board with mx66l51235f spi-nor. Fixes: 0e30f47232ab ("mtd: spi-nor: add support for DTR protocol") Signed-off-by: Patrice Chotard [ta: use nor->reg_proto in spi_nor_controller_ops_erase()] Signed-off-by: Tudor Ambarus Tested-by: Alexander Sverdlin Reviewed-by: Pratyush Yadav Link: https://lore.kernel.org/r/20220629133013.3382393-1-patrice.chotard@fo= ss.st.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/mtd/spi-nor/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index d97cdbc2b9de..eb5d7b3d1860 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -177,7 +177,7 @@ static int spi_nor_controller_ops_write_reg(struct spi_= nor *nor, u8 opcode, =20 static int spi_nor_controller_ops_erase(struct spi_nor *nor, loff_t offs) { - if (spi_nor_protocol_is_dtr(nor->write_proto)) + if (spi_nor_protocol_is_dtr(nor->reg_proto)) return -EOPNOTSUPP; =20 return nor->controller_ops->erase(nor, offs); @@ -1195,7 +1195,7 @@ static int spi_nor_erase_chip(struct spi_nor *nor) SPI_MEM_OP_NO_DUMMY, SPI_MEM_OP_NO_DATA); =20 - spi_nor_spimem_setup_op(nor, &op, nor->write_proto); + spi_nor_spimem_setup_op(nor, &op, nor->reg_proto); =20 ret =3D spi_mem_exec_op(nor->spimem, &op); } else { @@ -1340,7 +1340,7 @@ int spi_nor_erase_sector(struct spi_nor *nor, u32 add= r) SPI_MEM_OP_NO_DUMMY, SPI_MEM_OP_NO_DATA); =20 - spi_nor_spimem_setup_op(nor, &op, nor->write_proto); + spi_nor_spimem_setup_op(nor, &op, nor->reg_proto); =20 return spi_mem_exec_op(nor->spimem, &op); } else if (nor->controller_ops->erase) { --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80617C00140 for ; Mon, 15 Aug 2022 19:28:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241325AbiHOT2I (ORCPT ); Mon, 15 Aug 2022 15:28:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245627AbiHOTXm (ORCPT ); Mon, 15 Aug 2022 15:23:42 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A603F2E6AB; Mon, 15 Aug 2022 11:40: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 sin.source.kernel.org (Postfix) with ESMTPS id 190E1CE1268; Mon, 15 Aug 2022 18:40:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E3D6C433D6; Mon, 15 Aug 2022 18:40:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588847; bh=MDjOWR3mdEcU0zgLl2F8s7Mx4q697ts3JyTlo8tcbgw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=agu0GFxRmFrRDaxBr2e5M1NWPPAN73LKcBvENMU9SiQTamKtNOU2bvznTJeKJTJIr IQn0B0rqxRL5NZGBv8qRRGqAO/B2MaKbGsMxY648P8etKhlurkLZhtWGCsfHELYZVJ liLSIMVg2TsexoeY8Zds9dIWFOzyIF/B6nheYn4I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.15 534/779] KVM: nVMX: Set UMIP bit CR4_FIXED1 MSR when emulating UMIP Date: Mon, 15 Aug 2022 20:02:58 +0200 Message-Id: <20220815180400.122076727@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson [ Upstream commit a910b5ab6b250a88fff1866bf708642d83317466 ] Make UMIP an "allowed-1" bit CR4_FIXED1 MSR when KVM is emulating UMIP. KVM emulates UMIP for both L1 and L2, and so should enumerate that L2 is allowed to have CR4.UMIP=3D1. Not setting the bit doesn't immediately break nVMX, as KVM does set/clear the bit in CR4_FIXED1 in response to a guest CPUID update, i.e. KVM will correctly (dis)allow nested VM-Entry based on whether or not UMIP is exposed to L1. That said, KVM should enumerate the bit as being allowed from time zero, e.g. userspace will see the wrong value if the MSR is read before CPUID is written. Fixes: 0367f205a3b7 ("KVM: vmx: add support for emulating UMIP") Signed-off-by: Sean Christopherson Message-Id: <20220607213604.3346000-12-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/x86/kvm/vmx/nested.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index 256a2aba830a..9f845556dde8 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -6736,6 +6736,9 @@ void nested_vmx_setup_ctls_msrs(struct nested_vmx_msr= s *msrs, u32 ept_caps) rdmsrl(MSR_IA32_VMX_CR0_FIXED1, msrs->cr0_fixed1); rdmsrl(MSR_IA32_VMX_CR4_FIXED1, msrs->cr4_fixed1); =20 + if (vmx_umip_emulated()) + msrs->cr4_fixed1 |=3D X86_CR4_UMIP; + msrs->vmcs_enum =3D nested_vmx_calc_vmcs_enum_msr(); } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB0BAC3F6B0 for ; Mon, 15 Aug 2022 19:28:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243892AbiHOT2R (ORCPT ); Mon, 15 Aug 2022 15:28:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245662AbiHOTXm (ORCPT ); Mon, 15 Aug 2022 15:23: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 8DAFB2E9E4; Mon, 15 Aug 2022 11:40: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 1B93F6117D; Mon, 15 Aug 2022 18:40:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11A3AC433C1; Mon, 15 Aug 2022 18:40:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588850; bh=PQa41Dw1cLrvGbifrXo1+Q6UP14K5C3ONaexlLXM2xo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pKNKIBVUW0d+GvqDQRHc8DmsH+QrOBZLmz4nGPN3+3QwjClNZiwQQvuQ9eAOtg452 mkEVlY3CJI3Cr84YyuZ7QuFDm3u6MGatgf9wBw3dHA7U8UJbG3fQzodqNSPpBwBQvN I1LWIS6gyquZgy83zb1NxuOn3r5Kjjz2BGpT+2pY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Hans de Goede , Sasha Levin Subject: [PATCH 5.15 535/779] platform/olpc: Fix uninitialized data in debugfs write Date: Mon, 15 Aug 2022 20:02:59 +0200 Message-Id: <20220815180400.174734457@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter [ Upstream commit 40ec787e1adf302c11668d4cc69838f4d584187d ] The call to: size =3D simple_write_to_buffer(cmdbuf, sizeof(cmdbuf), ppos, buf, size); will succeed if at least one byte is written to the "cmdbuf" buffer. The "*ppos" value controls which byte is written. Another problem is that this code does not check for errors so it's possible for the entire buffer to be uninitialized. Inintialize the struct to zero to prevent reading uninitialized stack data. Debugfs is normally only writable by root so the impact of this bug is very minimal. Fixes: 6cca83d498bd ("Platform: OLPC: move debugfs support from x86 EC driv= er") Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/YthIKn+TfZSZMEcM@kili Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/platform/olpc/olpc-ec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/olpc/olpc-ec.c b/drivers/platform/olpc/olpc-e= c.c index 4ff5c3a12991..921520475ff6 100644 --- a/drivers/platform/olpc/olpc-ec.c +++ b/drivers/platform/olpc/olpc-ec.c @@ -264,7 +264,7 @@ static ssize_t ec_dbgfs_cmd_write(struct file *file, co= nst char __user *buf, int i, m; unsigned char ec_cmd[EC_MAX_CMD_ARGS]; unsigned int ec_cmd_int[EC_MAX_CMD_ARGS]; - char cmdbuf[64]; + char cmdbuf[64] =3D ""; int ec_cmd_bytes; =20 mutex_lock(&ec_dbgfs_lock); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBD61C00140 for ; Mon, 15 Aug 2022 19:28:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244290AbiHOT2U (ORCPT ); Mon, 15 Aug 2022 15:28:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244230AbiHOTYC (ORCPT ); Mon, 15 Aug 2022 15:24:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 701262ED50; Mon, 15 Aug 2022 11:40: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 E3855611C5; Mon, 15 Aug 2022 18:40:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA761C433C1; Mon, 15 Aug 2022 18:40:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588853; bh=hADJyJQE5NagnoxhSnl4VH2kvotc821VkXjIYGoKySs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rxx2jQLtaLlGGGByG88XleLQvgBJJSyrZWgWmqb4yg+1JjJpxZAU01joYxV6gJG5o OF2dhlgLOeYXqAhEjWos7w+XVMj4MhLu8j2FqrShDViIDlZJBgJGdDQA1wRtJYuVrF xRuvPoamzYXWUjoVsYZOS34Zpp0t3nzh5+ZlwxSw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bart Van Assche , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.15 536/779] RDMA/srpt: Duplicate port name members Date: Mon, 15 Aug 2022 20:03:00 +0200 Message-Id: <20220815180400.214166883@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bart Van Assche [ Upstream commit b03b1ae2a3125d4475452e4f19f5d3a6e910ff6e ] Prepare for decoupling the lifetimes of struct srpt_port and struct srpt_port_id by duplicating the port name into struct srpt_port. Link: https://lore.kernel.org/r/20220727193415.1583860-2-bvanassche@acm.org Signed-off-by: Bart Van Assche Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/infiniband/ulp/srpt/ib_srpt.c | 9 ++++++--- drivers/infiniband/ulp/srpt/ib_srpt.h | 10 +++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp= /srpt/ib_srpt.c index 3cadf1295417..d36873e6d8fa 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -566,14 +566,17 @@ static int srpt_refresh_port(struct srpt_port *sport) return ret; =20 sport->port_guid_id.wwn.priv =3D sport; - srpt_format_guid(sport->port_guid_id.name, - sizeof(sport->port_guid_id.name), + srpt_format_guid(sport->guid_name, ARRAY_SIZE(sport->guid_name), &sport->gid.global.interface_id); + memcpy(sport->port_guid_id.name, sport->guid_name, + ARRAY_SIZE(sport->guid_name)); sport->port_gid_id.wwn.priv =3D sport; - snprintf(sport->port_gid_id.name, sizeof(sport->port_gid_id.name), + snprintf(sport->gid_name, ARRAY_SIZE(sport->gid_name), "0x%016llx%016llx", be64_to_cpu(sport->gid.global.subnet_prefix), be64_to_cpu(sport->gid.global.interface_id)); + memcpy(sport->port_gid_id.name, sport->gid_name, + ARRAY_SIZE(sport->gid_name)); =20 if (rdma_protocol_iwarp(sport->sdev->device, sport->port)) return 0; diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.h b/drivers/infiniband/ulp= /srpt/ib_srpt.h index 76e66f630c17..3844a7058559 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.h +++ b/drivers/infiniband/ulp/srpt/ib_srpt.h @@ -376,7 +376,7 @@ struct srpt_tpg { }; =20 /** - * struct srpt_port_id - information about an RDMA port name + * struct srpt_port_id - LIO RDMA port information * @mutex: Protects @tpg_list changes. * @tpg_list: TPGs associated with the RDMA port name. * @wwn: WWN associated with the RDMA port name. @@ -402,8 +402,10 @@ struct srpt_port_id { * @lid: cached value of the port's lid. * @gid: cached value of the port's gid. * @work: work structure for refreshing the aforementioned cached val= ues. - * @port_guid_id: target port GUID - * @port_gid_id: target port GID + * @guid_name: port name in GUID format. + * @port_guid_id: LIO target port information for the port name in GUID fo= rmat. + * @gid_name: port name in GID format. + * @port_gid_id: LIO target port information for the port name in GID form= at. * @port_attrib: Port attributes that can be accessed through configfs. * @refcount: Number of objects associated with this port. * @freed_channels: Completion that will be signaled once @refcount become= s 0. @@ -419,7 +421,9 @@ struct srpt_port { u32 lid; union ib_gid gid; struct work_struct work; + char guid_name[64]; struct srpt_port_id port_guid_id; + char gid_name[64]; struct srpt_port_id port_gid_id; struct srpt_port_attrib port_attrib; atomic_t refcount; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1582BC3F6B0 for ; Mon, 15 Aug 2022 19:28:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244620AbiHOT2Y (ORCPT ); Mon, 15 Aug 2022 15:28:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244832AbiHOTYF (ORCPT ); Mon, 15 Aug 2022 15:24: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 48DFC3DF2B; Mon, 15 Aug 2022 11:40: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 D6E4E611C6; Mon, 15 Aug 2022 18:40:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDC1EC433D6; Mon, 15 Aug 2022 18:40:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588856; bh=o8vGMGZ07S1MdoCCE7yctR0rhGjN2zFQONZJWw7rzTI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DdAQe1B6yPEe79MTBpd0SvSlqqC7wcwRROL3a9e5SkMvH8PpuSpZyNvV5BQJfebTW onTKWiaY7BTwmi49jdD/7U3lm7lDY5bleEMnG5IEGXUjqg9nrYz9hBrUjpEBDXpbRm 0qb3ges5+YBJ1TqxlouyPecgD9yCW9wkt9dPyyrw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bart Van Assche , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.15 537/779] RDMA/srpt: Introduce a reference count in struct srpt_device Date: Mon, 15 Aug 2022 20:03:01 +0200 Message-Id: <20220815180400.261099997@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bart Van Assche [ Upstream commit aa7dfbb41b5a60ab90e244d6f586b8cb5c791c3e ] This will be used to keep struct srpt_device around as long as either the RDMA port exists or a LIO target port is associated with the struct srpt_device. Link: https://lore.kernel.org/r/20220727193415.1583860-3-bvanassche@acm.org Signed-off-by: Bart Van Assche Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/infiniband/ulp/srpt/ib_srpt.c | 17 +++++++++++++++-- drivers/infiniband/ulp/srpt/ib_srpt.h | 2 ++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp= /srpt/ib_srpt.c index d36873e6d8fa..b59fc584de18 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -3104,6 +3104,18 @@ static int srpt_use_srq(struct srpt_device *sdev, bo= ol use_srq) return ret; } =20 +static void srpt_free_sdev(struct kref *refcnt) +{ + struct srpt_device *sdev =3D container_of(refcnt, typeof(*sdev), refcnt); + + kfree(sdev); +} + +static void srpt_sdev_put(struct srpt_device *sdev) +{ + kref_put(&sdev->refcnt, srpt_free_sdev); +} + /** * srpt_add_one - InfiniBand device addition callback function * @device: Describes a HCA. @@ -3122,6 +3134,7 @@ static int srpt_add_one(struct ib_device *device) if (!sdev) return -ENOMEM; =20 + kref_init(&sdev->refcnt); sdev->device =3D device; mutex_init(&sdev->sdev_mutex); =20 @@ -3217,7 +3230,7 @@ static int srpt_add_one(struct ib_device *device) srpt_free_srq(sdev); ib_dealloc_pd(sdev->pd); free_dev: - kfree(sdev); + srpt_sdev_put(sdev); pr_info("%s(%s) failed.\n", __func__, dev_name(&device->dev)); return ret; } @@ -3261,7 +3274,7 @@ static void srpt_remove_one(struct ib_device *device,= void *client_data) =20 ib_dealloc_pd(sdev->pd); =20 - kfree(sdev); + srpt_sdev_put(sdev); } =20 static struct ib_client srpt_client =3D { diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.h b/drivers/infiniband/ulp= /srpt/ib_srpt.h index 3844a7058559..0cb867d580f1 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.h +++ b/drivers/infiniband/ulp/srpt/ib_srpt.h @@ -434,6 +434,7 @@ struct srpt_port { =20 /** * struct srpt_device - information associated by SRPT with a single HCA + * @refcnt: Reference count for this device. * @device: Backpointer to the struct ib_device managed by the IB c= ore. * @pd: IB protection domain. * @lkey: L_Key (local key) with write access to all local memory. @@ -449,6 +450,7 @@ struct srpt_port { * @port: Information about the ports owned by this HCA. */ struct srpt_device { + struct kref refcnt; struct ib_device *device; struct ib_pd *pd; u32 lkey; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD1B7C25B08 for ; Mon, 15 Aug 2022 19:28:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245012AbiHOT22 (ORCPT ); Mon, 15 Aug 2022 15:28:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245697AbiHOTYG (ORCPT ); Mon, 15 Aug 2022 15:24:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37C0A2B1AF; Mon, 15 Aug 2022 11:41:00 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BB044611C2; Mon, 15 Aug 2022 18:40:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C52C2C433C1; Mon, 15 Aug 2022 18:40:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588859; bh=kar5H/Hr8i0R0HMKJ+I84Y8iUWRBiQqmKEEAd+BEWTc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gfPvRGMG/RhtsUZF1KCBwiDsICdtf83duHeCHrPI1gdV0weq/T9EWudW7rxsSGmED /HXpcFc+E4oFH0nbfkz3gU/Oj7Ds+yjfi71zX+IrriXCxxAi4oxVm6mOJ3FZ4EVN1z R3KQ02wqm/SjNQjcaQKIDkLQUoieV8TXB8tf/KpA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Li Zhijian , Bart Van Assche , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.15 538/779] RDMA/srpt: Fix a use-after-free Date: Mon, 15 Aug 2022 20:03:02 +0200 Message-Id: <20220815180400.309201440@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bart Van Assche [ Upstream commit b5605148e6ce36bb21020d49010b617693933128 ] Change the LIO port members inside struct srpt_port from regular members into pointers. Allocate the LIO port data structures from inside srpt_make_tport() and free these from inside srpt_make_tport(). Keep struct srpt_device as long as either an RDMA port or a LIO target port is associated with it. This patch decouples the lifetime of struct srpt_port (controlled by the RDMA core) and struct srpt_port_id (controlled by LIO). This patch fixes the following KASAN complaint: BUG: KASAN: use-after-free in srpt_enable_tpg+0x31/0x70 [ib_srpt] Read of size 8 at addr ffff888141cc34b8 by task check/5093 Call Trace: show_stack+0x4e/0x53 dump_stack_lvl+0x51/0x66 print_address_description.constprop.0.cold+0xea/0x41e print_report.cold+0x90/0x205 kasan_report+0xb9/0xf0 __asan_load8+0x69/0x90 srpt_enable_tpg+0x31/0x70 [ib_srpt] target_fabric_tpg_base_enable_store+0xe2/0x140 [target_core_mod] configfs_write_iter+0x18b/0x210 new_sync_write+0x1f2/0x2f0 vfs_write+0x3e3/0x540 ksys_write+0xbb/0x140 __x64_sys_write+0x42/0x50 do_syscall_64+0x34/0x80 entry_SYSCALL_64_after_hwframe+0x46/0xb0 Link: https://lore.kernel.org/r/20220727193415.1583860-4-bvanassche@acm.org Reported-by: Li Zhijian Tested-by: Li Zhijian Fixes: a42d985bd5b2 ("ib_srpt: Initial SRP Target merge for v3.3-rc1") Signed-off-by: Bart Van Assche Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/infiniband/ulp/srpt/ib_srpt.c | 130 ++++++++++++++++++-------- drivers/infiniband/ulp/srpt/ib_srpt.h | 10 +- 2 files changed, 94 insertions(+), 46 deletions(-) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.c b/drivers/infiniband/ulp= /srpt/ib_srpt.c index b59fc584de18..7b69b0c9e48d 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.c +++ b/drivers/infiniband/ulp/srpt/ib_srpt.c @@ -565,18 +565,12 @@ static int srpt_refresh_port(struct srpt_port *sport) if (ret) return ret; =20 - sport->port_guid_id.wwn.priv =3D sport; srpt_format_guid(sport->guid_name, ARRAY_SIZE(sport->guid_name), &sport->gid.global.interface_id); - memcpy(sport->port_guid_id.name, sport->guid_name, - ARRAY_SIZE(sport->guid_name)); - sport->port_gid_id.wwn.priv =3D sport; snprintf(sport->gid_name, ARRAY_SIZE(sport->gid_name), "0x%016llx%016llx", be64_to_cpu(sport->gid.global.subnet_prefix), be64_to_cpu(sport->gid.global.interface_id)); - memcpy(sport->port_gid_id.name, sport->gid_name, - ARRAY_SIZE(sport->gid_name)); =20 if (rdma_protocol_iwarp(sport->sdev->device, sport->port)) return 0; @@ -2317,31 +2311,35 @@ static int srpt_cm_req_recv(struct srpt_device *con= st sdev, tag_num =3D ch->rq_size; tag_size =3D 1; /* ib_srpt does not use se_sess->sess_cmd_map */ =20 - mutex_lock(&sport->port_guid_id.mutex); - list_for_each_entry(stpg, &sport->port_guid_id.tpg_list, entry) { - if (!IS_ERR_OR_NULL(ch->sess)) - break; - ch->sess =3D target_setup_session(&stpg->tpg, tag_num, + if (sport->guid_id) { + mutex_lock(&sport->guid_id->mutex); + list_for_each_entry(stpg, &sport->guid_id->tpg_list, entry) { + if (!IS_ERR_OR_NULL(ch->sess)) + break; + ch->sess =3D target_setup_session(&stpg->tpg, tag_num, tag_size, TARGET_PROT_NORMAL, ch->sess_name, ch, NULL); + } + mutex_unlock(&sport->guid_id->mutex); } - mutex_unlock(&sport->port_guid_id.mutex); =20 - mutex_lock(&sport->port_gid_id.mutex); - list_for_each_entry(stpg, &sport->port_gid_id.tpg_list, entry) { - if (!IS_ERR_OR_NULL(ch->sess)) - break; - ch->sess =3D target_setup_session(&stpg->tpg, tag_num, + if (sport->gid_id) { + mutex_lock(&sport->gid_id->mutex); + list_for_each_entry(stpg, &sport->gid_id->tpg_list, entry) { + if (!IS_ERR_OR_NULL(ch->sess)) + break; + ch->sess =3D target_setup_session(&stpg->tpg, tag_num, tag_size, TARGET_PROT_NORMAL, i_port_id, ch, NULL); - if (!IS_ERR_OR_NULL(ch->sess)) - break; - /* Retry without leading "0x" */ - ch->sess =3D target_setup_session(&stpg->tpg, tag_num, + if (!IS_ERR_OR_NULL(ch->sess)) + break; + /* Retry without leading "0x" */ + ch->sess =3D target_setup_session(&stpg->tpg, tag_num, tag_size, TARGET_PROT_NORMAL, i_port_id + 2, ch, NULL); + } + mutex_unlock(&sport->gid_id->mutex); } - mutex_unlock(&sport->port_gid_id.mutex); =20 if (IS_ERR_OR_NULL(ch->sess)) { WARN_ON_ONCE(ch->sess =3D=3D NULL); @@ -2986,7 +2984,12 @@ static int srpt_release_sport(struct srpt_port *spor= t) return 0; } =20 -static struct se_wwn *__srpt_lookup_wwn(const char *name) +struct port_and_port_id { + struct srpt_port *sport; + struct srpt_port_id **port_id; +}; + +static struct port_and_port_id __srpt_lookup_port(const char *name) { struct ib_device *dev; struct srpt_device *sdev; @@ -3001,25 +3004,38 @@ static struct se_wwn *__srpt_lookup_wwn(const char = *name) for (i =3D 0; i < dev->phys_port_cnt; i++) { sport =3D &sdev->port[i]; =20 - if (strcmp(sport->port_guid_id.name, name) =3D=3D 0) - return &sport->port_guid_id.wwn; - if (strcmp(sport->port_gid_id.name, name) =3D=3D 0) - return &sport->port_gid_id.wwn; + if (strcmp(sport->guid_name, name) =3D=3D 0) { + kref_get(&sdev->refcnt); + return (struct port_and_port_id){ + sport, &sport->guid_id}; + } + if (strcmp(sport->gid_name, name) =3D=3D 0) { + kref_get(&sdev->refcnt); + return (struct port_and_port_id){ + sport, &sport->gid_id}; + } } } =20 - return NULL; + return (struct port_and_port_id){}; } =20 -static struct se_wwn *srpt_lookup_wwn(const char *name) +/** + * srpt_lookup_port() - Look up an RDMA port by name + * @name: ASCII port name + * + * Increments the RDMA port reference count if an RDMA port pointer is ret= urned. + * The caller must drop that reference count by calling srpt_port_put_ref(= ). + */ +static struct port_and_port_id srpt_lookup_port(const char *name) { - struct se_wwn *wwn; + struct port_and_port_id papi; =20 spin_lock(&srpt_dev_lock); - wwn =3D __srpt_lookup_wwn(name); + papi =3D __srpt_lookup_port(name); spin_unlock(&srpt_dev_lock); =20 - return wwn; + return papi; } =20 static void srpt_free_srq(struct srpt_device *sdev) @@ -3198,10 +3214,6 @@ static int srpt_add_one(struct ib_device *device) sport->port_attrib.srp_sq_size =3D DEF_SRPT_SQ_SIZE; sport->port_attrib.use_srq =3D false; INIT_WORK(&sport->work, srpt_refresh_port_work); - mutex_init(&sport->port_guid_id.mutex); - INIT_LIST_HEAD(&sport->port_guid_id.tpg_list); - mutex_init(&sport->port_gid_id.mutex); - INIT_LIST_HEAD(&sport->port_gid_id.tpg_list); =20 ret =3D srpt_refresh_port(sport); if (ret) { @@ -3302,10 +3314,10 @@ static struct srpt_port_id *srpt_wwn_to_sport_id(st= ruct se_wwn *wwn) { struct srpt_port *sport =3D wwn->priv; =20 - if (wwn =3D=3D &sport->port_guid_id.wwn) - return &sport->port_guid_id; - if (wwn =3D=3D &sport->port_gid_id.wwn) - return &sport->port_gid_id; + if (sport->guid_id && &sport->guid_id->wwn =3D=3D wwn) + return sport->guid_id; + if (sport->gid_id && &sport->gid_id->wwn =3D=3D wwn) + return sport->gid_id; WARN_ON_ONCE(true); return NULL; } @@ -3820,7 +3832,31 @@ static struct se_wwn *srpt_make_tport(struct target_= fabric_configfs *tf, struct config_group *group, const char *name) { - return srpt_lookup_wwn(name) ? : ERR_PTR(-EINVAL); + struct port_and_port_id papi =3D srpt_lookup_port(name); + struct srpt_port *sport =3D papi.sport; + struct srpt_port_id *port_id; + + if (!papi.port_id) + return ERR_PTR(-EINVAL); + if (*papi.port_id) { + /* Attempt to create a directory that already exists. */ + WARN_ON_ONCE(true); + return &(*papi.port_id)->wwn; + } + port_id =3D kzalloc(sizeof(*port_id), GFP_KERNEL); + if (!port_id) { + srpt_sdev_put(sport->sdev); + return ERR_PTR(-ENOMEM); + } + mutex_init(&port_id->mutex); + INIT_LIST_HEAD(&port_id->tpg_list); + port_id->wwn.priv =3D sport; + memcpy(port_id->name, port_id =3D=3D sport->guid_id ? sport->guid_name : + sport->gid_name, ARRAY_SIZE(port_id->name)); + + *papi.port_id =3D port_id; + + return &port_id->wwn; } =20 /** @@ -3829,6 +3865,18 @@ static struct se_wwn *srpt_make_tport(struct target_= fabric_configfs *tf, */ static void srpt_drop_tport(struct se_wwn *wwn) { + struct srpt_port_id *port_id =3D container_of(wwn, typeof(*port_id), wwn); + struct srpt_port *sport =3D wwn->priv; + + if (sport->guid_id =3D=3D port_id) + sport->guid_id =3D NULL; + else if (sport->gid_id =3D=3D port_id) + sport->gid_id =3D NULL; + else + WARN_ON_ONCE(true); + + srpt_sdev_put(sport->sdev); + kfree(port_id); } =20 static ssize_t srpt_wwn_version_show(struct config_item *item, char *buf) diff --git a/drivers/infiniband/ulp/srpt/ib_srpt.h b/drivers/infiniband/ulp= /srpt/ib_srpt.h index 0cb867d580f1..4c46b301eea1 100644 --- a/drivers/infiniband/ulp/srpt/ib_srpt.h +++ b/drivers/infiniband/ulp/srpt/ib_srpt.h @@ -393,7 +393,7 @@ struct srpt_port_id { }; =20 /** - * struct srpt_port - information associated by SRPT with a single IB port + * struct srpt_port - SRPT RDMA port information * @sdev: backpointer to the HCA information. * @mad_agent: per-port management datagram processing information. * @enabled: Whether or not this target port is enabled. @@ -403,9 +403,9 @@ struct srpt_port_id { * @gid: cached value of the port's gid. * @work: work structure for refreshing the aforementioned cached val= ues. * @guid_name: port name in GUID format. - * @port_guid_id: LIO target port information for the port name in GUID fo= rmat. + * @guid_id: LIO target port information for the port name in GUID forma= t. * @gid_name: port name in GID format. - * @port_gid_id: LIO target port information for the port name in GID form= at. + * @gid_id: LIO target port information for the port name in GID format. * @port_attrib: Port attributes that can be accessed through configfs. * @refcount: Number of objects associated with this port. * @freed_channels: Completion that will be signaled once @refcount become= s 0. @@ -422,9 +422,9 @@ struct srpt_port { union ib_gid gid; struct work_struct work; char guid_name[64]; - struct srpt_port_id port_guid_id; + struct srpt_port_id *guid_id; char gid_name[64]; - struct srpt_port_id port_gid_id; + struct srpt_port_id *gid_id; struct srpt_port_attrib port_attrib; atomic_t refcount; struct completion *freed_channels; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 745AFC25B0E for ; Mon, 15 Aug 2022 19:28:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245376AbiHOT2g (ORCPT ); Mon, 15 Aug 2022 15:28:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244636AbiHOTYc (ORCPT ); Mon, 15 Aug 2022 15:24:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69CAA3DF28; Mon, 15 Aug 2022 11:41: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 BFBD56113D; Mon, 15 Aug 2022 18:41:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EEBCC433C1; Mon, 15 Aug 2022 18:41:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588862; bh=M3xhcxIN8ENJPHujSBsF3FdrlL6jp6V6lcPb7cgGdOo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WWNzymBygh98Y8zpgglDHq7I9/2bnJVmC7hvIVaeCDl7Suzzuqw9qWz4na6K8QMSo mpQsLWdpQqusjccnBpD019qsCsDsBTzcdis1Il9mubmwr1AMa221zpEypE/9XrL/QE RNlWUfO134+0n/xkyGRRdMFRizzUG5PxJVrfcTvE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+58b51ac2b04e388ab7b0@syzkaller.appspotmail.com, "Liam R. Howlett" , Minchan Kim , "Christian Brauner (Microsoft)" , Hridya Valsaraju , Joel Fernandes , Martijn Coenen , Suren Baghdasaryan , Todd Kjos , "Matthew Wilcox (Oracle)" , Andrew Morton , Sasha Levin Subject: [PATCH 5.15 539/779] android: binder: stop saving a pointer to the VMA Date: Mon, 15 Aug 2022 20:03:03 +0200 Message-Id: <20220815180400.350699128@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liam R. Howlett [ Upstream commit a43cfc87caaf46710c8027a8c23b8a55f1078f19 ] Do not record a pointer to a VMA outside of the mmap_lock for later use. This is unsafe and there are a number of failure paths *after* the recorded VMA pointer may be freed during setup. There is no callback to the driver to clear the saved pointer from generic mm code. Furthermore, the VMA pointer may become stale if any number of VMA operations end up freeing the VMA so saving it was fragile to being with. Instead, change the binder_alloc struct to record the start address of the VMA and use vma_lookup() to get the vma when needed. Add lockdep mmap_lock checks on updates to the vma pointer to ensure the lock is held and depend on that lock for synchronization of readers and writers - which was already the case anyways, so the smp_wmb()/smp_rmb() was not necessary. [akpm@linux-foundation.org: fix drivers/android/binder_alloc_selftest.c] Link: https://lkml.kernel.org/r/20220621140212.vpkio64idahetbyf@revolver Fixes: da1b9564e85b ("android: binder: fix the race mmap and alloc_new_buf_= locked") Reported-by: syzbot+58b51ac2b04e388ab7b0@syzkaller.appspotmail.com Signed-off-by: Liam R. Howlett Cc: Minchan Kim Cc: Christian Brauner (Microsoft) Cc: Greg Kroah-Hartman Cc: Hridya Valsaraju Cc: Joel Fernandes Cc: Martijn Coenen Cc: Suren Baghdasaryan Cc: Todd Kjos Cc: Matthew Wilcox (Oracle) Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/android/binder_alloc.c | 30 ++++++++++++------------- drivers/android/binder_alloc.h | 2 +- drivers/android/binder_alloc_selftest.c | 2 +- 3 files changed, 16 insertions(+), 18 deletions(-) diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c index 47bc74a8c7b6..b398909fda36 100644 --- a/drivers/android/binder_alloc.c +++ b/drivers/android/binder_alloc.c @@ -213,7 +213,7 @@ static int binder_update_page_range(struct binder_alloc= *alloc, int allocate, =20 if (mm) { mmap_read_lock(mm); - vma =3D alloc->vma; + vma =3D vma_lookup(mm, alloc->vma_addr); } =20 if (!vma && need_mm) { @@ -313,16 +313,15 @@ static int binder_update_page_range(struct binder_all= oc *alloc, int allocate, static inline void binder_alloc_set_vma(struct binder_alloc *alloc, struct vm_area_struct *vma) { - if (vma) + unsigned long vm_start =3D 0; + + if (vma) { + vm_start =3D vma->vm_start; alloc->vma_vm_mm =3D vma->vm_mm; - /* - * If we see alloc->vma is not NULL, buffer data structures set up - * completely. Look at smp_rmb side binder_alloc_get_vma. - * We also want to guarantee new alloc->vma_vm_mm is always visible - * if alloc->vma is set. - */ - smp_wmb(); - alloc->vma =3D vma; + } + + mmap_assert_write_locked(alloc->vma_vm_mm); + alloc->vma_addr =3D vm_start; } =20 static inline struct vm_area_struct *binder_alloc_get_vma( @@ -330,11 +329,9 @@ static inline struct vm_area_struct *binder_alloc_get_= vma( { struct vm_area_struct *vma =3D NULL; =20 - if (alloc->vma) { - /* Look at description in binder_alloc_set_vma */ - smp_rmb(); - vma =3D alloc->vma; - } + if (alloc->vma_addr) + vma =3D vma_lookup(alloc->vma_vm_mm, alloc->vma_addr); + return vma; } =20 @@ -817,7 +814,8 @@ void binder_alloc_deferred_release(struct binder_alloc = *alloc) =20 buffers =3D 0; mutex_lock(&alloc->mutex); - BUG_ON(alloc->vma); + BUG_ON(alloc->vma_addr && + vma_lookup(alloc->vma_vm_mm, alloc->vma_addr)); =20 while ((n =3D rb_first(&alloc->allocated_buffers))) { buffer =3D rb_entry(n, struct binder_buffer, rb_node); diff --git a/drivers/android/binder_alloc.h b/drivers/android/binder_alloc.h index 7dea57a84c79..1e4fd37af5e0 100644 --- a/drivers/android/binder_alloc.h +++ b/drivers/android/binder_alloc.h @@ -100,7 +100,7 @@ struct binder_lru_page { */ struct binder_alloc { struct mutex mutex; - struct vm_area_struct *vma; + unsigned long vma_addr; struct mm_struct *vma_vm_mm; void __user *buffer; struct list_head buffers; diff --git a/drivers/android/binder_alloc_selftest.c b/drivers/android/bind= er_alloc_selftest.c index c2b323bc3b3a..43a881073a42 100644 --- a/drivers/android/binder_alloc_selftest.c +++ b/drivers/android/binder_alloc_selftest.c @@ -287,7 +287,7 @@ void binder_selftest_alloc(struct binder_alloc *alloc) if (!binder_selftest_run) return; mutex_lock(&binder_selftest_lock); - if (!binder_selftest_run || !alloc->vma) + if (!binder_selftest_run || !alloc->vma_addr) goto done; pr_info("STARTED\n"); binder_selftest_alloc_offset(alloc, end_offset, 0); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A872C25B0E for ; Mon, 15 Aug 2022 19:28:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245457AbiHOT2p (ORCPT ); Mon, 15 Aug 2022 15:28:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245125AbiHOTYo (ORCPT ); Mon, 15 Aug 2022 15:24:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3999E48C88; Mon, 15 Aug 2022 11:41: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 BACFB6113D; Mon, 15 Aug 2022 18:41:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD201C433C1; Mon, 15 Aug 2022 18:41:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588865; bh=PeOXGJFs0w0UcUVNaIMXcvP9j7s1pLeJ3CYXZuat4tw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DgM0bpC/3DGICzWQMbTVqm/J1FeALBEglL8GqQiGUPFJ2oHGa+VoPA4QYTIynE2fJ ev1apX+6IdYMtEu8JN+GW1/MUJERgZ29qPEl+uN2V/+lZE93wBjlQnc/cCxoaTeoIx P43vYu0Ms+r6anxQ9yy/MhUmaZ25gNCr9aPu4JVw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaohe Lin , Andrew Morton , Sasha Levin Subject: [PATCH 5.15 540/779] mm/mmap.c: fix missing call to vm_unacct_memory in mmap_region Date: Mon, 15 Aug 2022 20:03:04 +0200 Message-Id: <20220815180400.396206986@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaohe Lin [ Upstream commit 7f82f922319ede486540e8746769865b9508d2c2 ] Since the beginning, charged is set to 0 to avoid calling vm_unacct_memory twice because vm_unacct_memory will be called by above unmap_region. But since commit 4f74d2c8e827 ("vm: remove 'nr_accounted' calculations from the unmap_vmas() interfaces"), unmap_region doesn't call vm_unacct_memory anymore. So charged shouldn't be set to 0 now otherwise the calling to paired vm_unacct_memory will be missed and leads to imbalanced account. Link: https://lkml.kernel.org/r/20220618082027.43391-1-linmiaohe@huawei.com Fixes: 4f74d2c8e827 ("vm: remove 'nr_accounted' calculations from the unmap= _vmas() interfaces") Signed-off-by: Miaohe Lin Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- mm/mmap.c | 1 - 1 file changed, 1 deletion(-) diff --git a/mm/mmap.c b/mm/mmap.c index 6bb553ed5c55..031fca1a7c65 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1878,7 +1878,6 @@ unsigned long mmap_region(struct file *file, unsigned= long addr, =20 /* Undo any partial mapping done by a device driver. */ unmap_region(mm, vma, prev, vma->vm_start, vma->vm_end); - charged =3D 0; if (vm_flags & VM_SHARED) mapping_unmap_writable(file->f_mapping); free_vma: --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 367EDC00140 for ; Mon, 15 Aug 2022 19:28:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245253AbiHOT24 (ORCPT ); Mon, 15 Aug 2022 15:28:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244331AbiHOTZY (ORCPT ); Mon, 15 Aug 2022 15:25: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 B87FE3DF3F; Mon, 15 Aug 2022 11:41: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 690AEB8108B; Mon, 15 Aug 2022 18:41:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7EBEC433D6; Mon, 15 Aug 2022 18:41:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588868; bh=5pWfrt/jeU3UzOemzTFrVOklI4sIZ1fhq+ClWMCfkK8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tfKp8uOr8F05z9NyPZs/vlBnx0cecbIxM+OUhIi/fl3fU7wCuOx7acaai0Ljl85EN oIg82FeQ5rZyerd5PIx/iSnUEVno9TAs8D5bfJT09Y1PCZ/f5df3VvHlhOC4MpQQiF IKGzpVfIVz84BMkznr91z+Ran6ajYcFKNhMeYXw4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrei Vagin , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.15 541/779] selftests: kvm: set rax before vmcall Date: Mon, 15 Aug 2022 20:03:05 +0200 Message-Id: <20220815180400.445087721@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrei Vagin [ Upstream commit 281106f938d3daaea6f8b6723a8217a2a1ef6936 ] kvm_hypercall has to place the hypercall number in rax. Trace events show that kvm_pv_test doesn't work properly: kvm_pv_test-53132: kvm_hypercall: nr 0x0 a0 0x0 a1 0x0 a2 0x0 a3 0x0 kvm_pv_test-53132: kvm_hypercall: nr 0x0 a0 0x0 a1 0x0 a2 0x0 a3 0x0 kvm_pv_test-53132: kvm_hypercall: nr 0x0 a0 0x0 a1 0x0 a2 0x0 a3 0x0 With this change, it starts working as expected: kvm_pv_test-54285: kvm_hypercall: nr 0x5 a0 0x0 a1 0x0 a2 0x0 a3 0x0 kvm_pv_test-54285: kvm_hypercall: nr 0xa a0 0x0 a1 0x0 a2 0x0 a3 0x0 kvm_pv_test-54285: kvm_hypercall: nr 0xb a0 0x0 a1 0x0 a2 0x0 a3 0x0 Signed-off-by: Andrei Vagin Message-Id: <20220722230241.1944655-5-avagin@google.com> Fixes: ac4a4d6de22e ("selftests: kvm: test enforcement of paravirtual cpuid= features") Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- tools/testing/selftests/kvm/lib/x86_64/processor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b/tools/tes= ting/selftests/kvm/lib/x86_64/processor.c index 46057079d8bb..4f1449fa9592 100644 --- a/tools/testing/selftests/kvm/lib/x86_64/processor.c +++ b/tools/testing/selftests/kvm/lib/x86_64/processor.c @@ -1326,7 +1326,7 @@ uint64_t kvm_hypercall(uint64_t nr, uint64_t a0, uint= 64_t a1, uint64_t a2, =20 asm volatile("vmcall" : "=3Da"(r) - : "b"(a0), "c"(a1), "d"(a2), "S"(a3)); + : "a"(nr), "b"(a0), "c"(a1), "d"(a2), "S"(a3)); return r; } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C444C25B08 for ; Mon, 15 Aug 2022 19:29:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245586AbiHOT3A (ORCPT ); Mon, 15 Aug 2022 15:29:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245192AbiHOTZs (ORCPT ); Mon, 15 Aug 2022 15:25:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E0BB3E759; Mon, 15 Aug 2022 11:41: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 F02D161029; Mon, 15 Aug 2022 18:41:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1483C433C1; Mon, 15 Aug 2022 18:41:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588874; bh=0kvt60j2xLMDGX4/p5w7TBRFw0hJQ5k87RL9avNFBVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yeRZiq+P7OkMJb/snf+HdXWCrTMx0P2pHqoi43P4rV0fZKfo2/hHYnqvn6O8QByhc VoIo5HgskgkwvTGaZKsdWjREdRw8KM6ZtYFVTAuWpAiagXDn1q0toFiTklj+5WxSlR prc4PwlSM23tH0nB7A6a2vIXKDr/R4Z30g0nYxGQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xu Qiang , Rob Herring , Sasha Levin Subject: [PATCH 5.15 542/779] of/fdt: declared return type does not match actual return type Date: Mon, 15 Aug 2022 20:03:06 +0200 Message-Id: <20220815180400.484353850@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Xu Qiang [ Upstream commit 7913145afa51bbed9eaf8e5b4ee55fa9884a71e5 ] The commit 649cab56de8e (=E2=80=9Cof: properly check for error returned by fdt_get_name()=E2=80=9D) changed the return value type from bool to int, but forgot to change the return value simultaneously. populate_node was only called in unflatten_dt_nodes, and returns with values greater than or equal to 0 were discarded without further processing. Considering that return 0 usually indicates success, return 0 instead of return true. Fixes: 649cab56de8e (=E2=80=9Cof: properly check for error returned by fdt_= get_name()=E2=80=9D) Signed-off-by: Xu Qiang Signed-off-by: Rob Herring Link: https://lore.kernel.org/r/20220801120506.11461-2-xuqiang36@huawei.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/of/fdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 59a7a9ee58ef..d245628b15dd 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -245,7 +245,7 @@ static int populate_node(const void *blob, } =20 *pnp =3D np; - return true; + return 0; } =20 static void reverse_nodes(struct device_node *parent) --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C74EAC25B0E for ; Mon, 15 Aug 2022 19:29:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245656AbiHOT3L (ORCPT ); Mon, 15 Aug 2022 15:29:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245400AbiHOTZ6 (ORCPT ); Mon, 15 Aug 2022 15:25:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3EEE5A2F5; Mon, 15 Aug 2022 11:41: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 683E7B8105C; Mon, 15 Aug 2022 18:41:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B053C433D6; Mon, 15 Aug 2022 18:41:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588878; bh=uSXCGKyWfEZEfMx7t2fOTKn70UCFSbJkruLUw78RvUs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I62mynV8yP5AtXABpqGDTeSoPBtDXXG9uKr9Cgy7dDlKvr4kwyiog0MXzp205EcMd NiAxQ9sKSWLyt+gctFB+iLyiBspmX7PWRzAf3k8EnXC8kNNH5fkvffoSA3JmSILxM1 1lRc5QHgBaernsQAgbdZp4FZnhF+U30sl1Jwq3DE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Itay Aveksis , Maor Gottlieb , Leon Romanovsky , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.15 543/779] RDMA/mlx5: Add missing check for return value in get namespace flow Date: Mon, 15 Aug 2022 20:03:07 +0200 Message-Id: <20220815180400.514895853@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maor Gottlieb [ Upstream commit c9776457bd5eaad4ce4ecb17af8d8f3cc6957c0b ] Add missing check for return value when calling to mlx5_ib_ft_type_to_namespace, even though it can't really fail in this specific call. Fixes: 52438be44112 ("RDMA/mlx5: Allow inserting a steering rule to the FDB= ") Link: https://lore.kernel.org/r/7b9ceda217d9368a51dc47a46b769bad4af9ac92.16= 59256069.git.leonro@nvidia.com Reviewed-by: Itay Aveksis Signed-off-by: Maor Gottlieb Signed-off-by: Leon Romanovsky Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/infiniband/hw/mlx5/fs.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/hw/mlx5/fs.c b/drivers/infiniband/hw/mlx5/f= s.c index 5fbc0a8454b9..8a7e182af530 100644 --- a/drivers/infiniband/hw/mlx5/fs.c +++ b/drivers/infiniband/hw/mlx5/fs.c @@ -2078,12 +2078,10 @@ static int mlx5_ib_matcher_ns(struct uverbs_attr_bu= ndle *attrs, if (err) return err; =20 - if (flags) { - mlx5_ib_ft_type_to_namespace( + if (flags) + return mlx5_ib_ft_type_to_namespace( MLX5_IB_UAPI_FLOW_TABLE_TYPE_NIC_TX, &obj->ns_type); - return 0; - } } =20 obj->ns_type =3D MLX5_FLOW_NAMESPACE_BYPASS; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 474ACC3F6B0 for ; Mon, 15 Aug 2022 19:29:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245759AbiHOT32 (ORCPT ); Mon, 15 Aug 2022 15:29:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245611AbiHOT0C (ORCPT ); Mon, 15 Aug 2022 15:26: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 632BD3ED54; Mon, 15 Aug 2022 11:41: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 DEB2BB81081; Mon, 15 Aug 2022 18:41:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0AF1C433D6; Mon, 15 Aug 2022 18:41:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588881; bh=W+YzqJ82PDLn90z2FUSypkIRDrM6lgeCIWhlSJNRJeA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ElUqHAd5JIvuMdDSY/dl1wUEveOleTHBzOoawENIySqzsfxnA6blunQ9s7SGf7vhZ hJzSHV4qPs6p7zO2Wf6t+iPJtGvfre0FTU7vDiqA8LUT7wXmYlD7LXKleyf/qaci9U I0YuQR7kDXBEPt5eqcMOigf6OZD4oj0AiF4kfMY0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bob Pearson , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.15 544/779] RDMA/rxe: Add memory barriers to kernel queues Date: Mon, 15 Aug 2022 20:03:08 +0200 Message-Id: <20220815180400.549590306@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bob Pearson [ Upstream commit ae6e843fe08d0ea8e158815809dcc20e3a1afc22 ] Earlier patches added memory barriers to protect user space to kernel space communications. The user space queues were previously shown to have occasional memory synchonization errors which were removed by adding smp_load_acquire, smp_store_release barriers. This patch extends that to the case where queues are used between kernel space threads. This patch also extends the queue types to include kernel ULP queues which access the other end of the queues in kernel verbs calls like poll_cq and post_send/recv. Link: https://lore.kernel.org/r/20210914164206.19768-2-rpearsonhpe@gmail.com Signed-off-by: Bob Pearson Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/infiniband/sw/rxe/rxe_comp.c | 12 +- drivers/infiniband/sw/rxe/rxe_cq.c | 25 +-- drivers/infiniband/sw/rxe/rxe_qp.c | 12 +- drivers/infiniband/sw/rxe/rxe_queue.c | 30 ++- drivers/infiniband/sw/rxe/rxe_queue.h | 292 +++++++++++--------------- drivers/infiniband/sw/rxe/rxe_req.c | 37 ++-- drivers/infiniband/sw/rxe/rxe_resp.c | 40 +--- drivers/infiniband/sw/rxe/rxe_srq.c | 2 +- drivers/infiniband/sw/rxe/rxe_verbs.c | 53 +---- 9 files changed, 189 insertions(+), 314 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_comp.c b/drivers/infiniband/sw/r= xe/rxe_comp.c index d2d802c776fd..48a3864ada29 100644 --- a/drivers/infiniband/sw/rxe/rxe_comp.c +++ b/drivers/infiniband/sw/rxe/rxe_comp.c @@ -142,10 +142,7 @@ static inline enum comp_state get_wqe(struct rxe_qp *q= p, /* we come here whether or not we found a response packet to see if * there are any posted WQEs */ - if (qp->is_user) - wqe =3D queue_head(qp->sq.queue, QUEUE_TYPE_FROM_USER); - else - wqe =3D queue_head(qp->sq.queue, QUEUE_TYPE_KERNEL); + wqe =3D queue_head(qp->sq.queue, QUEUE_TYPE_FROM_CLIENT); *wqe_p =3D wqe; =20 /* no WQE or requester has not started it yet */ @@ -432,10 +429,7 @@ static void do_complete(struct rxe_qp *qp, struct rxe_= send_wqe *wqe) if (post) make_send_cqe(qp, wqe, &cqe); =20 - if (qp->is_user) - advance_consumer(qp->sq.queue, QUEUE_TYPE_FROM_USER); - else - advance_consumer(qp->sq.queue, QUEUE_TYPE_KERNEL); + queue_advance_consumer(qp->sq.queue, QUEUE_TYPE_FROM_CLIENT); =20 if (post) rxe_cq_post(qp->scq, &cqe, 0); @@ -539,7 +533,7 @@ static void rxe_drain_resp_pkts(struct rxe_qp *qp, bool= notify) wqe->status =3D IB_WC_WR_FLUSH_ERR; do_complete(qp, wqe); } else { - advance_consumer(q, q->type); + queue_advance_consumer(q, q->type); } } } diff --git a/drivers/infiniband/sw/rxe/rxe_cq.c b/drivers/infiniband/sw/rxe= /rxe_cq.c index aef288f164fd..4eedaa0244b3 100644 --- a/drivers/infiniband/sw/rxe/rxe_cq.c +++ b/drivers/infiniband/sw/rxe/rxe_cq.c @@ -25,11 +25,7 @@ int rxe_cq_chk_attr(struct rxe_dev *rxe, struct rxe_cq *= cq, } =20 if (cq) { - if (cq->is_user) - count =3D queue_count(cq->queue, QUEUE_TYPE_TO_USER); - else - count =3D queue_count(cq->queue, QUEUE_TYPE_KERNEL); - + count =3D queue_count(cq->queue, QUEUE_TYPE_TO_CLIENT); if (cqe < count) { pr_warn("cqe(%d) < current # elements in queue (%d)", cqe, count); @@ -65,7 +61,7 @@ int rxe_cq_from_init(struct rxe_dev *rxe, struct rxe_cq *= cq, int cqe, int err; enum queue_type type; =20 - type =3D uresp ? QUEUE_TYPE_TO_USER : QUEUE_TYPE_KERNEL; + type =3D QUEUE_TYPE_TO_CLIENT; cq->queue =3D rxe_queue_init(rxe, &cqe, sizeof(struct rxe_cqe), type); if (!cq->queue) { @@ -117,11 +113,7 @@ int rxe_cq_post(struct rxe_cq *cq, struct rxe_cqe *cqe= , int solicited) =20 spin_lock_irqsave(&cq->cq_lock, flags); =20 - if (cq->is_user) - full =3D queue_full(cq->queue, QUEUE_TYPE_TO_USER); - else - full =3D queue_full(cq->queue, QUEUE_TYPE_KERNEL); - + full =3D queue_full(cq->queue, QUEUE_TYPE_TO_CLIENT); if (unlikely(full)) { spin_unlock_irqrestore(&cq->cq_lock, flags); if (cq->ibcq.event_handler) { @@ -134,17 +126,10 @@ int rxe_cq_post(struct rxe_cq *cq, struct rxe_cqe *cq= e, int solicited) return -EBUSY; } =20 - if (cq->is_user) - addr =3D producer_addr(cq->queue, QUEUE_TYPE_TO_USER); - else - addr =3D producer_addr(cq->queue, QUEUE_TYPE_KERNEL); - + addr =3D queue_producer_addr(cq->queue, QUEUE_TYPE_TO_CLIENT); memcpy(addr, cqe, sizeof(*cqe)); =20 - if (cq->is_user) - advance_producer(cq->queue, QUEUE_TYPE_TO_USER); - else - advance_producer(cq->queue, QUEUE_TYPE_KERNEL); + queue_advance_producer(cq->queue, QUEUE_TYPE_TO_CLIENT); =20 spin_unlock_irqrestore(&cq->cq_lock, flags); =20 diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe= /rxe_qp.c index ed326d82725c..0d6a3d363554 100644 --- a/drivers/infiniband/sw/rxe/rxe_qp.c +++ b/drivers/infiniband/sw/rxe/rxe_qp.c @@ -231,7 +231,7 @@ static int rxe_qp_init_req(struct rxe_dev *rxe, struct = rxe_qp *qp, qp->sq.max_inline =3D init->cap.max_inline_data =3D wqe_size; wqe_size +=3D sizeof(struct rxe_send_wqe); =20 - type =3D uresp ? QUEUE_TYPE_FROM_USER : QUEUE_TYPE_KERNEL; + type =3D QUEUE_TYPE_FROM_CLIENT; qp->sq.queue =3D rxe_queue_init(rxe, &qp->sq.max_wr, wqe_size, type); if (!qp->sq.queue) @@ -248,12 +248,8 @@ static int rxe_qp_init_req(struct rxe_dev *rxe, struct= rxe_qp *qp, return err; } =20 - if (qp->is_user) - qp->req.wqe_index =3D producer_index(qp->sq.queue, - QUEUE_TYPE_FROM_USER); - else - qp->req.wqe_index =3D producer_index(qp->sq.queue, - QUEUE_TYPE_KERNEL); + qp->req.wqe_index =3D queue_get_producer(qp->sq.queue, + QUEUE_TYPE_FROM_CLIENT); =20 qp->req.state =3D QP_STATE_RESET; qp->req.opcode =3D -1; @@ -293,7 +289,7 @@ static int rxe_qp_init_resp(struct rxe_dev *rxe, struct= rxe_qp *qp, pr_debug("qp#%d max_wr =3D %d, max_sge =3D %d, wqe_size =3D %d\n", qp_num(qp), qp->rq.max_wr, qp->rq.max_sge, wqe_size); =20 - type =3D uresp ? QUEUE_TYPE_FROM_USER : QUEUE_TYPE_KERNEL; + type =3D QUEUE_TYPE_FROM_CLIENT; qp->rq.queue =3D rxe_queue_init(rxe, &qp->rq.max_wr, wqe_size, type); if (!qp->rq.queue) diff --git a/drivers/infiniband/sw/rxe/rxe_queue.c b/drivers/infiniband/sw/= rxe/rxe_queue.c index 72d95398e604..6e6e023c1b45 100644 --- a/drivers/infiniband/sw/rxe/rxe_queue.c +++ b/drivers/infiniband/sw/rxe/rxe_queue.c @@ -111,17 +111,33 @@ struct rxe_queue *rxe_queue_init(struct rxe_dev *rxe,= int *num_elem, static int resize_finish(struct rxe_queue *q, struct rxe_queue *new_q, unsigned int num_elem) { - if (!queue_empty(q, q->type) && (num_elem < queue_count(q, q->type))) + enum queue_type type =3D q->type; + u32 prod; + u32 cons; + + if (!queue_empty(q, q->type) && (num_elem < queue_count(q, type))) return -EINVAL; =20 - while (!queue_empty(q, q->type)) { - memcpy(producer_addr(new_q, new_q->type), - consumer_addr(q, q->type), - new_q->elem_size); - advance_producer(new_q, new_q->type); - advance_consumer(q, q->type); + prod =3D queue_get_producer(new_q, type); + cons =3D queue_get_consumer(q, type); + + while (!queue_empty(q, type)) { + memcpy(queue_addr_from_index(new_q, prod), + queue_addr_from_index(q, cons), new_q->elem_size); + prod =3D queue_next_index(new_q, prod); + cons =3D queue_next_index(q, cons); } =20 + new_q->buf->producer_index =3D prod; + q->buf->consumer_index =3D cons; + + /* update private index copies */ + if (type =3D=3D QUEUE_TYPE_TO_CLIENT) + new_q->index =3D new_q->buf->producer_index; + else + q->index =3D q->buf->consumer_index; + + /* exchange rxe_queue headers */ swap(*q, *new_q); =20 return 0; diff --git a/drivers/infiniband/sw/rxe/rxe_queue.h b/drivers/infiniband/sw/= rxe/rxe_queue.h index 2702b0e55fc3..6227112ef7a2 100644 --- a/drivers/infiniband/sw/rxe/rxe_queue.h +++ b/drivers/infiniband/sw/rxe/rxe_queue.h @@ -10,34 +10,47 @@ /* for definition of shared struct rxe_queue_buf */ #include =20 -/* implements a simple circular buffer that can optionally be - * shared between user space and the kernel and can be resized - * the requested element size is rounded up to a power of 2 - * and the number of elements in the buffer is also rounded - * up to a power of 2. Since the queue is empty when the - * producer and consumer indices match the maximum capacity - * of the queue is one less than the number of element slots +/* Implements a simple circular buffer that is shared between user + * and the driver and can be resized. The requested element size is + * rounded up to a power of 2 and the number of elements in the buffer + * is also rounded up to a power of 2. Since the queue is empty when + * the producer and consumer indices match the maximum capacity of the + * queue is one less than the number of element slots. * * Notes: - * - Kernel space indices are always masked off to q->index_mask - * before storing so do not need to be checked on reads. - * - User space indices may be out of range and must be - * masked before use when read. - * - The kernel indices for shared queues must not be written - * by user space so a local copy is used and a shared copy is - * stored when the local copy changes. + * - The driver indices are always masked off to q->index_mask + * before storing so do not need to be checked on reads. + * - The user whether user space or kernel is generally + * not trusted so its parameters are masked to make sure + * they do not access the queue out of bounds on reads. + * - The driver indices for queues must not be written + * by user so a local copy is used and a shared copy is + * stored when the local copy is changed. * - By passing the type in the parameter list separate from q - * the compiler can eliminate the switch statement when the - * actual queue type is known when the function is called. - * In the performance path this is done. In less critical - * paths just q->type is passed. + * the compiler can eliminate the switch statement when the + * actual queue type is known when the function is called at + * compile time. + * - These queues are lock free. The user and driver must protect + * changes to their end of the queues with locks if more than one + * CPU can be accessing it at the same time. */ =20 -/* type of queue */ +/** + * enum queue_type - type of queue + * @QUEUE_TYPE_TO_CLIENT: Queue is written by rxe driver and + * read by client. Used by rxe driver only. + * @QUEUE_TYPE_FROM_CLIENT: Queue is written by client and + * read by rxe driver. Used by rxe driver only. + * @QUEUE_TYPE_TO_DRIVER: Queue is written by client and + * read by rxe driver. Used by kernel client only. + * @QUEUE_TYPE_FROM_DRIVER: Queue is written by rxe driver and + * read by client. Used by kernel client only. + */ enum queue_type { - QUEUE_TYPE_KERNEL, - QUEUE_TYPE_TO_USER, - QUEUE_TYPE_FROM_USER, + QUEUE_TYPE_TO_CLIENT, + QUEUE_TYPE_FROM_CLIENT, + QUEUE_TYPE_TO_DRIVER, + QUEUE_TYPE_FROM_DRIVER, }; =20 struct rxe_queue { @@ -69,238 +82,171 @@ struct rxe_queue *rxe_queue_init(struct rxe_dev *rxe,= int *num_elem, int rxe_queue_resize(struct rxe_queue *q, unsigned int *num_elem_p, unsigned int elem_size, struct ib_udata *udata, struct mminfo __user *outbuf, - /* Protect producers while resizing queue */ - spinlock_t *producer_lock, - /* Protect consumers while resizing queue */ - spinlock_t *consumer_lock); + spinlock_t *producer_lock, spinlock_t *consumer_lock); =20 void rxe_queue_cleanup(struct rxe_queue *queue); =20 -static inline int next_index(struct rxe_queue *q, int index) +static inline u32 queue_next_index(struct rxe_queue *q, int index) { - return (index + 1) & q->buf->index_mask; + return (index + 1) & q->index_mask; } =20 -static inline int queue_empty(struct rxe_queue *q, enum queue_type type) +static inline u32 queue_get_producer(const struct rxe_queue *q, + enum queue_type type) { u32 prod; - u32 cons; =20 switch (type) { - case QUEUE_TYPE_FROM_USER: - /* protect user space index */ + case QUEUE_TYPE_FROM_CLIENT: + /* protect user index */ prod =3D smp_load_acquire(&q->buf->producer_index); - cons =3D q->index; break; - case QUEUE_TYPE_TO_USER: + case QUEUE_TYPE_TO_CLIENT: prod =3D q->index; - /* protect user space index */ - cons =3D smp_load_acquire(&q->buf->consumer_index); break; - case QUEUE_TYPE_KERNEL: + case QUEUE_TYPE_FROM_DRIVER: + /* protect driver index */ + prod =3D smp_load_acquire(&q->buf->producer_index); + break; + case QUEUE_TYPE_TO_DRIVER: prod =3D q->buf->producer_index; - cons =3D q->buf->consumer_index; break; } =20 - return ((prod - cons) & q->index_mask) =3D=3D 0; + return prod; } =20 -static inline int queue_full(struct rxe_queue *q, enum queue_type type) +static inline u32 queue_get_consumer(const struct rxe_queue *q, + enum queue_type type) { - u32 prod; u32 cons; =20 switch (type) { - case QUEUE_TYPE_FROM_USER: - /* protect user space index */ - prod =3D smp_load_acquire(&q->buf->producer_index); + case QUEUE_TYPE_FROM_CLIENT: cons =3D q->index; break; - case QUEUE_TYPE_TO_USER: - prod =3D q->index; - /* protect user space index */ + case QUEUE_TYPE_TO_CLIENT: + /* protect user index */ cons =3D smp_load_acquire(&q->buf->consumer_index); break; - case QUEUE_TYPE_KERNEL: - prod =3D q->buf->producer_index; + case QUEUE_TYPE_FROM_DRIVER: cons =3D q->buf->consumer_index; break; + case QUEUE_TYPE_TO_DRIVER: + /* protect driver index */ + cons =3D smp_load_acquire(&q->buf->consumer_index); + break; } =20 - return ((prod + 1 - cons) & q->index_mask) =3D=3D 0; + return cons; } =20 -static inline unsigned int queue_count(const struct rxe_queue *q, - enum queue_type type) +static inline int queue_empty(struct rxe_queue *q, enum queue_type type) { - u32 prod; - u32 cons; - - switch (type) { - case QUEUE_TYPE_FROM_USER: - /* protect user space index */ - prod =3D smp_load_acquire(&q->buf->producer_index); - cons =3D q->index; - break; - case QUEUE_TYPE_TO_USER: - prod =3D q->index; - /* protect user space index */ - cons =3D smp_load_acquire(&q->buf->consumer_index); - break; - case QUEUE_TYPE_KERNEL: - prod =3D q->buf->producer_index; - cons =3D q->buf->consumer_index; - break; - } + u32 prod =3D queue_get_producer(q, type); + u32 cons =3D queue_get_consumer(q, type); =20 - return (prod - cons) & q->index_mask; + return ((prod - cons) & q->index_mask) =3D=3D 0; } =20 -static inline void advance_producer(struct rxe_queue *q, enum queue_type t= ype) +static inline int queue_full(struct rxe_queue *q, enum queue_type type) { - u32 prod; + u32 prod =3D queue_get_producer(q, type); + u32 cons =3D queue_get_consumer(q, type); =20 - switch (type) { - case QUEUE_TYPE_FROM_USER: - pr_warn_once("Normally kernel should not write user space index\n"); - /* protect user space index */ - prod =3D smp_load_acquire(&q->buf->producer_index); - prod =3D (prod + 1) & q->index_mask; - /* same */ - smp_store_release(&q->buf->producer_index, prod); - break; - case QUEUE_TYPE_TO_USER: - prod =3D q->index; - q->index =3D (prod + 1) & q->index_mask; - q->buf->producer_index =3D q->index; - break; - case QUEUE_TYPE_KERNEL: - prod =3D q->buf->producer_index; - q->buf->producer_index =3D (prod + 1) & q->index_mask; - break; - } + return ((prod + 1 - cons) & q->index_mask) =3D=3D 0; } =20 -static inline void advance_consumer(struct rxe_queue *q, enum queue_type t= ype) +static inline u32 queue_count(const struct rxe_queue *q, + enum queue_type type) { - u32 cons; + u32 prod =3D queue_get_producer(q, type); + u32 cons =3D queue_get_consumer(q, type); =20 - switch (type) { - case QUEUE_TYPE_FROM_USER: - cons =3D q->index; - q->index =3D (cons + 1) & q->index_mask; - q->buf->consumer_index =3D q->index; - break; - case QUEUE_TYPE_TO_USER: - pr_warn_once("Normally kernel should not write user space index\n"); - /* protect user space index */ - cons =3D smp_load_acquire(&q->buf->consumer_index); - cons =3D (cons + 1) & q->index_mask; - /* same */ - smp_store_release(&q->buf->consumer_index, cons); - break; - case QUEUE_TYPE_KERNEL: - cons =3D q->buf->consumer_index; - q->buf->consumer_index =3D (cons + 1) & q->index_mask; - break; - } + return (prod - cons) & q->index_mask; } =20 -static inline void *producer_addr(struct rxe_queue *q, enum queue_type typ= e) +static inline void queue_advance_producer(struct rxe_queue *q, + enum queue_type type) { u32 prod; =20 switch (type) { - case QUEUE_TYPE_FROM_USER: - /* protect user space index */ - prod =3D smp_load_acquire(&q->buf->producer_index); - prod &=3D q->index_mask; + case QUEUE_TYPE_FROM_CLIENT: + pr_warn("%s: attempt to advance client index\n", + __func__); break; - case QUEUE_TYPE_TO_USER: + case QUEUE_TYPE_TO_CLIENT: prod =3D q->index; + prod =3D (prod + 1) & q->index_mask; + q->index =3D prod; + /* protect user index */ + smp_store_release(&q->buf->producer_index, prod); + break; + case QUEUE_TYPE_FROM_DRIVER: + pr_warn("%s: attempt to advance driver index\n", + __func__); break; - case QUEUE_TYPE_KERNEL: + case QUEUE_TYPE_TO_DRIVER: prod =3D q->buf->producer_index; + prod =3D (prod + 1) & q->index_mask; + q->buf->producer_index =3D prod; break; } - - return q->buf->data + (prod << q->log2_elem_size); } =20 -static inline void *consumer_addr(struct rxe_queue *q, enum queue_type typ= e) +static inline void queue_advance_consumer(struct rxe_queue *q, + enum queue_type type) { u32 cons; =20 switch (type) { - case QUEUE_TYPE_FROM_USER: + case QUEUE_TYPE_FROM_CLIENT: cons =3D q->index; + cons =3D (cons + 1) & q->index_mask; + q->index =3D cons; + /* protect user index */ + smp_store_release(&q->buf->consumer_index, cons); break; - case QUEUE_TYPE_TO_USER: - /* protect user space index */ - cons =3D smp_load_acquire(&q->buf->consumer_index); - cons &=3D q->index_mask; + case QUEUE_TYPE_TO_CLIENT: + pr_warn("%s: attempt to advance client index\n", + __func__); break; - case QUEUE_TYPE_KERNEL: + case QUEUE_TYPE_FROM_DRIVER: cons =3D q->buf->consumer_index; + cons =3D (cons + 1) & q->index_mask; + q->buf->consumer_index =3D cons; + break; + case QUEUE_TYPE_TO_DRIVER: + pr_warn("%s: attempt to advance driver index\n", + __func__); break; } - - return q->buf->data + (cons << q->log2_elem_size); } =20 -static inline unsigned int producer_index(struct rxe_queue *q, - enum queue_type type) +static inline void *queue_producer_addr(struct rxe_queue *q, + enum queue_type type) { - u32 prod; + u32 prod =3D queue_get_producer(q, type); =20 - switch (type) { - case QUEUE_TYPE_FROM_USER: - /* protect user space index */ - prod =3D smp_load_acquire(&q->buf->producer_index); - prod &=3D q->index_mask; - break; - case QUEUE_TYPE_TO_USER: - prod =3D q->index; - break; - case QUEUE_TYPE_KERNEL: - prod =3D q->buf->producer_index; - break; - } - - return prod; + return q->buf->data + (prod << q->log2_elem_size); } =20 -static inline unsigned int consumer_index(struct rxe_queue *q, - enum queue_type type) +static inline void *queue_consumer_addr(struct rxe_queue *q, + enum queue_type type) { - u32 cons; - - switch (type) { - case QUEUE_TYPE_FROM_USER: - cons =3D q->index; - break; - case QUEUE_TYPE_TO_USER: - /* protect user space index */ - cons =3D smp_load_acquire(&q->buf->consumer_index); - cons &=3D q->index_mask; - break; - case QUEUE_TYPE_KERNEL: - cons =3D q->buf->consumer_index; - break; - } + u32 cons =3D queue_get_consumer(q, type); =20 - return cons; + return q->buf->data + (cons << q->log2_elem_size); } =20 -static inline void *addr_from_index(struct rxe_queue *q, - unsigned int index) +static inline void *queue_addr_from_index(struct rxe_queue *q, u32 index) { return q->buf->data + ((index & q->index_mask) - << q->buf->log2_elem_size); + << q->log2_elem_size); } =20 -static inline unsigned int index_from_addr(const struct rxe_queue *q, +static inline u32 queue_index_from_addr(const struct rxe_queue *q, const void *addr) { return (((u8 *)addr - q->buf->data) >> q->log2_elem_size) @@ -309,7 +255,7 @@ static inline unsigned int index_from_addr(const struct= rxe_queue *q, =20 static inline void *queue_head(struct rxe_queue *q, enum queue_type type) { - return queue_empty(q, type) ? NULL : consumer_addr(q, type); + return queue_empty(q, type) ? NULL : queue_consumer_addr(q, type); } =20 #endif /* RXE_QUEUE_H */ diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rx= e/rxe_req.c index 4ea9319f0d52..8c0e7ecd4141 100644 --- a/drivers/infiniband/sw/rxe/rxe_req.c +++ b/drivers/infiniband/sw/rxe/rxe_req.c @@ -49,21 +49,16 @@ static void req_retry(struct rxe_qp *qp) unsigned int cons; unsigned int prod; =20 - if (qp->is_user) { - cons =3D consumer_index(q, QUEUE_TYPE_FROM_USER); - prod =3D producer_index(q, QUEUE_TYPE_FROM_USER); - } else { - cons =3D consumer_index(q, QUEUE_TYPE_KERNEL); - prod =3D producer_index(q, QUEUE_TYPE_KERNEL); - } + cons =3D queue_get_consumer(q, QUEUE_TYPE_FROM_CLIENT); + prod =3D queue_get_producer(q, QUEUE_TYPE_FROM_CLIENT); =20 qp->req.wqe_index =3D cons; qp->req.psn =3D qp->comp.psn; qp->req.opcode =3D -1; =20 for (wqe_index =3D cons; wqe_index !=3D prod; - wqe_index =3D next_index(q, wqe_index)) { - wqe =3D addr_from_index(qp->sq.queue, wqe_index); + wqe_index =3D queue_next_index(q, wqe_index)) { + wqe =3D queue_addr_from_index(qp->sq.queue, wqe_index); mask =3D wr_opcode_mask(wqe->wr.opcode, qp); =20 if (wqe->state =3D=3D wqe_state_posted) @@ -121,15 +116,9 @@ static struct rxe_send_wqe *req_next_wqe(struct rxe_qp= *qp) unsigned int cons; unsigned int prod; =20 - if (qp->is_user) { - wqe =3D queue_head(q, QUEUE_TYPE_FROM_USER); - cons =3D consumer_index(q, QUEUE_TYPE_FROM_USER); - prod =3D producer_index(q, QUEUE_TYPE_FROM_USER); - } else { - wqe =3D queue_head(q, QUEUE_TYPE_KERNEL); - cons =3D consumer_index(q, QUEUE_TYPE_KERNEL); - prod =3D producer_index(q, QUEUE_TYPE_KERNEL); - } + wqe =3D queue_head(q, QUEUE_TYPE_FROM_CLIENT); + cons =3D queue_get_consumer(q, QUEUE_TYPE_FROM_CLIENT); + prod =3D queue_get_producer(q, QUEUE_TYPE_FROM_CLIENT); =20 if (unlikely(qp->req.state =3D=3D QP_STATE_DRAIN)) { /* check to see if we are drained; @@ -170,7 +159,7 @@ static struct rxe_send_wqe *req_next_wqe(struct rxe_qp = *qp) if (index =3D=3D prod) return NULL; =20 - wqe =3D addr_from_index(q, index); + wqe =3D queue_addr_from_index(q, index); =20 if (unlikely((qp->req.state =3D=3D QP_STATE_DRAIN || qp->req.state =3D=3D QP_STATE_DRAINED) && @@ -560,7 +549,8 @@ static void update_state(struct rxe_qp *qp, struct rxe_= send_wqe *wqe, qp->req.opcode =3D pkt->opcode; =20 if (pkt->mask & RXE_END_MASK) - qp->req.wqe_index =3D next_index(qp->sq.queue, qp->req.wqe_index); + qp->req.wqe_index =3D queue_next_index(qp->sq.queue, + qp->req.wqe_index); =20 qp->need_req_skb =3D 0; =20 @@ -610,7 +600,7 @@ static int rxe_do_local_ops(struct rxe_qp *qp, struct r= xe_send_wqe *wqe) =20 wqe->state =3D wqe_state_done; wqe->status =3D IB_WC_SUCCESS; - qp->req.wqe_index =3D next_index(qp->sq.queue, qp->req.wqe_index); + qp->req.wqe_index =3D queue_next_index(qp->sq.queue, qp->req.wqe_index); =20 /* There is no ack coming for local work requests * which can lead to a deadlock. So go ahead and complete @@ -643,7 +633,8 @@ int rxe_requester(void *arg) goto exit; =20 if (unlikely(qp->req.state =3D=3D QP_STATE_RESET)) { - qp->req.wqe_index =3D consumer_index(q, q->type); + qp->req.wqe_index =3D queue_get_consumer(q, + QUEUE_TYPE_FROM_CLIENT); qp->req.opcode =3D -1; qp->req.need_rd_atomic =3D 0; qp->req.wait_psn =3D 0; @@ -709,7 +700,7 @@ int rxe_requester(void *arg) wqe->last_psn =3D qp->req.psn; qp->req.psn =3D (qp->req.psn + 1) & BTH_PSN_MASK; qp->req.opcode =3D IB_OPCODE_UD_SEND_ONLY; - qp->req.wqe_index =3D next_index(qp->sq.queue, + qp->req.wqe_index =3D queue_next_index(qp->sq.queue, qp->req.wqe_index); wqe->state =3D wqe_state_done; wqe->status =3D IB_WC_SUCCESS; diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/r= xe/rxe_resp.c index 8ed172ab0beb..e7dec8481061 100644 --- a/drivers/infiniband/sw/rxe/rxe_resp.c +++ b/drivers/infiniband/sw/rxe/rxe_resp.c @@ -303,10 +303,7 @@ static enum resp_states get_srq_wqe(struct rxe_qp *qp) =20 spin_lock_bh(&srq->rq.consumer_lock); =20 - if (qp->is_user) - wqe =3D queue_head(q, QUEUE_TYPE_FROM_USER); - else - wqe =3D queue_head(q, QUEUE_TYPE_KERNEL); + wqe =3D queue_head(q, QUEUE_TYPE_FROM_CLIENT); if (!wqe) { spin_unlock_bh(&srq->rq.consumer_lock); return RESPST_ERR_RNR; @@ -322,13 +319,8 @@ static enum resp_states get_srq_wqe(struct rxe_qp *qp) memcpy(&qp->resp.srq_wqe, wqe, size); =20 qp->resp.wqe =3D &qp->resp.srq_wqe.wqe; - if (qp->is_user) { - advance_consumer(q, QUEUE_TYPE_FROM_USER); - count =3D queue_count(q, QUEUE_TYPE_FROM_USER); - } else { - advance_consumer(q, QUEUE_TYPE_KERNEL); - count =3D queue_count(q, QUEUE_TYPE_KERNEL); - } + queue_advance_consumer(q, QUEUE_TYPE_FROM_CLIENT); + count =3D queue_count(q, QUEUE_TYPE_FROM_CLIENT); =20 if (srq->limit && srq->ibsrq.event_handler && (count < srq->limit)) { srq->limit =3D 0; @@ -357,12 +349,8 @@ static enum resp_states check_resource(struct rxe_qp *= qp, qp->resp.status =3D IB_WC_WR_FLUSH_ERR; return RESPST_COMPLETE; } else if (!srq) { - if (qp->is_user) - qp->resp.wqe =3D queue_head(qp->rq.queue, - QUEUE_TYPE_FROM_USER); - else - qp->resp.wqe =3D queue_head(qp->rq.queue, - QUEUE_TYPE_KERNEL); + qp->resp.wqe =3D queue_head(qp->rq.queue, + QUEUE_TYPE_FROM_CLIENT); if (qp->resp.wqe) { qp->resp.status =3D IB_WC_WR_FLUSH_ERR; return RESPST_COMPLETE; @@ -389,12 +377,8 @@ static enum resp_states check_resource(struct rxe_qp *= qp, if (srq) return get_srq_wqe(qp); =20 - if (qp->is_user) - qp->resp.wqe =3D queue_head(qp->rq.queue, - QUEUE_TYPE_FROM_USER); - else - qp->resp.wqe =3D queue_head(qp->rq.queue, - QUEUE_TYPE_KERNEL); + qp->resp.wqe =3D queue_head(qp->rq.queue, + QUEUE_TYPE_FROM_CLIENT); return (qp->resp.wqe) ? RESPST_CHK_LENGTH : RESPST_ERR_RNR; } =20 @@ -938,12 +922,8 @@ static enum resp_states do_complete(struct rxe_qp *qp, } =20 /* have copy for srq and reference for !srq */ - if (!qp->srq) { - if (qp->is_user) - advance_consumer(qp->rq.queue, QUEUE_TYPE_FROM_USER); - else - advance_consumer(qp->rq.queue, QUEUE_TYPE_KERNEL); - } + if (!qp->srq) + queue_advance_consumer(qp->rq.queue, QUEUE_TYPE_FROM_CLIENT); =20 qp->resp.wqe =3D NULL; =20 @@ -1215,7 +1195,7 @@ static void rxe_drain_req_pkts(struct rxe_qp *qp, boo= l notify) return; =20 while (!qp->srq && q && queue_head(q, q->type)) - advance_consumer(q, q->type); + queue_advance_consumer(q, q->type); } =20 int rxe_responder(void *arg) diff --git a/drivers/infiniband/sw/rxe/rxe_srq.c b/drivers/infiniband/sw/rx= e/rxe_srq.c index 610c98d24b5c..a9e7817e2732 100644 --- a/drivers/infiniband/sw/rxe/rxe_srq.c +++ b/drivers/infiniband/sw/rxe/rxe_srq.c @@ -93,7 +93,7 @@ int rxe_srq_from_init(struct rxe_dev *rxe, struct rxe_srq= *srq, spin_lock_init(&srq->rq.producer_lock); spin_lock_init(&srq->rq.consumer_lock); =20 - type =3D uresp ? QUEUE_TYPE_FROM_USER : QUEUE_TYPE_KERNEL; + type =3D QUEUE_TYPE_FROM_CLIENT; q =3D rxe_queue_init(rxe, &srq->rq.max_wr, srq_wqe_size, type); if (!q) { diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/= rxe/rxe_verbs.c index 267b5a9c345d..46eaa1c5d4b3 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.c +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c @@ -218,11 +218,7 @@ static int post_one_recv(struct rxe_rq *rq, const stru= ct ib_recv_wr *ibwr) int num_sge =3D ibwr->num_sge; int full; =20 - if (rq->is_user) - full =3D queue_full(rq->queue, QUEUE_TYPE_FROM_USER); - else - full =3D queue_full(rq->queue, QUEUE_TYPE_KERNEL); - + full =3D queue_full(rq->queue, QUEUE_TYPE_TO_DRIVER); if (unlikely(full)) { err =3D -ENOMEM; goto err1; @@ -237,11 +233,7 @@ static int post_one_recv(struct rxe_rq *rq, const stru= ct ib_recv_wr *ibwr) for (i =3D 0; i < num_sge; i++) length +=3D ibwr->sg_list[i].length; =20 - if (rq->is_user) - recv_wqe =3D producer_addr(rq->queue, QUEUE_TYPE_FROM_USER); - else - recv_wqe =3D producer_addr(rq->queue, QUEUE_TYPE_KERNEL); - + recv_wqe =3D queue_producer_addr(rq->queue, QUEUE_TYPE_TO_DRIVER); recv_wqe->wr_id =3D ibwr->wr_id; recv_wqe->num_sge =3D num_sge; =20 @@ -254,10 +246,7 @@ static int post_one_recv(struct rxe_rq *rq, const stru= ct ib_recv_wr *ibwr) recv_wqe->dma.cur_sge =3D 0; recv_wqe->dma.sge_offset =3D 0; =20 - if (rq->is_user) - advance_producer(rq->queue, QUEUE_TYPE_FROM_USER); - else - advance_producer(rq->queue, QUEUE_TYPE_KERNEL); + queue_advance_producer(rq->queue, QUEUE_TYPE_TO_DRIVER); =20 return 0; =20 @@ -633,27 +622,17 @@ static int post_one_send(struct rxe_qp *qp, const str= uct ib_send_wr *ibwr, =20 spin_lock_irqsave(&qp->sq.sq_lock, flags); =20 - if (qp->is_user) - full =3D queue_full(sq->queue, QUEUE_TYPE_FROM_USER); - else - full =3D queue_full(sq->queue, QUEUE_TYPE_KERNEL); + full =3D queue_full(sq->queue, QUEUE_TYPE_TO_DRIVER); =20 if (unlikely(full)) { spin_unlock_irqrestore(&qp->sq.sq_lock, flags); return -ENOMEM; } =20 - if (qp->is_user) - send_wqe =3D producer_addr(sq->queue, QUEUE_TYPE_FROM_USER); - else - send_wqe =3D producer_addr(sq->queue, QUEUE_TYPE_KERNEL); - + send_wqe =3D queue_producer_addr(sq->queue, QUEUE_TYPE_TO_DRIVER); init_send_wqe(qp, ibwr, mask, length, send_wqe); =20 - if (qp->is_user) - advance_producer(sq->queue, QUEUE_TYPE_FROM_USER); - else - advance_producer(sq->queue, QUEUE_TYPE_KERNEL); + queue_advance_producer(sq->queue, QUEUE_TYPE_TO_DRIVER); =20 spin_unlock_irqrestore(&qp->sq.sq_lock, flags); =20 @@ -845,18 +824,12 @@ static int rxe_poll_cq(struct ib_cq *ibcq, int num_en= tries, struct ib_wc *wc) =20 spin_lock_irqsave(&cq->cq_lock, flags); for (i =3D 0; i < num_entries; i++) { - if (cq->is_user) - cqe =3D queue_head(cq->queue, QUEUE_TYPE_TO_USER); - else - cqe =3D queue_head(cq->queue, QUEUE_TYPE_KERNEL); + cqe =3D queue_head(cq->queue, QUEUE_TYPE_FROM_DRIVER); if (!cqe) break; =20 memcpy(wc++, &cqe->ibwc, sizeof(*wc)); - if (cq->is_user) - advance_consumer(cq->queue, QUEUE_TYPE_TO_USER); - else - advance_consumer(cq->queue, QUEUE_TYPE_KERNEL); + queue_advance_consumer(cq->queue, QUEUE_TYPE_FROM_DRIVER); } spin_unlock_irqrestore(&cq->cq_lock, flags); =20 @@ -868,10 +841,7 @@ static int rxe_peek_cq(struct ib_cq *ibcq, int wc_cnt) struct rxe_cq *cq =3D to_rcq(ibcq); int count; =20 - if (cq->is_user) - count =3D queue_count(cq->queue, QUEUE_TYPE_TO_USER); - else - count =3D queue_count(cq->queue, QUEUE_TYPE_KERNEL); + count =3D queue_count(cq->queue, QUEUE_TYPE_FROM_DRIVER); =20 return (count > wc_cnt) ? wc_cnt : count; } @@ -887,10 +857,7 @@ static int rxe_req_notify_cq(struct ib_cq *ibcq, enum = ib_cq_notify_flags flags) if (cq->notify !=3D IB_CQ_NEXT_COMP) cq->notify =3D flags & IB_CQ_SOLICITED_MASK; =20 - if (cq->is_user) - empty =3D queue_empty(cq->queue, QUEUE_TYPE_TO_USER); - else - empty =3D queue_empty(cq->queue, QUEUE_TYPE_KERNEL); + empty =3D queue_empty(cq->queue, QUEUE_TYPE_FROM_DRIVER); =20 if ((flags & IB_CQ_REPORT_MISSED_EVENTS) && !empty) ret =3D 1; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6400FC00140 for ; Mon, 15 Aug 2022 19:29:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244025AbiHOT3h (ORCPT ); Mon, 15 Aug 2022 15:29:37 -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 S245615AbiHOT0C (ORCPT ); Mon, 15 Aug 2022 15:26: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 602FE3ED70; Mon, 15 Aug 2022 11:41: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 133DBB8105C; Mon, 15 Aug 2022 18:41:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 584BEC433D7; Mon, 15 Aug 2022 18:41:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588884; bh=YVsnVuSTYcaa9tQGwvyI6dFXD95rjra3stsjmc8dPxE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AJGQ+UlWbzW+D2PIpck2a0PFYjsGdnwgCd3T2QM/79p/ztvBH3d7rKRHEvBqMlPen KkU/b6CQhMVaDHD8ADPtLUcSD9kS+RALz1pH2fpcHeU/OOt/fa9xS2TLTPSUnnM8QE gOjB1Jx1TwDWbPCqv3b2yYBr77N3r7Ro12GATWt8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiao Yang , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.15 545/779] RDMA/rxe: Remove the is_user members of struct rxe_sq/rxe_rq/rxe_srq Date: Mon, 15 Aug 2022 20:03:09 +0200 Message-Id: <20220815180400.598735848@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xiao Yang [ Upstream commit 1cf2ce8272802e677398fab47a73713bc6e1fd5c ] The is_user members of struct rxe_sq/rxe_rq/rxe_srq are unsed since commit ae6e843fe08d ("RDMA/rxe: Add memory barriers to kernel queues"). In this case, it is fine to remove them directly. Link: https://lore.kernel.org/r/20210930094813.226888-2-yangx.jy@fujitsu.com Signed-off-by: Xiao Yang Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/infiniband/sw/rxe/rxe_qp.c | 2 -- drivers/infiniband/sw/rxe/rxe_srq.c | 1 - drivers/infiniband/sw/rxe/rxe_verbs.c | 3 --- drivers/infiniband/sw/rxe/rxe_verbs.h | 3 --- 4 files changed, 9 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe= /rxe_qp.c index 0d6a3d363554..5731bc15991c 100644 --- a/drivers/infiniband/sw/rxe/rxe_qp.c +++ b/drivers/infiniband/sw/rxe/rxe_qp.c @@ -309,8 +309,6 @@ static int rxe_qp_init_resp(struct rxe_dev *rxe, struct= rxe_qp *qp, spin_lock_init(&qp->rq.producer_lock); spin_lock_init(&qp->rq.consumer_lock); =20 - qp->rq.is_user =3D qp->is_user; - skb_queue_head_init(&qp->resp_pkts); =20 rxe_init_task(rxe, &qp->resp.task, qp, diff --git a/drivers/infiniband/sw/rxe/rxe_srq.c b/drivers/infiniband/sw/rx= e/rxe_srq.c index a9e7817e2732..eb1c4c3b3a78 100644 --- a/drivers/infiniband/sw/rxe/rxe_srq.c +++ b/drivers/infiniband/sw/rxe/rxe_srq.c @@ -86,7 +86,6 @@ int rxe_srq_from_init(struct rxe_dev *rxe, struct rxe_srq= *srq, srq->srq_num =3D srq->pelem.index; srq->rq.max_wr =3D init->attr.max_wr; srq->rq.max_sge =3D init->attr.max_sge; - srq->rq.is_user =3D srq->is_user; =20 srq_wqe_size =3D rcv_wqe_size(srq->rq.max_sge); =20 diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/= rxe/rxe_verbs.c index 46eaa1c5d4b3..e40927cf5772 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.c +++ b/drivers/infiniband/sw/rxe/rxe_verbs.c @@ -270,9 +270,6 @@ static int rxe_create_srq(struct ib_srq *ibsrq, struct = ib_srq_init_attr *init, if (udata->outlen < sizeof(*uresp)) return -EINVAL; uresp =3D udata->outbuf; - srq->is_user =3D true; - } else { - srq->is_user =3D false; } =20 err =3D rxe_srq_chk_attr(rxe, NULL, &init->attr, IB_SRQ_INIT_MASK); diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.h b/drivers/infiniband/sw/= rxe/rxe_verbs.h index d90b1d77de34..c852a9907bad 100644 --- a/drivers/infiniband/sw/rxe/rxe_verbs.h +++ b/drivers/infiniband/sw/rxe/rxe_verbs.h @@ -77,7 +77,6 @@ enum wqe_state { }; =20 struct rxe_sq { - bool is_user; int max_wr; int max_sge; int max_inline; @@ -86,7 +85,6 @@ struct rxe_sq { }; =20 struct rxe_rq { - bool is_user; int max_wr; int max_sge; spinlock_t producer_lock; /* guard queue producer */ @@ -100,7 +98,6 @@ struct rxe_srq { struct rxe_pd *pd; struct rxe_rq rq; u32 srq_num; - bool is_user; =20 int limit; int error; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A585EC00140 for ; Mon, 15 Aug 2022 19:29:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244672AbiHOT3l (ORCPT ); Mon, 15 Aug 2022 15:29:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245752AbiHOT0I (ORCPT ); Mon, 15 Aug 2022 15:26: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 B20042E692; Mon, 15 Aug 2022 11:41: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 63BCBB8105C; Mon, 15 Aug 2022 18:41:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E05CC433D6; Mon, 15 Aug 2022 18:41:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588888; bh=YcOJxycpi4cPibHqtgkK5q4CTB0pAgpHo75/oWB9Fpk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xLYqUmF6bdWXvoJ40Rsa4CKDRbBXRc6LXSrnrRqA66HfcyxaBWYEg9QdiecQx8a4e lPG99oYUC4Kgo0Nz4gLA1K9gs5EaWnl71UWmz6BRpfWc2NW/LAEqIIKEUR+pl09sqj HG7YESjfgUcqTrFy9uIj/2J3jxGUpUdO0o9ZYpxo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+833061116fa28df97f3b@syzkaller.appspotmail.com, Zhu Yanjun , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.15 546/779] RDMA/rxe: Fix error unwind in rxe_create_qp() Date: Mon, 15 Aug 2022 20:03:10 +0200 Message-Id: <20220815180400.648278997@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhu Yanjun [ Upstream commit fd5382c5805c4bcb50fd25b7246247d3f7114733 ] In the function rxe_create_qp(), rxe_qp_from_init() is called to initialize qp, internally things like the spin locks are not setup until rxe_qp_init_req(). If an error occures before this point then the unwind will call rxe_cleanup() and eventually to rxe_qp_do_cleanup()/rxe_cleanup_task() which will oops when trying to access the uninitialized spinlock. Move the spinlock initializations earlier before any failures. Fixes: 8700e3e7c485 ("Soft RoCE driver") Link: https://lore.kernel.org/r/20220731063621.298405-1-yanjun.zhu@linux.dev Reported-by: syzbot+833061116fa28df97f3b@syzkaller.appspotmail.com Signed-off-by: Zhu Yanjun Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/infiniband/sw/rxe/rxe_qp.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe= /rxe_qp.c index 5731bc15991c..661b83d65af3 100644 --- a/drivers/infiniband/sw/rxe/rxe_qp.c +++ b/drivers/infiniband/sw/rxe/rxe_qp.c @@ -195,6 +195,14 @@ static void rxe_qp_init_misc(struct rxe_dev *rxe, stru= ct rxe_qp *qp, spin_lock_init(&qp->grp_lock); spin_lock_init(&qp->state_lock); =20 + spin_lock_init(&qp->req.task.state_lock); + spin_lock_init(&qp->resp.task.state_lock); + spin_lock_init(&qp->comp.task.state_lock); + + spin_lock_init(&qp->sq.sq_lock); + spin_lock_init(&qp->rq.producer_lock); + spin_lock_init(&qp->rq.consumer_lock); + atomic_set(&qp->ssn, 0); atomic_set(&qp->skb_out, 0); } @@ -255,7 +263,6 @@ static int rxe_qp_init_req(struct rxe_dev *rxe, struct = rxe_qp *qp, qp->req.opcode =3D -1; qp->comp.opcode =3D -1; =20 - spin_lock_init(&qp->sq.sq_lock); skb_queue_head_init(&qp->req_pkts); =20 rxe_init_task(rxe, &qp->req.task, qp, @@ -306,9 +313,6 @@ static int rxe_qp_init_resp(struct rxe_dev *rxe, struct= rxe_qp *qp, } } =20 - spin_lock_init(&qp->rq.producer_lock); - spin_lock_init(&qp->rq.consumer_lock); - skb_queue_head_init(&qp->resp_pkts); =20 rxe_init_task(rxe, &qp->resp.task, qp, --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 070F2C00140 for ; Mon, 15 Aug 2022 19:29:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244559AbiHOT3s (ORCPT ); Mon, 15 Aug 2022 15:29:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343500AbiHOT0J (ORCPT ); Mon, 15 Aug 2022 15:26: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 6541BF4C; Mon, 15 Aug 2022 11:41: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 02F6061029; Mon, 15 Aug 2022 18:41:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F3ABEC433D6; Mon, 15 Aug 2022 18:41:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588891; bh=UEx6Vo839Re8ohZgQ30MADWOy3uPBUVXeG91KoZjUHI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0PfbZ14kBhfhrsc3HyaMYC1ZHcjFfvTq/jcd8KtDROBpl/xUczoRanqEkTJK0nZuv ntH7pJPGJzc4MjFamkJnwcHKR2jcTdLsTpLP+R02BPW89yOvPoC65vH3QJtaX/F54C Q7T6UXesPfVVsF6fXWcUEiPGAKoSVKdrTUrAHxtw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, gi-oh.kim@ionos.com, Md Haris Iqbal , Jack Wang , Jens Axboe , Sasha Levin Subject: [PATCH 5.15 547/779] block/rnbd-srv: Set keep_id to true after mutex_trylock Date: Mon, 15 Aug 2022 20:03:11 +0200 Message-Id: <20220815180400.696262812@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Md Haris Iqbal [ Upstream commit 4bc14f3101364877dd59085f39e068a2a7ec9f2d ] After setting keep_id if the mutex trylock fails, the keep_id stays set for the rest of the sess_dev lifetime. Therefore, set keep_id to true after mutex_trylock succeeds, so that a failure of trylock does'nt touch keep_id. Fixes: b168e1d85cf3 ("block/rnbd-srv: Prevent a deadlock generated by acces= sing sysfs in parallel") Cc: gi-oh.kim@ionos.com Signed-off-by: Md Haris Iqbal Signed-off-by: Jack Wang Link: https://lore.kernel.org/r/20220707143122.460362-2-haris.iqbal@ionos.c= om Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/block/rnbd/rnbd-srv.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/block/rnbd/rnbd-srv.c b/drivers/block/rnbd/rnbd-srv.c index 1ba1a93a6fe7..1896cde8135e 100644 --- a/drivers/block/rnbd/rnbd-srv.c +++ b/drivers/block/rnbd/rnbd-srv.c @@ -333,10 +333,11 @@ void rnbd_srv_sess_dev_force_close(struct rnbd_srv_se= ss_dev *sess_dev, { struct rnbd_srv_session *sess =3D sess_dev->sess; =20 - sess_dev->keep_id =3D true; /* It is already started to close by client's close message. */ if (!mutex_trylock(&sess->lock)) return; + + sess_dev->keep_id =3D true; /* first remove sysfs itself to avoid deadlock */ sysfs_remove_file_self(&sess_dev->kobj, &attr->attr); rnbd_srv_destroy_dev_session_sysfs(sess_dev); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA4A1C00140 for ; Mon, 15 Aug 2022 19:29:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240529AbiHOT3w (ORCPT ); Mon, 15 Aug 2022 15:29:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343535AbiHOT0K (ORCPT ); Mon, 15 Aug 2022 15:26:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D78402ED60; Mon, 15 Aug 2022 11:41: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 7481060FB8; Mon, 15 Aug 2022 18:41:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 619AAC433D6; Mon, 15 Aug 2022 18:41:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588894; bh=3mOKCliFe7i9AhglC7ww2MiPXJeDXcOx3MuanO0bK3A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cMs0JttFRZGZdJ+vArm6h5i0eAsQDg2nApbsXDoi+E0k73jJtV14HrOSyHyrilFpv fuUKhN7O7fnJodn+iU0sHl/iRW5fPs8bcchS1iA1ZRF9fYbloGhPGynRp7uXxL9TdR HCI6pKWAggwSDXw+heqN1dT/H7xbnCSNVwvz19/o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Jens Axboe , Sasha Levin Subject: [PATCH 5.15 548/779] null_blk: fix ida error handling in null_add_dev() Date: Mon, 15 Aug 2022 20:03:12 +0200 Message-Id: <20220815180400.746303156@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter [ Upstream commit ee452a8d984f94fa8e894f003a52e776e4572881 ] There needs to be some error checking if ida_simple_get() fails. Also call ida_free() if there are errors later. Fixes: 94bc02e30fb8 ("nullb: use ida to manage index") Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/YtEhXsr6vJeoiYhd@kili Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/block/null_blk/main.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c index 187d779c8ca0..4c8b4101516c 100644 --- a/drivers/block/null_blk/main.c +++ b/drivers/block/null_blk/main.c @@ -1884,8 +1884,13 @@ static int null_add_dev(struct nullb_device *dev) blk_queue_flag_clear(QUEUE_FLAG_ADD_RANDOM, nullb->q); =20 mutex_lock(&lock); - nullb->index =3D ida_simple_get(&nullb_indexes, 0, 0, GFP_KERNEL); - dev->index =3D nullb->index; + rv =3D ida_simple_get(&nullb_indexes, 0, 0, GFP_KERNEL); + if (rv < 0) { + mutex_unlock(&lock); + goto out_cleanup_zone; + } + nullb->index =3D rv; + dev->index =3D rv; mutex_unlock(&lock); =20 blk_queue_logical_block_size(nullb->q, dev->blocksize); @@ -1905,13 +1910,16 @@ static int null_add_dev(struct nullb_device *dev) =20 rv =3D null_gendisk_register(nullb); if (rv) - goto out_cleanup_zone; + goto out_ida_free; =20 mutex_lock(&lock); list_add_tail(&nullb->list, &nullb_list); mutex_unlock(&lock); =20 return 0; + +out_ida_free: + ida_free(&nullb_indexes, nullb->index); out_cleanup_zone: null_free_zoned_dev(dev); out_cleanup_disk: --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2E3EC00140 for ; Mon, 15 Aug 2022 19:30:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244053AbiHOTaB (ORCPT ); Mon, 15 Aug 2022 15:30:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343604AbiHOT0L (ORCPT ); Mon, 15 Aug 2022 15:26: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 44CF73ED6B; Mon, 15 Aug 2022 11:41: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 D657E61120; Mon, 15 Aug 2022 18:41:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD8CCC433D6; Mon, 15 Aug 2022 18:41:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588898; bh=atgAS25s2COpB8BFvUkh8vDm4Mkm8/SqFe6Oe0UtabQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OHSBeCqtZkLeMvvCmyf3WdQKwAkItTccoz9urkEG0SfXxGZusO4r7zaaDuFDJZzr4 WOUgyxrWyPQ3IWHeAi1zLRzaMeZAqSl8urY2yBqyQ7zUSIGKdZZz/8ajvswcyjY8OK 7sLQqY0BlSu0PCsA1TOOiyHsCe6wNDvlpE7q9/Vs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bean Huo , Christoph Hellwig , Jens Axboe , Sasha Levin Subject: [PATCH 5.15 549/779] nvme: use command_id instead of req->tag in trace_nvme_complete_rq() Date: Mon, 15 Aug 2022 20:03:13 +0200 Message-Id: <20220815180400.793451288@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bean Huo [ Upstream commit 679c54f2de672b7d79d02f8c4ad483ff6dd8ce2e ] Use command_id instead of req->tag in trace_nvme_complete_rq(), because of commit e7006de6c238 ("nvme: code command_id with a genctr for use authentication after release"), cmd->common.command_id is set to ((genctl & 0xf)< 12 | req->tag), no longer req->tag, which makes cid in trace_nvme_complete_rq and trace_nvme_setup_cmd are not the same. Fixes: e7006de6c238 ("nvme: code command_id with a genctr for use authentic= ation after release") Signed-off-by: Bean Huo Signed-off-by: Christoph Hellwig Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/nvme/host/trace.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/trace.h b/drivers/nvme/host/trace.h index 35bac7a25422..aa8b0f86b2be 100644 --- a/drivers/nvme/host/trace.h +++ b/drivers/nvme/host/trace.h @@ -98,7 +98,7 @@ TRACE_EVENT(nvme_complete_rq, TP_fast_assign( __entry->ctrl_id =3D nvme_req(req)->ctrl->instance; __entry->qid =3D nvme_req_qid(req); - __entry->cid =3D req->tag; + __entry->cid =3D nvme_req(req)->cmd->common.command_id; __entry->result =3D le64_to_cpu(nvme_req(req)->result.u64); __entry->retries =3D nvme_req(req)->retries; __entry->flags =3D nvme_req(req)->flags; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC3FFC00140 for ; Mon, 15 Aug 2022 19:30:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244010AbiHOTaN (ORCPT ); Mon, 15 Aug 2022 15:30:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343736AbiHOT0M (ORCPT ); Mon, 15 Aug 2022 15:26:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FFAF2E6A9; Mon, 15 Aug 2022 11:41: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 1C19D61052; Mon, 15 Aug 2022 18:41:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0DD6FC433D6; Mon, 15 Aug 2022 18:41:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588901; bh=jqZQpyPn2dZOqCwXBRjbQ/P5QFK+HXUbTUTfYyIkLK0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zsQJaPHc0jH0Ng4vNWF5v9nGM3ps7z5JlCooQX9Ojiskpl0tNNG9iJrVcktrf3v6m fIYl9HKB00ifw27s2RGxM5JJIqBiR6HojAFZfNsh4/TEY3K3wGbw7dYDcE0vod5nUK 7xrrrlTeBHbNOlKXpyi6dimfcEV0xvPZyTcKT9cw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nick Bowler , Guixin Liu , Christoph Hellwig , Jens Axboe , Sasha Levin Subject: [PATCH 5.15 550/779] nvme: define compat_ioctl again to unbreak 32-bit userspace. Date: Mon, 15 Aug 2022 20:03:14 +0200 Message-Id: <20220815180400.844968398@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nick Bowler [ Upstream commit a25d4261582cf00dad884c194d21084836663d3d ] Commit 89b3d6e60550 ("nvme: simplify the compat ioctl handling") removed the initialization of compat_ioctl from the nvme block_device_operations structures. Presumably the expectation was that 32-bit ioctls would be directed through the regular handler but this is not the case: failing to assign .compat_ioctl actually means that the compat case is disabled entirely, and any attempt to submit nvme ioctls from 32-bit userspace fails outright with -ENOTTY. For example: % smartctl -x /dev/nvme0n1 [...] Read NVMe Identify Controller failed: NVME_IOCTL_ADMIN_CMD: Inappropriate= ioctl for device The blkdev_compat_ptr_ioctl helper can be used to direct compat calls through the main ioctl handler and makes things work again. Fixes: 89b3d6e60550 ("nvme: simplify the compat ioctl handling") Signed-off-by: Nick Bowler Reviewed-by: Guixin Liu Signed-off-by: Christoph Hellwig Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/nvme/host/core.c | 1 + drivers/nvme/host/multipath.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 0c9cdbaf5cd6..ace55ebb1bff 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -2102,6 +2102,7 @@ static int nvme_report_zones(struct gendisk *disk, se= ctor_t sector, static const struct block_device_operations nvme_bdev_ops =3D { .owner =3D THIS_MODULE, .ioctl =3D nvme_ioctl, + .compat_ioctl =3D blkdev_compat_ptr_ioctl, .open =3D nvme_open, .release =3D nvme_release, .getgeo =3D nvme_getgeo, diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c index 064acad505d3..04fa276701d1 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -388,6 +388,7 @@ const struct block_device_operations nvme_ns_head_ops = =3D { .open =3D nvme_ns_head_open, .release =3D nvme_ns_head_release, .ioctl =3D nvme_ns_head_ioctl, + .compat_ioctl =3D blkdev_compat_ptr_ioctl, .getgeo =3D nvme_getgeo, .report_zones =3D nvme_ns_head_report_zones, .pr_ops =3D &nvme_pr_ops, --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74BA8C3F6B0 for ; Mon, 15 Aug 2022 19:30:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244019AbiHOTaT (ORCPT ); Mon, 15 Aug 2022 15:30:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343790AbiHOT0O (ORCPT ); Mon, 15 Aug 2022 15:26:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB45A2ED69; Mon, 15 Aug 2022 11:41:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4744D61029; Mon, 15 Aug 2022 18:41:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 378FCC433B5; Mon, 15 Aug 2022 18:41:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588904; bh=yIa20byh02SPEnrPWn+KsrTdc7YW/1nPI3I2EWlrIBk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1op+MAWkzb+815QFh157OHyY2JbS57AVxsOxfm4t8GdKlseeS3fG00a1Jhs27452j X3bfyF1Oh/eoKtSUYGItwkxfhVgJPu6l3p8G3eK+CqlptiAXTzawecWw1r8hMFlsNF GyCMC3Tx0zs4SxFmALnZEQWC/GDbRvINji1/vwsc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Max Gurtovoy , Sagi Grimberg , Keith Busch , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.15 551/779] nvme: disable namespace access for unsupported metadata Date: Mon, 15 Aug 2022 20:03:15 +0200 Message-Id: <20220815180400.883704062@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Keith Busch [ Upstream commit d39ad2a45c0e38def3e0c95f5b90d9af4274c939 ] The only fabrics target that supports metadata handling through the separate integrity buffer is RDMA. It is currently usable only if the size is 8B per block and formatted for protection information. If an rdma target were to export a namespace with a different format (ex: 4k+64B), the driver will not be able to submit valid read/write commands for that namespace. Suppress setting the metadata feature in the namespace so that the gendisk capacity will be set to 0. This will prevent read/write access through the block stack, but will continue to allow ioctl passthrough commands. Cc: Max Gurtovoy Cc: Sagi Grimberg Signed-off-by: Keith Busch Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/nvme/host/core.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index ace55ebb1bff..d9aea6c22f52 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1744,9 +1744,20 @@ static int nvme_configure_metadata(struct nvme_ns *n= s, struct nvme_id_ns *id) */ if (WARN_ON_ONCE(!(id->flbas & NVME_NS_FLBAS_META_EXT))) return -EINVAL; - if (ctrl->max_integrity_segments) - ns->features |=3D - (NVME_NS_METADATA_SUPPORTED | NVME_NS_EXT_LBAS); + + ns->features |=3D NVME_NS_EXT_LBAS; + + /* + * The current fabrics transport drivers support namespace + * metadata formats only if nvme_ns_has_pi() returns true. + * Suppress support for all other formats so the namespace will + * have a 0 capacity and not be usable through the block stack. + * + * Note, this check will need to be modified if any drivers + * gain the ability to use other metadata formats. + */ + if (ctrl->max_integrity_segments && nvme_ns_has_pi(ns)) + ns->features |=3D NVME_NS_METADATA_SUPPORTED; } else { /* * For PCIe controllers, we can't easily remap the separate --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D3A7C00140 for ; Mon, 15 Aug 2022 19:31:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245120AbiHOTak (ORCPT ); Mon, 15 Aug 2022 15:30:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343899AbiHOT0R (ORCPT ); Mon, 15 Aug 2022 15:26:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D27A6373; Mon, 15 Aug 2022 11:41: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 CE03260FB8; Mon, 15 Aug 2022 18:41:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE70EC433D7; Mon, 15 Aug 2022 18:41:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588911; bh=KG7BALg1sD0ROWmjsKGTkVQvs7DVZVNMvsof7QwVH8I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=saW0VZP7GyLal6Yxek+Fi8HbJmMq3eZTwezN8S2EsF+HukbfIa4zTtJgodNWTC0lI v88dz90OZH7uubBfYEWSOofXLpN1Y7iHWIbfG5CUa41OzoB+olejvZyyQe/puLBmFa +j9ARGvkGSKFzJlg591AEuOi3EYYp0hdDQSzpnkw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Sagi Grimberg , Daniel Wagner , Kanchan Joshi , Sasha Levin Subject: [PATCH 5.15 552/779] nvme: dont return an error from nvme_configure_metadata Date: Mon, 15 Aug 2022 20:03:16 +0200 Message-Id: <20220815180400.932327480@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 363f6368603743072e5f318c668c632bccb097a3 ] When a fabrics controller claims to support an invalidate metadata configuration we already warn and disable metadata support. No need to also return an error during revalidation. Signed-off-by: Christoph Hellwig Reviewed-by: Sagi Grimberg Reviewed-by: Daniel Wagner Tested-by: Kanchan Joshi Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/nvme/host/core.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index d9aea6c22f52..ddaad05ff043 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1719,7 +1719,7 @@ static int nvme_setup_streams_ns(struct nvme_ctrl *ct= rl, struct nvme_ns *ns, return 0; } =20 -static int nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns *= id) +static void nvme_configure_metadata(struct nvme_ns *ns, struct nvme_id_ns = *id) { struct nvme_ctrl *ctrl =3D ns->ctrl; =20 @@ -1735,7 +1735,8 @@ static int nvme_configure_metadata(struct nvme_ns *ns= , struct nvme_id_ns *id) =20 ns->features &=3D ~(NVME_NS_METADATA_SUPPORTED | NVME_NS_EXT_LBAS); if (!ns->ms || !(ctrl->ops->flags & NVME_F_METADATA_SUPPORTED)) - return 0; + return; + if (ctrl->ops->flags & NVME_F_FABRICS) { /* * The NVMe over Fabrics specification only supports metadata as @@ -1743,7 +1744,7 @@ static int nvme_configure_metadata(struct nvme_ns *ns= , struct nvme_id_ns *id) * remap the separate metadata buffer from the block layer. */ if (WARN_ON_ONCE(!(id->flbas & NVME_NS_FLBAS_META_EXT))) - return -EINVAL; + return; =20 ns->features |=3D NVME_NS_EXT_LBAS; =20 @@ -1770,8 +1771,6 @@ static int nvme_configure_metadata(struct nvme_ns *ns= , struct nvme_id_ns *id) else ns->features |=3D NVME_NS_METADATA_SUPPORTED; } - - return 0; } =20 static void nvme_set_queue_limits(struct nvme_ctrl *ctrl, @@ -1909,9 +1908,7 @@ static int nvme_update_ns_info(struct nvme_ns *ns, st= ruct nvme_id_ns *id) ns->lba_shift =3D id->lbaf[lbaf].ds; nvme_set_queue_limits(ns->ctrl, ns->queue); =20 - ret =3D nvme_configure_metadata(ns, id); - if (ret) - goto out_unfreeze; + nvme_configure_metadata(ns, id); nvme_set_chunk_sectors(ns, id); nvme_update_disk_info(ns->disk, ns, id); =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15656C25B0E for ; Mon, 15 Aug 2022 19:31:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245538AbiHOTat (ORCPT ); Mon, 15 Aug 2022 15:30:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343953AbiHOT0S (ORCPT ); Mon, 15 Aug 2022 15:26: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 8856E2A95F; Mon, 15 Aug 2022 11:41: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 2685160FB8; Mon, 15 Aug 2022 18:41:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2823C433B5; Mon, 15 Aug 2022 18:41:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588914; bh=d9k79EkyQ2/BI9EEkP/6956Vb4q7VWRvrkWKgvW8sIU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VmHT/nfTnaKx1Op5s8xwdmh2iMc1UQef3ojJgFDWtpKiyRM4v6XHcMG+fbMceDTVx qQyA42qmXYnF+PO4EbzlscjF244/uS6ARehaycInHERYPYvcNBnNkfioto9SVfT8Eh rmapXrcZnejGi3dnA6VSCIiMqPV5o0ko1kMHvuzM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joel Granados , Christoph Hellwig , Sagi Grimberg , Jens Axboe , Sasha Levin Subject: [PATCH 5.15 553/779] nvme: catch -ENODEV from nvme_revalidate_zones again Date: Mon, 15 Aug 2022 20:03:17 +0200 Message-Id: <20220815180400.976145763@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 e06b425bc835ead08b9fd935bf5e47eef473e7a0 ] nvme_revalidate_zones can also return -ENODEV if e.g. zone sizes aren't constant or not a power of two. In that case we should jump to marking the gendisk hidden and only support pass through. Fixes: 602e57c9799c ("nvme: also mark passthrough-only namespaces ready in = nvme_update_ns_info") Reported-by: Joel Granados Signed-off-by: Christoph Hellwig Reviewed-by: Joel Granados Reviewed-by: Sagi Grimberg Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/nvme/host/core.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index ddaad05ff043..ed2740585c5d 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1914,8 +1914,10 @@ static int nvme_update_ns_info(struct nvme_ns *ns, s= truct nvme_id_ns *id) =20 if (ns->head->ids.csi =3D=3D NVME_CSI_ZNS) { ret =3D nvme_update_zone_info(ns, lbaf); - if (ret) - goto out_unfreeze; + if (ret) { + blk_mq_unfreeze_queue(ns->disk->queue); + goto out; + } } =20 set_disk_ro(ns->disk, (id->nsattr & NVME_NS_ATTR_RO) || @@ -1926,7 +1928,7 @@ static int nvme_update_ns_info(struct nvme_ns *ns, st= ruct nvme_id_ns *id) if (blk_queue_is_zoned(ns->queue)) { ret =3D nvme_revalidate_zones(ns); if (ret && !nvme_first_scan(ns->disk)) - return ret; + goto out; } =20 if (nvme_ns_head_multipath(ns->head)) { @@ -1941,9 +1943,9 @@ static int nvme_update_ns_info(struct nvme_ns *ns, st= ruct nvme_id_ns *id) disk_update_readahead(ns->head->disk); blk_mq_unfreeze_queue(ns->head->disk->queue); } - return 0; =20 -out_unfreeze: + ret =3D 0; +out: /* * If probing fails due an unsupported feature, hide the block device, * but still allow other access. @@ -1953,7 +1955,6 @@ static int nvme_update_ns_info(struct nvme_ns *ns, st= ruct nvme_id_ns *id) set_bit(NVME_NS_READY, &ns->flags); ret =3D 0; } - blk_mq_unfreeze_queue(ns->disk->queue); return ret; } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25BBCC25B08 for ; Mon, 15 Aug 2022 19:31:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343591AbiHOTaz (ORCPT ); Mon, 15 Aug 2022 15:30:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343991AbiHOT0T (ORCPT ); Mon, 15 Aug 2022 15:26: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 7044127A; Mon, 15 Aug 2022 11:42: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 3353DB81085; Mon, 15 Aug 2022 18:41:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BFE1C433D6; Mon, 15 Aug 2022 18:41:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588917; bh=iKkEgDV2buLql+rSlAkMsm13QPSkgjnk2BlgGzA15C8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=na/+ipWcyHkeNxY6TMbnREIq+DojShIAfDL6yfpNZgrhWrn9Pu+9zpIbkFFdoXw9g DYPyrO/XyOJ3H3pmnXic6w+0leqkg3q19arR8sfJ0vExr47eHnaoxVrcADFXlaK4/d DiE9Z81JXMrCrcNGH3w5Rep9hBXedi4RuuJT6UwQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Keith Busch , Johannes Thumshirn , Christoph Hellwig , Jens Axboe , Sasha Levin Subject: [PATCH 5.15 554/779] block/bio: remove duplicate append pages code Date: Mon, 15 Aug 2022 20:03:18 +0200 Message-Id: <20220815180401.024572633@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Keith Busch [ Upstream commit c58c0074c54c2e2bb3bb0d5a4d8896bb660cc8bc ] The getting pages setup for zone append and normal IO are identical. Use common code for each. Signed-off-by: Keith Busch Reviewed-by: Johannes Thumshirn Reviewed-by: Christoph Hellwig Link: https://lore.kernel.org/r/20220610195830.3574005-3-kbusch@fb.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- block/bio.c | 102 ++++++++++++++++++++++------------------------------ 1 file changed, 42 insertions(+), 60 deletions(-) diff --git a/block/bio.c b/block/bio.c index b117765d58c0..0dd7aa1797f6 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1071,6 +1071,37 @@ static void bio_put_pages(struct page **pages, size_= t size, size_t off) put_page(pages[i]); } =20 +static int bio_iov_add_page(struct bio *bio, struct page *page, + unsigned int len, unsigned int offset) +{ + bool same_page =3D false; + + if (!__bio_try_merge_page(bio, page, len, offset, &same_page)) { + if (WARN_ON_ONCE(bio_full(bio, len))) + return -EINVAL; + __bio_add_page(bio, page, len, offset); + return 0; + } + + if (same_page) + put_page(page); + return 0; +} + +static int bio_iov_add_zone_append_page(struct bio *bio, struct page *page, + unsigned int len, unsigned int offset) +{ + struct request_queue *q =3D bdev_get_queue(bio->bi_bdev); + bool same_page =3D false; + + if (bio_add_hw_page(q, bio, page, len, offset, + queue_max_zone_append_sectors(q), &same_page) !=3D len) + return -EINVAL; + if (same_page) + put_page(page); + return 0; +} + #define PAGE_PTRS_PER_BVEC (sizeof(struct bio_vec) / sizeof(struct pag= e *)) =20 /** @@ -1089,7 +1120,6 @@ static int __bio_iov_iter_get_pages(struct bio *bio, = struct iov_iter *iter) unsigned short entries_left =3D bio->bi_max_vecs - bio->bi_vcnt; struct bio_vec *bv =3D bio->bi_io_vec + bio->bi_vcnt; struct page **pages =3D (struct page **)bv; - bool same_page =3D false; ssize_t size, left; unsigned len, i; size_t offset; @@ -1098,7 +1128,7 @@ static int __bio_iov_iter_get_pages(struct bio *bio, = struct iov_iter *iter) * Move page array up in the allocated memory for the bio vecs as far as * possible so that we can start filling biovecs from the beginning * without overwriting the temporary page array. - */ + */ BUILD_BUG_ON(PAGE_PTRS_PER_BVEC < 2); pages +=3D entries_left * (PAGE_PTRS_PER_BVEC - 1); =20 @@ -1108,18 +1138,18 @@ static int __bio_iov_iter_get_pages(struct bio *bio= , struct iov_iter *iter) =20 for (left =3D size, i =3D 0; left > 0; left -=3D len, i++) { struct page *page =3D pages[i]; + int ret; =20 len =3D min_t(size_t, PAGE_SIZE - offset, left); + if (bio_op(bio) =3D=3D REQ_OP_ZONE_APPEND) + ret =3D bio_iov_add_zone_append_page(bio, page, len, + offset); + else + ret =3D bio_iov_add_page(bio, page, len, offset); =20 - if (__bio_try_merge_page(bio, page, len, offset, &same_page)) { - if (same_page) - put_page(page); - } else { - if (WARN_ON_ONCE(bio_full(bio, len))) { - bio_put_pages(pages + i, left, offset); - return -EINVAL; - } - __bio_add_page(bio, page, len, offset); + if (ret) { + bio_put_pages(pages + i, left, offset); + return ret; } offset =3D 0; } @@ -1128,51 +1158,6 @@ static int __bio_iov_iter_get_pages(struct bio *bio,= struct iov_iter *iter) return 0; } =20 -static int __bio_iov_append_get_pages(struct bio *bio, struct iov_iter *it= er) -{ - unsigned short nr_pages =3D bio->bi_max_vecs - bio->bi_vcnt; - unsigned short entries_left =3D bio->bi_max_vecs - bio->bi_vcnt; - struct request_queue *q =3D bdev_get_queue(bio->bi_bdev); - unsigned int max_append_sectors =3D queue_max_zone_append_sectors(q); - struct bio_vec *bv =3D bio->bi_io_vec + bio->bi_vcnt; - struct page **pages =3D (struct page **)bv; - ssize_t size, left; - unsigned len, i; - size_t offset; - int ret =3D 0; - - /* - * Move page array up in the allocated memory for the bio vecs as far as - * possible so that we can start filling biovecs from the beginning - * without overwriting the temporary page array. - */ - BUILD_BUG_ON(PAGE_PTRS_PER_BVEC < 2); - pages +=3D entries_left * (PAGE_PTRS_PER_BVEC - 1); - - size =3D iov_iter_get_pages(iter, pages, LONG_MAX, nr_pages, &offset); - if (unlikely(size <=3D 0)) - return size ? size : -EFAULT; - - for (left =3D size, i =3D 0; left > 0; left -=3D len, i++) { - struct page *page =3D pages[i]; - bool same_page =3D false; - - len =3D min_t(size_t, PAGE_SIZE - offset, left); - if (bio_add_hw_page(q, bio, page, len, offset, - max_append_sectors, &same_page) !=3D len) { - bio_put_pages(pages + i, left, offset); - ret =3D -EINVAL; - break; - } - if (same_page) - put_page(page); - offset =3D 0; - } - - iov_iter_advance(iter, size - left); - return ret; -} - /** * bio_iov_iter_get_pages - add user or kernel pages to a bio * @bio: bio to add pages to @@ -1207,10 +1192,7 @@ int bio_iov_iter_get_pages(struct bio *bio, struct i= ov_iter *iter) } =20 do { - if (bio_op(bio) =3D=3D REQ_OP_ZONE_APPEND) - ret =3D __bio_iov_append_get_pages(bio, iter); - else - ret =3D __bio_iov_iter_get_pages(bio, iter); + ret =3D __bio_iov_iter_get_pages(bio, iter); } while (!ret && iov_iter_count(iter) && !bio_full(bio, 0)); =20 /* don't account direct I/O as memory stall */ --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DA43EC00140 for ; Mon, 15 Aug 2022 19:35:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244437AbiHOTfE (ORCPT ); Mon, 15 Aug 2022 15:35:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344011AbiHOT0U (ORCPT ); Mon, 15 Aug 2022 15:26:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E2E32FD; Mon, 15 Aug 2022 11:42: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 50DA1B81081; Mon, 15 Aug 2022 18:42:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94693C433D6; Mon, 15 Aug 2022 18:42:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588921; bh=K2mymVMllnaeMhMciQeht38cTlLrhvodPRgy0FCmX+I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aV7DWe4ssCI3e9qMGdeF6uJRl8TqshKU5p/Qyc6dfPTlblLSH7hobK1Err5HmDGfF cryqTbtPU2HQSPGxxiXFbFassZ8GcLeNTfjNYHhl6HEQmDZ3cDWwe782+4ZWCswaLR +5/jxCGfQzBiscxMMTkn37PAqtvQrM4mWa4av+ts= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Keith Busch , Jens Axboe , Sasha Levin Subject: [PATCH 5.15 555/779] block: ensure iov_iter advances for added pages Date: Mon, 15 Aug 2022 20:03:19 +0200 Message-Id: <20220815180401.056459983@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Keith Busch [ Upstream commit 325347d965e7ccf5424a05398807a6d801846612 ] There are cases where a bio may not accept additional pages, and the iov needs to advance to the last data length that was accepted. The zone append used to handle this correctly, but was inadvertently broken when the setup was made common with the normal r/w case. Fixes: 576ed9135489c ("block: use bio_add_page in bio_iov_iter_get_pages") Fixes: c58c0074c54c2 ("block/bio: remove duplicate append pages code") Signed-off-by: Keith Busch Link: https://lore.kernel.org/r/20220712153256.2202024-1-kbusch@fb.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- block/bio.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/block/bio.c b/block/bio.c index 0dd7aa1797f6..ba9120d4fe49 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1123,6 +1123,7 @@ static int __bio_iov_iter_get_pages(struct bio *bio, = struct iov_iter *iter) ssize_t size, left; unsigned len, i; size_t offset; + int ret =3D 0; =20 /* * Move page array up in the allocated memory for the bio vecs as far as @@ -1138,7 +1139,6 @@ static int __bio_iov_iter_get_pages(struct bio *bio, = struct iov_iter *iter) =20 for (left =3D size, i =3D 0; left > 0; left -=3D len, i++) { struct page *page =3D pages[i]; - int ret; =20 len =3D min_t(size_t, PAGE_SIZE - offset, left); if (bio_op(bio) =3D=3D REQ_OP_ZONE_APPEND) @@ -1149,13 +1149,13 @@ static int __bio_iov_iter_get_pages(struct bio *bio= , struct iov_iter *iter) =20 if (ret) { bio_put_pages(pages + i, left, offset); - return ret; + break; } offset =3D 0; } =20 - iov_iter_advance(iter, size); - return 0; + iov_iter_advance(iter, size - left); + return ret; } =20 /** --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3AD83C3F6B0 for ; Mon, 15 Aug 2022 19:31:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343834AbiHOTa6 (ORCPT ); Mon, 15 Aug 2022 15:30:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344036AbiHOT0V (ORCPT ); Mon, 15 Aug 2022 15:26: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 0D6D3B3B; Mon, 15 Aug 2022 11:42: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 8674360FB8; Mon, 15 Aug 2022 18:42:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 83E09C433D6; Mon, 15 Aug 2022 18:42:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588923; bh=h5IQ40lJ1q8klEjO8xL8OheZJmsYS5JNjLAwAZF7Yxc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ou4kCyJMimLR6cXU+Ytm3vrOjHLugCvfTNn5UuuCAqVUZwRgVbIZq67D/aD+4QtH4 sU70DD6LAUSQHFo6YcexSRHvN+in753CMZ6NWJJijjFncUC9URwtLXaui/5D5oe0nj HOi7anxvxTpyKQXiEnIjgvqPpY+ASCylK7PZtnHI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Yi , Jan Kara , Theodore Tso , Sasha Levin Subject: [PATCH 5.15 556/779] jbd2: fix outstanding credits assert in jbd2_journal_commit_transaction() Date: Mon, 15 Aug 2022 20:03:20 +0200 Message-Id: <20220815180401.094593943@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhang Yi [ Upstream commit a89573ce4ad32f19f43ec669771726817e185be0 ] We catch an assert problem in jbd2_journal_commit_transaction() when doing fsstress and request falut injection tests. The problem is happened in a race condition between jbd2_journal_commit_transaction() and ext4_end_io_end(). Firstly, ext4_writepages() writeback dirty pages and start reserved handle, and then the journal was aborted due to some previous metadata IO error, jbd2_journal_abort() start to commit current running transaction, the committing procedure could be raced by ext4_end_io_end() and lead to subtract j_reserved_credits twice from commit_transaction->t_outstanding_credits, finally the t_outstanding_credits is mistakenly smaller than t_nr_buffers and trigger assert. kjournald2 kworker jbd2_journal_commit_transaction() write_unlock(&journal->j_state_lock); atomic_sub(j_reserved_credits, t_outstanding_credits); //sub once jbd2_journal_start_reserved() start_this_handle() //detect aborted journal jbd2_journal_free_reserved() //get running transaction read_lock(&journal->j_state_lock) __jbd2_journal_unreserve_handle() atomic_sub(j_reserved_credits, t_outstanding_credits); //sub again read_unlock(&journal->j_state_lock); journal->j_running_transaction =3D NULL; J_ASSERT(t_nr_buffers <=3D t_outstanding_credits) //bomb!!! Fix this issue by using journal->j_state_lock to protect the subtraction in jbd2_journal_commit_transaction(). Fixes: 96f1e0974575 ("jbd2: avoid long hold times of j_state_lock while com= mitting a transaction") Signed-off-by: Zhang Yi Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220611130426.2013258-1-yi.zhang@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/jbd2/commit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c index 34b1406c06fd..69538061c551 100644 --- a/fs/jbd2/commit.c +++ b/fs/jbd2/commit.c @@ -564,13 +564,13 @@ void jbd2_journal_commit_transaction(journal_t *journ= al) */ jbd2_journal_switch_revoke_table(journal); =20 + write_lock(&journal->j_state_lock); /* * Reserved credits cannot be claimed anymore, free them */ atomic_sub(atomic_read(&journal->j_reserved_credits), &commit_transaction->t_outstanding_credits); =20 - write_lock(&journal->j_state_lock); trace_jbd2_commit_flushing(journal, commit_transaction); stats.run.rs_flushing =3D jiffies; stats.run.rs_locked =3D jbd2_time_diff(stats.run.rs_locked, --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4B6DC2BB45 for ; Mon, 15 Aug 2022 19:36:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344340AbiHOTge (ORCPT ); Mon, 15 Aug 2022 15:36:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343725AbiHOTa4 (ORCPT ); Mon, 15 Aug 2022 15:30:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE2B25F9AF; Mon, 15 Aug 2022 11:44:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D900E6113D; Mon, 15 Aug 2022 18:44:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DA1AC433D6; Mon, 15 Aug 2022 18:44:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589057; bh=g0WUy9z2Xp8PZ4Dnmj9bYY/NRZgrjr5Aw07PKgj/mhs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KeC4sl56WtYy01k+zxFQ8O+5QHLhMzX1JR6VcGdLLsJCV6Fn86gJqRRdhKkcfTykr Zuiwl58baT/Epmj8gX7Q2FX2fVlflEsJCAENuWhRVB7bT0gKNCjQ/mqwh3H94qc+HA zc8b/jOxYrD/FWCcgofNbZnDG/KllXnQy2Ea3CwU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Li Lingfeng , Jan Kara , Theodore Tso , Sasha Levin Subject: [PATCH 5.15 557/779] ext4: recover csum seed of tmp_inode after migrating to extents Date: Mon, 15 Aug 2022 20:03:21 +0200 Message-Id: <20220815180401.134739403@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Li Lingfeng [ Upstream commit 07ea7a617d6b278fb7acedb5cbe1a81ce2de7d0c ] When migrating to extents, the checksum seed of temporary inode need to be replaced by inode's, otherwise the inode checksums will be incorrect when swapping the inodes data. However, the temporary inode can not match it's checksum to itself since it has lost it's own checksum seed. mkfs.ext4 -F /dev/sdc mount /dev/sdc /mnt/sdc xfs_io -fc "pwrite 4k 4k" -c "fsync" /mnt/sdc/testfile chattr -e /mnt/sdc/testfile chattr +e /mnt/sdc/testfile umount /dev/sdc fsck -fn /dev/sdc =3D=3D=3D=3D=3D=3D=3D=3D ... Pass 1: Checking inodes, blocks, and sizes Inode 13 passes checks, but checksum does not match inode. Fix? no ... =3D=3D=3D=3D=3D=3D=3D=3D The fix is simple, save the checksum seed of temporary inode, and recover it after migrating to extents. Fixes: e81c9302a6c3 ("ext4: set csum seed in tmp inode while migrating to e= xtents") Signed-off-by: Li Lingfeng Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220617062515.2113438-1-lilingfeng3@huawei= .com Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/ext4/migrate.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c index ff8916e1d38e..af5a75a89e6e 100644 --- a/fs/ext4/migrate.c +++ b/fs/ext4/migrate.c @@ -417,7 +417,7 @@ int ext4_ext_migrate(struct inode *inode) struct inode *tmp_inode =3D NULL; struct migrate_struct lb; unsigned long max_entries; - __u32 goal; + __u32 goal, tmp_csum_seed; uid_t owner[2]; =20 /* @@ -465,6 +465,7 @@ int ext4_ext_migrate(struct inode *inode) * the migration. */ ei =3D EXT4_I(inode); + tmp_csum_seed =3D EXT4_I(tmp_inode)->i_csum_seed; EXT4_I(tmp_inode)->i_csum_seed =3D ei->i_csum_seed; i_size_write(tmp_inode, i_size_read(inode)); /* @@ -575,6 +576,7 @@ int ext4_ext_migrate(struct inode *inode) * the inode is not visible to user space. */ tmp_inode->i_blocks =3D 0; + EXT4_I(tmp_inode)->i_csum_seed =3D tmp_csum_seed; =20 /* Reset the extent details */ ext4_ext_tree_init(handle, tmp_inode); --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFD7BC2BB47 for ; Mon, 15 Aug 2022 19:31:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344566AbiHOTbg (ORCPT ); Mon, 15 Aug 2022 15:31:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344258AbiHOT0g (ORCPT ); Mon, 15 Aug 2022 15:26:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2EDC2F013; Mon, 15 Aug 2022 11:42: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 E04B061120; Mon, 15 Aug 2022 18:42:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E458FC433C1; Mon, 15 Aug 2022 18:42:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588948; bh=JoeneKCpfUsi2Yb/npweThkxb5RViy4QYBY9IpUx/E4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=INJdT3D6HgBbaK7hUrw+K6ZMeJUnoDoUHAGGSK5Y1v1+U37tcao2WsZRzmS29+FkV 4++lZ6zC4fMRZjed3d9gnAXy/mN1zoLcPgQVUJoQqPV2qZ1rjubMoRtNCIj5s+1SyF gjGmfA3tyo2P0KPmFyQObM7VnWtDDXuNtXONR3DI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhihao Cheng , Theodore Tso , Sasha Levin Subject: [PATCH 5.15 558/779] jbd2: fix assertion jh->b_frozen_data == NULL failure when journal aborted Date: Mon, 15 Aug 2022 20:03:22 +0200 Message-Id: <20220815180401.180864676@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhihao Cheng [ Upstream commit 4a734f0869f970b8a9b65062ea40b09a5da9dba8 ] Following process will fail assertion 'jh->b_frozen_data =3D=3D NULL' in jbd2_journal_dirty_metadata(): jbd2_journal_commit_transaction unlink(dir/a) jh->b_transaction =3D trans1 jh->b_jlist =3D BJ_Metadata journal->j_running_transaction =3D NULL trans1->t_state =3D T_COMMIT unlink(dir/b) handle->h_trans =3D trans2 do_get_write_access jh->b_modified =3D 0 jh->b_frozen_data =3D frozen_buffer jh->b_next_transaction =3D trans2 jbd2_journal_dirty_metadata is_handle_aborted is_journal_aborted // return false --> jbd2 abort <-- while (commit_transaction->t_buffers) if (is_journal_aborted) jbd2_journal_refile_buffer __jbd2_journal_refile_buffer WRITE_ONCE(jh->b_transaction, jh->b_next_transaction) WRITE_ONCE(jh->b_next_transaction, NULL) __jbd2_journal_file_buffer(jh, BJ_Reserved) J_ASSERT_JH(jh, jh->b_frozen_data =3D=3D NULL) // assertion failure= ! The reproducer (See detail in [Link]) reports: ------------[ cut here ]------------ kernel BUG at fs/jbd2/transaction.c:1629! invalid opcode: 0000 [#1] PREEMPT SMP CPU: 2 PID: 584 Comm: unlink Tainted: G W 5.19.0-rc6-00115-g4a57a8400075-dirty #697 RIP: 0010:jbd2_journal_dirty_metadata+0x3c5/0x470 RSP: 0018:ffffc90000be7ce0 EFLAGS: 00010202 Call Trace: __ext4_handle_dirty_metadata+0xa0/0x290 ext4_handle_dirty_dirblock+0x10c/0x1d0 ext4_delete_entry+0x104/0x200 __ext4_unlink+0x22b/0x360 ext4_unlink+0x275/0x390 vfs_unlink+0x20b/0x4c0 do_unlinkat+0x42f/0x4c0 __x64_sys_unlink+0x37/0x50 do_syscall_64+0x35/0x80 After journal aborting, __jbd2_journal_refile_buffer() is executed with holding @jh->b_state_lock, we can fix it by moving 'is_handle_aborted()' into the area protected by @jh->b_state_lock. Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D216251 Fixes: 470decc613ab20 ("[PATCH] jbd2: initial copy of files from jbd") Signed-off-by: Zhihao Cheng Link: https://lore.kernel.org/r/20220715125152.4022726-1-chengzhihao1@huawe= i.com Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/jbd2/transaction.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/fs/jbd2/transaction.c b/fs/jbd2/transaction.c index 6a3caedd2285..53cb236b53db 100644 --- a/fs/jbd2/transaction.c +++ b/fs/jbd2/transaction.c @@ -1477,8 +1477,6 @@ int jbd2_journal_dirty_metadata(handle_t *handle, str= uct buffer_head *bh) struct journal_head *jh; int ret =3D 0; =20 - if (is_handle_aborted(handle)) - return -EROFS; if (!buffer_jbd(bh)) return -EUCLEAN; =20 @@ -1525,6 +1523,18 @@ int jbd2_journal_dirty_metadata(handle_t *handle, st= ruct buffer_head *bh) journal =3D transaction->t_journal; spin_lock(&jh->b_state_lock); =20 + if (is_handle_aborted(handle)) { + /* + * Check journal aborting with @jh->b_state_lock locked, + * since 'jh->b_transaction' could be replaced with + * 'jh->b_next_transaction' during old transaction + * committing if journal aborted, which may fail + * assertion on 'jh->b_frozen_data =3D=3D NULL'. + */ + ret =3D -EROFS; + goto out_unlock_bh; + } + if (jh->b_modified =3D=3D 0) { /* * This buffer's got modified and becoming part --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4C23C00140 for ; Mon, 15 Aug 2022 19:32:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244751AbiHOTcl (ORCPT ); Mon, 15 Aug 2022 15:32:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344813AbiHOT1O (ORCPT ); Mon, 15 Aug 2022 15:27:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC07A5B04C; Mon, 15 Aug 2022 11:43: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 925B7B8105D; Mon, 15 Aug 2022 18:43:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5584C433D6; Mon, 15 Aug 2022 18:43:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588983; bh=TyFNt0yGMX+HCgNReElfeOZCISJv3dIiyMGCwZjmTq8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ri+4kvwWsP1HDeZRpxFypFNc4xQKyKSXVnc31F6v2jFPJH5+VTFs1aoTWmbudTYae uRZnnaqdud1qBrGKRkQcHpkbcfHQqW+jFCTUwzXJN66PMrNaJqVg5tiGs2vXAiqHsV TVXemb/6h/xBgbz6aSGF9sgJReaNGMKjJkD7tl/k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Linus Torvalds , Sasha Levin Subject: [PATCH 5.15 559/779] usb: cdns3: Dont use priv_dev uninitialized in cdns3_gadget_ep_enable() Date: Mon, 15 Aug 2022 20:03:23 +0200 Message-Id: <20220815180401.230200387@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nathan Chancellor [ Upstream commit 78acd4ca433425e6dd4032cfc2156c60e34931f2 ] Clang warns: drivers/usb/cdns3/cdns3-gadget.c:2290:11: error: variable 'priv_dev' is u= ninitialized when used here [-Werror,-Wuninitialized] dev_dbg(priv_dev->dev, "usbss: invalid parameters\n"); ^~~~~~~~ include/linux/dev_printk.h:155:18: note: expanded from macro 'dev_dbg' dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__) ^~~ include/linux/dynamic_debug.h:167:7: note: expanded from macro 'dynamic_d= ev_dbg' dev, fmt, ##__VA_ARGS__) ^~~ include/linux/dynamic_debug.h:152:56: note: expanded from macro '_dynamic= _func_call' __dynamic_func_call(__UNIQUE_ID(ddebug), fmt, func, ##__VA_ARGS__) ^~~~~~~~~~~ include/linux/dynamic_debug.h:134:15: note: expanded from macro '__dynami= c_func_call' func(&id, ##__VA_ARGS__); \ ^~~~~~~~~~~ drivers/usb/cdns3/cdns3-gadget.c:2278:31: note: initialize the variable '= priv_dev' to silence this warning struct cdns3_device *priv_dev; ^ =3D NULL 1 error generated. The priv_dev assignment was moved below the if statement to avoid potentially dereferencing ep before it was checked but priv_dev is used in the dev_dbg() call. To fix this, move the priv_dev and comp_desc assignments back to their original spot and hoist the ep check above those assignments with a call to pr_debug() instead of dev_dbg(). Fixes: c3ffc9c4ca44 ("usb: cdns3: change place of 'priv_ep' assignment in c= dns3_gadget_ep_dequeue(), cdns3_gadget_ep_enable()") Link: https://github.com/ClangBuiltLinux/linux/issues/1680 Signed-off-by: Nathan Chancellor Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/usb/cdns3/cdns3-gadget.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gad= get.c index e0cf62e65075..ae049eb28b93 100644 --- a/drivers/usb/cdns3/cdns3-gadget.c +++ b/drivers/usb/cdns3/cdns3-gadget.c @@ -2280,16 +2280,20 @@ static int cdns3_gadget_ep_enable(struct usb_ep *ep, int ret =3D 0; int val; =20 + if (!ep) { + pr_debug("usbss: ep not configured?\n"); + return -EINVAL; + } + priv_ep =3D ep_to_cdns3_ep(ep); + priv_dev =3D priv_ep->cdns3_dev; + comp_desc =3D priv_ep->endpoint.comp_desc; =20 - if (!ep || !desc || desc->bDescriptorType !=3D USB_DT_ENDPOINT) { + if (!desc || desc->bDescriptorType !=3D USB_DT_ENDPOINT) { dev_dbg(priv_dev->dev, "usbss: invalid parameters\n"); return -EINVAL; } =20 - comp_desc =3D priv_ep->endpoint.comp_desc; - priv_dev =3D priv_ep->cdns3_dev; - if (!desc->wMaxPacketSize) { dev_err(priv_dev->dev, "usbss: missing wMaxPacketSize\n"); return -EINVAL; --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DEE88C00140 for ; Mon, 15 Aug 2022 19:35:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343622AbiHOTf3 (ORCPT ); Mon, 15 Aug 2022 15:35:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345107AbiHOT1s (ORCPT ); Mon, 15 Aug 2022 15:27: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 DAE215C96D; Mon, 15 Aug 2022 11:43: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 83B3661120; Mon, 15 Aug 2022 18:43:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76D75C433C1; Mon, 15 Aug 2022 18:43:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589017; bh=c6POu7CxEZAtsyfak6/OCQvCWxH0FLYJlmluklao9ew=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XsS5sARaZncgAuT4TBFj5/7LjkMoUXFutZly3zWHrlXFvx0NMOvsPCRCdTmKoCLyq 5L3Jf7s1czWizHICL9vkGQvp9vRLgiA9epmju6AqLhIMuGOeE6jaiGoRifUpxbkIvA 19nl1jtcNlUt/x3Ft+el41ARBeDTyo3IyEX2MBvQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tang Bin , Viresh Kumar , Sasha Levin Subject: [PATCH 5.15 560/779] opp: Fix error check in dev_pm_opp_attach_genpd() Date: Mon, 15 Aug 2022 20:03:24 +0200 Message-Id: <20220815180401.279999844@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tang Bin [ Upstream commit 4ea9496cbc959eb5c78f3e379199aca9ef4e386b ] dev_pm_domain_attach_by_name() may return NULL in some cases, so IS_ERR() doesn't meet the requirements. Thus fix it. Fixes: 6319aee10e53 ("opp: Attach genpds to devices from within OPP core") Signed-off-by: Tang Bin [ Viresh: Replace ENODATA with ENODEV ] Signed-off-by: Viresh Kumar Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/opp/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 04b4691a8aac..b2da497dd378 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -2388,8 +2388,8 @@ struct opp_table *dev_pm_opp_attach_genpd(struct devi= ce *dev, } =20 virt_dev =3D dev_pm_domain_attach_by_name(dev, *name); - if (IS_ERR(virt_dev)) { - ret =3D PTR_ERR(virt_dev); + if (IS_ERR_OR_NULL(virt_dev)) { + ret =3D PTR_ERR(virt_dev) ? : -ENODEV; dev_err(dev, "Couldn't attach to pm_domain: %d\n", ret); goto err; } --=20 2.35.1 From nobody Sun Dec 14 03:24:45 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4481AC28B2C for ; Mon, 15 Aug 2022 19:36:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344035AbiHOTgG (ORCPT ); Mon, 15 Aug 2022 15:36:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244747AbiHOT2v (ORCPT ); Mon, 15 Aug 2022 15:28: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 030195D0D3; Mon, 15 Aug 2022 11:43: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 93EF8611C1; Mon, 15 Aug 2022 18:43:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 80E25C433D6; Mon, 15 Aug 2022 18:43:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589037; bh=JKSsVhydSCnFVOkIw5jQLYVlmg82JtFskndc5/+TtqM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0auD9sJoisOKhm7AWXY2oP+LdD6yiAaX667e+AC/3MDntNYNoV4jgp/+smzGHITfY Fe6u1++i+5OlkAMKHbPJ6aXCyQvmf0JkHUJGfCmQDgkF2iN7uixenqpbTajqP2J0BB mw1FWw2Km626e8RRQm3t6SYs+b00kT5o16y51VeM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Tzung-Bi Shih , Guenter Roeck , Mark Brown , Sasha Levin Subject: [PATCH 5.15 561/779] ASoC: cros_ec_codec: Fix refcount leak in cros_ec_codec_platform_probe Date: Mon, 15 Aug 2022 20:03:25 +0200 Message-Id: <20220815180401.315845366@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 0a034d93ee929a9ea89f3fa5f1d8492435b9ee6e ] of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: b6bc07d4360d ("ASoC: cros_ec_codec: support WoV") Signed-off-by: Miaoqian Lin Reviewed-by: Tzung-Bi Shih Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220603131043.38907-1-linmq006@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- sound/soc/codecs/cros_ec_codec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/codecs/cros_ec_codec.c b/sound/soc/codecs/cros_ec_co= dec.c index a201d652aca2..8823edc35113 100644 --- a/sound/soc/codecs/cros_ec_codec.c +++ b/sound/soc/codecs/cros_ec_codec.c @@ -994,6 +994,7 @@ static int cros_ec_codec_platform_probe(struct platform= _device *pdev) dev_dbg(dev, "ap_shm_phys_addr=3D%#llx len=3D%#x\n", priv->ap_shm_phys_addr, priv->ap_shm_len); } + of_node_put(node); } #endif =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F54FC00140 for ; Mon, 15 Aug 2022 19:37:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245584AbiHOTh0 (ORCPT ); Mon, 15 Aug 2022 15:37:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245740AbiHOT30 (ORCPT ); Mon, 15 Aug 2022 15:29:26 -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 D2F505E324; Mon, 15 Aug 2022 11:44: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 sin.source.kernel.org (Postfix) with ESMTPS id DE11ACE126A; Mon, 15 Aug 2022 18:44:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AAF5FC433C1; Mon, 15 Aug 2022 18:43:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589040; bh=pqbpWM0ovuucZKEV5C40+B3/2rDpOTNZlRfpRdD2Tu0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YFOhygoVRTUUevZ1PQyqt+Uj3mkNc/beDgC/4vC74CL9U6U6On7/1tfiozkCc8gnN dAs4Yg5Tt3UvNWGB2IraH47rfr86s37djDr8Q2fiFii01U4xubGu9uBVLny84t8amL HB0Ecjeo/skQQ6eHOAZ92Od0FJOXxKCPGxLOzKmc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Krzysztof Kozlowski , Mark Brown , Sasha Levin Subject: [PATCH 5.15 562/779] ASoC: samsung: Fix error handling in aries_audio_probe Date: Mon, 15 Aug 2022 20:03:26 +0200 Message-Id: <20220815180401.347902834@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 3e2649c5e8643bea0867bb1dd970fedadb0eb7f3 ] of_get_child_by_name() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. This function is missing of_node_put(cpu) in the error path. Fix this by goto out label. of_node_put() will check NULL pointer. Fixes: 7a3a7671fa6c ("ASoC: samsung: Add driver for Aries boards") Signed-off-by: Miaoqian Lin Reviewed-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220603130640.37624-1-linmq006@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- sound/soc/samsung/aries_wm8994.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sound/soc/samsung/aries_wm8994.c b/sound/soc/samsung/aries_wm8= 994.c index 83acbe57b248..a0825da9fff9 100644 --- a/sound/soc/samsung/aries_wm8994.c +++ b/sound/soc/samsung/aries_wm8994.c @@ -628,8 +628,10 @@ static int aries_audio_probe(struct platform_device *p= dev) return -EINVAL; =20 codec =3D of_get_child_by_name(dev->of_node, "codec"); - if (!codec) - return -EINVAL; + if (!codec) { + ret =3D -EINVAL; + goto out; + } =20 for_each_card_prelinks(card, i, dai_link) { dai_link->codecs->of_node =3D of_parse_phandle(codec, --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62E23C28B2B for ; Mon, 15 Aug 2022 19:36:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344076AbiHOTgJ (ORCPT ); Mon, 15 Aug 2022 15:36:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244202AbiHOT32 (ORCPT ); Mon, 15 Aug 2022 15:29: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 D8A355E32A; Mon, 15 Aug 2022 11:44: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 BB07B611DD; Mon, 15 Aug 2022 18:44:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C21D3C433D6; Mon, 15 Aug 2022 18:44:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589043; bh=yhuN0DL0yv2xRFCMow4wX3R8JWRCMkUfnbUAKDjrUfk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fkfOykeIpBV7596KxMb/efFs6T1mJtJNkiF1chrmu2gZZ5rM1+44FIqN189xhNE2T Tfm2Cxl6tN6VtXjleUXEgiJ4YjKGw4DhYahU5FkvT+Zh/KuMFkM7MXsZHXJDT5p61D qaSYyohjZB8ETGnF1yVjfiVAm2xj9DKxNHibhnU4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Fabio Estevam , Mark Brown , Sasha Levin Subject: [PATCH 5.15 563/779] ASoC: imx-audmux: Silence a clang warning Date: Mon, 15 Aug 2022 20:03:27 +0200 Message-Id: <20220815180401.386328352@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 2f4a8171da06609bb6a063630ed546ee3d93dad7 ] Change the of_device_get_match_data() cast to (uintptr_t) to silence the following clang warning: sound/soc/fsl/imx-audmux.c:301:16: warning: cast to smaller integer type 'e= num imx_audmux_type' from 'const void *' [-Wvoid-pointer-to-enum-cast] Reported-by: kernel test robot Fixes: 6a8b8b582db1 ("ASoC: imx-audmux: Remove unused .id_table") Signed-off-by: Fabio Estevam Link: https://lore.kernel.org/r/20220526010543.1164793-1-festevam@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- sound/soc/fsl/imx-audmux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/fsl/imx-audmux.c b/sound/soc/fsl/imx-audmux.c index dfa05d40b276..a8e5e0f57faf 100644 --- a/sound/soc/fsl/imx-audmux.c +++ b/sound/soc/fsl/imx-audmux.c @@ -298,7 +298,7 @@ static int imx_audmux_probe(struct platform_device *pde= v) audmux_clk =3D NULL; } =20 - audmux_type =3D (enum imx_audmux_type)of_device_get_match_data(&pdev->dev= ); + audmux_type =3D (uintptr_t)of_device_get_match_data(&pdev->dev); =20 switch (audmux_type) { case IMX31_AUDMUX: --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DC38AC00140 for ; Mon, 15 Aug 2022 19:37:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344242AbiHOTg0 (ORCPT ); Mon, 15 Aug 2022 15:36:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244984AbiHOTaD (ORCPT ); Mon, 15 Aug 2022 15:30:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6FEFE5F10D; Mon, 15 Aug 2022 11:44: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 A7E43B8105D; Mon, 15 Aug 2022 18:44:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7622C433D6; Mon, 15 Aug 2022 18:44:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589046; bh=Z0NR9/jU7NPzm9A8SgemrFstoeQ930lhwENoftfU0xY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lbqZCHW9AsuHbgA4giZOsZo2bVnzLohV79RCalDybmZd9rrQz9DnCbWDgVyTNNeuO srAN2cyZLRc0yGarPeeAIoS2uLoZASd01KfKZYFLAIlTgyHGwpzC9UqCukSAFV8+2A nZqejMYlRRcBWa73GbOuocukyZoga0r7LZMZKWiM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Mark Brown , Sasha Levin Subject: [PATCH 5.15 564/779] ASoC: mediatek: mt8173: Fix refcount leak in mt8173_rt5650_rt5676_dev_probe Date: Mon, 15 Aug 2022 20:03:28 +0200 Message-Id: <20220815180401.426152365@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit ae4f11c1ed2d67192fdf3d89db719ee439827c11 ] of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Fix missing of_node_put() in error paths. Fixes: 94319ba10eca ("ASoC: mediatek: Use platform_of_node for machine driv= ers") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220602034144.60159-1-linmq006@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c b/sound/soc/m= ediatek/mt8173/mt8173-rt5650-rt5676.c index c8e4e85e1057..94a9bbf144d1 100644 --- a/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650-rt5676.c @@ -256,14 +256,16 @@ static int mt8173_rt5650_rt5676_dev_probe(struct plat= form_device *pdev) if (!mt8173_rt5650_rt5676_dais[DAI_LINK_CODEC_I2S].codecs[0].of_node) { dev_err(&pdev->dev, "Property 'audio-codec' missing or invalid\n"); - return -EINVAL; + ret =3D -EINVAL; + goto put_node; } mt8173_rt5650_rt5676_dais[DAI_LINK_CODEC_I2S].codecs[1].of_node =3D of_parse_phandle(pdev->dev.of_node, "mediatek,audio-codec", 1); if (!mt8173_rt5650_rt5676_dais[DAI_LINK_CODEC_I2S].codecs[1].of_node) { dev_err(&pdev->dev, "Property 'audio-codec' missing or invalid\n"); - return -EINVAL; + ret =3D -EINVAL; + goto put_node; } mt8173_rt5650_rt5676_codec_conf[0].dlc.of_node =3D mt8173_rt5650_rt5676_dais[DAI_LINK_CODEC_I2S].codecs[1].of_node; @@ -276,7 +278,8 @@ static int mt8173_rt5650_rt5676_dev_probe(struct platfo= rm_device *pdev) if (!mt8173_rt5650_rt5676_dais[DAI_LINK_HDMI_I2S].codecs->of_node) { dev_err(&pdev->dev, "Property 'audio-codec' missing or invalid\n"); - return -EINVAL; + ret =3D -EINVAL; + goto put_node; } =20 card->dev =3D &pdev->dev; @@ -286,6 +289,7 @@ static int mt8173_rt5650_rt5676_dev_probe(struct platfo= rm_device *pdev) dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", __func__, ret); =20 +put_node: of_node_put(platform_node); return ret; } --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91B98C2BB41 for ; Mon, 15 Aug 2022 19:36:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344185AbiHOTgV (ORCPT ); Mon, 15 Aug 2022 15:36:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245027AbiHOTaS (ORCPT ); Mon, 15 Aug 2022 15:30:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 327D85F121; Mon, 15 Aug 2022 11:44: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 B95E2611E4; Mon, 15 Aug 2022 18:44:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3749AC433D7; Mon, 15 Aug 2022 18:44:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589050; bh=DF7PTMewUFfS/ZB+3tf2747d7ms+FLwktLmvT2BQnNg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1he8+7HXFA+tPy2sVZHyNBRovOJbl7VJbLwB696YuBKTRcOhvJP4Yj8pwvie89eud y7ZoVN2LsOCoGhlWTXqrh6N09gHaD6zyAfOuAwRj1au8hLhgLtdxqL1lV0sdG7mfCm d1nUR0N5V6sFxhDPlJEr3T+gdYqdnzPZkuK5549I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Mark Brown , Sasha Levin Subject: [PATCH 5.15 565/779] ASoC: mt6797-mt6351: Fix refcount leak in mt6797_mt6351_dev_probe Date: Mon, 15 Aug 2022 20:03:29 +0200 Message-Id: <20220815180401.467155717@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 7472eb8d7dd12b6b9b1a4f4527719cc9c7f5965f ] of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: f0ab0bf250da ("ASoC: add mt6797-mt6351 driver and config option") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220603083417.9011-1-linmq006@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- sound/soc/mediatek/mt6797/mt6797-mt6351.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sound/soc/mediatek/mt6797/mt6797-mt6351.c b/sound/soc/mediatek= /mt6797/mt6797-mt6351.c index 496f32bcfb5e..d2f6213a6bfc 100644 --- a/sound/soc/mediatek/mt6797/mt6797-mt6351.c +++ b/sound/soc/mediatek/mt6797/mt6797-mt6351.c @@ -217,7 +217,8 @@ static int mt6797_mt6351_dev_probe(struct platform_devi= ce *pdev) if (!codec_node) { dev_err(&pdev->dev, "Property 'audio-codec' missing or invalid\n"); - return -EINVAL; + ret =3D -EINVAL; + goto put_platform_node; } for_each_card_prelinks(card, i, dai_link) { if (dai_link->codecs->name) @@ -230,6 +231,9 @@ static int mt6797_mt6351_dev_probe(struct platform_devi= ce *pdev) dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", __func__, ret); =20 + of_node_put(codec_node); +put_platform_node: + of_node_put(platform_node); return ret; } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6336C2BB47 for ; Mon, 15 Aug 2022 19:36:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344299AbiHOTg3 (ORCPT ); Mon, 15 Aug 2022 15:36:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245626AbiHOTau (ORCPT ); Mon, 15 Aug 2022 15:30:50 -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 42EB25F128; Mon, 15 Aug 2022 11:44: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 9A315B8105D; Mon, 15 Aug 2022 18:44:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF7DAC433C1; Mon, 15 Aug 2022 18:44:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589053; bh=C8wLxk7wMPsaN29ahyc7gGPIyxKfCJhjmUtAVYyWJfU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZqCtDe331D5nQQ5DCUmFRtYxHWM6qIDvZJ8CLqlmXXWFCAy95a7PMOHgEdFEGin1l 7LVnwABJTPlRjhJF+wwTOas2mRh04eeb4cTd5ujESbp0+uL9o9QrMTEqFzfvmiNhw8 UFmSdJiOUYhUQ9Ylk3F4DJHcbmCfZuI4fAcWdJgs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Mark Brown , Sasha Levin Subject: [PATCH 5.15 566/779] ASoC: codecs: da7210: add check for i2c_add_driver Date: Mon, 15 Aug 2022 20:03:30 +0200 Message-Id: <20220815180401.517388530@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiasheng Jiang [ Upstream commit 82fa8f581a954ddeec1602bed9f8b4a09d100e6e ] As i2c_add_driver could return error if fails, it should be better to check the return value. However, if the CONFIG_I2C and CONFIG_SPI_MASTER are both true, the return value of i2c_add_driver will be covered by spi_register_driver. Therefore, it is necessary to add check and return error if fails. Fixes: aa0e25caafb7 ("ASoC: da7210: Add support for spi regmap") Signed-off-by: Jiasheng Jiang Link: https://lore.kernel.org/r/20220531094712.2376759-1-jiasheng@iscas.ac.= cn Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- sound/soc/codecs/da7210.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/soc/codecs/da7210.c b/sound/soc/codecs/da7210.c index 8af344b2fdbf..d75d15006f64 100644 --- a/sound/soc/codecs/da7210.c +++ b/sound/soc/codecs/da7210.c @@ -1336,6 +1336,8 @@ static int __init da7210_modinit(void) int ret =3D 0; #if IS_ENABLED(CONFIG_I2C) ret =3D i2c_add_driver(&da7210_i2c_driver); + if (ret) + return ret; #endif #if defined(CONFIG_SPI_MASTER) ret =3D spi_register_driver(&da7210_spi_driver); --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0CA32C32757 for ; Mon, 15 Aug 2022 19:31:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344644AbiHOTbk (ORCPT ); Mon, 15 Aug 2022 15:31:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344301AbiHOT0i (ORCPT ); Mon, 15 Aug 2022 15:26:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C60912F390; Mon, 15 Aug 2022 11:42: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 4D5EE611C2; Mon, 15 Aug 2022 18:42:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 377DCC433C1; Mon, 15 Aug 2022 18:42:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588951; bh=Fq2/Qa+l2s9n7XYaDXSNDg2FJSRH8B8oFrH9I8yNc8k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wWtzQjqso+rCC6DI90nFOwY/P0sYwv0yo1F/bYCy5SQseMOA1GeHSaawep2FuDI7D fcqelvfW0hcFdBYl8MjAZuGA55D4nDuDx2nfrfbZ7fdKBzfUrp5VHaDfDfES8Ej/JU TI7Jca6FGA4/rUlLtD5c2shNNcZOQtwucPI6g4dI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Mark Brown , Sasha Levin Subject: [PATCH 5.15 567/779] ASoC: mediatek: mt8173-rt5650: Fix refcount leak in mt8173_rt5650_dev_probe Date: Mon, 15 Aug 2022 20:03:31 +0200 Message-Id: <20220815180401.558005945@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit efe2178d1a32492f99e7f1f2568eea5c88a85729 ] of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Fix refcount leak in some error paths. Fixes: 0f83f9296d5c ("ASoC: mediatek: Add machine driver for ALC5650 codec") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220603124243.31358-1-linmq006@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- sound/soc/mediatek/mt8173/mt8173-rt5650.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sound/soc/mediatek/mt8173/mt8173-rt5650.c b/sound/soc/mediatek= /mt8173/mt8173-rt5650.c index e168d31f4445..1de9dab218c6 100644 --- a/sound/soc/mediatek/mt8173/mt8173-rt5650.c +++ b/sound/soc/mediatek/mt8173/mt8173-rt5650.c @@ -280,7 +280,8 @@ static int mt8173_rt5650_dev_probe(struct platform_devi= ce *pdev) if (!mt8173_rt5650_dais[DAI_LINK_CODEC_I2S].codecs[0].of_node) { dev_err(&pdev->dev, "Property 'audio-codec' missing or invalid\n"); - return -EINVAL; + ret =3D -EINVAL; + goto put_platform_node; } mt8173_rt5650_dais[DAI_LINK_CODEC_I2S].codecs[1].of_node =3D mt8173_rt5650_dais[DAI_LINK_CODEC_I2S].codecs[0].of_node; @@ -293,7 +294,7 @@ static int mt8173_rt5650_dev_probe(struct platform_devi= ce *pdev) dev_err(&pdev->dev, "%s codec_capture_dai name fail %d\n", __func__, ret); - return ret; + goto put_platform_node; } mt8173_rt5650_dais[DAI_LINK_CODEC_I2S].codecs[1].dai_name =3D codec_capture_dai; @@ -315,7 +316,8 @@ static int mt8173_rt5650_dev_probe(struct platform_devi= ce *pdev) if (!mt8173_rt5650_dais[DAI_LINK_HDMI_I2S].codecs->of_node) { dev_err(&pdev->dev, "Property 'audio-codec' missing or invalid\n"); - return -EINVAL; + ret =3D -EINVAL; + goto put_platform_node; } card->dev =3D &pdev->dev; =20 @@ -324,6 +326,7 @@ static int mt8173_rt5650_dev_probe(struct platform_devi= ce *pdev) dev_err(&pdev->dev, "%s snd_soc_register_card fail %d\n", __func__, ret); =20 +put_platform_node: of_node_put(platform_node); return ret; } --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21D16C2BBC5 for ; Mon, 15 Aug 2022 19:31:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344718AbiHOTbo (ORCPT ); Mon, 15 Aug 2022 15:31:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344344AbiHOT0n (ORCPT ); Mon, 15 Aug 2022 15:26:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06CAD2F025; Mon, 15 Aug 2022 11:42: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 8A74161120; Mon, 15 Aug 2022 18:42:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7AE78C433C1; Mon, 15 Aug 2022 18:42:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588955; bh=FpJB5bvoHtxoOMqSH9y0L+Uu18qnX9Iul8pE4PGs3mA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZuA5Y0/N9rXxyGKIVSMwsLk/tQUA7oy+DbimA+0eGD3a761bqlfrQ9jLs7GNA10Aw yeSISY2ecr/NwHq3QVezL2SEYsn9Nod+uMehF1/A6I2GnE9/qxaT5eYVFGhSVA50+/ vRFnroH4mapjs4bUSaJRykAh4PY2aDGO8HGtHZ7k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Maciej W. Rozycki" , Andy Shevchenko , Sasha Levin Subject: [PATCH 5.15 568/779] serial: 8250: Export ICR access helpers for internal use Date: Mon, 15 Aug 2022 20:03:32 +0200 Message-Id: <20220815180401.606383226@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maciej W. Rozycki [ Upstream commit cb5a40e3143bc64437858b337273fd63cc42e9c2 ] Make ICR access helpers available outside 8250_port.c, however retain them as ordinary static functions so as not to regress code generation. This is because `serial_icr_write' is currently automatically inlined by GCC, however `serial_icr_read' is not. Making them both static inline would grow code produced, e.g.: $ i386-linux-gnu-size --format=3Dgnu 8250_port-{old,new}.o text data bss total filename 15065 3378 0 18443 8250_port-old.o 15289 3378 0 18667 8250_port-new.o and: $ riscv64-linux-gnu-size --format=3Dgnu 8250_port-{old,new}.o text data bss total filename 16980 5306 0 22286 8250_port-old.o 17124 5306 0 22430 8250_port-new.o while making them external would needlessly add a new module interface and lose the benefit from `serial_icr_write' getting inlined outside 8250_port.o. Signed-off-by: Maciej W. Rozycki Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/alpine.DEB.2.21.2204181517500.9383@angie.or= cam.me.uk Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/tty/serial/8250/8250.h | 22 ++++++++++++++++++++++ drivers/tty/serial/8250/8250_port.c | 21 --------------------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h index 6473361525d1..0efe4df24622 100644 --- a/drivers/tty/serial/8250/8250.h +++ b/drivers/tty/serial/8250/8250.h @@ -120,6 +120,28 @@ static inline void serial_out(struct uart_8250_port *u= p, int offset, int value) up->port.serial_out(&up->port, offset, value); } =20 +/* + * For the 16C950 + */ +static void serial_icr_write(struct uart_8250_port *up, int offset, int va= lue) +{ + serial_out(up, UART_SCR, offset); + serial_out(up, UART_ICR, value); +} + +static unsigned int __maybe_unused serial_icr_read(struct uart_8250_port *= up, + int offset) +{ + unsigned int value; + + serial_icr_write(up, UART_ACR, up->acr | UART_ACR_ICRRD); + serial_out(up, UART_SCR, offset); + value =3D serial_in(up, UART_ICR); + serial_icr_write(up, UART_ACR, up->acr); + + return value; +} + void serial8250_clear_and_reinit_fifos(struct uart_8250_port *p); =20 static inline int serial_dl_read(struct uart_8250_port *up) diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/= 8250_port.c index 4f66825abe67..a5496bd1b650 100644 --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -537,27 +537,6 @@ serial_port_out_sync(struct uart_port *p, int offset, = int value) } } =20 -/* - * For the 16C950 - */ -static void serial_icr_write(struct uart_8250_port *up, int offset, int va= lue) -{ - serial_out(up, UART_SCR, offset); - serial_out(up, UART_ICR, value); -} - -static unsigned int serial_icr_read(struct uart_8250_port *up, int offset) -{ - unsigned int value; - - serial_icr_write(up, UART_ACR, up->acr | UART_ACR_ICRRD); - serial_out(up, UART_SCR, offset); - value =3D serial_in(up, UART_ICR); - serial_icr_write(up, UART_ACR, up->acr); - - return value; -} - /* * FIFO support. */ --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30BF1C32763 for ; Mon, 15 Aug 2022 19:31:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344799AbiHOTbr (ORCPT ); Mon, 15 Aug 2022 15:31:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344441AbiHOT0w (ORCPT ); Mon, 15 Aug 2022 15:26:52 -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 958F13FA05; Mon, 15 Aug 2022 11:42: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 9DE2F60FEE; Mon, 15 Aug 2022 18:42:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D611C433C1; Mon, 15 Aug 2022 18:42:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588958; bh=zZb3w4ZEQn3rVjMUEfbqtgtrFhNi4p7gFpwg8dCPZdY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nb28TJvNIv8XJqe/Fyd/sLrk1cFbcRd/x6RdrEE8IygS1LGDD31EUuNbRmN+29NjM IBr//jFmXfmKUvoltVoB0t9+Hzwefecd60Q+9QA0boFma2ZBErOGMEODz48kqE34d3 dCDIVSyeBbF7UHPRkXzRIVRA5ye8EV5J3iLaHgXM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , Miquel Raynal , Sasha Levin Subject: [PATCH 5.15 569/779] serial: 8250: dma: Allow driver operations before starting DMA transfers Date: Mon, 15 Aug 2022 20:03:33 +0200 Message-Id: <20220815180401.657567808@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miquel Raynal [ Upstream commit e4fb03fe10c5e7a5d9aef7cefe815253274fb9ee ] One situation where this could be used is when configuring the UART controller to be the DMA flow controller. This is a typical case where the driver might need to program a few more registers before starting a DMA transfer. Provide the necessary infrastructure to support this case. Suggested-by: Andy Shevchenko Reviewed-by: Andy Shevchenko Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/r/20220422180615.9098-6-miquel.raynal@bootlin= .com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/tty/serial/8250/8250.h | 18 ++++++++++++++++++ drivers/tty/serial/8250/8250_dma.c | 4 ++++ 2 files changed, 22 insertions(+) diff --git a/drivers/tty/serial/8250/8250.h b/drivers/tty/serial/8250/8250.h index 0efe4df24622..b3abc29aa927 100644 --- a/drivers/tty/serial/8250/8250.h +++ b/drivers/tty/serial/8250/8250.h @@ -17,6 +17,8 @@ struct uart_8250_dma { int (*tx_dma)(struct uart_8250_port *p); int (*rx_dma)(struct uart_8250_port *p); + void (*prepare_tx_dma)(struct uart_8250_port *p); + void (*prepare_rx_dma)(struct uart_8250_port *p); =20 /* Filter function */ dma_filter_fn fn; @@ -331,6 +333,22 @@ extern int serial8250_rx_dma(struct uart_8250_port *); extern void serial8250_rx_dma_flush(struct uart_8250_port *); extern int serial8250_request_dma(struct uart_8250_port *); extern void serial8250_release_dma(struct uart_8250_port *); + +static inline void serial8250_do_prepare_tx_dma(struct uart_8250_port *p) +{ + struct uart_8250_dma *dma =3D p->dma; + + if (dma->prepare_tx_dma) + dma->prepare_tx_dma(p); +} + +static inline void serial8250_do_prepare_rx_dma(struct uart_8250_port *p) +{ + struct uart_8250_dma *dma =3D p->dma; + + if (dma->prepare_rx_dma) + dma->prepare_rx_dma(p); +} #else static inline int serial8250_tx_dma(struct uart_8250_port *p) { diff --git a/drivers/tty/serial/8250/8250_dma.c b/drivers/tty/serial/8250/8= 250_dma.c index b3c3f7e5851a..1bdc8d6432fe 100644 --- a/drivers/tty/serial/8250/8250_dma.c +++ b/drivers/tty/serial/8250/8250_dma.c @@ -86,6 +86,8 @@ int serial8250_tx_dma(struct uart_8250_port *p) =20 dma->tx_size =3D CIRC_CNT_TO_END(xmit->head, xmit->tail, UART_XMIT_SIZE); =20 + serial8250_do_prepare_tx_dma(p); + desc =3D dmaengine_prep_slave_single(dma->txchan, dma->tx_addr + xmit->tail, dma->tx_size, DMA_MEM_TO_DEV, @@ -123,6 +125,8 @@ int serial8250_rx_dma(struct uart_8250_port *p) if (dma->rx_running) return 0; =20 + serial8250_do_prepare_rx_dma(p); + desc =3D dmaengine_prep_slave_single(dma->rxchan, dma->rx_addr, dma->rx_size, DMA_DEV_TO_MEM, DMA_PREP_INTERRUPT | DMA_CTRL_ACK); --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC285C00140 for ; Mon, 15 Aug 2022 19:32:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344851AbiHOTbt (ORCPT ); Mon, 15 Aug 2022 15:31:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344516AbiHOT04 (ORCPT ); Mon, 15 Aug 2022 15:26:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64ED25A3D3; Mon, 15 Aug 2022 11:42: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 B1347611C2; Mon, 15 Aug 2022 18:42:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9FCF6C433C1; Mon, 15 Aug 2022 18:42:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588961; bh=TZ2I0orKzVsErbjWyCR70Fk0ZaBl7NXIQBB05th5cEQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VUWlGyOHKOXDkGTHk8nIHIsTDpyiusFC83LTE9yYCQugOXUu/OyKA2c5RHnFvGWKa ya0swIv6Y/SbWUPxitETbVbiIjD3ub9njJIURsqI/u4KDVeq+YKtafrsJKdmnAxlk/ WR8UCYTTSIhhGOE6fqGgmXaqjJg0m+Srg62mHdFo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , Sasha Levin Subject: [PATCH 5.15 570/779] serial: 8250_dw: Store LSR into lsr_saved_flags in dw8250_tx_wait_empty() Date: Mon, 15 Aug 2022 20:03:34 +0200 Message-Id: <20220815180401.697120685@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ilpo J=C3=A4rvinen [ Upstream commit af14f3007e2dca0d112f10f6717ba43093f74e81 ] Make sure LSR flags are preserved in dw8250_tx_wait_empty(). This function is called from a low-level out function and therefore cannot call serial_lsr_in() as it would lead to infinite recursion. It is borderline if the flags need to be saved here at all since this code relates to writing LCR register which usually implies no important characters should be arriving. Fixes: 914eaf935ec7 ("serial: 8250_dw: Allow TX FIFO to drain before writin= g to UART_LCR") Reviewed-by: Andy Shevchenko Signed-off-by: Ilpo J=C3=A4rvinen Link: https://lore.kernel.org/r/20220608095431.18376-7-ilpo.jarvinen@linux.= intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/tty/serial/8250/8250_dw.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/82= 50_dw.c index 49559731bbcf..ace221afeb03 100644 --- a/drivers/tty/serial/8250/8250_dw.c +++ b/drivers/tty/serial/8250/8250_dw.c @@ -124,12 +124,15 @@ static void dw8250_check_lcr(struct uart_port *p, int= value) /* Returns once the transmitter is empty or we run out of retries */ static void dw8250_tx_wait_empty(struct uart_port *p) { + struct uart_8250_port *up =3D up_to_u8250p(p); unsigned int tries =3D 20000; unsigned int delay_threshold =3D tries - 1000; unsigned int lsr; =20 while (tries--) { lsr =3D readb (p->membase + (UART_LSR << p->regshift)); + up->lsr_saved_flags |=3D lsr & LSR_SAVE_FLAGS; + if (lsr & UART_LSR_TEMT) break; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D3F3C00140 for ; Mon, 15 Aug 2022 19:33:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243912AbiHOTcC (ORCPT ); Mon, 15 Aug 2022 15:32:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344573AbiHOT1B (ORCPT ); Mon, 15 Aug 2022 15:27: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 367943FA08; Mon, 15 Aug 2022 11:42: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 A4C08B81032; Mon, 15 Aug 2022 18:42:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8F0DC433C1; Mon, 15 Aug 2022 18:42:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588964; bh=STzebAMGS8YaWORs9LTZ5121krjgl6i4VyUyXVdzzak=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GJkg3Q+4RhgOcpTvS4aOf8rQa20LFMgcja0qJPGykrf7bYyHQUs/mR3gqXdhzSw0l 36XG4PyTCRqliA1FgLPix7c2HKk8O2YiXe2mFo90i1cCxAe+Zrfpaw5vHvHQnxkDqW lUwr0zt3C2HlCHc1x12+tB/0ByfjvmQJTYP3uE30= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Srinivas Kandagatla , Mark Brown , Sasha Levin Subject: [PATCH 5.15 571/779] ASoC: codecs: msm8916-wcd-digital: move gains from SX_TLV to S8_TLV Date: Mon, 15 Aug 2022 20:03:35 +0200 Message-Id: <20220815180401.737328735@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Srinivas Kandagatla [ Upstream commit 5babb012c847beb6c8c7108fd78f650b7a2c6054 ] move all the digital gains form using SX_TLV to S8_TLV, these gains are actually 8 bit gains with 7th signed bit and ranges from -84dB to +40dB rest of the Qualcomm wcd codecs uses these properly. Fixes: ef8a4757a6db ("ASoC: msm8916-wcd-digital: Add sidetone support") Fixes: 150db8c5afa1 ("ASoC: codecs: Add msm8916-wcd digital codec") Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20220609111901.318047-2-srinivas.kandagatla= @linaro.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- sound/soc/codecs/msm8916-wcd-digital.c | 46 +++++++++++++------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/sound/soc/codecs/msm8916-wcd-digital.c b/sound/soc/codecs/msm8= 916-wcd-digital.c index 20a07c92b2fc..098a58990f07 100644 --- a/sound/soc/codecs/msm8916-wcd-digital.c +++ b/sound/soc/codecs/msm8916-wcd-digital.c @@ -328,8 +328,8 @@ static const struct snd_kcontrol_new rx1_mix2_inp1_mux = =3D SOC_DAPM_ENUM( static const struct snd_kcontrol_new rx2_mix2_inp1_mux =3D SOC_DAPM_ENUM( "RX2 MIX2 INP1 Mux", rx2_mix2_inp1_chain_enum); =20 -/* Digital Gain control -38.4 dB to +38.4 dB in 0.3 dB steps */ -static const DECLARE_TLV_DB_SCALE(digital_gain, -3840, 30, 0); +/* Digital Gain control -84 dB to +40 dB in 1 dB steps */ +static const DECLARE_TLV_DB_SCALE(digital_gain, -8400, 100, -8400); =20 /* Cutoff Freq for High Pass Filter at -3dB */ static const char * const hpf_cutoff_text[] =3D { @@ -510,15 +510,15 @@ static int wcd_iir_filter_info(struct snd_kcontrol *k= control, =20 static const struct snd_kcontrol_new msm8916_wcd_digital_snd_controls[] = =3D { SOC_SINGLE_S8_TLV("RX1 Digital Volume", LPASS_CDC_RX1_VOL_CTL_B2_CTL, - -128, 127, digital_gain), + -84, 40, digital_gain), SOC_SINGLE_S8_TLV("RX2 Digital Volume", LPASS_CDC_RX2_VOL_CTL_B2_CTL, - -128, 127, digital_gain), + -84, 40, digital_gain), SOC_SINGLE_S8_TLV("RX3 Digital Volume", LPASS_CDC_RX3_VOL_CTL_B2_CTL, - -128, 127, digital_gain), + -84, 40, digital_gain), SOC_SINGLE_S8_TLV("TX1 Digital Volume", LPASS_CDC_TX1_VOL_CTL_GAIN, - -128, 127, digital_gain), + -84, 40, digital_gain), SOC_SINGLE_S8_TLV("TX2 Digital Volume", LPASS_CDC_TX2_VOL_CTL_GAIN, - -128, 127, digital_gain), + -84, 40, digital_gain), SOC_ENUM("TX1 HPF Cutoff", tx1_hpf_cutoff_enum), SOC_ENUM("TX2 HPF Cutoff", tx2_hpf_cutoff_enum), SOC_SINGLE("TX1 HPF Switch", LPASS_CDC_TX1_MUX_CTL, 3, 1, 0), @@ -553,22 +553,22 @@ static const struct snd_kcontrol_new msm8916_wcd_digi= tal_snd_controls[] =3D { WCD_IIR_FILTER_CTL("IIR2 Band3", IIR2, BAND3), WCD_IIR_FILTER_CTL("IIR2 Band4", IIR2, BAND4), WCD_IIR_FILTER_CTL("IIR2 Band5", IIR2, BAND5), - SOC_SINGLE_SX_TLV("IIR1 INP1 Volume", LPASS_CDC_IIR1_GAIN_B1_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("IIR1 INP2 Volume", LPASS_CDC_IIR1_GAIN_B2_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("IIR1 INP3 Volume", LPASS_CDC_IIR1_GAIN_B3_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("IIR1 INP4 Volume", LPASS_CDC_IIR1_GAIN_B4_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("IIR2 INP1 Volume", LPASS_CDC_IIR2_GAIN_B1_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("IIR2 INP2 Volume", LPASS_CDC_IIR2_GAIN_B2_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("IIR2 INP3 Volume", LPASS_CDC_IIR2_GAIN_B3_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("IIR2 INP4 Volume", LPASS_CDC_IIR2_GAIN_B4_CTL, - 0, -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("IIR1 INP1 Volume", LPASS_CDC_IIR1_GAIN_B1_CTL, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("IIR1 INP2 Volume", LPASS_CDC_IIR1_GAIN_B2_CTL, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("IIR1 INP3 Volume", LPASS_CDC_IIR1_GAIN_B3_CTL, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("IIR1 INP4 Volume", LPASS_CDC_IIR1_GAIN_B4_CTL, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("IIR2 INP1 Volume", LPASS_CDC_IIR2_GAIN_B1_CTL, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("IIR2 INP2 Volume", LPASS_CDC_IIR2_GAIN_B2_CTL, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("IIR2 INP3 Volume", LPASS_CDC_IIR2_GAIN_B3_CTL, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("IIR2 INP4 Volume", LPASS_CDC_IIR2_GAIN_B4_CTL, + -84, 40, digital_gain), =20 }; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6EB9C28B2C for ; Mon, 15 Aug 2022 19:33:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244231AbiHOTcI (ORCPT ); Mon, 15 Aug 2022 15:32:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344631AbiHOT1F (ORCPT ); Mon, 15 Aug 2022 15:27:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E31D85A885; Mon, 15 Aug 2022 11:42: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 D97D0B8108E; Mon, 15 Aug 2022 18:42:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18B85C433D6; Mon, 15 Aug 2022 18:42:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588967; bh=ck9ZbTAmRWqWpD4kaTM2T0GKFcV2RSVc8kXODD7nPN8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CMPmfH6cgFkPIa8Gu1KW+KqHbrJZRPnvn+mgdhD6UoBkp33ApcDvZ4XoHj0K7lbwR HZknTG2uezBMubdEU6jmexg7hv/YKH8qG8JSdd5VhpYT2x8sBfehNoch4jFuy0FXqP l/TA99yv+oU3nLgxulRhG1RMIIfOaLmgARxplhW0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Srinivas Kandagatla , Mark Brown , Sasha Levin Subject: [PATCH 5.15 572/779] ASoC: codecs: wcd9335: move gains from SX_TLV to S8_TLV Date: Mon, 15 Aug 2022 20:03:36 +0200 Message-Id: <20220815180401.785196709@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Srinivas Kandagatla [ Upstream commit 2fbe0953732e06b471cdedbf6f615b84235580d8 ] move all the digital gains form using SX_TLV to S8_TLV, these gains are actually 8 bit gains with 7th signed bit and ranges from -84dB to +40dB rest of the Qualcomm wcd codecs uses these properly. Fixes: 8c4f021d806a ("ASoC: wcd9335: add basic controls") Signed-off-by: Srinivas Kandagatla Link: https://lore.kernel.org/r/20220609111901.318047-3-srinivas.kandagatla= @linaro.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- sound/soc/codecs/wcd9335.c | 81 +++++++++++++++++--------------------- 1 file changed, 36 insertions(+), 45 deletions(-) diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c index bc5d68c53e5a..3a13afbfb74b 100644 --- a/sound/soc/codecs/wcd9335.c +++ b/sound/soc/codecs/wcd9335.c @@ -2252,51 +2252,42 @@ static int wcd9335_rx_hph_mode_put(struct snd_kcont= rol *kc, =20 static const struct snd_kcontrol_new wcd9335_snd_controls[] =3D { /* -84dB min - 40dB max */ - SOC_SINGLE_SX_TLV("RX0 Digital Volume", WCD9335_CDC_RX0_RX_VOL_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX1 Digital Volume", WCD9335_CDC_RX1_RX_VOL_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX2 Digital Volume", WCD9335_CDC_RX2_RX_VOL_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX3 Digital Volume", WCD9335_CDC_RX3_RX_VOL_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX4 Digital Volume", WCD9335_CDC_RX4_RX_VOL_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX5 Digital Volume", WCD9335_CDC_RX5_RX_VOL_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX6 Digital Volume", WCD9335_CDC_RX6_RX_VOL_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX7 Digital Volume", WCD9335_CDC_RX7_RX_VOL_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX8 Digital Volume", WCD9335_CDC_RX8_RX_VOL_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX0 Mix Digital Volume", - WCD9335_CDC_RX0_RX_VOL_MIX_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX1 Mix Digital Volume", - WCD9335_CDC_RX1_RX_VOL_MIX_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX2 Mix Digital Volume", - WCD9335_CDC_RX2_RX_VOL_MIX_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX3 Mix Digital Volume", - WCD9335_CDC_RX3_RX_VOL_MIX_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX4 Mix Digital Volume", - WCD9335_CDC_RX4_RX_VOL_MIX_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX5 Mix Digital Volume", - WCD9335_CDC_RX5_RX_VOL_MIX_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX6 Mix Digital Volume", - WCD9335_CDC_RX6_RX_VOL_MIX_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX7 Mix Digital Volume", - WCD9335_CDC_RX7_RX_VOL_MIX_CTL, - 0, -84, 40, digital_gain), - SOC_SINGLE_SX_TLV("RX8 Mix Digital Volume", - WCD9335_CDC_RX8_RX_VOL_MIX_CTL, - 0, -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX0 Digital Volume", WCD9335_CDC_RX0_RX_VOL_CTL, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX1 Digital Volume", WCD9335_CDC_RX1_RX_VOL_CTL, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX2 Digital Volume", WCD9335_CDC_RX2_RX_VOL_CTL, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX3 Digital Volume", WCD9335_CDC_RX3_RX_VOL_CTL, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX4 Digital Volume", WCD9335_CDC_RX4_RX_VOL_CTL, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX5 Digital Volume", WCD9335_CDC_RX5_RX_VOL_CTL, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX6 Digital Volume", WCD9335_CDC_RX6_RX_VOL_CTL, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX7 Digital Volume", WCD9335_CDC_RX7_RX_VOL_CTL, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX8 Digital Volume", WCD9335_CDC_RX8_RX_VOL_CTL, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX0 Mix Digital Volume", WCD9335_CDC_RX0_RX_VOL_MIX_CT= L, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX1 Mix Digital Volume", WCD9335_CDC_RX1_RX_VOL_MIX_CT= L, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX2 Mix Digital Volume", WCD9335_CDC_RX2_RX_VOL_MIX_CT= L, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX3 Mix Digital Volume", WCD9335_CDC_RX3_RX_VOL_MIX_CT= L, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX4 Mix Digital Volume", WCD9335_CDC_RX4_RX_VOL_MIX_CT= L, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX5 Mix Digital Volume", WCD9335_CDC_RX5_RX_VOL_MIX_CT= L, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX6 Mix Digital Volume", WCD9335_CDC_RX6_RX_VOL_MIX_CT= L, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX7 Mix Digital Volume", WCD9335_CDC_RX7_RX_VOL_MIX_CT= L, + -84, 40, digital_gain), + SOC_SINGLE_S8_TLV("RX8 Mix Digital Volume", WCD9335_CDC_RX8_RX_VOL_MIX_CT= L, + -84, 40, digital_gain), SOC_ENUM("RX INT0_1 HPF cut off", cf_int0_1_enum), SOC_ENUM("RX INT0_2 HPF cut off", cf_int0_2_enum), SOC_ENUM("RX INT1_1 HPF cut off", cf_int1_1_enum), --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63365C2BB9D for ; Mon, 15 Aug 2022 19:33:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244644AbiHOTcN (ORCPT ); Mon, 15 Aug 2022 15:32:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344645AbiHOT1F (ORCPT ); Mon, 15 Aug 2022 15:27: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 A71F95A3CA; Mon, 15 Aug 2022 11:42: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 34656B810A2; Mon, 15 Aug 2022 18:42:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5DD8EC433D6; Mon, 15 Aug 2022 18:42:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588970; bh=kqisEMR1dw40SEAe95IXg/m0xgPf6Z1t4GvyGIxY2Uk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0xu7Gb1N8l6dFWTvcbynATkdbttLyU1SlTDRgi8H/t7Ri+qTWT7C67gM90TCcr+kB lBCUvJCVEycWpeyENIO+AduaSbaHm4XMiFRREMdLfxKVRup6yLutVE0TTKvibjibtg nADPVLrtt4DIFXQQdTu8Y8hOwj7HNffA1uypIfOI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shengjiu Wang , Mathieu Poirier , Sasha Levin Subject: [PATCH 5.15 573/779] rpmsg: char: Add mutex protection for rpmsg_eptdev_open() Date: Mon, 15 Aug 2022 20:03:37 +0200 Message-Id: <20220815180401.816997752@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shengjiu Wang [ Upstream commit abe13e9a561d6b3e82b21362c0d6dd3ecd8a5b13 ] There is no mutex protection for rpmsg_eptdev_open(), especially for eptdev->ept read and write operation. It may cause issues when multiple instances call rpmsg_eptdev_open() in parallel,the return state may be success or EBUSY. Fixes: 964e8bedd5a1 ("rpmsg: char: Return an error if device already open") Signed-off-by: Shengjiu Wang Link: https://lore.kernel.org/r/1653104105-16779-1-git-send-email-shengjiu.= wang@nxp.com Signed-off-by: Mathieu Poirier Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/rpmsg/rpmsg_char.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/rpmsg/rpmsg_char.c b/drivers/rpmsg/rpmsg_char.c index 49dd5a200998..88c985f9e73a 100644 --- a/drivers/rpmsg/rpmsg_char.c +++ b/drivers/rpmsg/rpmsg_char.c @@ -127,8 +127,11 @@ static int rpmsg_eptdev_open(struct inode *inode, stru= ct file *filp) struct rpmsg_device *rpdev =3D eptdev->rpdev; struct device *dev =3D &eptdev->dev; =20 - if (eptdev->ept) + mutex_lock(&eptdev->ept_lock); + if (eptdev->ept) { + mutex_unlock(&eptdev->ept_lock); return -EBUSY; + } =20 get_device(dev); =20 @@ -136,11 +139,13 @@ static int rpmsg_eptdev_open(struct inode *inode, str= uct file *filp) if (!ept) { dev_err(dev, "failed to open %s\n", eptdev->chinfo.name); put_device(dev); + mutex_unlock(&eptdev->ept_lock); return -EINVAL; } =20 eptdev->ept =3D ept; filp->private_data =3D eptdev; + mutex_unlock(&eptdev->ept_lock); =20 return 0; } --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC5FEC25B0E for ; Mon, 15 Aug 2022 19:32:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233112AbiHOTcS (ORCPT ); Mon, 15 Aug 2022 15:32:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344690AbiHOT1J (ORCPT ); Mon, 15 Aug 2022 15:27:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11EE85A8A6; Mon, 15 Aug 2022 11:42: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 82055B81085; Mon, 15 Aug 2022 18:42:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B92CDC433D7; Mon, 15 Aug 2022 18:42:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588974; bh=YmPtB00+x06ok6M2EENGT2jgGfbXWBYmBnCWOHj6VxI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CISi8X91BTtDqzLnLY1TnlIpeYoRdIyb1myE3bT5cykDWRkSIIyi/t3XxQkjZg7VX QZDeZ4dJPfMSf5LrsUFrVwgkJBhqAnsTlEBuIZTB6nZoBSEuQ/BeNiAiYhVzlkEkGC t05CUvrUsEfPh9mEHc3vI/4ldhLIvnxzCfLuoi/A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, AngeloGioacchino Del Regno , Mathieu Poirier , Sasha Levin Subject: [PATCH 5.15 574/779] rpmsg: mtk_rpmsg: Fix circular locking dependency Date: Mon, 15 Aug 2022 20:03:38 +0200 Message-Id: <20220815180401.856920074@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: AngeloGioacchino Del Regno [ Upstream commit 353d9214682e65c55cdffad8c82139a3321c5f13 ] During execution of the worker that's used to register rpmsg devices we are safely locking the channels mutex but, when creating a new endpoint for such devices, we are registering a IPI on the SCP, which then makes the SCP to trigger an interrupt, lock its own mutex and in turn register more subdevices. This creates a circular locking dependency situation, as the mtk_rpmsg channels_lock will then depend on the SCP IPI lock. [ 15.447736] =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D [ 15.460158] WARNING: possible circular locking dependency detected [ 15.460161] 5.17.0-next-20220324+ #399 Not tainted [ 15.460165] ------------------------------------------------------ [ 15.460166] kworker/0:3/155 is trying to acquire lock: [ 15.460170] ffff5b4d0eaf1308 (&scp->ipi_desc[i].lock){+.+.}-{4:4}, at: s= cp_ipi_lock+0x34/0x50 [mtk_scp_ipi] [ 15.504958] [] but task is already holding lock: [ 15.504960] ffff5b4d0e8f1918 (&mtk_subdev->channels_lock){+.+.}-{4:4}, a= t: mtk_register_device_work_function+0x50/0x1cc [mtk_rpmsg] [ 15.504978] [] which lock already depends on the new lock. [ 15.504980] [] the existing dependency chain (in reverse order) is: [ 15.504982] [] -> #1 (&mtk_subdev->channels_lock){+.+.}-{4:4}: [ 15.504990] lock_acquire+0x68/0x84 [ 15.504999] __mutex_lock+0xa4/0x3e0 [ 15.505007] mutex_lock_nested+0x40/0x70 [ 15.505012] mtk_rpmsg_ns_cb+0xe4/0x134 [mtk_rpmsg] [ 15.641684] mtk_rpmsg_ipi_handler+0x38/0x64 [mtk_rpmsg] [ 15.641693] scp_ipi_handler+0xbc/0x180 [mtk_scp] [ 15.663905] mt8192_scp_irq_handler+0x44/0xa4 [mtk_scp] [ 15.663915] scp_irq_handler+0x6c/0xa0 [mtk_scp] [ 15.685779] irq_thread_fn+0x34/0xa0 [ 15.685785] irq_thread+0x18c/0x240 [ 15.685789] kthread+0x104/0x110 [ 15.709579] ret_from_fork+0x10/0x20 [ 15.709586] [] -> #0 (&scp->ipi_desc[i].lock){+.+.}-{4:4}: [ 15.731271] __lock_acquire+0x11e4/0x1910 [ 15.740367] lock_acquire.part.0+0xd8/0x220 [ 15.749813] lock_acquire+0x68/0x84 [ 15.757861] __mutex_lock+0xa4/0x3e0 [ 15.766084] mutex_lock_nested+0x40/0x70 [ 15.775006] scp_ipi_lock+0x34/0x50 [mtk_scp_ipi] [ 15.785503] scp_ipi_register+0x40/0xa4 [mtk_scp_ipi] [ 15.796697] scp_register_ipi+0x1c/0x30 [mtk_scp] [ 15.807194] mtk_rpmsg_create_ept+0xa0/0x108 [mtk_rpmsg] [ 15.818912] rpmsg_create_ept+0x44/0x60 [ 15.827660] cros_ec_rpmsg_probe+0x15c/0x1f0 [ 15.837282] rpmsg_dev_probe+0x128/0x1d0 [ 15.846203] really_probe.part.0+0xa4/0x2a0 [ 15.855649] __driver_probe_device+0xa0/0x150 [ 15.865443] driver_probe_device+0x48/0x150 [ 15.877157] __device_attach_driver+0xc0/0x12c [ 15.889359] bus_for_each_drv+0x80/0xe0 [ 15.900330] __device_attach+0xe4/0x190 [ 15.911303] device_initial_probe+0x1c/0x2c [ 15.922969] bus_probe_device+0xa8/0xb0 [ 15.933927] device_add+0x3a8/0x8a0 [ 15.944193] device_register+0x28/0x40 [ 15.954970] rpmsg_register_device+0x5c/0xa0 [ 15.966782] mtk_register_device_work_function+0x148/0x1cc [mtk_rp= msg] [ 15.983146] process_one_work+0x294/0x664 [ 15.994458] worker_thread+0x7c/0x45c [ 16.005069] kthread+0x104/0x110 [ 16.014789] ret_from_fork+0x10/0x20 [ 16.025201] [] other info that might help us debug this: [ 16.047769] Possible unsafe locking scenario: [ 16.063942] CPU0 CPU1 [ 16.075166] ---- ---- [ 16.086376] lock(&mtk_subdev->channels_lock); [ 16.097592] lock(&scp->ipi_desc[i].lock); [ 16.113188] lock(&mtk_subdev->channels_lo= ck); [ 16.129482] lock(&scp->ipi_desc[i].lock); [ 16.140020] [] *** DEADLOCK *** [ 16.158282] 4 locks held by kworker/0:3/155: [ 16.168978] #0: ffff5b4d00008748 ((wq_completion)events){+.+.}-{0:0}, a= t: process_one_work+0x1fc/0x664 [ 16.190017] #1: ffff80000953bdc8 ((work_completion)(&mtk_subdev->regist= er_work)){+.+.}-{0:0}, at: process_one_work+0x1fc/0x664 [ 16.215269] #2: ffff5b4d0e8f1918 (&mtk_subdev->channels_lock){+.+.}-{4:= 4}, at: mtk_register_device_work_function+0x50/0x1cc [mtk_rpmsg] [ 16.242131] #3: ffff5b4d05964190 (&dev->mutex){....}-{4:4}, at: __devic= e_attach+0x44/0x190 To solve this, simply unlock the channels_lock mutex before calling mtk_rpmsg_register_device() and relock it right after, as safety is still ensured by the locking mechanism that happens right after through SCP. Fixes: 7017996951fd ("rpmsg: add rpmsg support for mt8183 SCP.") Signed-off-by: AngeloGioacchino Del Regno Link: https://lore.kernel.org/r/20220525091201.14210-1-angelogioacchino.del= regno@collabora.com Signed-off-by: Mathieu Poirier Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/rpmsg/mtk_rpmsg.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/rpmsg/mtk_rpmsg.c b/drivers/rpmsg/mtk_rpmsg.c index 96a17ec29140..2d8cb596ad69 100644 --- a/drivers/rpmsg/mtk_rpmsg.c +++ b/drivers/rpmsg/mtk_rpmsg.c @@ -234,7 +234,9 @@ static void mtk_register_device_work_function(struct wo= rk_struct *register_work) if (info->registered) continue; =20 + mutex_unlock(&subdev->channels_lock); ret =3D mtk_rpmsg_register_device(subdev, &info->info); + mutex_lock(&subdev->channels_lock); if (ret) { dev_err(&pdev->dev, "Can't create rpmsg_device\n"); continue; --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6133DC00140 for ; Mon, 15 Aug 2022 19:32:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244493AbiHOTcc (ORCPT ); Mon, 15 Aug 2022 15:32:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344744AbiHOT1L (ORCPT ); Mon, 15 Aug 2022 15:27:11 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC63613F9C; Mon, 15 Aug 2022 11:43: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 EDF78CE1272; Mon, 15 Aug 2022 18:42:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9EB6C433D6; Mon, 15 Aug 2022 18:42:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588977; bh=rCXvtXaR4ly72y2j//EvqPJYbAVPh9JaWUyU2scxMdo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0YU2IFHI8y44nCwEffOIW4/t7wrcOzaKXHM88T6I0vhmigA7bm0ATcXdkZujLWD7A SggrctJAUM0wA6RxTSJ110oixFSiUvjwQTm44CC7FHTLPZ6wjRz1m0vJb+BnhH39ow iXCOO2s8Whvq0Hem+NUDQ+G1DbqxBJwIbXkpYjzI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Suman Anna , Mathieu Poirier , Sasha Levin Subject: [PATCH 5.15 575/779] remoteproc: k3-r5: Fix refcount leak in k3_r5_cluster_of_init Date: Mon, 15 Aug 2022 20:03:39 +0200 Message-Id: <20220815180401.904853789@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit fa220c05d282e7479abe08b54e3bdffd06c25e97 ] Every iteration of for_each_available_child_of_node() decrements the reference count of the previous node. When breaking early from a for_each_available_child_of_node() loop, we need to explicitly call of_node_put() on the child node. Add missing of_node_put() to avoid refcount leak. Fixes: 6dedbd1d5443 ("remoteproc: k3-r5: Add a remoteproc driver for R5F su= bsystem") Signed-off-by: Miaoqian Lin Acked-by: Suman Anna Link: https://lore.kernel.org/r/20220605083334.23942-1-linmq006@gmail.com Signed-off-by: Mathieu Poirier Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/remoteproc/ti_k3_r5_remoteproc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/remoteproc/ti_k3_r5_remoteproc.c b/drivers/remoteproc/= ti_k3_r5_remoteproc.c index 71615210df3e..54266ea69c84 100644 --- a/drivers/remoteproc/ti_k3_r5_remoteproc.c +++ b/drivers/remoteproc/ti_k3_r5_remoteproc.c @@ -1430,6 +1430,7 @@ static int k3_r5_cluster_of_init(struct platform_devi= ce *pdev) if (!cpdev) { ret =3D -ENODEV; dev_err(dev, "could not get R5 core platform device\n"); + of_node_put(child); goto fail; } =20 @@ -1438,6 +1439,7 @@ static int k3_r5_cluster_of_init(struct platform_devi= ce *pdev) dev_err(dev, "k3_r5_core_of_init failed, ret =3D %d\n", ret); put_device(&cpdev->dev); + of_node_put(child); goto fail; } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5A23C00140 for ; Mon, 15 Aug 2022 19:32:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242575AbiHOTcf (ORCPT ); Mon, 15 Aug 2022 15:32:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344772AbiHOT1N (ORCPT ); Mon, 15 Aug 2022 15:27:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9E8F5B042; Mon, 15 Aug 2022 11:43: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 7B8A8B8105D; Mon, 15 Aug 2022 18:43:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA052C433D6; Mon, 15 Aug 2022 18:42:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588980; bh=ZxhMVr49eMNwslMvCFUqsr9mcAHtbfXm7urEzpKHVlo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sTFKWGPT5/cZjdUm0GKRL/QrGx5IzdlhoME0NBN2PaVHERwwQ+zORVgwp51S6tiTg Qis5YcdaFdb68mgGM/ikpEivIXBW4MYYQENUKLlg2vwbyXbI06Tcm8jkRxw0ciPkph 1IB9aLTPL4FLLAy0XHv2396bSADUe5VyzGURdgE4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joe Lawrence , Petr Mladek , Sasha Levin Subject: [PATCH 5.15 576/779] selftests/livepatch: better synchronize test_klp_callbacks_busy Date: Mon, 15 Aug 2022 20:03:40 +0200 Message-Id: <20220815180401.950862942@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Joe Lawrence [ Upstream commit 55eb9a6c8bf3e2099863118ef53e02d9f44f85a8 ] The test_klp_callbacks_busy module conditionally blocks a future livepatch transition by busy waiting inside its workqueue function, busymod_work_func(). After scheduling this work, a test livepatch is loaded, introducing the transition under test. Both events are marked in the kernel log for later verification, but there is no synchronization to ensure that busymod_work_func() logs its function entry message before subsequent selftest commands log their own messages. This can lead to a rare test failure due to unexpected ordering like: # --- expected # +++ result # @@ -1,7 +1,7 @@ # % modprobe test_klp_callbacks_busy block_transition=3DY # test_klp_callbacks_busy: test_klp_callbacks_busy_init # -test_klp_callbacks_busy: busymod_work_func enter # % modprobe test_klp_callbacks_demo # +test_klp_callbacks_busy: busymod_work_func enter # livepatch: enabling patch 'test_klp_callbacks_demo' # livepatch: 'test_klp_callbacks_demo': initializing patching transition # test_klp_callbacks_demo: pre_patch_callback: vmlinux Force the module init function to wait until busymod_work_func() has started (and logged its message), before exiting to the next selftest steps. Fixes: 547840bd5ae5 ("selftests/livepatch: simplify test-klp-callbacks busy= target tests") Signed-off-by: Joe Lawrence Reviewed-by: Petr Mladek Signed-off-by: Petr Mladek Link: https://lore.kernel.org/r/20220602203233.979681-1-joe.lawrence@redhat= .com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- lib/livepatch/test_klp_callbacks_busy.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/lib/livepatch/test_klp_callbacks_busy.c +++ b/lib/livepatch/test_klp_callbacks_busy.c @@ -16,10 +16,12 @@ MODULE_PARM_DESC(block_transition, "bloc =20 static void busymod_work_func(struct work_struct *work); static DECLARE_WORK(work, busymod_work_func); +static DECLARE_COMPLETION(busymod_work_started); =20 static void busymod_work_func(struct work_struct *work) { pr_info("%s enter\n", __func__); + complete(&busymod_work_started); =20 while (READ_ONCE(block_transition)) { /* @@ -37,6 +39,12 @@ static int test_klp_callbacks_busy_init( pr_info("%s\n", __func__); schedule_work(&work); =20 + /* + * To synchronize kernel messages, hold the init function from + * exiting until the work function's entry message has printed. + */ + wait_for_completion(&busymod_work_started); + if (!block_transition) { /* * Serialize output: print all messages from the work From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B574FC00140 for ; Mon, 15 Aug 2022 19:32:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243954AbiHOTcw (ORCPT ); Mon, 15 Aug 2022 15:32:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344850AbiHOT1S (ORCPT ); Mon, 15 Aug 2022 15:27:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 225185A8BC; Mon, 15 Aug 2022 11:43: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 BC0C0B81081; Mon, 15 Aug 2022 18:43:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AE0CC433C1; Mon, 15 Aug 2022 18:43:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588986; bh=GOfBK2gscdwO9OyW57PLbtTXBjoNAVxft36u86R8bUQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0dIC9TjrSnssIIp2F6yXwYAoPRQwmnvA/GE/K4dfSn3ijWV2Jaeas2msGX2KJ+Onz H9YIhM4Oj6QaSqoeAJwL3apqIwkrQIfrToMxASeu5EoyeW+r90CDxUMvOGfWOk75Sf 63luD0DyWZmUwJuocjsGIMoTQOGOuE0Vo2jVVuQc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen Zhongjin , Andrew Morton , Sasha Levin Subject: [PATCH 5.15 577/779] profiling: fix shift too large makes kernel panic Date: Mon, 15 Aug 2022 20:03:41 +0200 Message-Id: <20220815180401.999342942@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Zhongjin [ Upstream commit 0fe6ee8f123a4dfb529a5aff07536bb481f34043 ] 2d186afd04d6 ("profiling: fix shift-out-of-bounds bugs") limits shift value by [0, BITS_PER_LONG -1], which means [0, 63]. However, syzbot found that the max shift value should be the bit number of (_etext - _stext). If shift is outside of this, the "buffer_bytes" will be zero and will cause kzalloc(0). Then the kernel panics due to dereferencing the returned pointer 16. This can be easily reproduced by passing a large number like 60 to enable profiling and then run readprofile. LOGS: BUG: kernel NULL pointer dereference, address: 0000000000000010 #PF: supervisor write access in kernel mode #PF: error_code(0x0002) - not-present page PGD 6148067 P4D 6148067 PUD 6142067 PMD 0 PREEMPT SMP CPU: 4 PID: 184 Comm: readprofile Not tainted 5.18.0+ #162 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.15.0-0-g= 2dd4b9b3f840-prebuilt.qemu.org 04/01/2014 RIP: 0010:read_profile+0x104/0x220 RSP: 0018:ffffc900006fbe80 EFLAGS: 00000202 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 RDX: ffff888006150000 RSI: 0000000000000001 RDI: ffffffff82aba4a0 RBP: 000000000188bb60 R08: 0000000000000010 R09: ffff888006151000 R10: 0000000000000000 R11: 0000000000000000 R12: ffffffff82aba4a0 R13: 0000000000000000 R14: ffffc900006fbf08 R15: 0000000000020c30 FS: 000000000188a8c0(0000) GS:ffff88803ed00000(0000) knlGS:00000000000000= 00 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000010 CR3: 0000000006144000 CR4: 00000000000006e0 Call Trace: proc_reg_read+0x56/0x70 vfs_read+0x9a/0x1b0 ksys_read+0xa1/0xe0 ? fpregs_assert_state_consistent+0x1e/0x40 do_syscall_64+0x3a/0x80 entry_SYSCALL_64_after_hwframe+0x46/0xb0 RIP: 0033:0x4d4b4e RSP: 002b:00007ffebb668d58 EFLAGS: 00000246 ORIG_RAX: 0000000000000000 RAX: ffffffffffffffda RBX: 000000000188a8a0 RCX: 00000000004d4b4e RDX: 0000000000000400 RSI: 000000000188bb60 RDI: 0000000000000003 RBP: 0000000000000003 R08: 000000000000006e R09: 0000000000000000 R10: 0000000000000041 R11: 0000000000000246 R12: 000000000188bb60 R13: 0000000000000400 R14: 0000000000000000 R15: 000000000188bb60 Modules linked in: CR2: 0000000000000010 Killed ---[ end trace 0000000000000000 ]--- Check prof_len in profile_init() to prevent it be zero. Link: https://lkml.kernel.org/r/20220531012854.229439-1-chenzhongjin@huawei= .com Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Chen Zhongjin Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- kernel/profile.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/kernel/profile.c b/kernel/profile.c index eb9c7f0f5ac5..0db1122855c0 100644 --- a/kernel/profile.c +++ b/kernel/profile.c @@ -109,6 +109,13 @@ int __ref profile_init(void) =20 /* only text is profiled */ prof_len =3D (_etext - _stext) >> prof_shift; + + if (!prof_len) { + pr_warn("profiling shift: %u too large\n", prof_shift); + prof_on =3D 0; + return -EINVAL; + } + buffer_bytes =3D prof_len*sizeof(atomic_t); =20 if (!alloc_cpumask_var(&prof_cpu_mask, GFP_KERNEL)) --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16799C00140 for ; Mon, 15 Aug 2022 19:32:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242777AbiHOTcr (ORCPT ); Mon, 15 Aug 2022 15:32:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344864AbiHOT1V (ORCPT ); Mon, 15 Aug 2022 15:27:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BAB95B06E; Mon, 15 Aug 2022 11:43: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 05EB5B8105D; Mon, 15 Aug 2022 18:43:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46F1FC433D7; Mon, 15 Aug 2022 18:43:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588989; bh=nUtCaeffMCvmWQbyHKlf7NyVMga44HMxbZ1Rwk1aclw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eMAFsiCmDTmwgD1QEmCokH18MJuv4tURi1BfJBaxGDpBh23eQ2nuH8Wl6+XC+vE71 pJuGlFRFUxwi3N6yhkujzbdkljweHA0nc2hq1Y0Kq8N/IwLj+lokcJhJjCDcOt6fSj +vTNtyuJ3DVAkdAJ2+x6WpHcPZntBQRIyqbOVBsA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Mathieu Poirier , Sasha Levin Subject: [PATCH 5.15 578/779] remoteproc: imx_rproc: Fix refcount leak in imx_rproc_addr_init Date: Mon, 15 Aug 2022 20:03:42 +0200 Message-Id: <20220815180402.041792259@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 61afafe8b938bc74841cf4b1a73dd08b9d287c5a ] of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not needed anymore. This function has two paths missing of_node_put(). Fixes: 6e962bfe56b9 ("remoteproc: imx_rproc: add missing of_node_put") Fixes: a0ff4aa6f010 ("remoteproc: imx_rproc: add a NXP/Freescale imx_rproc = driver") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220512045558.7142-1-linmq006@gmail.com Signed-off-by: Mathieu Poirier Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/remoteproc/imx_rproc.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/remoteproc/imx_rproc.c b/drivers/remoteproc/imx_rproc.c index 59eae605ad59..e8a170ad43c1 100644 --- a/drivers/remoteproc/imx_rproc.c +++ b/drivers/remoteproc/imx_rproc.c @@ -586,16 +586,17 @@ static int imx_rproc_addr_init(struct imx_rproc *priv, =20 node =3D of_parse_phandle(np, "memory-region", a); /* Not map vdevbuffer, vdevring region */ - if (!strncmp(node->name, "vdev", strlen("vdev"))) + if (!strncmp(node->name, "vdev", strlen("vdev"))) { + of_node_put(node); continue; + } err =3D of_address_to_resource(node, 0, &res); + of_node_put(node); if (err) { dev_err(dev, "unable to resolve memory region\n"); return err; } =20 - of_node_put(node); - if (b >=3D IMX_RPROC_MEM_MAX) break; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D8B2C00140 for ; Mon, 15 Aug 2022 19:33:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232093AbiHOTdC (ORCPT ); Mon, 15 Aug 2022 15:33:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344879AbiHOT1Y (ORCPT ); Mon, 15 Aug 2022 15:27:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE8A95B074; Mon, 15 Aug 2022 11:43: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 59603611E3; Mon, 15 Aug 2022 18:43:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6035AC433C1; Mon, 15 Aug 2022 18:43:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588992; bh=yL9JrACkjVTIEMIH6qNEY4LXIxEtqVAeLLxT0WWprIU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=joOItXO4vCGVkjKfvr0UXTv5PYy1hlEmfVZGgMHUVa3HT7hxwDJcwTYFBnS7gRa3w oyN2V5rTaOY3Usqf5cUuKqYfnPrwAhJxpPm6Et63F2fY0xSMshVfaDwEiu9+nItTkI 3mex6xz9OMGpM4yVUgoQRmr4D/6v1Vq0yJtCfNkg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Krzysztof Kozlowski , Mark Brown , Sasha Levin Subject: [PATCH 5.15 579/779] ASoC: samsung: h1940_uda1380: include proepr GPIO consumer header Date: Mon, 15 Aug 2022 20:03:43 +0200 Message-Id: <20220815180402.086350747@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 bd10b0dafdcf0ec1677cad70101e1f97b9e28f2e ] h1940_uda1380 uses gpiod*/GPIOD* so it should include GPIO consumer header. Fixes: 9666e27f90b9 ("ASoC: samsung: h1940: turn into platform driver") Signed-off-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220627141900.470469-1-krzysztof.kozlowski= @linaro.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- sound/soc/samsung/h1940_uda1380.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/samsung/h1940_uda1380.c b/sound/soc/samsung/h1940_ud= a1380.c index c994e67d1eaf..ca086243fcfd 100644 --- a/sound/soc/samsung/h1940_uda1380.c +++ b/sound/soc/samsung/h1940_uda1380.c @@ -8,7 +8,7 @@ // Based on version from Arnaud Patard =20 #include -#include +#include #include =20 #include --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6C35C00140 for ; Mon, 15 Aug 2022 19:33:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245141AbiHOTdY (ORCPT ); Mon, 15 Aug 2022 15:33:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344918AbiHOT12 (ORCPT ); Mon, 15 Aug 2022 15:27:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9D8E5B78C; Mon, 15 Aug 2022 11:43: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 45524B81084; Mon, 15 Aug 2022 18:43:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BE3AC433D6; Mon, 15 Aug 2022 18:43:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588995; bh=pJnMWDnMzy10rYH7E792Cl5WrTV1NQgSAUWHLyCQRbQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zpzEUYV63E6u7PDHNdQscTVoeo/bmVuc8Zd/4lLqqLgcaTiFC+seYeWQTJ8OMP2jz KUHOBxrUf1PAGAVnABD/Wsl0LodtBkgeK0fLezgKjetRH4WMSUHzW1qHamssASdGYI k272xNP9El/pgGLSOQ2SUtzC9yEJJswCnOWVAiAc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Athira Rajeev , Michael Ellerman , Sasha Levin Subject: [PATCH 5.15 580/779] powerpc/perf: Optimize clearing the pending PMI and remove WARN_ON for PMI check in power_pmu_disable Date: Mon, 15 Aug 2022 20:03:44 +0200 Message-Id: <20220815180402.130977064@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Athira Rajeev [ Upstream commit 890005a7d98f7452cfe86dcfb2aeeb7df01132ce ] commit 2c9ac51b850d ("powerpc/perf: Fix PMU callbacks to clear pending PMI before resetting an overflown PMC") added a new function "pmi_irq_pending" in hw_irq.h. This function is to check if there is a PMI marked as pending in Paca (PACA_IRQ_PMI).This is used in power_pmu_disable in a WARN_ON. The intention here is to provide a warning if there is PMI pending, but no counter is found overflown. During some of the perf runs, below warning is hit: WARNING: CPU: 36 PID: 0 at arch/powerpc/perf/core-book3s.c:1332 power_pmu_d= isable+0x25c/0x2c0 Modules linked in: ----- NIP [c000000000141c3c] power_pmu_disable+0x25c/0x2c0 LR [c000000000141c8c] power_pmu_disable+0x2ac/0x2c0 Call Trace: [c000000baffcfb90] [c000000000141c8c] power_pmu_disable+0x2ac/0x2c0 (unrel= iable) [c000000baffcfc10] [c0000000003e2f8c] perf_pmu_disable+0x4c/0x60 [c000000baffcfc30] [c0000000003e3344] group_sched_out.part.124+0x44/0x100 [c000000baffcfc80] [c0000000003e353c] __perf_event_disable+0x13c/0x240 [c000000baffcfcd0] [c0000000003dd334] event_function+0xc4/0x140 [c000000baffcfd20] [c0000000003d855c] remote_function+0x7c/0xa0 [c000000baffcfd50] [c00000000026c394] flush_smp_call_function_queue+0xd4/0= x300 [c000000baffcfde0] [c000000000065b24] smp_ipi_demux_relaxed+0xa4/0x100 [c000000baffcfe20] [c0000000000cb2b0] xive_muxed_ipi_action+0x20/0x40 [c000000baffcfe40] [c000000000207c3c] __handle_irq_event_percpu+0x8c/0x250 [c000000baffcfee0] [c000000000207e2c] handle_irq_event_percpu+0x2c/0xa0 [c000000baffcff10] [c000000000210a04] handle_percpu_irq+0x84/0xc0 [c000000baffcff40] [c000000000205f14] generic_handle_irq+0x54/0x80 [c000000baffcff60] [c000000000015740] __do_irq+0x90/0x1d0 [c000000baffcff90] [c000000000016990] __do_IRQ+0xc0/0x140 [c0000009732f3940] [c000000bafceaca8] 0xc000000bafceaca8 [c0000009732f39d0] [c000000000016b78] do_IRQ+0x168/0x1c0 [c0000009732f3a00] [c0000000000090c8] hardware_interrupt_common_virt+0x218= /0x220 This means that there is no PMC overflown among the active events in the PMU, but there is a PMU pending in Paca. The function "any_pmc_overflown" checks the PMCs on active events in cpuhw->n_events. Code snippet: <<>> if (any_pmc_overflown(cpuhw)) clear_pmi_irq_pending(); else WARN_ON(pmi_irq_pending()); <<>> Here the PMC overflown is not from active event. Example: When we do perf record, default cycles and instructions will be running on PMC6 and PMC5 respectively. It could happen that overflowed event is currently not active and pending PMI is for the inactive event. Debug logs from trace_printk: <<>> any_pmc_overflown: idx is 5: pmc value is 0xd9a power_pmu_disable: PMC1: 0x0, PMC2: 0x0, PMC3: 0x0, PMC4: 0x0, PMC5: 0xd9a,= PMC6: 0x80002011 <<>> Here active PMC (from idx) is PMC5 , but overflown PMC is PMC6(0x80002011). When we handle PMI interrupt for such cases, if the PMC overflown is from inactive event, it will be ignored. Reference commit: commit bc09c219b2e6 ("powerpc/perf: Fix finding overflowed PMC in interrupt= ") Patch addresses two changes: 1) Fix 1 : Removal of warning ( WARN_ON(pmi_irq_pending()); ) We were printing warning if no PMC is found overflown among active PMU events, but PMI pending in PACA. But this could happen in cases where PMC overflown is not in active PMC. An inactive event could have caused the overflow. Hence the warning is not needed. To know pending PMI is from an inactive event, we need to loop through all PMC's which will cause more SPR reads via mfspr and increase in context switch. Also in existing function: perf_event_interrupt, already we ignore PMI's overflown when it is from an inactive PMC. 2) Fix 2: optimization in clearing pending PMI. Currently we check for any active PMC overflown before clearing PMI pending in Paca. This is causing additional SPR read also. From point 1, we know that if PMI pending in Paca from inactive cases, that is going to be ignored during replay. Hence if there is pending PMI in Paca, just clear it irrespective of PMC overflown or not. In summary, remove the any_pmc_overflown check entirely in power_pmu_disable. ie If there is a pending PMI in Paca, clear it, since we are in pmu_disable. There could be cases where PMI is pending because of inactive PMC ( which later when replayed also will get ignored ), so WARN_ON could give false warning. Hence removing it. Fixes: 2c9ac51b850d ("powerpc/perf: Fix PMU callbacks to clear pending PMI = before resetting an overflown PMC") Signed-off-by: Athira Rajeev Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220522142256.24699-1-atrajeev@linux.vnet.= ibm.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/powerpc/perf/core-book3s.c | 35 ++++++++++++++------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3= s.c index e78de7050947..1078784b74c9 100644 --- a/arch/powerpc/perf/core-book3s.c +++ b/arch/powerpc/perf/core-book3s.c @@ -1320,27 +1320,22 @@ static void power_pmu_disable(struct pmu *pmu) * a PMI happens during interrupt replay and perf counter * values are cleared by PMU callbacks before replay. * - * If any PMC corresponding to the active PMU events are - * overflown, disable the interrupt by clearing the paca - * bit for PMI since we are disabling the PMU now. - * Otherwise provide a warning if there is PMI pending, but - * no counter is found overflown. + * Disable the interrupt by clearing the paca bit for PMI + * since we are disabling the PMU now. Otherwise provide a + * warning if there is PMI pending, but no counter is found + * overflown. + * + * Since power_pmu_disable runs under local_irq_save, it + * could happen that code hits a PMC overflow without PMI + * pending in paca. Hence only clear PMI pending if it was + * set. + * + * If a PMI is pending, then MSR[EE] must be disabled (because + * the masked PMI handler disabling EE). So it is safe to + * call clear_pmi_irq_pending(). */ - if (any_pmc_overflown(cpuhw)) { - /* - * Since power_pmu_disable runs under local_irq_save, it - * could happen that code hits a PMC overflow without PMI - * pending in paca. Hence only clear PMI pending if it was - * set. - * - * If a PMI is pending, then MSR[EE] must be disabled (because - * the masked PMI handler disabling EE). So it is safe to - * call clear_pmi_irq_pending(). - */ - if (pmi_irq_pending()) - clear_pmi_irq_pending(); - } else - WARN_ON(pmi_irq_pending()); + if (pmi_irq_pending()) + clear_pmi_irq_pending(); =20 val =3D mmcra =3D cpuhw->mmcr.mmcra; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72D83C00140 for ; Mon, 15 Aug 2022 19:33:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245357AbiHOTdl (ORCPT ); Mon, 15 Aug 2022 15:33:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344959AbiHOT1c (ORCPT ); Mon, 15 Aug 2022 15:27:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F6005B791; Mon, 15 Aug 2022 11:43:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 64DFEB81081; Mon, 15 Aug 2022 18:43:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DA0DC433D6; Mon, 15 Aug 2022 18:43:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660588999; bh=DxR5Te+0hr5YPpVC4TDSEMJ/BVrdzLv1VvmTAOdfL3I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f9ycYEZ96DiwIMw2poVyNW2Jr+7b/4SAr3A3BQhyw4sFUx0QWkwgAu1P/sxdUe/Vh qekC6rr9is+U+qHxq1ALekjd2M8yGeFeHYL2cTID9sl78kc+M3WqevQbmmC9Zo9bzk AS0nREjSK1zTtFsrpvB4BmRFgiDq8w71hvxoNSPc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Rix , Krzysztof Kozlowski , Mark Brown , Sasha Levin Subject: [PATCH 5.15 581/779] ASoC: samsung: change gpiod_speaker_power and rx1950_audio from global to static variables Date: Mon, 15 Aug 2022 20:03:45 +0200 Message-Id: <20220815180402.180048808@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 d2294461b90e0c5b3bbfaaf2c8baff4fd3e2bb13 ] sparse reports sound/soc/samsung/rx1950_uda1380.c:131:18: warning: symbol 'gpiod_speaker_p= ower' was not declared. Should it be static? sound/soc/samsung/rx1950_uda1380.c:231:24: warning: symbol 'rx1950_audio' w= as not declared. Should it be static? Both gpiod_speaker_power and rx1950_audio are only used in rx1950_uda1380.c, so their storage class specifiers should be static. Fixes: 83d74e354200 ("ASoC: samsung: rx1950: turn into platform driver") Signed-off-by: Tom Rix Reviewed-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220629185345.910406-1-trix@redhat.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- sound/soc/samsung/rx1950_uda1380.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/samsung/rx1950_uda1380.c b/sound/soc/samsung/rx1950_= uda1380.c index 6ea1c8cc9167..2820097b00b9 100644 --- a/sound/soc/samsung/rx1950_uda1380.c +++ b/sound/soc/samsung/rx1950_uda1380.c @@ -128,7 +128,7 @@ static int rx1950_startup(struct snd_pcm_substream *sub= stream) &hw_rates); } =20 -struct gpio_desc *gpiod_speaker_power; +static struct gpio_desc *gpiod_speaker_power; =20 static int rx1950_spk_power(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) @@ -227,7 +227,7 @@ static int rx1950_probe(struct platform_device *pdev) return devm_snd_soc_register_card(dev, &rx1950_asoc); } =20 -struct platform_driver rx1950_audio =3D { +static struct platform_driver rx1950_audio =3D { .driver =3D { .name =3D "rx1950-audio", .pm =3D &snd_soc_pm_ops, --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9DE9AC25B08 for ; Mon, 15 Aug 2022 19:33:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245601AbiHOTdv (ORCPT ); Mon, 15 Aug 2022 15:33:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344978AbiHOT1d (ORCPT ); Mon, 15 Aug 2022 15:27:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D39EE5B7B4; Mon, 15 Aug 2022 11:43: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 A04DA61029; Mon, 15 Aug 2022 18:43:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0BB3C433D6; Mon, 15 Aug 2022 18:43:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589002; bh=AhmeuQUzMoaGbxiUtk8bPJmXxcVzqBhuEkgrIDVu3A4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bJrzIRNzRXO4PkKaQoSBejKgIh1jdXT1SxBNMbmM7b7i1jnEA45t3JTrTU4407V/7 X8iiKRpnA2aKcS/R5TNQVVJVfJvhH4D+XFeygyzk5y6IZsWrzEI+FdCFH1GtD1/JpF tYbVyu1DRZGdYxPSscBy+xX1FX0xMOKNFSFbz1D0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhenguo Zhao , Sasha Levin Subject: [PATCH 5.15 582/779] tty: n_gsm: Delete gsmtty open SABM frame when config requester Date: Mon, 15 Aug 2022 20:03:46 +0200 Message-Id: <20220815180402.212451203@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhenguo Zhao [ Upstream commit cbff2b32516881bef30bbebf413d1b49495bab1d ] When n_gsm config "initiator=3D0",as requester ,it doesn't need to send SABM frame data during gsmtty open. Example,when gsmtty open,it will send SABM frame.for initiator,it maybe not want to receive the frame. [ 88.410426] c1 gsmld_output: 00000000: f9 07 3f 01 de f9 [ 88.420839] c1 --> 1) R: SABM(F) Signed-off-by: Zhenguo Zhao Link: https://lore.kernel.org/r/1629461872-26965-6-git-send-email-zhenguo68= 58@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/tty/n_gsm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 4946a241e323..f86c5ebfcf91 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -3214,6 +3214,7 @@ static int gsmtty_open(struct tty_struct *tty, struct= file *filp) { struct gsm_dlci *dlci =3D tty->driver_data; struct tty_port *port =3D &dlci->port; + struct gsm_mux *gsm =3D dlci->gsm; =20 port->count++; tty_port_tty_set(port, tty); @@ -3223,7 +3224,8 @@ static int gsmtty_open(struct tty_struct *tty, struct= file *filp) a DM straight back. This is ok as that will have caused a hangup */ tty_port_set_initialized(port, 1); /* Start sending off SABM messages */ - gsm_dlci_begin_open(dlci); + if (gsm->initiator) + gsm_dlci_begin_open(dlci); /* And wait for virtual carrier */ return tty_port_block_til_ready(port, tty, filp); } --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09A2CC00140 for ; Mon, 15 Aug 2022 19:34:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233119AbiHOTeP (ORCPT ); Mon, 15 Aug 2022 15:34:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345012AbiHOT1g (ORCPT ); Mon, 15 Aug 2022 15:27:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E08405B7BB; Mon, 15 Aug 2022 11:43: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 4E7BDB810A1; Mon, 15 Aug 2022 18:43:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7B91C433D7; Mon, 15 Aug 2022 18:43:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589005; bh=zn8xdHTvk6cuJwKCSSmY3TtG/YeiFQm5hr60CWdFPHE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s7cYMpN7gBW0ieJ+1vFETmF9JwOv+FhGYTxFQZTmE4ahPzGbYcFxatlel9uaR4xdl EEspreW4e2B6VMsthf7bdAKqCCXdNuzHrkER5d1SZ+jIgbZPSmKaMN6iiQx9xqBh8a I8IbBxMt4MVUsYNTamfaWnaoKoUkB6MSNMlGoVSs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Starke , Sasha Levin Subject: [PATCH 5.15 583/779] tty: n_gsm: fix user open not possible at responder until initiator open Date: Mon, 15 Aug 2022 20:03:47 +0200 Message-Id: <20220815180402.254233998@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Starke [ Upstream commit ac77f0077c3265197d378158c85a55eee6d21508 ] After setting up the control channel on both sides the responder side may want to open a virtual tty to listen on until the initiator starts an application on a user channel. The current implementation allows the open() but no other operation, like termios. These fail with EINVAL. The responder sided application has no means to detect an open by the initiator sided application this way. And the initiator sided applications usually expect the responder sided application to listen on the user channel upon open. Set the user channel into half-open state on responder side once a user application opens the virtual tty to allow IO operations on it. Furthermore, keep the user channel constipated until the initiator side opens it to give the responder sided application the chance to detect the new connection and to avoid data loss if the responder sided application starts sending before the user channel is open. Fixes: e1eaea46bb40 ("tty: n_gsm line discipline") Signed-off-by: Daniel Starke Link: https://lore.kernel.org/r/20220701061652.39604-1-daniel.starke@siemen= s.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/tty/n_gsm.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index f86c5ebfcf91..36d5afa25fbb 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -1524,6 +1524,8 @@ static void gsm_dlci_close(struct gsm_dlci *dlci) if (debug & 8) pr_debug("DLCI %d goes closed.\n", dlci->addr); dlci->state =3D DLCI_CLOSED; + /* Prevent us from sending data before the link is up again */ + dlci->constipated =3D true; if (dlci->addr !=3D 0) { tty_port_tty_hangup(&dlci->port, false); spin_lock_irqsave(&dlci->lock, flags); @@ -1553,6 +1555,7 @@ static void gsm_dlci_open(struct gsm_dlci *dlci) del_timer(&dlci->t1); /* This will let a tty open continue */ dlci->state =3D DLCI_OPEN; + dlci->constipated =3D false; if (debug & 8) pr_debug("DLCI %d goes open.\n", dlci->addr); /* Send current modem state */ @@ -1633,6 +1636,25 @@ static void gsm_dlci_begin_open(struct gsm_dlci *dlc= i) mod_timer(&dlci->t1, jiffies + gsm->t1 * HZ / 100); } =20 +/** + * gsm_dlci_set_opening - change state to opening + * @dlci: DLCI to open + * + * Change internal state to wait for DLCI open from initiator side. + * We set off timers and responses upon reception of an SABM. + */ +static void gsm_dlci_set_opening(struct gsm_dlci *dlci) +{ + switch (dlci->state) { + case DLCI_CLOSED: + case DLCI_CLOSING: + dlci->state =3D DLCI_OPENING; + break; + default: + break; + } +} + /** * gsm_dlci_begin_close - start channel open procedure * @dlci: DLCI to open @@ -1776,10 +1798,13 @@ static struct gsm_dlci *gsm_dlci_alloc(struct gsm_m= ux *gsm, int addr) dlci->addr =3D addr; dlci->adaption =3D gsm->adaption; dlci->state =3D DLCI_CLOSED; - if (addr) + if (addr) { dlci->data =3D gsm_dlci_data; - else + /* Prevent us from sending data before the link is up */ + dlci->constipated =3D true; + } else { dlci->data =3D gsm_dlci_command; + } gsm->dlci[addr] =3D dlci; return dlci; } @@ -3226,6 +3251,8 @@ static int gsmtty_open(struct tty_struct *tty, struct= file *filp) /* Start sending off SABM messages */ if (gsm->initiator) gsm_dlci_begin_open(dlci); + else + gsm_dlci_set_opening(dlci); /* And wait for virtual carrier */ return tty_port_block_til_ready(port, tty, filp); } --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35CC0C25B08 for ; Mon, 15 Aug 2022 19:35:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343541AbiHOTfQ (ORCPT ); Mon, 15 Aug 2022 15:35:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345030AbiHOT1i (ORCPT ); Mon, 15 Aug 2022 15:27:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 550FD5C346; Mon, 15 Aug 2022 11:43: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 AA62661120; Mon, 15 Aug 2022 18:43:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0256C433D7; Mon, 15 Aug 2022 18:43:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589008; bh=lg3yLOyHRQ2kKv8C3j+wcdDavW77db+yK9HpxwkL5rQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v+zBoIuQjhBOS+478Um5dZ55WqMfEwiBr3hm04S1VHCK2PHDusG9o3lTPYBKvg2Qb mIceMHZ/NuC9tg+XAmbtAlNVwdOFDAESIYDUWp4y7EM/Io0f4Kazo5OPQ30SaLgC1z eA5vRkVPXORNr9+Bk6G4DDEwkd7htJs8PCqUpKSg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Starke , Sasha Levin Subject: [PATCH 5.15 584/779] tty: n_gsm: fix tty registration before control channel open Date: Mon, 15 Aug 2022 20:03:48 +0200 Message-Id: <20220815180402.292755815@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Starke [ Upstream commit 01aecd917114577c423f07cec0d186ad007d76fc ] The current implementation registers/deregisters the user ttys at mux attach/detach. That means that the user devices are available before any control channel is open. However, user channel initialization requires an open control channel. Furthermore, the user is not informed if the mux restarts due to configuration changes. Put the registration/deregistration procedure into separate function to improve readability. Move registration to mux activation and deregistration to mux cleanup to keep the user devices only open as long as a control channel exists. The user will be informed via the device driver if the mux was reconfigured in a way that required a mux re-activation. This makes it necessary to add T2 initialization to gsmld_open() for the ldisc open code path (not the reconfiguration code path) to avoid deletion of an uninitialized T2 at mux cleanup. Fixes: d50f6dcaf22a ("tty: n_gsm: expose gsmtty device nodes at ldisc open = time") Signed-off-by: Daniel Starke Link: https://lore.kernel.org/r/20220701061652.39604-2-daniel.starke@siemen= s.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/tty/n_gsm.c | 117 ++++++++++++++++++++++++++++++-------------- 1 file changed, 79 insertions(+), 38 deletions(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 36d5afa25fbb..9f7a638c6400 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -235,6 +235,7 @@ struct gsm_mux { struct gsm_dlci *dlci[NUM_DLCI]; int old_c_iflag; /* termios c_iflag value before attach */ bool constipated; /* Asked by remote to shut up */ + bool has_devices; /* Devices were registered */ =20 spinlock_t tx_lock; unsigned int tx_bytes; /* TX data outstanding */ @@ -467,6 +468,68 @@ static void gsm_hex_dump_bytes(const char *fname, cons= t u8 *data, kfree(prefix); } =20 +/** + * gsm_register_devices - register all tty devices for a given mux index + * + * @driver: the tty driver that describes the tty devices + * @index: the mux number is used to calculate the minor numbers of the + * ttys for this mux and may differ from the position in the + * mux array. + */ +static int gsm_register_devices(struct tty_driver *driver, unsigned int in= dex) +{ + struct device *dev; + int i; + unsigned int base; + + if (!driver || index >=3D MAX_MUX) + return -EINVAL; + + base =3D index * NUM_DLCI; /* first minor for this index */ + for (i =3D 1; i < NUM_DLCI; i++) { + /* Don't register device 0 - this is the control channel + * and not a usable tty interface + */ + dev =3D tty_register_device(gsm_tty_driver, base + i, NULL); + if (IS_ERR(dev)) { + if (debug & 8) + pr_info("%s failed to register device minor %u", + __func__, base + i); + for (i--; i >=3D 1; i--) + tty_unregister_device(gsm_tty_driver, base + i); + return PTR_ERR(dev); + } + } + + return 0; +} + +/** + * gsm_unregister_devices - unregister all tty devices for a given mux ind= ex + * + * @driver: the tty driver that describes the tty devices + * @index: the mux number is used to calculate the minor numbers of the + * ttys for this mux and may differ from the position in the + * mux array. + */ +static void gsm_unregister_devices(struct tty_driver *driver, + unsigned int index) +{ + int i; + unsigned int base; + + if (!driver || index >=3D MAX_MUX) + return; + + base =3D index * NUM_DLCI; /* first minor for this index */ + for (i =3D 1; i < NUM_DLCI; i++) { + /* Don't unregister device 0 - this is the control + * channel and not a usable tty interface + */ + tty_unregister_device(gsm_tty_driver, base + i); + } +} + /** * gsm_print_packet - display a frame for debug * @hdr: header to print before decode @@ -2256,6 +2319,10 @@ static void gsm_cleanup_mux(struct gsm_mux *gsm, boo= l disc) del_timer_sync(&gsm->t2_timer); =20 /* Free up any link layer users and finally the control channel */ + if (gsm->has_devices) { + gsm_unregister_devices(gsm_tty_driver, gsm->num); + gsm->has_devices =3D false; + } for (i =3D NUM_DLCI - 1; i >=3D 0; i--) if (gsm->dlci[i]) gsm_dlci_release(gsm->dlci[i]); @@ -2279,6 +2346,7 @@ static void gsm_cleanup_mux(struct gsm_mux *gsm, bool= disc) static int gsm_activate_mux(struct gsm_mux *gsm) { struct gsm_dlci *dlci; + int ret; =20 timer_setup(&gsm->t2_timer, gsm_control_retransmit, 0); init_waitqueue_head(&gsm->event); @@ -2290,9 +2358,14 @@ static int gsm_activate_mux(struct gsm_mux *gsm) else gsm->receive =3D gsm1_receive; =20 + ret =3D gsm_register_devices(gsm_tty_driver, gsm->num); + if (ret) + return ret; + dlci =3D gsm_dlci_alloc(gsm, 0); if (dlci =3D=3D NULL) return -ENOMEM; + gsm->has_devices =3D true; gsm->dead =3D false; /* Tty opens are now permissible */ return 0; } @@ -2552,39 +2625,14 @@ static int gsmld_output(struct gsm_mux *gsm, u8 *da= ta, int len) * will need moving to an ioctl path. */ =20 -static int gsmld_attach_gsm(struct tty_struct *tty, struct gsm_mux *gsm) +static void gsmld_attach_gsm(struct tty_struct *tty, struct gsm_mux *gsm) { - unsigned int base; - int ret, i; - gsm->tty =3D tty_kref_get(tty); /* Turn off tty XON/XOFF handling to handle it explicitly. */ gsm->old_c_iflag =3D tty->termios.c_iflag; tty->termios.c_iflag &=3D (IXON | IXOFF); - ret =3D gsm_activate_mux(gsm); - if (ret !=3D 0) - tty_kref_put(gsm->tty); - else { - /* Don't register device 0 - this is the control channel and not - a usable tty interface */ - base =3D mux_num_to_base(gsm); /* Base for this MUX */ - for (i =3D 1; i < NUM_DLCI; i++) { - struct device *dev; - - dev =3D tty_register_device(gsm_tty_driver, - base + i, NULL); - if (IS_ERR(dev)) { - for (i--; i >=3D 1; i--) - tty_unregister_device(gsm_tty_driver, - base + i); - return PTR_ERR(dev); - } - } - } - return ret; } =20 - /** * gsmld_detach_gsm - stop doing 0710 mux * @tty: tty attached to the mux @@ -2595,12 +2643,7 @@ static int gsmld_attach_gsm(struct tty_struct *tty, = struct gsm_mux *gsm) =20 static void gsmld_detach_gsm(struct tty_struct *tty, struct gsm_mux *gsm) { - unsigned int base =3D mux_num_to_base(gsm); /* Base for this MUX */ - int i; - WARN_ON(tty !=3D gsm->tty); - for (i =3D 1; i < NUM_DLCI; i++) - tty_unregister_device(gsm_tty_driver, base + i); /* Restore tty XON/XOFF handling. */ gsm->tty->termios.c_iflag =3D gsm->old_c_iflag; tty_kref_put(gsm->tty); @@ -2692,7 +2735,6 @@ static void gsmld_close(struct tty_struct *tty) static int gsmld_open(struct tty_struct *tty) { struct gsm_mux *gsm; - int ret; =20 if (tty->ops->write =3D=3D NULL) return -EINVAL; @@ -2708,12 +2750,11 @@ static int gsmld_open(struct tty_struct *tty) /* Attach the initial passive connection */ gsm->encoding =3D 1; =20 - ret =3D gsmld_attach_gsm(tty, gsm); - if (ret !=3D 0) { - gsm_cleanup_mux(gsm, false); - mux_put(gsm); - } - return ret; + gsmld_attach_gsm(tty, gsm); + + timer_setup(&gsm->t2_timer, gsm_control_retransmit, 0); + + return 0; } =20 /** --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FE71C25B0E for ; Mon, 15 Aug 2022 19:35:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245329AbiHOTfU (ORCPT ); Mon, 15 Aug 2022 15:35:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56896 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345084AbiHOT1p (ORCPT ); Mon, 15 Aug 2022 15:27:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BCC15C36B; Mon, 15 Aug 2022 11:43:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 98670B8108E; Mon, 15 Aug 2022 18:43:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1C03C433C1; Mon, 15 Aug 2022 18:43:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589011; bh=8qZo+gA82mlmHVA/PQ8pstnWKMZVK1SmbB7hFN0GCB8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pG51ysHM+bNTkd64ZQBX+Zr2tudLhUaz5xil01Vk6nhfKdzApCal15ghnlr88hSB7 Ur6f+/z5Ip48RJJKBoazWK3wLyrqBMinUcI7IwM4URWR26objyGX5TcDZCgj3w2nqT sl2XML/k9RohLPfaXrzc7/lkBXiO+rzRQuA/FP98= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Starke , Sasha Levin Subject: [PATCH 5.15 585/779] tty: n_gsm: fix wrong queuing behavior in gsm_dlci_data_output() Date: Mon, 15 Aug 2022 20:03:49 +0200 Message-Id: <20220815180402.334449440@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Starke [ Upstream commit 556fc8ac06513cced381588d6d58c184d95cc4fe ] 1) The function drains the fifo for the given user tty/DLCI without considering 'TX_THRESH_HI' and different to gsm_dlci_data_output_framed(), which moves only one packet from the user side to the internal transmission queue. We can only handle one packet at a time here if we want to allow DLCI priority handling in gsm_dlci_data_sweep() to avoid link starvation. 2) Furthermore, the additional header octet from convergence layer type 2 is not counted against MTU. It is part of the UI/UIH frame message which needs to be limited to MTU. Hence, it is wrong not to consider this octet. 3) Finally, the waiting user tty is not informed about freed space in its send queue. Take at most one packet worth of data out of the DLCI fifo to fix 1). Limit the max user data size per packet to MTU - 1 in case of convergence layer type 2 to leave space for the control signal octet which is added in the later part of the function. This fixes 2). Add tty_port_tty_wakeup() to wake up the user tty if new write space has been made available to fix 3). Fixes: 268e526b935e ("tty/n_gsm: avoid fifo overflow in gsm_dlci_data_outpu= t") Signed-off-by: Daniel Starke Link: https://lore.kernel.org/r/20220701061652.39604-3-daniel.starke@siemen= s.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/tty/n_gsm.c | 74 +++++++++++++++++++++++++-------------------- 1 file changed, 42 insertions(+), 32 deletions(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 9f7a638c6400..a554c22e0ee2 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -886,41 +886,51 @@ static int gsm_dlci_data_output(struct gsm_mux *gsm, = struct gsm_dlci *dlci) { struct gsm_msg *msg; u8 *dp; - int len, total_size, size; - int h =3D dlci->adaption - 1; + int h, len, size; =20 - total_size =3D 0; - while (1) { - len =3D kfifo_len(&dlci->fifo); - if (len =3D=3D 0) - return total_size; - - /* MTU/MRU count only the data bits */ - if (len > gsm->mtu) - len =3D gsm->mtu; - - size =3D len + h; - - msg =3D gsm_data_alloc(gsm, dlci->addr, size, gsm->ftype); - /* FIXME: need a timer or something to kick this so it can't - get stuck with no work outstanding and no buffer free */ - if (msg =3D=3D NULL) - return -ENOMEM; - dp =3D msg->data; - switch (dlci->adaption) { - case 1: /* Unstructured */ - break; - case 2: /* Unstructed with modem bits. - Always one byte as we never send inline break data */ - *dp++ =3D (gsm_encode_modem(dlci) << 1) | EA; - break; - } - WARN_ON(kfifo_out_locked(&dlci->fifo, dp , len, &dlci->lock) !=3D len); - __gsm_data_queue(dlci, msg); - total_size +=3D size; + /* for modem bits without break data */ + h =3D ((dlci->adaption =3D=3D 1) ? 0 : 1); + + len =3D kfifo_len(&dlci->fifo); + if (len =3D=3D 0) + return 0; + + /* MTU/MRU count only the data bits but watch adaption mode */ + if ((len + h) > gsm->mtu) + len =3D gsm->mtu - h; + + size =3D len + h; + + msg =3D gsm_data_alloc(gsm, dlci->addr, size, gsm->ftype); + /* FIXME: need a timer or something to kick this so it can't + * get stuck with no work outstanding and no buffer free + */ + if (!msg) + return -ENOMEM; + dp =3D msg->data; + switch (dlci->adaption) { + case 1: /* Unstructured */ + break; + case 2: /* Unstructured with modem bits. + * Always one byte as we never send inline break data + */ + *dp++ =3D (gsm_encode_modem(dlci) << 1) | EA; + break; + default: + pr_err("%s: unsupported adaption %d\n", __func__, + dlci->adaption); + break; } + + WARN_ON(len !=3D kfifo_out_locked(&dlci->fifo, dp, len, + &dlci->lock)); + + /* Notify upper layer about available send space. */ + tty_port_tty_wakeup(&dlci->port); + + __gsm_data_queue(dlci, msg); /* Bytes of data we used up */ - return total_size; + return size; } =20 /** --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31F8CC00140 for ; Mon, 15 Aug 2022 19:35:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343736AbiHOTfd (ORCPT ); Mon, 15 Aug 2022 15:35:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345112AbiHOT1s (ORCPT ); Mon, 15 Aug 2022 15:27:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 716CE5C379; Mon, 15 Aug 2022 11:43: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 C05B7B8109B; Mon, 15 Aug 2022 18:43:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00F32C433C1; Mon, 15 Aug 2022 18:43:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589014; bh=mpPyCTW7VseZn0zFZNhWYlR9X2WWh6o1zNFb0GoU4+Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g2cSZi4yYUqzcrZsot5uRzWVbfTvLtqK/hNQldFdSRxukLLAXKpxfwU+/qhYyjS1H hPzRULtdZNb+RGV8z83vLoehu1ZGj8+dcmN9zC+d90rLG5iP6wmiiZ18mPZcA77Sob CtxDbTPOSf661GobZ1JavJunWNmuYOWT4yU0gayU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Starke , Sasha Levin Subject: [PATCH 5.15 586/779] tty: n_gsm: fix missing timer to handle stalled links Date: Mon, 15 Aug 2022 20:03:50 +0200 Message-Id: <20220815180402.375556841@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Starke [ Upstream commit c568f7086c6e771c77aad13d727c70ef70e07243 ] The current implementation does not handle the situation that no data is in the internal queue and needs to be sent out while the user tty fifo is full. Add a timer that moves more data from user tty down to the internal queue which is then serialized on the ldisc. This timer is triggered if no data was moved from a user tty to the internal queue within 10 * T1. Fixes: e1eaea46bb40 ("tty: n_gsm line discipline") Signed-off-by: Daniel Starke Link: https://lore.kernel.org/r/20220701061652.39604-4-daniel.starke@siemen= s.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/tty/n_gsm.c | 43 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index a554c22e0ee2..271efa7ae793 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -244,6 +244,7 @@ struct gsm_mux { struct list_head tx_list; /* Pending data packets */ =20 /* Control messages */ + struct timer_list kick_timer; /* Kick TX queuing on timeout */ struct timer_list t2_timer; /* Retransmit timer for commands */ int cretries; /* Command retry counter */ struct gsm_control *pending_cmd;/* Our current pending command */ @@ -850,6 +851,7 @@ static void __gsm_data_queue(struct gsm_dlci *dlci, str= uct gsm_msg *msg) list_add_tail(&msg->list, &gsm->tx_list); gsm->tx_bytes +=3D msg->len; gsm_data_kick(gsm, dlci); + mod_timer(&gsm->kick_timer, jiffies + 10 * gsm->t1 * HZ / 100); } =20 /** @@ -902,9 +904,6 @@ static int gsm_dlci_data_output(struct gsm_mux *gsm, st= ruct gsm_dlci *dlci) size =3D len + h; =20 msg =3D gsm_data_alloc(gsm, dlci->addr, size, gsm->ftype); - /* FIXME: need a timer or something to kick this so it can't - * get stuck with no work outstanding and no buffer free - */ if (!msg) return -ENOMEM; dp =3D msg->data; @@ -981,9 +980,6 @@ static int gsm_dlci_data_output_framed(struct gsm_mux *= gsm, =20 size =3D len + overhead; msg =3D gsm_data_alloc(gsm, dlci->addr, size, gsm->ftype); - - /* FIXME: need a timer or something to kick this so it can't - get stuck with no work outstanding and no buffer free */ if (msg =3D=3D NULL) { skb_queue_tail(&dlci->skb_list, dlci->skb); dlci->skb =3D NULL; @@ -1079,9 +1075,9 @@ static int gsm_dlci_modem_output(struct gsm_mux *gsm,= struct gsm_dlci *dlci, * renegotiate DLCI priorities with optional stuff. Needs optimising. */ =20 -static void gsm_dlci_data_sweep(struct gsm_mux *gsm) +static int gsm_dlci_data_sweep(struct gsm_mux *gsm) { - int len; + int len, ret =3D 0; /* Priority ordering: We should do priority with RR of the groups */ int i =3D 1; =20 @@ -1104,7 +1100,11 @@ static void gsm_dlci_data_sweep(struct gsm_mux *gsm) /* DLCI empty - try the next */ if (len =3D=3D 0) i++; + else + ret++; } + + return ret; } =20 /** @@ -1837,6 +1837,30 @@ static void gsm_dlci_command(struct gsm_dlci *dlci, = const u8 *data, int len) } } =20 +/** + * gsm_kick_timer - transmit if possible + * @t: timer contained in our gsm object + * + * Transmit data from DLCIs if the queue is empty. We can't rely on + * a tty wakeup except when we filled the pipe so we need to fire off + * new data ourselves in other cases. + */ +static void gsm_kick_timer(struct timer_list *t) +{ + struct gsm_mux *gsm =3D from_timer(gsm, t, kick_timer); + unsigned long flags; + int sent =3D 0; + + spin_lock_irqsave(&gsm->tx_lock, flags); + /* If we have nothing running then we need to fire up */ + if (gsm->tx_bytes < TX_THRESH_LO) + sent =3D gsm_dlci_data_sweep(gsm); + spin_unlock_irqrestore(&gsm->tx_lock, flags); + + if (sent && debug & 4) + pr_info("%s TX queue stalled\n", __func__); +} + /* * Allocate/Free DLCI channels */ @@ -2326,6 +2350,7 @@ static void gsm_cleanup_mux(struct gsm_mux *gsm, bool= disc) } =20 /* Finish outstanding timers, making sure they are done */ + del_timer_sync(&gsm->kick_timer); del_timer_sync(&gsm->t2_timer); =20 /* Free up any link layer users and finally the control channel */ @@ -2358,6 +2383,7 @@ static int gsm_activate_mux(struct gsm_mux *gsm) struct gsm_dlci *dlci; int ret; =20 + timer_setup(&gsm->kick_timer, gsm_kick_timer, 0); timer_setup(&gsm->t2_timer, gsm_control_retransmit, 0); init_waitqueue_head(&gsm->event); spin_lock_init(&gsm->control_lock); @@ -2762,6 +2788,7 @@ static int gsmld_open(struct tty_struct *tty) =20 gsmld_attach_gsm(tty, gsm); =20 + timer_setup(&gsm->kick_timer, gsm_kick_timer, 0); timer_setup(&gsm->t2_timer, gsm_control_retransmit, 0); =20 return 0; --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC5D9C25B0E for ; Mon, 15 Aug 2022 19:36:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343806AbiHOTfr (ORCPT ); Mon, 15 Aug 2022 15:35:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345179AbiHOT1y (ORCPT ); Mon, 15 Aug 2022 15:27: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 C719B5C9D7; Mon, 15 Aug 2022 11:43: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 5B529B81082; Mon, 15 Aug 2022 18:43:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0FC7C433D6; Mon, 15 Aug 2022 18:43:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589021; bh=MLtZtshAMiBLV7e0brGdDAHW+5VrH3xIHxwwvHxraHQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ttEQ3ZQqCxRrGSI+998vb977brIWSh02BN838Zb67cx1GMlVLKgQeU1ejJdArOj/d 95FXXFZSnqWeRs0bKEIrTE9w9sg4V7ek7mTthGUCLNWRigJq+vtfL505lmensHo2+h sFvTR4LgoTV7jq4PBX7NNnOVB2j0WT1IwzPGGmbo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Starke , Sasha Levin Subject: [PATCH 5.15 587/779] tty: n_gsm: fix non flow control frames during mux flow off Date: Mon, 15 Aug 2022 20:03:51 +0200 Message-Id: <20220815180402.417130818@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Starke [ Upstream commit bec0224816d19abe4fe503586d16d51890540615 ] n_gsm is based on the 3GPP 07.010 and its newer version is the 3GPP 27.010. See https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDeta= ils.aspx?specificationId=3D1516 The changes from 07.010 to 27.010 are non-functional. Therefore, I refer to the newer 27.010 here. Chapter 5.4.6.3.6 states that FCoff stops the transmission on all channels except the control channel. This is already implemented in gsm_data_kick(). However, chapter 5.4.8.1 explains that this shall result in the same behavior as software flow control on the ldisc in advanced option mode. That means only flow control frames shall be sent during flow off. The current implementation does not consider this case. Change gsm_data_kick() to send only flow control frames if constipated to abide the standard. gsm_read_ea_val() and gsm_is_flow_ctrl_msg() are introduced as helper functions for this. It is planned to use gsm_read_ea_val() in later code cleanups for other functions, too. Fixes: c01af4fec2c8 ("n_gsm : Flow control handling in Mux driver") Signed-off-by: Daniel Starke Link: https://lore.kernel.org/r/20220701061652.39604-5-daniel.starke@siemen= s.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/tty/n_gsm.c | 54 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 53 insertions(+), 1 deletion(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 271efa7ae793..56a3466acfc6 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -425,6 +425,27 @@ static int gsm_read_ea(unsigned int *val, u8 c) return c & EA; } =20 +/** + * gsm_read_ea_val - read a value until EA + * @val: variable holding value + * @data: buffer of data + * @dlen: length of data + * + * Processes an EA value. Updates the passed variable and + * returns the processed data length. + */ +static unsigned int gsm_read_ea_val(unsigned int *val, const u8 *data, int= dlen) +{ + unsigned int len =3D 0; + + for (; dlen > 0; dlen--) { + len++; + if (gsm_read_ea(val, *data++)) + break; + } + return len; +} + /** * gsm_encode_modem - encode modem data bits * @dlci: DLCI to encode from @@ -746,6 +767,37 @@ static struct gsm_msg *gsm_data_alloc(struct gsm_mux *= gsm, u8 addr, int len, return m; } =20 +/** + * gsm_is_flow_ctrl_msg - checks if flow control message + * @msg: message to check + * + * Returns true if the given message is a flow control command of the + * control channel. False is returned in any other case. + */ +static bool gsm_is_flow_ctrl_msg(struct gsm_msg *msg) +{ + unsigned int cmd; + + if (msg->addr > 0) + return false; + + switch (msg->ctrl & ~PF) { + case UI: + case UIH: + cmd =3D 0; + if (gsm_read_ea_val(&cmd, msg->data + 2, msg->len - 2) < 1) + break; + switch (cmd & ~PF) { + case CMD_FCOFF: + case CMD_FCON: + return true; + } + break; + } + + return false; +} + /** * gsm_data_kick - poke the queue * @gsm: GSM Mux @@ -765,7 +817,7 @@ static void gsm_data_kick(struct gsm_mux *gsm, struct g= sm_dlci *dlci) int len; =20 list_for_each_entry_safe(msg, nmsg, &gsm->tx_list, list) { - if (gsm->constipated && msg->addr) + if (gsm->constipated && !gsm_is_flow_ctrl_msg(msg)) continue; if (gsm->encoding !=3D 0) { gsm->txframe[0] =3D GSM1_SOF; --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D995C00140 for ; Mon, 15 Aug 2022 19:36:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343768AbiHOTfk (ORCPT ); Mon, 15 Aug 2022 15:35:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345180AbiHOT1y (ORCPT ); Mon, 15 Aug 2022 15:27:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA9CB2B60C; Mon, 15 Aug 2022 11:43: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 C301F611DD; Mon, 15 Aug 2022 18:43:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B16E5C433C1; Mon, 15 Aug 2022 18:43:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589024; bh=CEMIqF+IphZQ8hodhebu4GIFclW1IydghT4k3XvrY7s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T9HM2ND5VwNdbhSRByB8aXr09NAnVntA11X2luCuVAfq/21UriZ4cFqegLuNupgvu aOAeMKKnldC1vlArh3BK8QyzTJLcKU8YFE4skzBukcHH/Ilrgi6YDAADG7r4Q9b1R4 idmathudNdC+GA/bcPiO86NwoHUvUo285DTvrSuE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Starke , Sasha Levin Subject: [PATCH 5.15 588/779] tty: n_gsm: fix packet re-transmission without open control channel Date: Mon, 15 Aug 2022 20:03:52 +0200 Message-Id: <20220815180402.463312290@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Starke [ Upstream commit 4fae831b3a71fc5a44cc5c7d0b8c1267ee7659f5 ] In the current implementation control packets are re-transmitted even if the control channel closed down during T2. This is wrong. Check whether the control channel is open before re-transmitting any packets. Note that control channel open/close is handled by T1 and not T2 and remains unaffected by this. Fixes: e1eaea46bb40 ("tty: n_gsm line discipline") Signed-off-by: Daniel Starke Link: https://lore.kernel.org/r/20220701061652.39604-7-daniel.starke@siemen= s.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/tty/n_gsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 56a3466acfc6..3f65990fc959 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -1546,7 +1546,7 @@ static void gsm_control_retransmit(struct timer_list = *t) spin_lock_irqsave(&gsm->control_lock, flags); ctrl =3D gsm->pending_cmd; if (ctrl) { - if (gsm->cretries =3D=3D 0) { + if (gsm->cretries =3D=3D 0 || !gsm->dlci[0] || gsm->dlci[0]->dead) { gsm->pending_cmd =3D NULL; ctrl->error =3D -ETIMEDOUT; ctrl->done =3D 1; --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB46DC3F6B0 for ; Mon, 15 Aug 2022 19:36:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343858AbiHOTfu (ORCPT ); Mon, 15 Aug 2022 15:35:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241621AbiHOT2N (ORCPT ); Mon, 15 Aug 2022 15:28:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B7905D0C4; Mon, 15 Aug 2022 11:43: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 2C3BB61120; Mon, 15 Aug 2022 18:43:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19EE8C433B5; Mon, 15 Aug 2022 18:43:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589027; bh=y05tG2XekrDOE2v1i1ySAuL9G93xiQJcKq6uz3F+EMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KwFVr/XB7Kgqt4wbEQat2Zzq9oqbdYDGCw9cfrKzEdgn7PnmG+g7XIVJ/K4+ANmZB YCF3msLFShIiFubIdOF4ZoSUlIwKfAtZ7OsUCFiDQZlZb2H5ygqg8TKFKaBhmZm9sr apr2pHbVtLzrZw6xyO16tNPA62LF1NONmJcscVjI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Starke , Sasha Levin Subject: [PATCH 5.15 589/779] tty: n_gsm: fix race condition in gsmld_write() Date: Mon, 15 Aug 2022 20:03:53 +0200 Message-Id: <20220815180402.512558272@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Starke [ Upstream commit 32dd59f96924f45e33bc79854f7a00679c0fa28e ] The function may be used by the user directly and also by the n_gsm internal functions. They can lead into a race condition which results in interleaved frames if both are writing at the same time. The receiving side is not able to decode those interleaved frames correctly. Add a lock around the low side tty write to avoid race conditions and frame interleaving between user originated writes and n_gsm writes. Fixes: e1eaea46bb40 ("tty: n_gsm line discipline") Signed-off-by: Daniel Starke Link: https://lore.kernel.org/r/20220701061652.39604-9-daniel.starke@siemen= s.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/tty/n_gsm.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 3f65990fc959..23fcb34240ac 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -2911,11 +2911,24 @@ static ssize_t gsmld_read(struct tty_struct *tty, s= truct file *file, static ssize_t gsmld_write(struct tty_struct *tty, struct file *file, const unsigned char *buf, size_t nr) { - int space =3D tty_write_room(tty); + struct gsm_mux *gsm =3D tty->disc_data; + unsigned long flags; + int space; + int ret; + + if (!gsm) + return -ENODEV; + + ret =3D -ENOBUFS; + spin_lock_irqsave(&gsm->tx_lock, flags); + space =3D tty_write_room(tty); if (space >=3D nr) - return tty->ops->write(tty, buf, nr); - set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); - return -ENOBUFS; + ret =3D tty->ops->write(tty, buf, nr); + else + set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags); + spin_unlock_irqrestore(&gsm->tx_lock, flags); + + return ret; } =20 /** --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06D55C25B08 for ; Mon, 15 Aug 2022 19:36:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343920AbiHOTfz (ORCPT ); Mon, 15 Aug 2022 15:35:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244222AbiHOT2T (ORCPT ); Mon, 15 Aug 2022 15:28:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C384A5D0CF; Mon, 15 Aug 2022 11:43: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 392D7611E7; Mon, 15 Aug 2022 18:43:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B929C433D6; Mon, 15 Aug 2022 18:43:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589030; bh=DQYpAKgxnwyRGtLDlzQC5Y75d+Ggep7f0vdNwu/fXAw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FdUwHOY61+PEYG7wzMlImxL1maXq+mc99hUvGTsgadK3zvuJzKfausZ1r46YSREhY B1gdi9WOJN4ypfg4dYeUxjW4E1EblqzCnI3cavn0xk83ZRu2nuzpaRNSVG8Un44p9t qaagi0Hb8emC2TSU2fGLPSvab2LYivhW6siEehnQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Starke , Sasha Levin Subject: [PATCH 5.15 590/779] tty: n_gsm: fix resource allocation order in gsm_activate_mux() Date: Mon, 15 Aug 2022 20:03:54 +0200 Message-Id: <20220815180402.560197049@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Starke [ Upstream commit 7349660438603ed19282e75949561406531785a5 ] Within gsm_activate_mux() all timers and locks are initiated before the actual resource for the control channel is allocated. This can lead to race conditions. Allocate the control channel DLCI object first to avoid race conditions. Fixes: e1eaea46bb40 ("tty: n_gsm line discipline") Signed-off-by: Daniel Starke Link: https://lore.kernel.org/r/20220701122332.2039-2-daniel.starke@siemens= .com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/tty/n_gsm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 23fcb34240ac..b5ce10b0656f 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -2435,6 +2435,10 @@ static int gsm_activate_mux(struct gsm_mux *gsm) struct gsm_dlci *dlci; int ret; =20 + dlci =3D gsm_dlci_alloc(gsm, 0); + if (dlci =3D=3D NULL) + return -ENOMEM; + timer_setup(&gsm->kick_timer, gsm_kick_timer, 0); timer_setup(&gsm->t2_timer, gsm_control_retransmit, 0); init_waitqueue_head(&gsm->event); @@ -2450,9 +2454,6 @@ static int gsm_activate_mux(struct gsm_mux *gsm) if (ret) return ret; =20 - dlci =3D gsm_dlci_alloc(gsm, 0); - if (dlci =3D=3D NULL) - return -ENOMEM; gsm->has_devices =3D true; gsm->dead =3D false; /* Tty opens are now permissible */ return 0; --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25986C282E7 for ; Mon, 15 Aug 2022 19:36:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343982AbiHOTgB (ORCPT ); Mon, 15 Aug 2022 15:36:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244443AbiHOT2q (ORCPT ); Mon, 15 Aug 2022 15:28:46 -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 F2F1C5D0C6; Mon, 15 Aug 2022 11:43: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 sin.source.kernel.org (Postfix) with ESMTPS id 5C6C1CE1273; Mon, 15 Aug 2022 18:43:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55B6BC433D6; Mon, 15 Aug 2022 18:43:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589033; bh=XodYGOdnVgsklnX4DOkSbhBIo4TlJdS6kPEufjU+TnU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kTYredGdHAx/wIJ7Pq37zkmB76564zN1/q7Uxm7IJM/GdvbSH/nkqSRCQb4sg8GBU mL82fAw+pPMgFEE44KyHEx+YizPr3/c8Hi4mA5eHO6NaP4ThlclGl7WXPfbD4n0lyF bmC0tOiFtfXnFI9oELVUpd7p2iAZ2+2vN3DVWBrI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Mark Brown , Sasha Levin , Miaoqian Lin Subject: [PATCH 5.15 591/779] ASoC: qcom: Fix missing of_node_put() in asoc_qcom_lpass_cpu_platform_probe() Date: Mon, 15 Aug 2022 20:03:55 +0200 Message-Id: <20220815180402.591391486@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit f507c0c67dac57d2bcd5dcae4b6139b0305d8957 ] We should call of_node_put() for the reference 'dsp_of_node' returned by of_parse_phandle() which will increase the refcount. Fixes: 9bae4880acee ("ASoC: qcom: move ipq806x specific bits out of lpass d= river.") Co-authored-by: Miaoqian Lin Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220702020109.263980-1-windhl@126.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- sound/soc/qcom/lpass-cpu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c index 3bd9eb3cc688..5e89d280e355 100644 --- a/sound/soc/qcom/lpass-cpu.c +++ b/sound/soc/qcom/lpass-cpu.c @@ -880,6 +880,7 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_= device *pdev) dsp_of_node =3D of_parse_phandle(pdev->dev.of_node, "qcom,adsp", 0); if (dsp_of_node) { dev_err(dev, "DSP exists and holds audio resources\n"); + of_node_put(dsp_of_node); return -EBUSY; } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20469C00140 for ; Mon, 15 Aug 2022 19:40:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344335AbiHOTkH (ORCPT ); Mon, 15 Aug 2022 15:40:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344437AbiHOTgk (ORCPT ); Mon, 15 Aug 2022 15:36:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A615B30F6B; Mon, 15 Aug 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 514D5B81071; Mon, 15 Aug 2022 18:46:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACD77C433C1; Mon, 15 Aug 2022 18:46:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589165; bh=NQ/7lkw2mnIkkDW+T812q2jdHGkwZYAPQVpi7RPSVnU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xhvZxD6JBY4IRjD7gSluDFw0MGyDBvRYoWzr2ATCj5LCqTa3tdN3b6WhWwJzlM2jS bX2Jesw0afpIV/pofEJsl8H9baGSiNT3RyCre26OdFGBfwEnRzo8RH6WGyLCH7pwre hHyfZf00GtFO4jKHYqzdvUwT0fgsWcqlqMkGgVMc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shengjiu Wang , Mark Brown , Sasha Levin Subject: [PATCH 5.15 592/779] ASoC: imx-card: Fix DSD/PDM mclk frequency Date: Mon, 15 Aug 2022 20:03:56 +0200 Message-Id: <20220815180402.631828875@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shengjiu Wang [ Upstream commit c0fabd12a8570cb932f13d9388f3d887ad44369b ] The DSD/PDM rate not only DSD64/128/256/512, which are the multiple rate of 44.1kHz, but also support the multiple rate of 8kHz, so can't force all mclk frequency to be 22579200Hz, need to assign the frequency according to rate. Fixes: aa736700f42f ("ASoC: imx-card: Add imx-card machine driver") Signed-off-by: Shengjiu Wang Link: https://lore.kernel.org/r/1657100575-8261-1-git-send-email-shengjiu.w= ang@nxp.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- sound/soc/fsl/imx-card.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/sound/soc/fsl/imx-card.c b/sound/soc/fsl/imx-card.c index 55bc1bb0dbbd..b28b30c69a3f 100644 --- a/sound/soc/fsl/imx-card.c +++ b/sound/soc/fsl/imx-card.c @@ -17,6 +17,9 @@ =20 #include "fsl_sai.h" =20 +#define IMX_CARD_MCLK_22P5792MHZ 22579200 +#define IMX_CARD_MCLK_24P576MHZ 24576000 + enum codec_type { CODEC_DUMMY =3D 0, CODEC_AK5558 =3D 1, @@ -353,9 +356,14 @@ static int imx_aif_hw_params(struct snd_pcm_substream = *substream, mclk_freq =3D akcodec_get_mclk_rate(substream, params, slots, slot_width= ); else mclk_freq =3D params_rate(params) * slots * slot_width; - /* Use the maximum freq from DSD512 (512*44100 =3D 22579200) */ - if (format_is_dsd(params)) - mclk_freq =3D 22579200; + + if (format_is_dsd(params)) { + /* Use the maximum freq from DSD512 (512*44100 =3D 22579200) */ + if (!(params_rate(params) % 11025)) + mclk_freq =3D IMX_CARD_MCLK_22P5792MHZ; + else + mclk_freq =3D IMX_CARD_MCLK_24P576MHZ; + } =20 ret =3D snd_soc_dai_set_sysclk(cpu_dai, link_data->cpu_sysclk_id, mclk_fr= eq, SND_SOC_CLOCK_OUT); --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D412CC2BBC5 for ; Mon, 15 Aug 2022 19:36:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344388AbiHOTgh (ORCPT ); Mon, 15 Aug 2022 15:36:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343984AbiHOTbD (ORCPT ); Mon, 15 Aug 2022 15:31: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 7B9015FADF; Mon, 15 Aug 2022 11:44: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 B820DB81081; Mon, 15 Aug 2022 18:44:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9D67C433C1; Mon, 15 Aug 2022 18:44:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589060; bh=nB3DazRTjFbJzl5tmLUkm9iShBqPVj9wrCAhLar+mp8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qi54lZTd1RY9SkXhw5XMIqCi9JBStbL7RxmPfIZ+9n8AJvPgK6+O1sRjKNR0cm5d/ wbSufnp3v4CPkn0aZQXXkRJYihEPYc1jyvDKN/Sy0MRcj6GsIqfV/XcxQpb8+Llp2F oQ2CRV3U+NJSeEwpXd4KaKuJDzVO3zbeufjMumHI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sireesh Kodali , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 593/779] remoteproc: qcom: wcnss: Fix handling of IRQs Date: Mon, 15 Aug 2022 20:03:57 +0200 Message-Id: <20220815180402.684575532@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sireesh Kodali [ Upstream commit bed0adac1ded4cb486ba19a3a7e730fbd9a1c9c6 ] The wcnss_get_irq function is expected to return a value > 0 in the event that an IRQ is succssfully obtained, but it instead returns 0. This causes the stop and ready IRQs to never actually be used despite being defined in the device-tree. This patch fixes that. Fixes: aed361adca9f ("remoteproc: qcom: Introduce WCNSS peripheral image lo= ader") Signed-off-by: Sireesh Kodali Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220526141740.15834-2-sireeshkodali1@gmail= .com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/remoteproc/qcom_wcnss.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/remoteproc/qcom_wcnss.c b/drivers/remoteproc/qcom_wcns= s.c index b17742eac9ff..97a0c0dc4c77 100644 --- a/drivers/remoteproc/qcom_wcnss.c +++ b/drivers/remoteproc/qcom_wcnss.c @@ -468,6 +468,7 @@ static int wcnss_request_irq(struct qcom_wcnss *wcnss, irq_handler_t thread_fn) { int ret; + int irq_number; =20 ret =3D platform_get_irq_byname(pdev, name); if (ret < 0 && optional) { @@ -478,14 +479,19 @@ static int wcnss_request_irq(struct qcom_wcnss *wcnss, return ret; } =20 + irq_number =3D ret; + ret =3D devm_request_threaded_irq(&pdev->dev, ret, NULL, thread_fn, IRQF_TRIGGER_RISING | IRQF_ONESHOT, "wcnss", wcnss); - if (ret) + if (ret) { dev_err(&pdev->dev, "request %s IRQ failed\n", name); + return ret; + } =20 - return ret; + /* Return the IRQ number if the IRQ was successfully acquired */ + return irq_number; } =20 static int wcnss_alloc_memory_region(struct qcom_wcnss *wcnss) --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E053C00140 for ; Mon, 15 Aug 2022 19:37:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343529AbiHOTht (ORCPT ); Mon, 15 Aug 2022 15:37:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344827AbiHOTbs (ORCPT ); Mon, 15 Aug 2022 15:31: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 7AEE561134; Mon, 15 Aug 2022 11:44: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 0F4E9611DD; Mon, 15 Aug 2022 18:44:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 03E25C433C1; Mon, 15 Aug 2022 18:44:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589095; bh=+qo1pC4Ttl+/9j8G+c7N7G61muT841xoBx/FamNTO98=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p62m7FXkV8e/HiThWm4nOEh5/gcP/aYRr6+rdBCC1zG/L/Q0rs4iDMDw8H2Mmu6pI iDHPKNi5ctJoXg8nzrANcLE1l2lzDCTIiJS0Hh8GowPTMAiGi079qB1RsIpYU0Fkp4 P5r1hpwl/srCEg3Nzok/tZpH9EQR3mUZ+v7Dhc4k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Farman , Matthew Rosato , Alex Williamson , Sasha Levin Subject: [PATCH 5.15 594/779] vfio/ccw: Do not change FSM state in subchannel event Date: Mon, 15 Aug 2022 20:03:58 +0200 Message-Id: <20220815180402.727715424@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Farman [ Upstream commit cffcc109fd682075dee79bade3d60a07152a8fd1 ] The routine vfio_ccw_sch_event() is tasked with handling subchannel events, specifically machine checks, on behalf of vfio-ccw. It correctly calls cio_update_schib(), and if that fails (meaning the subchannel is gone) it makes an FSM event call to mark the subchannel Not Operational. If that worked, however, then it decides that if the FSM state was already Not Operational (implying the subchannel just came back), then it should simply change the FSM to partially- or fully-open. Remove this trickery, since a subchannel returning will require more probing than simply "oh all is well again" to ensure it works correctly. Fixes: bbe37e4cb8970 ("vfio: ccw: introduce a finite state machine") Signed-off-by: Eric Farman Reviewed-by: Matthew Rosato Link: https://lore.kernel.org/r/20220707135737.720765-4-farman@linux.ibm.com Signed-off-by: Alex Williamson Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/s390/cio/vfio_ccw_drv.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/drivers/s390/cio/vfio_ccw_drv.c b/drivers/s390/cio/vfio_ccw_dr= v.c index 76099bcb765b..b9091e22ca57 100644 --- a/drivers/s390/cio/vfio_ccw_drv.c +++ b/drivers/s390/cio/vfio_ccw_drv.c @@ -287,19 +287,11 @@ static int vfio_ccw_sch_event(struct subchannel *sch,= int process) if (work_pending(&sch->todo_work)) goto out_unlock; =20 - if (cio_update_schib(sch)) { - vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_NOT_OPER); - rc =3D 0; - goto out_unlock; - } - - private =3D dev_get_drvdata(&sch->dev); - if (private->state =3D=3D VFIO_CCW_STATE_NOT_OPER) { - private->state =3D private->mdev ? VFIO_CCW_STATE_IDLE : - VFIO_CCW_STATE_STANDBY; - } rc =3D 0; =20 + if (cio_update_schib(sch)) + vfio_ccw_fsm_event(private, VFIO_CCW_EVENT_NOT_OPER); + out_unlock: spin_unlock_irqrestore(sch->lock, flags); =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D918C00140 for ; Mon, 15 Aug 2022 19:38:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245755AbiHOTiy (ORCPT ); Mon, 15 Aug 2022 15:38:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343535AbiHOTfQ (ORCPT ); Mon, 15 Aug 2022 15:35:16 -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 6A3F1D56; Mon, 15 Aug 2022 11:45: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 C59D1B81084; Mon, 15 Aug 2022 18:45:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECE7FC433D6; Mon, 15 Aug 2022 18:45:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589129; bh=WXXzMF4sMqYMGLnLltrAPopaHu8WYQB8WVsEjuffUYk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m2XOEgfLfO0ByEUuP/4nKGdyRtlc/0Aw9sUtkDLfEIM3uE5yBOelkrDOKXaDQG2tg d2kKYmity0BiMwnUJpQ5KFJdr7yFns9kkI+TEvF9bRKsbPy+rCRDSdDgKtLPbVc1aQ YaEzmS6C8W4hObQjlS0dUFgj9ADjA09Q6Ls6k72Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Sasha Levin Subject: [PATCH 5.15 595/779] serial: 8250_fsl: Dont report FE, PE and OE twice Date: Mon, 15 Aug 2022 20:03:59 +0200 Message-Id: <20220815180402.779700090@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Uwe Kleine-K=C3=B6nig [ Upstream commit 9d3aaceb73acadf134596a2f8db9c451c1332d3d ] Some Freescale 8250 implementations have the problem that a single long break results in one irq per character frame time. The code in fsl8250_handle_irq() that is supposed to handle that uses the BI bit in lsr_saved_flags to detect such a situation and then skip the second received character. However it also stores other error bits and so after a single frame error the character received in the next irq handling is passed to the upper layer with a frame error, too. So after a spike on the data line (which is correctly recognized as a frame error) the following valid character is thrown away, because the driver reports a frame error for that one, too. To weaken this problem restrict saving LSR to only the BI bit. Note however that the handling is still broken: - lsr_saved_flags is updated using orig_lsr which is the LSR content for the first received char, but there might be more in the FIFO, so a character is thrown away that is received later and not necessarily the one following the break. - The doubled break might be the 2nd and 3rd char in the FIFO, so the workaround doesn't catch these, because serial8250_rx_chars() doesn't handle the workaround. - lsr_saved_flags might have set UART_LSR_BI at the entry of fsl8250_handle_irq() which doesn't originate from fsl8250_handle_irq()'s "up->lsr_saved_flags |=3D orig_lsr & UART_LSR_BI;" but from e.g. from serial8250_tx_empty(). - For a long or a short break this isn't about two characters, but more or only a single one. Fixes: 9deaa53ac7fa ("serial: add irq handler for Freescale 16550 errata.") Acked-by: Ilpo J=C3=A4rvinen Signed-off-by: Uwe Kleine-K=C3=B6nig Link: https://lore.kernel.org/r/20220704085119.55900-1-u.kleine-koenig@peng= utronix.de Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/tty/serial/8250/8250_fsl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/serial/8250/8250_fsl.c b/drivers/tty/serial/8250/8= 250_fsl.c index fc65a2293ce9..af74f82ad782 100644 --- a/drivers/tty/serial/8250/8250_fsl.c +++ b/drivers/tty/serial/8250/8250_fsl.c @@ -81,7 +81,7 @@ int fsl8250_handle_irq(struct uart_port *port) if ((lsr & UART_LSR_THRE) && (up->ier & UART_IER_THRI)) serial8250_tx_chars(up); =20 - up->lsr_saved_flags =3D orig_lsr; + up->lsr_saved_flags |=3D orig_lsr & UART_LSR_BI; =20 uart_unlock_and_check_sysrq_irqrestore(&up->port, flags); =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 715C5C00140 for ; Mon, 15 Aug 2022 19:39:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344237AbiHOTjQ (ORCPT ); Mon, 15 Aug 2022 15:39:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344267AbiHOTg1 (ORCPT ); Mon, 15 Aug 2022 15:36:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C41402F674; Mon, 15 Aug 2022 11:45: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 2E8D9611AA; Mon, 15 Aug 2022 18:45:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02973C433D6; Mon, 15 Aug 2022 18:45:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589145; bh=KIjTpLMYMMESOEUkLCXFuygfVJV54M6nmV1h3uM4cDc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EQ6/YU7PQ/FtJTvK6xHYbRiwaqxgsK8f1qu3kCUaqiyg0cdraTBLAHII7JqHph5Zm ZXybcTZ0bKfGGEbw6wbIDClWzQAg99S2KbDNsg0bYuQFkoUwiMbdDYT8VGeSUJe5ga vn14RWiRqO4LSFsgMt72FYiIekx35tKXyTdnHX2I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Starke , Sasha Levin Subject: [PATCH 5.15 596/779] tty: n_gsm: fix wrong T1 retry count handling Date: Mon, 15 Aug 2022 20:04:00 +0200 Message-Id: <20220815180402.832791565@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Starke [ Upstream commit f30e10caa80aa1f35508bc17fc302dbbde9a833c ] n_gsm is based on the 3GPP 07.010 and its newer version is the 3GPP 27.010. See https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDeta= ils.aspx?specificationId=3D1516 The changes from 07.010 to 27.010 are non-functional. Therefore, I refer to the newer 27.010 here. Chapter 5.7.3 states that the valid range for the maximum number of retransmissions (N2) is from 0 to 255 (both including). gsm_dlci_t1() handles this number incorrectly by performing N2 - 1 retransmission attempts. Setting N2 to zero results in more than 255 retransmission attempts. Fix gsm_dlci_t1() to comply with 3GPP 27.010. Fixes: e1eaea46bb40 ("tty: n_gsm line discipline") Signed-off-by: Daniel Starke Link: https://lore.kernel.org/r/20220707113223.3685-1-daniel.starke@siemens= .com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/tty/n_gsm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index b5ce10b0656f..35504e7e6a35 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -1711,8 +1711,8 @@ static void gsm_dlci_t1(struct timer_list *t) =20 switch (dlci->state) { case DLCI_OPENING: - dlci->retries--; if (dlci->retries) { + dlci->retries--; gsm_command(dlci->gsm, dlci->addr, SABM|PF); mod_timer(&dlci->t1, jiffies + gsm->t1 * HZ / 100); } else if (!dlci->addr && gsm->control =3D=3D (DM | PF)) { @@ -1727,8 +1727,8 @@ static void gsm_dlci_t1(struct timer_list *t) =20 break; case DLCI_CLOSING: - dlci->retries--; if (dlci->retries) { + dlci->retries--; gsm_command(dlci->gsm, dlci->addr, DISC|PF); mod_timer(&dlci->t1, jiffies + gsm->t1 * HZ / 100); } else --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 372C3C25B0E for ; Mon, 15 Aug 2022 19:39:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344249AbiHOTjT (ORCPT ); Mon, 15 Aug 2022 15:39:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344292AbiHOTg3 (ORCPT ); Mon, 15 Aug 2022 15:36:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 33A912FFEF; Mon, 15 Aug 2022 11:45: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 1CE9E61124; Mon, 15 Aug 2022 18:45:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1DD2FC433C1; Mon, 15 Aug 2022 18:45:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589148; bh=FpEssARrHd+5ZVfgg7cLzg1C9xRJKUF7HbOY7INY68k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kXqlbTbQl5C2zBZ6XSt/evvb4oJLHedJh4+eMQMV3Vor/CsJ8fhQWq7+im84W+WGs qLY1PM0CkE4vqkwWQqeyRf2nh728AWTWZA1ENty53xXlUoS/InVbVm/wC+zP8L27dI RtoEyq6lCSzoCoEFvDUgpsysZVg9RSu6gy5YU5+w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Starke , Sasha Levin Subject: [PATCH 5.15 597/779] tty: n_gsm: fix DM command Date: Mon, 15 Aug 2022 20:04:01 +0200 Message-Id: <20220815180402.873018444@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Starke [ Upstream commit 18a948c7d90995d127785e308fa7b701df4c499f ] n_gsm is based on the 3GPP 07.010 and its newer version is the 3GPP 27.010. See https://portal.3gpp.org/desktopmodules/Specifications/SpecificationDeta= ils.aspx?specificationId=3D1516 The changes from 07.010 to 27.010 are non-functional. Therefore, I refer to the newer 27.010 here. Chapter 5.3.3 defines the DM response. There exists no DM command. However, the current implementation incorrectly sends DM as command in case of unexpected UIH frames in gsm_queue(). Correct this behavior by always sending DM as response. Fixes: e1eaea46bb40 ("tty: n_gsm line discipline") Signed-off-by: Daniel Starke Link: https://lore.kernel.org/r/20220707113223.3685-2-daniel.starke@siemens= .com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/tty/n_gsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 35504e7e6a35..7a82fff7f5fe 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -2148,7 +2148,7 @@ static void gsm_queue(struct gsm_mux *gsm) goto invalid; #endif if (dlci =3D=3D NULL || dlci->state !=3D DLCI_OPEN) { - gsm_command(gsm, address, DM|PF); + gsm_response(gsm, address, DM|PF); return; } dlci->data(dlci, gsm->buf, gsm->len); --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B17ADC3F6B0 for ; Mon, 15 Aug 2022 19:39:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344263AbiHOTjW (ORCPT ); Mon, 15 Aug 2022 15:39:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344295AbiHOTg3 (ORCPT ); Mon, 15 Aug 2022 15:36: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 091AC30544; Mon, 15 Aug 2022 11:45:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 52779611C1; Mon, 15 Aug 2022 18:45:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22483C433D6; Mon, 15 Aug 2022 18:45:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589151; bh=7NiuDdZp+VFXZf96F2eqTvZlHVtKr2r82h+BlquUbbE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y76iTdc9trS6YJjX2GuHS4DngfoQ8q/5hnV5RaeK5xlSz+qaMZH9swm5iu+YCGEZJ u5rI40gRqd1sncZU6yEZl10myNdythdzvnV+lF0i3tDlyrhireNmqEXYN7zlQvPI7Q Umrr+Msdfh1KvkRwAMmGSApZfoiWK2883cIzzic4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Starke , Sasha Levin Subject: [PATCH 5.15 598/779] tty: n_gsm: fix missing corner cases in gsmld_poll() Date: Mon, 15 Aug 2022 20:04:02 +0200 Message-Id: <20220815180402.919621462@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Starke [ Upstream commit 7e5b4322cde067e1d0f1bf8f490e93f664a7c843 ] gsmld_poll() currently fails to handle the following corner cases correctly: - remote party closed the associated tty Add the missing checks and map those to EPOLLHUP. Reorder the checks to group them by their reaction. Fixes: e1eaea46bb40 ("tty: n_gsm line discipline") Signed-off-by: Daniel Starke Link: https://lore.kernel.org/r/20220707113223.3685-4-daniel.starke@siemens= .com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/tty/n_gsm.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/tty/n_gsm.c b/drivers/tty/n_gsm.c index 7a82fff7f5fe..b89655f585f1 100644 --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -2954,12 +2954,15 @@ static __poll_t gsmld_poll(struct tty_struct *tty, = struct file *file, =20 poll_wait(file, &tty->read_wait, wait); poll_wait(file, &tty->write_wait, wait); + + if (gsm->dead) + mask |=3D EPOLLHUP; if (tty_hung_up_p(file)) mask |=3D EPOLLHUP; + if (test_bit(TTY_OTHER_CLOSED, &tty->flags)) + mask |=3D EPOLLHUP; if (!tty_is_writelocked(tty) && tty_write_room(tty) > 0) mask |=3D EPOLLOUT | EPOLLWRNORM; - if (gsm->dead) - mask |=3D EPOLLHUP; return mask; } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25F50C25B08 for ; Mon, 15 Aug 2022 19:39:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344289AbiHOTji (ORCPT ); Mon, 15 Aug 2022 15:39:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344344AbiHOTgf (ORCPT ); Mon, 15 Aug 2022 15:36:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 811CC642E3; Mon, 15 Aug 2022 11:45: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 73100611EF; Mon, 15 Aug 2022 18:45:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60131C433C1; Mon, 15 Aug 2022 18:45:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589154; bh=qV18CXrqDsPNUqyyYXpbc7vK2XRoYEx8HCVgIpmxHzs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iyiik0wiZaOIDPtmZkWwzVDpiwkhY0nTpdFg+peaLCiO76vNhCnVW84ipjP9fd7Oq gtSTiF4/78P3ETVJVGmWNoSgMTvuFW0MhbguI4iNZ6eG5ZzhGQrOzf/I2AwMPrSfkf j7cT0q8/7516NjxAlMXmS0ERotObBEcvueEuVPmQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Greg Ungerer , Serge Semin , Florian Fainelli , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.15 599/779] MIPS: vdso: Utilize __pa() for gic_pfn Date: Mon, 15 Aug 2022 20:04:03 +0200 Message-Id: <20220815180402.958097458@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Fainelli [ Upstream commit 8baa65126e19af5ee9f3c07e7bb53da41c39e4b1 ] The GIC user offset is mapped into every process' virtual address and is therefore part of the hot-path of arch_setup_additional_pages(). Utilize __pa() such that we are more optimal even when CONFIG_DEBUG_VIRTUAL is enabled, and while at it utilize PFN_DOWN() instead of open-coding the right shift by PAGE_SHIFT. Reported-by: Greg Ungerer Suggested-by: Serge Semin Fixes: dfad83cb7193 ("MIPS: Add support for CONFIG_DEBUG_VIRTUAL") Signed-off-by: Florian Fainelli Acked-by: Greg Ungerer Tested-by: Greg Ungerer Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/mips/kernel/vdso.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/mips/kernel/vdso.c b/arch/mips/kernel/vdso.c index 3d0cf471f2fe..b2cc2c2dd4bf 100644 --- a/arch/mips/kernel/vdso.c +++ b/arch/mips/kernel/vdso.c @@ -159,7 +159,7 @@ int arch_setup_additional_pages(struct linux_binprm *bp= rm, int uses_interp) /* Map GIC user page. */ if (gic_size) { gic_base =3D (unsigned long)mips_gic_base + MIPS_GIC_USER_OFS; - gic_pfn =3D virt_to_phys((void *)gic_base) >> PAGE_SHIFT; + gic_pfn =3D PFN_DOWN(__pa(gic_base)); =20 ret =3D io_remap_pfn_range(vma, base, gic_pfn, gic_size, pgprot_noncached(vma->vm_page_prot)); --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B456C00140 for ; Mon, 15 Aug 2022 19:39:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344283AbiHOTj3 (ORCPT ); Mon, 15 Aug 2022 15:39:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344343AbiHOTge (ORCPT ); Mon, 15 Aug 2022 15:36:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8107D642E2; Mon, 15 Aug 2022 11:45: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 832DA611EC; Mon, 15 Aug 2022 18:45:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BFECC433C1; Mon, 15 Aug 2022 18:45:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589157; bh=amYYCAHW3rWIpE80WiCKgqephSy5vPKtilzeKaE+CA4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pxavnGOemPVFIJNNIyjhYF+lrAB7VhG01KDGxiaOaXtqrswTmwSUqcEVluUHLAPeq Yd+WsP+2JzbJ2fj5rj7uod1pN2VikgtBai757iRryPk5ILDet7oqUfxo2B97G8IJsb /2ZDlkU5lVSUPlx6qvZWdO82BN6caM9vq4zkqMJ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robin Murphy , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.15 600/779] swiotlb: fail map correctly with failed io_tlb_default_mem Date: Mon, 15 Aug 2022 20:04:04 +0200 Message-Id: <20220815180402.999454368@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Robin Murphy [ Upstream commit c51ba246cb172c9e947dc6fb8868a1eaf0b2a913 ] In the failure case of trying to use a buffer which we'd previously failed to allocate, the "!mem" condition is no longer sufficient since io_tlb_default_mem became static and assigned by default. Update the condition to work as intended per the rest of that conversion. Fixes: 463e862ac63e ("swiotlb: Convert io_default_tlb_mem to static allocat= ion") Signed-off-by: Robin Murphy Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- kernel/dma/swiotlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index 2ee5419649ed..e62fb7a4da69 100644 --- a/kernel/dma/swiotlb.c +++ b/kernel/dma/swiotlb.c @@ -551,7 +551,7 @@ phys_addr_t swiotlb_tbl_map_single(struct device *dev, = phys_addr_t orig_addr, int index; phys_addr_t tlb_addr; =20 - if (!mem) + if (!mem || !mem->nslabs) panic("Can not allocate SWIOTLB buffer earlier and can't now provide you= with the DMA bounce buffer"); =20 if (mem_encrypt_active()) --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19FB0C00140 for ; Mon, 15 Aug 2022 19:39:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242456AbiHOTj4 (ORCPT ); Mon, 15 Aug 2022 15:39:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344380AbiHOTgh (ORCPT ); Mon, 15 Aug 2022 15:36:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9E60642F3; Mon, 15 Aug 2022 11:46: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 95876611DB; Mon, 15 Aug 2022 18:46:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 969ECC433C1; Mon, 15 Aug 2022 18:46:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589161; bh=5SpB8uOR+chZgRcrC8jOsqoAakLPmR2ieEX9GHWy0ak=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x9+NAtGD9g21B6V4lGcO8SP9mjb+m4wGVuznakZ1zj77gp4ePGlq+tm0koLT5Igku +fppAzZ3c6NM54zF4v/Nq8FkT+7RBlaaxqAMzWPUgY95TgXAVgzKb+j4eFI5TtdZJA 6R9QUTy9D0EO6iMx7Jik58GwuaLi3Pr7VX8rP4Cc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Mark Brown , Sasha Levin Subject: [PATCH 5.15 601/779] ASoC: mt6359: Fix refcount leak bug Date: Mon, 15 Aug 2022 20:04:05 +0200 Message-Id: <20220815180403.052918259@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit a8d5df69e2ec702d979f7d04ed519caf8691a032 ] In mt6359_parse_dt() and mt6359_accdet_parse_dt(), we should call of_node_put() for the reference returned by of_get_child_by_name() which has increased the refcount. Fixes: 683530285316 ("ASoC: mt6359: fix failed to parse DT properties") Fixes: eef07b9e0925 ("ASoC: mediatek: mt6359: add MT6359 accdet jack driver= ") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220713102013.367336-1-windhl@126.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- sound/soc/codecs/mt6359-accdet.c | 1 + sound/soc/codecs/mt6359.c | 1 + 2 files changed, 2 insertions(+) diff --git a/sound/soc/codecs/mt6359-accdet.c b/sound/soc/codecs/mt6359-acc= det.c index 6d3d170144a0..c190628e2905 100644 --- a/sound/soc/codecs/mt6359-accdet.c +++ b/sound/soc/codecs/mt6359-accdet.c @@ -675,6 +675,7 @@ static int mt6359_accdet_parse_dt(struct mt6359_accdet = *priv) sizeof(struct three_key_threshold)); } =20 + of_node_put(node); dev_warn(priv->dev, "accdet caps=3D%x\n", priv->caps); =20 return 0; diff --git a/sound/soc/codecs/mt6359.c b/sound/soc/codecs/mt6359.c index 2d6a4a29b850..cf1febe54bcd 100644 --- a/sound/soc/codecs/mt6359.c +++ b/sound/soc/codecs/mt6359.c @@ -2780,6 +2780,7 @@ static int mt6359_parse_dt(struct mt6359_priv *priv) =20 ret =3D of_property_read_u32(np, "mediatek,mic-type-2", &priv->mux_select[MUX_MIC_TYPE_2]); + of_node_put(np); if (ret) { dev_info(priv->dev, "%s() failed to read mic-type-2, use default (%d)\n", --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6892C2BB9D for ; Mon, 15 Aug 2022 19:36:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344443AbiHOTgm (ORCPT ); Mon, 15 Aug 2022 15:36:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344077AbiHOTbF (ORCPT ); Mon, 15 Aug 2022 15:31: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 B8DA260509; Mon, 15 Aug 2022 11:44:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BD608B81084; Mon, 15 Aug 2022 18:44:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A2E9C433C1; Mon, 15 Aug 2022 18:44:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589063; bh=w0zsOwPQN8FgIJ2NQvJHzp2BmCnZTYagGKj8W77EbmI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lofTsz3K5aoBaEr9EfUiDs8r0vluYmg8hbNnig4lqSjX7yNMNOx+adJlXBMGntw1U 62/auH5F5c3/zZUnr9TxnqM3s3Qpv+O6Gk2YMN4q6QpW02kDlCwMeMDxvoXqG1+RdJ ohwi7aoVyLB28H6bWaQmpdkqmDXsw3xu1FCgkj8Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Doug Berger , Florian Fainelli , Sasha Levin Subject: [PATCH 5.15 602/779] serial: 8250_bcm7271: Save/restore RTS in suspend/resume Date: Mon, 15 Aug 2022 20:04:06 +0200 Message-Id: <20220815180403.094392907@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Doug Berger [ Upstream commit 3182efd036c1b955403d131258234896cbd9fbeb ] Commit 9cabe26e65a8 ("serial: 8250_bcm7271: UART errors after resuming from S2") prevented an early enabling of RTS during resume, but it did not actively restore the RTS state after resume. Fixes: 9cabe26e65a8 ("serial: 8250_bcm7271: UART errors after resuming from= S2") Signed-off-by: Doug Berger Signed-off-by: Florian Fainelli Link: https://lore.kernel.org/r/20220714031316.404918-1-f.fainelli@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/tty/serial/8250/8250_bcm7271.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/tty/serial/8250/8250_bcm7271.c b/drivers/tty/serial/82= 50/8250_bcm7271.c index 0877cf24f7de..711cf30e835a 100644 --- a/drivers/tty/serial/8250/8250_bcm7271.c +++ b/drivers/tty/serial/8250/8250_bcm7271.c @@ -1141,16 +1141,19 @@ static int __maybe_unused brcmuart_suspend(struct d= evice *dev) struct brcmuart_priv *priv =3D dev_get_drvdata(dev); struct uart_8250_port *up =3D serial8250_get_port(priv->line); struct uart_port *port =3D &up->port; - - serial8250_suspend_port(priv->line); - clk_disable_unprepare(priv->baud_mux_clk); + unsigned long flags; =20 /* * This will prevent resume from enabling RTS before the - * baud rate has been resored. + * baud rate has been restored. */ + spin_lock_irqsave(&port->lock, flags); priv->saved_mctrl =3D port->mctrl; - port->mctrl =3D 0; + port->mctrl &=3D ~TIOCM_RTS; + spin_unlock_irqrestore(&port->lock, flags); + + serial8250_suspend_port(priv->line); + clk_disable_unprepare(priv->baud_mux_clk); =20 return 0; } @@ -1160,6 +1163,7 @@ static int __maybe_unused brcmuart_resume(struct devi= ce *dev) struct brcmuart_priv *priv =3D dev_get_drvdata(dev); struct uart_8250_port *up =3D serial8250_get_port(priv->line); struct uart_port *port =3D &up->port; + unsigned long flags; int ret; =20 ret =3D clk_prepare_enable(priv->baud_mux_clk); @@ -1182,7 +1186,15 @@ static int __maybe_unused brcmuart_resume(struct dev= ice *dev) start_rx_dma(serial8250_get_port(priv->line)); } serial8250_resume_port(priv->line); - port->mctrl =3D priv->saved_mctrl; + + if (priv->saved_mctrl & TIOCM_RTS) { + /* Restore RTS */ + spin_lock_irqsave(&port->lock, flags); + port->mctrl |=3D TIOCM_RTS; + port->ops->set_mctrl(port, port->mctrl); + spin_unlock_irqrestore(&port->lock, flags); + } + return 0; } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAC53C00140 for ; Mon, 15 Aug 2022 19:36:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233135AbiHOTgp (ORCPT ); Mon, 15 Aug 2022 15:36:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344191AbiHOTbL (ORCPT ); Mon, 15 Aug 2022 15:31:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F21D60517; Mon, 15 Aug 2022 11:44: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 56E8D611C1; Mon, 15 Aug 2022 18:44:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5012CC433D7; Mon, 15 Aug 2022 18:44:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589066; bh=+TbaaYbSBoBGvAluhcP3Z4EiFOsKfK4408pvK7toNQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dWMQ8LXy6Nd0Me17NHyvlX/Ci+K+00GOQTwWjKhy7hnXSbINQ4PHB2OORXT1XFFMM U+/5HcWZerAwyDNG+UkWjCovMmG4tjATA8DfnITcoJSUCmMKF0Nhq/6FnfrPxCfuOW k3JSJ86sIpnD7WhUwmPU36vg/dxBF6ed8aPIE2BI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sam Protsenko , Krzysztof Kozlowski , Marek Szyprowski , Joerg Roedel , Sasha Levin Subject: [PATCH 5.15 603/779] iommu/exynos: Handle failed IOMMU device registration properly Date: Mon, 15 Aug 2022 20:04:07 +0200 Message-Id: <20220815180403.132641736@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sam Protsenko [ Upstream commit fce398d2d02c0a9a2bedf7c7201b123e153e8963 ] If iommu_device_register() fails in exynos_sysmmu_probe(), the previous calls have to be cleaned up. In this case, the iommu_device_sysfs_add() should be cleaned up, by calling its remove counterpart call. Fixes: d2c302b6e8b1 ("iommu/exynos: Make use of iommu_device_register inter= face") Signed-off-by: Sam Protsenko Reviewed-by: Krzysztof Kozlowski Acked-by: Marek Szyprowski Link: https://lore.kernel.org/r/20220714165550.8884-3-semen.protsenko@linar= o.org Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/iommu/exynos-iommu.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 939ffa768986..f96acc3525e8 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c @@ -630,7 +630,7 @@ static int exynos_sysmmu_probe(struct platform_device *= pdev) =20 ret =3D iommu_device_register(&data->iommu, &exynos_iommu_ops, dev); if (ret) - return ret; + goto err_iommu_register; =20 platform_set_drvdata(pdev, data); =20 @@ -657,6 +657,10 @@ static int exynos_sysmmu_probe(struct platform_device = *pdev) pm_runtime_enable(dev); =20 return 0; + +err_iommu_register: + iommu_device_sysfs_remove(&data->iommu); + return ret; } =20 static int __maybe_unused exynos_sysmmu_suspend(struct device *dev) --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EF1CC00140 for ; Mon, 15 Aug 2022 19:37:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244747AbiHOTg6 (ORCPT ); Mon, 15 Aug 2022 15:36:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344394AbiHOTbZ (ORCPT ); Mon, 15 Aug 2022 15:31:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6FC32B633; Mon, 15 Aug 2022 11:44: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 C427EB8105C; Mon, 15 Aug 2022 18:44:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93F1AC433C1; Mon, 15 Aug 2022 18:44:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589070; bh=tWN5yU3HtCGh/ww69p/tfqc6Xnx4l+6311RSPwAUIXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G4nFkkFlJeOerphifDtLxh8OIaMxWe+zeL2n4+v39qF+iSmnkM8GtQEhjhYXZQZWX itDLcNWNdbj6mPOzQ35eRevJ2fmRg2DcRpeopvm+5bibo8YEEh2khO1hUut3OZIF92 mJ2jfOIufR33JNlwJMMRR4HfPEh8pcakO1hT6sNA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dominique Martinet , Sasha Levin Subject: [PATCH 5.15 604/779] 9p: fix a bunch of checkpatch warnings Date: Mon, 15 Aug 2022 20:04:08 +0200 Message-Id: <20220815180403.175113584@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dominique Martinet [ Upstream commit 6e195b0f7c8e50927fa31946369c22a0534ec7e2 ] Sohaib Mohamed started a serie of tiny and incomplete checkpatch fixes but seemingly stopped halfway -- take over and do most of it. This is still missing net/9p/trans* and net/9p/protocol.c for a later time... Link: http://lkml.kernel.org/r/20211102134608.1588018-3-dominique.martinet@= atmark-techno.com Signed-off-by: Dominique Martinet Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/9p/acl.c | 1 + fs/9p/acl.h | 17 +- fs/9p/cache.c | 4 +- fs/9p/v9fs.c | 4 + fs/9p/v9fs_vfs.h | 11 +- fs/9p/vfs_addr.c | 6 +- fs/9p/vfs_dentry.c | 2 + fs/9p/vfs_file.c | 1 + fs/9p/vfs_inode.c | 14 +- fs/9p/vfs_inode_dotl.c | 9 +- fs/9p/vfs_super.c | 7 +- fs/9p/xattr.h | 19 +- include/net/9p/9p.h | 10 +- include/net/9p/client.h | 22 +- include/net/9p/transport.h | 18 +- net/9p/client.c | 432 ++++++++++++++++++------------------- net/9p/error.c | 2 +- net/9p/mod.c | 9 +- net/9p/protocol.c | 36 ++-- net/9p/protocol.h | 2 +- net/9p/trans_common.h | 2 +- 21 files changed, 323 insertions(+), 305 deletions(-) diff --git a/fs/9p/acl.c b/fs/9p/acl.c index c381499f5416..da22415ed036 100644 --- a/fs/9p/acl.c +++ b/fs/9p/acl.c @@ -123,6 +123,7 @@ static int v9fs_set_acl(struct p9_fid *fid, int type, s= truct posix_acl *acl) char *name; size_t size; void *buffer; + if (!acl) return 0; =20 diff --git a/fs/9p/acl.h b/fs/9p/acl.h index d43c8949e807..bc87b36f529e 100644 --- a/fs/9p/acl.h +++ b/fs/9p/acl.h @@ -15,14 +15,15 @@ #define FS_9P_ACL_H =20 #ifdef CONFIG_9P_FS_POSIX_ACL -extern int v9fs_get_acl(struct inode *, struct p9_fid *); -extern struct posix_acl *v9fs_iop_get_acl(struct inode *inode, int type, b= ool rcu); -extern int v9fs_acl_chmod(struct inode *, struct p9_fid *); -extern int v9fs_set_create_acl(struct inode *, struct p9_fid *, - struct posix_acl *, struct posix_acl *); -extern int v9fs_acl_mode(struct inode *dir, umode_t *modep, - struct posix_acl **dpacl, struct posix_acl **pacl); -extern void v9fs_put_acl(struct posix_acl *dacl, struct posix_acl *acl); +int v9fs_get_acl(struct inode *inode, struct p9_fid *fid); +struct posix_acl *v9fs_iop_get_acl(struct inode *inode, int type, + bool rcu); +int v9fs_acl_chmod(struct inode *inode, struct p9_fid *fid); +int v9fs_set_create_acl(struct inode *inode, struct p9_fid *fid, + struct posix_acl *dacl, struct posix_acl *acl); +int v9fs_acl_mode(struct inode *dir, umode_t *modep, + struct posix_acl **dpacl, struct posix_acl **pacl); +void v9fs_put_acl(struct posix_acl *dacl, struct posix_acl *acl); #else #define v9fs_iop_get_acl NULL static inline int v9fs_get_acl(struct inode *inode, struct p9_fid *fid) diff --git a/fs/9p/cache.c b/fs/9p/cache.c index 1769a44f4819..41da71320482 100644 --- a/fs/9p/cache.c +++ b/fs/9p/cache.c @@ -19,8 +19,8 @@ #define CACHETAG_LEN 11 =20 struct fscache_netfs v9fs_cache_netfs =3D { - .name =3D "9p", - .version =3D 0, + .name =3D "9p", + .version =3D 0, }; =20 /* diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c index 2e0fa7c932db..141067379f5e 100644 --- a/fs/9p/v9fs.c +++ b/fs/9p/v9fs.c @@ -190,8 +190,10 @@ static int v9fs_parse_options(struct v9fs_session_info= *v9ses, char *opts) =20 while ((p =3D strsep(&options, ",")) !=3D NULL) { int token, r; + if (!*p) continue; + token =3D match_token(p, tokens, args); switch (token) { case Opt_debug: @@ -659,6 +661,7 @@ static void v9fs_destroy_inode_cache(void) static int v9fs_cache_register(void) { int ret; + ret =3D v9fs_init_inode_cache(); if (ret < 0) return ret; @@ -686,6 +689,7 @@ static void v9fs_cache_unregister(void) static int __init init_v9fs(void) { int err; + pr_info("Installing v9fs 9p2000 file system support\n"); /* TODO: Setup list of registered trasnport modules */ =20 diff --git a/fs/9p/v9fs_vfs.h b/fs/9p/v9fs_vfs.h index d44ade76966a..bc417da7e9c1 100644 --- a/fs/9p/v9fs_vfs.h +++ b/fs/9p/v9fs_vfs.h @@ -44,9 +44,10 @@ extern struct kmem_cache *v9fs_inode_cache; =20 struct inode *v9fs_alloc_inode(struct super_block *sb); void v9fs_free_inode(struct inode *inode); -struct inode *v9fs_get_inode(struct super_block *sb, umode_t mode, dev_t); +struct inode *v9fs_get_inode(struct super_block *sb, umode_t mode, + dev_t rdev); int v9fs_init_inode(struct v9fs_session_info *v9ses, - struct inode *inode, umode_t mode, dev_t); + struct inode *inode, umode_t mode, dev_t rdev); void v9fs_evict_inode(struct inode *inode); ino_t v9fs_qid2ino(struct p9_qid *qid); void v9fs_stat2inode(struct p9_wstat *stat, struct inode *inode, @@ -59,8 +60,8 @@ void v9fs_inode2stat(struct inode *inode, struct p9_wstat= *stat); int v9fs_uflags2omode(int uflags, int extended); =20 void v9fs_blank_wstat(struct p9_wstat *wstat); -int v9fs_vfs_setattr_dotl(struct user_namespace *, struct dentry *, - struct iattr *); +int v9fs_vfs_setattr_dotl(struct user_namespace *mnt_userns, + struct dentry *dentry, struct iattr *iattr); int v9fs_file_fsync_dotl(struct file *filp, loff_t start, loff_t end, int datasync); int v9fs_refresh_inode(struct p9_fid *fid, struct inode *inode); @@ -68,9 +69,9 @@ int v9fs_refresh_inode_dotl(struct p9_fid *fid, struct in= ode *inode); static inline void v9fs_invalidate_inode_attr(struct inode *inode) { struct v9fs_inode *v9inode; + v9inode =3D V9FS_I(inode); v9inode->cache_validity |=3D V9FS_INO_INVALID_ATTR; - return; } =20 int v9fs_open_to_dotl_flags(int flags); diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c index 1c4f1b39cc95..606d33ef35c6 100644 --- a/fs/9p/vfs_addr.c +++ b/fs/9p/vfs_addr.c @@ -242,11 +242,13 @@ v9fs_direct_IO(struct kiocb *iocb, struct iov_iter *i= ter) loff_t pos =3D iocb->ki_pos; ssize_t n; int err =3D 0; + if (iov_iter_rw(iter) =3D=3D WRITE) { n =3D p9_client_write(file->private_data, pos, iter, &err); if (n) { struct inode *inode =3D file_inode(file); loff_t i_size =3D i_size_read(inode); + if (pos + n > i_size) inode_add_bytes(inode, pos + n - i_size); } @@ -257,7 +259,7 @@ v9fs_direct_IO(struct kiocb *iocb, struct iov_iter *ite= r) } =20 static int v9fs_write_begin(struct file *filp, struct address_space *mappi= ng, - loff_t pos, unsigned len, unsigned flags, + loff_t pos, unsigned int len, unsigned int flags, struct page **pagep, void **fsdata) { int retval =3D 0; @@ -293,7 +295,7 @@ static int v9fs_write_begin(struct file *filp, struct a= ddress_space *mapping, } =20 static int v9fs_write_end(struct file *filp, struct address_space *mapping, - loff_t pos, unsigned len, unsigned copied, + loff_t pos, unsigned int len, unsigned int copied, struct page *page, void *fsdata) { loff_t last_pos =3D pos + copied; diff --git a/fs/9p/vfs_dentry.c b/fs/9p/vfs_dentry.c index 4b4292123b3d..c2736af97884 100644 --- a/fs/9p/vfs_dentry.c +++ b/fs/9p/vfs_dentry.c @@ -52,6 +52,7 @@ static int v9fs_cached_dentry_delete(const struct dentry = *dentry) static void v9fs_dentry_release(struct dentry *dentry) { struct hlist_node *p, *n; + p9_debug(P9_DEBUG_VFS, " dentry: %pd (%p)\n", dentry, dentry); hlist_for_each_safe(p, n, (struct hlist_head *)&dentry->d_fsdata) @@ -76,6 +77,7 @@ static int v9fs_lookup_revalidate(struct dentry *dentry, = unsigned int flags) if (v9inode->cache_validity & V9FS_INO_INVALID_ATTR) { int retval; struct v9fs_session_info *v9ses; + fid =3D v9fs_fid_lookup(dentry); if (IS_ERR(fid)) return PTR_ERR(fid); diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index 246235ebdb70..7437b185fa8e 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c @@ -408,6 +408,7 @@ v9fs_file_write_iter(struct kiocb *iocb, struct iov_ite= r *from) struct inode *inode =3D file_inode(file); loff_t i_size; unsigned long pg_start, pg_end; + pg_start =3D origin >> PAGE_SHIFT; pg_end =3D (origin + retval - 1) >> PAGE_SHIFT; if (inode->i_mapping && inode->i_mapping->nrpages) diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 15d9492536cf..0d9b7d453a87 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c @@ -49,6 +49,7 @@ static const struct inode_operations v9fs_symlink_inode_o= perations; static u32 unixmode2p9mode(struct v9fs_session_info *v9ses, umode_t mode) { int res; + res =3D mode & 0777; if (S_ISDIR(mode)) res |=3D P9_DMDIR; @@ -223,6 +224,7 @@ v9fs_blank_wstat(struct p9_wstat *wstat) struct inode *v9fs_alloc_inode(struct super_block *sb) { struct v9fs_inode *v9inode; + v9inode =3D kmem_cache_alloc(v9fs_inode_cache, GFP_KERNEL); if (!v9inode) return NULL; @@ -251,7 +253,7 @@ int v9fs_init_inode(struct v9fs_session_info *v9ses, { int err =3D 0; =20 - inode_init_owner(&init_user_ns,inode, NULL, mode); + inode_init_owner(&init_user_ns, inode, NULL, mode); inode->i_blocks =3D 0; inode->i_rdev =3D rdev; inode->i_atime =3D inode->i_mtime =3D inode->i_ctime =3D current_time(ino= de); @@ -440,7 +442,7 @@ static struct inode *v9fs_qid_iget(struct super_block *= sb, unsigned long i_ino; struct inode *inode; struct v9fs_session_info *v9ses =3D sb->s_fs_info; - int (*test)(struct inode *, void *); + int (*test)(struct inode *inode, void *data); =20 if (new) test =3D v9fs_test_new_inode; @@ -499,8 +501,10 @@ v9fs_inode_from_fid(struct v9fs_session_info *v9ses, s= truct p9_fid *fid, static int v9fs_at_to_dotl_flags(int flags) { int rflags =3D 0; + if (flags & AT_REMOVEDIR) rflags |=3D P9_DOTL_AT_REMOVEDIR; + return rflags; } =20 @@ -797,7 +801,7 @@ struct dentry *v9fs_vfs_lookup(struct inode *dir, struc= t dentry *dentry, =20 static int v9fs_vfs_atomic_open(struct inode *dir, struct dentry *dentry, - struct file *file, unsigned flags, umode_t mode) + struct file *file, unsigned int flags, umode_t mode) { int err; u32 perm; @@ -1084,7 +1088,7 @@ static int v9fs_vfs_setattr(struct user_namespace *mn= t_userns, fid =3D v9fs_fid_lookup(dentry); use_dentry =3D 1; } - if(IS_ERR(fid)) + if (IS_ERR(fid)) return PTR_ERR(fid); =20 v9fs_blank_wstat(&wstat); @@ -1364,7 +1368,7 @@ v9fs_vfs_mknod(struct user_namespace *mnt_userns, str= uct inode *dir, char name[2 + U32_MAX_DIGITS + 1 + U32_MAX_DIGITS + 1]; u32 perm; =20 - p9_debug(P9_DEBUG_VFS, " %lu,%pd mode: %hx MAJOR: %u MINOR: %u\n", + p9_debug(P9_DEBUG_VFS, " %lu,%pd mode: %x MAJOR: %u MINOR: %u\n", dir->i_ino, dentry, mode, MAJOR(rdev), MINOR(rdev)); =20 diff --git a/fs/9p/vfs_inode_dotl.c b/fs/9p/vfs_inode_dotl.c index 833c638437a7..0f73aa26ddf4 100644 --- a/fs/9p/vfs_inode_dotl.c +++ b/fs/9p/vfs_inode_dotl.c @@ -107,7 +107,7 @@ static struct inode *v9fs_qid_iget_dotl(struct super_bl= ock *sb, unsigned long i_ino; struct inode *inode; struct v9fs_session_info *v9ses =3D sb->s_fs_info; - int (*test)(struct inode *, void *); + int (*test)(struct inode *inode, void *data); =20 if (new) test =3D v9fs_test_new_inode_dotl; @@ -230,7 +230,7 @@ v9fs_vfs_create_dotl(struct user_namespace *mnt_userns,= struct inode *dir, =20 static int v9fs_vfs_atomic_open_dotl(struct inode *dir, struct dentry *dentry, - struct file *file, unsigned flags, umode_t omode) + struct file *file, unsigned int flags, umode_t omode) { int err =3D 0; kgid_t gid; @@ -261,7 +261,7 @@ v9fs_vfs_atomic_open_dotl(struct inode *dir, struct den= try *dentry, v9ses =3D v9fs_inode2v9ses(dir); =20 name =3D dentry->d_name.name; - p9_debug(P9_DEBUG_VFS, "name:%s flags:0x%x mode:0x%hx\n", + p9_debug(P9_DEBUG_VFS, "name:%s flags:0x%x mode:0x%x\n", name, flags, omode); =20 dfid =3D v9fs_parent_fid(dentry); @@ -821,6 +821,7 @@ v9fs_vfs_link_dotl(struct dentry *old_dentry, struct in= ode *dir, if (v9ses->cache =3D=3D CACHE_LOOSE || v9ses->cache =3D=3D CACHE_FSCACHE)= { /* Get the latest stat info from server. */ struct p9_fid *fid; + fid =3D v9fs_fid_lookup(old_dentry); if (IS_ERR(fid)) return PTR_ERR(fid); @@ -857,7 +858,7 @@ v9fs_vfs_mknod_dotl(struct user_namespace *mnt_userns, = struct inode *dir, struct p9_qid qid; struct posix_acl *dacl =3D NULL, *pacl =3D NULL; =20 - p9_debug(P9_DEBUG_VFS, " %lu,%pd mode: %hx MAJOR: %u MINOR: %u\n", + p9_debug(P9_DEBUG_VFS, " %lu,%pd mode: %x MAJOR: %u MINOR: %u\n", dir->i_ino, dentry, omode, MAJOR(rdev), MINOR(rdev)); =20 diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index 5fce6e30bc5a..7449f7fd47d2 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c @@ -113,7 +113,7 @@ static struct dentry *v9fs_mount(struct file_system_typ= e *fs_type, int flags, struct inode *inode =3D NULL; struct dentry *root =3D NULL; struct v9fs_session_info *v9ses =3D NULL; - umode_t mode =3D S_IRWXUGO | S_ISVTX; + umode_t mode =3D 0777 | S_ISVTX; struct p9_fid *fid; int retval =3D 0; =20 @@ -157,6 +157,7 @@ static struct dentry *v9fs_mount(struct file_system_typ= e *fs_type, int flags, sb->s_root =3D root; if (v9fs_proto_dotl(v9ses)) { struct p9_stat_dotl *st =3D NULL; + st =3D p9_client_getattr_dotl(fid, P9_STATS_BASIC); if (IS_ERR(st)) { retval =3D PTR_ERR(st); @@ -167,6 +168,7 @@ static struct dentry *v9fs_mount(struct file_system_typ= e *fs_type, int flags, kfree(st); } else { struct p9_wstat *st =3D NULL; + st =3D p9_client_stat(fid); if (IS_ERR(st)) { retval =3D PTR_ERR(st); @@ -275,12 +277,13 @@ static int v9fs_statfs(struct dentry *dentry, struct = kstatfs *buf) static int v9fs_drop_inode(struct inode *inode) { struct v9fs_session_info *v9ses; + v9ses =3D v9fs_inode2v9ses(inode); if (v9ses->cache =3D=3D CACHE_LOOSE || v9ses->cache =3D=3D CACHE_FSCACHE) return generic_drop_inode(inode); /* * in case of non cached mode always drop the - * the inode because we want the inode attribute + * inode because we want the inode attribute * to always match that on the server. */ return 1; diff --git a/fs/9p/xattr.h b/fs/9p/xattr.h index c63c3bea5de5..9b28842c6363 100644 --- a/fs/9p/xattr.h +++ b/fs/9p/xattr.h @@ -22,13 +22,14 @@ extern const struct xattr_handler *v9fs_xattr_handlers[= ]; extern const struct xattr_handler v9fs_xattr_acl_access_handler; extern const struct xattr_handler v9fs_xattr_acl_default_handler; =20 -extern ssize_t v9fs_fid_xattr_get(struct p9_fid *, const char *, - void *, size_t); -extern ssize_t v9fs_xattr_get(struct dentry *, const char *, - void *, size_t); -extern int v9fs_fid_xattr_set(struct p9_fid *, const char *, - const void *, size_t, int); -extern int v9fs_xattr_set(struct dentry *, const char *, - const void *, size_t, int); -extern ssize_t v9fs_listxattr(struct dentry *, char *, size_t); +ssize_t v9fs_fid_xattr_get(struct p9_fid *fid, const char *name, + void *buffer, size_t buffer_size); +ssize_t v9fs_xattr_get(struct dentry *dentry, const char *name, + void *buffer, size_t buffer_size); +int v9fs_fid_xattr_set(struct p9_fid *fid, const char *name, + const void *value, size_t value_len, int flags); +int v9fs_xattr_set(struct dentry *dentry, const char *name, + const void *value, size_t value_len, int flags); +ssize_t v9fs_listxattr(struct dentry *dentry, char *buffer, + size_t buffer_size); #endif /* FS_9P_XATTR_H */ diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h index 03614de86942..6d0615140dbc 100644 --- a/include/net/9p/9p.h +++ b/include/net/9p/9p.h @@ -32,13 +32,13 @@ */ =20 enum p9_debug_flags { - P9_DEBUG_ERROR =3D (1<<0), - P9_DEBUG_9P =3D (1<<2), + P9_DEBUG_ERROR =3D (1<<0), + P9_DEBUG_9P =3D (1<<2), P9_DEBUG_VFS =3D (1<<3), P9_DEBUG_CONV =3D (1<<4), P9_DEBUG_MUX =3D (1<<5), P9_DEBUG_TRANS =3D (1<<6), - P9_DEBUG_SLABS =3D (1<<7), + P9_DEBUG_SLABS =3D (1<<7), P9_DEBUG_FCALL =3D (1<<8), P9_DEBUG_FID =3D (1<<9), P9_DEBUG_PKT =3D (1<<10), @@ -317,8 +317,8 @@ enum p9_qid_t { }; =20 /* 9P Magic Numbers */ -#define P9_NOTAG (u16)(~0) -#define P9_NOFID (u32)(~0) +#define P9_NOTAG ((u16)(~0)) +#define P9_NOFID ((u32)(~0)) #define P9_MAXWELEM 16 =20 /* Minimal header size: size[4] type[1] tag[2] */ diff --git a/include/net/9p/client.h b/include/net/9p/client.h index e1c308d8d288..334dc748fb3f 100644 --- a/include/net/9p/client.h +++ b/include/net/9p/client.h @@ -23,7 +23,7 @@ * @p9_proto_2000L: 9P2000.L extension */ =20 -enum p9_proto_versions{ +enum p9_proto_versions { p9_proto_legacy, p9_proto_2000u, p9_proto_2000L, @@ -219,13 +219,13 @@ struct p9_stat_dotl *p9_client_getattr_dotl(struct p9= _fid *fid, u64 request_mask); =20 int p9_client_mknod_dotl(struct p9_fid *oldfid, const char *name, int mode, - dev_t rdev, kgid_t gid, struct p9_qid *); + dev_t rdev, kgid_t gid, struct p9_qid *qid); int p9_client_mkdir_dotl(struct p9_fid *fid, const char *name, int mode, - kgid_t gid, struct p9_qid *); + kgid_t gid, struct p9_qid *qid); int p9_client_lock_dotl(struct p9_fid *fid, struct p9_flock *flock, u8 *st= atus); int p9_client_getlock_dotl(struct p9_fid *fid, struct p9_getlock *fl); void p9_fcall_fini(struct p9_fcall *fc); -struct p9_req_t *p9_tag_lookup(struct p9_client *, u16); +struct p9_req_t *p9_tag_lookup(struct p9_client *c, u16 tag); =20 static inline void p9_req_get(struct p9_req_t *r) { @@ -241,14 +241,18 @@ int p9_req_put(struct p9_req_t *r); =20 void p9_client_cb(struct p9_client *c, struct p9_req_t *req, int status); =20 -int p9_parse_header(struct p9_fcall *, int32_t *, int8_t *, int16_t *, int= ); -int p9stat_read(struct p9_client *, char *, int, struct p9_wstat *); -void p9stat_free(struct p9_wstat *); +int p9_parse_header(struct p9_fcall *pdu, int32_t *size, int8_t *type, + int16_t *tag, int rewind); +int p9stat_read(struct p9_client *clnt, char *buf, int len, + struct p9_wstat *st); +void p9stat_free(struct p9_wstat *stbuf); =20 int p9_is_proto_dotu(struct p9_client *clnt); int p9_is_proto_dotl(struct p9_client *clnt); -struct p9_fid *p9_client_xattrwalk(struct p9_fid *, const char *, u64 *); -int p9_client_xattrcreate(struct p9_fid *, const char *, u64, int); +struct p9_fid *p9_client_xattrwalk(struct p9_fid *file_fid, + const char *attr_name, u64 *attr_size); +int p9_client_xattrcreate(struct p9_fid *fid, const char *name, + u64 attr_size, int flags); int p9_client_readlink(struct p9_fid *fid, char **target); =20 int p9_client_init(void); diff --git a/include/net/9p/transport.h b/include/net/9p/transport.h index 3eb4261b2958..721597611625 100644 --- a/include/net/9p/transport.h +++ b/include/net/9p/transport.h @@ -40,14 +40,16 @@ struct p9_trans_module { int maxsize; /* max message size of transport */ int def; /* this transport should be default */ struct module *owner; - int (*create)(struct p9_client *, const char *, char *); - void (*close) (struct p9_client *); - int (*request) (struct p9_client *, struct p9_req_t *req); - int (*cancel) (struct p9_client *, struct p9_req_t *req); - int (*cancelled)(struct p9_client *, struct p9_req_t *req); - int (*zc_request)(struct p9_client *, struct p9_req_t *, - struct iov_iter *, struct iov_iter *, int , int, int); - int (*show_options)(struct seq_file *, struct p9_client *); + int (*create)(struct p9_client *client, + const char *devname, char *args); + void (*close)(struct p9_client *client); + int (*request)(struct p9_client *client, struct p9_req_t *req); + int (*cancel)(struct p9_client *client, struct p9_req_t *req); + int (*cancelled)(struct p9_client *client, struct p9_req_t *req); + int (*zc_request)(struct p9_client *client, struct p9_req_t *req, + struct iov_iter *uidata, struct iov_iter *uodata, + int inlen, int outlen, int in_hdr_len); + int (*show_options)(struct seq_file *m, struct p9_client *client); }; =20 void v9fs_register_trans(struct p9_trans_module *m); diff --git a/net/9p/client.c b/net/9p/client.c index 7973267ec846..33a53f016e73 100644 --- a/net/9p/client.c +++ b/net/9p/client.c @@ -32,10 +32,9 @@ =20 #define DEFAULT_MSIZE (128 * 1024) =20 -/* - * Client Option Parsing (code inspired by NFS code) - * - a little lazy - parse all client options - */ +/* Client Option Parsing (code inspired by NFS code) + * - a little lazy - parse all client options + */ =20 enum { Opt_msize, @@ -89,20 +88,18 @@ int p9_show_client_options(struct seq_file *m, struct p= 9_client *clnt) } EXPORT_SYMBOL(p9_show_client_options); =20 -/* - * Some error codes are taken directly from the server replies, +/* Some error codes are taken directly from the server replies, * make sure they are valid. */ static int safe_errno(int err) { - if ((err > 0) || (err < -MAX_ERRNO)) { + if (err > 0 || err < -MAX_ERRNO) { p9_debug(P9_DEBUG_ERROR, "Invalid error code %d\n", err); return -EPROTO; } return err; } =20 - /* Interpret mount option for protocol version */ static int get_protocol_version(char *s) { @@ -117,8 +114,9 @@ static int get_protocol_version(char *s) } else if (!strcmp(s, "9p2000.L")) { version =3D p9_proto_2000L; p9_debug(P9_DEBUG_9P, "Protocol version: 9P2000.L\n"); - } else + } else { pr_info("Unknown protocol version %s\n", s); + } =20 return version; } @@ -147,15 +145,13 @@ static int parse_opts(char *opts, struct p9_client *c= lnt) return 0; =20 tmp_options =3D kstrdup(opts, GFP_KERNEL); - if (!tmp_options) { - p9_debug(P9_DEBUG_ERROR, - "failed to allocate copy of option string\n"); + if (!tmp_options) return -ENOMEM; - } options =3D tmp_options; =20 while ((p =3D strsep(&options, ",")) !=3D NULL) { int token, r; + if (!*p) continue; token =3D match_token(p, tokens, args); @@ -187,7 +183,7 @@ static int parse_opts(char *opts, struct p9_client *cln= t) =20 v9fs_put_trans(clnt->trans_mod); clnt->trans_mod =3D v9fs_get_trans_by_name(s); - if (clnt->trans_mod =3D=3D NULL) { + if (!clnt->trans_mod) { pr_info("Could not find request transport: %s\n", s); ret =3D -EINVAL; @@ -379,6 +375,7 @@ static int p9_tag_remove(struct p9_client *c, struct p9= _req_t *r) static void p9_req_free(struct kref *ref) { struct p9_req_t *r =3D container_of(ref, struct p9_req_t, refcount); + p9_fcall_fini(&r->tc); p9_fcall_fini(&r->rc); kmem_cache_free(p9_req_cache, r); @@ -423,8 +420,7 @@ void p9_client_cb(struct p9_client *c, struct p9_req_t = *req, int status) { p9_debug(P9_DEBUG_MUX, " tag %d\n", req->tc.tag); =20 - /* - * This barrier is needed to make sure any change made to req before + /* This barrier is needed to make sure any change made to req before * the status change is visible to another thread */ smp_wmb(); @@ -446,12 +442,12 @@ EXPORT_SYMBOL(p9_client_cb); */ =20 int -p9_parse_header(struct p9_fcall *pdu, int32_t *size, int8_t *type, int16_t= *tag, - int rewind) +p9_parse_header(struct p9_fcall *pdu, int32_t *size, int8_t *type, + int16_t *tag, int rewind) { - int8_t r_type; - int16_t r_tag; - int32_t r_size; + s8 r_type; + s16 r_tag; + s32 r_size; int offset =3D pdu->offset; int err; =20 @@ -499,7 +495,7 @@ EXPORT_SYMBOL(p9_parse_header); =20 static int p9_check_errors(struct p9_client *c, struct p9_req_t *req) { - int8_t type; + s8 type; int err; int ecode; =20 @@ -510,8 +506,7 @@ static int p9_check_errors(struct p9_client *c, struct = p9_req_t *req) req->rc.size); return -EIO; } - /* - * dump the response from server + /* dump the response from server * This should be after check errors which poplulate pdu_fcall. */ trace_9p_protocol_dump(c, &req->rc); @@ -524,6 +519,7 @@ static int p9_check_errors(struct p9_client *c, struct = p9_req_t *req) =20 if (!p9_is_proto_dotl(c)) { char *ename; + err =3D p9pdu_readf(&req->rc, c->proto_version, "s?d", &ename, &ecode); if (err) @@ -574,12 +570,11 @@ static int p9_check_zc_errors(struct p9_client *c, st= ruct p9_req_t *req, { int err; int ecode; - int8_t type; + s8 type; char *ename =3D NULL; =20 err =3D p9_parse_header(&req->rc, NULL, &type, NULL, 0); - /* - * dump the response from server + /* dump the response from server * This should be after parse_header which poplulate pdu_fcall. */ trace_9p_protocol_dump(c, &req->rc); @@ -607,7 +602,7 @@ static int p9_check_zc_errors(struct p9_client *c, stru= ct p9_req_t *req, if (len > inline_len) { /* We have error in external buffer */ if (!copy_from_iter_full(ename + inline_len, - len - inline_len, uidata)) { + len - inline_len, uidata)) { err =3D -EFAULT; goto out_err; } @@ -659,7 +654,7 @@ p9_client_rpc(struct p9_client *c, int8_t type, const c= har *fmt, ...); static int p9_client_flush(struct p9_client *c, struct p9_req_t *oldreq) { struct p9_req_t *req; - int16_t oldtag; + s16 oldtag; int err; =20 err =3D p9_parse_header(&oldreq->tc, NULL, NULL, &oldtag, 1); @@ -672,8 +667,7 @@ static int p9_client_flush(struct p9_client *c, struct = p9_req_t *oldreq) if (IS_ERR(req)) return PTR_ERR(req); =20 - /* - * if we haven't received a response for oldreq, + /* if we haven't received a response for oldreq, * remove it from the list */ if (oldreq->status =3D=3D REQ_STATUS_SENT) { @@ -699,7 +693,7 @@ static struct p9_req_t *p9_client_prepare_req(struct p9= _client *c, return ERR_PTR(-EIO); =20 /* if status is begin_disconnected we allow only clunk request */ - if ((c->status =3D=3D BeginDisconnect) && (type !=3D P9_TCLUNK)) + if (c->status =3D=3D BeginDisconnect && type !=3D P9_TCLUNK) return ERR_PTR(-EIO); =20 req =3D p9_tag_alloc(c, type, req_size); @@ -747,8 +741,9 @@ p9_client_rpc(struct p9_client *c, int8_t type, const c= har *fmt, ...) if (signal_pending(current)) { sigpending =3D 1; clear_thread_flag(TIF_SIGPENDING); - } else + } else { sigpending =3D 0; + } =20 err =3D c->trans_mod->request(c, req); if (err < 0) { @@ -762,14 +757,13 @@ p9_client_rpc(struct p9_client *c, int8_t type, const= char *fmt, ...) /* Wait for the response */ err =3D wait_event_killable(req->wq, req->status >=3D REQ_STATUS_RCVD); =20 - /* - * Make sure our req is coherent with regard to updates in other + /* Make sure our req is coherent with regard to updates in other * threads - echoes to wmb() in the callback */ smp_rmb(); =20 - if ((err =3D=3D -ERESTARTSYS) && (c->status =3D=3D Connected) - && (type =3D=3D P9_TFLUSH)) { + if (err =3D=3D -ERESTARTSYS && c->status =3D=3D Connected && + type =3D=3D P9_TFLUSH) { sigpending =3D 1; clear_thread_flag(TIF_SIGPENDING); goto again; @@ -779,7 +773,7 @@ p9_client_rpc(struct p9_client *c, int8_t type, const c= har *fmt, ...) p9_debug(P9_DEBUG_ERROR, "req_status error %d\n", req->t_err); err =3D req->t_err; } - if ((err =3D=3D -ERESTARTSYS) && (c->status =3D=3D Connected)) { + if (err =3D=3D -ERESTARTSYS && c->status =3D=3D Connected) { p9_debug(P9_DEBUG_MUX, "flushing\n"); sigpending =3D 1; clear_thread_flag(TIF_SIGPENDING); @@ -834,8 +828,7 @@ static struct p9_req_t *p9_client_zc_rpc(struct p9_clie= nt *c, int8_t type, struct p9_req_t *req; =20 va_start(ap, fmt); - /* - * We allocate a inline protocol data of only 4k bytes. + /* We allocate a inline protocol data of only 4k bytes. * The actual content is passed in zero-copy fashion. */ req =3D p9_client_prepare_req(c, type, P9_ZC_HDR_SZ, fmt, ap); @@ -846,8 +839,9 @@ static struct p9_req_t *p9_client_zc_rpc(struct p9_clie= nt *c, int8_t type, if (signal_pending(current)) { sigpending =3D 1; clear_thread_flag(TIF_SIGPENDING); - } else + } else { sigpending =3D 0; + } =20 err =3D c->trans_mod->zc_request(c, req, uidata, uodata, inlen, olen, in_hdrlen); @@ -861,7 +855,7 @@ static struct p9_req_t *p9_client_zc_rpc(struct p9_clie= nt *c, int8_t type, p9_debug(P9_DEBUG_ERROR, "req_status error %d\n", req->t_err); err =3D req->t_err; } - if ((err =3D=3D -ERESTARTSYS) && (c->status =3D=3D Connected)) { + if (err =3D=3D -ERESTARTSYS && c->status =3D=3D Connected) { p9_debug(P9_DEBUG_MUX, "flushing\n"); sigpending =3D 1; clear_thread_flag(TIF_SIGPENDING); @@ -897,11 +891,11 @@ static struct p9_fid *p9_fid_create(struct p9_client = *clnt) struct p9_fid *fid; =20 p9_debug(P9_DEBUG_FID, "clnt %p\n", clnt); - fid =3D kmalloc(sizeof(struct p9_fid), GFP_KERNEL); + fid =3D kmalloc(sizeof(*fid), GFP_KERNEL); if (!fid) return NULL; =20 - memset(&fid->qid, 0, sizeof(struct p9_qid)); + memset(&fid->qid, 0, sizeof(fid->qid)); fid->mode =3D -1; fid->uid =3D current_fsuid(); fid->clnt =3D clnt; @@ -949,15 +943,15 @@ static int p9_client_version(struct p9_client *c) switch (c->proto_version) { case p9_proto_2000L: req =3D p9_client_rpc(c, P9_TVERSION, "ds", - c->msize, "9P2000.L"); + c->msize, "9P2000.L"); break; case p9_proto_2000u: req =3D p9_client_rpc(c, P9_TVERSION, "ds", - c->msize, "9P2000.u"); + c->msize, "9P2000.u"); break; case p9_proto_legacy: req =3D p9_client_rpc(c, P9_TVERSION, "ds", - c->msize, "9P2000"); + c->msize, "9P2000"); break; default: return -EINVAL; @@ -974,13 +968,13 @@ static int p9_client_version(struct p9_client *c) } =20 p9_debug(P9_DEBUG_9P, "<<< RVERSION msize %d %s\n", msize, version); - if (!strncmp(version, "9P2000.L", 8)) + if (!strncmp(version, "9P2000.L", 8)) { c->proto_version =3D p9_proto_2000L; - else if (!strncmp(version, "9P2000.u", 8)) + } else if (!strncmp(version, "9P2000.u", 8)) { c->proto_version =3D p9_proto_2000u; - else if (!strncmp(version, "9P2000", 6)) + } else if (!strncmp(version, "9P2000", 6)) { c->proto_version =3D p9_proto_legacy; - else { + } else { p9_debug(P9_DEBUG_ERROR, "server returned an unknown version: %s\n", version); err =3D -EREMOTEIO; @@ -1010,7 +1004,7 @@ struct p9_client *p9_client_create(const char *dev_na= me, char *options) char *client_id; =20 err =3D 0; - clnt =3D kmalloc(sizeof(struct p9_client), GFP_KERNEL); + clnt =3D kmalloc(sizeof(*clnt), GFP_KERNEL); if (!clnt) return ERR_PTR(-ENOMEM); =20 @@ -1032,7 +1026,7 @@ struct p9_client *p9_client_create(const char *dev_na= me, char *options) if (!clnt->trans_mod) clnt->trans_mod =3D v9fs_get_default_trans(); =20 - if (clnt->trans_mod =3D=3D NULL) { + if (!clnt->trans_mod) { err =3D -EPROTONOSUPPORT; p9_debug(P9_DEBUG_ERROR, "No transport defined or default transport\n"); @@ -1120,14 +1114,14 @@ void p9_client_begin_disconnect(struct p9_client *c= lnt) EXPORT_SYMBOL(p9_client_begin_disconnect); =20 struct p9_fid *p9_client_attach(struct p9_client *clnt, struct p9_fid *afi= d, - const char *uname, kuid_t n_uname, const char *aname) + const char *uname, kuid_t n_uname, + const char *aname) { int err =3D 0; struct p9_req_t *req; struct p9_fid *fid; struct p9_qid qid; =20 - p9_debug(P9_DEBUG_9P, ">>> TATTACH afid %d uname %s aname %s\n", afid ? afid->fid : -1, uname, aname); fid =3D p9_fid_create(clnt); @@ -1138,7 +1132,7 @@ struct p9_fid *p9_client_attach(struct p9_client *cln= t, struct p9_fid *afid, fid->uid =3D n_uname; =20 req =3D p9_client_rpc(clnt, P9_TATTACH, "ddss?u", fid->fid, - afid ? afid->fid : P9_NOFID, uname, aname, n_uname); + afid ? afid->fid : P9_NOFID, uname, aname, n_uname); if (IS_ERR(req)) { err =3D PTR_ERR(req); goto error; @@ -1152,7 +1146,7 @@ struct p9_fid *p9_client_attach(struct p9_client *cln= t, struct p9_fid *afid, } =20 p9_debug(P9_DEBUG_9P, "<<< RATTACH qid %x.%llx.%x\n", - qid.type, (unsigned long long)qid.path, qid.version); + qid.type, qid.path, qid.version); =20 memmove(&fid->qid, &qid, sizeof(struct p9_qid)); =20 @@ -1167,14 +1161,14 @@ struct p9_fid *p9_client_attach(struct p9_client *c= lnt, struct p9_fid *afid, EXPORT_SYMBOL(p9_client_attach); =20 struct p9_fid *p9_client_walk(struct p9_fid *oldfid, uint16_t nwname, - const unsigned char * const *wnames, int clone) + const unsigned char * const *wnames, int clone) { int err; struct p9_client *clnt; struct p9_fid *fid; struct p9_qid *wqids; struct p9_req_t *req; - uint16_t nwqids, count; + u16 nwqids, count; =20 err =3D 0; wqids =3D NULL; @@ -1187,14 +1181,14 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid= , uint16_t nwname, } =20 fid->uid =3D oldfid->uid; - } else + } else { fid =3D oldfid; - + } =20 p9_debug(P9_DEBUG_9P, ">>> TWALK fids %d,%d nwname %ud wname[0] %s\n", oldfid->fid, fid->fid, nwname, wnames ? wnames[0] : NULL); req =3D p9_client_rpc(clnt, P9_TWALK, "ddT", oldfid->fid, fid->fid, - nwname, wnames); + nwname, wnames); if (IS_ERR(req)) { err =3D PTR_ERR(req); goto error; @@ -1217,9 +1211,9 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, = uint16_t nwname, =20 for (count =3D 0; count < nwqids; count++) p9_debug(P9_DEBUG_9P, "<<< [%d] %x.%llx.%x\n", - count, wqids[count].type, - (unsigned long long)wqids[count].path, - wqids[count].version); + count, wqids[count].type, + wqids[count].path, + wqids[count].version); =20 if (nwname) memmove(&fid->qid, &wqids[nwqids - 1], sizeof(struct p9_qid)); @@ -1235,7 +1229,7 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, = uint16_t nwname, fid =3D NULL; =20 error: - if (fid && (fid !=3D oldfid)) + if (fid && fid !=3D oldfid) p9_fid_destroy(fid); =20 return ERR_PTR(err); @@ -1252,7 +1246,7 @@ int p9_client_open(struct p9_fid *fid, int mode) =20 clnt =3D fid->clnt; p9_debug(P9_DEBUG_9P, ">>> %s fid %d mode %d\n", - p9_is_proto_dotl(clnt) ? "TLOPEN" : "TOPEN", fid->fid, mode); + p9_is_proto_dotl(clnt) ? "TLOPEN" : "TOPEN", fid->fid, mode); err =3D 0; =20 if (fid->mode !=3D -1) @@ -1274,8 +1268,8 @@ int p9_client_open(struct p9_fid *fid, int mode) } =20 p9_debug(P9_DEBUG_9P, "<<< %s qid %x.%llx.%x iounit %x\n", - p9_is_proto_dotl(clnt) ? "RLOPEN" : "ROPEN", qid.type, - (unsigned long long)qid.path, qid.version, iounit); + p9_is_proto_dotl(clnt) ? "RLOPEN" : "ROPEN", qid.type, + qid.path, qid.version, iounit); =20 memmove(&fid->qid, &qid, sizeof(struct p9_qid)); fid->mode =3D mode; @@ -1288,8 +1282,8 @@ int p9_client_open(struct p9_fid *fid, int mode) } EXPORT_SYMBOL(p9_client_open); =20 -int p9_client_create_dotl(struct p9_fid *ofid, const char *name, u32 flags= , u32 mode, - kgid_t gid, struct p9_qid *qid) +int p9_client_create_dotl(struct p9_fid *ofid, const char *name, u32 flags, + u32 mode, kgid_t gid, struct p9_qid *qid) { int err =3D 0; struct p9_client *clnt; @@ -1297,16 +1291,16 @@ int p9_client_create_dotl(struct p9_fid *ofid, cons= t char *name, u32 flags, u32 int iounit; =20 p9_debug(P9_DEBUG_9P, - ">>> TLCREATE fid %d name %s flags %d mode %d gid %d\n", - ofid->fid, name, flags, mode, - from_kgid(&init_user_ns, gid)); + ">>> TLCREATE fid %d name %s flags %d mode %d gid %d\n", + ofid->fid, name, flags, mode, + from_kgid(&init_user_ns, gid)); clnt =3D ofid->clnt; =20 if (ofid->mode !=3D -1) return -EINVAL; =20 req =3D p9_client_rpc(clnt, P9_TLCREATE, "dsddg", ofid->fid, name, flags, - mode, gid); + mode, gid); if (IS_ERR(req)) { err =3D PTR_ERR(req); goto error; @@ -1319,9 +1313,7 @@ int p9_client_create_dotl(struct p9_fid *ofid, const = char *name, u32 flags, u32 } =20 p9_debug(P9_DEBUG_9P, "<<< RLCREATE qid %x.%llx.%x iounit %x\n", - qid->type, - (unsigned long long)qid->path, - qid->version, iounit); + qid->type, qid->path, qid->version, iounit); =20 memmove(&ofid->qid, qid, sizeof(struct p9_qid)); ofid->mode =3D mode; @@ -1344,7 +1336,7 @@ int p9_client_fcreate(struct p9_fid *fid, const char = *name, u32 perm, int mode, int iounit; =20 p9_debug(P9_DEBUG_9P, ">>> TCREATE fid %d name %s perm %d mode %d\n", - fid->fid, name, perm, mode); + fid->fid, name, perm, mode); err =3D 0; clnt =3D fid->clnt; =20 @@ -1352,7 +1344,7 @@ int p9_client_fcreate(struct p9_fid *fid, const char = *name, u32 perm, int mode, return -EINVAL; =20 req =3D p9_client_rpc(clnt, P9_TCREATE, "dsdb?s", fid->fid, name, perm, - mode, extension); + mode, extension); if (IS_ERR(req)) { err =3D PTR_ERR(req); goto error; @@ -1365,9 +1357,7 @@ int p9_client_fcreate(struct p9_fid *fid, const char = *name, u32 perm, int mode, } =20 p9_debug(P9_DEBUG_9P, "<<< RCREATE qid %x.%llx.%x iounit %x\n", - qid.type, - (unsigned long long)qid.path, - qid.version, iounit); + qid.type, qid.path, qid.version, iounit); =20 memmove(&fid->qid, &qid, sizeof(struct p9_qid)); fid->mode =3D mode; @@ -1381,18 +1371,18 @@ int p9_client_fcreate(struct p9_fid *fid, const cha= r *name, u32 perm, int mode, EXPORT_SYMBOL(p9_client_fcreate); =20 int p9_client_symlink(struct p9_fid *dfid, const char *name, - const char *symtgt, kgid_t gid, struct p9_qid *qid) + const char *symtgt, kgid_t gid, struct p9_qid *qid) { int err =3D 0; struct p9_client *clnt; struct p9_req_t *req; =20 p9_debug(P9_DEBUG_9P, ">>> TSYMLINK dfid %d name %s symtgt %s\n", - dfid->fid, name, symtgt); + dfid->fid, name, symtgt); clnt =3D dfid->clnt; =20 req =3D p9_client_rpc(clnt, P9_TSYMLINK, "dssg", dfid->fid, name, symtgt, - gid); + gid); if (IS_ERR(req)) { err =3D PTR_ERR(req); goto error; @@ -1405,7 +1395,7 @@ int p9_client_symlink(struct p9_fid *dfid, const char= *name, } =20 p9_debug(P9_DEBUG_9P, "<<< RSYMLINK qid %x.%llx.%x\n", - qid->type, (unsigned long long)qid->path, qid->version); + qid->type, qid->path, qid->version); =20 free_and_error: p9_tag_remove(clnt, req); @@ -1420,10 +1410,10 @@ int p9_client_link(struct p9_fid *dfid, struct p9_f= id *oldfid, const char *newna struct p9_req_t *req; =20 p9_debug(P9_DEBUG_9P, ">>> TLINK dfid %d oldfid %d newname %s\n", - dfid->fid, oldfid->fid, newname); + dfid->fid, oldfid->fid, newname); clnt =3D dfid->clnt; req =3D p9_client_rpc(clnt, P9_TLINK, "dds", dfid->fid, oldfid->fid, - newname); + newname); if (IS_ERR(req)) return PTR_ERR(req); =20 @@ -1440,7 +1430,7 @@ int p9_client_fsync(struct p9_fid *fid, int datasync) struct p9_req_t *req; =20 p9_debug(P9_DEBUG_9P, ">>> TFSYNC fid %d datasync:%d\n", - fid->fid, datasync); + fid->fid, datasync); err =3D 0; clnt =3D fid->clnt; =20 @@ -1476,8 +1466,8 @@ int p9_client_clunk(struct p9_fid *fid) return 0; =20 again: - p9_debug(P9_DEBUG_9P, ">>> TCLUNK fid %d (try %d)\n", fid->fid, - retries); + p9_debug(P9_DEBUG_9P, ">>> TCLUNK fid %d (try %d)\n", + fid->fid, retries); err =3D 0; clnt =3D fid->clnt; =20 @@ -1491,16 +1481,16 @@ int p9_client_clunk(struct p9_fid *fid) =20 p9_tag_remove(clnt, req); error: - /* - * Fid is not valid even after a failed clunk + /* Fid is not valid even after a failed clunk * If interrupted, retry once then give up and * leak fid until umount. */ if (err =3D=3D -ERESTARTSYS) { if (retries++ =3D=3D 0) goto again; - } else + } else { p9_fid_destroy(fid); + } return err; } EXPORT_SYMBOL(p9_client_clunk); @@ -1540,7 +1530,7 @@ int p9_client_unlinkat(struct p9_fid *dfid, const cha= r *name, int flags) struct p9_client *clnt; =20 p9_debug(P9_DEBUG_9P, ">>> TUNLINKAT fid %d %s %d\n", - dfid->fid, name, flags); + dfid->fid, name, flags); =20 clnt =3D dfid->clnt; req =3D p9_client_rpc(clnt, P9_TUNLINKAT, "dsd", dfid->fid, name, flags); @@ -1586,8 +1576,8 @@ p9_client_read_once(struct p9_fid *fid, u64 offset, s= truct iov_iter *to, char *dataptr; =20 *err =3D 0; - p9_debug(P9_DEBUG_9P, ">>> TREAD fid %d offset %llu %d\n", - fid->fid, (unsigned long long) offset, (int)iov_iter_count(to)); + p9_debug(P9_DEBUG_9P, ">>> TREAD fid %d offset %llu %zu\n", + fid->fid, offset, iov_iter_count(to)); =20 rsize =3D fid->iounit; if (!rsize || rsize > clnt->msize - P9_IOHDRSZ) @@ -1653,13 +1643,13 @@ p9_client_write(struct p9_fid *fid, u64 offset, str= uct iov_iter *from, int *err) *err =3D 0; =20 p9_debug(P9_DEBUG_9P, ">>> TWRITE fid %d offset %llu count %zd\n", - fid->fid, (unsigned long long) offset, - iov_iter_count(from)); + fid->fid, offset, iov_iter_count(from)); =20 while (iov_iter_count(from)) { int count =3D iov_iter_count(from); int rsize =3D fid->iounit; - if (!rsize || rsize > clnt->msize-P9_IOHDRSZ) + + if (!rsize || rsize > clnt->msize - P9_IOHDRSZ) rsize =3D clnt->msize - P9_IOHDRSZ; =20 if (count < rsize) @@ -1672,7 +1662,7 @@ p9_client_write(struct p9_fid *fid, u64 offset, struc= t iov_iter *from, int *err) fid->fid, offset, rsize); } else { req =3D p9_client_rpc(clnt, P9_TWRITE, "dqV", fid->fid, - offset, rsize, from); + offset, rsize, from); } if (IS_ERR(req)) { *err =3D PTR_ERR(req); @@ -1705,12 +1695,13 @@ struct p9_wstat *p9_client_stat(struct p9_fid *fid) { int err; struct p9_client *clnt; - struct p9_wstat *ret =3D kmalloc(sizeof(struct p9_wstat), GFP_KERNEL); + struct p9_wstat *ret; struct p9_req_t *req; u16 ignored; =20 p9_debug(P9_DEBUG_9P, ">>> TSTAT fid %d\n", fid->fid); =20 + ret =3D kmalloc(sizeof(*ret), GFP_KERNEL); if (!ret) return ERR_PTR(-ENOMEM); =20 @@ -1731,17 +1722,17 @@ struct p9_wstat *p9_client_stat(struct p9_fid *fid) } =20 p9_debug(P9_DEBUG_9P, - "<<< RSTAT sz=3D%x type=3D%x dev=3D%x qid=3D%x.%llx.%x\n" - "<<< mode=3D%8.8x atime=3D%8.8x mtime=3D%8.8x length=3D%llx\n" - "<<< name=3D%s uid=3D%s gid=3D%s muid=3D%s extension=3D(%s)\n" - "<<< uid=3D%d gid=3D%d n_muid=3D%d\n", - ret->size, ret->type, ret->dev, ret->qid.type, - (unsigned long long)ret->qid.path, ret->qid.version, ret->mode, - ret->atime, ret->mtime, (unsigned long long)ret->length, - ret->name, ret->uid, ret->gid, ret->muid, ret->extension, - from_kuid(&init_user_ns, ret->n_uid), - from_kgid(&init_user_ns, ret->n_gid), - from_kuid(&init_user_ns, ret->n_muid)); + "<<< RSTAT sz=3D%x type=3D%x dev=3D%x qid=3D%x.%llx.%x\n" + "<<< mode=3D%8.8x atime=3D%8.8x mtime=3D%8.8x length=3D%llx\n" + "<<< name=3D%s uid=3D%s gid=3D%s muid=3D%s extension=3D(%s)\n" + "<<< uid=3D%d gid=3D%d n_muid=3D%d\n", + ret->size, ret->type, ret->dev, ret->qid.type, ret->qid.path, + ret->qid.version, ret->mode, + ret->atime, ret->mtime, ret->length, + ret->name, ret->uid, ret->gid, ret->muid, ret->extension, + from_kuid(&init_user_ns, ret->n_uid), + from_kgid(&init_user_ns, ret->n_gid), + from_kuid(&init_user_ns, ret->n_muid)); =20 p9_tag_remove(clnt, req); return ret; @@ -1753,17 +1744,17 @@ struct p9_wstat *p9_client_stat(struct p9_fid *fid) EXPORT_SYMBOL(p9_client_stat); =20 struct p9_stat_dotl *p9_client_getattr_dotl(struct p9_fid *fid, - u64 request_mask) + u64 request_mask) { int err; struct p9_client *clnt; - struct p9_stat_dotl *ret =3D kmalloc(sizeof(struct p9_stat_dotl), - GFP_KERNEL); + struct p9_stat_dotl *ret; struct p9_req_t *req; =20 p9_debug(P9_DEBUG_9P, ">>> TGETATTR fid %d, request_mask %lld\n", - fid->fid, request_mask); + fid->fid, request_mask); =20 + ret =3D kmalloc(sizeof(*ret), GFP_KERNEL); if (!ret) return ERR_PTR(-ENOMEM); =20 @@ -1783,26 +1774,27 @@ struct p9_stat_dotl *p9_client_getattr_dotl(struct = p9_fid *fid, goto error; } =20 - p9_debug(P9_DEBUG_9P, - "<<< RGETATTR st_result_mask=3D%lld\n" - "<<< qid=3D%x.%llx.%x\n" - "<<< st_mode=3D%8.8x st_nlink=3D%llu\n" - "<<< st_uid=3D%d st_gid=3D%d\n" - "<<< st_rdev=3D%llx st_size=3D%llx st_blksize=3D%llu st_blocks=3D%llu\n" - "<<< st_atime_sec=3D%lld st_atime_nsec=3D%lld\n" - "<<< st_mtime_sec=3D%lld st_mtime_nsec=3D%lld\n" - "<<< st_ctime_sec=3D%lld st_ctime_nsec=3D%lld\n" - "<<< st_btime_sec=3D%lld st_btime_nsec=3D%lld\n" - "<<< st_gen=3D%lld st_data_version=3D%lld\n", - ret->st_result_mask, ret->qid.type, ret->qid.path, - ret->qid.version, ret->st_mode, ret->st_nlink, - from_kuid(&init_user_ns, ret->st_uid), - from_kgid(&init_user_ns, ret->st_gid), - ret->st_rdev, ret->st_size, ret->st_blksize, - ret->st_blocks, ret->st_atime_sec, ret->st_atime_nsec, - ret->st_mtime_sec, ret->st_mtime_nsec, ret->st_ctime_sec, - ret->st_ctime_nsec, ret->st_btime_sec, ret->st_btime_nsec, - ret->st_gen, ret->st_data_version); + p9_debug(P9_DEBUG_9P, "<<< RGETATTR st_result_mask=3D%lld\n" + "<<< qid=3D%x.%llx.%x\n" + "<<< st_mode=3D%8.8x st_nlink=3D%llu\n" + "<<< st_uid=3D%d st_gid=3D%d\n" + "<<< st_rdev=3D%llx st_size=3D%llx st_blksize=3D%llu st_blocks=3D%llu\n" + "<<< st_atime_sec=3D%lld st_atime_nsec=3D%lld\n" + "<<< st_mtime_sec=3D%lld st_mtime_nsec=3D%lld\n" + "<<< st_ctime_sec=3D%lld st_ctime_nsec=3D%lld\n" + "<<< st_btime_sec=3D%lld st_btime_nsec=3D%lld\n" + "<<< st_gen=3D%lld st_data_version=3D%lld\n", + ret->st_result_mask, + ret->qid.type, ret->qid.path, ret->qid.version, + ret->st_mode, ret->st_nlink, + from_kuid(&init_user_ns, ret->st_uid), + from_kgid(&init_user_ns, ret->st_gid), + ret->st_rdev, ret->st_size, ret->st_blksize, ret->st_blocks, + ret->st_atime_sec, ret->st_atime_nsec, + ret->st_mtime_sec, ret->st_mtime_nsec, + ret->st_ctime_sec, ret->st_ctime_nsec, + ret->st_btime_sec, ret->st_btime_nsec, + ret->st_gen, ret->st_data_version); =20 p9_tag_remove(clnt, req); return ret; @@ -1821,7 +1813,7 @@ static int p9_client_statsize(struct p9_wstat *wst, i= nt proto_version) /* size[2] type[2] dev[4] qid[13] */ /* mode[4] atime[4] mtime[4] length[8]*/ /* name[s] uid[s] gid[s] muid[s] */ - ret =3D 2+4+13+4+4+4+8+2+2+2+2; + ret =3D 2 + 4 + 13 + 4 + 4 + 4 + 8 + 2 + 2 + 2 + 2; =20 if (wst->name) ret +=3D strlen(wst->name); @@ -1832,9 +1824,10 @@ static int p9_client_statsize(struct p9_wstat *wst, = int proto_version) if (wst->muid) ret +=3D strlen(wst->muid); =20 - if ((proto_version =3D=3D p9_proto_2000u) || - (proto_version =3D=3D p9_proto_2000L)) { - ret +=3D 2+4+4+4; /* extension[s] n_uid[4] n_gid[4] n_muid[4] */ + if (proto_version =3D=3D p9_proto_2000u || + proto_version =3D=3D p9_proto_2000L) { + /* extension[s] n_uid[4] n_gid[4] n_muid[4] */ + ret +=3D 2 + 4 + 4 + 4; if (wst->extension) ret +=3D strlen(wst->extension); } @@ -1851,21 +1844,23 @@ int p9_client_wstat(struct p9_fid *fid, struct p9_w= stat *wst) err =3D 0; clnt =3D fid->clnt; wst->size =3D p9_client_statsize(wst, clnt->proto_version); - p9_debug(P9_DEBUG_9P, ">>> TWSTAT fid %d\n", fid->fid); + p9_debug(P9_DEBUG_9P, ">>> TWSTAT fid %d\n", + fid->fid); p9_debug(P9_DEBUG_9P, - " sz=3D%x type=3D%x dev=3D%x qid=3D%x.%llx.%x\n" - " mode=3D%8.8x atime=3D%8.8x mtime=3D%8.8x length=3D%llx\n" - " name=3D%s uid=3D%s gid=3D%s muid=3D%s extension=3D(%s)\n" - " uid=3D%d gid=3D%d n_muid=3D%d\n", - wst->size, wst->type, wst->dev, wst->qid.type, - (unsigned long long)wst->qid.path, wst->qid.version, wst->mode, - wst->atime, wst->mtime, (unsigned long long)wst->length, - wst->name, wst->uid, wst->gid, wst->muid, wst->extension, - from_kuid(&init_user_ns, wst->n_uid), - from_kgid(&init_user_ns, wst->n_gid), - from_kuid(&init_user_ns, wst->n_muid)); - - req =3D p9_client_rpc(clnt, P9_TWSTAT, "dwS", fid->fid, wst->size+2, wst); + " sz=3D%x type=3D%x dev=3D%x qid=3D%x.%llx.%x\n" + " mode=3D%8.8x atime=3D%8.8x mtime=3D%8.8x length=3D%llx\n" + " name=3D%s uid=3D%s gid=3D%s muid=3D%s extension=3D(%s)\n" + " uid=3D%d gid=3D%d n_muid=3D%d\n", + wst->size, wst->type, wst->dev, wst->qid.type, + wst->qid.path, wst->qid.version, + wst->mode, wst->atime, wst->mtime, wst->length, + wst->name, wst->uid, wst->gid, wst->muid, wst->extension, + from_kuid(&init_user_ns, wst->n_uid), + from_kgid(&init_user_ns, wst->n_gid), + from_kuid(&init_user_ns, wst->n_muid)); + + req =3D p9_client_rpc(clnt, P9_TWSTAT, "dwS", + fid->fid, wst->size + 2, wst); if (IS_ERR(req)) { err =3D PTR_ERR(req); goto error; @@ -1888,15 +1883,15 @@ int p9_client_setattr(struct p9_fid *fid, struct p9= _iattr_dotl *p9attr) err =3D 0; clnt =3D fid->clnt; p9_debug(P9_DEBUG_9P, ">>> TSETATTR fid %d\n", fid->fid); - p9_debug(P9_DEBUG_9P, - " valid=3D%x mode=3D%x uid=3D%d gid=3D%d size=3D%lld\n" - " atime_sec=3D%lld atime_nsec=3D%lld\n" - " mtime_sec=3D%lld mtime_nsec=3D%lld\n", - p9attr->valid, p9attr->mode, - from_kuid(&init_user_ns, p9attr->uid), - from_kgid(&init_user_ns, p9attr->gid), - p9attr->size, p9attr->atime_sec, p9attr->atime_nsec, - p9attr->mtime_sec, p9attr->mtime_nsec); + p9_debug(P9_DEBUG_9P, " valid=3D%x mode=3D%x uid=3D%d gid=3D%d size=3D= %lld\n", + p9attr->valid, p9attr->mode, + from_kuid(&init_user_ns, p9attr->uid), + from_kgid(&init_user_ns, p9attr->gid), + p9attr->size); + p9_debug(P9_DEBUG_9P, " atime_sec=3D%lld atime_nsec=3D%lld\n", + p9attr->atime_sec, p9attr->atime_nsec); + p9_debug(P9_DEBUG_9P, " mtime_sec=3D%lld mtime_nsec=3D%lld\n", + p9attr->mtime_sec, p9attr->mtime_nsec); =20 req =3D p9_client_rpc(clnt, P9_TSETATTR, "dI", fid->fid, p9attr); =20 @@ -1937,12 +1932,10 @@ int p9_client_statfs(struct p9_fid *fid, struct p9_= rstatfs *sb) goto error; } =20 - p9_debug(P9_DEBUG_9P, "<<< RSTATFS fid %d type 0x%lx bsize %ld " - "blocks %llu bfree %llu bavail %llu files %llu ffree %llu " - "fsid %llu namelen %ld\n", - fid->fid, (long unsigned int)sb->type, (long int)sb->bsize, - sb->blocks, sb->bfree, sb->bavail, sb->files, sb->ffree, - sb->fsid, (long int)sb->namelen); + p9_debug(P9_DEBUG_9P, + "<<< RSTATFS fid %d type 0x%x bsize %u blocks %llu bfree %llu bavail %l= lu files %llu ffree %llu fsid %llu namelen %u\n", + fid->fid, sb->type, sb->bsize, sb->blocks, sb->bfree, + sb->bavail, sb->files, sb->ffree, sb->fsid, sb->namelen); =20 p9_tag_remove(clnt, req); error: @@ -1961,10 +1954,10 @@ int p9_client_rename(struct p9_fid *fid, clnt =3D fid->clnt; =20 p9_debug(P9_DEBUG_9P, ">>> TRENAME fid %d newdirfid %d name %s\n", - fid->fid, newdirfid->fid, name); + fid->fid, newdirfid->fid, name); =20 req =3D p9_client_rpc(clnt, P9_TRENAME, "dds", fid->fid, - newdirfid->fid, name); + newdirfid->fid, name); if (IS_ERR(req)) { err =3D PTR_ERR(req); goto error; @@ -1988,9 +1981,9 @@ int p9_client_renameat(struct p9_fid *olddirfid, cons= t char *old_name, err =3D 0; clnt =3D olddirfid->clnt; =20 - p9_debug(P9_DEBUG_9P, ">>> TRENAMEAT olddirfid %d old name %s" - " newdirfid %d new name %s\n", olddirfid->fid, old_name, - newdirfid->fid, new_name); + p9_debug(P9_DEBUG_9P, + ">>> TRENAMEAT olddirfid %d old name %s newdirfid %d new name %s\n", + olddirfid->fid, old_name, newdirfid->fid, new_name); =20 req =3D p9_client_rpc(clnt, P9_TRENAMEAT, "dsds", olddirfid->fid, old_name, newdirfid->fid, new_name); @@ -2000,7 +1993,7 @@ int p9_client_renameat(struct p9_fid *olddirfid, cons= t char *old_name, } =20 p9_debug(P9_DEBUG_9P, "<<< RRENAMEAT newdirfid %d new name %s\n", - newdirfid->fid, new_name); + newdirfid->fid, new_name); =20 p9_tag_remove(clnt, req); error: @@ -2008,11 +2001,10 @@ int p9_client_renameat(struct p9_fid *olddirfid, co= nst char *old_name, } EXPORT_SYMBOL(p9_client_renameat); =20 -/* - * An xattrwalk without @attr_name gives the fid for the lisxattr namespace +/* An xattrwalk without @attr_name gives the fid for the lisxattr namespace */ struct p9_fid *p9_client_xattrwalk(struct p9_fid *file_fid, - const char *attr_name, u64 *attr_size) + const char *attr_name, u64 *attr_size) { int err; struct p9_req_t *req; @@ -2027,11 +2019,11 @@ struct p9_fid *p9_client_xattrwalk(struct p9_fid *f= ile_fid, goto error; } p9_debug(P9_DEBUG_9P, - ">>> TXATTRWALK file_fid %d, attr_fid %d name %s\n", - file_fid->fid, attr_fid->fid, attr_name); + ">>> TXATTRWALK file_fid %d, attr_fid %d name %s\n", + file_fid->fid, attr_fid->fid, attr_name); =20 req =3D p9_client_rpc(clnt, P9_TXATTRWALK, "dds", - file_fid->fid, attr_fid->fid, attr_name); + file_fid->fid, attr_fid->fid, attr_name); if (IS_ERR(req)) { err =3D PTR_ERR(req); goto error; @@ -2044,13 +2036,13 @@ struct p9_fid *p9_client_xattrwalk(struct p9_fid *f= ile_fid, } p9_tag_remove(clnt, req); p9_debug(P9_DEBUG_9P, "<<< RXATTRWALK fid %d size %llu\n", - attr_fid->fid, *attr_size); + attr_fid->fid, *attr_size); return attr_fid; clunk_fid: p9_client_clunk(attr_fid); attr_fid =3D NULL; error: - if (attr_fid && (attr_fid !=3D file_fid)) + if (attr_fid && attr_fid !=3D file_fid) p9_fid_destroy(attr_fid); =20 return ERR_PTR(err); @@ -2058,19 +2050,19 @@ struct p9_fid *p9_client_xattrwalk(struct p9_fid *f= ile_fid, EXPORT_SYMBOL_GPL(p9_client_xattrwalk); =20 int p9_client_xattrcreate(struct p9_fid *fid, const char *name, - u64 attr_size, int flags) + u64 attr_size, int flags) { int err; struct p9_req_t *req; struct p9_client *clnt; =20 p9_debug(P9_DEBUG_9P, - ">>> TXATTRCREATE fid %d name %s size %lld flag %d\n", - fid->fid, name, (long long)attr_size, flags); + ">>> TXATTRCREATE fid %d name %s size %llu flag %d\n", + fid->fid, name, attr_size, flags); err =3D 0; clnt =3D fid->clnt; req =3D p9_client_rpc(clnt, P9_TXATTRCREATE, "dsqd", - fid->fid, name, attr_size, flags); + fid->fid, name, attr_size, flags); if (IS_ERR(req)) { err =3D PTR_ERR(req); goto error; @@ -2094,13 +2086,13 @@ int p9_client_readdir(struct p9_fid *fid, char *dat= a, u32 count, u64 offset) iov_iter_kvec(&to, READ, &kv, 1, count); =20 p9_debug(P9_DEBUG_9P, ">>> TREADDIR fid %d offset %llu count %d\n", - fid->fid, (unsigned long long) offset, count); + fid->fid, offset, count); =20 err =3D 0; clnt =3D fid->clnt; =20 rsize =3D fid->iounit; - if (!rsize || rsize > clnt->msize-P9_READDIRHDRSZ) + if (!rsize || rsize > clnt->msize - P9_READDIRHDRSZ) rsize =3D clnt->msize - P9_READDIRHDRSZ; =20 if (count < rsize) @@ -2108,8 +2100,7 @@ int p9_client_readdir(struct p9_fid *fid, char *data,= u32 count, u64 offset) =20 /* Don't bother zerocopy for small IO (< 1024) */ if (clnt->trans_mod->zc_request && rsize > 1024) { - /* - * response header len is 11 + /* response header len is 11 * PDU Header(7) + IO Size (4) */ req =3D p9_client_zc_rpc(clnt, P9_TREADDIR, &to, NULL, rsize, 0, @@ -2150,7 +2141,7 @@ int p9_client_readdir(struct p9_fid *fid, char *data,= u32 count, u64 offset) EXPORT_SYMBOL(p9_client_readdir); =20 int p9_client_mknod_dotl(struct p9_fid *fid, const char *name, int mode, - dev_t rdev, kgid_t gid, struct p9_qid *qid) + dev_t rdev, kgid_t gid, struct p9_qid *qid) { int err; struct p9_client *clnt; @@ -2158,10 +2149,11 @@ int p9_client_mknod_dotl(struct p9_fid *fid, const = char *name, int mode, =20 err =3D 0; clnt =3D fid->clnt; - p9_debug(P9_DEBUG_9P, ">>> TMKNOD fid %d name %s mode %d major %d " - "minor %d\n", fid->fid, name, mode, MAJOR(rdev), MINOR(rdev)); + p9_debug(P9_DEBUG_9P, + ">>> TMKNOD fid %d name %s mode %d major %d minor %d\n", + fid->fid, name, mode, MAJOR(rdev), MINOR(rdev)); req =3D p9_client_rpc(clnt, P9_TMKNOD, "dsdddg", fid->fid, name, mode, - MAJOR(rdev), MINOR(rdev), gid); + MAJOR(rdev), MINOR(rdev), gid); if (IS_ERR(req)) return PTR_ERR(req); =20 @@ -2170,18 +2162,17 @@ int p9_client_mknod_dotl(struct p9_fid *fid, const = char *name, int mode, trace_9p_protocol_dump(clnt, &req->rc); goto error; } - p9_debug(P9_DEBUG_9P, "<<< RMKNOD qid %x.%llx.%x\n", qid->type, - (unsigned long long)qid->path, qid->version); + p9_debug(P9_DEBUG_9P, "<<< RMKNOD qid %x.%llx.%x\n", + qid->type, qid->path, qid->version); =20 error: p9_tag_remove(clnt, req); return err; - } EXPORT_SYMBOL(p9_client_mknod_dotl); =20 int p9_client_mkdir_dotl(struct p9_fid *fid, const char *name, int mode, - kgid_t gid, struct p9_qid *qid) + kgid_t gid, struct p9_qid *qid) { int err; struct p9_client *clnt; @@ -2191,8 +2182,8 @@ int p9_client_mkdir_dotl(struct p9_fid *fid, const ch= ar *name, int mode, clnt =3D fid->clnt; p9_debug(P9_DEBUG_9P, ">>> TMKDIR fid %d name %s mode %d gid %d\n", fid->fid, name, mode, from_kgid(&init_user_ns, gid)); - req =3D p9_client_rpc(clnt, P9_TMKDIR, "dsdg", fid->fid, name, mode, - gid); + req =3D p9_client_rpc(clnt, P9_TMKDIR, "dsdg", + fid->fid, name, mode, gid); if (IS_ERR(req)) return PTR_ERR(req); =20 @@ -2202,12 +2193,11 @@ int p9_client_mkdir_dotl(struct p9_fid *fid, const = char *name, int mode, goto error; } p9_debug(P9_DEBUG_9P, "<<< RMKDIR qid %x.%llx.%x\n", qid->type, - (unsigned long long)qid->path, qid->version); + qid->path, qid->version); =20 error: p9_tag_remove(clnt, req); return err; - } EXPORT_SYMBOL(p9_client_mkdir_dotl); =20 @@ -2219,14 +2209,14 @@ int p9_client_lock_dotl(struct p9_fid *fid, struct = p9_flock *flock, u8 *status) =20 err =3D 0; clnt =3D fid->clnt; - p9_debug(P9_DEBUG_9P, ">>> TLOCK fid %d type %i flags %d " - "start %lld length %lld proc_id %d client_id %s\n", - fid->fid, flock->type, flock->flags, flock->start, - flock->length, flock->proc_id, flock->client_id); + p9_debug(P9_DEBUG_9P, + ">>> TLOCK fid %d type %i flags %d start %lld length %lld proc_id %d cl= ient_id %s\n", + fid->fid, flock->type, flock->flags, flock->start, + flock->length, flock->proc_id, flock->client_id); =20 req =3D p9_client_rpc(clnt, P9_TLOCK, "dbdqqds", fid->fid, flock->type, - flock->flags, flock->start, flock->length, - flock->proc_id, flock->client_id); + flock->flags, flock->start, flock->length, + flock->proc_id, flock->client_id); =20 if (IS_ERR(req)) return PTR_ERR(req); @@ -2240,7 +2230,6 @@ int p9_client_lock_dotl(struct p9_fid *fid, struct p9= _flock *flock, u8 *status) error: p9_tag_remove(clnt, req); return err; - } EXPORT_SYMBOL(p9_client_lock_dotl); =20 @@ -2252,12 +2241,14 @@ int p9_client_getlock_dotl(struct p9_fid *fid, stru= ct p9_getlock *glock) =20 err =3D 0; clnt =3D fid->clnt; - p9_debug(P9_DEBUG_9P, ">>> TGETLOCK fid %d, type %i start %lld " - "length %lld proc_id %d client_id %s\n", fid->fid, glock->type, - glock->start, glock->length, glock->proc_id, glock->client_id); + p9_debug(P9_DEBUG_9P, + ">>> TGETLOCK fid %d, type %i start %lld length %lld proc_id %d client_= id %s\n", + fid->fid, glock->type, glock->start, glock->length, + glock->proc_id, glock->client_id); =20 - req =3D p9_client_rpc(clnt, P9_TGETLOCK, "dbqqds", fid->fid, glock->type, - glock->start, glock->length, glock->proc_id, glock->client_id); + req =3D p9_client_rpc(clnt, P9_TGETLOCK, "dbqqds", fid->fid, + glock->type, glock->start, glock->length, + glock->proc_id, glock->client_id); =20 if (IS_ERR(req)) return PTR_ERR(req); @@ -2269,9 +2260,10 @@ int p9_client_getlock_dotl(struct p9_fid *fid, struc= t p9_getlock *glock) trace_9p_protocol_dump(clnt, &req->rc); goto error; } - p9_debug(P9_DEBUG_9P, "<<< RGETLOCK type %i start %lld length %lld " - "proc_id %d client_id %s\n", glock->type, glock->start, - glock->length, glock->proc_id, glock->client_id); + p9_debug(P9_DEBUG_9P, + "<<< RGETLOCK type %i start %lld length %lld proc_id %d client_id %s\n", + glock->type, glock->start, glock->length, + glock->proc_id, glock->client_id); error: p9_tag_remove(clnt, req); return err; diff --git a/net/9p/error.c b/net/9p/error.c index 61c18daf3050..ff935746754e 100644 --- a/net/9p/error.c +++ b/net/9p/error.c @@ -185,7 +185,7 @@ int p9_error_init(void) INIT_HLIST_HEAD(&hash_errmap[bucket]); =20 /* load initial error map into hash table */ - for (c =3D errmap; c->name !=3D NULL; c++) { + for (c =3D errmap; c->name; c++) { c->namelen =3D strlen(c->name); bucket =3D jhash(c->name, c->namelen, 0) % ERRHASHSZ; INIT_HLIST_NODE(&c->list); diff --git a/net/9p/mod.c b/net/9p/mod.c index 5126566850bd..535cf016633c 100644 --- a/net/9p/mod.c +++ b/net/9p/mod.c @@ -24,13 +24,13 @@ #include =20 #ifdef CONFIG_NET_9P_DEBUG -unsigned int p9_debug_level =3D 0; /* feature-rific global debug level */ +unsigned int p9_debug_level; /* feature-rific global debug level */ EXPORT_SYMBOL(p9_debug_level); module_param_named(debug, p9_debug_level, uint, 0); MODULE_PARM_DESC(debug, "9P debugging level"); =20 void _p9_debug(enum p9_debug_flags level, const char *func, - const char *fmt, ...) + const char *fmt, ...) { struct va_format vaf; va_list args; @@ -53,10 +53,7 @@ void _p9_debug(enum p9_debug_flags level, const char *fu= nc, EXPORT_SYMBOL(_p9_debug); #endif =20 -/* - * Dynamic Transport Registration Routines - * - */ +/* Dynamic Transport Registration Routines */ =20 static DEFINE_SPINLOCK(v9fs_trans_lock); static LIST_HEAD(v9fs_trans_list); diff --git a/net/9p/protocol.c b/net/9p/protocol.c index 03593eb240d8..59eb71f357fa 100644 --- a/net/9p/protocol.c +++ b/net/9p/protocol.c @@ -46,6 +46,7 @@ EXPORT_SYMBOL(p9stat_free); size_t pdu_read(struct p9_fcall *pdu, void *data, size_t size) { size_t len =3D min(pdu->size - pdu->offset, size); + memcpy(data, &pdu->sdata[pdu->offset], len); pdu->offset +=3D len; return size - len; @@ -54,6 +55,7 @@ size_t pdu_read(struct p9_fcall *pdu, void *data, size_t = size) static size_t pdu_write(struct p9_fcall *pdu, const void *data, size_t siz= e) { size_t len =3D min(pdu->capacity - pdu->size, size); + memcpy(&pdu->sdata[pdu->size], data, len); pdu->size +=3D len; return size - len; @@ -64,6 +66,7 @@ pdu_write_u(struct p9_fcall *pdu, struct iov_iter *from, = size_t size) { size_t len =3D min(pdu->capacity - pdu->size, size); struct iov_iter i =3D *from; + if (!copy_from_iter_full(&pdu->sdata[pdu->size], len, &i)) len =3D 0; =20 @@ -71,26 +74,25 @@ pdu_write_u(struct p9_fcall *pdu, struct iov_iter *from= , size_t size) return size - len; } =20 -/* - b - int8_t - w - int16_t - d - int32_t - q - int64_t - s - string - u - numeric uid - g - numeric gid - S - stat - Q - qid - D - data blob (int32_t size followed by void *, results are not freed) - T - array of strings (int16_t count, followed by strings) - R - array of qids (int16_t count, followed by qids) - A - stat for 9p2000.L (p9_stat_dotl) - ? - if optional =3D 1, continue parsing -*/ +/* b - int8_t + * w - int16_t + * d - int32_t + * q - int64_t + * s - string + * u - numeric uid + * g - numeric gid + * S - stat + * Q - qid + * D - data blob (int32_t size followed by void *, results are not freed) + * T - array of strings (int16_t count, followed by strings) + * R - array of qids (int16_t count, followed by qids) + * A - stat for 9p2000.L (p9_stat_dotl) + * ? - if optional =3D 1, continue parsing + */ =20 static int p9pdu_vreadf(struct p9_fcall *pdu, int proto_version, const char *fmt, - va_list ap) + va_list ap) { const char *ptr; int errcode =3D 0; diff --git a/net/9p/protocol.h b/net/9p/protocol.h index 6835f91cfda5..4a2f68651037 100644 --- a/net/9p/protocol.h +++ b/net/9p/protocol.h @@ -11,7 +11,7 @@ */ =20 int p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt, - va_list ap); + va_list ap); int p9pdu_readf(struct p9_fcall *pdu, int proto_version, const char *fmt, = ...); int p9pdu_prepare(struct p9_fcall *pdu, int16_t tag, int8_t type); int p9pdu_finalize(struct p9_client *clnt, struct p9_fcall *pdu); diff --git a/net/9p/trans_common.h b/net/9p/trans_common.h index c43babb3f635..65c094c321a2 100644 --- a/net/9p/trans_common.h +++ b/net/9p/trans_common.h @@ -12,4 +12,4 @@ * */ =20 -void p9_release_pages(struct page **, int); +void p9_release_pages(struct page **pages, int nr_pages); --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 651D3C282E7 for ; Mon, 15 Aug 2022 19:36:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243662AbiHOTgv (ORCPT ); Mon, 15 Aug 2022 15:36:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344357AbiHOTbX (ORCPT ); Mon, 15 Aug 2022 15:31:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 293F26068E; Mon, 15 Aug 2022 11:44:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 29F65611E3; Mon, 15 Aug 2022 18:44:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2EB33C433C1; Mon, 15 Aug 2022 18:44:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589073; bh=W3zPSwdpF9S2bsdG1crbuH3BFIELlcL1I3DqDNyJR7Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UKjXXR+3FeivK3G6JZCLs4cbzIX93PX3vKEHrVFL9c9UUJu2F4GlEYQm9+MTJ6MIC XXTekG7FeE/Y3wFjEhvVV1QVnhp2Gx9av90nLB8EtmKOtP5DJMjdE7986/mvJyCSx8 RIwKosIypKxa8FGw6eNQbwLXOuPg/jMzfY3WcdTo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kent Overstreet , Eric Van Hensbergen , Latchesar Ionkov , Dominique Martinet , Sasha Levin Subject: [PATCH 5.15 605/779] 9p: Drop kref usage Date: Mon, 15 Aug 2022 20:04:09 +0200 Message-Id: <20220815180403.209309203@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kent Overstreet [ Upstream commit 6cda12864cb0f99810a5809e11e3ee5b102c9a47 ] An upcoming patch is going to require passing the client through p9_req_put() -> p9_req_free(), but that's awkward with the kref indirection - so this patch switches to using refcount_t directly. Link: https://lkml.kernel.org/r/20220704014243.153050-1-kent.overstreet@gma= il.com Signed-off-by: Kent Overstreet Cc: Eric Van Hensbergen Cc: Latchesar Ionkov Signed-off-by: Dominique Martinet Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- include/net/9p/client.h | 6 +++--- net/9p/client.c | 19 ++++++++----------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/include/net/9p/client.h b/include/net/9p/client.h index 334dc748fb3f..67c854d07d7e 100644 --- a/include/net/9p/client.h +++ b/include/net/9p/client.h @@ -78,7 +78,7 @@ enum p9_req_status_t { struct p9_req_t { int status; int t_err; - struct kref refcount; + refcount_t refcount; wait_queue_head_t wq; struct p9_fcall tc; struct p9_fcall rc; @@ -229,12 +229,12 @@ struct p9_req_t *p9_tag_lookup(struct p9_client *c, u= 16 tag); =20 static inline void p9_req_get(struct p9_req_t *r) { - kref_get(&r->refcount); + refcount_inc(&r->refcount); } =20 static inline int p9_req_try_get(struct p9_req_t *r) { - return kref_get_unless_zero(&r->refcount); + return refcount_inc_not_zero(&r->refcount); } =20 int p9_req_put(struct p9_req_t *r); diff --git a/net/9p/client.c b/net/9p/client.c index 33a53f016e73..5835fe4aebd7 100644 --- a/net/9p/client.c +++ b/net/9p/client.c @@ -307,7 +307,7 @@ p9_tag_alloc(struct p9_client *c, int8_t type, unsigned= int max_size) * callback), so p9_client_cb eats the second ref there * as the pointer is duplicated directly by virtqueue_add_sgs() */ - refcount_set(&req->refcount.refcount, 2); + refcount_set(&req->refcount, 2); =20 return req; =20 @@ -372,18 +372,15 @@ static int p9_tag_remove(struct p9_client *c, struct = p9_req_t *r) return p9_req_put(r); } =20 -static void p9_req_free(struct kref *ref) -{ - struct p9_req_t *r =3D container_of(ref, struct p9_req_t, refcount); - - p9_fcall_fini(&r->tc); - p9_fcall_fini(&r->rc); - kmem_cache_free(p9_req_cache, r); -} - int p9_req_put(struct p9_req_t *r) { - return kref_put(&r->refcount, p9_req_free); + if (refcount_dec_and_test(&r->refcount)) { + p9_fcall_fini(&r->tc); + p9_fcall_fini(&r->rc); + kmem_cache_free(p9_req_cache, r); + return 1; + } + return 0; } EXPORT_SYMBOL(p9_req_put); =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57A2BC00140 for ; Mon, 15 Aug 2022 19:37:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244239AbiHOThP (ORCPT ); Mon, 15 Aug 2022 15:37:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344468AbiHOTba (ORCPT ); Mon, 15 Aug 2022 15:31:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95A1061103; Mon, 15 Aug 2022 11:44: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 B75DCB81057; Mon, 15 Aug 2022 18:44:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CCB0C433D6; Mon, 15 Aug 2022 18:44:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589076; bh=39xC/sPcvcPzbSKHtZDJSlpE6SSTmB0YMk336LQU+2Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dWctEwpdvO9TeeBlhDtXx0k1r662q/Q/eEeqTLgFvynZ56TtZcrijy/lAqnguAFiP bvZ6sznOs0FWRnNqDluRQVWnbpc9xZ3XU+q3Fo4zMlu+2BqLYsqbmh+pFf1/gcu0a2 5gStZUxtpnqMVgARxbtXKCeISYhC7AmJiOLFaINI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kent Overstreet , Eric Van Hensbergen , Latchesar Ionkov , Dominique Martinet , Sasha Levin Subject: [PATCH 5.15 606/779] 9p: Add client parameter to p9_req_put() Date: Mon, 15 Aug 2022 20:04:10 +0200 Message-Id: <20220815180403.257883961@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kent Overstreet [ Upstream commit 8b11ff098af42b1fa57fc817daadd53c8b244a0c ] This is to aid in adding mempools, in the next patch. Link: https://lkml.kernel.org/r/20220704014243.153050-2-kent.overstreet@gma= il.com Signed-off-by: Kent Overstreet Cc: Eric Van Hensbergen Cc: Latchesar Ionkov Signed-off-by: Dominique Martinet Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- include/net/9p/client.h | 2 +- net/9p/client.c | 12 ++++++------ net/9p/trans_fd.c | 12 ++++++------ net/9p/trans_rdma.c | 2 +- net/9p/trans_virtio.c | 4 ++-- net/9p/trans_xen.c | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/include/net/9p/client.h b/include/net/9p/client.h index 67c854d07d7e..7060de84c559 100644 --- a/include/net/9p/client.h +++ b/include/net/9p/client.h @@ -237,7 +237,7 @@ static inline int p9_req_try_get(struct p9_req_t *r) return refcount_inc_not_zero(&r->refcount); } =20 -int p9_req_put(struct p9_req_t *r); +int p9_req_put(struct p9_client *c, struct p9_req_t *r); =20 void p9_client_cb(struct p9_client *c, struct p9_req_t *req, int status); =20 diff --git a/net/9p/client.c b/net/9p/client.c index 5835fe4aebd7..866f02e88c79 100644 --- a/net/9p/client.c +++ b/net/9p/client.c @@ -343,7 +343,7 @@ struct p9_req_t *p9_tag_lookup(struct p9_client *c, u16= tag) if (!p9_req_try_get(req)) goto again; if (req->tc.tag !=3D tag) { - p9_req_put(req); + p9_req_put(c, req); goto again; } } @@ -369,10 +369,10 @@ static int p9_tag_remove(struct p9_client *c, struct = p9_req_t *r) spin_lock_irqsave(&c->lock, flags); idr_remove(&c->reqs, tag); spin_unlock_irqrestore(&c->lock, flags); - return p9_req_put(r); + return p9_req_put(c, r); } =20 -int p9_req_put(struct p9_req_t *r) +int p9_req_put(struct p9_client *c, struct p9_req_t *r) { if (refcount_dec_and_test(&r->refcount)) { p9_fcall_fini(&r->tc); @@ -425,7 +425,7 @@ void p9_client_cb(struct p9_client *c, struct p9_req_t = *req, int status) =20 wake_up(&req->wq); p9_debug(P9_DEBUG_MUX, "wakeup: %d\n", req->tc.tag); - p9_req_put(req); + p9_req_put(c, req); } EXPORT_SYMBOL(p9_client_cb); =20 @@ -708,7 +708,7 @@ static struct p9_req_t *p9_client_prepare_req(struct p9= _client *c, reterr: p9_tag_remove(c, req); /* We have to put also the 2nd reference as it won't be used */ - p9_req_put(req); + p9_req_put(c, req); return ERR_PTR(err); } =20 @@ -745,7 +745,7 @@ p9_client_rpc(struct p9_client *c, int8_t type, const c= har *fmt, ...) err =3D c->trans_mod->request(c, req); if (err < 0) { /* write won't happen */ - p9_req_put(req); + p9_req_put(c, req); if (err !=3D -ERESTARTSYS && err !=3D -EFAULT) c->status =3D Disconnected; goto recalc_sigpending; diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c index 007bbcc68010..c55c8a608bc7 100644 --- a/net/9p/trans_fd.c +++ b/net/9p/trans_fd.c @@ -380,7 +380,7 @@ static void p9_read_work(struct work_struct *work) m->rc.sdata =3D NULL; m->rc.offset =3D 0; m->rc.capacity =3D 0; - p9_req_put(m->rreq); + p9_req_put(m->client, m->rreq); m->rreq =3D NULL; } =20 @@ -494,7 +494,7 @@ static void p9_write_work(struct work_struct *work) m->wpos +=3D err; if (m->wpos =3D=3D m->wsize) { m->wpos =3D m->wsize =3D 0; - p9_req_put(m->wreq); + p9_req_put(m->client, m->wreq); m->wreq =3D NULL; } =20 @@ -697,7 +697,7 @@ static int p9_fd_cancel(struct p9_client *client, struc= t p9_req_t *req) if (req->status =3D=3D REQ_STATUS_UNSENT) { list_del(&req->req_list); req->status =3D REQ_STATUS_FLSHD; - p9_req_put(req); + p9_req_put(client, req); ret =3D 0; } spin_unlock(&client->lock); @@ -724,7 +724,7 @@ static int p9_fd_cancelled(struct p9_client *client, st= ruct p9_req_t *req) list_del(&req->req_list); req->status =3D REQ_STATUS_FLSHD; spin_unlock(&client->lock); - p9_req_put(req); + p9_req_put(client, req); =20 return 0; } @@ -885,12 +885,12 @@ static void p9_conn_destroy(struct p9_conn *m) p9_mux_poll_stop(m); cancel_work_sync(&m->rq); if (m->rreq) { - p9_req_put(m->rreq); + p9_req_put(m->client, m->rreq); m->rreq =3D NULL; } cancel_work_sync(&m->wq); if (m->wreq) { - p9_req_put(m->wreq); + p9_req_put(m->client, m->wreq); m->wreq =3D NULL; } =20 diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c index af0a8a6cd3fd..f6d145873b49 100644 --- a/net/9p/trans_rdma.c +++ b/net/9p/trans_rdma.c @@ -352,7 +352,7 @@ send_done(struct ib_cq *cq, struct ib_wc *wc) c->busa, c->req->tc.size, DMA_TO_DEVICE); up(&rdma->sq_sem); - p9_req_put(c->req); + p9_req_put(client, c->req); kfree(c); } =20 diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index 490a4c900339..d110df3cb4e1 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c @@ -199,7 +199,7 @@ static int p9_virtio_cancel(struct p9_client *client, s= truct p9_req_t *req) /* Reply won't come, so drop req ref */ static int p9_virtio_cancelled(struct p9_client *client, struct p9_req_t *= req) { - p9_req_put(req); + p9_req_put(client, req); return 0; } =20 @@ -523,7 +523,7 @@ p9_virtio_zc_request(struct p9_client *client, struct p= 9_req_t *req, kvfree(out_pages); if (!kicked) { /* reply won't come */ - p9_req_put(req); + p9_req_put(client, req); } return err; } diff --git a/net/9p/trans_xen.c b/net/9p/trans_xen.c index 432ac5a16f2e..427f6caefa29 100644 --- a/net/9p/trans_xen.c +++ b/net/9p/trans_xen.c @@ -186,7 +186,7 @@ static int p9_xen_request(struct p9_client *client, str= uct p9_req_t *p9_req) ring->intf->out_prod =3D prod; spin_unlock_irqrestore(&ring->lock, flags); notify_remote_via_irq(ring->irq); - p9_req_put(p9_req); + p9_req_put(client, p9_req); =20 return 0; } --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72031C00140 for ; Mon, 15 Aug 2022 19:37:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241823AbiHOThF (ORCPT ); Mon, 15 Aug 2022 15:37:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344471AbiHOTba (ORCPT ); Mon, 15 Aug 2022 15:31:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB93961107; Mon, 15 Aug 2022 11:44: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 18E53611E6; Mon, 15 Aug 2022 18:44:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06438C433D7; Mon, 15 Aug 2022 18:44:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589079; bh=BE+qFjw6qKenTUdK2eHcBqM74EQDU1O2m42p5rJePb0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TgjQQcCVsLvueZOEpMlvioDUYxAg42wrH5vD1Nq/xbIb3FkJ6GHNFt7QfUN9wWjBg 9h+UXQ66+Nn7LvrocxrUGuAiQN3dzmUJkDbUCJghTmLj/PYvMzEapnCnLFDu3O1vz9 rJ8S7yLp9M6eAfVJ0PZi2wwD52wRTlvrgzBILNZY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hangyu Hua , Dominique Martinet , Sasha Levin Subject: [PATCH 5.15 607/779] net: 9p: fix refcount leak in p9_read_work() error handling Date: Mon, 15 Aug 2022 20:04:11 +0200 Message-Id: <20220815180403.298006742@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 4ac7573e1f9333073fa8d303acc941c9b7ab7f61 ] p9_req_put need to be called when m->rreq->rc.sdata is NULL to avoid temporary refcount leak. Link: https://lkml.kernel.org/r/20220712104438.30800-1-hbh25y@gmail.com Fixes: 728356dedeff ("9p: Add refcount to p9_req_t") Signed-off-by: Hangyu Hua [Dominique: commit wording adjustments, p9_req_put argument fixes for rebas= e] Signed-off-by: Dominique Martinet Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- net/9p/trans_fd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c index c55c8a608bc7..6fe3719c1fc6 100644 --- a/net/9p/trans_fd.c +++ b/net/9p/trans_fd.c @@ -345,6 +345,7 @@ static void p9_read_work(struct work_struct *work) p9_debug(P9_DEBUG_ERROR, "No recv fcall for tag %d (req %p), disconnecting!\n", m->rc.tag, m->rreq); + p9_req_put(m->client, m->rreq); m->rreq =3D NULL; err =3D -EIO; goto error; --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8464C00140 for ; Mon, 15 Aug 2022 19:37:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245496AbiHOThX (ORCPT ); Mon, 15 Aug 2022 15:37:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344561AbiHOTbg (ORCPT ); Mon, 15 Aug 2022 15:31:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 285152F640; Mon, 15 Aug 2022 11:44:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 471CD6113D; Mon, 15 Aug 2022 18:44:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FDC8C433D6; Mon, 15 Aug 2022 18:44:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589082; bh=f1yBoZdlxrrj+e56t5SpYyY3+I6Cwa8ohg4maem5XqM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mqH34xeb9Ol+4s4K6/JLdFSA2tGyNJioNQ3mkELhx8JxhQGfY3nB9fYbS1YkUaRWH OkLwI9dbt2RMlvypJ7ycC2lMsO2GQF7jdoZ3uYQYd8MUMKEO24jYOlpqVG+kM1zA85 eD4A5FmIchuIbQzQicHP6LBKDDUHrsmwljFbl1gk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , Serge Semin , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.15 608/779] MIPS: Fixed __debug_virt_addr_valid() Date: Mon, 15 Aug 2022 20:04:12 +0200 Message-Id: <20220815180403.346888369@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Fainelli [ Upstream commit 8a2b456665d1e797123669581524cbb095fb003b ] It is permissible for kernel code to call virt_to_phys() against virtual addresses that are in KSEG0 or KSEG1 and we need to be dealing with both types. Rewrite the test condition to ensure that the kernel virtual addresses are above PAGE_OFFSET which they must be, and below KSEG2 where the non-linear mapping starts. For EVA, there is not much that we can do given the linear address range that is offered, so just return any virtual address as being valid. Finally, when HIGHMEM is not enabled, all virtual addresses are assumed to be valid as well. Fixes: dfad83cb7193 ("MIPS: Add support for CONFIG_DEBUG_VIRTUAL") Signed-off-by: Florian Fainelli Reviewed-by: Serge Semin Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/mips/mm/physaddr.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/arch/mips/mm/physaddr.c b/arch/mips/mm/physaddr.c index a1ced5e44951..f9b8c85e9843 100644 --- a/arch/mips/mm/physaddr.c +++ b/arch/mips/mm/physaddr.c @@ -5,6 +5,7 @@ #include #include =20 +#include #include #include #include @@ -12,15 +13,6 @@ =20 static inline bool __debug_virt_addr_valid(unsigned long x) { - /* high_memory does not get immediately defined, and there - * are early callers of __pa() against PAGE_OFFSET - */ - if (!high_memory && x >=3D PAGE_OFFSET) - return true; - - if (high_memory && x >=3D PAGE_OFFSET && x < (unsigned long)high_memory) - return true; - /* * MAX_DMA_ADDRESS is a virtual address that may not correspond to an * actual physical address. Enough code relies on @@ -30,7 +22,9 @@ static inline bool __debug_virt_addr_valid(unsigned long = x) if (x =3D=3D MAX_DMA_ADDRESS) return true; =20 - return false; + return x >=3D PAGE_OFFSET && (KSEGX(x) < KSEG2 || + IS_ENABLED(CONFIG_EVA) || + !IS_ENABLED(CONFIG_HIGHMEM)); } =20 phys_addr_t __virt_to_phys(volatile const void *x) --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 180ABC00140 for ; Mon, 15 Aug 2022 19:37:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245678AbiHOThn (ORCPT ); Mon, 15 Aug 2022 15:37:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344609AbiHOTbi (ORCPT ); Mon, 15 Aug 2022 15:31: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 324502F65F; Mon, 15 Aug 2022 11:44: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 8C72D611E3; Mon, 15 Aug 2022 18:44:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 742E9C433C1; Mon, 15 Aug 2022 18:44:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589085; bh=lFvRoPO0C78WmmkaQwm+/7W0uLsJV+9f16ZbqFOrQcw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mw/gJYhUeTni+DiHr+UZyukEDLbfz9zeQ0LMTBvc4LVFKLvCbuocAHaOA8WOLOaw1 uunynyHCeIYjHoxX5K0X7zHRd1IKcYIV2BtFOTD6v2NstMSS6cR5HjaKXZwkogquaz hh/yqESnCtrTFjFENsTPjhfBA+ecMdJxoV1ZrHlo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 609/779] rpmsg: qcom_smd: Fix refcount leak in qcom_smd_parse_edge Date: Mon, 15 Aug 2022 20:04:13 +0200 Message-Id: <20220815180403.396451137@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 65382585f067d4256ba087934f30f85c9b6984de ] of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when done. Fixes: 53e2822e56c7 ("rpmsg: Introduce Qualcomm SMD backend") Signed-off-by: Miaoqian Lin Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/20220511120737.57374-1-linmq006@gmail.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/rpmsg/qcom_smd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/rpmsg/qcom_smd.c b/drivers/rpmsg/qcom_smd.c index 370688e8646b..c1c07ff39a79 100644 --- a/drivers/rpmsg/qcom_smd.c +++ b/drivers/rpmsg/qcom_smd.c @@ -1380,6 +1380,7 @@ static int qcom_smd_parse_edge(struct device *dev, } =20 edge->ipc_regmap =3D syscon_node_to_regmap(syscon_np); + of_node_put(syscon_np); if (IS_ERR(edge->ipc_regmap)) { ret =3D PTR_ERR(edge->ipc_regmap); goto put_node; --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8ECF6C00140 for ; Mon, 15 Aug 2022 19:37:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245652AbiHOThh (ORCPT ); Mon, 15 Aug 2022 15:37:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344693AbiHOTbn (ORCPT ); Mon, 15 Aug 2022 15:31:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6090161B04; Mon, 15 Aug 2022 11:44: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 AE069611E3; Mon, 15 Aug 2022 18:44:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B4FFDC433C1; Mon, 15 Aug 2022 18:44:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589089; bh=JLzz5dq88jRbBg6ItZt/44TfxmNsOXXimPAGwGAhAmo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SoPct4JZMLuUNTGc/4Db8/W+zkdI9BofFEKmCiZAiW0HP1MF5rDHJMU2tNRY3+TCP +EdtmDHcMNXnapUeEcAFMxy56BAjNeGSOHr2Om8sR9IWnHeNTQJQQ8xy0Z4QZSNYBJ nZjsOWetLwPY+m/GnX8wdH966prnNJaA6vRWOx4E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Stefani Seibold , Randy Dunlap , Andrew Morton , Sasha Levin Subject: [PATCH 5.15 610/779] kfifo: fix kfifo_to_user() return type Date: Mon, 15 Aug 2022 20:04:14 +0200 Message-Id: <20220815180403.437446270@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter [ Upstream commit 045ed31e23aea840648c290dbde04797064960db ] The kfifo_to_user() macro is supposed to return zero for success or negative error codes. Unfortunately, there is a signedness bug so it returns unsigned int. This only affects callers which try to save the result in ssize_t and as far as I can see the only place which does that is line6_hwdep_read(). TL;DR: s/_uint/_int/. Link: https://lkml.kernel.org/r/YrVL3OJVLlNhIMFs@kili Fixes: 144ecf310eb5 ("kfifo: fix kfifo_alloc() to return a signed int value= ") Signed-off-by: Dan Carpenter Cc: Stefani Seibold Cc: Randy Dunlap Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- include/linux/kfifo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h index 86249476b57f..0b35a41440ff 100644 --- a/include/linux/kfifo.h +++ b/include/linux/kfifo.h @@ -688,7 +688,7 @@ __kfifo_uint_must_check_helper( \ * writer, you don't need extra locking to use these macro. */ #define kfifo_to_user(fifo, to, len, copied) \ -__kfifo_uint_must_check_helper( \ +__kfifo_int_must_check_helper( \ ({ \ typeof((fifo) + 1) __tmp =3D (fifo); \ void __user *__to =3D (to); \ --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D5C0C00140 for ; Mon, 15 Aug 2022 19:37:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343604AbiHOTh5 (ORCPT ); Mon, 15 Aug 2022 15:37:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344821AbiHOTbs (ORCPT ); Mon, 15 Aug 2022 15:31:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36AE061B0F; Mon, 15 Aug 2022 11:44: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 9DE2EB81081; Mon, 15 Aug 2022 18:44:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E24A5C433D6; Mon, 15 Aug 2022 18:44:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589092; bh=ZlNZIoT0xcoVZ4uXOg7Rh64aSqYXluwZIxnpm37NvZI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J63gjBUKkqOXjC+II/OPbpsbDuO/xwg1mxUhCugQ0DW/8+EG4aD2gK2O1HgygNREO Qi/znYi6V79FQqy3hORtxRgSf1H5UmVHF8So1/5saSKS4WWMA2q9wMLRZV2qHQUvuH Mv4olWadYy0tvOl9Q83h3NDRuGRTKKv2Q7r2OupE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tetsuo Handa , Thomas Gleixner , Alexandre Chartre , Peter Zijlstra , Andrew Morton , Sasha Levin Subject: [PATCH 5.15 611/779] lib/smp_processor_id: fix imbalanced instrumentation_end() call Date: Mon, 15 Aug 2022 20:04:15 +0200 Message-Id: <20220815180403.490114359@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 bd27acaac24e4b252ee28dddcabaee80456d0faf ] Currently instrumentation_end() won't be called if printk_ratelimit() returned false. Link: https://lkml.kernel.org/r/a636d8e0-ad32-5888-acac-671f7f553bb3@I-love= .SAKURA.ne.jp Fixes: 126f21f0e8d46e2c ("lib/smp_processor_id: Move it into noinstr sectio= n") Signed-off-by: Tetsuo Handa Cc: Thomas Gleixner Cc: Alexandre Chartre Cc: Peter Zijlstra Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- lib/smp_processor_id.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/smp_processor_id.c b/lib/smp_processor_id.c index 046ac6297c78..a2bb7738c373 100644 --- a/lib/smp_processor_id.c +++ b/lib/smp_processor_id.c @@ -47,9 +47,9 @@ unsigned int check_preemption_disabled(const char *what1,= const char *what2) =20 printk("caller is %pS\n", __builtin_return_address(0)); dump_stack(); - instrumentation_end(); =20 out_enable: + instrumentation_end(); preempt_enable_no_resched_notrace(); out: return this_cpu; --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E20BC00140 for ; Mon, 15 Aug 2022 19:38:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343777AbiHOTiC (ORCPT ); Mon, 15 Aug 2022 15:38:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344855AbiHOTbt (ORCPT ); Mon, 15 Aug 2022 15:31:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0B7D61B29; Mon, 15 Aug 2022 11:44: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 508F9611E8; Mon, 15 Aug 2022 18:44:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14FC8C433C1; Mon, 15 Aug 2022 18:44:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589098; bh=aCqRcYrxw2cu4UqoCRRfrKKAKiiP6MJmXbqpsjLOvlM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cyC9hFnFo6kfQ/sib+r1Sr5wE2NC2NuDxSVyI/UqWJO2O6PVJlrldm5uth0oncCI+ B0+7JGLJGguFvKGJds5NDn6WJ0Mw6j4IceUmR0HQNwKFk/puMk5KJ9nSJWG40JaDBq AT0KEQSav9crJwZRMeTR5N/tHV6VuO09v94Y755M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhihao Cheng , Zhang Yi , Brian Foster , Al Viro , Alexey Dobriyan , Eric Biederman , Matthew Wilcox , Baoquan He , Kalesh Singh , Yu Kuai , Andrew Morton , Sasha Levin Subject: [PATCH 5.15 612/779] proc: fix a dentry lock race between release_task and lookup Date: Mon, 15 Aug 2022 20:04:16 +0200 Message-Id: <20220815180403.525826843@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zhihao Cheng [ Upstream commit d919a1e79bac890421537cf02ae773007bf55e6b ] Commit 7bc3e6e55acf06 ("proc: Use a list of inodes to flush from proc") moved proc_flush_task() behind __exit_signal(). Then, process systemd can take long period high cpu usage during releasing task in following concurrent processes: systemd ps kernel_waitid stat(/proc/tgid) do_wait filename_lookup wait_consider_task lookup_fast release_task __exit_signal __unhash_process detach_pid __change_pid // remove task->pid_links d_revalidate -> pid_revalidate // 0 d_invalidate(/proc/tgid) shrink_dcache_parent(/proc/tgid) d_walk(/proc/tgid) spin_lock_nested(/proc/tgid/fd) // iterating opened fd proc_flush_pid | d_invalidate (/proc/tgid/fd) | shrink_dcache_parent(/proc/tgid/fd) | shrink_dentry_list(subdirs) =E2=86=93 shrink_lock_dentry(/proc/tgid/fd) --> race on dentry lock Function d_invalidate() will remove dentry from hash firstly, but why does proc_flush_pid() process dentry '/proc/tgid/fd' before dentry '/proc/tgid'? That's because proc_pid_make_inode() adds proc inode in reverse order by invoking hlist_add_head_rcu(). But proc should not add any inodes under '/proc/tgid' except '/proc/tgid/task/pid', fix it by adding inode into 'pid->inodes' only if the inode is /proc/tgid or /proc/tgid/task/pid. Performance regression: Create 200 tasks, each task open one file for 50,000 times. Kill all tasks when opened files exceed 10,000,000 (cat /proc/sys/fs/file-nr). Before fix: $ time killall -wq aa real 4m40.946s # During this period, we can see 'ps' and 'systemd' taking high cpu usage. After fix: $ time killall -wq aa real 1m20.732s # During this period, we can see 'systemd' taking high cpu usage. Link: https://lkml.kernel.org/r/20220713130029.4133533-1-chengzhihao1@huawe= i.com Fixes: 7bc3e6e55acf06 ("proc: Use a list of inodes to flush from proc") Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D216054 Signed-off-by: Zhihao Cheng Signed-off-by: Zhang Yi Suggested-by: Brian Foster Reviewed-by: Brian Foster Cc: Al Viro Cc: Alexey Dobriyan Cc: Eric Biederman Cc: Matthew Wilcox Cc: Baoquan He Cc: Kalesh Singh Cc: Yu Kuai Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/proc/base.c | 46 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/fs/proc/base.c b/fs/proc/base.c index 1f394095eb88..300d53ee7040 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -1886,7 +1886,7 @@ void proc_pid_evict_inode(struct proc_inode *ei) put_pid(pid); } =20 -struct inode *proc_pid_make_inode(struct super_block * sb, +struct inode *proc_pid_make_inode(struct super_block *sb, struct task_struct *task, umode_t mode) { struct inode * inode; @@ -1915,11 +1915,6 @@ struct inode *proc_pid_make_inode(struct super_block= * sb, =20 /* Let the pid remember us for quick removal */ ei->pid =3D pid; - if (S_ISDIR(mode)) { - spin_lock(&pid->lock); - hlist_add_head_rcu(&ei->sibling_inodes, &pid->inodes); - spin_unlock(&pid->lock); - } =20 task_dump_owner(task, 0, &inode->i_uid, &inode->i_gid); security_task_to_inode(task, inode); @@ -1932,6 +1927,39 @@ struct inode *proc_pid_make_inode(struct super_block= * sb, return NULL; } =20 +/* + * Generating an inode and adding it into @pid->inodes, so that task will + * invalidate inode's dentry before being released. + * + * This helper is used for creating dir-type entries under '/proc' and + * '/proc//task'. Other entries(eg. fd, stat) under '/proc/' + * can be released by invalidating '/proc/' dentry. + * In theory, dentries under '/proc//task' can also be released by + * invalidating '/proc/' dentry, we reserve it to handle single + * thread exiting situation: Any one of threads should invalidate its + * '/proc//task/' dentry before released. + */ +static struct inode *proc_pid_make_base_inode(struct super_block *sb, + struct task_struct *task, umode_t mode) +{ + struct inode *inode; + struct proc_inode *ei; + struct pid *pid; + + inode =3D proc_pid_make_inode(sb, task, mode); + if (!inode) + return NULL; + + /* Let proc_flush_pid find this directory inode */ + ei =3D PROC_I(inode); + pid =3D ei->pid; + spin_lock(&pid->lock); + hlist_add_head_rcu(&ei->sibling_inodes, &pid->inodes); + spin_unlock(&pid->lock); + + return inode; +} + int pid_getattr(struct user_namespace *mnt_userns, const struct path *path, struct kstat *stat, u32 request_mask, unsigned int query_flags) { @@ -3349,7 +3377,8 @@ static struct dentry *proc_pid_instantiate(struct den= try * dentry, { struct inode *inode; =20 - inode =3D proc_pid_make_inode(dentry->d_sb, task, S_IFDIR | S_IRUGO | S_I= XUGO); + inode =3D proc_pid_make_base_inode(dentry->d_sb, task, + S_IFDIR | S_IRUGO | S_IXUGO); if (!inode) return ERR_PTR(-ENOENT); =20 @@ -3648,7 +3677,8 @@ static struct dentry *proc_task_instantiate(struct de= ntry *dentry, struct task_struct *task, const void *ptr) { struct inode *inode; - inode =3D proc_pid_make_inode(dentry->d_sb, task, S_IFDIR | S_IRUGO | S_I= XUGO); + inode =3D proc_pid_make_base_inode(dentry->d_sb, task, + S_IFDIR | S_IRUGO | S_IXUGO); if (!inode) return ERR_PTR(-ENOENT); =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C368CC00140 for ; Mon, 15 Aug 2022 19:38:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343863AbiHOTiG (ORCPT ); Mon, 15 Aug 2022 15:38:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344876AbiHOTbw (ORCPT ); Mon, 15 Aug 2022 15:31:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 188EA61D40; Mon, 15 Aug 2022 11:45: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 65C92611C1; Mon, 15 Aug 2022 18:45:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55881C433C1; Mon, 15 Aug 2022 18:45:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589101; bh=9cdqy1RC1yntKX06V8HA9t5CMzYLghHcz50V6NAkJA8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CR7jqsd81Sa+42LcFjpt1hGrvgiyuxZ6DzFY3coINh2hB8Ud/+JrSWnuhqXlwykSW 4nDTzuD9OJyf7wd3BRVf3VBleb2moBg7rvVvsVvqwzFJgppTjKIRbWZuQTumGNiZ56 M0naaVBiklkz4FgvnZ+0/q7O/EmtwsoJJEXC22pg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Siddharth Gupta , Sibi Sankar , Konrad Dybcio , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 613/779] remoteproc: qcom: pas: Check if coredump is enabled Date: Mon, 15 Aug 2022 20:04:17 +0200 Message-Id: <20220815180403.570623098@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Siddharth Gupta [ Upstream commit 7b6ece968fca4ec9e42d34caff7e06dc84c45717 ] Client drivers need to check if coredump is enabled for the rproc before continuing with coredump generation. This change adds a check in the PAS driver. Fixes: 8ed8485c4f05 ("remoteproc: qcom: Add capability to collect minidumps= ") Signed-off-by: Siddharth Gupta Signed-off-by: Sibi Sankar Reviewed-by: Konrad Dybcio Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/1657022900-2049-5-git-send-email-quic_sibis= @quicinc.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/remoteproc/qcom_q6v5_pas.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q= 6v5_pas.c index 699eaac5b760..78d90d856e40 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -87,6 +87,9 @@ static void adsp_minidump(struct rproc *rproc) { struct qcom_adsp *adsp =3D rproc->priv; =20 + if (rproc->dump_conf =3D=3D RPROC_COREDUMP_DISABLED) + return; + qcom_minidump(rproc, adsp->minidump_id); } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9081C00140 for ; Mon, 15 Aug 2022 19:38:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343902AbiHOTiM (ORCPT ); Mon, 15 Aug 2022 15:38:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244155AbiHOTcH (ORCPT ); Mon, 15 Aug 2022 15:32:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93D3E606A6; Mon, 15 Aug 2022 11:45: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 3D133B81057; Mon, 15 Aug 2022 18:45:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 818BFC433C1; Mon, 15 Aug 2022 18:45:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589104; bh=0uKQ4XlDoVmec3sjjPuLPu/Rai684n2yPKBqpnW4JQ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lHIgNfg0FvvMJpRdK1SdFLFw4FHmV98LiDwcZIuYut4qRMrDpOkTUBklvqgmLRPVJ 5SpTqFKGuTO1uvqiRm1huhner7HayXLm71awcF4xtUijZLPJYWttXfOW9hDBykIWuK Qe0uQmh6Egi2ROh1CUsbXfKblRh99sCwR6Dvc6ik= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthias Kaehlcke , Sibi Sankar , Bjorn Andersson , Sasha Levin Subject: [PATCH 5.15 614/779] remoteproc: sysmon: Wait for SSCTL service to come up Date: Mon, 15 Aug 2022 20:04:18 +0200 Message-Id: <20220815180403.610017606@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sibi Sankar [ Upstream commit 47c04e00eff86a81cd357c3feed04c86089bcb85 ] The SSCTL service comes up after a finite time when the remote Q6 comes out of reset. Any graceful shutdowns requested during this period will be a NOP and abrupt tearing down of the glink channel might lead to pending transactions on the remote Q6 side and will ultimately lead to a fatal error. Fix this by waiting for the SSCTL service when a graceful shutdown is requested. Fixes: 1fb82ee806d1 ("remoteproc: qcom: Introduce sysmon") Reviewed-by: Matthias Kaehlcke Signed-off-by: Sibi Sankar Signed-off-by: Bjorn Andersson Link: https://lore.kernel.org/r/1657022900-2049-7-git-send-email-quic_sibis= @quicinc.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/remoteproc/qcom_sysmon.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/remoteproc/qcom_sysmon.c b/drivers/remoteproc/qcom_sys= mon.c index 9fca81492863..a9f04dd83ab6 100644 --- a/drivers/remoteproc/qcom_sysmon.c +++ b/drivers/remoteproc/qcom_sysmon.c @@ -41,6 +41,7 @@ struct qcom_sysmon { struct completion comp; struct completion ind_comp; struct completion shutdown_comp; + struct completion ssctl_comp; struct mutex lock; =20 bool ssr_ack; @@ -445,6 +446,8 @@ static int ssctl_new_server(struct qmi_handle *qmi, str= uct qmi_service *svc) =20 svc->priv =3D sysmon; =20 + complete(&sysmon->ssctl_comp); + return 0; } =20 @@ -501,6 +504,7 @@ static int sysmon_start(struct rproc_subdev *subdev) .ssr_event =3D SSCTL_SSR_EVENT_AFTER_POWERUP }; =20 + reinit_completion(&sysmon->ssctl_comp); mutex_lock(&sysmon->state_lock); sysmon->state =3D SSCTL_SSR_EVENT_AFTER_POWERUP; blocking_notifier_call_chain(&sysmon_notifiers, 0, (void *)&event); @@ -545,6 +549,11 @@ static void sysmon_stop(struct rproc_subdev *subdev, b= ool crashed) if (crashed) return; =20 + if (sysmon->ssctl_instance) { + if (!wait_for_completion_timeout(&sysmon->ssctl_comp, HZ / 2)) + dev_err(sysmon->dev, "timeout waiting for ssctl service\n"); + } + if (sysmon->ssctl_version) sysmon->shutdown_acked =3D ssctl_request_shutdown(sysmon); else if (sysmon->ept) @@ -631,6 +640,7 @@ struct qcom_sysmon *qcom_add_sysmon_subdev(struct rproc= *rproc, init_completion(&sysmon->comp); init_completion(&sysmon->ind_comp); init_completion(&sysmon->shutdown_comp); + init_completion(&sysmon->ssctl_comp); mutex_init(&sysmon->lock); mutex_init(&sysmon->state_lock); =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6AFBCC25B08 for ; Mon, 15 Aug 2022 19:38:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343978AbiHOTiS (ORCPT ); Mon, 15 Aug 2022 15:38:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245295AbiHOTdi (ORCPT ); Mon, 15 Aug 2022 15:33:38 -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 DEB552F66D; Mon, 15 Aug 2022 11:45: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 sin.source.kernel.org (Postfix) with ESMTPS id 0E652CE1268; Mon, 15 Aug 2022 18:45:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7AE9FC433C1; Mon, 15 Aug 2022 18:45:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589108; bh=hyTcSWCJpM8XrR++nPsIwaPrLzF9BBedKqDgX0Srn/w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gL7gjqLxHpY35BkAoIfDf1azK9BeArQPr6Fw1GzPzfxb6TlA1jYt1Mse3VdT6LW1r /0OvxofTjJKEbAtKltJIARn4fkGfQZNGDoaPrLS9lXdFk2J6qzj6g3ppLh6lU6a2WW esxBHOnqGGOT6Ha5k+oG6lFaQ5guYlntPJ1LD3yM= 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?= , Lee Jones , Sasha Levin Subject: [PATCH 5.15 615/779] mfd: t7l66xb: Drop platform disable callback Date: Mon, 15 Aug 2022 20:04:19 +0200 Message-Id: <20220815180403.651006449@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Uwe Kleine-K=C3=B6nig [ Upstream commit 128ac294e1b437cb8a7f2ff8ede1cde9082bddbe ] None of the in-tree instantiations of struct t7l66xb_platform_data provides a disable callback. So better don't dereference this function pointer unconditionally. As there is no user, drop it completely instead of calling it conditional. This is a preparation for making platform remove callbacks return void. Fixes: 1f192015ca5b ("mfd: driver for the T7L66XB TMIO SoC") Signed-off-by: Uwe Kleine-K=C3=B6nig Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20220530192430.2108217-3-u.kleine-koenig@pe= ngutronix.de Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/mfd/t7l66xb.c | 6 +----- include/linux/mfd/t7l66xb.h | 1 - 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/mfd/t7l66xb.c b/drivers/mfd/t7l66xb.c index 5369c67e3280..663ffd4b8570 100644 --- a/drivers/mfd/t7l66xb.c +++ b/drivers/mfd/t7l66xb.c @@ -397,11 +397,8 @@ static int t7l66xb_probe(struct platform_device *dev) =20 static int t7l66xb_remove(struct platform_device *dev) { - struct t7l66xb_platform_data *pdata =3D dev_get_platdata(&dev->dev); struct t7l66xb *t7l66xb =3D platform_get_drvdata(dev); - int ret; =20 - ret =3D pdata->disable(dev); clk_disable_unprepare(t7l66xb->clk48m); clk_put(t7l66xb->clk48m); clk_disable_unprepare(t7l66xb->clk32k); @@ -412,8 +409,7 @@ static int t7l66xb_remove(struct platform_device *dev) mfd_remove_devices(&dev->dev); kfree(t7l66xb); =20 - return ret; - + return 0; } =20 static struct platform_driver t7l66xb_platform_driver =3D { diff --git a/include/linux/mfd/t7l66xb.h b/include/linux/mfd/t7l66xb.h index 69632c1b07bd..ae3e7a5c5219 100644 --- a/include/linux/mfd/t7l66xb.h +++ b/include/linux/mfd/t7l66xb.h @@ -12,7 +12,6 @@ =20 struct t7l66xb_platform_data { int (*enable)(struct platform_device *dev); - int (*disable)(struct platform_device *dev); int (*suspend)(struct platform_device *dev); int (*resume)(struct platform_device *dev); =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BFD9C00140 for ; Mon, 15 Aug 2022 19:38:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344077AbiHOTi2 (ORCPT ); Mon, 15 Aug 2022 15:38:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245510AbiHOTdt (ORCPT ); Mon, 15 Aug 2022 15:33: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 38E9424B; Mon, 15 Aug 2022 11:45: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 91898B8105C; Mon, 15 Aug 2022 18:45:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CCC74C433D6; Mon, 15 Aug 2022 18:45:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589111; bh=9aFWhDb0sLjSYCbmI8Iu1nyBKM24DyHPC+Y0uMpBoEI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XlAllnD9/w6QbJYCgNaAvb9rj3nDdGwdFbhkWRuVMnualxhCXHzyosqBCDnGsLHKp eQBpjdfI82Cu1a+L8MeIGxV7JovSYe5+zewX8EqGw7i1+/w6ZFBqungz+xOqDqBute Kvdj+B6ReVIZa1mwe6UGuQUSVImH1GaKn4PrTUZg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Krzysztof Kozlowski , Lee Jones , Sasha Levin Subject: [PATCH 5.15 616/779] mfd: max77620: Fix refcount leak in max77620_initialise_fps Date: Mon, 15 Aug 2022 20:04:20 +0200 Message-Id: <20220815180403.700238951@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 1520669c8255bd637c6b248b2be910e2688d38dd ] of_get_child_by_name() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: 327156c59360 ("mfd: max77620: Add core driver for MAX77620/MAX20024") Signed-off-by: Miaoqian Lin Reviewed-by: Krzysztof Kozlowski Signed-off-by: Lee Jones Link: https://lore.kernel.org/r/20220601043222.64441-1-linmq006@gmail.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/mfd/max77620.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/mfd/max77620.c b/drivers/mfd/max77620.c index fec2096474ad..a6661e07035b 100644 --- a/drivers/mfd/max77620.c +++ b/drivers/mfd/max77620.c @@ -419,9 +419,11 @@ static int max77620_initialise_fps(struct max77620_chi= p *chip) ret =3D max77620_config_fps(chip, fps_child); if (ret < 0) { of_node_put(fps_child); + of_node_put(fps_np); return ret; } } + of_node_put(fps_np); =20 config =3D chip->enable_global_lpm ? MAX77620_ONOFFCNFG2_SLP_LPM_MSK : 0; ret =3D regmap_update_bits(chip->rmap, MAX77620_REG_ONOFFCNFG2, --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 582D2C00140 for ; Mon, 15 Aug 2022 19:38:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344128AbiHOTib (ORCPT ); Mon, 15 Aug 2022 15:38:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245576AbiHOTdu (ORCPT ); Mon, 15 Aug 2022 15:33:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D62EB10A1; Mon, 15 Aug 2022 11:45: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 D00A3611E4; Mon, 15 Aug 2022 18:45:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA871C4314B; Mon, 15 Aug 2022 18:45:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589114; bh=SFI2MM/IZGUbUrOQF7HrsxzLRHIiI8peA5d7xXudR4E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2M3CH2dAwnahnm7v+Ic0fSK7NP88OS2ZR7ELVK2VuJXHD8zaHcuimIvLVOZx+dGtD Lq1Cvk+w+4F8V7r9CzY2I88fQhHBWitMiBZzgKDj0b27uLko/nm7Clv4lMQflpWLPi ySuc8N9wGZ1+ML+6i1pzG26NcgDhMC4bSikYxD4w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Will Deacon , Sasha Levin Subject: [PATCH 5.15 617/779] iommu/arm-smmu: qcom_iommu: Add of_node_put() when breaking out of loop Date: Mon, 15 Aug 2022 20:04:21 +0200 Message-Id: <20220815180403.739053904@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit a91eb6803c1c715738682fece095145cbd68fe0b ] In qcom_iommu_has_secure_context(), we should call of_node_put() for the reference 'child' when breaking out of for_each_child_of_node() which will automatically increase and decrease the refcount. Fixes: d051f28c8807 ("iommu/qcom: Initialize secure page table") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220719124955.1242171-1-windhl@126.com Signed-off-by: Will Deacon Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/iommu/arm/arm-smmu/qcom_iommu.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/iommu/arm/arm-smmu/qcom_iommu.c b/drivers/iommu/arm/ar= m-smmu/qcom_iommu.c index b91874cb6cf3..a47cb654b704 100644 --- a/drivers/iommu/arm/arm-smmu/qcom_iommu.c +++ b/drivers/iommu/arm/arm-smmu/qcom_iommu.c @@ -748,9 +748,12 @@ static bool qcom_iommu_has_secure_context(struct qcom_= iommu_dev *qcom_iommu) { struct device_node *child; =20 - for_each_child_of_node(qcom_iommu->dev->of_node, child) - if (of_device_is_compatible(child, "qcom,msm-iommu-v1-sec")) + for_each_child_of_node(qcom_iommu->dev->of_node, child) { + if (of_device_is_compatible(child, "qcom,msm-iommu-v1-sec")) { + of_node_put(child); return true; + } + } =20 return false; } --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4845EC00140 for ; Mon, 15 Aug 2022 19:38:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344145AbiHOTif (ORCPT ); Mon, 15 Aug 2022 15:38:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245185AbiHOTeI (ORCPT ); Mon, 15 Aug 2022 15:34: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 9210DB1FD; Mon, 15 Aug 2022 11:45:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B7E9F611E8; Mon, 15 Aug 2022 18:45:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA547C433D7; Mon, 15 Aug 2022 18:45:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589117; bh=OaTRRyi9soEAGUwezZ6afXq9Tx652YqDV8+1EJl6L4w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OVgYaqYpkGTQJnjtfC4vuzlxPsnUebLINnnq+qFOJVXnCwJ82HC27qcXyVoOK757O mlzArjpr6zjSsPK3d1Kfx3wjv2IZbmrmdMHneuquLQ06ag99nwo2kzt+wCvUizYxxJ ENotdOj9DrK5h9qeyJLmoCMpQsH6EnvJXCGN65Fg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adrian Hunter , Andi Kleen , Ian Rogers , Jiri Olsa , kvm@vger.kernel.org, Namhyung Kim , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.15 618/779] perf tools: Fix dso_id inode generation comparison Date: Mon, 15 Aug 2022 20:04:22 +0200 Message-Id: <20220815180403.780906129@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Adrian Hunter [ Upstream commit 68566a7cf56bf3148797c218ed45a9de078ef47c ] Synthesized MMAP events have zero ino_generation, so do not compare them to DSOs with a real ino_generation otherwise we end up with a DSO without a build id. Fixes: 0e3149f86b99ddab ("perf dso: Move dso_id from 'struct map' to 'struc= t dso'") Signed-off-by: Adrian Hunter Cc: Andi Kleen Cc: Ian Rogers Cc: Jiri Olsa Cc: kvm@vger.kernel.org Cc: Namhyung Kim Link: https://lore.kernel.org/r/20220711093218.10967-2-adrian.hunter@intel.= com [ Added clarification to the comment from Ian + more detailed explanation f= rom Adrian ] Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- tools/perf/util/dsos.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/dsos.c b/tools/perf/util/dsos.c index 183a81d5b2f9..2db91121bdaf 100644 --- a/tools/perf/util/dsos.c +++ b/tools/perf/util/dsos.c @@ -20,8 +20,19 @@ static int __dso_id__cmp(struct dso_id *a, struct dso_id= *b) if (a->ino > b->ino) return -1; if (a->ino < b->ino) return 1; =20 - if (a->ino_generation > b->ino_generation) return -1; - if (a->ino_generation < b->ino_generation) return 1; + /* + * Synthesized MMAP events have zero ino_generation, avoid comparing + * them with MMAP events with actual ino_generation. + * + * I found it harmful because the mismatch resulted in a new + * dso that did not have a build ID whereas the original dso did have a + * build ID. The build ID was essential because the object was not found + * otherwise. - Adrian + */ + if (a->ino_generation && b->ino_generation) { + if (a->ino_generation > b->ino_generation) return -1; + if (a->ino_generation < b->ino_generation) return 1; + } =20 return 0; } --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91E88C00140 for ; Mon, 15 Aug 2022 19:38:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344157AbiHOTii (ORCPT ); Mon, 15 Aug 2022 15:38:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244181AbiHOTef (ORCPT ); Mon, 15 Aug 2022 15:34:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 416CEE60; Mon, 15 Aug 2022 11:45: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 C5C6C611C1; Mon, 15 Aug 2022 18:45:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD959C433D6; Mon, 15 Aug 2022 18:45:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589120; bh=66U9M5aFiEG9ZonRvU6aDKIvHi2Duefgh838xmhafKs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G3R4RAA72bzrXVIFsB6TJKrqlWBozTgTTS/sHyrk0NZAM7U+b0MW4vGVOWr5vrryx 3zsCaLFXrDvvBCzP8LjVqKG5cknq15qt0w2GV8w2syq+yrSh8FW3r2w4MbLF9RX3Xt wMT3aOCKTjIBSCbowok0O+Q7mr41E3f/qXdp9tWs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiko Carstens , Alexander Gordeev , Vasily Gorbik , Sasha Levin Subject: [PATCH 5.15 619/779] s390/dump: fix old lowcore virtual vs physical address confusion Date: Mon, 15 Aug 2022 20:04:23 +0200 Message-Id: <20220815180403.828592726@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Gordeev [ Upstream commit dc306186a130c6d9feb0aabc1c71b8ed1674a3bf ] Virtual addresses of vmcore_info and os_info members are wrongly passed to copy_oldmem_kernel(), while the function expects physical address of the source. Instead, __pa() macro should have been applied. Yet, use of __pa() macro could be somehow confusing, since copy_oldmem_kernel() may treat the source as an offset, not as a direct physical address (that depens from the oldmem availability and location). Fix the virtual vs physical address confusion and make the way the old lowcore is read consistent across all sources. Reviewed-by: Heiko Carstens Signed-off-by: Alexander Gordeev Signed-off-by: Vasily Gorbik Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/s390/kernel/asm-offsets.c | 2 ++ arch/s390/kernel/crash_dump.c | 2 +- arch/s390/kernel/os_info.c | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/s390/kernel/asm-offsets.c b/arch/s390/kernel/asm-offsets.c index b57da9338588..9242d7ad71e7 100644 --- a/arch/s390/kernel/asm-offsets.c +++ b/arch/s390/kernel/asm-offsets.c @@ -128,6 +128,8 @@ int main(void) OFFSET(__LC_BR_R1, lowcore, br_r1_trampoline); /* software defined ABI-relevant lowcore locations 0xe00 - 0xe20 */ OFFSET(__LC_DUMP_REIPL, lowcore, ipib); + OFFSET(__LC_VMCORE_INFO, lowcore, vmcore_info); + OFFSET(__LC_OS_INFO, lowcore, os_info); /* hardware defined lowcore locations 0x1000 - 0x18ff */ OFFSET(__LC_MCESAD, lowcore, mcesad); OFFSET(__LC_EXT_PARAMS2, lowcore, ext_params2); diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c index 785d54c9350c..9c2597be28dc 100644 --- a/arch/s390/kernel/crash_dump.c +++ b/arch/s390/kernel/crash_dump.c @@ -432,7 +432,7 @@ static void *get_vmcoreinfo_old(unsigned long *size) Elf64_Nhdr note; void *addr; =20 - if (copy_oldmem_kernel(&addr, &S390_lowcore.vmcore_info, sizeof(addr))) + if (copy_oldmem_kernel(&addr, (void *)__LC_VMCORE_INFO, sizeof(addr))) return NULL; memset(nt_name, 0, sizeof(nt_name)); if (copy_oldmem_kernel(¬e, addr, sizeof(note))) diff --git a/arch/s390/kernel/os_info.c b/arch/s390/kernel/os_info.c index 4bef35b79b93..198f9694e439 100644 --- a/arch/s390/kernel/os_info.c +++ b/arch/s390/kernel/os_info.c @@ -15,6 +15,7 @@ #include #include #include +#include =20 /* * OS info structure has to be page aligned @@ -123,7 +124,7 @@ static void os_info_old_init(void) return; if (!oldmem_data.start) goto fail; - if (copy_oldmem_kernel(&addr, &S390_lowcore.os_info, sizeof(addr))) + if (copy_oldmem_kernel(&addr, (void *)__LC_OS_INFO, sizeof(addr))) goto fail; if (addr =3D=3D 0 || addr % PAGE_SIZE) goto fail; --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C27CBC00140 for ; Mon, 15 Aug 2022 19:38:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344176AbiHOTio (ORCPT ); Mon, 15 Aug 2022 15:38:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245322AbiHOTe6 (ORCPT ); Mon, 15 Aug 2022 15:34:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C76C2FD0B; Mon, 15 Aug 2022 11:45:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7DB86B8105C; Mon, 15 Aug 2022 18:45:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0198C433D7; Mon, 15 Aug 2022 18:45:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589123; bh=WKxmQw5pSQ28FOzZrvEX54gflyZ++1SZChqQlk4GO/s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u/Oedxpmmq8U4vbGJWPZpTxDE8nvpUtYr5C//6IDv86UAVAjVxqCb6vqkEsxpgvL2 KmPc1/LBxpR4XkzU6hn3iE8AxZVZu+5FCbeQxqrihETJBi5dGxb5TMPAwV54Zjn+n1 L4YjALbvH0dFtiTK/HH87DKVbwSvUS4SouR3gHhk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiko Carstens , Alexander Gordeev , Vasily Gorbik , Sasha Levin Subject: [PATCH 5.15 620/779] s390/maccess: fix semantics of memcpy_real() and its callers Date: Mon, 15 Aug 2022 20:04:24 +0200 Message-Id: <20220815180403.880300415@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Gordeev [ Upstream commit 303fd988ed644c7daa260410f3ac99266573557d ] There is a confusion with regard to the source address of memcpy_real() and calling functions. While the declared type for a source assumes a virtual address, in fact it always called with physical address of the source. This confusion led to bugs in copy_oldmem_kernel() and copy_oldmem_user() functions, where __pa() macro applied mistakenly to physical addresses. It does not lead to a real issue, since virtual and physical addresses are currently the same. Fix both the bugs and memcpy_real() prototype by making type of source address consistent to the function name and the way it actually used. Reviewed-by: Heiko Carstens Signed-off-by: Alexander Gordeev Signed-off-by: Vasily Gorbik Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/s390/include/asm/os_info.h | 2 +- arch/s390/include/asm/processor.h | 2 +- arch/s390/include/asm/uaccess.h | 2 +- arch/s390/kernel/crash_dump.c | 58 +++++++++++++++---------------- arch/s390/kernel/os_info.c | 7 ++-- arch/s390/kernel/smp.c | 2 +- arch/s390/mm/maccess.c | 4 +-- drivers/s390/char/zcore.c | 3 +- 8 files changed, 38 insertions(+), 42 deletions(-) diff --git a/arch/s390/include/asm/os_info.h b/arch/s390/include/asm/os_inf= o.h index 3c89279d2a4b..147a8d547ef9 100644 --- a/arch/s390/include/asm/os_info.h +++ b/arch/s390/include/asm/os_info.h @@ -39,7 +39,7 @@ u32 os_info_csum(struct os_info *os_info); =20 #ifdef CONFIG_CRASH_DUMP void *os_info_old_entry(int nr, unsigned long *size); -int copy_oldmem_kernel(void *dst, void *src, size_t count); +int copy_oldmem_kernel(void *dst, unsigned long src, size_t count); #else static inline void *os_info_old_entry(int nr, unsigned long *size) { diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/proc= essor.h index 879b8e3f609c..e9db8efd50f2 100644 --- a/arch/s390/include/asm/processor.h +++ b/arch/s390/include/asm/processor.h @@ -318,7 +318,7 @@ extern void (*s390_base_pgm_handler_fn)(void); =20 #define ARCH_LOW_ADDRESS_LIMIT 0x7fffffffUL =20 -extern int memcpy_real(void *, void *, size_t); +extern int memcpy_real(void *, unsigned long, size_t); extern void memcpy_absolute(void *, void *, size_t); =20 #define mem_assign_absolute(dest, val) do { \ diff --git a/arch/s390/include/asm/uaccess.h b/arch/s390/include/asm/uacces= s.h index ce550d06abc3..3379694e9a42 100644 --- a/arch/s390/include/asm/uaccess.h +++ b/arch/s390/include/asm/uaccess.h @@ -245,7 +245,7 @@ static inline unsigned long __must_check clear_user(voi= d __user *to, unsigned lo return __clear_user(to, n); } =20 -int copy_to_user_real(void __user *dest, void *src, unsigned long count); +int copy_to_user_real(void __user *dest, unsigned long src, unsigned long = count); void *s390_kernel_write(void *dst, const void *src, size_t size); =20 #define HAVE_GET_KERNEL_NOFAULT diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c index 9c2597be28dc..199f136d1644 100644 --- a/arch/s390/kernel/crash_dump.c +++ b/arch/s390/kernel/crash_dump.c @@ -132,28 +132,27 @@ static inline void *load_real_addr(void *addr) /* * Copy memory of the old, dumped system to a kernel space virtual address */ -int copy_oldmem_kernel(void *dst, void *src, size_t count) +int copy_oldmem_kernel(void *dst, unsigned long src, size_t count) { - unsigned long from, len; + unsigned long len; void *ra; int rc; =20 while (count) { - from =3D __pa(src); - if (!oldmem_data.start && from < sclp.hsa_size) { + if (!oldmem_data.start && src < sclp.hsa_size) { /* Copy from zfcp/nvme dump HSA area */ - len =3D min(count, sclp.hsa_size - from); - rc =3D memcpy_hsa_kernel(dst, from, len); + len =3D min(count, sclp.hsa_size - src); + rc =3D memcpy_hsa_kernel(dst, src, len); if (rc) return rc; } else { /* Check for swapped kdump oldmem areas */ - if (oldmem_data.start && from - oldmem_data.start < oldmem_data.size) { - from -=3D oldmem_data.start; - len =3D min(count, oldmem_data.size - from); - } else if (oldmem_data.start && from < oldmem_data.size) { - len =3D min(count, oldmem_data.size - from); - from +=3D oldmem_data.start; + if (oldmem_data.start && src - oldmem_data.start < oldmem_data.size) { + src -=3D oldmem_data.start; + len =3D min(count, oldmem_data.size - src); + } else if (oldmem_data.start && src < oldmem_data.size) { + len =3D min(count, oldmem_data.size - src); + src +=3D oldmem_data.start; } else { len =3D count; } @@ -163,7 +162,7 @@ int copy_oldmem_kernel(void *dst, void *src, size_t cou= nt) } else { ra =3D dst; } - if (memcpy_real(ra, (void *) from, len)) + if (memcpy_real(ra, src, len)) return -EFAULT; } dst +=3D len; @@ -176,31 +175,30 @@ int copy_oldmem_kernel(void *dst, void *src, size_t c= ount) /* * Copy memory of the old, dumped system to a user space virtual address */ -static int copy_oldmem_user(void __user *dst, void *src, size_t count) +static int copy_oldmem_user(void __user *dst, unsigned long src, size_t co= unt) { - unsigned long from, len; + unsigned long len; int rc; =20 while (count) { - from =3D __pa(src); - if (!oldmem_data.start && from < sclp.hsa_size) { + if (!oldmem_data.start && src < sclp.hsa_size) { /* Copy from zfcp/nvme dump HSA area */ - len =3D min(count, sclp.hsa_size - from); - rc =3D memcpy_hsa_user(dst, from, len); + len =3D min(count, sclp.hsa_size - src); + rc =3D memcpy_hsa_user(dst, src, len); if (rc) return rc; } else { /* Check for swapped kdump oldmem areas */ - if (oldmem_data.start && from - oldmem_data.start < oldmem_data.size) { - from -=3D oldmem_data.start; - len =3D min(count, oldmem_data.size - from); - } else if (oldmem_data.start && from < oldmem_data.size) { - len =3D min(count, oldmem_data.size - from); - from +=3D oldmem_data.start; + if (oldmem_data.start && src - oldmem_data.start < oldmem_data.size) { + src -=3D oldmem_data.start; + len =3D min(count, oldmem_data.size - src); + } else if (oldmem_data.start && src < oldmem_data.size) { + len =3D min(count, oldmem_data.size - src); + src +=3D oldmem_data.start; } else { len =3D count; } - rc =3D copy_to_user_real(dst, (void *) from, count); + rc =3D copy_to_user_real(dst, src, count); if (rc) return rc; } @@ -217,12 +215,12 @@ static int copy_oldmem_user(void __user *dst, void *s= rc, size_t count) ssize_t copy_oldmem_page(unsigned long pfn, char *buf, size_t csize, unsigned long offset, int userbuf) { - void *src; + unsigned long src; int rc; =20 if (!csize) return 0; - src =3D (void *) (pfn << PAGE_SHIFT) + offset; + src =3D pfn_to_phys(pfn) + offset; if (userbuf) rc =3D copy_oldmem_user((void __force __user *) buf, src, csize); else @@ -429,10 +427,10 @@ static void *nt_prpsinfo(void *ptr) static void *get_vmcoreinfo_old(unsigned long *size) { char nt_name[11], *vmcoreinfo; + unsigned long addr; Elf64_Nhdr note; - void *addr; =20 - if (copy_oldmem_kernel(&addr, (void *)__LC_VMCORE_INFO, sizeof(addr))) + if (copy_oldmem_kernel(&addr, __LC_VMCORE_INFO, sizeof(addr))) return NULL; memset(nt_name, 0, sizeof(nt_name)); if (copy_oldmem_kernel(¬e, addr, sizeof(note))) diff --git a/arch/s390/kernel/os_info.c b/arch/s390/kernel/os_info.c index 198f9694e439..e548844dde28 100644 --- a/arch/s390/kernel/os_info.c +++ b/arch/s390/kernel/os_info.c @@ -91,7 +91,7 @@ static void os_info_old_alloc(int nr, int align) goto fail; } buf_align =3D PTR_ALIGN(buf, align); - if (copy_oldmem_kernel(buf_align, (void *) addr, size)) { + if (copy_oldmem_kernel(buf_align, addr, size)) { msg =3D "copy failed"; goto fail_free; } @@ -124,15 +124,14 @@ static void os_info_old_init(void) return; if (!oldmem_data.start) goto fail; - if (copy_oldmem_kernel(&addr, (void *)__LC_OS_INFO, sizeof(addr))) + if (copy_oldmem_kernel(&addr, __LC_OS_INFO, sizeof(addr))) goto fail; if (addr =3D=3D 0 || addr % PAGE_SIZE) goto fail; os_info_old =3D kzalloc(sizeof(*os_info_old), GFP_KERNEL); if (!os_info_old) goto fail; - if (copy_oldmem_kernel(os_info_old, (void *) addr, - sizeof(*os_info_old))) + if (copy_oldmem_kernel(os_info_old, addr, sizeof(*os_info_old))) goto fail_free; if (os_info_old->magic !=3D OS_INFO_MAGIC) goto fail_free; diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index 1a04e5bdf655..e57eb2260b90 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c @@ -675,7 +675,7 @@ static __init void smp_save_cpu_regs(struct save_area *= sa, u16 addr, void *regs =3D (void *) page; =20 if (is_boot_cpu) - copy_oldmem_kernel(regs, (void *) __LC_FPREGS_SAVE_AREA, 512); + copy_oldmem_kernel(regs, __LC_FPREGS_SAVE_AREA, 512); else __pcpu_sigp_relax(addr, SIGP_STORE_STATUS_AT_ADDRESS, page); save_area_add_regs(sa, regs); diff --git a/arch/s390/mm/maccess.c b/arch/s390/mm/maccess.c index 9663ce3625bc..2ed198b4f7d0 100644 --- a/arch/s390/mm/maccess.c +++ b/arch/s390/mm/maccess.c @@ -123,7 +123,7 @@ static unsigned long __no_sanitize_address _memcpy_real= (unsigned long dest, /* * Copy memory in real mode (kernel to kernel) */ -int memcpy_real(void *dest, void *src, size_t count) +int memcpy_real(void *dest, unsigned long src, size_t count) { unsigned long _dest =3D (unsigned long)dest; unsigned long _src =3D (unsigned long)src; @@ -175,7 +175,7 @@ void memcpy_absolute(void *dest, void *src, size_t coun= t) /* * Copy memory from kernel (real) to user (virtual) */ -int copy_to_user_real(void __user *dest, void *src, unsigned long count) +int copy_to_user_real(void __user *dest, unsigned long src, unsigned long = count) { int offs =3D 0, size, rc; char *buf; diff --git a/drivers/s390/char/zcore.c b/drivers/s390/char/zcore.c index 3ba2d934a3e8..516783ba950f 100644 --- a/drivers/s390/char/zcore.c +++ b/drivers/s390/char/zcore.c @@ -229,8 +229,7 @@ static int __init zcore_reipl_init(void) rc =3D memcpy_hsa_kernel(zcore_ipl_block, ipib_info.ipib, PAGE_SIZE); else - rc =3D memcpy_real(zcore_ipl_block, (void *) ipib_info.ipib, - PAGE_SIZE); + rc =3D memcpy_real(zcore_ipl_block, ipib_info.ipib, PAGE_SIZE); if (rc || (__force u32)csum_partial(zcore_ipl_block, zcore_ipl_block->hdr= .len, 0) !=3D ipib_info.checksum) { TRACE("Checksum does not match\n"); --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 954A3C25B0E for ; Mon, 15 Aug 2022 19:38:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245326AbiHOTir (ORCPT ); Mon, 15 Aug 2022 15:38:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245755AbiHOTfM (ORCPT ); Mon, 15 Aug 2022 15:35:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03E2F13E23; Mon, 15 Aug 2022 11:45: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 DE279611C1; Mon, 15 Aug 2022 18:45:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3837C433D7; Mon, 15 Aug 2022 18:45:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589126; bh=ezq9bND8emS5xMQV7ZmKm2wM1mVM8Yl7j5xThVo+uFE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=coKxv9tMgHJnYTEqTre5wosSKgvRBq3iwNXpOPeqhojCT2bZ+usUvDCTVAwyJhT31 MW3DxMT/ObjKuUWV1wdbfaqRXdFReJvBzpKSj9pdaT01xMiteBJzyIQzZdOn4CDZvx RcOp7rycApHcz5BLEsFFdqAHmMvOWyIOwpCUyMeM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthew Wilcox , Alexander Gordeev , Sasha Levin Subject: [PATCH 5.15 621/779] s390/crash: fix incorrect number of bytes to copy to user space Date: Mon, 15 Aug 2022 20:04:25 +0200 Message-Id: <20220815180403.929995313@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Gordeev [ Upstream commit f6749da17a34eb08c9665f072ce7c812ff68aad2 ] The number of bytes in a chunk is correctly calculated, but instead the total number of bytes is passed to copy_to_user_real() function. Reported-by: Matthew Wilcox Fixes: df9694c7975f ("s390/dump: streamline oldmem copy functions") Signed-off-by: Alexander Gordeev Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/s390/kernel/crash_dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/s390/kernel/crash_dump.c b/arch/s390/kernel/crash_dump.c index 199f136d1644..f17ad2daab07 100644 --- a/arch/s390/kernel/crash_dump.c +++ b/arch/s390/kernel/crash_dump.c @@ -198,7 +198,7 @@ static int copy_oldmem_user(void __user *dst, unsigned = long src, size_t count) } else { len =3D count; } - rc =3D copy_to_user_real(dst, src, count); + rc =3D copy_to_user_real(dst, src, len); if (rc) return rc; } --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0DEAC00140 for ; Mon, 15 Aug 2022 19:39:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244398AbiHOTjB (ORCPT ); Mon, 15 Aug 2022 15:39:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343567AbiHOTfT (ORCPT ); Mon, 15 Aug 2022 15:35:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 655F52C106; Mon, 15 Aug 2022 11:45:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3FAEC611C1; Mon, 15 Aug 2022 18:45:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 447F8C433D6; Mon, 15 Aug 2022 18:45:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589132; bh=mQCrq2ntPhCcnbK41SusLBAMdtiHg3E1dAxiOPm3NqU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0bEho7NGW93XSDxOcQ76m3UDyWGP5IlSmLVofIas/jwIRlXHeULA+caJbKpnCaPDN yDybB46avztVk0MzGFPGGUbfE9vKEZyo8YckW0BGWX/r5UO5mR9qUDikvn/SIZTWZx NjHWV839brwPQl5fe2AwBPTQ1Q1ugWQ/NarXo4tA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Matthew Wilcox , Heiko Carstens , Alexander Egorenkov , Alexander Gordeev , Sasha Levin Subject: [PATCH 5.15 622/779] s390/zcore: fix race when reading from hardware system area Date: Mon, 15 Aug 2022 20:04:26 +0200 Message-Id: <20220815180403.978669981@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Gordeev [ Upstream commit 9ffed254d938c9e99eb7761c7f739294c84e0367 ] Memory buffer used for reading out data from hardware system area is not protected against concurrent access. Reported-by: Matthew Wilcox Fixes: 411ed3225733 ("[S390] zfcpdump support.") Acked-by: Heiko Carstens Tested-by: Alexander Egorenkov Link: https://lore.kernel.org/r/e68137f0f9a0d2558f37becc20af18e2939934f6.16= 58206891.git.agordeev@linux.ibm.com Signed-off-by: Alexander Gordeev Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/s390/char/zcore.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/s390/char/zcore.c b/drivers/s390/char/zcore.c index 516783ba950f..92b32ce645b9 100644 --- a/drivers/s390/char/zcore.c +++ b/drivers/s390/char/zcore.c @@ -50,6 +50,7 @@ static struct dentry *zcore_reipl_file; static struct dentry *zcore_hsa_file; static struct ipl_parameter_block *zcore_ipl_block; =20 +static DEFINE_MUTEX(hsa_buf_mutex); static char hsa_buf[PAGE_SIZE] __aligned(PAGE_SIZE); =20 /* @@ -66,19 +67,24 @@ int memcpy_hsa_user(void __user *dest, unsigned long sr= c, size_t count) if (!hsa_available) return -ENODATA; =20 + mutex_lock(&hsa_buf_mutex); while (count) { if (sclp_sdias_copy(hsa_buf, src / PAGE_SIZE + 2, 1)) { TRACE("sclp_sdias_copy() failed\n"); + mutex_unlock(&hsa_buf_mutex); return -EIO; } offset =3D src % PAGE_SIZE; bytes =3D min(PAGE_SIZE - offset, count); - if (copy_to_user(dest, hsa_buf + offset, bytes)) + if (copy_to_user(dest, hsa_buf + offset, bytes)) { + mutex_unlock(&hsa_buf_mutex); return -EFAULT; + } src +=3D bytes; dest +=3D bytes; count -=3D bytes; } + mutex_unlock(&hsa_buf_mutex); return 0; } =20 @@ -96,9 +102,11 @@ int memcpy_hsa_kernel(void *dest, unsigned long src, si= ze_t count) if (!hsa_available) return -ENODATA; =20 + mutex_lock(&hsa_buf_mutex); while (count) { if (sclp_sdias_copy(hsa_buf, src / PAGE_SIZE + 2, 1)) { TRACE("sclp_sdias_copy() failed\n"); + mutex_unlock(&hsa_buf_mutex); return -EIO; } offset =3D src % PAGE_SIZE; @@ -108,6 +116,7 @@ int memcpy_hsa_kernel(void *dest, unsigned long src, si= ze_t count) dest +=3D bytes; count -=3D bytes; } + mutex_unlock(&hsa_buf_mutex); return 0; } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 094BCC00140 for ; Mon, 15 Aug 2022 19:39:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344308AbiHOTjs (ORCPT ); Mon, 15 Aug 2022 15:39:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344129AbiHOTgQ (ORCPT ); Mon, 15 Aug 2022 15:36:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A14852FC0; Mon, 15 Aug 2022 11:45: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 67176611EA; Mon, 15 Aug 2022 18:45:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3AD20C433C1; Mon, 15 Aug 2022 18:45:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589135; bh=FlydeP6PYQGyn0AYt0muUhmpUF8x2hn0JEyYh0BdFuw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CmNx+hm3vrHMvQo/5kewqeVxeAbKrLnqRfSq6ZT6ozYRTlpf0Ch8GYvUPfTovevi3 LnbGpckvS14M84tMW8OoDU3VW8MK3qxSn3MXaxuykkB/vAZw1W0m4iy0FibnZe7Z+u 1IeR+34HfW0LkL0oe+xg5TrbfCslFw4gLgzAep8E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shengjiu Wang , Mark Brown , Sasha Levin Subject: [PATCH 5.15 623/779] ASoC: fsl_asrc: force cast the asrc_format type Date: Mon, 15 Aug 2022 20:04:27 +0200 Message-Id: <20220815180404.026562897@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shengjiu Wang [ Upstream commit c49932726de24405d45516b3f8ad2735714fdf05 ] Fix sparse warning: sound/soc/fsl/fsl_asrc.c:1177:60: sparse: warning: incorrect type in argume= nt 3 (different base types) sound/soc/fsl/fsl_asrc.c:1177:60: sparse: expected unsigned int [usertyp= e] *out_value sound/soc/fsl/fsl_asrc.c:1177:60: sparse: got restricted snd_pcm_format_= t * sound/soc/fsl/fsl_asrc.c:1200:47: sparse: warning: restricted snd_pcm_forma= t_t degrades to integer Fixes: 4520af41fd21 ("ASoC: fsl_asrc: Support new property fsl,asrc-format") Signed-off-by: Shengjiu Wang Link: https://lore.kernel.org/r/1658399393-28777-3-git-send-email-shengjiu.= wang@nxp.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- sound/soc/fsl/fsl_asrc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c index d7d1536a4f37..44dcbf49456c 100644 --- a/sound/soc/fsl/fsl_asrc.c +++ b/sound/soc/fsl/fsl_asrc.c @@ -1066,6 +1066,7 @@ static int fsl_asrc_probe(struct platform_device *pde= v) struct resource *res; void __iomem *regs; int irq, ret, i; + u32 asrc_fmt =3D 0; u32 map_idx; char tmp[16]; u32 width; @@ -1174,7 +1175,8 @@ static int fsl_asrc_probe(struct platform_device *pde= v) return ret; } =20 - ret =3D of_property_read_u32(np, "fsl,asrc-format", &asrc->asrc_format); + ret =3D of_property_read_u32(np, "fsl,asrc-format", &asrc_fmt); + asrc->asrc_format =3D (__force snd_pcm_format_t)asrc_fmt; if (ret) { ret =3D of_property_read_u32(np, "fsl,asrc-width", &width); if (ret) { @@ -1197,7 +1199,7 @@ static int fsl_asrc_probe(struct platform_device *pde= v) } } =20 - if (!(FSL_ASRC_FORMATS & (1ULL << asrc->asrc_format))) { + if (!(FSL_ASRC_FORMATS & pcm_format_to_bits(asrc->asrc_format))) { dev_warn(&pdev->dev, "unsupported width, use default S24_LE\n"); asrc->asrc_format =3D SNDRV_PCM_FORMAT_S24_LE; } --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D4AEC00140 for ; Mon, 15 Aug 2022 19:39:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344216AbiHOTjH (ORCPT ); Mon, 15 Aug 2022 15:39:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344208AbiHOTgX (ORCPT ); Mon, 15 Aug 2022 15:36: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 1CAB62FFD2; Mon, 15 Aug 2022 11:45: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 7C16A611C1; Mon, 15 Aug 2022 18:45:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FE70C433D6; Mon, 15 Aug 2022 18:45:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589138; bh=SJ0B+3F+fbAszECz8ZtkNnD+5SL0MMT+AsyQBtyN4Bg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S0ypjPLsHsuQeGSpN0+n8IB2GNVGwFfduhwKeZQCy+Veb/3UzwoNKRPGkc+c5HmHK ujbd8VoO7odV8QA6ERyOWGQmzVvzfUH1FOhvJ1L+BeSJu4byDexV1GWSJE91hwctHs mSNMUS+fFqrXzqOt/pdr1+KamX8QIPnywcPMpwz8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shengjiu Wang , Mark Brown , Sasha Levin Subject: [PATCH 5.15 624/779] ASoC: fsl-asoc-card: force cast the asrc_format type Date: Mon, 15 Aug 2022 20:04:28 +0200 Message-Id: <20220815180404.057997012@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shengjiu Wang [ Upstream commit 6c7b077dad62178c33f9a3ae17f90d6b0bf6e2e5 ] Fix sparse warning: sound/soc/fsl/fsl-asoc-card.c:833:45: sparse: warning: incorrect type in ar= gument 3 (different base types) sound/soc/fsl/fsl-asoc-card.c:833:45: sparse: expected unsigned int [use= rtype] *out_value sound/soc/fsl/fsl-asoc-card.c:833:45: sparse: got restricted snd_pcm_for= mat_t * Fixes: 859e364302c5 ("ASoC: fsl-asoc-card: Support new property fsl, asrc-f= ormat") Signed-off-by: Shengjiu Wang Link: https://lore.kernel.org/r/1658399393-28777-4-git-send-email-shengjiu.= wang@nxp.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- sound/soc/fsl/fsl-asoc-card.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c index 95286c839b57..c72a156737e6 100644 --- a/sound/soc/fsl/fsl-asoc-card.c +++ b/sound/soc/fsl/fsl-asoc-card.c @@ -540,6 +540,7 @@ static int fsl_asoc_card_probe(struct platform_device *= pdev) struct device *codec_dev =3D NULL; const char *codec_dai_name; const char *codec_dev_name; + u32 asrc_fmt =3D 0; u32 width; int ret; =20 @@ -817,8 +818,8 @@ static int fsl_asoc_card_probe(struct platform_device *= pdev) goto asrc_fail; } =20 - ret =3D of_property_read_u32(asrc_np, "fsl,asrc-format", - &priv->asrc_format); + ret =3D of_property_read_u32(asrc_np, "fsl,asrc-format", &asrc_fmt); + priv->asrc_format =3D (__force snd_pcm_format_t)asrc_fmt; if (ret) { /* Fallback to old binding; translate to asrc_format */ ret =3D of_property_read_u32(asrc_np, "fsl,asrc-width", --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9688EC25B0E for ; Mon, 15 Aug 2022 19:39:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344224AbiHOTjM (ORCPT ); Mon, 15 Aug 2022 15:39:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344250AbiHOTg0 (ORCPT ); Mon, 15 Aug 2022 15:36:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D8A9642D2; Mon, 15 Aug 2022 11:45: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 8C1AD611E8; Mon, 15 Aug 2022 18:45:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92AA6C433C1; Mon, 15 Aug 2022 18:45:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589141; bh=ZrmD6NIvlvB4c/OD2NuWsSHOYZ1Vb1Ay9jCFCc1P/sY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W8OQADtHScLQZuVAlDPqJ42iAV+SMzqpcyaWBzBShZOHABb8ghbxRn3zmP8MjUb4M Feg1AN6Fvx9S7o8H7O9MimD8OGC3x8zfi8AVEESCvlnvnzhOKBiAeIpB9dVwXgPZpU tHgMx1oukAOMZZMlQ2ht7qSA/Vl8kEGFe6dRDRv0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shengjiu Wang , Mark Brown , Sasha Levin Subject: [PATCH 5.15 625/779] ASoC: fsl_easrc: use snd_pcm_format_t type for sample_format Date: Mon, 15 Aug 2022 20:04:29 +0200 Message-Id: <20220815180404.101146633@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shengjiu Wang [ Upstream commit de27216cf2d645c2fd14e513707bdcd54e5b1de4 ] Fix sparse warning: sound/soc/fsl/fsl_easrc.c:562:33: sparse: warning: restricted snd_pcm_forma= t_t degrades to integer sound/soc/fsl/fsl_easrc.c:563:34: sparse: warning: restricted snd_pcm_forma= t_t degrades to integer sound/soc/fsl/fsl_easrc.c:565:38: sparse: warning: restricted snd_pcm_forma= t_t degrades to integer sound/soc/fsl/fsl_easrc.c:566:39: sparse: warning: restricted snd_pcm_forma= t_t degrades to integer sound/soc/fsl/fsl_easrc.c:608:33: sparse: warning: restricted snd_pcm_forma= t_t degrades to integer sound/soc/fsl/fsl_easrc.c:609:34: sparse: warning: restricted snd_pcm_forma= t_t degrades to integer sound/soc/fsl/fsl_easrc.c:615:40: sparse: warning: restricted snd_pcm_forma= t_t degrades to integer sound/soc/fsl/fsl_easrc.c:616:41: sparse: warning: restricted snd_pcm_forma= t_t degrades to integer sound/soc/fsl/fsl_easrc.c:1465:51: sparse: warning: incorrect type in assig= nment (different base types) sound/soc/fsl/fsl_easrc.c:1465:51: sparse: expected unsigned int sample_= format sound/soc/fsl/fsl_easrc.c:1465:51: sparse: got restricted snd_pcm_format= _t [usertype] format sound/soc/fsl/fsl_easrc.c:1467:52: sparse: warning: incorrect type in assig= nment (different base types) sound/soc/fsl/fsl_easrc.c:1467:52: sparse: expected unsigned int sample_= format sound/soc/fsl/fsl_easrc.c:1467:52: sparse: got restricted snd_pcm_format= _t [usertype] asrc_format sound/soc/fsl/fsl_easrc.c:1470:52: sparse: warning: incorrect type in assig= nment (different base types) sound/soc/fsl/fsl_easrc.c:1470:52: sparse: expected unsigned int sample_= format sound/soc/fsl/fsl_easrc.c:1470:52: sparse: got restricted snd_pcm_format= _t [usertype] format sound/soc/fsl/fsl_easrc.c:1472:51: sparse: warning: incorrect type in assig= nment (different base types) sound/soc/fsl/fsl_easrc.c:1472:51: sparse: expected unsigned int sample_= format sound/soc/fsl/fsl_easrc.c:1472:51: sparse: got restricted snd_pcm_format= _t [usertype] asrc_format sound/soc/fsl/fsl_easrc.c:1484:41: sparse: warning: incorrect type in argum= ent 2 (different base types) sound/soc/fsl/fsl_easrc.c:1484:41: sparse: expected restricted snd_pcm_f= ormat_t [usertype] *in_raw_format sound/soc/fsl/fsl_easrc.c:1484:41: sparse: got unsigned int * sound/soc/fsl/fsl_easrc.c:1485:41: sparse: warning: incorrect type in argum= ent 3 (different base types) sound/soc/fsl/fsl_easrc.c:1485:41: sparse: expected restricted snd_pcm_f= ormat_t [usertype] *out_raw_format sound/soc/fsl/fsl_easrc.c:1485:41: sparse: got unsigned int * sound/soc/fsl/fsl_easrc.c:1937:60: sparse: warning: incorrect type in argum= ent 3 (different base types) sound/soc/fsl/fsl_easrc.c:1937:60: sparse: expected unsigned int [userty= pe] *out_value sound/soc/fsl/fsl_easrc.c:1937:60: sparse: got restricted snd_pcm_format= _t * sound/soc/fsl/fsl_easrc.c:1943:49: sparse: warning: restricted snd_pcm_form= at_t degrades to integer Fixes: 955ac624058f ("ASoC: fsl_easrc: Add EASRC ASoC CPU DAI drivers") Signed-off-by: Shengjiu Wang Link: https://lore.kernel.org/r/1658399393-28777-5-git-send-email-shengjiu.= wang@nxp.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- sound/soc/fsl/fsl_easrc.c | 9 ++++++--- sound/soc/fsl/fsl_easrc.h | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/sound/soc/fsl/fsl_easrc.c b/sound/soc/fsl/fsl_easrc.c index be14f84796cb..cf0e10d17dbe 100644 --- a/sound/soc/fsl/fsl_easrc.c +++ b/sound/soc/fsl/fsl_easrc.c @@ -476,7 +476,8 @@ static int fsl_easrc_prefilter_config(struct fsl_asrc *= easrc, struct fsl_asrc_pair *ctx; struct device *dev; u32 inrate, outrate, offset =3D 0; - u32 in_s_rate, out_s_rate, in_s_fmt, out_s_fmt; + u32 in_s_rate, out_s_rate; + snd_pcm_format_t in_s_fmt, out_s_fmt; int ret, i; =20 if (!easrc) @@ -1873,6 +1874,7 @@ static int fsl_easrc_probe(struct platform_device *pd= ev) struct resource *res; struct device_node *np; void __iomem *regs; + u32 asrc_fmt =3D 0; int ret, irq; =20 easrc =3D devm_kzalloc(dev, sizeof(*easrc), GFP_KERNEL); @@ -1933,13 +1935,14 @@ static int fsl_easrc_probe(struct platform_device *= pdev) return ret; } =20 - ret =3D of_property_read_u32(np, "fsl,asrc-format", &easrc->asrc_format); + ret =3D of_property_read_u32(np, "fsl,asrc-format", &asrc_fmt); + easrc->asrc_format =3D (__force snd_pcm_format_t)asrc_fmt; if (ret) { dev_err(dev, "failed to asrc format\n"); return ret; } =20 - if (!(FSL_EASRC_FORMATS & (1ULL << easrc->asrc_format))) { + if (!(FSL_EASRC_FORMATS & (pcm_format_to_bits(easrc->asrc_format)))) { dev_warn(dev, "unsupported format, switching to S24_LE\n"); easrc->asrc_format =3D SNDRV_PCM_FORMAT_S24_LE; } diff --git a/sound/soc/fsl/fsl_easrc.h b/sound/soc/fsl/fsl_easrc.h index 30620d56252c..5b8469757c12 100644 --- a/sound/soc/fsl/fsl_easrc.h +++ b/sound/soc/fsl/fsl_easrc.h @@ -569,7 +569,7 @@ struct fsl_easrc_io_params { unsigned int access_len; unsigned int fifo_wtmk; unsigned int sample_rate; - unsigned int sample_format; + snd_pcm_format_t sample_format; unsigned int norm_rate; }; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 533CDC00140 for ; Mon, 15 Aug 2022 19:47:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344881AbiHOTpg (ORCPT ); Mon, 15 Aug 2022 15:45:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345006AbiHOTmH (ORCPT ); Mon, 15 Aug 2022 15:42:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14B3941D11; Mon, 15 Aug 2022 11:47: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 3116461215; Mon, 15 Aug 2022 18:47:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0FBBC433C1; Mon, 15 Aug 2022 18:47:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589275; bh=Fwi3sWQJEDyeCfSlZ8mzk9hmc7TmCoU9uZk6Wb8OtrM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dMsnNHLWIQr9xPdiP42iKIn/G8MM+8YsxPOsZ0b+N7aRbtshbA5UuaIEm+G1BBfv4 hZXEJGvOXtUzXz6uZuTp8LlWUjEZX0JV7waSVzJvooWKuRLdTTnP9+IrFLHyJzwf6V Npt4KXPBX2tKKoPSX7g2JWqIlsNrNhv+bD0dWDkM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shengjiu Wang , Mark Brown , Sasha Levin Subject: [PATCH 5.15 626/779] ASoC: imx-card: use snd_pcm_format_t type for asrc_format Date: Mon, 15 Aug 2022 20:04:30 +0200 Message-Id: <20220815180404.131743767@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shengjiu Wang [ Upstream commit 409a8652e909e323c715f3088e6c3133e37c8881 ] Fix sparse warning: sound/soc/fsl/imx-card.c:653:59: sparse: warning: incorrect type in assignm= ent (different base types) sound/soc/fsl/imx-card.c:653:59: sparse: expected unsigned int [usertype= ] asrc_format sound/soc/fsl/imx-card.c:653:59: sparse: got restricted snd_pcm_format_t= [usertype] sound/soc/fsl/imx-card.c:655:59: sparse: warning: incorrect type in assignm= ent (different base types) sound/soc/fsl/imx-card.c:655:59: sparse: expected unsigned int [usertype= ] asrc_format sound/soc/fsl/imx-card.c:655:59: sparse: got restricted snd_pcm_format_t= [usertype] Fixes: aa736700f42f ("ASoC: imx-card: Add imx-card machine driver") Signed-off-by: Shengjiu Wang Link: https://lore.kernel.org/r/1658399393-28777-6-git-send-email-shengjiu.= wang@nxp.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- sound/soc/fsl/imx-card.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sound/soc/fsl/imx-card.c b/sound/soc/fsl/imx-card.c index b28b30c69a3f..593d69b96523 100644 --- a/sound/soc/fsl/imx-card.c +++ b/sound/soc/fsl/imx-card.c @@ -118,7 +118,7 @@ struct imx_card_data { struct snd_soc_card card; int num_dapm_routes; u32 asrc_rate; - u32 asrc_format; + snd_pcm_format_t asrc_format; }; =20 static struct imx_akcodec_fs_mul ak4458_fs_mul[] =3D { @@ -474,7 +474,7 @@ static int be_hw_params_fixup(struct snd_soc_pcm_runtim= e *rtd, =20 mask =3D hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); snd_mask_none(mask); - snd_mask_set(mask, data->asrc_format); + snd_mask_set(mask, (__force unsigned int)data->asrc_format); =20 return 0; } @@ -493,6 +493,7 @@ static int imx_card_parse_of(struct imx_card_data *data) struct dai_link_data *link_data; struct of_phandle_args args; int ret, num_links; + u32 asrc_fmt =3D 0; u32 width; =20 ret =3D snd_soc_of_parse_card_name(card, "model"); @@ -639,7 +640,8 @@ static int imx_card_parse_of(struct imx_card_data *data) goto err; } =20 - ret =3D of_property_read_u32(args.np, "fsl,asrc-format", &data->asrc_fo= rmat); + ret =3D of_property_read_u32(args.np, "fsl,asrc-format", &asrc_fmt); + data->asrc_format =3D (__force snd_pcm_format_t)asrc_fmt; if (ret) { /* Fallback to old binding; translate to asrc_format */ ret =3D of_property_read_u32(args.np, "fsl,asrc-width", &width); --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B680C00140 for ; Mon, 15 Aug 2022 19:40:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344323AbiHOTkB (ORCPT ); Mon, 15 Aug 2022 15:40:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344455AbiHOTgm (ORCPT ); Mon, 15 Aug 2022 15:36:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 282F731211; Mon, 15 Aug 2022 11:46: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 B923A611DD; Mon, 15 Aug 2022 18:46:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC5FBC433D6; Mon, 15 Aug 2022 18:46:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589168; bh=mUVe9/nmN1h9AHULm+LGHsm4E1xXlvp9qIYrPIpf/lU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2Vfbnlr1dxSa6hhiifsuXUVtRBKWPTWQQTOE6NCBQZOtsx+xOssruU0KJTkVYNtnp jst2hoDhSJOwBV7hwVjt24PM4vpeWL85H4QrHU+7JASAYSaFVsOYgBupcv+9cgRLtN cXJ7fxRSV39m4MR07rqh8ypw6RUvjbNfSjbf5QvA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Mark Brown , Sasha Levin Subject: [PATCH 5.15 627/779] ASoC: qcom: q6dsp: Fix an off-by-one in q6adm_alloc_copp() Date: Mon, 15 Aug 2022 20:04:31 +0200 Message-Id: <20220815180404.173912748@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET [ Upstream commit 673f58f62ca6fc98979d1cf3fe89c3ff33f29b2e ] find_first_zero_bit() returns MAX_COPPS_PER_PORT at max here. So 'idx' should be tested with ">=3D" or the test can't match. Fixes: 7b20b2be51e1 ("ASoC: qdsp6: q6adm: Add q6adm driver") Signed-off-by: Christophe JAILLET Link: https://lore.kernel.org/r/0fca3271649736053eb9649d87e1ca01b056be40.16= 58394124.git.christophe.jaillet@wanadoo.fr Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- sound/soc/qcom/qdsp6/q6adm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/qcom/qdsp6/q6adm.c b/sound/soc/qcom/qdsp6/q6adm.c index 3d831b635524..4ae97afe9062 100644 --- a/sound/soc/qcom/qdsp6/q6adm.c +++ b/sound/soc/qcom/qdsp6/q6adm.c @@ -217,7 +217,7 @@ static struct q6copp *q6adm_alloc_copp(struct q6adm *ad= m, int port_idx) idx =3D find_first_zero_bit(&adm->copp_bitmap[port_idx], MAX_COPPS_PER_PORT); =20 - if (idx > MAX_COPPS_PER_PORT) + if (idx >=3D MAX_COPPS_PER_PORT) return ERR_PTR(-EBUSY); =20 c =3D kzalloc(sizeof(*c), GFP_ATOMIC); --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30F90C00140 for ; Mon, 15 Aug 2022 19:43:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344507AbiHOTn0 (ORCPT ); Mon, 15 Aug 2022 15:43:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344195AbiHOTip (ORCPT ); Mon, 15 Aug 2022 15:38:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FF6921B9; Mon, 15 Aug 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 ams.source.kernel.org (Postfix) with ESMTPS id DDA2FB81082; Mon, 15 Aug 2022 18:46:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F954C433D6; Mon, 15 Aug 2022 18:46:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589205; bh=9aQn6HVkvYsPal5YbQdM+9fKm2iAIf76v5YHe/43/XA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GzOswDYptWuQuZonavXj/TOgKfHQeuU15DkMhlL3Lv7fV9ZLGPQO4a3yCyjcNZ6GF riwUoOIaDUopefftlXZs4dzAYmM+RH5xtWx08Aj8sHX8xZeWWPOerAhAtHM5nuHXfA N5DF81h2nSN1izEC/EiCeKxGa07dtC2mAuhsM8Bw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xie Yongji , Miklos Szeredi , Sasha Levin Subject: [PATCH 5.15 628/779] fuse: Remove the control interface for virtio-fs Date: Mon, 15 Aug 2022 20:04:32 +0200 Message-Id: <20220815180404.220639286@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 c64797809a64c73497082aa05e401a062ec1af34 ] The commit 15c8e72e88e0 ("fuse: allow skipping control interface and forced unmount") tries to remove the control interface for virtio-fs since it does not support aborting requests which are being processed. But it doesn't work now. This patch fixes it by skipping creating the control interface if fuse_conn->no_control is set. Fixes: 15c8e72e88e0 ("fuse: allow skipping control interface and forced unm= ount") Signed-off-by: Xie Yongji Signed-off-by: Miklos Szeredi Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/fuse/control.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/fuse/control.c b/fs/fuse/control.c index 000d2e5627e9..79f01d09c78c 100644 --- a/fs/fuse/control.c +++ b/fs/fuse/control.c @@ -275,7 +275,7 @@ int fuse_ctl_add_conn(struct fuse_conn *fc) struct dentry *parent; char name[32]; =20 - if (!fuse_control_sb) + if (!fuse_control_sb || fc->no_control) return 0; =20 parent =3D fuse_control_sb->s_root; @@ -313,7 +313,7 @@ void fuse_ctl_remove_conn(struct fuse_conn *fc) { int i; =20 - if (!fuse_control_sb) + if (!fuse_control_sb || fc->no_control) return; =20 for (i =3D fc->ctl_ndents - 1; i >=3D 0; i--) { --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10426C00140 for ; Mon, 15 Aug 2022 19:44:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344713AbiHOTo1 (ORCPT ); Mon, 15 Aug 2022 15:44:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344576AbiHOTlI (ORCPT ); Mon, 15 Aug 2022 15:41:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C34F9419B6; Mon, 15 Aug 2022 11:47: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 ECA39611CA; Mon, 15 Aug 2022 18:47:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA6BCC4347C; Mon, 15 Aug 2022 18:47:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589240; bh=fmKx06rMjjpXJdunefnM2+WN1TOv8vRZu90f/apMnXA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S9wSF7oEjtATKdJFovRX5Foaa82zYxy+BL/68RAlnL2ukozJ1InTY4C+Ge5bW3jS2 /tgQUC6QdFqb/WTWYQsKa2jAgEjrQx2rPimYKSTTihaM48E7Zig8tJlChvN0FIdaGQ rq5iEv53bMDhVGrkpMHyYjsVpYKmtY87p0Wn1oew= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Mark Brown , Sasha Levin Subject: [PATCH 5.15 629/779] ASoC: audio-graph-card: Add of_node_put() in fail path Date: Mon, 15 Aug 2022 20:04:33 +0200 Message-Id: <20220815180404.253880323@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 65fb8e2ef3531a6e950060fca6e551c923fb0f0e ] In asoc_simple_parse_dai(), we should call of_node_put() for the reference returned by of_graph_get_port_parent() in fail path. Fixes: ae30a694da4c ("ASoC: simple-card-utils: add asoc_simple_card_parse_d= ai()") Signed-off-by: Liang He Link: https://lore.kernel.org/r/20220721144308.1301587-1-windhl@126.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- sound/soc/generic/audio-graph-card.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio= -graph-card.c index 546f6fd0609e..28cbcdb56857 100644 --- a/sound/soc/generic/audio-graph-card.c +++ b/sound/soc/generic/audio-graph-card.c @@ -158,8 +158,10 @@ static int asoc_simple_parse_dai(struct device_node *e= p, * if he unbinded CPU or Codec. */ ret =3D snd_soc_get_dai_name(&args, &dlc->dai_name); - if (ret < 0) + if (ret < 0) { + of_node_put(node); return ret; + } =20 dlc->of_node =3D node; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 186ABC00140 for ; Mon, 15 Aug 2022 19:45:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343969AbiHOTo5 (ORCPT ); Mon, 15 Aug 2022 15:44:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344870AbiHOTlq (ORCPT ); Mon, 15 Aug 2022 15:41:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9430C66A4C; Mon, 15 Aug 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 dfw.source.kernel.org (Postfix) with ESMTPS id B17BA611EA; Mon, 15 Aug 2022 18:47:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB273C433C1; Mon, 15 Aug 2022 18:47:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589256; bh=UBA+AIG0oDv9VnGsMs56izD1WNgmZUuKglNygKzGjco=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1AOwlyLLbb+U/zo1k6hlwb+r3cUb4o7LILi92rIpIAADzlPx46WUrwj2fh7bgoRmu sF513pwvJKIOIWgZjsFdtKaSalyBkxmHtyeatmNa52aDcjkpO64ls7ns+FjjTX+siS +0Mtd+zYzVbBprwmzfQiOi6ONZbmPt68NN++VV64= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jean Delvare , Terry Bowman , Wim Van Sebroeck , Guenter Roeck , Sasha Levin Subject: [PATCH 5.15 630/779] watchdog: sp5100_tco: Fix a memory leak of EFCH MMIO resource Date: Mon, 15 Aug 2022 20:04:34 +0200 Message-Id: <20220815180404.283750714@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jean Delvare [ Upstream commit c6d9c0798ed366a09a9e53d71edcd2266e34a6eb ] Unlike release_mem_region(), a call to release_resource() does not free the resource, so it has to be freed explicitly to avoid a memory leak. Signed-off-by: Jean Delvare Fixes: 0578fff4aae5 ("Watchdog: sp5100_tco: Add initialization using EFCH M= MIO") Cc: Terry Bowman Cc: Wim Van Sebroeck Cc: Guenter Roeck Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220621152840.420a0f4c@endymion.delvare Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/watchdog/sp5100_tco.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/watchdog/sp5100_tco.c b/drivers/watchdog/sp5100_tco.c index 4820af929a82..4afc468d8ed1 100644 --- a/drivers/watchdog/sp5100_tco.c +++ b/drivers/watchdog/sp5100_tco.c @@ -394,6 +394,7 @@ static int sp5100_tco_setupdevice_mmio(struct device *d= ev, iounmap(addr); =20 release_resource(res); + kfree(res); =20 return ret; } --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B250C00140 for ; Mon, 15 Aug 2022 19:45:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344330AbiHOTpH (ORCPT ); Mon, 15 Aug 2022 15:45:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344919AbiHOTlz (ORCPT ); Mon, 15 Aug 2022 15:41:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76644419B7; Mon, 15 Aug 2022 11:47: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 B276DB81057; Mon, 15 Aug 2022 18:47:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E6205C433C1; Mon, 15 Aug 2022 18:47:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589259; bh=sZQQJBhKBqZz1oQBCZX4pRulQOQ09eGmJoa2eOxyBZQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ppuSzYIHh9nIy6RP/rEmORTihFSIT3oGSWZeyUnSZPwzHENZJ61kix/1N4G3w+NWX au2zlIe72mlYbxPA6FvzR/gmS3rkl3X2eT9IOvPVezPg0aFtpAYgFs7tNzEUQr//aA qIQskTGgqAoXFVyq8z3tkG0DD99NMCu4yvbEwSAw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hacash Robot , William Dean , Marek Beh=C3=BAn , Guenter Roeck , Wim Van Sebroeck , Sasha Levin Subject: [PATCH 5.15 631/779] watchdog: armada_37xx_wdt: check the return value of devm_ioremap() in armada_37xx_wdt_probe() Date: Mon, 15 Aug 2022 20:04:35 +0200 Message-Id: <20220815180404.315501255@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: William Dean [ Upstream commit 2d27e52841092e5831dd41f313028c668d816eb0 ] The function devm_ioremap() in armada_37xx_wdt_probe() can fail, so its return value should be checked. Fixes: 54e3d9b518c8a ("watchdog: Add support for Armada 37xx CPU watchdog") Reported-by: Hacash Robot Signed-off-by: William Dean Reviewed-by: Marek Beh=3DC3=3DBAn Reviewed-by: Guenter Roeck Link: https://lore.kernel.org/r/20220722030938.2925156-1-williamsukatube@16= 3.com Signed-off-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/watchdog/armada_37xx_wdt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/watchdog/armada_37xx_wdt.c b/drivers/watchdog/armada_3= 7xx_wdt.c index 1635f421ef2c..854b1cc723cb 100644 --- a/drivers/watchdog/armada_37xx_wdt.c +++ b/drivers/watchdog/armada_37xx_wdt.c @@ -274,6 +274,8 @@ static int armada_37xx_wdt_probe(struct platform_device= *pdev) if (!res) return -ENODEV; dev->reg =3D devm_ioremap(&pdev->dev, res->start, resource_size(res)); + if (!dev->reg) + return -ENOMEM; =20 /* init clock */ dev->clk =3D devm_clk_get(&pdev->dev, NULL); --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C850C282E7 for ; Mon, 15 Aug 2022 19:45:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344857AbiHOTpN (ORCPT ); Mon, 15 Aug 2022 15:45:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344932AbiHOTl4 (ORCPT ); Mon, 15 Aug 2022 15:41: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 BA5A141D18; Mon, 15 Aug 2022 11:47: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 CE430B810A2; Mon, 15 Aug 2022 18:47:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CC7CC433C1; Mon, 15 Aug 2022 18:47:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589262; bh=vo0TAGeRPJNhuCFG7rNuv/V9pYpe7Wt0kisbfUGzm10=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wewEOf2pMdtJ3GIVvcz5Nt1BmwxhYDNnz4+E3+yWYSpc9XoBb7Viwf9afkZ6pox37 MvRzspHFxSsVtCimS4MaKUoqUKo5a8dUGFiA52gduHPV80yo3f/U4lwOPmuC/34HZd zMpJtvPznpq4T/BKC+DFO4iMVGgLTCjfeKZPdvaE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Liang He , Helge Deller , Sasha Levin Subject: [PATCH 5.15 632/779] video: fbdev: amba-clcd: Fix refcount leak bugs Date: Mon, 15 Aug 2022 20:04:36 +0200 Message-Id: <20220815180404.352870143@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Liang He [ Upstream commit 26c2b7d9fac42eb8317f3ceefa4c1a9a9170ca69 ] In clcdfb_of_init_display(), we should call of_node_put() for the references returned by of_graph_get_next_endpoint() and of_graph_get_remote_port_parent() which have increased the refcount. Besides, we should call of_node_put() both in fail path or when the references are not used anymore. Fixes: d10715be03bd ("video: ARM CLCD: Add DT support") Signed-off-by: Liang He Signed-off-by: Helge Deller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/video/fbdev/amba-clcd.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/drivers/video/fbdev/amba-clcd.c b/drivers/video/fbdev/amba-clc= d.c index 8080116aea84..f65c96d1394d 100644 --- a/drivers/video/fbdev/amba-clcd.c +++ b/drivers/video/fbdev/amba-clcd.c @@ -698,16 +698,18 @@ static int clcdfb_of_init_display(struct clcd_fb *fb) return -ENODEV; =20 panel =3D of_graph_get_remote_port_parent(endpoint); - if (!panel) - return -ENODEV; + if (!panel) { + err =3D -ENODEV; + goto out_endpoint_put; + } =20 err =3D clcdfb_of_get_backlight(&fb->dev->dev, fb->panel); if (err) - return err; + goto out_panel_put; =20 err =3D clcdfb_of_get_mode(&fb->dev->dev, panel, fb->panel); if (err) - return err; + goto out_panel_put; =20 err =3D of_property_read_u32(fb->dev->dev.of_node, "max-memory-bandwidth", &max_bandwidth); @@ -736,11 +738,21 @@ static int clcdfb_of_init_display(struct clcd_fb *fb) =20 if (of_property_read_u32_array(endpoint, "arm,pl11x,tft-r0g0b0-pads", - tft_r0b0g0, ARRAY_SIZE(tft_r0b0g0)) !=3D 0) - return -ENOENT; + tft_r0b0g0, ARRAY_SIZE(tft_r0b0g0)) !=3D 0) { + err =3D -ENOENT; + goto out_panel_put; + } + + of_node_put(panel); + of_node_put(endpoint); =20 return clcdfb_of_init_tft_panel(fb, tft_r0b0g0[0], tft_r0b0g0[1], tft_r0b0g0[2]); +out_panel_put: + of_node_put(panel); +out_endpoint_put: + of_node_put(endpoint); + return err; } =20 static int clcdfb_of_vram_setup(struct clcd_fb *fb) --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E0E3C00140 for ; Mon, 15 Aug 2022 19:45:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344864AbiHOTpS (ORCPT ); Mon, 15 Aug 2022 15:45:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344930AbiHOTl4 (ORCPT ); Mon, 15 Aug 2022 15:41: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 CEB4667C83; Mon, 15 Aug 2022 11:47: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 E6683B810A4; Mon, 15 Aug 2022 18:47:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E6D6C433D7; Mon, 15 Aug 2022 18:47:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589265; bh=g+7P8x4nQek5z0FnHiv1VkueNiRjREbVGrtQV0qPJVs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U8Xzk4DoD4qD4j5Q8w4S9h6aZ7rDUcrcyBG8KEfFE42VgPJZBws6VHhA6G3xGlaNS 7spOX3enWYZTyBGI/mW+gHBzwwsvobscqKEjnL4BjvgQpJ/JnhXxZt8nmErGUtcqnn 8Q41KZahpngFkWcy6PP7nAfseCGdwA1qeX3i619A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rustam Subkhankulov , Helge Deller , Sasha Levin Subject: [PATCH 5.15 633/779] video: fbdev: sis: fix typos in SiS_GetModeID() Date: Mon, 15 Aug 2022 20:04:37 +0200 Message-Id: <20220815180404.402498762@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rustam Subkhankulov [ Upstream commit 3eb8fccc244bfb41a7961969e4db280d44911226 ] The second operand of a '&&' operator has no impact on expression result for cases 400 and 512 in SiS_GetModeID(). Judging by the logic and the names of the variables, in both cases a typo was made. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Rustam Subkhankulov Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Helge Deller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/video/fbdev/sis/init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/video/fbdev/sis/init.c b/drivers/video/fbdev/sis/init.c index b568c646a76c..2ba91d62af92 100644 --- a/drivers/video/fbdev/sis/init.c +++ b/drivers/video/fbdev/sis/init.c @@ -355,12 +355,12 @@ SiS_GetModeID(int VGAEngine, unsigned int VBFlags, in= t HDisplay, int VDisplay, } break; case 400: - if((!(VBFlags & CRT1_LCDA)) || ((LCDwidth >=3D 800) && (LCDwidth >=3D 60= 0))) { + if((!(VBFlags & CRT1_LCDA)) || ((LCDwidth >=3D 800) && (LCDheight >=3D 6= 00))) { if(VDisplay =3D=3D 300) ModeIndex =3D ModeIndex_400x300[Depth]; } break; case 512: - if((!(VBFlags & CRT1_LCDA)) || ((LCDwidth >=3D 1024) && (LCDwidth >=3D 7= 68))) { + if((!(VBFlags & CRT1_LCDA)) || ((LCDwidth >=3D 1024) && (LCDheight >=3D = 768))) { if(VDisplay =3D=3D 384) ModeIndex =3D ModeIndex_512x384[Depth]; } break; --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B93D5C00140 for ; Mon, 15 Aug 2022 19:45:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233163AbiHOTpY (ORCPT ); Mon, 15 Aug 2022 15:45:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344998AbiHOTmH (ORCPT ); Mon, 15 Aug 2022 15:42:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 064A967CAA; Mon, 15 Aug 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 2F4D7B81057; Mon, 15 Aug 2022 18:47:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73191C433D7; Mon, 15 Aug 2022 18:47:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589268; bh=V1JLJD5JDI15dPV+5pZwuivXT3yv18inMqghy5mVCUs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GbkZpL1kEADQG9Mtx3gqenqdMv5OwGVOdTofsc9p5rEgvMBLM+gAwkM3taVUDXROv eu7QW4JQkJKQ0Ve8vAd9AJSWzm+i8mS53jUEhifvs0V/DPLqs+XHRQ8ZI462qRl+RH BOAI6wbRLEFc41ShHa4Qcm1lthsZUFCm38CVWdG4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Claudiu Beznea , Mark Brown , Sasha Levin Subject: [PATCH 5.15 634/779] ASoC: mchp-spdifrx: disable end of block interrupt on failures Date: Mon, 15 Aug 2022 20:04:38 +0200 Message-Id: <20220815180404.444352967@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea [ Upstream commit 768ac4f12ca0fda935f58eb8c5120e9d795bc6e3 ] Disable end of block interrupt in case of wait for completion timeout or errors to undo previously enable operation (done in mchp_spdifrx_isr_blockend_en()). Otherwise we can end up with an unbalanced reference counter for this interrupt. Fixes: ef265c55c1ac ("ASoC: mchp-spdifrx: add driver for SPDIF RX") Signed-off-by: Claudiu Beznea Link: https://lore.kernel.org/r/20220727090814.2446111-2-claudiu.beznea@mic= rochip.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- sound/soc/atmel/mchp-spdifrx.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sound/soc/atmel/mchp-spdifrx.c b/sound/soc/atmel/mchp-spdifrx.c index bcd4f3e4fb0f..2a62d9a2fa0d 100644 --- a/sound/soc/atmel/mchp-spdifrx.c +++ b/sound/soc/atmel/mchp-spdifrx.c @@ -288,15 +288,17 @@ static void mchp_spdifrx_isr_blockend_en(struct mchp_= spdifrx_dev *dev) spin_unlock_irqrestore(&dev->blockend_lock, flags); } =20 -/* called from atomic context only */ +/* called from atomic/non-atomic context */ static void mchp_spdifrx_isr_blockend_dis(struct mchp_spdifrx_dev *dev) { - spin_lock(&dev->blockend_lock); + unsigned long flags; + + spin_lock_irqsave(&dev->blockend_lock, flags); dev->blockend_refcount--; /* don't enable BLOCKEND interrupt if it's already enabled */ if (dev->blockend_refcount =3D=3D 0) regmap_write(dev->regmap, SPDIFRX_IDR, SPDIFRX_IR_BLOCKEND); - spin_unlock(&dev->blockend_lock); + spin_unlock_irqrestore(&dev->blockend_lock, flags); } =20 static irqreturn_t mchp_spdif_interrupt(int irq, void *dev_id) @@ -575,6 +577,7 @@ static int mchp_spdifrx_subcode_ch_get(struct mchp_spdi= frx_dev *dev, if (ret <=3D 0) { dev_dbg(dev->dev, "user data for channel %d timeout\n", channel); + mchp_spdifrx_isr_blockend_dis(dev); return ret; } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75A0CC25B0E for ; Mon, 15 Aug 2022 19:47:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344893AbiHOTpn (ORCPT ); Mon, 15 Aug 2022 15:45:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345026AbiHOTmJ (ORCPT ); Mon, 15 Aug 2022 15:42: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 4A2EC6A499; Mon, 15 Aug 2022 11:47: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 sin.source.kernel.org (Postfix) with ESMTPS id C401DCE1278; Mon, 15 Aug 2022 18:47:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C946C433D6; Mon, 15 Aug 2022 18:47:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589272; bh=0pZNiys6EeeQjDyQBEPKfm5W/loToFEP2OhpcPkhyts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bFyk5y/IupakqImUtJXcGGb29UlFvHTJx1a/4rJUKFkLShRADmCmJRsLOYh/CpHcy VCpV0/TAVq7aIYsathWmO7/x29RLaAAb34vSF6cID2k689ROC200+7uLaxmi+X7BBh 5wXBT63SfGst7iDAlUwwBBQwlSmKwv+ojW/vlyco= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy , Michael Ellerman , Sasha Levin Subject: [PATCH 5.15 635/779] powerpc/32: Call mmu_mark_initmem_nx() regardless of data block mapping. Date: Mon, 15 Aug 2022 20:04:39 +0200 Message-Id: <20220815180404.482517916@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe Leroy [ Upstream commit 980bbf7ca72012d317617fcdbfabe8708e4cef29 ] mark_initmem_nx() calls either mmu_mark_initmem_nx() or set_memory_attr() based on return from v_block_mapped() of _sinittext. But we can now handle text and data independently, so that text may be mapped by block even when data is mapped by pages. On the 8xx for instance, at startup 32Mbytes of memory are pinned in TLB. So the pinned entries need to go away for sinittext. In next patch a BAT will be set to also covers sinittext on book3s/32. So it will also be needed to call mmu_mark_initmem_nx() even when data above sinittext is not mapped with BATs. As this is highly dependent on the platform, call mmu_mark_initmem_nx() regardless of data block mapping. Then the platform will know what to do. Modify 8xx mmu_mark_initmem_nx() so that inittext mapping is modified only when pagealloc debug and kfence are not active, otherwise inittext is mapped with standard pages. And don't do anything on kernel text which is already mapped with PAGE_KERNEL_TEXT. Fixes: da1adea07576 ("powerpc/8xx: Allow STRICT_KERNEL_RwX with pinned TLB") Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/db3fc14f3bfa6215b0786ef58a6e2bc1e1f964d7.16= 55202804.git.christophe.leroy@csgroup.eu Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/powerpc/mm/nohash/8xx.c | 4 ++-- arch/powerpc/mm/pgtable_32.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/arch/powerpc/mm/nohash/8xx.c b/arch/powerpc/mm/nohash/8xx.c index 0df9fe29dd56..5348e1f9eb94 100644 --- a/arch/powerpc/mm/nohash/8xx.c +++ b/arch/powerpc/mm/nohash/8xx.c @@ -183,8 +183,8 @@ void mmu_mark_initmem_nx(void) unsigned long boundary =3D strict_kernel_rwx_enabled() ? sinittext : etex= t8; unsigned long einittext8 =3D ALIGN(__pa(_einittext), SZ_8M); =20 - mmu_mapin_ram_chunk(0, boundary, PAGE_KERNEL_TEXT, false); - mmu_mapin_ram_chunk(boundary, einittext8, PAGE_KERNEL, false); + if (!debug_pagealloc_enabled_or_kfence()) + mmu_mapin_ram_chunk(boundary, einittext8, PAGE_KERNEL, false); =20 mmu_pin_tlb(block_mapped_ram, false); } diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c index f28859771440..502e3d3d1dbf 100644 --- a/arch/powerpc/mm/pgtable_32.c +++ b/arch/powerpc/mm/pgtable_32.c @@ -138,9 +138,9 @@ void mark_initmem_nx(void) unsigned long numpages =3D PFN_UP((unsigned long)_einittext) - PFN_DOWN((unsigned long)_sinittext); =20 - if (v_block_mapped((unsigned long)_sinittext)) { - mmu_mark_initmem_nx(); - } else { + mmu_mark_initmem_nx(); + + if (!v_block_mapped((unsigned long)_sinittext)) { set_memory_nx((unsigned long)_sinittext, numpages); set_memory_rw((unsigned long)_sinittext, numpages); } --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91B1AC00140 for ; Mon, 15 Aug 2022 19:40:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344346AbiHOTkK (ORCPT ); Mon, 15 Aug 2022 15:40:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344493AbiHOTgp (ORCPT ); Mon, 15 Aug 2022 15:36:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F180D3121B; Mon, 15 Aug 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 80C7F611EC; Mon, 15 Aug 2022 18:46:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFCB2C433B5; Mon, 15 Aug 2022 18:46:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589171; bh=cRlLFjAVgnrgy41c8V3O5sjZBDaCSnMXi0/hnIxRhHE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sG0lRVrTTPjT3TmXGIWDQaTbzay3DUxlUYOwPn/Ex0DH8Mp0DXkbbijk5holPtN8J OyYDvxbaDS7lIXss2ONas5PYGtja7edCx0B9gg6rK6tzWA50mHWonoMFWiTxG38MSW L1VHrvvgMaZlqH8qLjtCN9LqTzhxAW8poL04bGM0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe Leroy , Michael Ellerman , Sasha Levin Subject: [PATCH 5.15 636/779] powerpc/32: Do not allow selection of e5500 or e6500 CPUs on PPC32 Date: Mon, 15 Aug 2022 20:04:40 +0200 Message-Id: <20220815180404.529163114@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe Leroy [ Upstream commit 9be013b2a9ecb29b5168e4b9db0e48ed53acf37c ] Commit 0e00a8c9fd92 ("powerpc: Allow CPU selection also on PPC32") enlarged the CPU selection logic to PPC32 by removing depend to PPC64, and failed to restrict that depend to E5500_CPU and E6500_CPU. Fortunately that got unnoticed because -mcpu=3D8540 will override the -mcpu=3De500mc64 or -mpcu=3De6500 as they are ealier, but that's fragile and may no be right in the future. Add back the depend PPC64 on E5500_CPU and E6500_CPU. Fixes: 0e00a8c9fd92 ("powerpc: Allow CPU selection also on PPC32") Signed-off-by: Christophe Leroy Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/8abab4888da69ff78b73a56f64d9678a7bf684e9.16= 57549153.git.christophe.leroy@csgroup.eu Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/powerpc/platforms/Kconfig.cputype | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platform= s/Kconfig.cputype index 87a95cbff2f3..81f8c9634832 100644 --- a/arch/powerpc/platforms/Kconfig.cputype +++ b/arch/powerpc/platforms/Kconfig.cputype @@ -170,11 +170,11 @@ config POWER9_CPU =20 config E5500_CPU bool "Freescale e5500" - depends on E500 + depends on PPC64 && E500 =20 config E6500_CPU bool "Freescale e6500" - depends on E500 + depends on PPC64 && E500 =20 config 860_CPU bool "8xx family" --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72453C25B08 for ; Mon, 15 Aug 2022 19:40:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344356AbiHOTkQ (ORCPT ); Mon, 15 Aug 2022 15:40:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244340AbiHOTg6 (ORCPT ); Mon, 15 Aug 2022 15:36:58 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECD3F31235; Mon, 15 Aug 2022 11:46: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 7E3CF611DD; Mon, 15 Aug 2022 18:46:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AFA3C433C1; Mon, 15 Aug 2022 18:46:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589174; bh=CM7F2rOUBmfcXUgNZhY9n4+a8WWv8wo3ROGfc/dqlQo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cjI7B6GtJBSDb2QKNois5N9NfLoAxFd1hZ1jfUHOCf2pcqANjc0j+pApBP9/W5Xoy nfZfS9RUQ5Hwt93xJnkVn+WFGoxEXjtCsBGPLSGPkY+WaffFHDCXMrrL6O2HtEp6Qc voK50F0rVuzHcZaHFdaRvNcKnf8zZNla1c/AP8DM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexey Kardashevskiy , Michael Ellerman , Sasha Levin Subject: [PATCH 5.15 637/779] powerpc/iommu: Fix iommu_table_in_use for a small default DMA window case Date: Mon, 15 Aug 2022 20:04:41 +0200 Message-Id: <20220815180404.569679022@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexey Kardashevskiy [ Upstream commit d80f6de9d601c30b53c17f00cb7cfe3169f2ddad ] The existing iommu_table_in_use() helper checks if the kernel is using any of TCEs. There are some reserved TCEs: 1) the very first one if DMA window starts from 0 to avoid having a zero but still valid DMA handle; 2) it_reserved_start..it_reserved_end to exclude MMIO32 window in case the default window spans across that - this is the default for the first DMA window on PowerNV. When 1) is the case and 2) is not the helper does not skip 1) and returns wrong status. This only seems occurring when passing through a PCI device to a nested guest (not something we support really well) so it has not been seen before. This fixes the bug by adding a special case for no MMIO32 reservation. Fixes: 3c33066a2190 ("powerpc/kernel/iommu: Add new iommu_table_in_use() he= lper") Signed-off-by: Alexey Kardashevskiy Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220714081119.3714605-1-aik@ozlabs.ru Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/powerpc/kernel/iommu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c index 07093b7cdcb9..a67fd54ccc57 100644 --- a/arch/powerpc/kernel/iommu.c +++ b/arch/powerpc/kernel/iommu.c @@ -776,6 +776,11 @@ bool iommu_table_in_use(struct iommu_table *tbl) /* ignore reserved bit0 */ if (tbl->it_offset =3D=3D 0) start =3D 1; + + /* Simple case with no reserved MMIO32 region */ + if (!tbl->it_reserved_start && !tbl->it_reserved_end) + return find_next_bit(tbl->it_map, tbl->it_size, start) !=3D tbl->it_size; + end =3D tbl->it_reserved_start - tbl->it_offset; if (find_next_bit(tbl->it_map, end, start) !=3D end) return true; --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CD7BC00140 for ; Mon, 15 Aug 2022 19:40:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343999AbiHOTkT (ORCPT ); Mon, 15 Aug 2022 15:40:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245340AbiHOThF (ORCPT ); Mon, 15 Aug 2022 15:37:05 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 67BD731352; Mon, 15 Aug 2022 11:46: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 sin.source.kernel.org (Postfix) with ESMTPS id D5B04CE1272; Mon, 15 Aug 2022 18:46:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3167C433D6; Mon, 15 Aug 2022 18:46:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589178; bh=lh8PcIV0OaoKHeruMeGTWcF3pMbyWXtMi/lOW9qra2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oHglkbO9B16tyJyQYAsockMTw+mkXTBAOvYT7lCWRGJ7Qjq+ZkzUbeFHoFYgUpHbY fVzbwmaKxE0Sn3Nhyhwqk9FSwl7S4JbvylWuPDWgQBT8zkWEce/T6oH36RXPLJxrN+ T2T+TPLQIpwuHPw7Ftrg/qFt0E8RjkAp5Hlw4h+M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Pali=20Roh=C3=A1r?= , Michael Ellerman , Sasha Levin Subject: [PATCH 5.15 638/779] powerpc/pci: Prefer PCI domain assignment via DT linux,pci-domain and alias Date: Mon, 15 Aug 2022 20:04:42 +0200 Message-Id: <20220815180404.617595407@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pali Roh=C3=A1r [ Upstream commit 0fe1e96fef0a5c53b4c0d1500d356f3906000f81 ] Other Linux architectures use DT property 'linux,pci-domain' for specifying fixed PCI domain of PCI controller specified in Device-Tree. And lot of Freescale powerpc boards have defined numbered pci alias in Device-Tree for every PCIe controller which number specify preferred PCI domain. So prefer usage of DT property 'linux,pci-domain' (via function of_get_pci_domain_nr()) and DT pci alias (via function of_alias_get_id()) on powerpc architecture for assigning PCI domain to PCI controller. Fixes: 63a72284b159 ("powerpc/pci: Assign fixed PHB number based on device-= tree properties") Signed-off-by: Pali Roh=C3=A1r Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220706102148.5060-2-pali@kernel.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/powerpc/kernel/pci-common.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-com= mon.c index c3573430919d..08eea633c380 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c @@ -74,16 +74,30 @@ void set_pci_dma_ops(const struct dma_map_ops *dma_ops) static int get_phb_number(struct device_node *dn) { int ret, phb_id =3D -1; - u32 prop_32; u64 prop; =20 /* * Try fixed PHB numbering first, by checking archs and reading - * the respective device-tree properties. Firstly, try powernv by - * reading "ibm,opal-phbid", only present in OPAL environment. + * the respective device-tree properties. Firstly, try reading + * standard "linux,pci-domain", then try reading "ibm,opal-phbid" + * (only present in powernv OPAL environment), then try device-tree + * alias and as the last try to use lower bits of "reg" property. */ - ret =3D of_property_read_u64(dn, "ibm,opal-phbid", &prop); + ret =3D of_get_pci_domain_nr(dn); + if (ret >=3D 0) { + prop =3D ret; + ret =3D 0; + } + if (ret) + ret =3D of_property_read_u64(dn, "ibm,opal-phbid", &prop); + if (ret) + ret =3D of_alias_get_id(dn, "pci"); + if (ret >=3D 0) { + prop =3D ret; + ret =3D 0; + } if (ret) { + u32 prop_32; ret =3D of_property_read_u32_index(dn, "reg", 1, &prop_32); prop =3D prop_32; } @@ -95,10 +109,7 @@ static int get_phb_number(struct device_node *dn) if ((phb_id >=3D 0) && !test_and_set_bit(phb_id, phb_bitmap)) return phb_id; =20 - /* - * If not pseries nor powernv, or if fixed PHB numbering tried to add - * the same PHB number twice, then fallback to dynamic PHB numbering. - */ + /* If everything fails then fallback to dynamic PHB numbering. */ phb_id =3D find_first_zero_bit(phb_bitmap, MAX_PHBS); BUG_ON(phb_id >=3D MAX_PHBS); set_bit(phb_id, phb_bitmap); --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAAFEC00140 for ; Mon, 15 Aug 2022 19:40:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344033AbiHOTkX (ORCPT ); Mon, 15 Aug 2022 15:40:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245630AbiHOThe (ORCPT ); Mon, 15 Aug 2022 15:37:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29D2431349; Mon, 15 Aug 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 E57B9B81057; Mon, 15 Aug 2022 18:46:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 044B9C433C1; Mon, 15 Aug 2022 18:46:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589181; bh=+z29A/P3gfUa+DLcK1Cr+c4N/+VadkGSz84KoYlC+7A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y/clz9Ee3eI2cfG2ggRWs6SegMHv/6r87saS2tksE+qNPU5bs5gNhVEE6G8sy265W kjK7hOoDKFw0+AHvb8ufIzIG27lSbqgq9s8Z2vyw0SG8QF0WjPhyLZqJo7TJvGU6RG rH8PcwDaAojTyV3PJxYoj4VR4vVgT5i6VrAQPVZo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Walle , Sherry Sun , Sasha Levin Subject: [PATCH 5.15 639/779] tty: serial: fsl_lpuart: correct the count of break characters Date: Mon, 15 Aug 2022 20:04:43 +0200 Message-Id: <20220815180404.666599482@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sherry Sun [ Upstream commit 707f816f25590c20e056b3bd4a17ce69b03fe856 ] The LPUART can't distinguish between a break signal and a framing error, so need to count the break characters if there is a framing error and received data is zero instead of the parity error. Fixes: 5541a9bacfe5 ("serial: fsl_lpuart: handle break and make sysrq work") Reviewed-by: Michael Walle Signed-off-by: Sherry Sun Link: https://lore.kernel.org/r/20220725050115.12396-1-sherry.sun@nxp.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/tty/serial/fsl_lpuart.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuar= t.c index 481107fdd69b..4155bd10711d 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c @@ -982,12 +982,12 @@ static void lpuart32_rxint(struct lpuart_port *sport) =20 if (sr & (UARTSTAT_PE | UARTSTAT_OR | UARTSTAT_FE)) { if (sr & UARTSTAT_PE) { + sport->port.icount.parity++; + } else if (sr & UARTSTAT_FE) { if (is_break) sport->port.icount.brk++; else - sport->port.icount.parity++; - } else if (sr & UARTSTAT_FE) { - sport->port.icount.frame++; + sport->port.icount.frame++; } =20 if (sr & UARTSTAT_OR) @@ -1002,12 +1002,12 @@ static void lpuart32_rxint(struct lpuart_port *spor= t) sr &=3D sport->port.read_status_mask; =20 if (sr & UARTSTAT_PE) { + flg =3D TTY_PARITY; + } else if (sr & UARTSTAT_FE) { if (is_break) flg =3D TTY_BREAK; else - flg =3D TTY_PARITY; - } else if (sr & UARTSTAT_FE) { - flg =3D TTY_FRAME; + flg =3D TTY_FRAME; } =20 if (sr & UARTSTAT_OR) --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ADAB2C25B08 for ; Mon, 15 Aug 2022 19:42:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241134AbiHOTmu (ORCPT ); Mon, 15 Aug 2022 15:42:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55348 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343953AbiHOTiQ (ORCPT ); Mon, 15 Aug 2022 15:38:16 -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 1587331357; Mon, 15 Aug 2022 11:46: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 6BEBCB8105D; Mon, 15 Aug 2022 18:46:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1DACC433D6; Mon, 15 Aug 2022 18:46:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589186; bh=OiLI/r7+B3K8dB10cvzdDcNRahAya9DTiPCTuRpfaaw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uNgTd/CtRuDd0G+HVBLBSuyFObninhKDZhnwtP/5pqaT8tl358Uvyzi4wlL6qkl6W /otFFrek0FXReD2z+QNHSMIkQKnGYI0aIOwlM/70y+wVUNxkG+1AjXcYwUmQcl58+S LwcMHnlk2JUMBC+y0bGInNecQbBfzJ8beNsKSs5k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiko Carstens , Alexander Gordeev , Vasily Gorbik , Sasha Levin Subject: [PATCH 5.15 640/779] s390/dump: fix os_info virtual vs physical address confusion Date: Mon, 15 Aug 2022 20:04:44 +0200 Message-Id: <20220815180404.705724643@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Gordeev [ Upstream commit 9de209c7d584d6e06ad92f120d83d4f27c200497 ] Due to historical reasons os_info handling functions misuse the notion of physical vs virtual addresses difference. Note: this does not fix a bug currently, since virtual and physical addresses are identical. Reviewed-by: Heiko Carstens Signed-off-by: Alexander Gordeev Signed-off-by: Vasily Gorbik Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/s390/kernel/os_info.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/s390/kernel/os_info.c b/arch/s390/kernel/os_info.c index e548844dde28..6b5b64e67eee 100644 --- a/arch/s390/kernel/os_info.c +++ b/arch/s390/kernel/os_info.c @@ -46,7 +46,7 @@ void os_info_crashkernel_add(unsigned long base, unsigned= long size) */ void os_info_entry_add(int nr, void *ptr, u64 size) { - os_info.entry[nr].addr =3D (u64)(unsigned long)ptr; + os_info.entry[nr].addr =3D __pa(ptr); os_info.entry[nr].size =3D size; os_info.entry[nr].csum =3D (__force u32)csum_partial(ptr, size, 0); os_info.csum =3D os_info_csum(&os_info); @@ -63,7 +63,7 @@ void __init os_info_init(void) os_info.version_minor =3D OS_INFO_VERSION_MINOR; os_info.magic =3D OS_INFO_MAGIC; os_info.csum =3D os_info_csum(&os_info); - mem_assign_absolute(S390_lowcore.os_info, (unsigned long) ptr); + mem_assign_absolute(S390_lowcore.os_info, __pa(ptr)); } =20 #ifdef CONFIG_CRASH_DUMP --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB061C25B08 for ; Mon, 15 Aug 2022 19:42:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343838AbiHOTmz (ORCPT ); Mon, 15 Aug 2022 15:42:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343957AbiHOTiQ (ORCPT ); Mon, 15 Aug 2022 15:38: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 8F36031DC4; Mon, 15 Aug 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 dfw.source.kernel.org (Postfix) with ESMTPS id 2D383611DB; Mon, 15 Aug 2022 18:46:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A48FC433C1; Mon, 15 Aug 2022 18:46:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589189; bh=6He/nieo34FbAoePLRcPRcoYRJZGQDmNooBT9RKLjkU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NvUpYPVKjemBDeYkrXCZ3T1uEnx1+CPE0cK9rJpnpu+f22sm3q3mgJ0qIkcq7vR4r x7JUWK0Qdih6lR5T8tfabyjpm38sN1lFUpBMtMe250goGMgV0oJUmQaFW+bw5BVgiE eolfAxp/8gzC5eJA4H0zLdxiFugMG0b7bMFd3PuI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiko Carstens , Alexander Gordeev , Vasily Gorbik , Sasha Levin Subject: [PATCH 5.15 641/779] s390/smp: cleanup target CPU callback starting Date: Mon, 15 Aug 2022 20:04:45 +0200 Message-Id: <20220815180404.755545770@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Gordeev [ Upstream commit dc2ab23b992c9d5dab93b9bf01b10b10465e537e ] Macro mem_assign_absolute() is used to initialize a target CPU lowcore callback parameters. But despite the macro name it writes to the absolute lowcore only if the target CPU is offline. In case the CPU is online the macro does implicitly write to the normal memory. That behaviour is correct, but extremely subtle. Sacrifice few program bits in favour of clarity and distinguish between online vs offline CPUs and normal vs absolute lowcore pointer. Reviewed-by: Heiko Carstens Signed-off-by: Alexander Gordeev Signed-off-by: Vasily Gorbik Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/s390/kernel/smp.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index e57eb2260b90..982b72ca677c 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c @@ -328,10 +328,17 @@ static void pcpu_delegate(struct pcpu *pcpu, /* Stop target cpu (if func returns this stops the current cpu). */ pcpu_sigp_retry(pcpu, SIGP_STOP, 0); /* Restart func on the target cpu and stop the current cpu. */ - mem_assign_absolute(lc->restart_stack, stack); - mem_assign_absolute(lc->restart_fn, (unsigned long) func); - mem_assign_absolute(lc->restart_data, (unsigned long) data); - mem_assign_absolute(lc->restart_source, source_cpu); + if (lc) { + lc->restart_stack =3D stack; + lc->restart_fn =3D (unsigned long)func; + lc->restart_data =3D (unsigned long)data; + lc->restart_source =3D source_cpu; + } else { + mem_assign_absolute(lc->restart_stack, stack); + mem_assign_absolute(lc->restart_fn, (unsigned long)func); + mem_assign_absolute(lc->restart_data, (unsigned long)data); + mem_assign_absolute(lc->restart_source, source_cpu); + } __bpon(); asm volatile( "0: sigp 0,%0,%2 # sigp restart to target cpu\n" --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BFC3C25B0E for ; Mon, 15 Aug 2022 19:43:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344274AbiHOTm7 (ORCPT ); Mon, 15 Aug 2022 15:42:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343991AbiHOTiU (ORCPT ); Mon, 15 Aug 2022 15:38: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 87A993ED72; Mon, 15 Aug 2022 11:46:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2579F611DB; Mon, 15 Aug 2022 18:46:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25AB4C433C1; Mon, 15 Aug 2022 18:46:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589192; bh=DQqfjIPCusGfeXhHiEnPPDYHHL0EQoPeHiJRj6wvgJg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tPXasR58sE+90u2/LePNj/asSGZhDi0had+c5Qg0HK/CyPQm/eErq6YAgBzB7/9S+ C4c0tIiM+MtUbl/lHWBchxRO2ErSOm475ciUg+n4R5yNnyo6ghnjN3grjJCDiKfMi6 n9lGXrziD6PC4HdURmaKGQTslyIaqOvsuvaKNFDI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiko Carstens , Alexander Gordeev , Vasily Gorbik , Sasha Levin Subject: [PATCH 5.15 642/779] s390/smp: cleanup control register update routines Date: Mon, 15 Aug 2022 20:04:46 +0200 Message-Id: <20220815180404.804207438@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Gordeev [ Upstream commit 9097fc793f74ef9c677f8c4aed0c24f6f07f0133 ] Get rid of duplicate code and redundant data. Reviewed-by: Heiko Carstens Signed-off-by: Alexander Gordeev Signed-off-by: Vasily Gorbik Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/s390/include/asm/ctl_reg.h | 16 ++++++++++----- arch/s390/kernel/smp.c | 36 +++++++++++---------------------- 2 files changed, 23 insertions(+), 29 deletions(-) diff --git a/arch/s390/include/asm/ctl_reg.h b/arch/s390/include/asm/ctl_re= g.h index 04dc65f8901d..80b93c06a2bb 100644 --- a/arch/s390/include/asm/ctl_reg.h +++ b/arch/s390/include/asm/ctl_reg.h @@ -72,8 +72,17 @@ static __always_inline void __ctl_clear_bit(unsigned int= cr, unsigned int bit) __ctl_load(reg, cr, cr); } =20 -void smp_ctl_set_bit(int cr, int bit); -void smp_ctl_clear_bit(int cr, int bit); +void smp_ctl_set_clear_bit(int cr, int bit, bool set); + +static inline void ctl_set_bit(int cr, int bit) +{ + smp_ctl_set_clear_bit(cr, bit, true); +} + +static inline void ctl_clear_bit(int cr, int bit) +{ + smp_ctl_set_clear_bit(cr, bit, false); +} =20 union ctlreg0 { unsigned long val; @@ -128,8 +137,5 @@ union ctlreg15 { }; }; =20 -#define ctl_set_bit(cr, bit) smp_ctl_set_bit(cr, bit) -#define ctl_clear_bit(cr, bit) smp_ctl_clear_bit(cr, bit) - #endif /* __ASSEMBLY__ */ #endif /* __ASM_CTL_REG_H */ diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index 982b72ca677c..7bbcb5b8d3f6 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c @@ -579,39 +579,27 @@ static void smp_ctl_bit_callback(void *info) } =20 static DEFINE_SPINLOCK(ctl_lock); -static unsigned long ctlreg; =20 -/* - * Set a bit in a control register of all cpus - */ -void smp_ctl_set_bit(int cr, int bit) +void smp_ctl_set_clear_bit(int cr, int bit, bool set) { - struct ec_creg_mask_parms parms =3D { 1UL << bit, -1UL, cr }; - - spin_lock(&ctl_lock); - memcpy_absolute(&ctlreg, &S390_lowcore.cregs_save_area[cr], sizeof(ctlreg= )); - __set_bit(bit, &ctlreg); - memcpy_absolute(&S390_lowcore.cregs_save_area[cr], &ctlreg, sizeof(ctlreg= )); - spin_unlock(&ctl_lock); - on_each_cpu(smp_ctl_bit_callback, &parms, 1); -} -EXPORT_SYMBOL(smp_ctl_set_bit); - -/* - * Clear a bit in a control register of all cpus - */ -void smp_ctl_clear_bit(int cr, int bit) -{ - struct ec_creg_mask_parms parms =3D { 0, ~(1UL << bit), cr }; + struct ec_creg_mask_parms parms =3D { .cr =3D cr, }; + u64 ctlreg; =20 + if (set) { + parms.orval =3D 1UL << bit; + parms.andval =3D -1UL; + } else { + parms.orval =3D 0; + parms.andval =3D ~(1UL << bit); + } spin_lock(&ctl_lock); memcpy_absolute(&ctlreg, &S390_lowcore.cregs_save_area[cr], sizeof(ctlreg= )); - __clear_bit(bit, &ctlreg); + ctlreg =3D (ctlreg & parms.andval) | parms.orval; memcpy_absolute(&S390_lowcore.cregs_save_area[cr], &ctlreg, sizeof(ctlreg= )); spin_unlock(&ctl_lock); on_each_cpu(smp_ctl_bit_callback, &parms, 1); } -EXPORT_SYMBOL(smp_ctl_clear_bit); +EXPORT_SYMBOL(smp_ctl_set_clear_bit); =20 #ifdef CONFIG_CRASH_DUMP =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19679C3F6B0 for ; Mon, 15 Aug 2022 19:43:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344380AbiHOTnF (ORCPT ); Mon, 15 Aug 2022 15:43:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344116AbiHOTia (ORCPT ); Mon, 15 Aug 2022 15:38:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C23923FA19; Mon, 15 Aug 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 dfw.source.kernel.org (Postfix) with ESMTPS id 4D043611DD; Mon, 15 Aug 2022 18:46:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3D83EC433D6; Mon, 15 Aug 2022 18:46:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589195; bh=aNIxx6z7knY/YW6XDKOiztcUiW0pNHqrHuUnLYw9M+8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dJ3F17vh5Q4rMR9vDbfMNIKgaoir2BFuhy5UaVFyRZ5LgSerhaEpsndDXZARE18Rf giyr0Tl43F21q77GdqN2TdEE1MuNvSxWW9KIqsdUbUxtltS4jmfsdfu5taoPn0odUY Zj82l/1huVE6o5OKFbSXIvgmFwK0hA8pZ2CINbbY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiko Carstens , Alexander Gordeev , Vasily Gorbik , Sasha Levin Subject: [PATCH 5.15 643/779] s390/maccess: rework absolute lowcore accessors Date: Mon, 15 Aug 2022 20:04:47 +0200 Message-Id: <20220815180404.851126944@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Gordeev [ Upstream commit ed0192bc644f3553d64a5cb461bdd0b1fbae3fdf ] Macro mem_assign_absolute() is able to access the whole memory, but is only used and makes sense when updating the absolute lowcore. Instead, introduce get_abs_lowcore() and put_abs_lowcore() macros that limit access to absolute lowcore addresses only. Suggested-by: Heiko Carstens Reviewed-by: Heiko Carstens Signed-off-by: Alexander Gordeev Signed-off-by: Vasily Gorbik Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/s390/include/asm/processor.h | 17 ++++++++++++----- arch/s390/kernel/ipl.c | 4 ++-- arch/s390/kernel/machine_kexec.c | 2 +- arch/s390/kernel/os_info.c | 2 +- arch/s390/kernel/setup.c | 19 ++++++++++--------- arch/s390/kernel/smp.c | 12 ++++++------ 6 files changed, 32 insertions(+), 24 deletions(-) diff --git a/arch/s390/include/asm/processor.h b/arch/s390/include/asm/proc= essor.h index e9db8efd50f2..d7ca76bb2720 100644 --- a/arch/s390/include/asm/processor.h +++ b/arch/s390/include/asm/processor.h @@ -321,11 +321,18 @@ extern void (*s390_base_pgm_handler_fn)(void); extern int memcpy_real(void *, unsigned long, size_t); extern void memcpy_absolute(void *, void *, size_t); =20 -#define mem_assign_absolute(dest, val) do { \ - __typeof__(dest) __tmp =3D (val); \ - \ - BUILD_BUG_ON(sizeof(__tmp) !=3D sizeof(val)); \ - memcpy_absolute(&(dest), &__tmp, sizeof(__tmp)); \ +#define put_abs_lowcore(member, x) do { \ + unsigned long __abs_address =3D offsetof(struct lowcore, member); \ + __typeof__(((struct lowcore *)0)->member) __tmp =3D (x); \ + \ + memcpy_absolute(__va(__abs_address), &__tmp, sizeof(__tmp)); \ +} while (0) + +#define get_abs_lowcore(x, member) do { \ + unsigned long __abs_address =3D offsetof(struct lowcore, member); \ + __typeof__(((struct lowcore *)0)->member) *__ptr =3D &(x); \ + \ + memcpy_absolute(__ptr, __va(__abs_address), sizeof(*__ptr)); \ } while (0) =20 extern int s390_isolate_bp(void); diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c index 5ad1dde23dc5..ba2988783d66 100644 --- a/arch/s390/kernel/ipl.c +++ b/arch/s390/kernel/ipl.c @@ -1646,8 +1646,8 @@ static void dump_reipl_run(struct shutdown_trigger *t= rigger) =20 csum =3D (__force unsigned int) csum_partial(reipl_block_actual, reipl_block_actual->hdr.len, 0); - mem_assign_absolute(S390_lowcore.ipib, ipib); - mem_assign_absolute(S390_lowcore.ipib_checksum, csum); + put_abs_lowcore(ipib, ipib); + put_abs_lowcore(ipib_checksum, csum); dump_run(trigger); } =20 diff --git a/arch/s390/kernel/machine_kexec.c b/arch/s390/kernel/machine_ke= xec.c index 0505e55a6297..4b95684fbe46 100644 --- a/arch/s390/kernel/machine_kexec.c +++ b/arch/s390/kernel/machine_kexec.c @@ -227,7 +227,7 @@ void arch_crash_save_vmcoreinfo(void) vmcoreinfo_append_str("SAMODE31=3D%lx\n", __samode31); vmcoreinfo_append_str("EAMODE31=3D%lx\n", __eamode31); vmcoreinfo_append_str("KERNELOFFSET=3D%lx\n", kaslr_offset()); - mem_assign_absolute(S390_lowcore.vmcore_info, paddr_vmcoreinfo_note()); + put_abs_lowcore(vmcore_info, paddr_vmcoreinfo_note()); } =20 void machine_shutdown(void) diff --git a/arch/s390/kernel/os_info.c b/arch/s390/kernel/os_info.c index 6b5b64e67eee..1acc2e05d70f 100644 --- a/arch/s390/kernel/os_info.c +++ b/arch/s390/kernel/os_info.c @@ -63,7 +63,7 @@ void __init os_info_init(void) os_info.version_minor =3D OS_INFO_VERSION_MINOR; os_info.magic =3D OS_INFO_MAGIC; os_info.csum =3D os_info_csum(&os_info); - mem_assign_absolute(S390_lowcore.os_info, __pa(ptr)); + put_abs_lowcore(os_info, __pa(ptr)); } =20 #ifdef CONFIG_CRASH_DUMP diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index 36c1f31dfd66..6b1a8697fae8 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c @@ -479,11 +479,11 @@ static void __init setup_lowcore_dat_off(void) lc->mcck_stack =3D mcck_stack + STACK_INIT_OFFSET; =20 /* Setup absolute zero lowcore */ - mem_assign_absolute(S390_lowcore.restart_stack, lc->restart_stack); - mem_assign_absolute(S390_lowcore.restart_fn, lc->restart_fn); - mem_assign_absolute(S390_lowcore.restart_data, lc->restart_data); - mem_assign_absolute(S390_lowcore.restart_source, lc->restart_source); - mem_assign_absolute(S390_lowcore.restart_psw, lc->restart_psw); + put_abs_lowcore(restart_stack, lc->restart_stack); + put_abs_lowcore(restart_fn, lc->restart_fn); + put_abs_lowcore(restart_data, lc->restart_data); + put_abs_lowcore(restart_source, lc->restart_source); + put_abs_lowcore(restart_psw, lc->restart_psw); =20 lc->spinlock_lockval =3D arch_spin_lockval(0); lc->spinlock_index =3D 0; @@ -500,6 +500,7 @@ static void __init setup_lowcore_dat_off(void) static void __init setup_lowcore_dat_on(void) { struct lowcore *lc =3D lowcore_ptr[0]; + int cr; =20 __ctl_clear_bit(0, 28); S390_lowcore.external_new_psw.mask |=3D PSW_MASK_DAT; @@ -508,10 +509,10 @@ static void __init setup_lowcore_dat_on(void) S390_lowcore.io_new_psw.mask |=3D PSW_MASK_DAT; __ctl_store(S390_lowcore.cregs_save_area, 0, 15); __ctl_set_bit(0, 28); - mem_assign_absolute(S390_lowcore.restart_flags, RESTART_FLAG_CTLREGS); - mem_assign_absolute(S390_lowcore.program_new_psw, lc->program_new_psw); - memcpy_absolute(&S390_lowcore.cregs_save_area, lc->cregs_save_area, - sizeof(S390_lowcore.cregs_save_area)); + put_abs_lowcore(restart_flags, RESTART_FLAG_CTLREGS); + put_abs_lowcore(program_new_psw, lc->program_new_psw); + for (cr =3D 0; cr < ARRAY_SIZE(lc->cregs_save_area); cr++) + put_abs_lowcore(cregs_save_area[cr], lc->cregs_save_area[cr]); } =20 static struct resource code_resource =3D { diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c index 7bbcb5b8d3f6..35af70ed58fc 100644 --- a/arch/s390/kernel/smp.c +++ b/arch/s390/kernel/smp.c @@ -334,10 +334,10 @@ static void pcpu_delegate(struct pcpu *pcpu, lc->restart_data =3D (unsigned long)data; lc->restart_source =3D source_cpu; } else { - mem_assign_absolute(lc->restart_stack, stack); - mem_assign_absolute(lc->restart_fn, (unsigned long)func); - mem_assign_absolute(lc->restart_data, (unsigned long)data); - mem_assign_absolute(lc->restart_source, source_cpu); + put_abs_lowcore(restart_stack, stack); + put_abs_lowcore(restart_fn, (unsigned long)func); + put_abs_lowcore(restart_data, (unsigned long)data); + put_abs_lowcore(restart_source, source_cpu); } __bpon(); asm volatile( @@ -593,9 +593,9 @@ void smp_ctl_set_clear_bit(int cr, int bit, bool set) parms.andval =3D ~(1UL << bit); } spin_lock(&ctl_lock); - memcpy_absolute(&ctlreg, &S390_lowcore.cregs_save_area[cr], sizeof(ctlreg= )); + get_abs_lowcore(ctlreg, cregs_save_area[cr]); ctlreg =3D (ctlreg & parms.andval) | parms.orval; - memcpy_absolute(&S390_lowcore.cregs_save_area[cr], &ctlreg, sizeof(ctlreg= )); + put_abs_lowcore(cregs_save_area[cr], ctlreg); spin_unlock(&ctl_lock); on_each_cpu(smp_ctl_bit_callback, &parms, 1); } --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC1C3C25B08 for ; Mon, 15 Aug 2022 19:43:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344408AbiHOTnH (ORCPT ); Mon, 15 Aug 2022 15:43:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245185AbiHOTig (ORCPT ); Mon, 15 Aug 2022 15:38: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 031503FA21; Mon, 15 Aug 2022 11:46: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 95131611DB; Mon, 15 Aug 2022 18:46:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 82347C433D6; Mon, 15 Aug 2022 18:46:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589199; bh=2c/eqYOdA18TAZX5IpO0DONV+1HCzEmfBOAB1tPKM0M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wn0ToYUw+Ytllbe4HS/Gus45W2OjNakQjscBc7DM5NS2h3kRN4wSInxSx4igzyU7g ysSNV+hOksmU9bbirfjamgWSJi7M7Sjvq0+x1UNVUIFKocLey4n8LciQs6LEqDIX9K 1rGSrTDLufoMBkLjcnT8Ap26vuAQ2EHzlQZsoG/I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiko Carstens , Alexander Gordeev , Sasha Levin Subject: [PATCH 5.15 644/779] s390/smp: enforce lowcore protection on CPU restart Date: Mon, 15 Aug 2022 20:04:48 +0200 Message-Id: <20220815180404.884030334@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Gordeev [ Upstream commit 6f5c672d17f583b081e283927f5040f726c54598 ] As result of commit 915fea04f932 ("s390/smp: enable DAT before CPU restart callback is called") the low-address protection bit gets mistakenly unset in control register 0 save area of the absolute zero memory. That area is used when manual PSW restart happened to hit an offline CPU. In this case the low-address protection for that CPU will be dropped. Reviewed-by: Heiko Carstens Fixes: 915fea04f932 ("s390/smp: enable DAT before CPU restart callback is c= alled") Signed-off-by: Alexander Gordeev Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/s390/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c index 6b1a8697fae8..c8e7b3db82e2 100644 --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c @@ -507,8 +507,8 @@ static void __init setup_lowcore_dat_on(void) S390_lowcore.svc_new_psw.mask |=3D PSW_MASK_DAT; S390_lowcore.program_new_psw.mask |=3D PSW_MASK_DAT; S390_lowcore.io_new_psw.mask |=3D PSW_MASK_DAT; - __ctl_store(S390_lowcore.cregs_save_area, 0, 15); __ctl_set_bit(0, 28); + __ctl_store(S390_lowcore.cregs_save_area, 0, 15); put_abs_lowcore(restart_flags, RESTART_FLAG_CTLREGS); put_abs_lowcore(program_new_psw, lc->program_new_psw); for (cr =3D 0; cr < ARRAY_SIZE(lc->cregs_save_area); cr++) --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5110FC282E7 for ; Mon, 15 Aug 2022 19:43:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344442AbiHOTnL (ORCPT ); Mon, 15 Aug 2022 15:43:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344193AbiHOTip (ORCPT ); Mon, 15 Aug 2022 15:38: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 741F43FA30; Mon, 15 Aug 2022 11:46: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 116D161029; Mon, 15 Aug 2022 18:46:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C10F3C433C1; Mon, 15 Aug 2022 18:46:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589202; bh=miZTVE+YOz/R7w6hCTacYkqD1Esp9ssmE5hadX5Egfk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uy1xStPzbGNsCSCUpmSwggnWAaL7KpOwS43+xk6ZmWisZ/TGwoaJkhYOXn+jTRdpr 36db4YxrxU+PDDKloFpc5WGZPAHv4kcEFHWYn/ufwiQ8MGZTz0hgRFE0oUjodQVS53 X34E8RoVQd7msnJiZcPfxLzpRaIDjZL6dORVNgUE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chao Yu , Chao Liu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 5.15 645/779] f2fs: fix to remove F2FS_COMPR_FL and tag F2FS_NOCOMP_FL at the same time Date: Mon, 15 Aug 2022 20:04:49 +0200 Message-Id: <20220815180404.932766673@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chao Liu [ Upstream commit 8ee236dcaa690d09ca612622e8bc8d09c302021d ] If the inode has the compress flag, it will fail to use 'chattr -c +m' to remove its compress flag and tag no compress flag. However, the same command will be successful when executed again, as shown below: $ touch foo.txt $ chattr +c foo.txt $ chattr -c +m foo.txt chattr: Invalid argument while setting flags on foo.txt $ chattr -c +m foo.txt $ f2fs_io getflags foo.txt get a flag on foo.txt ret=3D0, flags=3Dnocompression,inline_data Fix this by removing some checks in f2fs_setflags_common() that do not affect the original logic. I go through all the possible scenarios, and the results are as follows. Bold is the only thing that has changed. +---------------+-----------+-----------+----------+ | | file flags | + command +-----------+-----------+----------+ | | no flag | compr | nocompr | +---------------+-----------+-----------+----------+ | chattr +c | compr | compr | -EINVAL | | chattr -c | no flag | no flag | nocompr | | chattr +m | nocompr | -EINVAL | nocompr | | chattr -m | no flag | compr | no flag | | chattr +c +m | -EINVAL | -EINVAL | -EINVAL | | chattr +c -m | compr | compr | compr | | chattr -c +m | nocompr | *nocompr* | nocompr | | chattr -c -m | no flag | no flag | no flag | +---------------+-----------+-----------+----------+ Link: https://lore.kernel.org/linux-f2fs-devel/20220621064833.1079383-1-cha= oliu719@gmail.com/ Fixes: 4c8ff7095bef ("f2fs: support data compression") Reviewed-by: Chao Yu Signed-off-by: Chao Liu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/f2fs/file.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index bfcafc20eada..eacc80ac160f 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -1869,10 +1869,7 @@ static int f2fs_setflags_common(struct inode *inode,= u32 iflags, u32 mask) if (masked_flags & F2FS_COMPR_FL) { if (!f2fs_disable_compressed_file(inode)) return -EINVAL; - } - if (iflags & F2FS_NOCOMP_FL) - return -EINVAL; - if (iflags & F2FS_COMPR_FL) { + } else { if (!f2fs_may_compress(inode)) return -EINVAL; if (S_ISREG(inode->i_mode) && inode->i_size) @@ -1881,10 +1878,6 @@ static int f2fs_setflags_common(struct inode *inode,= u32 iflags, u32 mask) set_compress_context(inode); } } - if ((iflags ^ masked_flags) & F2FS_NOCOMP_FL) { - if (masked_flags & F2FS_COMPR_FL) - return -EINVAL; - } =20 fi->i_flags =3D iflags | (fi->i_flags & ~mask); f2fs_bug_on(F2FS_I_SB(inode), (fi->i_flags & F2FS_COMPR_FL) && --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61A58C25B0E for ; Mon, 15 Aug 2022 19:43:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344482AbiHOTnQ (ORCPT ); Mon, 15 Aug 2022 15:43:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344223AbiHOTjM (ORCPT ); Mon, 15 Aug 2022 15:39:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5D873FA36; Mon, 15 Aug 2022 11:46: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 48775611EA; Mon, 15 Aug 2022 18:46:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B668C433C1; Mon, 15 Aug 2022 18:46:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589208; bh=oh8spEm7HRDLUB099iOQF8whp8gjdsZtkabb2xOHksk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WXgsUPlQQzoei0LZwzMqhZ+gKK0quMjwKAm8gFeMiz+HszhrBj+NvN9P7TZ/SSRk/ zQkqzboSD/u8LOmb8y087zygeTQw8NIqZLqJ0fBoLLtpDKePxw+FK3Q2prGeOK/pUH neco8c5SxfuFNEUoz+FnqOaYeCGkmfD+cQeu6QkY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Arnd Bergmann , Michael Ellerman , Sasha Levin Subject: [PATCH 5.15 646/779] powerpc/spufs: Fix refcount leak in spufs_init_isolated_loader Date: Mon, 15 Aug 2022 20:04:50 +0200 Message-Id: <20220815180404.979237902@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 6ac059dacffa8ab2f7798f20e4bd3333890c541c ] of_find_node_by_path() returns remote device nodepointer with refcount incremented, we should use of_node_put() on it when done. Add missing of_node_put() to avoid refcount leak. Fixes: 0afacde3df4c ("[POWERPC] spufs: allow isolated mode apps by starting= the SPE loader") Signed-off-by: Miaoqian Lin Acked-by: Arnd Bergmann Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220603121543.22884-1-linmq006@gmail.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/powerpc/platforms/cell/spufs/inode.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platf= orms/cell/spufs/inode.c index bed05b644c2c..ed37a93bf858 100644 --- a/arch/powerpc/platforms/cell/spufs/inode.c +++ b/arch/powerpc/platforms/cell/spufs/inode.c @@ -659,6 +659,7 @@ spufs_init_isolated_loader(void) return; =20 loader =3D of_get_property(dn, "loader", &size); + of_node_put(dn); if (!loader) return; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99DBEC00140 for ; Mon, 15 Aug 2022 19:43:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344523AbiHOTnf (ORCPT ); Mon, 15 Aug 2022 15:43:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344230AbiHOTjN (ORCPT ); Mon, 15 Aug 2022 15:39: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 83540402C1; Mon, 15 Aug 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 ams.source.kernel.org (Postfix) with ESMTPS id 0AD6DB8105C; Mon, 15 Aug 2022 18:46:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5025AC433C1; Mon, 15 Aug 2022 18:46:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589211; bh=aiNS8m4zZFUULNlVvVO20tIZMp6ooCOq2nuoy3iOBus=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=egTjS53vBpPc3YVhrVV7+0aMZwSps3Vyq0UZvnbInTioCj3E/wekTBpeRE9p6ITk3 CzHKcVX6JRNZlZmi6PyN5qiDxsYLNfOnDMJiMCFiD5TOZxozYMwgUicUwMZtAwFAv0 tJ1L7NxhgnCWOxDS5MyjxHHdNK5GJ6N8iFhnwjXU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Michael Ellerman , Sasha Levin Subject: [PATCH 5.15 647/779] powerpc/xive: Fix refcount leak in xive_get_max_prio Date: Mon, 15 Aug 2022 20:04:51 +0200 Message-Id: <20220815180405.026057307@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 255b650cbec6849443ce2e0cdd187fd5e61c218c ] of_find_node_by_path() returns a node pointer with refcount incremented, we should use of_node_put() on it when done. Add missing of_node_put() to avoid refcount leak. Fixes: eac1e731b59e ("powerpc/xive: guest exploitation of the XIVE interrup= t controller") Signed-off-by: Miaoqian Lin Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220605053225.56125-1-linmq006@gmail.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/powerpc/sysdev/xive/spapr.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/sysdev/xive/spapr.c b/arch/powerpc/sysdev/xive/sp= apr.c index 583b2c6df390..2bf78a30238b 100644 --- a/arch/powerpc/sysdev/xive/spapr.c +++ b/arch/powerpc/sysdev/xive/spapr.c @@ -716,6 +716,7 @@ static bool xive_get_max_prio(u8 *max_prio) } =20 reg =3D of_get_property(rootdn, "ibm,plat-res-int-priorities", &len); + of_node_put(rootdn); if (!reg) { pr_err("Failed to read 'ibm,plat-res-int-priorities' property\n"); return false; --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49C6BC00140 for ; Mon, 15 Aug 2022 19:43:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344536AbiHOTnl (ORCPT ); Mon, 15 Aug 2022 15:43:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344250AbiHOTjT (ORCPT ); Mon, 15 Aug 2022 15:39: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 B114D402D1; Mon, 15 Aug 2022 11:46: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 7439BB8105C; Mon, 15 Aug 2022 18:46:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AFA0BC433D6; Mon, 15 Aug 2022 18:46:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589215; bh=n4ydhLWTwQ0Ro1UivgLERAa8kdCl/YEYoqbe4qCFrL4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nQZKAFJCvxCYiUWlH2BRX4uV6RdA8HkXpoE8YbNVoGues/bOSNDEbJz6FiygMOARp kTknTCUFf25IabhioJKUGEJD8fIjD6zJGFuMfJgYP1S+37Iyug7naRxVRSoGMCYaOY JhGr25838XIA3G1X8qq0EXyr7/pZHcEOaD7xX4+I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Michael Ellerman , Sasha Levin Subject: [PATCH 5.15 648/779] powerpc/cell/axon_msi: Fix refcount leak in setup_msi_msg_address Date: Mon, 15 Aug 2022 20:04:52 +0200 Message-Id: <20220815180405.070191290@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit df5d4b616ee76abc97e5bd348e22659c2b095b1c ] of_get_next_parent() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() in the error path to avoid refcount leak. Fixes: ce21b3c9648a ("[CELL] add support for MSI on Axon-based Cell systems= ") Signed-off-by: Miaoqian Lin Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220605065129.63906-1-linmq006@gmail.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/powerpc/platforms/cell/axon_msi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/platforms/cell/axon_msi.c b/arch/powerpc/platform= s/cell/axon_msi.c index 82335e364c44..f630693c8de7 100644 --- a/arch/powerpc/platforms/cell/axon_msi.c +++ b/arch/powerpc/platforms/cell/axon_msi.c @@ -226,6 +226,7 @@ static int setup_msi_msg_address(struct pci_dev *dev, s= truct msi_msg *msg) if (!prop) { dev_dbg(&dev->dev, "axon_msi: no msi-address-(32|64) properties found\n"); + of_node_put(dn); return -ENOENT; } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA557C00140 for ; Mon, 15 Aug 2022 19:43:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344569AbiHOTnq (ORCPT ); Mon, 15 Aug 2022 15:43:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344261AbiHOTjU (ORCPT ); Mon, 15 Aug 2022 15:39:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47FB3402D2; Mon, 15 Aug 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 D0A6461029; Mon, 15 Aug 2022 18:46:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7AB8C433C1; Mon, 15 Aug 2022 18:46:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589218; bh=wDfmcr8hqpXBUVKskBOJMr0tIJOdTKM3fBqq+O/LQL8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uaV+uoA7ZQaVKhwozIshNAfXyAi8Ybckf3BtVldu13D1Bsyrq4G+KCPIX/1vnEUnU q1Ajk3OsigJfs2gfiWjAjIt30VorFGZRDEUxTJaqyQqR+Zi/ilVoY45ZJXXbPm+ANK hW8C34yceIH7ZMJ/Wz8fxQqztgY58Ey7zgtavuMw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Leo Yan , Ian Rogers , Alexander Shishkin , Jiri Olsa , Mark Rutland , Namhyung Kim , Peter Zijlstra , Stephane Eranian , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.15 649/779] perf symbol: Fail to read phdr workaround Date: Mon, 15 Aug 2022 20:04:53 +0200 Message-Id: <20220815180405.115224213@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ian Rogers [ Upstream commit 6d518ac7be6223811ab947897273b1bbef846180 ] The perf jvmti agent doesn't create program headers, in this case fallback on section headers as happened previously. Committer notes: To test this, from a public post by Ian: 1) download a Java workload dacapo-9.12-MR1-bach.jar from https://sourceforge.net/projects/dacapobench/ 2) build perf such as "make -C tools/perf O=3D/tmp/perf NO_LIBBFD=3D1" it should detect Java and create /tmp/perf/libperf-jvmti.so 3) run perf with the jvmti agent: perf record -k 1 java -agentpath:/tmp/perf/libperf-jvmti.so -jar dacapo-9= .12-MR1-bach.jar -n 10 fop 4) run perf inject: perf inject -i perf.data -o perf-injected.data -j 5) run perf report perf report -i perf-injected.data | grep org.apache.fop With this patch reverted I see lots of symbols like: 0.00% java jitted-388040-4656.so [.] org.apache.fop.fo.F= Obj.bind(org.apache.fop.fo.PropertyList) With the patch (2d86612aacb7805f ("perf symbol: Correct address for bss symbols")) I see lots of: dso__load_sym_internal: failed to find program header for symbol: Lorg/apache/fop/fo/FObj;bind(Lorg/apache/fop/fo/PropertyList;)V st_value: 0x40 Fixes: 2d86612aacb7805f ("perf symbol: Correct address for bss symbols") Reviewed-by: Leo Yan Signed-off-by: Ian Rogers Tested-by: Leo Yan Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Leo Yan Cc: Mark Rutland Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lore.kernel.org/lkml/20220731164923.691193-1-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- tools/perf/util/symbol-elf.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c index ef6ced5c5746..cb7b24493782 100644 --- a/tools/perf/util/symbol-elf.c +++ b/tools/perf/util/symbol-elf.c @@ -1294,16 +1294,29 @@ dso__load_sym_internal(struct dso *dso, struct map = *map, struct symsrc *syms_ss, =20 if (elf_read_program_header(syms_ss->elf, (u64)sym.st_value, &phdr)) { - pr_warning("%s: failed to find program header for " + pr_debug4("%s: failed to find program header for " "symbol: %s st_value: %#" PRIx64 "\n", __func__, elf_name, (u64)sym.st_value); - continue; + pr_debug4("%s: adjusting symbol: st_value: %#" PRIx64 " " + "sh_addr: %#" PRIx64 " sh_offset: %#" PRIx64 "\n", + __func__, (u64)sym.st_value, (u64)shdr.sh_addr, + (u64)shdr.sh_offset); + /* + * Fail to find program header, let's rollback + * to use shdr.sh_addr and shdr.sh_offset to + * calibrate symbol's file address, though this + * is not necessary for normal C ELF file, we + * still need to handle java JIT symbols in this + * case. + */ + sym.st_value -=3D shdr.sh_addr - shdr.sh_offset; + } else { + pr_debug4("%s: adjusting symbol: st_value: %#" PRIx64 " " + "p_vaddr: %#" PRIx64 " p_offset: %#" PRIx64 "\n", + __func__, (u64)sym.st_value, (u64)phdr.p_vaddr, + (u64)phdr.p_offset); + sym.st_value -=3D phdr.p_vaddr - phdr.p_offset; } - pr_debug4("%s: adjusting symbol: st_value: %#" PRIx64 " " - "p_vaddr: %#" PRIx64 " p_offset: %#" PRIx64 "\n", - __func__, (u64)sym.st_value, (u64)phdr.p_vaddr, - (u64)phdr.p_offset); - sym.st_value -=3D phdr.p_vaddr - phdr.p_offset; } =20 demangled =3D demangle_sym(dso, kmodule, elf_name); --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 818C3C00140 for ; Mon, 15 Aug 2022 19:43:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344608AbiHOTn4 (ORCPT ); Mon, 15 Aug 2022 15:43:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343507AbiHOTj2 (ORCPT ); Mon, 15 Aug 2022 15:39: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 5D7AA3FA3B; Mon, 15 Aug 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 E7FF7611C1; Mon, 15 Aug 2022 18:47:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF23AC433D6; Mon, 15 Aug 2022 18:47:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589221; bh=s6q4I9E/H3aJyGcKpp4gtkOiVcuq9GHZGZImjn6O7mc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1Ri4zdHgI0wyVKWsMMhZha6NLA24V6iiffnMAnuDr1p8BsQYcvgh5OhkfMlTsCjrN O2a/+LHYMauINb0mBYNNZ/UdlIMJZ/1GtkiE+uys6IrD6xBVsnRKOFccTZCpRvTEM6 63FGaOKk10PoQMRSp+IDfPgqWk6Ogh77lMq989tQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen Zhongjin , Ingo Molnar , "Masami Hiramatsu (Google)" , Sasha Levin Subject: [PATCH 5.15 650/779] kprobes: Forbid probing on trampoline and BPF code areas Date: Mon, 15 Aug 2022 20:04:54 +0200 Message-Id: <20220815180405.152343725@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Zhongjin [ Upstream commit 28f6c37a2910f565b4f5960df52b2eccae28c891 ] kernel_text_address() treats ftrace_trampoline, kprobe_insn_slot and bpf_text_address as valid kprobe addresses - which is not ideal. These text areas are removable and changeable without any notification to kprobes, and probing on them can trigger unexpected behavior: https://lkml.org/lkml/2022/7/26/1148 Considering that jump_label and static_call text are already forbiden to probe, kernel_text_address() should be replaced with core_kernel_text() and is_module_text_address() to check other text areas which are unsafe to kprobe. [ mingo: Rewrote the changelog. ] Fixes: 5b485629ba0d ("kprobes, extable: Identify kprobes trampolines as ker= nel text area") Fixes: 74451e66d516 ("bpf: make jited programs visible in traces") Signed-off-by: Chen Zhongjin Signed-off-by: Ingo Molnar Acked-by: Masami Hiramatsu (Google) Link: https://lore.kernel.org/r/20220801033719.228248-1-chenzhongjin@huawei= .com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- kernel/kprobes.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 2ef90d15699f..3a3c0166bd1f 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -1559,7 +1559,8 @@ static int check_kprobe_address_safe(struct kprobe *p, preempt_disable(); =20 /* Ensure it is not in reserved area nor out of text */ - if (!kernel_text_address((unsigned long) p->addr) || + if (!(core_kernel_text((unsigned long) p->addr) || + is_module_text_address((unsigned long) p->addr)) || within_kprobe_blacklist((unsigned long) p->addr) || jump_label_text_reserved(p->addr, p->addr) || static_call_text_reserved(p->addr, p->addr) || --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0EC4C00140 for ; Mon, 15 Aug 2022 19:44:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344647AbiHOToA (ORCPT ); Mon, 15 Aug 2022 15:44:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344358AbiHOTkQ (ORCPT ); Mon, 15 Aug 2022 15:40:16 -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 9CD5E402F8; Mon, 15 Aug 2022 11:47: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 C8256B81085; Mon, 15 Aug 2022 18:47:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1ED4EC4314F; Mon, 15 Aug 2022 18:47:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589224; bh=RbdrB2ItTg/BQanc9oDqPCLEHobXmx1sahtu8v1k7UQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EHwqrhV050ZvVoqer+hPRcV0FLIc3nl6RYTuVpRHpj+9mt5rtPxReAZ3RoTDW/oce fh5j2lkumch/rENuwKMwDrAWd/XXcAMdYwI5OjoV7n308JNf3WRUnHI3TUTDbWpRIL KfmGiM4DP60P/nXwvqaaQ3HB3IYeb+g2+B47C+FM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chenyi Qiang , Ingo Molnar , Tony Luck , Sasha Levin Subject: [PATCH 5.15 651/779] x86/bus_lock: Dont assume the init value of DEBUGCTLMSR.BUS_LOCK_DETECT to be zero Date: Mon, 15 Aug 2022 20:04:55 +0200 Message-Id: <20220815180405.193350957@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chenyi Qiang [ Upstream commit ffa6482e461ff550325356ae705b79e256702ea9 ] It's possible that this kernel has been kexec'd from a kernel that enabled bus lock detection, or (hypothetically) BIOS/firmware has set DEBUGCTLMSR_BUS_LOCK_DETECT. Disable bus lock detection explicitly if not wanted. Fixes: ebb1064e7c2e ("x86/traps: Handle #DB for bus lock") Signed-off-by: Chenyi Qiang Signed-off-by: Ingo Molnar Reviewed-by: Tony Luck Link: https://lore.kernel.org/r/20220802033206.21333-1-chenyi.qiang@intel.c= om Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/x86/kernel/cpu/intel.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index 2c87d62f191e..ae7d4c85f4f4 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c @@ -1145,22 +1145,23 @@ static void bus_lock_init(void) { u64 val; =20 - /* - * Warn and fatal are handled by #AC for split lock if #AC for - * split lock is supported. - */ - if (!boot_cpu_has(X86_FEATURE_BUS_LOCK_DETECT) || - (boot_cpu_has(X86_FEATURE_SPLIT_LOCK_DETECT) && - (sld_state =3D=3D sld_warn || sld_state =3D=3D sld_fatal)) || - sld_state =3D=3D sld_off) + if (!boot_cpu_has(X86_FEATURE_BUS_LOCK_DETECT)) return; =20 - /* - * Enable #DB for bus lock. All bus locks are handled in #DB except - * split locks are handled in #AC in the fatal case. - */ rdmsrl(MSR_IA32_DEBUGCTLMSR, val); - val |=3D DEBUGCTLMSR_BUS_LOCK_DETECT; + + if ((boot_cpu_has(X86_FEATURE_SPLIT_LOCK_DETECT) && + (sld_state =3D=3D sld_warn || sld_state =3D=3D sld_fatal)) || + sld_state =3D=3D sld_off) { + /* + * Warn and fatal are handled by #AC for split lock if #AC for + * split lock is supported. + */ + val &=3D ~DEBUGCTLMSR_BUS_LOCK_DETECT; + } else { + val |=3D DEBUGCTLMSR_BUS_LOCK_DETECT; + } + wrmsrl(MSR_IA32_DEBUGCTLMSR, val); } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D60B3C25B08 for ; Mon, 15 Aug 2022 19:44:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344665AbiHOToI (ORCPT ); Mon, 15 Aug 2022 15:44:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344370AbiHOTkT (ORCPT ); Mon, 15 Aug 2022 15:40:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00592402E6; Mon, 15 Aug 2022 11:47: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 3FD276120B; Mon, 15 Aug 2022 18:47:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31448C43142; Mon, 15 Aug 2022 18:47:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589227; bh=1UMCGvA0ZSvA0u3yFGaFpaWQTxDUFvSAfF08FhqPwPM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UoHe/9P4jQtmYqtMsVTbkWIpmS+j0l3HwB4ERuydDF25jZOpWokb3tax8dJYOW/ds CDBDHeij94JCsHyHvWeRiUPNjvB+mESWuyssmbB9w3gNckRQo1+jwq/aAktkqEYjbB 3/cho5of44Jmd6qqX0Z6pT31pELGCfDv4O+0gloY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Pali=20Roh=C3=A1r?= , Michael Ellerman , Sasha Levin Subject: [PATCH 5.15 652/779] powerpc/pci: Fix PHB numbering when using opal-phbid Date: Mon, 15 Aug 2022 20:04:56 +0200 Message-Id: <20220815180405.240851737@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael Ellerman [ Upstream commit f4b39e88b42d13366b831270306326b5c20971ca ] The recent change to the PHB numbering logic has a logic error in the handling of "ibm,opal-phbid". When an "ibm,opal-phbid" property is present, &prop is written to and ret is set to zero. The following call to of_alias_get_id() is skipped because ret =3D=3D 0. But then the if (ret >=3D 0) is true, and the body of that if statement sets prop =3D ret which throws away the value that was just read from "ibm,opal-phbid". Fix the logic by only doing the ret >=3D 0 check in the of_alias_get_id() case. Fixes: 0fe1e96fef0a ("powerpc/pci: Prefer PCI domain assignment via DT 'lin= ux,pci-domain' and alias") Reviewed-by: Pali Roh=C3=A1r Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220802105723.1055178-1-mpe@ellerman.id.au Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/powerpc/kernel/pci-common.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-com= mon.c index 08eea633c380..fc5187c6559a 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c @@ -90,11 +90,13 @@ static int get_phb_number(struct device_node *dn) } if (ret) ret =3D of_property_read_u64(dn, "ibm,opal-phbid", &prop); - if (ret) + + if (ret) { ret =3D of_alias_get_id(dn, "pci"); - if (ret >=3D 0) { - prop =3D ret; - ret =3D 0; + if (ret >=3D 0) { + prop =3D ret; + ret =3D 0; + } } if (ret) { u32 prop_32; --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 477A2C00140 for ; Mon, 15 Aug 2022 19:44:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344680AbiHOToN (ORCPT ); Mon, 15 Aug 2022 15:44:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344401AbiHOTkg (ORCPT ); Mon, 15 Aug 2022 15:40:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FD7640BD6; Mon, 15 Aug 2022 11:47: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 3E17C611EF; Mon, 15 Aug 2022 18:47:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15AC8C433D7; Mon, 15 Aug 2022 18:47:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589230; bh=e25EplunFs+xhOssElaZHcLWfqW4P+ZY5UR2hRo+Ob0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BO1VFK3/uYHeZEON7oy3e+nF7UrZiz4wIJscHNGu6YdnoVYl8vkGmUQV1PoK/JVmM r+96UyLC3HEqHiqUceL2bhAwaHHlQc5sacmBeASkJnaX9MwaW5KmEQFWgH8IqsBwpa CdFk+hWu2oeje+cj3xJvv8DcRr3KTMdB+wZOtNU4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?=E8=B0=AD=E6=A2=93=E7=85=8A?= , Alexei Starovoitov , Andrii Nakryiko , Daniel Borkmann , Jiri Olsa , John Fastabend , KP Singh , Martin KaFai Lau , Nick Terrell , Song Liu , Stephane Eranian , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 5.15 653/779] genelf: Use HAVE_LIBCRYPTO_SUPPORT, not the never defined HAVE_LIBCRYPTO Date: Mon, 15 Aug 2022 20:04:57 +0200 Message-Id: <20220815180405.286310016@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnaldo Carvalho de Melo [ Upstream commit 91cea6be90e436c55cde8770a15e4dac9d3032d0 ] When genelf was introduced it tested for HAVE_LIBCRYPTO not HAVE_LIBCRYPTO_SUPPORT, which is the define the feature test for openssl defines, fix it. This also adds disables the deprecation warning, someone has to fix this to build with openssl 3.0 before the warning becomes a hard error. Fixes: 9b07e27f88b9cd78 ("perf inject: Add jitdump mmap injection support") Reported-by: =E8=B0=AD=E6=A2=93=E7=85=8A Cc: Alexei Starovoitov Cc: Andrii Nakryiko Cc: Daniel Borkmann Cc: Jiri Olsa Cc: John Fastabend Cc: KP Singh Cc: Martin KaFai Lau Cc: Nick Terrell Cc: Song Liu Cc: Stephane Eranian Link: http://lore.kernel.org/lkml/YulpPqXSOG0Q4J1o@kernel.org Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- tools/perf/util/genelf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/perf/util/genelf.c b/tools/perf/util/genelf.c index aed49806a09b..953338b9e887 100644 --- a/tools/perf/util/genelf.c +++ b/tools/perf/util/genelf.c @@ -30,7 +30,11 @@ =20 #define BUILD_ID_URANDOM /* different uuid for each run */ =20 -#ifdef HAVE_LIBCRYPTO +// FIXME, remove this and fix the deprecation warnings before its removed = and +// We'll break for good here... +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + +#ifdef HAVE_LIBCRYPTO_SUPPORT =20 #define BUILD_ID_MD5 #undef BUILD_ID_SHA /* does not seem to work well when linked with Java */ --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7B1AC00140 for ; Mon, 15 Aug 2022 19:44:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344702AbiHOToT (ORCPT ); Mon, 15 Aug 2022 15:44:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344508AbiHOTks (ORCPT ); Mon, 15 Aug 2022 15:40:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 003AD419A6; Mon, 15 Aug 2022 11:47: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 E5806B81082; Mon, 15 Aug 2022 18:47:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C1F7C433B5; Mon, 15 Aug 2022 18:47:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589233; bh=Mt7AGGcZfiDtZCpqwjCJ+SIH9BMtPjFp1JhQA7qDVTk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vWqebUEo4UKkjTLN5uIiCwVo9ZTfdwnGzeltu1LRTAN6/Dz6DrOjY/Lvzi7jDNxHb g3oqMVwZ9hphDTM8E4z7JT0u+BBZNfBe8DBMYl2YqcLoY282zwAzzGesFzSvtWZrqA NZck5HvV8RCh8Yg3gn44JruR9PatlwyC+kP606aY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Garry , Josh Poimboeuf , Ingo Molnar , Sasha Levin Subject: [PATCH 5.15 654/779] scripts/faddr2line: Fix vmlinux detection on arm64 Date: Mon, 15 Aug 2022 20:04:58 +0200 Message-Id: <20220815180405.330986483@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Josh Poimboeuf [ Upstream commit b6a5068854cfe372da7dee3224dcf023ed5b00cb ] Since commit dcea997beed6 ("faddr2line: Fix overlapping text section failures, the sequel"), faddr2line is completely broken on arm64. For some reason, on arm64, the vmlinux ELF object file type is ET_DYN rather than ET_EXEC. Check for both when determining whether the object is vmlinux. Modules and vmlinux.o have type ET_REL on all arches. Fixes: dcea997beed6 ("faddr2line: Fix overlapping text section failures, th= e sequel") Reported-by: John Garry Signed-off-by: Josh Poimboeuf Signed-off-by: Ingo Molnar Tested-by: John Garry Link: https://lore.kernel.org/r/dad1999737471b06d6188ce4cdb11329aa41682c.16= 58426357.git.jpoimboe@kernel.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- scripts/faddr2line | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/faddr2line b/scripts/faddr2line index 94ed98dd899f..57099687e5e1 100755 --- a/scripts/faddr2line +++ b/scripts/faddr2line @@ -112,7 +112,9 @@ __faddr2line() { # section offsets. local file_type=3D$(${READELF} --file-header $objfile | ${AWK} '$1 =3D=3D "Type:" { print $2; exit }') - [[ $file_type =3D "EXEC" ]] && is_vmlinux=3D1 + if [[ $file_type =3D "EXEC" ]] || [[ $file_type =3D=3D "DYN" ]]; then + is_vmlinux=3D1 + fi =20 # Go through each of the object's symbols which match the func name. # In rare cases there might be duplicates, in which case we print all --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B87CAC00140 for ; Mon, 15 Aug 2022 19:44:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344727AbiHOTob (ORCPT ); Mon, 15 Aug 2022 15:44:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344621AbiHOTlO (ORCPT ); Mon, 15 Aug 2022 15:41:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6969865566; Mon, 15 Aug 2022 11:47:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A6FC1611EC; Mon, 15 Aug 2022 18:47:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64C4CC433D7; Mon, 15 Aug 2022 18:47:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589237; bh=2SlUA2K4kh8vddRQQgvCpzFLKXrX5y1ZP1t2OfhpRwc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VMRD65oWpG7KfpGrZQ24PqlIzpBVe/JZzEqW26IDbGkOvtAbem4HLcnWoBJMJxuUv 0JfmUqH5FL4H0EJYbOkUFCB2RV3KssdSYCY38tPvP/ytZBlwuv9wS2jUwPky6EojkG G0mUsLFWKIR5h6jaKtjRi3iE5HFPY4jeuD9eK36U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dietmar Eggemann , "Peter Zijlstra (Intel)" , Juri Lelli , Sasha Levin Subject: [PATCH 5.15 655/779] sched/deadline: Merge dl_task_can_attach() and dl_cpu_busy() Date: Mon, 15 Aug 2022 20:04:59 +0200 Message-Id: <20220815180405.374160004@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dietmar Eggemann [ Upstream commit 772b6539fdda31462cc08368e78df60b31a58bab ] Both functions are doing almost the same, that is checking if admission control is still respected. With exclusive cpusets, dl_task_can_attach() checks if the destination cpuset (i.e. its root domain) has enough CPU capacity to accommodate the task. dl_cpu_busy() checks if there is enough CPU capacity in the cpuset in case the CPU is hot-plugged out. dl_task_can_attach() is used to check if a task can be admitted while dl_cpu_busy() is used to check if a CPU can be hotplugged out. Make dl_cpu_busy() able to deal with a task and use it instead of dl_task_can_attach() in task_can_attach(). Signed-off-by: Dietmar Eggemann Signed-off-by: Peter Zijlstra (Intel) Acked-by: Juri Lelli Link: https://lore.kernel.org/r/20220302183433.333029-4-dietmar.eggemann@ar= m.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- kernel/sched/core.c | 13 +++++++---- kernel/sched/deadline.c | 52 +++++++++++------------------------------ kernel/sched/sched.h | 3 +-- 3 files changed, 24 insertions(+), 44 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 012c037da58a..154506e4d1f5 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -8760,8 +8760,11 @@ int task_can_attach(struct task_struct *p, } =20 if (dl_task(p) && !cpumask_intersects(task_rq(p)->rd->span, - cs_cpus_allowed)) - ret =3D dl_task_can_attach(p, cs_cpus_allowed); + cs_cpus_allowed)) { + int cpu =3D cpumask_any_and(cpu_active_mask, cs_cpus_allowed); + + ret =3D dl_cpu_busy(cpu, p); + } =20 out: return ret; @@ -9045,8 +9048,10 @@ static void cpuset_cpu_active(void) static int cpuset_cpu_inactive(unsigned int cpu) { if (!cpuhp_tasks_frozen) { - if (dl_cpu_busy(cpu)) - return -EBUSY; + int ret =3D dl_cpu_busy(cpu, NULL); + + if (ret) + return ret; cpuset_update_active_cpus(); } else { num_cpus_frozen++; diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index ee673a205e22..147b757d162b 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -2864,41 +2864,6 @@ bool dl_param_changed(struct task_struct *p, const s= truct sched_attr *attr) } =20 #ifdef CONFIG_SMP -int dl_task_can_attach(struct task_struct *p, const struct cpumask *cs_cpu= s_allowed) -{ - unsigned long flags, cap; - unsigned int dest_cpu; - struct dl_bw *dl_b; - bool overflow; - int ret; - - dest_cpu =3D cpumask_any_and(cpu_active_mask, cs_cpus_allowed); - - rcu_read_lock_sched(); - dl_b =3D dl_bw_of(dest_cpu); - raw_spin_lock_irqsave(&dl_b->lock, flags); - cap =3D dl_bw_capacity(dest_cpu); - overflow =3D __dl_overflow(dl_b, cap, 0, p->dl.dl_bw); - if (overflow) { - ret =3D -EBUSY; - } else { - /* - * We reserve space for this task in the destination - * root_domain, as we can't fail after this point. - * We will free resources in the source root_domain - * later on (see set_cpus_allowed_dl()). - */ - int cpus =3D dl_bw_cpus(dest_cpu); - - __dl_add(dl_b, p->dl.dl_bw, cpus); - ret =3D 0; - } - raw_spin_unlock_irqrestore(&dl_b->lock, flags); - rcu_read_unlock_sched(); - - return ret; -} - int dl_cpuset_cpumask_can_shrink(const struct cpumask *cur, const struct cpumask *trial) { @@ -2920,7 +2885,7 @@ int dl_cpuset_cpumask_can_shrink(const struct cpumask= *cur, return ret; } =20 -bool dl_cpu_busy(unsigned int cpu) +int dl_cpu_busy(int cpu, struct task_struct *p) { unsigned long flags, cap; struct dl_bw *dl_b; @@ -2930,11 +2895,22 @@ bool dl_cpu_busy(unsigned int cpu) dl_b =3D dl_bw_of(cpu); raw_spin_lock_irqsave(&dl_b->lock, flags); cap =3D dl_bw_capacity(cpu); - overflow =3D __dl_overflow(dl_b, cap, 0, 0); + overflow =3D __dl_overflow(dl_b, cap, 0, p ? p->dl.dl_bw : 0); + + if (!overflow && p) { + /* + * We reserve space for this task in the destination + * root_domain, as we can't fail after this point. + * We will free resources in the source root_domain + * later on (see set_cpus_allowed_dl()). + */ + __dl_add(dl_b, p->dl.dl_bw, dl_bw_cpus(cpu)); + } + raw_spin_unlock_irqrestore(&dl_b->lock, flags); rcu_read_unlock_sched(); =20 - return overflow; + return overflow ? -EBUSY : 0; } #endif =20 diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index fe8be2f8a47d..2bbf1f006d63 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -348,9 +348,8 @@ extern void __setparam_dl(struct task_struct *p, const = struct sched_attr *attr); extern void __getparam_dl(struct task_struct *p, struct sched_attr *attr); extern bool __checkparam_dl(const struct sched_attr *attr); extern bool dl_param_changed(struct task_struct *p, const struct sched_att= r *attr); -extern int dl_task_can_attach(struct task_struct *p, const struct cpumask= *cs_cpus_allowed); extern int dl_cpuset_cpumask_can_shrink(const struct cpumask *cur, const = struct cpumask *trial); -extern bool dl_cpu_busy(unsigned int cpu); +extern int dl_cpu_busy(int cpu, struct task_struct *p); =20 #ifdef CONFIG_CGROUP_SCHED =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B139C00140 for ; Mon, 15 Aug 2022 19:44:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344771AbiHOTol (ORCPT ); Mon, 15 Aug 2022 15:44:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344700AbiHOTlY (ORCPT ); Mon, 15 Aug 2022 15:41: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 9C79E65811; Mon, 15 Aug 2022 11:47:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A6A15B81084; Mon, 15 Aug 2022 18:47:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11A57C433C1; Mon, 15 Aug 2022 18:47:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589243; bh=m/cZj8U6SnnRtObGLL41hNZvW4O1KjdnXBw2od3BvTU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O2g2xXbJ0S9ELeOv+nVYn9dDxwuwNyyCL3LmZcTE6T95mEc1dDBqX1Os8ZRt7qLh8 KnZGWLupkYlReZoRsge2WpX9yx/u7vWmB1hXuo3Vuw8Oj9BcU9oFwHaqM3RPITNyfU 0siAFSGjavMTqLpb+TDyUPZwHz5VXRNbBej19B60= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Waiman Long , Ingo Molnar , Juri Lelli , Sasha Levin Subject: [PATCH 5.15 656/779] sched, cpuset: Fix dl_cpu_busy() panic due to empty cs->cpus_allowed Date: Mon, 15 Aug 2022 20:05:00 +0200 Message-Id: <20220815180405.422575786@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Waiman Long [ Upstream commit b6e8d40d43ae4dec00c8fea2593eeea3114b8f44 ] With cgroup v2, the cpuset's cpus_allowed mask can be empty indicating that the cpuset will just use the effective CPUs of its parent. So cpuset_can_attach() can call task_can_attach() with an empty mask. This can lead to cpumask_any_and() returns nr_cpu_ids causing the call to dl_bw_of() to crash due to percpu value access of an out of bound CPU value. For example: [80468.182258] BUG: unable to handle page fault for address: ffffffff8b664= 8b0 : [80468.191019] RIP: 0010:dl_cpu_busy+0x30/0x2b0 : [80468.207946] Call Trace: [80468.208947] cpuset_can_attach+0xa0/0x140 [80468.209953] cgroup_migrate_execute+0x8c/0x490 [80468.210931] cgroup_update_dfl_csses+0x254/0x270 [80468.211898] cgroup_subtree_control_write+0x322/0x400 [80468.212854] kernfs_fop_write_iter+0x11c/0x1b0 [80468.213777] new_sync_write+0x11f/0x1b0 [80468.214689] vfs_write+0x1eb/0x280 [80468.215592] ksys_write+0x5f/0xe0 [80468.216463] do_syscall_64+0x5c/0x80 [80468.224287] entry_SYSCALL_64_after_hwframe+0x44/0xae Fix that by using effective_cpus instead. For cgroup v1, effective_cpus is the same as cpus_allowed. For v2, effective_cpus is the real cpumask to be used by tasks within the cpuset anyway. Also update task_can_attach()'s 2nd argument name to cs_effective_cpus to reflect the change. In addition, a check is added to task_can_attach() to guard against the possibility that cpumask_any_and() may return a value >=3D nr_cpu_ids. Fixes: 7f51412a415d ("sched/deadline: Fix bandwidth check/update when migra= ting tasks between exclusive cpusets") Signed-off-by: Waiman Long Signed-off-by: Ingo Molnar Acked-by: Juri Lelli Link: https://lore.kernel.org/r/20220803015451.2219567-1-longman@redhat.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- include/linux/sched.h | 2 +- kernel/cgroup/cpuset.c | 2 +- kernel/sched/core.c | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/linux/sched.h b/include/linux/sched.h index ad7ff332a0ac..dcba347cbffa 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -1797,7 +1797,7 @@ current_restore_flags(unsigned long orig_flags, unsig= ned long flags) } =20 extern int cpuset_cpumask_can_shrink(const struct cpumask *cur, const stru= ct cpumask *trial); -extern int task_can_attach(struct task_struct *p, const struct cpumask *cs= _cpus_allowed); +extern int task_can_attach(struct task_struct *p, const struct cpumask *cs= _effective_cpus); #ifdef CONFIG_SMP extern void do_set_cpus_allowed(struct task_struct *p, const struct cpumas= k *new_mask); extern int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumas= k *new_mask); diff --git a/kernel/cgroup/cpuset.c b/kernel/cgroup/cpuset.c index 31f94c6ea0a5..9c5b659db63f 100644 --- a/kernel/cgroup/cpuset.c +++ b/kernel/cgroup/cpuset.c @@ -2199,7 +2199,7 @@ static int cpuset_can_attach(struct cgroup_taskset *t= set) goto out_unlock; =20 cgroup_taskset_for_each(task, css, tset) { - ret =3D task_can_attach(task, cs->cpus_allowed); + ret =3D task_can_attach(task, cs->effective_cpus); if (ret) goto out_unlock; ret =3D security_task_setscheduler(task); diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 154506e4d1f5..5c7937b504d2 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -8741,7 +8741,7 @@ int cpuset_cpumask_can_shrink(const struct cpumask *c= ur, } =20 int task_can_attach(struct task_struct *p, - const struct cpumask *cs_cpus_allowed) + const struct cpumask *cs_effective_cpus) { int ret =3D 0; =20 @@ -8760,9 +8760,11 @@ int task_can_attach(struct task_struct *p, } =20 if (dl_task(p) && !cpumask_intersects(task_rq(p)->rd->span, - cs_cpus_allowed)) { - int cpu =3D cpumask_any_and(cpu_active_mask, cs_cpus_allowed); + cs_effective_cpus)) { + int cpu =3D cpumask_any_and(cpu_active_mask, cs_effective_cpus); =20 + if (unlikely(cpu >=3D nr_cpu_ids)) + return -EINVAL; ret =3D dl_cpu_busy(cpu, p); } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28317C00140 for ; Mon, 15 Aug 2022 19:44:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344758AbiHOToh (ORCPT ); Mon, 15 Aug 2022 15:44:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344703AbiHOTlY (ORCPT ); Mon, 15 Aug 2022 15:41: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 498FC65836; Mon, 15 Aug 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 BAF80B810A0; Mon, 15 Aug 2022 18:47:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02B6BC433D6; Mon, 15 Aug 2022 18:47:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589246; bh=Gpq+I7u/RwPSeuzvhjXCYNqP5aQ3HsWjVO9K27J+oxA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0nmDmKoGWHyYqpRsQnTKMlLkZNcDUJXnt1KfRAxkAnknH/EPR8I6bMpN7A40fwyeb F/AOo0Tff1Z6rYjH67MX58NO7LZ+kPVhx4f2uuK/DTMKTL+AXUf7cMRlN2fMN1skty xmU4+gSf8lBpv9aSQ6DpXjNQl0tekxfhrK41NRoo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Siddh Raman Pant , Ingo Molnar , Sasha Levin Subject: [PATCH 5.15 657/779] x86/numa: Use cpumask_available instead of hardcoded NULL check Date: Mon, 15 Aug 2022 20:05:01 +0200 Message-Id: <20220815180405.454442467@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Siddh Raman Pant [ Upstream commit 625395c4a0f4775e0fe00f616888d2e6c1ba49db ] GCC-12 started triggering a new warning: arch/x86/mm/numa.c: In function =E2=80=98cpumask_of_node=E2=80=99: arch/x86/mm/numa.c:916:39: warning: the comparison will always evaluate a= s =E2=80=98false=E2=80=99 for the address of =E2=80=98node_to_cpumask_map= =E2=80=99 will never be NULL [-Waddress] 916 | if (node_to_cpumask_map[node] =3D=3D NULL) { | ^~ node_to_cpumask_map is of type cpumask_var_t[]. When CONFIG_CPUMASK_OFFSTACK is set, cpumask_var_t is typedef'd to a pointer for dynamic allocation, else to an array of one element. The "wicked game" can be checked on line 700 of include/linux/cpumask.h. The original code in debug_cpumask_set_cpu() and cpumask_of_node() were probably written by the original authors with CONFIG_CPUMASK_OFFSTACK=3Dy (i.e. dynamic allocation) in mind, checking if the cpumask was available via a direct NULL check. When CONFIG_CPUMASK_OFFSTACK is not set, GCC gives the above warning while compiling the kernel. Fix that by using cpumask_available(), which does the NULL check when CONFIG_CPUMASK_OFFSTACK is set, otherwise returns true. Use it wherever such checks are made. Conditional definitions of cpumask_available() can be found along with the definition of cpumask_var_t. Check the cpumask.h reference mentioned above. Fixes: c032ef60d1aa ("cpumask: convert node_to_cpumask_map[] to cpumask_var= _t") Fixes: de2d9445f162 ("x86: Unify node_to_cpumask_map handling between 32 an= d 64bit") Signed-off-by: Siddh Raman Pant Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/20220731160913.632092-1-code@siddh.me Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/x86/mm/numa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c index 1e9b93b088db..e360c6892a58 100644 --- a/arch/x86/mm/numa.c +++ b/arch/x86/mm/numa.c @@ -860,7 +860,7 @@ void debug_cpumask_set_cpu(int cpu, int node, bool enab= le) return; } mask =3D node_to_cpumask_map[node]; - if (!mask) { + if (!cpumask_available(mask)) { pr_err("node_to_cpumask_map[%i] NULL\n", node); dump_stack(); return; @@ -906,7 +906,7 @@ const struct cpumask *cpumask_of_node(int node) dump_stack(); return cpu_none_mask; } - if (node_to_cpumask_map[node] =3D=3D NULL) { + if (!cpumask_available(node_to_cpumask_map[node])) { printk(KERN_WARNING "cpumask_of_node(%d): no node_to_cpumask_map!\n", node); --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C42EDC00140 for ; Mon, 15 Aug 2022 19:44:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344792AbiHOTos (ORCPT ); Mon, 15 Aug 2022 15:44:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344734AbiHOTl0 (ORCPT ); Mon, 15 Aug 2022 15:41:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D71B741D0E; Mon, 15 Aug 2022 11:47: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 0A3CCB810A1; Mon, 15 Aug 2022 18:47:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3511AC433C1; Mon, 15 Aug 2022 18:47:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589249; bh=LCo2QkVytE7Tr9hl2fNVtY5d98hSWfj7DY3qjB6UhnI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t50fAoimKA7TpEdmkjaGj4CkzaSFRLS8IYIawA5jAojqB2JbZDbAIig14GeWud1nC 6A1KIWJr21l0vM/VOc2KD0u499ZRTpz5uqUBR74Ze0Xe1LmIXJSiYfM4hEf2FwmAUW gAEcHK2M420TKS2z+QMfvsJ4oLr7QizREj+Zor+I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Helge Deller , Sasha Levin Subject: [PATCH 5.15 658/779] video: fbdev: arkfb: Fix a divide-by-zero bug in ark_set_pixclock() Date: Mon, 15 Aug 2022 20:05:02 +0200 Message-Id: <20220815180405.492821485@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 2f1c4523f7a3aaabe7e53d3ebd378292947e95c8 ] Since the user can control the arguments of the ioctl() from the user space, under special arguments that may result in a divide-by-zero bug in: drivers/video/fbdev/arkfb.c:784: ark_set_pixclock(info, (hdiv * info->var= .pixclock) / hmul); with hdiv=3D1, pixclock=3D1 and hmul=3D2 you end up with (1*1)/2 =3D (int) = 0. and then in: drivers/video/fbdev/arkfb.c:504: rv =3D dac_set_freq(par->dac, 0, 1000000= 000 / pixclock); we'll get a division-by-zero. The following log can reveal it: divide error: 0000 [#1] PREEMPT SMP KASAN PTI RIP: 0010:ark_set_pixclock drivers/video/fbdev/arkfb.c:504 [inline] RIP: 0010:arkfb_set_par+0x10fc/0x24c0 drivers/video/fbdev/arkfb.c:784 Call Trace: fb_set_var+0x604/0xeb0 drivers/video/fbdev/core/fbmem.c:1034 do_fb_ioctl+0x234/0x670 drivers/video/fbdev/core/fbmem.c:1110 fb_ioctl+0xdd/0x130 drivers/video/fbdev/core/fbmem.c:1189 Fix this by checking the argument of ark_set_pixclock() first. Fixes: 681e14730c73 ("arkfb: new framebuffer driver for ARK Logic cards") Signed-off-by: Zheyu Ma Signed-off-by: Helge Deller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/video/fbdev/arkfb.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/arkfb.c b/drivers/video/fbdev/arkfb.c index edf169d0816e..d94cc5ad1ef6 100644 --- a/drivers/video/fbdev/arkfb.c +++ b/drivers/video/fbdev/arkfb.c @@ -778,7 +778,12 @@ static int arkfb_set_par(struct fb_info *info) return -EINVAL; } =20 - ark_set_pixclock(info, (hdiv * info->var.pixclock) / hmul); + value =3D (hdiv * info->var.pixclock) / hmul; + if (!value) { + fb_dbg(info, "invalid pixclock\n"); + value =3D 1; + } + ark_set_pixclock(info, value); svga_set_timings(par->state.vgabase, &ark_timing_regs, &(info->var), hmul= , hdiv, (info->var.vmode & FB_VMODE_DOUBLE) ? 2 : 1, (info->var.vmode & FB_VMODE_INTERLACED) ? 2 : 1, --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 171ECC00140 for ; Mon, 15 Aug 2022 19:44:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245740AbiHOTox (ORCPT ); Mon, 15 Aug 2022 15:44:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344815AbiHOTlf (ORCPT ); Mon, 15 Aug 2022 15:41:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62615419BB; Mon, 15 Aug 2022 11:47:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6C6C4611EC; Mon, 15 Aug 2022 18:47:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75D7EC433D6; Mon, 15 Aug 2022 18:47:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589252; bh=xIKOzEbAHX9r+GH4VZhr1OOjANvkwjV7THn/VhsTL20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RKT5w103BdBDpExVnAgPm2iaoU/qLGTdb3VAgvvtIzonL4hCqYC/58b4a+l+Xo5tR 6F5E2MTfxrxj7jDiGeUut5yZfwabwDFxC5jhUvy5rWzdyytdHqbm8yA2+JIUU9ocVC 5hl6DkAIo3osUNNvSMWFXS3G0Rm/0jnOpM6HVQFk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.15 659/779] tools/thermal: Fix possible path truncations Date: Mon, 15 Aug 2022 20:05:03 +0200 Message-Id: <20220815180405.532688469@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Fainelli [ Upstream commit 6c58cf40e3a1d2f47c09d3489857e9476316788a ] A build with -D_FORTIFY_SOURCE=3D2 enabled will produce the following warni= ngs: sysfs.c:63:30: warning: '%s' directive output may be truncated writing up t= o 255 bytes into a region of size between 0 and 255 [-Wformat-truncation=3D] snprintf(filepath, 256, "%s/%s", path, filename); ^~ Bump up the buffer to PATH_MAX which is the limit and account for all of the possible NUL and separators that could lead to exceeding the allocated buffer sizes. Fixes: 94f69966faf8 ("tools/thermal: Introduce tmon, a tool for thermal sub= system") Signed-off-by: Florian Fainelli Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- tools/thermal/tmon/sysfs.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/tools/thermal/tmon/sysfs.c b/tools/thermal/tmon/sysfs.c index b00b1bfd9d8e..cb1108bc9249 100644 --- a/tools/thermal/tmon/sysfs.c +++ b/tools/thermal/tmon/sysfs.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -33,9 +34,9 @@ int sysfs_set_ulong(char *path, char *filename, unsigned = long val) { FILE *fd; int ret =3D -1; - char filepath[256]; + char filepath[PATH_MAX + 2]; /* NUL and '/' */ =20 - snprintf(filepath, 256, "%s/%s", path, filename); + snprintf(filepath, sizeof(filepath), "%s/%s", path, filename); =20 fd =3D fopen(filepath, "w"); if (!fd) { @@ -57,9 +58,9 @@ static int sysfs_get_ulong(char *path, char *filename, un= signed long *p_ulong) { FILE *fd; int ret =3D -1; - char filepath[256]; + char filepath[PATH_MAX + 2]; /* NUL and '/' */ =20 - snprintf(filepath, 256, "%s/%s", path, filename); + snprintf(filepath, sizeof(filepath), "%s/%s", path, filename); =20 fd =3D fopen(filepath, "r"); if (!fd) { @@ -76,9 +77,9 @@ static int sysfs_get_string(char *path, char *filename, c= har *str) { FILE *fd; int ret =3D -1; - char filepath[256]; + char filepath[PATH_MAX + 2]; /* NUL and '/' */ =20 - snprintf(filepath, 256, "%s/%s", path, filename); + snprintf(filepath, sizeof(filepath), "%s/%s", path, filename); =20 fd =3D fopen(filepath, "r"); if (!fd) { @@ -199,8 +200,8 @@ static int find_tzone_cdev(struct dirent *nl, char *tz_= name, { unsigned long trip_instance =3D 0; char cdev_name_linked[256]; - char cdev_name[256]; - char cdev_trip_name[256]; + char cdev_name[PATH_MAX]; + char cdev_trip_name[PATH_MAX]; int cdev_id; =20 if (nl->d_type =3D=3D DT_LNK) { @@ -213,7 +214,8 @@ static int find_tzone_cdev(struct dirent *nl, char *tz_= name, return -EINVAL; } /* find the link to real cooling device record binding */ - snprintf(cdev_name, 256, "%s/%s", tz_name, nl->d_name); + snprintf(cdev_name, sizeof(cdev_name) - 2, "%s/%s", + tz_name, nl->d_name); memset(cdev_name_linked, 0, sizeof(cdev_name_linked)); if (readlink(cdev_name, cdev_name_linked, sizeof(cdev_name_linked) - 1) !=3D -1) { @@ -226,8 +228,8 @@ static int find_tzone_cdev(struct dirent *nl, char *tz_= name, /* find the trip point in which the cdev is binded to * in this tzone */ - snprintf(cdev_trip_name, 256, "%s%s", nl->d_name, - "_trip_point"); + snprintf(cdev_trip_name, sizeof(cdev_trip_name) - 1, + "%s%s", nl->d_name, "_trip_point"); sysfs_get_ulong(tz_name, cdev_trip_name, &trip_instance); /* validate trip point range, e.g. trip could return -1 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B58F2C00140 for ; Mon, 15 Aug 2022 19:49:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345332AbiHOTty (ORCPT ); Mon, 15 Aug 2022 15:49:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344981AbiHOTsE (ORCPT ); Mon, 15 Aug 2022 15:48: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 C8EB042ACB; Mon, 15 Aug 2022 11:49: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 D19CA611EC; Mon, 15 Aug 2022 18:49:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5906C433D6; Mon, 15 Aug 2022 18:49:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589384; bh=zmO6h4LqP4TkymwQXnLVD7MZL74/ycAA3eFNVw5TmDU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R4nSgfQh6VVhsHZGDcfH2yGtkJh9KumSrSVslkKXGtx0pw/uasGEDxy2xnI6XiOJ/ /7d0TPF19Y6ouy3C01uEpYWC32pMxyY6J7J7fd5OnSQQZL4aAMMWShoBzt1e0IDzGd D59r51q4dzHmFeAdiacY0ltKZKYMFDdssDYKHSRs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Valentin Schneider , Tianchen Ding , "Peter Zijlstra (Intel)" , Sasha Levin Subject: [PATCH 5.15 660/779] sched: Fix the check of nr_running at queue wakelist Date: Mon, 15 Aug 2022 20:05:04 +0200 Message-Id: <20220815180405.571526633@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tianchen Ding [ Upstream commit 28156108fecb1f808b21d216e8ea8f0d205a530c ] The commit 2ebb17717550 ("sched/core: Offload wakee task activation if it the wakee is descheduling") checked rq->nr_running <=3D 1 to avoid task stacking when WF_ON_CPU. Per the ordering of writes to p->on_rq and p->on_cpu, observing p->on_cpu (WF_ON_CPU) in ttwu_queue_cond() implies !p->on_rq, IOW p has gone through the deactivate_task() in __schedule(), thus p has been accounted out of rq->nr_running. As such, the task being the only runnable task on the rq implies reading rq->nr_running =3D=3D 0 at that point. The benchmark result is in [1]. [1] https://lore.kernel.org/all/e34de686-4e85-bde1-9f3c-9bbc86b38627@linux.= alibaba.com/ Suggested-by: Valentin Schneider Signed-off-by: Tianchen Ding Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Valentin Schneider Link: https://lore.kernel.org/r/20220608233412.327341-2-dtcccc@linux.alibab= a.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- kernel/sched/core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 5c7937b504d2..892c06ff9dd0 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -3735,8 +3735,12 @@ static inline bool ttwu_queue_cond(int cpu, int wake= _flags) * CPU then use the wakelist to offload the task activation to * the soon-to-be-idle CPU as the current CPU is likely busy. * nr_running is checked to avoid unnecessary task stacking. + * + * Note that we can only get here with (wakee) p->on_rq=3D0, + * p->on_cpu can be whatever, we've done the dequeue, so + * the wakee has been accounted out of ->nr_running. */ - if ((wake_flags & WF_ON_CPU) && cpu_rq(cpu)->nr_running <=3D 1) + if ((wake_flags & WF_ON_CPU) && !cpu_rq(cpu)->nr_running) return true; =20 return false; --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BF7EC25B0E for ; Mon, 15 Aug 2022 19:47:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344909AbiHOTps (ORCPT ); Mon, 15 Aug 2022 15:45:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345078AbiHOTmV (ORCPT ); Mon, 15 Aug 2022 15:42:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96D3D6AA17; Mon, 15 Aug 2022 11:48: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 41C25B810A7; Mon, 15 Aug 2022 18:48:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49357C433D6; Mon, 15 Aug 2022 18:47:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589279; bh=yvmeV3EfBEO14uIQ/mpXL74P8WfYvkvN0eh0Mv9qcl8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X2UddrWvequf87pzJ39LNvHWlwtXQUtxvJNxp0d60r95RDhgu93cEpAKStk4bDVFA 4/trO4hL/smyzYXyctWAAXOLfyNoiBeE8lGFA64/GpQeyBCdGm7jUGhimf/hJuUMUH Yz366+56Qxdr0sKkzioM/B5tTBr+lpyH2adHWoMQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tianchen Ding , "Peter Zijlstra (Intel)" , Valentin Schneider , Sasha Levin Subject: [PATCH 5.15 661/779] sched: Remove the limitation of WF_ON_CPU on wakelist if wakee cpu is idle Date: Mon, 15 Aug 2022 20:05:05 +0200 Message-Id: <20220815180405.614039131@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tianchen Ding [ Upstream commit f3dd3f674555bd9455c5ae7fafce0696bd9931b3 ] Wakelist can help avoid cache bouncing and offload the overhead of waker cpu. So far, using wakelist within the same llc only happens on WF_ON_CPU, and this limitation could be removed to further improve wakeup performance. The commit 518cd6234178 ("sched: Only queue remote wakeups when crossing cache boundaries") disabled queuing tasks on wakelist when the cpus share llc. This is because, at that time, the scheduler must send IPIs to do ttwu_queue_wakelist. Nowadays, ttwu_queue_wakelist also supports TIF_POLLING, so this is not a problem now when the wakee cpu is in idle polling. Benefits: Queuing the task on idle cpu can help improving performance on waker cpu and utilization on wakee cpu, and further improve locality because the wakee cpu can handle its own rq. This patch helps improving rt on our real java workloads where wakeup happens frequently. Consider the normal condition (CPU0 and CPU1 share same llc) Before this patch: CPU0 CPU1 select_task_rq() idle rq_lock(CPU1->rq) enqueue_task(CPU1->rq) notify CPU1 (by sending IPI or CPU1 polling) resched() After this patch: CPU0 CPU1 select_task_rq() idle add to wakelist of CPU1 notify CPU1 (by sending IPI or CPU1 polling) rq_lock(CPU1->rq) enqueue_task(CPU1->rq) resched() We see CPU0 can finish its work earlier. It only needs to put task to wakelist and return. While CPU1 is idle, so let itself handle its own runqueue data. This patch brings no difference about IPI. This patch only takes effect when the wakee cpu is: 1) idle polling 2) idle not polling For 1), there will be no IPI with or without this patch. For 2), there will always be an IPI before or after this patch. Before this patch: waker cpu will enqueue task and check preempt. Since "idle" will be sure to be preempted, waker cpu must send a resched IPI. After this patch: waker cpu will put the task to the wakelist of wakee cpu, and send an IPI. Benchmark: We've tested schbench, unixbench, and hachbench on both x86 and arm64. On x86 (Intel Xeon Platinum 8269CY): schbench -m 2 -t 8 Latency percentiles (usec) before after 50.0000th: 8 6 75.0000th: 10 7 90.0000th: 11 8 95.0000th: 12 8 *99.0000th: 13 10 99.5000th: 15 11 99.9000th: 18 14 Unixbench with full threads (104) before after Dhrystone 2 using register variables 3011862938 3009935994 -0.06% Double-Precision Whetstone 617119.3 617298.5 0.03% Execl Throughput 27667.3 27627.3 -0.14% File Copy 1024 bufsize 2000 maxblocks 785871.4 784906.2 -0.12% File Copy 256 bufsize 500 maxblocks 210113.6 212635.4 1.20% File Copy 4096 bufsize 8000 maxblocks 2328862.2 2320529.1 -0.36% Pipe Throughput 145535622.8 145323033.2 -0.15% Pipe-based Context Switching 3221686.4 3583975.4 11.25% Process Creation 101347.1 103345.4 1.97% Shell Scripts (1 concurrent) 120193.5 123977.8 3.15% Shell Scripts (8 concurrent) 17233.4 17138.4 -0.55% System Call Overhead 5300604.8 5312213.6 0.22% hackbench -g 1 -l 100000 before after Time 3.246 2.251 On arm64 (Ampere Altra): schbench -m 2 -t 8 Latency percentiles (usec) before after 50.0000th: 14 10 75.0000th: 19 14 90.0000th: 22 16 95.0000th: 23 16 *99.0000th: 24 17 99.5000th: 24 17 99.9000th: 28 25 Unixbench with full threads (80) before after Dhrystone 2 using register variables 3536194249 3537019613 0.02% Double-Precision Whetstone 629383.6 629431.6 0.01% Execl Throughput 65920.5 65846.2 -0.11% File Copy 1024 bufsize 2000 maxblocks 1063722.8 1064026.8 0.03% File Copy 256 bufsize 500 maxblocks 322684.5 318724.5 -1.23% File Copy 4096 bufsize 8000 maxblocks 2348285.3 2328804.8 -0.83% Pipe Throughput 133542875.3 131619389.8 -1.44% Pipe-based Context Switching 3215356.1 3576945.1 11.25% Process Creation 108520.5 120184.6 10.75% Shell Scripts (1 concurrent) 122636.3 121888 -0.61% Shell Scripts (8 concurrent) 17462.1 17381.4 -0.46% System Call Overhead 4429998.9 4435006.7 0.11% hackbench -g 1 -l 100000 before after Time 4.217 2.916 Our patch has improvement on schbench, hackbench and Pipe-based Context Switching of unixbench when there exists idle cpus, and no obvious regression on other tests of unixbench. This can help improve rt in scenes where wakeup happens frequently. Signed-off-by: Tianchen Ding Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Valentin Schneider Link: https://lore.kernel.org/r/20220608233412.327341-3-dtcccc@linux.alibab= a.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- kernel/sched/core.c | 26 ++++++++++++++------------ kernel/sched/sched.h | 1 - 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 892c06ff9dd0..4499b58ac2ca 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -3714,7 +3714,7 @@ bool cpus_share_cache(int this_cpu, int that_cpu) return per_cpu(sd_llc_id, this_cpu) =3D=3D per_cpu(sd_llc_id, that_cpu); } =20 -static inline bool ttwu_queue_cond(int cpu, int wake_flags) +static inline bool ttwu_queue_cond(int cpu) { /* * Do not complicate things with the async wake_list while the CPU is @@ -3730,17 +3730,21 @@ static inline bool ttwu_queue_cond(int cpu, int wak= e_flags) if (!cpus_share_cache(smp_processor_id(), cpu)) return true; =20 + if (cpu =3D=3D smp_processor_id()) + return false; + /* - * If the task is descheduling and the only running task on the - * CPU then use the wakelist to offload the task activation to - * the soon-to-be-idle CPU as the current CPU is likely busy. - * nr_running is checked to avoid unnecessary task stacking. + * If the wakee cpu is idle, or the task is descheduling and the + * only running task on the CPU, then use the wakelist to offload + * the task activation to the idle (or soon-to-be-idle) CPU as + * the current CPU is likely busy. nr_running is checked to + * avoid unnecessary task stacking. * * Note that we can only get here with (wakee) p->on_rq=3D0, * p->on_cpu can be whatever, we've done the dequeue, so * the wakee has been accounted out of ->nr_running. */ - if ((wake_flags & WF_ON_CPU) && !cpu_rq(cpu)->nr_running) + if (!cpu_rq(cpu)->nr_running) return true; =20 return false; @@ -3748,10 +3752,7 @@ static inline bool ttwu_queue_cond(int cpu, int wake= _flags) =20 static bool ttwu_queue_wakelist(struct task_struct *p, int cpu, int wake_f= lags) { - if (sched_feat(TTWU_QUEUE) && ttwu_queue_cond(cpu, wake_flags)) { - if (WARN_ON_ONCE(cpu =3D=3D smp_processor_id())) - return false; - + if (sched_feat(TTWU_QUEUE) && ttwu_queue_cond(cpu)) { sched_clock_cpu(cpu); /* Sync clocks across CPUs */ __ttwu_queue_wakelist(p, cpu, wake_flags); return true; @@ -4073,7 +4074,7 @@ try_to_wake_up(struct task_struct *p, unsigned int st= ate, int wake_flags) * scheduling. */ if (smp_load_acquire(&p->on_cpu) && - ttwu_queue_wakelist(p, task_cpu(p), wake_flags | WF_ON_CPU)) + ttwu_queue_wakelist(p, task_cpu(p), wake_flags)) goto unlock; =20 /* @@ -4589,7 +4590,8 @@ static inline void prepare_task(struct task_struct *n= ext) * Claim the task as running, we do this before switching to it * such that any running task will have this set. * - * See the ttwu() WF_ON_CPU case and its ordering comment. + * See the smp_load_acquire(&p->on_cpu) case in ttwu() and + * its ordering comment. */ WRITE_ONCE(next->on_cpu, 1); #endif diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 2bbf1f006d63..e49902898253 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -2052,7 +2052,6 @@ static inline int task_on_rq_migrating(struct task_st= ruct *p) =20 #define WF_SYNC 0x10 /* Waker goes to sleep after wakeup */ #define WF_MIGRATED 0x20 /* Internal use, task got migrated */ -#define WF_ON_CPU 0x40 /* Wakee is on_cpu */ =20 #ifdef CONFIG_SMP static_assert(WF_EXEC =3D=3D SD_BALANCE_EXEC); --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6282C25B0E for ; Mon, 15 Aug 2022 19:47:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344624AbiHOTr1 (ORCPT ); Mon, 15 Aug 2022 15:47:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344965AbiHOTp5 (ORCPT ); Mon, 15 Aug 2022 15:45:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9DB06CD22; Mon, 15 Aug 2022 11:48: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 9405EB81082; Mon, 15 Aug 2022 18:48:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9935AC433D6; Mon, 15 Aug 2022 18:48:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589314; bh=QY8H96EPvepEtFY3UWFxK8kekjXPXBDtFe/aU03yreA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Nh/F6uun1yAkAVVTguNMXyIEpH0b3mVu2+EB8L5hdDecgFDfJnz+MCIIo6yBJZhRr FlDSltOhR4Ug4slTuncY1XPKMjTqNwq2inS3sgSMauOfYSONeSpe3xj2jLnZrjTv37 y00w7YSpBWILWyvPCk3MjBfUlUCQly2vUNQbScYM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mel Gorman , Ingo Molnar , Sasha Levin Subject: [PATCH 5.15 662/779] sched/core: Do not requeue task on CPU excluded from cpus_mask Date: Mon, 15 Aug 2022 20:05:06 +0200 Message-Id: <20220815180405.648962572@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mel Gorman [ Upstream commit 751d4cbc43879229dbc124afefe240b70fd29a85 ] The following warning was triggered on a large machine early in boot on a distribution kernel but the same problem should also affect mainline. WARNING: CPU: 439 PID: 10 at ../kernel/workqueue.c:2231 process_one_work= +0x4d/0x440 Call Trace: rescuer_thread+0x1f6/0x360 kthread+0x156/0x180 ret_from_fork+0x22/0x30 Commit c6e7bd7afaeb ("sched/core: Optimize ttwu() spinning on p->on_cpu") optimises ttwu by queueing a task that is descheduling on the wakelist, but does not check if the task descheduling is still allowed to run on that= CPU. In this warning, the problematic task is a workqueue rescue thread which checks if the rescue is for a per-cpu workqueue and running on the wrong CP= U. While this is early in boot and it should be possible to create workers, the rescue thread may still used if the MAYDAY_INITIAL_TIMEOUT is reached or MAYDAY_INTERVAL and on a sufficiently large machine, the rescue thread is being used frequently. Tracing confirmed that the task should have migrated properly using the stopper thread to handle the migration. However, a parallel wakeup from udev running on another CPU that does not share CPU cache observes p->on_cpu and uses task_cpu(p), queues the task on the old CPU and triggers the warning. Check that the wakee task that is descheduling is still allowed to run on its current CPU and if not, wait for the descheduling to complete and select an allowed CPU. Fixes: c6e7bd7afaeb ("sched/core: Optimize ttwu() spinning on p->on_cpu") Signed-off-by: Mel Gorman Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/20220804092119.20137-1-mgorman@techsingular= ity.net Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- kernel/sched/core.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 4499b58ac2ca..85be684687b0 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -3714,7 +3714,7 @@ bool cpus_share_cache(int this_cpu, int that_cpu) return per_cpu(sd_llc_id, this_cpu) =3D=3D per_cpu(sd_llc_id, that_cpu); } =20 -static inline bool ttwu_queue_cond(int cpu) +static inline bool ttwu_queue_cond(struct task_struct *p, int cpu) { /* * Do not complicate things with the async wake_list while the CPU is @@ -3723,6 +3723,10 @@ static inline bool ttwu_queue_cond(int cpu) if (!cpu_active(cpu)) return false; =20 + /* Ensure the task will still be allowed to run on the CPU. */ + if (!cpumask_test_cpu(cpu, p->cpus_ptr)) + return false; + /* * If the CPU does not share cache, then queue the task on the * remote rqs wakelist to avoid accessing remote data. @@ -3752,7 +3756,7 @@ static inline bool ttwu_queue_cond(int cpu) =20 static bool ttwu_queue_wakelist(struct task_struct *p, int cpu, int wake_f= lags) { - if (sched_feat(TTWU_QUEUE) && ttwu_queue_cond(cpu)) { + if (sched_feat(TTWU_QUEUE) && ttwu_queue_cond(p, cpu)) { sched_clock_cpu(cpu); /* Sync clocks across CPUs */ __ttwu_queue_wakelist(p, cpu, wake_flags); return true; --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EBE14C00140 for ; Mon, 15 Aug 2022 19:48:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345093AbiHOTsZ (ORCPT ); Mon, 15 Aug 2022 15:48:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345364AbiHOTqh (ORCPT ); Mon, 15 Aug 2022 15:46:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5A4D6EF08; Mon, 15 Aug 2022 11:49: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 ACA34611C6; Mon, 15 Aug 2022 18:49:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DB41C433D6; Mon, 15 Aug 2022 18:49:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589349; bh=ko3JdWQA422V17oiWukJmeSyouPP90TNkwWa5lkIEpI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fJMpsiZoq5tF2VjniWb2/n3X92y40z+qo2++6PhDIq1XrUJF+QPCLy8qVMeox2PLN AyQ0I7KeABFflp0HuMcLTwdH4aj7aqslZnQs+o0vetaJXkaev++AOkPRX48Z5CC6ef /c3oj0eBCo0IJ+8hLPHwO3Uxb3LuVWqDrZtoPWko= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrea Righi , Ingo Molnar , Sasha Levin Subject: [PATCH 5.15 663/779] x86/entry: Build thunk_$(BITS) only if CONFIG_PREEMPTION=y Date: Mon, 15 Aug 2022 20:05:07 +0200 Message-Id: <20220815180405.695710169@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andrea Righi [ Upstream commit de979c83574abf6e78f3fa65b716515c91b2613d ] With CONFIG_PREEMPTION disabled, arch/x86/entry/thunk_$(BITS).o becomes an empty object file. With some old versions of binutils (i.e., 2.35.90.20210113-1ubuntu1) the GNU assembler doesn't generate a symbol table for empty object files and objtool fails with the following error when a valid symbol table cannot be found: arch/x86/entry/thunk_64.o: warning: objtool: missing symbol table To prevent this from happening, build thunk_$(BITS).o only if CONFIG_PREEMPTION is enabled. BugLink: https://bugs.launchpad.net/bugs/1911359 Fixes: 320100a5ffe5 ("x86/entry: Remove the TRACE_IRQS cruft") Signed-off-by: Andrea Righi Signed-off-by: Ingo Molnar Link: https://lore.kernel.org/r/Ys/Ke7EWjcX+ZlXO@arighi-desktop Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/x86/entry/Makefile | 3 ++- arch/x86/entry/thunk_32.S | 2 -- arch/x86/entry/thunk_64.S | 4 ---- arch/x86/um/Makefile | 3 ++- 4 files changed, 4 insertions(+), 8 deletions(-) diff --git a/arch/x86/entry/Makefile b/arch/x86/entry/Makefile index eeadbd7d92cc..ca2fe186994b 100644 --- a/arch/x86/entry/Makefile +++ b/arch/x86/entry/Makefile @@ -11,12 +11,13 @@ CFLAGS_REMOVE_common.o =3D $(CC_FLAGS_FTRACE) =20 CFLAGS_common.o +=3D -fno-stack-protector =20 -obj-y :=3D entry.o entry_$(BITS).o thunk_$(BITS).o syscall_$(BITS).o +obj-y :=3D entry.o entry_$(BITS).o syscall_$(BITS).o obj-y +=3D common.o =20 obj-y +=3D vdso/ obj-y +=3D vsyscall/ =20 +obj-$(CONFIG_PREEMPTION) +=3D thunk_$(BITS).o obj-$(CONFIG_IA32_EMULATION) +=3D entry_64_compat.o syscall_32.o obj-$(CONFIG_X86_X32_ABI) +=3D syscall_x32.o =20 diff --git a/arch/x86/entry/thunk_32.S b/arch/x86/entry/thunk_32.S index 7591bab060f7..ff6e7003da97 100644 --- a/arch/x86/entry/thunk_32.S +++ b/arch/x86/entry/thunk_32.S @@ -29,10 +29,8 @@ SYM_CODE_START_NOALIGN(\name) SYM_CODE_END(\name) .endm =20 -#ifdef CONFIG_PREEMPTION THUNK preempt_schedule_thunk, preempt_schedule THUNK preempt_schedule_notrace_thunk, preempt_schedule_notrace EXPORT_SYMBOL(preempt_schedule_thunk) EXPORT_SYMBOL(preempt_schedule_notrace_thunk) -#endif =20 diff --git a/arch/x86/entry/thunk_64.S b/arch/x86/entry/thunk_64.S index 505b488fcc65..f38b07d2768b 100644 --- a/arch/x86/entry/thunk_64.S +++ b/arch/x86/entry/thunk_64.S @@ -31,14 +31,11 @@ SYM_FUNC_END(\name) _ASM_NOKPROBE(\name) .endm =20 -#ifdef CONFIG_PREEMPTION THUNK preempt_schedule_thunk, preempt_schedule THUNK preempt_schedule_notrace_thunk, preempt_schedule_notrace EXPORT_SYMBOL(preempt_schedule_thunk) EXPORT_SYMBOL(preempt_schedule_notrace_thunk) -#endif =20 -#ifdef CONFIG_PREEMPTION SYM_CODE_START_LOCAL_NOALIGN(__thunk_restore) popq %r11 popq %r10 @@ -53,4 +50,3 @@ SYM_CODE_START_LOCAL_NOALIGN(__thunk_restore) RET _ASM_NOKPROBE(__thunk_restore) SYM_CODE_END(__thunk_restore) -#endif diff --git a/arch/x86/um/Makefile b/arch/x86/um/Makefile index 5ccb18290d71..a8591ec8ae68 100644 --- a/arch/x86/um/Makefile +++ b/arch/x86/um/Makefile @@ -28,7 +28,8 @@ else =20 obj-y +=3D syscalls_64.o vdso/ =20 -subarch-y =3D ../lib/csum-partial_64.o ../lib/memcpy_64.o ../entry/thunk_6= 4.o +subarch-y =3D ../lib/csum-partial_64.o ../lib/memcpy_64.o +subarch-$(CONFIG_PREEMPTION) +=3D ../entry/thunk_64.o =20 endif =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00FE8C00140 for ; Mon, 15 Aug 2022 19:49:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345236AbiHOTtD (ORCPT ); Mon, 15 Aug 2022 15:49:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345530AbiHOTrD (ORCPT ); Mon, 15 Aug 2022 15:47:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CA2F70E46; Mon, 15 Aug 2022 11:49: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 C713661154; Mon, 15 Aug 2022 18:49:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9842EC433D7; Mon, 15 Aug 2022 18:49:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589365; bh=ipEuWqVwLQzWBrbxUH2ccIIU5vSZ5RZEqX7SzOLfPMA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BsjZPgd+me1py/ypzfOqYl8Pf26a9HNWwE60G9Gip8lkeZ/o8Owsw36K7NHv58BSX V1WxRBVDQE87cndJs0ygkPy8ynj4wlfjNFEVmqd0ZCykEZfeYck2yLpxvJ7LtodOgL PTZoxQF07K1p6Q9gQoJjaW2AtidBQ9DMX5DtvI7A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sungjong Seo , Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 5.15 664/779] f2fs: allow compression for mmap files in compress_mode=user Date: Mon, 15 Aug 2022 20:05:08 +0200 Message-Id: <20220815180405.736724412@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sungjong Seo [ Upstream commit 66d34fcbbe63ebd8584b792e0d741f6648100894 ] Since commit e3c548323d32 ("f2fs: let's allow compression for mmap files"), it has been allowed to compress mmap files. However, in compress_mode=3Duse= r, it is not allowed yet. To keep the same concept in both compress_modes, f2fs_ioc_(de)compress_file() should also allow it. Let's remove checking mmap files in f2fs_ioc_(de)compress_file() so that the compression for mmap files is also allowed in compress_mode=3Duser. Signed-off-by: Sungjong Seo Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/f2fs/file.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index eacc80ac160f..0669464a942a 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -4011,11 +4011,6 @@ static int f2fs_ioc_decompress_file(struct file *fil= p, unsigned long arg) goto out; } =20 - if (f2fs_is_mmap_file(inode)) { - ret =3D -EBUSY; - goto out; - } - ret =3D filemap_write_and_wait_range(inode->i_mapping, 0, LLONG_MAX); if (ret) goto out; @@ -4083,11 +4078,6 @@ static int f2fs_ioc_compress_file(struct file *filp,= unsigned long arg) goto out; } =20 - if (f2fs_is_mmap_file(inode)) { - ret =3D -EBUSY; - goto out; - } - ret =3D filemap_write_and_wait_range(inode->i_mapping, 0, LLONG_MAX); if (ret) goto out; --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47FC2C00140 for ; Mon, 15 Aug 2022 19:49:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345254AbiHOTtH (ORCPT ); Mon, 15 Aug 2022 15:49:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345560AbiHOTrH (ORCPT ); Mon, 15 Aug 2022 15:47:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C4CA70E64; Mon, 15 Aug 2022 11:49: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 B0117B810A1; Mon, 15 Aug 2022 18:49:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAE89C433C1; Mon, 15 Aug 2022 18:49:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589368; bh=MXWx+3HasW0tR213YqIc6ahlgS/NMcSpnkiVtVTpnvM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fumdkHlqrimhcrllJ4qus25NVcbJTFzSlDo4qL1hzzxktwPIWq0caoMSdE0tg+3zo Lvn5FMwCC0kAu24SwJIcdjh+Bwb0FGzBf/0HDA/suea60P2fCmtHscJTLeYMJon0eP vD0fCvty0fD4cLyLjOsXHIZmQg9VrT+U3CwmK8k4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Junbeom Yeom , Sungjong Seo , Youngjin Gil , Jaewook Kim , Chao Yu , Jaegeuk Kim , Sasha Levin Subject: [PATCH 5.15 665/779] f2fs: do not allow to decompress files have FI_COMPRESS_RELEASED Date: Mon, 15 Aug 2022 20:05:09 +0200 Message-Id: <20220815180405.775800553@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jaewook Kim [ Upstream commit 90be48bd9d29ece3965e5e8b21499b6db166e57b ] If a file has FI_COMPRESS_RELEASED, all writes for it should not be allowed. However, as of now, in case of compress_mode=3Duser, writes triggered by IOCTLs like F2FS_IOC_DE/COMPRESS_FILE are allowed unexpectly, which could crash that file. To fix it, let's do not allow F2FS_IOC_DE/COMPRESS_IOCTL if a file already has FI_COMPRESS_RELEASED flag. This is the reproduction process: 1. $ touch ./file 2. $ chattr +c ./file 3. $ dd if=3D/dev/random of=3D./file bs=3D4096 count=3D30 conv=3Dnotrunc 4. $ dd if=3D/dev/zero of=3D./file bs=3D4096 count=3D34 seek=3D30 conv=3Dn= otrunc 5. $ sync 6. $ do_compress ./file ; call F2FS_IOC_COMPRESS_FILE 7. $ get_compr_blocks ./file ; call F2FS_IOC_GET_COMPRESS_BLOCKS 8. $ release ./file ; call F2FS_IOC_RELEASE_COMPRESS_BLOCKS 9. $ do_compress ./file ; call F2FS_IOC_COMPRESS_FILE again 10. $ get_compr_blocks ./file ; call F2FS_IOC_GET_COMPRESS_BLOCKS again This reproduction process is tested in 128kb cluster size. You can find compr_blocks has a negative value. Fixes: 5fdb322ff2c2b ("f2fs: add F2FS_IOC_DECOMPRESS_FILE and F2FS_IOC_COMP= RESS_FILE") Signed-off-by: Junbeom Yeom Signed-off-by: Sungjong Seo Signed-off-by: Youngjin Gil Signed-off-by: Jaewook Kim Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/f2fs/file.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index 0669464a942a..758048a885d2 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -4011,6 +4011,11 @@ static int f2fs_ioc_decompress_file(struct file *fil= p, unsigned long arg) goto out; } =20 + if (is_inode_flag_set(inode, FI_COMPRESS_RELEASED)) { + ret =3D -EINVAL; + goto out; + } + ret =3D filemap_write_and_wait_range(inode->i_mapping, 0, LLONG_MAX); if (ret) goto out; @@ -4078,6 +4083,11 @@ static int f2fs_ioc_compress_file(struct file *filp,= unsigned long arg) goto out; } =20 + if (is_inode_flag_set(inode, FI_COMPRESS_RELEASED)) { + ret =3D -EINVAL; + goto out; + } + ret =3D filemap_write_and_wait_range(inode->i_mapping, 0, LLONG_MAX); if (ret) goto out; --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4DEE8C00140 for ; Mon, 15 Aug 2022 19:49:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345269AbiHOTtK (ORCPT ); Mon, 15 Aug 2022 15:49:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345577AbiHOTrM (ORCPT ); Mon, 15 Aug 2022 15:47:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1B8170E6F; Mon, 15 Aug 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 26174611EC; Mon, 15 Aug 2022 18:49:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A122C433C1; Mon, 15 Aug 2022 18:49:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589371; bh=iNolcQLsPmYHRMyNxtH30MXdTPCUZ/VVHnCYzYOKTLg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O3+p/mwWVJiDJYbaxy9Espib/Ey2xhRHoxP1PZrgZJ7LrfWw6ds0JmoDKX994VnCZ oJg3lNYYejoEHNMFcQaRpnyVOuM/FtH9jagNgineZuDCmXY5sZ5RyxBA9e15Dq9qqm Mt6jxIzb+dYlYOMrLqxFLKbdKIfYphCFF73H7iXI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Helge Deller , Sasha Levin Subject: [PATCH 5.15 666/779] video: fbdev: vt8623fb: Check the size of screen before memset_io() Date: Mon, 15 Aug 2022 20:05:10 +0200 Message-Id: <20220815180405.808687784@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 ec0754c60217248fa77cc9005d66b2b55200ac06 ] In the function vt8623fb_set_par(), the value of 'screen_size' is calculated by the user input. If the user provides the improper value, the value of 'screen_size' may larger than 'info->screen_size', which may cause the following bug: [ 583.339036] BUG: unable to handle page fault for address: ffffc900050000= 00 [ 583.339049] #PF: supervisor write access in kernel mode [ 583.339052] #PF: error_code(0x0002) - not-present page [ 583.339074] RIP: 0010:memset_orig+0x33/0xb0 [ 583.339110] Call Trace: [ 583.339118] vt8623fb_set_par+0x11cd/0x21e0 [ 583.339146] fb_set_var+0x604/0xeb0 [ 583.339181] do_fb_ioctl+0x234/0x670 [ 583.339209] fb_ioctl+0xdd/0x130 Fix the this by checking the value of 'screen_size' before memset_io(). Fixes: 558b7bd86c32 ("vt8623fb: new framebuffer driver for VIA VT8623") Signed-off-by: Zheyu Ma Signed-off-by: Helge Deller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/video/fbdev/vt8623fb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/video/fbdev/vt8623fb.c b/drivers/video/fbdev/vt8623fb.c index 7a959e5ba90b..c274ec5e965c 100644 --- a/drivers/video/fbdev/vt8623fb.c +++ b/drivers/video/fbdev/vt8623fb.c @@ -504,6 +504,8 @@ static int vt8623fb_set_par(struct fb_info *info) (info->var.vmode & FB_VMODE_DOUBLE) ? 2 : 1, 1, 1, info->node); =20 + if (screen_size > info->screen_size) + screen_size =3D info->screen_size; memset_io(info->screen_base, 0x00, screen_size); =20 /* Device and screen back on */ --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2CD4C25B08 for ; Mon, 15 Aug 2022 19:49:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345311AbiHOTtR (ORCPT ); Mon, 15 Aug 2022 15:49:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345606AbiHOTrP (ORCPT ); Mon, 15 Aug 2022 15:47:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41FB87170B; Mon, 15 Aug 2022 11:49: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 4A50460FB8; Mon, 15 Aug 2022 18:49:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C7A4C433C1; Mon, 15 Aug 2022 18:49:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589374; bh=Nr2tTi7hex0MmEAfHhyJS0YEDbBqvlF6Y+BVTcagX2U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ibq3gvQDMJZ4xphm1G8FciTaDJtALhWEWE1oUyGxGN1Wbk5+rvOWwTWATp0jqShdJ NQ5gN74l9Ae76qij/enH9O8fJd2yqRv8/s0AbpxrhWz8xKBZKc90XWo55V52PwaTUi SqtPpLdXEFuooFcWLxj68HQn6HQ0ut6FXtGr/W04= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Helge Deller , Sasha Levin Subject: [PATCH 5.15 667/779] video: fbdev: arkfb: Check the size of screen before memset_io() Date: Mon, 15 Aug 2022 20:05:11 +0200 Message-Id: <20220815180405.850582198@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 96b550971c65d54d64728d8ba973487878a06454 ] In the function arkfb_set_par(), the value of 'screen_size' is calculated by the user input. If the user provides the improper value, the value of 'screen_size' may larger than 'info->screen_size', which may cause the following bug: [ 659.399066] BUG: unable to handle page fault for address: ffffc900030000= 00 [ 659.399077] #PF: supervisor write access in kernel mode [ 659.399079] #PF: error_code(0x0002) - not-present page [ 659.399094] RIP: 0010:memset_orig+0x33/0xb0 [ 659.399116] Call Trace: [ 659.399122] arkfb_set_par+0x143f/0x24c0 [ 659.399130] fb_set_var+0x604/0xeb0 [ 659.399161] do_fb_ioctl+0x234/0x670 [ 659.399189] fb_ioctl+0xdd/0x130 Fix the this by checking the value of 'screen_size' before memset_io(). Fixes: 681e14730c73 ("arkfb: new framebuffer driver for ARK Logic cards") Signed-off-by: Zheyu Ma Signed-off-by: Helge Deller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/video/fbdev/arkfb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/video/fbdev/arkfb.c b/drivers/video/fbdev/arkfb.c index d94cc5ad1ef6..8d092b106470 100644 --- a/drivers/video/fbdev/arkfb.c +++ b/drivers/video/fbdev/arkfb.c @@ -794,6 +794,8 @@ static int arkfb_set_par(struct fb_info *info) value =3D ((value * hmul / hdiv) / 8) - 5; vga_wcrt(par->state.vgabase, 0x42, (value + 1) / 2); =20 + if (screen_size > info->screen_size) + screen_size =3D info->screen_size; memset_io(info->screen_base, 0x00, screen_size); /* Device and screen back on */ svga_wcrt_mask(par->state.vgabase, 0x17, 0x80, 0x80); --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCC22C00140 for ; Mon, 15 Aug 2022 19:49:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344745AbiHOTtb (ORCPT ); Mon, 15 Aug 2022 15:49:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344565AbiHOTr0 (ORCPT ); Mon, 15 Aug 2022 15:47:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9252A71737; Mon, 15 Aug 2022 11:49: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 2FA88B810A1; Mon, 15 Aug 2022 18:49:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62311C433C1; Mon, 15 Aug 2022 18:49:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589377; bh=THYaxhYxEtt5DwL3NnXBSqE1FH6qDsr39tfqXb4p+iA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rd/278UB4SHCwcCfdz8X7aX975cruP6mwc07y5q5MSq4mWpmAHNMYGhx1+igS2L6m eltcw3k3wKBUVHEhQZwUCa2Uv27JRoe5lkKqTCFCxGA9lciqR5xep4riebl1PaUSYe RmxUmjr7ZcuVRakvb54rZs0R2pj2w+x8Fznun5Uk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , Helge Deller , Sasha Levin Subject: [PATCH 5.15 668/779] video: fbdev: s3fb: Check the size of screen before memset_io() Date: Mon, 15 Aug 2022 20:05:12 +0200 Message-Id: <20220815180405.892058097@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 6ba592fa014f21f35a8ee8da4ca7b95a018f13e8 ] In the function s3fb_set_par(), the value of 'screen_size' is calculated by the user input. If the user provides the improper value, the value of 'screen_size' may larger than 'info->screen_size', which may cause the following bug: [ 54.083733] BUG: unable to handle page fault for address: ffffc900030000= 00 [ 54.083742] #PF: supervisor write access in kernel mode [ 54.083744] #PF: error_code(0x0002) - not-present page [ 54.083760] RIP: 0010:memset_orig+0x33/0xb0 [ 54.083782] Call Trace: [ 54.083788] s3fb_set_par+0x1ec6/0x4040 [ 54.083806] fb_set_var+0x604/0xeb0 [ 54.083836] do_fb_ioctl+0x234/0x670 Fix the this by checking the value of 'screen_size' before memset_io(). Fixes: a268422de8bf ("fbdev driver for S3 Trio/Virge") Signed-off-by: Zheyu Ma Signed-off-by: Helge Deller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/video/fbdev/s3fb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/video/fbdev/s3fb.c b/drivers/video/fbdev/s3fb.c index 5c74253e7b2c..a936455a3df2 100644 --- a/drivers/video/fbdev/s3fb.c +++ b/drivers/video/fbdev/s3fb.c @@ -902,6 +902,8 @@ static int s3fb_set_par(struct fb_info *info) value =3D clamp((htotal + hsstart + 1) / 2 + 2, hsstart + 4, htotal + 1); svga_wcrt_multi(par->state.vgabase, s3_dtpc_regs, value); =20 + if (screen_size > info->screen_size) + screen_size =3D info->screen_size; memset_io(info->screen_base, 0x00, screen_size); /* Device and screen back on */ svga_wcrt_mask(par->state.vgabase, 0x17, 0x80, 0x80); --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4119C00140 for ; Mon, 15 Aug 2022 19:49:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244468AbiHOTtt (ORCPT ); Mon, 15 Aug 2022 15:49:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344976AbiHOTsE (ORCPT ); Mon, 15 Aug 2022 15:48:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4760742AC3; Mon, 15 Aug 2022 11:49: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 64513B810A0; Mon, 15 Aug 2022 18:49:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AADB0C433D6; Mon, 15 Aug 2022 18:49:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589381; bh=o7H7UAVGrrpPOWxQzTHEeKccaB3z4bO8liOCqHQkIlA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dHOGAt2FMMxcYZxj2c39W+5g5FHXOTJ4zLd11igKNBsVS8NyL+eE982lzOn5BpZ98 RUZRctl+8I8HxcWTDqR4sOlSRyoMx08o+J8Sc6npiz+rwrUT+BeU4qhH/uhc5Bk9yx CQzdP1B6KfgZzzFQAjjmGPMt2bgM1GQ3o8ugOnTA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stanley Chu , Peter Wang , "Martin K. Petersen" Subject: [PATCH 5.15 669/779] scsi: ufs: core: Correct ufshcd_shutdown() flow Date: Mon, 15 Aug 2022 20:05:13 +0200 Message-Id: <20220815180405.942124712@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Wang commit 00511d2abf5708ad05dd5d1c36adb2468d274698 upstream. After ufshcd_wl_shutdown() set device power off and link off, ufshcd_shutdown() could turn off clock/power. Also remove pm_runtime_get_sync. The reason why it is safe to remove pm_runtime_get_sync() is because: - ufshcd_wl_shutdown() -> pm_runtime_get_sync() will resume hba->dev too. - device resume(turn on clk/power) is not required, even if device is in RPM_SUSPENDED. Link: https://lore.kernel.org/r/20220727030526.31022-1-peter.wang@mediatek.= com Fixes: b294ff3e3449 ("scsi: ufs: core: Enable power management for wlun") Cc: # 5.15.x Reviewed-by: Stanley Chu Signed-off-by: Peter Wang Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/ufs/ufshcd.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -9239,12 +9239,8 @@ EXPORT_SYMBOL(ufshcd_runtime_resume); int ufshcd_shutdown(struct ufs_hba *hba) { if (ufshcd_is_ufs_dev_poweroff(hba) && ufshcd_is_link_off(hba)) - goto out; + ufshcd_suspend(hba); =20 - pm_runtime_get_sync(hba->dev); - - ufshcd_suspend(hba); -out: hba->is_powered =3D false; /* allow force shutdown even in case of errors */ return 0; From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F6D9C3F6B0 for ; Mon, 15 Aug 2022 19:47:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344953AbiHOTpz (ORCPT ); Mon, 15 Aug 2022 15:45:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345103AbiHOTmZ (ORCPT ); Mon, 15 Aug 2022 15:42:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BFA986AA27; Mon, 15 Aug 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 97032B810A3; Mon, 15 Aug 2022 18:48:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7B20C433D6; Mon, 15 Aug 2022 18:48:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589282; bh=RiMHovBZYHCGWtaHr4fLln1x+ZrPOtYFkzQIgJvlNg8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CgWzTp4lV0KCfXqz50O+LEYukGMjCKB61Xm2t9/qh86ywv2aSgJPggQI5U2aBlzzI pTM9ORCb5m7akY/HvFRzqDGGcQLedFkmYBOi/VWjx+tNzE77biLXl0iFi0ugIx89CV 0A9MQ8Zxb7LQHlSisOjQmU6Q62WtxQNGp05DOvkg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benjamin Block , Steffen Maier , "Martin K. Petersen" Subject: [PATCH 5.15 670/779] scsi: zfcp: Fix missing auto port scan and thus missing target ports Date: Mon, 15 Aug 2022 20:05:14 +0200 Message-Id: <20220815180405.994344666@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Steffen Maier commit 4da8c5f76825269f28d6a89fa752934a4bcb6dfa upstream. Case (1): The only waiter on wka_port->completion_wq is zfcp_fc_wka_port_get() trying to open a WKA port. As such it should only be woken up by WKA port *open* responses, not by WKA port close responses. Case (2): A close WKA port response coming in just after having sent a new open WKA port request and before blocking for the open response with wait_event() in zfcp_fc_wka_port_get() erroneously renders the wait_event a NOP because the close handler overwrites wka_port->status. Hence the wait_event condition is erroneously true and it does not enter blocking state. With non-negligible probability, the following time space sequence happens depending on timing without this fix: user process ERP thread zfcp work queue tasklet system work queue =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D =3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D $ echo 1 > online zfcp_ccw_set_online zfcp_ccw_activate zfcp_erp_adapter_reopen msleep scan backoff zfcp_erp_strategy | ... | zfcp_erp_action_cleanup | ... | queue delayed scan_work | queue ns_up_work | ns_up_work: | zfcp_fc_wka_port_get | open wka request | open response | GSPN FC-GS | RSPN FC-GS [NPIV-only] | zfcp_fc_wka_port_put | (--wka->refcount=3D=3D0) | sched delayed wka->work | ~~~Case (1)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ zfcp_erp_wait flush scan_work | wka->work: | wka->status=3DCLOSING | close wka request | scan_work: | zfcp_fc_wka_port_get | (wka->status=3D=3DCLOSING) | wka->status=3DOPENING | open wka request | wait_event | | close response | | wka->status=3DOFFLINE | | wake_up /*WRONG*/ ~~~Case (2)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | wka->work: | wka->status=3DCLOSING | close wka request zfcp_erp_wait flush scan_work | scan_work: | zfcp_fc_wka_port_get | (wka->status=3D=3DCLOSING) | wka->status=3DOPENING | open wka request | close response | wka->status=3DOFFLINE | wake_up /*WRONG&NOP*/ | wait_event /*NOP*/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | (wka->status!=3DONLINE) | return -EIO | return early open response wka->status=3DONLINE wake_up /*NOP*/ So we erroneously end up with no automatic port scan. This is a big problem when it happens during boot. The timing is influenced by v3.19 commit 18f87a67e6d6 ("zfcp: auto port scan resiliency"). Fix it by fully mutually excluding zfcp_fc_wka_port_get() and zfcp_fc_wka_port_offline(). For that to work, we make the latter block until we got the response for a close WKA port. In order not to penalize the system workqueue, we move wka_port->work to our own adapter workqueue. Note that before v2.6.30 commit 828bc1212a68 ("[SCSI] zfcp: Set WKA-port to offline on adapter deactivation"), zfcp did block in zfcp_fc_wka_port_offline() as well, but with a different condition. While at it, make non-functional cleanups to improve code reading in zfcp_fc_wka_port_get(). If we cannot send the WKA port open request, don't rely on the subsequent wait_event condition to immediately let this case pass without blocking. Also don't want to rely on the additional condition handling the refcount to be skipped just to finally return with -EIO. Link: https://lore.kernel.org/r/20220729162529.1620730-1-maier@linux.ibm.com Fixes: 5ab944f97e09 ("[SCSI] zfcp: attach and release SAN nameserver port o= n demand") Cc: #v2.6.28+ Reviewed-by: Benjamin Block Signed-off-by: Steffen Maier Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/s390/scsi/zfcp_fc.c | 29 ++++++++++++++++++++--------- drivers/s390/scsi/zfcp_fc.h | 6 ++++-- drivers/s390/scsi/zfcp_fsf.c | 4 ++-- 3 files changed, 26 insertions(+), 13 deletions(-) --- a/drivers/s390/scsi/zfcp_fc.c +++ b/drivers/s390/scsi/zfcp_fc.c @@ -145,27 +145,33 @@ void zfcp_fc_enqueue_event(struct zfcp_a =20 static int zfcp_fc_wka_port_get(struct zfcp_fc_wka_port *wka_port) { + int ret =3D -EIO; + if (mutex_lock_interruptible(&wka_port->mutex)) return -ERESTARTSYS; =20 if (wka_port->status =3D=3D ZFCP_FC_WKA_PORT_OFFLINE || wka_port->status =3D=3D ZFCP_FC_WKA_PORT_CLOSING) { wka_port->status =3D ZFCP_FC_WKA_PORT_OPENING; - if (zfcp_fsf_open_wka_port(wka_port)) + if (zfcp_fsf_open_wka_port(wka_port)) { + /* could not even send request, nothing to wait for */ wka_port->status =3D ZFCP_FC_WKA_PORT_OFFLINE; + goto out; + } } =20 - mutex_unlock(&wka_port->mutex); - - wait_event(wka_port->completion_wq, + wait_event(wka_port->opened, wka_port->status =3D=3D ZFCP_FC_WKA_PORT_ONLINE || wka_port->status =3D=3D ZFCP_FC_WKA_PORT_OFFLINE); =20 if (wka_port->status =3D=3D ZFCP_FC_WKA_PORT_ONLINE) { atomic_inc(&wka_port->refcount); - return 0; + ret =3D 0; + goto out; } - return -EIO; +out: + mutex_unlock(&wka_port->mutex); + return ret; } =20 static void zfcp_fc_wka_port_offline(struct work_struct *work) @@ -181,9 +187,12 @@ static void zfcp_fc_wka_port_offline(str =20 wka_port->status =3D ZFCP_FC_WKA_PORT_CLOSING; if (zfcp_fsf_close_wka_port(wka_port)) { + /* could not even send request, nothing to wait for */ wka_port->status =3D ZFCP_FC_WKA_PORT_OFFLINE; - wake_up(&wka_port->completion_wq); + goto out; } + wait_event(wka_port->closed, + wka_port->status =3D=3D ZFCP_FC_WKA_PORT_OFFLINE); out: mutex_unlock(&wka_port->mutex); } @@ -193,13 +202,15 @@ static void zfcp_fc_wka_port_put(struct if (atomic_dec_return(&wka_port->refcount) !=3D 0) return; /* wait 10 milliseconds, other reqs might pop in */ - schedule_delayed_work(&wka_port->work, HZ / 100); + queue_delayed_work(wka_port->adapter->work_queue, &wka_port->work, + msecs_to_jiffies(10)); } =20 static void zfcp_fc_wka_port_init(struct zfcp_fc_wka_port *wka_port, u32 d= _id, struct zfcp_adapter *adapter) { - init_waitqueue_head(&wka_port->completion_wq); + init_waitqueue_head(&wka_port->opened); + init_waitqueue_head(&wka_port->closed); =20 wka_port->adapter =3D adapter; wka_port->d_id =3D d_id; --- a/drivers/s390/scsi/zfcp_fc.h +++ b/drivers/s390/scsi/zfcp_fc.h @@ -185,7 +185,8 @@ enum zfcp_fc_wka_status { /** * struct zfcp_fc_wka_port - representation of well-known-address (WKA) FC= port * @adapter: Pointer to adapter structure this WKA port belongs to - * @completion_wq: Wait for completion of open/close command + * @opened: Wait for completion of open command + * @closed: Wait for completion of close command * @status: Current status of WKA port * @refcount: Reference count to keep port open as long as it is in use * @d_id: FC destination id or well-known-address @@ -195,7 +196,8 @@ enum zfcp_fc_wka_status { */ struct zfcp_fc_wka_port { struct zfcp_adapter *adapter; - wait_queue_head_t completion_wq; + wait_queue_head_t opened; + wait_queue_head_t closed; enum zfcp_fc_wka_status status; atomic_t refcount; u32 d_id; --- a/drivers/s390/scsi/zfcp_fsf.c +++ b/drivers/s390/scsi/zfcp_fsf.c @@ -1907,7 +1907,7 @@ static void zfcp_fsf_open_wka_port_handl wka_port->status =3D ZFCP_FC_WKA_PORT_ONLINE; } out: - wake_up(&wka_port->completion_wq); + wake_up(&wka_port->opened); } =20 /** @@ -1966,7 +1966,7 @@ static void zfcp_fsf_close_wka_port_hand } =20 wka_port->status =3D ZFCP_FC_WKA_PORT_OFFLINE; - wake_up(&wka_port->completion_wq); + wake_up(&wka_port->closed); } =20 /** From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6986EC25B08 for ; Mon, 15 Aug 2022 19:47:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344922AbiHOTpv (ORCPT ); Mon, 15 Aug 2022 15:45:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44362 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345119AbiHOTm1 (ORCPT ); Mon, 15 Aug 2022 15:42:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C64B6A496; Mon, 15 Aug 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 0E68561215; Mon, 15 Aug 2022 18:48:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E50EC433C1; Mon, 15 Aug 2022 18:48:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589285; bh=S/JQouxy1F63QMdn0oomDfQuYY1coqzJfhi6JPkD6tc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iP9E4fS0BboJIQFFdIc5S/MdMRKO+6VPZskKZLyCeqXJoolV4iuYOtA6IFlUvgEpa PQ4sIIWj1sqGrkUGcqZpKUcKE+w/DxAJVs7gFDGMR3HrYMPlycvaa2N0lFuOvulXXb WiiBzLEj0QVvsowGm6vjQewqmNL3APCuy7prgTAg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Himanshu Madhani , Quinn Tran , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.15 671/779] scsi: qla2xxx: Fix imbalance vha->vref_count Date: Mon, 15 Aug 2022 20:05:15 +0200 Message-Id: <20220815180406.029915271@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran commit 63fa7f2644b4b48e1913af33092c044bf48e9321 upstream. vref_count took an extra decrement in the task management path. Add an extra ref count to compensate the imbalance. Link: https://lore.kernel.org/r/20220713052045.10683-7-njavali@marvell.com Cc: stable@vger.kernel.org Reviewed-by: Himanshu Madhani Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_init.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -161,6 +161,7 @@ int qla24xx_async_abort_cmd(srb_t *cmd_s struct srb_iocb *abt_iocb; srb_t *sp; int rval =3D QLA_FUNCTION_FAILED; + uint8_t bail; =20 /* ref: INIT for ABTS command */ sp =3D qla2xxx_get_qpair_sp(cmd_sp->vha, cmd_sp->qpair, cmd_sp->fcport, @@ -168,6 +169,7 @@ int qla24xx_async_abort_cmd(srb_t *cmd_s if (!sp) return QLA_MEMORY_ALLOC_FAILED; =20 + QLA_VHA_MARK_BUSY(vha, bail); abt_iocb =3D &sp->u.iocb_cmd; sp->type =3D SRB_ABT_CMD; sp->name =3D "abort"; @@ -2009,12 +2011,14 @@ qla2x00_async_tm_cmd(fc_port_t *fcport, struct srb_iocb *tm_iocb; srb_t *sp; int rval =3D QLA_FUNCTION_FAILED; + uint8_t bail; =20 /* ref: INIT */ sp =3D qla2x00_get_sp(vha, fcport, GFP_KERNEL); if (!sp) goto done; =20 + QLA_VHA_MARK_BUSY(vha, bail); sp->type =3D SRB_TM_CMD; sp->name =3D "tmf"; qla2x00_init_async_sp(sp, qla2x00_get_async_timeout(vha), From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F0D4C282E7 for ; Mon, 15 Aug 2022 19:47:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344982AbiHOTp6 (ORCPT ); Mon, 15 Aug 2022 15:45:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345187AbiHOTme (ORCPT ); Mon, 15 Aug 2022 15:42:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2B1F6B646; Mon, 15 Aug 2022 11:48: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 E0C4CB810A0; Mon, 15 Aug 2022 18:48:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3464FC433C1; Mon, 15 Aug 2022 18:48:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589288; bh=5AooMPA3ZrJcRMxrL843yoAkL5TcRwMlZgvuvKA3e4w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NKzL1YqfnYZX2lx6BNn87/mGOQaJrrYuk1Phqswj64Q1zT4su6yBhHQvlVeDHByOe kd4Mhxim+nKhsf8EGGFvbcOPOsDWuwMRrZ6no1ZysgL93hIXzAELeEVub+kBsvGjN7 VvDaxF4LJJJo8Jos6Id4+EcIgFbJWJ3ni2zy1eHc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tony Battersby , Himanshu Madhani , Arun Easi , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.15 672/779] scsi: qla2xxx: Fix discovery issues in FC-AL topology Date: Mon, 15 Aug 2022 20:05:16 +0200 Message-Id: <20220815180406.063549006@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Arun Easi commit 47ccb113cead905bdc236571bf8ac6fed90321b3 upstream. A direct attach tape device, when gets swapped with another, was not discovered. Fix this by looking at loop map and reinitialize link if there are devices present. Link: https://lore.kernel.org/linux-scsi/baef87c3-5dad-3b47-44c1-6914bfc901= 08@cybernetics.com/ Link: https://lore.kernel.org/r/20220713052045.10683-8-njavali@marvell.com Cc: stable@vger.kernel.org Reported-by: Tony Battersby Tested-by: Tony Battersby Reviewed-by: Himanshu Madhani Signed-off-by: Arun Easi Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_gbl.h | 3 ++- drivers/scsi/qla2xxx/qla_init.c | 29 +++++++++++++++++++++++++++++ drivers/scsi/qla2xxx/qla_mbx.c | 5 ++++- 3 files changed, 35 insertions(+), 2 deletions(-) --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -433,7 +433,8 @@ extern int qla2x00_get_resource_cnts(scsi_qla_host_t *); =20 extern int -qla2x00_get_fcal_position_map(scsi_qla_host_t *ha, char *pos_map); +qla2x00_get_fcal_position_map(scsi_qla_host_t *ha, char *pos_map, + u8 *num_entries); =20 extern int qla2x00_get_link_status(scsi_qla_host_t *, uint16_t, struct link_statistic= s *, --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -5510,6 +5510,22 @@ static int qla2x00_configure_n2n_loop(sc return QLA_FUNCTION_FAILED; } =20 +static void +qla_reinitialize_link(scsi_qla_host_t *vha) +{ + int rval; + + atomic_set(&vha->loop_state, LOOP_DOWN); + atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME); + rval =3D qla2x00_full_login_lip(vha); + if (rval =3D=3D QLA_SUCCESS) { + ql_dbg(ql_dbg_disc, vha, 0xd050, "Link reinitialized\n"); + } else { + ql_dbg(ql_dbg_disc, vha, 0xd051, + "Link reinitialization failed (%d)\n", rval); + } +} + /* * qla2x00_configure_local_loop * Updates Fibre Channel Device Database with local loop devices. @@ -5561,6 +5577,19 @@ qla2x00_configure_local_loop(scsi_qla_ho spin_unlock_irqrestore(&vha->work_lock, flags); =20 if (vha->scan.scan_retry < MAX_SCAN_RETRIES) { + u8 loop_map_entries =3D 0; + int rc; + + rc =3D qla2x00_get_fcal_position_map(vha, NULL, + &loop_map_entries); + if (rc =3D=3D QLA_SUCCESS && loop_map_entries > 1) { + /* + * There are devices that are still not logged + * in. Reinitialize to give them a chance. + */ + qla_reinitialize_link(vha); + return QLA_FUNCTION_FAILED; + } set_bit(LOCAL_LOOP_UPDATE, &vha->dpc_flags); set_bit(LOOP_RESYNC_NEEDED, &vha->dpc_flags); } --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -3062,7 +3062,8 @@ qla2x00_get_resource_cnts(scsi_qla_host_ * Kernel context. */ int -qla2x00_get_fcal_position_map(scsi_qla_host_t *vha, char *pos_map) +qla2x00_get_fcal_position_map(scsi_qla_host_t *vha, char *pos_map, + u8 *num_entries) { int rval; mbx_cmd_t mc; @@ -3102,6 +3103,8 @@ qla2x00_get_fcal_position_map(scsi_qla_h =20 if (pos_map) memcpy(pos_map, pmap, FCAL_MAP_SIZE); + if (num_entries) + *num_entries =3D pmap[0]; } dma_pool_free(ha->s_dma_pool, pmap, pmap_dma); From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E2C8C28B2C for ; Mon, 15 Aug 2022 19:47:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345025AbiHOTqB (ORCPT ); Mon, 15 Aug 2022 15:46:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345213AbiHOTmi (ORCPT ); Mon, 15 Aug 2022 15:42:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4017C6B673; Mon, 15 Aug 2022 11:48: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 1D134B810A3; Mon, 15 Aug 2022 18:48:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48F26C433D6; Mon, 15 Aug 2022 18:48:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589291; bh=kE5Pc4KWT4QTt3aRanAvcr3cLoMWZNTORiqhy0qVjeU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SgWWe34h2D3Za/vcW9LpstzbjSjGJ9fIglhYgjlUtgGi3U9xHzFRq+ODMlT2ZegWC aJ6Y4h8yxDUokNTbOiM+AOy3FgXq31q2XkQMk/3Yw+hlE93mJKYoxbR90trdgx5No+ FoUdFPhnGm1STRiqdsWybrE5nf6bpFoNpQ3WPatQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quinn Tran , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.15 673/779] scsi: qla2xxx: Turn off multi-queue for 8G adapters Date: Mon, 15 Aug 2022 20:05:17 +0200 Message-Id: <20220815180406.116249365@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran commit 5304673bdb1635e27555bd636fd5d6956f1cd552 upstream. For 8G adapters, multi-queue was enabled accidentally. Make sure multi-queue is not enabled. Link: https://lore.kernel.org/r/20220616053508.27186-5-njavali@marvell.com Cc: stable@vger.kernel.org Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_def.h | 4 ++-- drivers/scsi/qla2xxx/qla_isr.c | 16 ++++++---------- 2 files changed, 8 insertions(+), 12 deletions(-) --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -4261,8 +4261,8 @@ struct qla_hw_data { #define IS_OEM_001(ha) ((ha)->device_type & DT_OEM_001) #define HAS_EXTENDED_IDS(ha) ((ha)->device_type & DT_EXTENDED_IDS) #define IS_CT6_SUPPORTED(ha) ((ha)->device_type & DT_CT6_SUPPORTED) -#define IS_MQUE_CAPABLE(ha) ((ha)->mqenable || IS_QLA83XX(ha) || \ - IS_QLA27XX(ha) || IS_QLA28XX(ha)) +#define IS_MQUE_CAPABLE(ha) (IS_QLA83XX(ha) || IS_QLA27XX(ha) || \ + IS_QLA28XX(ha)) #define IS_BIDI_CAPABLE(ha) \ (IS_QLA25XX(ha) || IS_QLA2031(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) /* Bit 21 of fw_attributes decides the MCTP capabilities */ --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -4415,16 +4415,12 @@ msix_register_fail: } =20 /* Enable MSI-X vector for response queue update for queue 0 */ - if (IS_QLA83XX(ha) || IS_QLA27XX(ha) || IS_QLA28XX(ha)) { - if (ha->msixbase && ha->mqiobase && - (ha->max_rsp_queues > 1 || ha->max_req_queues > 1 || - ql2xmqsupport)) - ha->mqenable =3D 1; - } else - if (ha->mqiobase && - (ha->max_rsp_queues > 1 || ha->max_req_queues > 1 || - ql2xmqsupport)) - ha->mqenable =3D 1; + if (IS_MQUE_CAPABLE(ha) && + (ha->msixbase && ha->mqiobase && ha->max_qpairs)) + ha->mqenable =3D 1; + else + ha->mqenable =3D 0; + ql_dbg(ql_dbg_multiq, vha, 0xc005, "mqiobase=3D%p, max_rsp_queues=3D%d, max_req_queues=3D%d.\n", ha->mqiobase, ha->max_rsp_queues, ha->max_req_queues); From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFF62C28B2B for ; Mon, 15 Aug 2022 19:47:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345073AbiHOTqE (ORCPT ); Mon, 15 Aug 2022 15:46:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345227AbiHOTmj (ORCPT ); Mon, 15 Aug 2022 15:42:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 878C86BD41; Mon, 15 Aug 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 dfw.source.kernel.org (Postfix) with ESMTPS id 6CE6B611DD; Mon, 15 Aug 2022 18:48:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C1FCC433D7; Mon, 15 Aug 2022 18:48:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589294; bh=0Q3PGTofDbqa7zbcMoFIWnJsfFMcWuzA/R+S9+DVup4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a9ShFKEBleUqkD9eCHKziyJkWdKRhJXxDp1ePj/wHtiW4gWGoIZB1zpP6SQSmD4Gv f9jSwOGjZ9qSZROCArce7XYs9NySfb784DWmihlaFlLyEYtvh7z6X5Gg+4zDvHmro3 3iXNiKO4Am0my6eKtcX+t9m25jzaUM5FmRQyUa2Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arun Easi , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.15 674/779] scsi: qla2xxx: Fix crash due to stale SRB access around I/O timeouts Date: Mon, 15 Aug 2022 20:05:18 +0200 Message-Id: <20220815180406.149098487@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Arun Easi commit c39587bc0abaf16593f7abcdf8aeec3c038c7d52 upstream. Ensure SRB is returned during I/O timeout error escalation. If that is not possible fail the escalation path. Following crash stack was seen: BUG: unable to handle kernel paging request at 0000002f56aa90f8 IP: qla_chk_edif_rx_sa_delete_pending+0x14/0x30 [qla2xxx] Call Trace: ? qla2x00_status_entry+0x19f/0x1c50 [qla2xxx] ? qla2x00_start_sp+0x116/0x1170 [qla2xxx] ? dma_pool_alloc+0x1d6/0x210 ? mempool_alloc+0x54/0x130 ? qla24xx_process_response_queue+0x548/0x12b0 [qla2xxx] ? qla_do_work+0x2d/0x40 [qla2xxx] ? process_one_work+0x14c/0x390 Link: https://lore.kernel.org/r/20220616053508.27186-6-njavali@marvell.com Fixes: d74595278f4a ("scsi: qla2xxx: Add multiple queue pair functionality.= ") Cc: stable@vger.kernel.org Signed-off-by: Arun Easi Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_os.c | 43 ++++++++++++++++++++++++++++++-------= ----- 1 file changed, 31 insertions(+), 12 deletions(-) --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -1333,21 +1333,20 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd) /* * Returns: QLA_SUCCESS or QLA_FUNCTION_FAILED. */ -int -qla2x00_eh_wait_for_pending_commands(scsi_qla_host_t *vha, unsigned int t, - uint64_t l, enum nexus_wait_type type) +static int +__qla2x00_eh_wait_for_pending_commands(struct qla_qpair *qpair, unsigned i= nt t, + uint64_t l, enum nexus_wait_type type) { int cnt, match, status; unsigned long flags; - struct qla_hw_data *ha =3D vha->hw; - struct req_que *req; + scsi_qla_host_t *vha =3D qpair->vha; + struct req_que *req =3D qpair->req; srb_t *sp; struct scsi_cmnd *cmd; =20 status =3D QLA_SUCCESS; =20 - spin_lock_irqsave(&ha->hardware_lock, flags); - req =3D vha->req; + spin_lock_irqsave(qpair->qp_lock_ptr, flags); for (cnt =3D 1; status =3D=3D QLA_SUCCESS && cnt < req->num_outstanding_cmds; cnt++) { sp =3D req->outstanding_cmds[cnt]; @@ -1374,12 +1373,32 @@ qla2x00_eh_wait_for_pending_commands(scs if (!match) continue; =20 - spin_unlock_irqrestore(&ha->hardware_lock, flags); + spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); status =3D qla2x00_eh_wait_on_command(cmd); - spin_lock_irqsave(&ha->hardware_lock, flags); + spin_lock_irqsave(qpair->qp_lock_ptr, flags); } - spin_unlock_irqrestore(&ha->hardware_lock, flags); + spin_unlock_irqrestore(qpair->qp_lock_ptr, flags); + + return status; +} + +int +qla2x00_eh_wait_for_pending_commands(scsi_qla_host_t *vha, unsigned int t, + uint64_t l, enum nexus_wait_type type) +{ + struct qla_qpair *qpair; + struct qla_hw_data *ha =3D vha->hw; + int i, status =3D QLA_SUCCESS; =20 + status =3D __qla2x00_eh_wait_for_pending_commands(ha->base_qpair, t, l, + type); + for (i =3D 0; status =3D=3D QLA_SUCCESS && i < ha->max_qpairs; i++) { + qpair =3D ha->queue_pair_map[i]; + if (!qpair) + continue; + status =3D __qla2x00_eh_wait_for_pending_commands(qpair, t, l, + type); + } return status; } =20 @@ -1416,7 +1435,7 @@ qla2xxx_eh_device_reset(struct scsi_cmnd return err; =20 if (fcport->deleted) - return SUCCESS; + return FAILED; =20 ql_log(ql_log_info, vha, 0x8009, "DEVICE RESET ISSUED nexus=3D%ld:%d:%llu cmd=3D%p.\n", vha->host_no, @@ -1484,7 +1503,7 @@ qla2xxx_eh_target_reset(struct scsi_cmnd return err; =20 if (fcport->deleted) - return SUCCESS; + return FAILED; =20 ql_log(ql_log_info, vha, 0x8009, "TARGET RESET ISSUED nexus=3D%ld:%d cmd=3D%p.\n", vha->host_no, From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3F8EC2BB45 for ; Mon, 15 Aug 2022 19:47:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345296AbiHOTqW (ORCPT ); Mon, 15 Aug 2022 15:46:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344510AbiHOTn0 (ORCPT ); Mon, 15 Aug 2022 15:43:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 458B06B173; Mon, 15 Aug 2022 11:48:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5BA95B81057; Mon, 15 Aug 2022 18:48:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87626C433D6; Mon, 15 Aug 2022 18:48:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589298; bh=xP/ztu0pUq3CTpZIxN6O309pzYdzPqxQGpCHUkUVZK4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rswcGjtObRCu5AaUcdteoFBQbiONL6UhraOHURbewxxoGpuoZD669ZzsPzGUVteF9 FOL3uVEI0NpTxLlGahZqJYLyNLDlIRwhUArHc/NLipXwhK6nUYoVtJD2/S/Li7/Owi P2CBlMWqEt1byWNK18dfm7jOTA19O+0+v60IyHXk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arun Easi , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.15 675/779] scsi: qla2xxx: Fix excessive I/O error messages by default Date: Mon, 15 Aug 2022 20:05:19 +0200 Message-Id: <20220815180406.199561698@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Arun Easi commit bff4873c709085e09d0ffae0c25b8e65256e3205 upstream. Disable printing I/O error messages by default. The messages will be printed only when logging was enabled. Link: https://lore.kernel.org/r/20220616053508.27186-2-njavali@marvell.com Fixes: 8e2d81c6b5be ("scsi: qla2xxx: Fix excessive messages during device l= ogout") Cc: stable@vger.kernel.org Signed-off-by: Arun Easi Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_isr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/scsi/qla2xxx/qla_isr.c +++ b/drivers/scsi/qla2xxx/qla_isr.c @@ -2633,7 +2633,7 @@ static void qla24xx_nvme_iocb_entry(scsi } =20 if (unlikely(logit)) - ql_log(ql_dbg_io, fcport->vha, 0x5060, + ql_dbg(ql_dbg_io, fcport->vha, 0x5060, "NVME-%s ERR Handling - hdl=3D%x status(%x) tr_len:%x resid=3D%x ox_= id=3D%x\n", sp->name, sp->handle, comp_status, fd->transferred_length, le32_to_cpu(sts->residual_len), @@ -3491,7 +3491,7 @@ check_scsi_status: =20 out: if (logit) - ql_log(ql_dbg_io, fcport->vha, 0x3022, + ql_dbg(ql_dbg_io, fcport->vha, 0x3022, "FCP command status: 0x%x-0x%x (0x%x) nexus=3D%ld:%d:%llu portid= =3D%02x%02x%02x oxid=3D0x%x cdb=3D%10phN len=3D0x%x rsp_info=3D0x%x resid= =3D0x%x fw_resid=3D0x%x sp=3D%p cp=3D%p.\n", comp_status, scsi_status, res, vha->host_no, cp->device->id, cp->device->lun, fcport->d_id.b.domain, From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF795C2BB43 for ; Mon, 15 Aug 2022 19:47:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345118AbiHOTqJ (ORCPT ); Mon, 15 Aug 2022 15:46:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345251AbiHOTmm (ORCPT ); Mon, 15 Aug 2022 15:42:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D2616C104; Mon, 15 Aug 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 dfw.source.kernel.org (Postfix) with ESMTPS id 89311611EC; Mon, 15 Aug 2022 18:48:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FD0FC433D7; Mon, 15 Aug 2022 18:48:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589300; bh=BWkT5Y8yauvayeEYP3032GkgL1q2sJJNLjErP6LavCU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ec1jM+0zu4BYGCslZtrXUUsiojiyvA5mPVzDQrlEvEKBq/7p/AIRU7LTwX7nLRe1x kugJXadSK71UcHRVLsTqiti1j3ylqNk1DtzN2D0mGNJd/V3xxDtSxuZETUiCucxeqc wKGv3553CTUNIQVBFG5I2NKmE8uOcsr3iDoSt4Bk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Naresh Bannoth , Kyle Mahlkuch , Quinn Tran , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.15 676/779] scsi: qla2xxx: Fix erroneous mailbox timeout after PCI error injection Date: Mon, 15 Aug 2022 20:05:20 +0200 Message-Id: <20220815180406.248729432@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran commit f260694e6463b63ae550aad25ddefe94cb1904da upstream. Clear wait for mailbox interrupt flag to prevent stale mailbox: Feb 22 05:22:56 ltcden4-lp7 kernel: qla2xxx [0135:90:00.1]-500a:4: LOOP UP = detected (16 Gbps). Feb 22 05:22:59 ltcden4-lp7 kernel: qla2xxx [0135:90:00.1]-d04c:4: MBX Comm= and timeout for cmd 69, ... To fix the issue, driver needs to clear the MBX_INTR_WAIT flag on purging the mailbox. When the stale mailbox completion does arrive, it will be dropped. Link: https://lore.kernel.org/r/20220616053508.27186-11-njavali@marvell.com Fixes: b6faaaf796d7 ("scsi: qla2xxx: Serialize mailbox request") Cc: Naresh Bannoth Cc: Kyle Mahlkuch Cc: stable@vger.kernel.org Reported-by: Naresh Bannoth Tested-by: Naresh Bannoth Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_mbx.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -276,6 +276,12 @@ qla2x00_mailbox_command(scsi_qla_host_t atomic_inc(&ha->num_pend_mbx_stage3); if (!wait_for_completion_timeout(&ha->mbx_intr_comp, mcp->tov * HZ)) { + ql_dbg(ql_dbg_mbx, vha, 0x117a, + "cmd=3D%x Timeout.\n", command); + spin_lock_irqsave(&ha->hardware_lock, flags); + clear_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags); + spin_unlock_irqrestore(&ha->hardware_lock, flags); + if (chip_reset !=3D ha->chip_reset) { eeh_delay =3D ha->flags.eeh_busy ? 1 : 0; =20 @@ -288,12 +294,6 @@ qla2x00_mailbox_command(scsi_qla_host_t rval =3D QLA_ABORTED; goto premature_exit; } - ql_dbg(ql_dbg_mbx, vha, 0x117a, - "cmd=3D%x Timeout.\n", command); - spin_lock_irqsave(&ha->hardware_lock, flags); - clear_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags); - spin_unlock_irqrestore(&ha->hardware_lock, flags); - } else if (ha->flags.purge_mbox || chip_reset !=3D ha->chip_reset) { eeh_delay =3D ha->flags.eeh_busy ? 1 : 0; From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF669C2BB41 for ; Mon, 15 Aug 2022 19:47:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345175AbiHOTqL (ORCPT ); Mon, 15 Aug 2022 15:46:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344338AbiHOTnD (ORCPT ); Mon, 15 Aug 2022 15:43:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D09F36C745; Mon, 15 Aug 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 ams.source.kernel.org (Postfix) with ESMTPS id 48E20B810A4; Mon, 15 Aug 2022 18:48:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 920C0C433C1; Mon, 15 Aug 2022 18:48:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589304; bh=J4jmhqH1QHUDWaxI00qFdkuWTbHMMJ3/Y4bD2QdzluQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xj7J/wa1kzGrJDT7/p7wcr2Zda13knEnFsZ/9dWXTcQDPBrNhnFQ1lmcIcTccpORj TIfNA173LKZX001XL+nsWhs0b2s14ztRR/rNjDcxDWEKz23ASh/UouC59QhgU2pSoz rIXlfy07nh7PhuBUmJFjh7CEAX+z0PxgoYF3OYbI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quinn Tran , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.15 677/779] scsi: qla2xxx: Wind down adapter after PCIe error Date: Mon, 15 Aug 2022 20:05:21 +0200 Message-Id: <20220815180406.287571695@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Quinn Tran commit d3117c83ba316b3200d9f2fe900f2b9a5525a25c upstream. Put adapter into a wind down state if OS does not make any attempt to recover the adapter after PCIe error. Link: https://lore.kernel.org/r/20220616053508.27186-4-njavali@marvell.com Cc: stable@vger.kernel.org Signed-off-by: Quinn Tran Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_bsg.c | 10 +++++++- drivers/scsi/qla2xxx/qla_def.h | 4 +++ drivers/scsi/qla2xxx/qla_init.c | 20 ++++++++++++++++ drivers/scsi/qla2xxx/qla_os.c | 48 +++++++++++++++++++++++++++++++++++= +++++ 4 files changed, 81 insertions(+), 1 deletion(-) --- a/drivers/scsi/qla2xxx/qla_bsg.c +++ b/drivers/scsi/qla2xxx/qla_bsg.c @@ -2972,6 +2972,13 @@ qla24xx_bsg_timeout(struct bsg_job *bsg_ =20 ql_log(ql_log_info, vha, 0x708b, "%s CMD timeout. bsg ptr %p.\n", __func__, bsg_job); + + if (qla2x00_isp_reg_stat(ha)) { + ql_log(ql_log_info, vha, 0x9007, + "PCI/Register disconnect.\n"); + qla_pci_set_eeh_busy(vha); + } + /* find the bsg job from the active list of commands */ spin_lock_irqsave(&ha->hardware_lock, flags); for (que =3D 0; que < ha->max_req_queues; que++) { @@ -2989,7 +2996,8 @@ qla24xx_bsg_timeout(struct bsg_job *bsg_ sp->u.bsg_job =3D=3D bsg_job) { req->outstanding_cmds[cnt] =3D NULL; spin_unlock_irqrestore(&ha->hardware_lock, flags); - if (ha->isp_ops->abort_command(sp)) { + + if (!ha->flags.eeh_busy && ha->isp_ops->abort_command(sp)) { ql_log(ql_log_warn, vha, 0x7089, "mbx abort_command failed.\n"); bsg_reply->result =3D -EIO; --- a/drivers/scsi/qla2xxx/qla_def.h +++ b/drivers/scsi/qla2xxx/qla_def.h @@ -4045,6 +4045,9 @@ struct qla_hw_data { uint32_t n2n_fw_acc_sec:1; uint32_t plogi_template_valid:1; uint32_t port_isolated:1; + uint32_t eeh_flush:2; +#define EEH_FLUSH_RDY 1 +#define EEH_FLUSH_DONE 2 } flags; =20 uint16_t max_exchg; @@ -4079,6 +4082,7 @@ struct qla_hw_data { uint32_t rsp_que_len; uint32_t req_que_off; uint32_t rsp_que_off; + unsigned long eeh_jif; =20 /* Multi queue data structs */ device_reg_t *mqiobase; --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -47,6 +47,7 @@ qla2x00_sp_timeout(struct timer_list *t) { srb_t *sp =3D from_timer(sp, t, u.iocb_cmd.timer); struct srb_iocb *iocb; + scsi_qla_host_t *vha =3D sp->vha; =20 WARN_ON(irqs_disabled()); iocb =3D &sp->u.iocb_cmd; @@ -54,6 +55,12 @@ qla2x00_sp_timeout(struct timer_list *t) =20 /* ref: TMR */ kref_put(&sp->cmd_kref, qla2x00_sp_release); + + if (vha && qla2x00_isp_reg_stat(vha->hw)) { + ql_log(ql_log_info, vha, 0x9008, + "PCI/Register disconnect.\n"); + qla_pci_set_eeh_busy(vha); + } } =20 void qla2x00_sp_free(srb_t *sp) @@ -9731,6 +9738,12 @@ int qla2xxx_disable_port(struct Scsi_Hos =20 vha->hw->flags.port_isolated =3D 1; =20 + if (qla2x00_isp_reg_stat(vha->hw)) { + ql_log(ql_log_info, vha, 0x9006, + "PCI/Register disconnect, exiting.\n"); + qla_pci_set_eeh_busy(vha); + return FAILED; + } if (qla2x00_chip_is_down(vha)) return 0; =20 @@ -9746,6 +9759,13 @@ int qla2xxx_enable_port(struct Scsi_Host { scsi_qla_host_t *vha =3D shost_priv(host); =20 + if (qla2x00_isp_reg_stat(vha->hw)) { + ql_log(ql_log_info, vha, 0x9001, + "PCI/Register disconnect, exiting.\n"); + qla_pci_set_eeh_busy(vha); + return FAILED; + } + vha->hw->flags.port_isolated =3D 0; /* Set the flag to 1, so that isp_abort can proceed */ vha->flags.online =3D 1; --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -333,6 +333,11 @@ MODULE_PARM_DESC(ql2xabts_wait_nvme, "To wait for ABTS response on I/O timeouts for NVMe. (default: 1)"); =20 =20 +u32 ql2xdelay_before_pci_error_handling =3D 5; +module_param(ql2xdelay_before_pci_error_handling, uint, 0644); +MODULE_PARM_DESC(ql2xdelay_before_pci_error_handling, + "Number of seconds delayed before qla begin PCI error self-handling (defa= ult: 5).\n"); + static void qla2x00_clear_drv_active(struct qla_hw_data *); static void qla2x00_free_device(scsi_qla_host_t *); static int qla2xxx_map_queues(struct Scsi_Host *shost); @@ -7251,6 +7256,44 @@ static void qla_heart_beat(struct scsi_q } } =20 +static void qla_wind_down_chip(scsi_qla_host_t *vha) +{ + struct qla_hw_data *ha =3D vha->hw; + + if (!ha->flags.eeh_busy) + return; + if (ha->pci_error_state) + /* system is trying to recover */ + return; + + /* + * Current system is not handling PCIE error. At this point, this is + * best effort to wind down the adapter. + */ + if (time_after_eq(jiffies, ha->eeh_jif + ql2xdelay_before_pci_error_handl= ing * HZ) && + !ha->flags.eeh_flush) { + ql_log(ql_log_info, vha, 0x9009, + "PCI Error detected, attempting to reset hardware.\n"); + + ha->isp_ops->reset_chip(vha); + ha->isp_ops->disable_intrs(ha); + + ha->flags.eeh_flush =3D EEH_FLUSH_RDY; + ha->eeh_jif =3D jiffies; + + } else if (ha->flags.eeh_flush =3D=3D EEH_FLUSH_RDY && + time_after_eq(jiffies, ha->eeh_jif + 5 * HZ)) { + pci_clear_master(ha->pdev); + + /* flush all command */ + qla2x00_abort_isp_cleanup(vha); + ha->flags.eeh_flush =3D EEH_FLUSH_DONE; + + ql_log(ql_log_info, vha, 0x900a, + "PCI Error handling complete, all IOs aborted.\n"); + } +} + /************************************************************************** * qla2x00_timer * @@ -7274,6 +7317,8 @@ qla2x00_timer(struct timer_list *t) fc_port_t *fcport =3D NULL; =20 if (ha->flags.eeh_busy) { + qla_wind_down_chip(vha); + ql_dbg(ql_dbg_timer, vha, 0x6000, "EEH =3D %d, restarting timer.\n", ha->flags.eeh_busy); @@ -7854,6 +7899,9 @@ void qla_pci_set_eeh_busy(struct scsi_ql =20 spin_lock_irqsave(&base_vha->work_lock, flags); if (!ha->flags.eeh_busy) { + ha->eeh_jif =3D jiffies; + ha->flags.eeh_flush =3D 0; + ha->flags.eeh_busy =3D 1; do_cleanup =3D true; } From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE850C2BB47 for ; Mon, 15 Aug 2022 19:47:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345240AbiHOTqR (ORCPT ); Mon, 15 Aug 2022 15:46:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344447AbiHOTnL (ORCPT ); Mon, 15 Aug 2022 15:43: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 E62BA41D14; Mon, 15 Aug 2022 11:48: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 0B412611C1; Mon, 15 Aug 2022 18:48:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC325C433C1; Mon, 15 Aug 2022 18:48:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589307; bh=PxBqGK2Kj8p0vATicmcfzDVyrDcCLlfhoWha3BM427I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wktWy4cG7ng/MCglyZqGKEpWW2aLcvyndnStQOPEPjQkCgnveLjbfO9k0leRziCAy fAIJXa8Cw5WbGRbQm+uotIq1zYAWwRx7b2ZSdMnlSSaod2qub/n7Bsmnm5D24fW+ia PTr/KtsWt1wUGJT5sBxIXmlnlqN1v6MZnd2JKjwk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arun Easi , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.15 678/779] scsi: qla2xxx: Fix losing FCP-2 targets on long port disable with I/Os Date: Mon, 15 Aug 2022 20:05:22 +0200 Message-Id: <20220815180406.331391461@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Arun Easi commit 2416ccd3815ba1613e10a6da0a24ef21acfe5633 upstream. FCP-2 devices were not coming back online once they were lost, login retries exhausted, and then came back up. Fix this by accepting RSCN when the device is not online. Link: https://lore.kernel.org/r/20220616053508.27186-10-njavali@marvell.com Fixes: 44c57f205876 ("scsi: qla2xxx: Changes to support FCP2 Target") Cc: stable@vger.kernel.org Signed-off-by: Arun Easi Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_init.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -1836,7 +1836,8 @@ void qla2x00_handle_rscn(scsi_qla_host_t case RSCN_PORT_ADDR: fcport =3D qla2x00_find_fcport_by_nportid(vha, &ea->id, 1); if (fcport) { - if (fcport->flags & FCF_FCP2_DEVICE) { + if (fcport->flags & FCF_FCP2_DEVICE && + atomic_read(&fcport->state) =3D=3D FCS_ONLINE) { ql_dbg(ql_dbg_disc, vha, 0x2115, "Delaying session delete for FCP2 portid=3D%06x %8phC ", fcport->d_id.b24, fcport->port_name); @@ -1868,7 +1869,8 @@ void qla2x00_handle_rscn(scsi_qla_host_t break; case RSCN_AREA_ADDR: list_for_each_entry(fcport, &vha->vp_fcports, list) { - if (fcport->flags & FCF_FCP2_DEVICE) + if (fcport->flags & FCF_FCP2_DEVICE && + atomic_read(&fcport->state) =3D=3D FCS_ONLINE) continue; =20 if ((ea->id.b24 & 0xffff00) =3D=3D (fcport->d_id.b24 & 0xffff00)) { @@ -1879,7 +1881,8 @@ void qla2x00_handle_rscn(scsi_qla_host_t break; case RSCN_DOM_ADDR: list_for_each_entry(fcport, &vha->vp_fcports, list) { - if (fcport->flags & FCF_FCP2_DEVICE) + if (fcport->flags & FCF_FCP2_DEVICE && + atomic_read(&fcport->state) =3D=3D FCS_ONLINE) continue; =20 if ((ea->id.b24 & 0xff0000) =3D=3D (fcport->d_id.b24 & 0xff0000)) { @@ -1891,7 +1894,8 @@ void qla2x00_handle_rscn(scsi_qla_host_t case RSCN_FAB_ADDR: default: list_for_each_entry(fcport, &vha->vp_fcports, list) { - if (fcport->flags & FCF_FCP2_DEVICE) + if (fcport->flags & FCF_FCP2_DEVICE && + atomic_read(&fcport->state) =3D=3D FCS_ONLINE) continue; =20 fcport->scan_needed =3D 1; From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA8EDC00140 for ; Mon, 15 Aug 2022 19:47:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345119AbiHOTrT (ORCPT ); Mon, 15 Aug 2022 15:47:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344820AbiHOTo4 (ORCPT ); Mon, 15 Aug 2022 15:44: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 C7FAD6C77C; Mon, 15 Aug 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 07649B81085; Mon, 15 Aug 2022 18:48:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BF20C433D6; Mon, 15 Aug 2022 18:48:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589310; bh=za6LKnhUJdxSuV7U5K0XsjjVK4rZw9f/Aesz5mtYlSo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pplMujBReiJ/GsvOrHu+8ctGBQhBDkbAG3obKxsnImzYlsqz05QmtpYhESvzcp8iK yTuAKA1YBGpW7Lb4luHbbYrAXf+ZdtXcS38Uu/0gvZgKI5gwXeCN6gmYU4YY4vnpCh xUmriG/889kRAdsqXfJUx6/tZIvqEob64esDX+hQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arun Easi , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.15 679/779] scsi: qla2xxx: Fix losing target when it reappears during delete Date: Mon, 15 Aug 2022 20:05:23 +0200 Message-Id: <20220815180406.381381897@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Arun Easi commit 118b0c863c8f5629cc5271fc24d72d926e0715d9 upstream. FC target disappeared during port perturbation tests due to a race that tramples target state. Fix the issue by adding state checks before proceeding. Link: https://lore.kernel.org/r/20220616053508.27186-8-njavali@marvell.com Fixes: 44c57f205876 ("scsi: qla2xxx: Changes to support FCP2 Target") Cc: stable@vger.kernel.org Signed-off-by: Arun Easi Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_attr.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c @@ -2705,17 +2705,24 @@ qla2x00_dev_loss_tmo_callbk(struct fc_rp if (!fcport) return; =20 - /* Now that the rport has been deleted, set the fcport state to - FCS_DEVICE_DEAD */ - qla2x00_set_fcport_state(fcport, FCS_DEVICE_DEAD); + + /* + * Now that the rport has been deleted, set the fcport state to + * FCS_DEVICE_DEAD, if the fcport is still lost. + */ + if (fcport->scan_state !=3D QLA_FCPORT_FOUND) + qla2x00_set_fcport_state(fcport, FCS_DEVICE_DEAD); =20 /* * Transport has effectively 'deleted' the rport, clear * all local references. */ spin_lock_irqsave(host->host_lock, flags); - fcport->rport =3D fcport->drport =3D NULL; - *((fc_port_t **)rport->dd_data) =3D NULL; + /* Confirm port has not reappeared before clearing pointers. */ + if (rport->port_state !=3D FC_PORTSTATE_ONLINE) { + fcport->rport =3D fcport->drport =3D NULL; + *((fc_port_t **)rport->dd_data) =3D NULL; + } spin_unlock_irqrestore(host->host_lock, flags); =20 if (test_bit(ABORT_ISP_ACTIVE, &fcport->vha->dpc_flags)) @@ -2748,9 +2755,12 @@ qla2x00_terminate_rport_io(struct fc_rpo /* * At this point all fcport's software-states are cleared. Perform any * final cleanup of firmware resources (PCBs and XCBs). + * + * Attempt to cleanup only lost devices. */ if (fcport->loop_id !=3D FC_NO_LOOP_ID) { - if (IS_FWI2_CAPABLE(fcport->vha->hw)) { + if (IS_FWI2_CAPABLE(fcport->vha->hw) && + fcport->scan_state !=3D QLA_FCPORT_FOUND) { if (fcport->loop_id !=3D FC_NO_LOOP_ID) fcport->logout_on_delete =3D 1; =20 @@ -2760,7 +2770,7 @@ qla2x00_terminate_rport_io(struct fc_rpo __LINE__); qlt_schedule_sess_for_deletion(fcport); } - } else { + } else if (!IS_FWI2_CAPABLE(fcport->vha->hw)) { qla2x00_port_logout(fcport->vha, fcport); } } From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A06E4C00140 for ; Mon, 15 Aug 2022 19:47:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344364AbiHOTrY (ORCPT ); Mon, 15 Aug 2022 15:47:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344969AbiHOTp5 (ORCPT ); Mon, 15 Aug 2022 15:45:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA1836CF57; Mon, 15 Aug 2022 11:48: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 1D665B810A0; Mon, 15 Aug 2022 18:48:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E205C433D6; Mon, 15 Aug 2022 18:48:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589317; bh=ia/EirAuhmqDledGbC0qAjRWcjTyE94Ok4hT+4Tw2wA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ttzwB+tVphylWqlwELLplfZP9RxibkdH1bICUt9oACOExRVCKP3oq86VO3Kv0ou+f EIax51p/wSoclmLs2Mxbk//61gc+W7zq0wevU+liQ4sNMkI+lUd01NajnSkUrbw+uJ X/GctdatIYFAg9xc5kdYg/O3rdk/jgOIlEchWlBU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arun Easi , Nilesh Javali , "Martin K. Petersen" Subject: [PATCH 5.15 680/779] scsi: qla2xxx: Fix losing FCP-2 targets during port perturbation tests Date: Mon, 15 Aug 2022 20:05:24 +0200 Message-Id: <20220815180406.429462281@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Arun Easi commit 58d1c124cd79ea686b512043c5bd515590b2ed95 upstream. When a mix of FCP-2 (tape) and non-FCP-2 targets are present, FCP-2 target state was incorrectly transitioned when both of the targets were gone. Fix this by ignoring state transition for FCP-2 targets. Link: https://lore.kernel.org/r/20220616053508.27186-7-njavali@marvell.com Fixes: 44c57f205876 ("scsi: qla2xxx: Changes to support FCP2 Target") Cc: stable@vger.kernel.org Signed-off-by: Arun Easi Signed-off-by: Nilesh Javali Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/qla2xxx/qla_gs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/scsi/qla2xxx/qla_gs.c +++ b/drivers/scsi/qla2xxx/qla_gs.c @@ -3628,7 +3628,7 @@ login_logout: do_delete) { if (fcport->loop_id !=3D FC_NO_LOOP_ID) { if (fcport->flags & FCF_FCP2_DEVICE) - fcport->logout_on_delete =3D 0; + continue; =20 ql_log(ql_log_warn, vha, 0x20f0, "%s %d %8phC post del sess\n", From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D18A7C25B0E for ; Mon, 15 Aug 2022 19:47:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344728AbiHOTrc (ORCPT ); Mon, 15 Aug 2022 15:47:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345014AbiHOTqB (ORCPT ); Mon, 15 Aug 2022 15:46: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 6C2B96D54C; Mon, 15 Aug 2022 11:48: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 A1F09611DB; Mon, 15 Aug 2022 18:48:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B77CC433D6; Mon, 15 Aug 2022 18:48:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589321; bh=qtqnXj6pQ+/+Vwp2iNF9jsPKncWlXe0QUMxDlQHbSKw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cei7pfXz1edLybruNKsHplku+siojwatrR0w3BLSEGfng33LT0nnUAiLxGMOa3L1A CLcEPadyuns+b4YGNdQWuKCloAfHRAyV8Kxb5O2BzCk65HGceZF/FFLtOOfW6hg6ya bMdd9ZL7fwkNGUdhd9E9Pgie/n7RFrSDSE4bF5aw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kim Phillips , Borislav Petkov Subject: [PATCH 5.15 681/779] x86/bugs: Enable STIBP for IBPB mitigated RETBleed Date: Mon, 15 Aug 2022 20:05:25 +0200 Message-Id: <20220815180406.462224184@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kim Phillips commit e6cfcdda8cbe81eaf821c897369a65fec987b404 upstream. AMD's "Technical Guidance for Mitigating Branch Type Confusion, Rev. 1.0 2022-07-12" whitepaper, under section 6.1.2 "IBPB On Privileged Mode Entry / SMT Safety" says: Similar to the Jmp2Ret mitigation, if the code on the sibling thread cannot be trusted, software should set STIBP to 1 or disable SMT to ensure SMT safety when using this mitigation. So, like already being done for retbleed=3Dunret, and now also for retbleed=3Dibpb, force STIBP on machines that have it, and report its SMT vulnerability status accordingly. [ bp: Remove the "we" and remove "[AMD]" applicability parameter which doesn't work here. ] Fixes: 3ebc17006888 ("x86/bugs: Add retbleed=3Dibpb") Signed-off-by: Kim Phillips Signed-off-by: Borislav Petkov Cc: stable@vger.kernel.org # 5.10, 5.15, 5.19 Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D206537 Link: https://lore.kernel.org/r/20220804192201.439596-1-kim.phillips@amd.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- Documentation/admin-guide/kernel-parameters.txt | 29 +++++++++++++++++--= ----- arch/x86/kernel/cpu/bugs.c | 10 ++++---- 2 files changed, 27 insertions(+), 12 deletions(-) --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -4974,20 +4974,33 @@ Speculative Code Execution with Return Instructions) vulnerability. =20 + AMD-based UNRET and IBPB mitigations alone do not stop + sibling threads from influencing the predictions of other + sibling threads. For that reason, STIBP is used on pro- + cessors that support it, and mitigate SMT on processors + that don't. + off - no mitigation auto - automatically select a migitation auto,nosmt - automatically select a mitigation, disabling SMT if necessary for the full mitigation (only on Zen1 and older without STIBP). - ibpb - mitigate short speculation windows on - basic block boundaries too. Safe, highest - perf impact. - unret - force enable untrained return thunks, - only effective on AMD f15h-f17h - based systems. - unret,nosmt - like unret, will disable SMT when STIBP - is not available. + ibpb - On AMD, mitigate short speculation + windows on basic block boundaries too. + Safe, highest perf impact. It also + enables STIBP if present. Not suitable + on Intel. + ibpb,nosmt - Like "ibpb" above but will disable SMT + when STIBP is not available. This is + the alternative for systems which do not + have STIBP. + unret - Force enable untrained return thunks, + only effective on AMD f15h-f17h based + systems. + unret,nosmt - Like unret, but will disable SMT when STIBP + is not available. This is the alternative for + systems which do not have STIBP. =20 Selecting 'auto' will choose a mitigation method at run time according to the CPU. --- a/arch/x86/kernel/cpu/bugs.c +++ b/arch/x86/kernel/cpu/bugs.c @@ -152,7 +152,7 @@ void __init check_bugs(void) /* * spectre_v2_user_select_mitigation() relies on the state set by * retbleed_select_mitigation(); specifically the STIBP selection is - * forced for UNRET. + * forced for UNRET or IBPB. */ spectre_v2_user_select_mitigation(); ssb_select_mitigation(); @@ -1172,7 +1172,8 @@ spectre_v2_user_select_mitigation(void) boot_cpu_has(X86_FEATURE_AMD_STIBP_ALWAYS_ON)) mode =3D SPECTRE_V2_USER_STRICT_PREFERRED; =20 - if (retbleed_mitigation =3D=3D RETBLEED_MITIGATION_UNRET) { + if (retbleed_mitigation =3D=3D RETBLEED_MITIGATION_UNRET || + retbleed_mitigation =3D=3D RETBLEED_MITIGATION_IBPB) { if (mode !=3D SPECTRE_V2_USER_STRICT && mode !=3D SPECTRE_V2_USER_STRICT_PREFERRED) pr_info("Selecting STIBP always-on mode to complement retbleed mitigati= on\n"); @@ -2353,10 +2354,11 @@ static ssize_t srbds_show_state(char *bu =20 static ssize_t retbleed_show_state(char *buf) { - if (retbleed_mitigation =3D=3D RETBLEED_MITIGATION_UNRET) { + if (retbleed_mitigation =3D=3D RETBLEED_MITIGATION_UNRET || + retbleed_mitigation =3D=3D RETBLEED_MITIGATION_IBPB) { if (boot_cpu_data.x86_vendor !=3D X86_VENDOR_AMD && boot_cpu_data.x86_vendor !=3D X86_VENDOR_HYGON) - return sprintf(buf, "Vulnerable: untrained return thunk on non-Zen u= arch\n"); + return sprintf(buf, "Vulnerable: untrained return thunk / IBPB on no= n-AMD based uarch\n"); =20 return sprintf(buf, "%s; SMT %s\n", retbleed_strings[retbleed_mitigation], From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99378C00140 for ; Mon, 15 Aug 2022 19:47:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344847AbiHOTrk (ORCPT ); Mon, 15 Aug 2022 15:47:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345068AbiHOTqE (ORCPT ); Mon, 15 Aug 2022 15:46: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 919816D57B; Mon, 15 Aug 2022 11:48: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 B01A7611EC; Mon, 15 Aug 2022 18:48:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1056C433D6; Mon, 15 Aug 2022 18:48:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589324; bh=pA8ISevhUsGe/p5+9L1xkYfUhHfjRk8HP8uS3OlHxrU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E+jizzapPTJPYqrpNnXOFq1loE9ezlWZYKF+She4FnwUVJP4CGovP3uCVTN1eCkhz lzOLdKMfppEBw7yorsMKdyFa38/VtePtyxN3qcrdAFrAqcHQbTvO0rJDdLyEVLZfX1 d8xA+/eA0AeUBPGuN/0G3PwHgUin6uW2dC4IoPc4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "x86@kernel.org" , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Andrew Morton , "Steven Rostedt (Google)" Subject: [PATCH 5.15 682/779] ftrace/x86: Add back ftrace_expected assignment Date: Mon, 15 Aug 2022 20:05:26 +0200 Message-Id: <20220815180406.508928002@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Steven Rostedt (Google) commit ac6c1b2ca77e722a1e5d651f12f437f2f237e658 upstream. When a ftrace_bug happens (where ftrace fails to modify a location) it is helpful to have what was at that location as well as what was expected to be there. But with the conversion to text_poke() the variable that assigns the expected for debugging was dropped. Unfortunately, I noticed this when I needed it. Add it back. Link: https://lkml.kernel.org/r/20220726101851.069d2e70@gandalf.local.home Cc: "x86@kernel.org" Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: "H. Peter Anvin" Cc: Andrew Morton Cc: stable@vger.kernel.org Fixes: 768ae4406a5c ("x86/ftrace: Use text_poke()") Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/x86/kernel/ftrace.c | 1 + 1 file changed, 1 insertion(+) --- a/arch/x86/kernel/ftrace.c +++ b/arch/x86/kernel/ftrace.c @@ -93,6 +93,7 @@ static int ftrace_verify_code(unsigned l =20 /* Make sure it is what we expect it to be */ if (memcmp(cur_code, old_code, MCOUNT_INSN_SIZE) !=3D 0) { + ftrace_expected =3D old_code; WARN_ON(1); return -EINVAL; } From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E3E6C28B2C for ; Mon, 15 Aug 2022 19:47:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229488AbiHOTrh (ORCPT ); Mon, 15 Aug 2022 15:47:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345039AbiHOTqC (ORCPT ); Mon, 15 Aug 2022 15:46:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF3116D9E0; Mon, 15 Aug 2022 11:48: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 E1134611CA; Mon, 15 Aug 2022 18:48:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD66EC433D6; Mon, 15 Aug 2022 18:48:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589327; bh=k0u/vGeggDbZwt1WBxF9FGs6XocuAMYXyNIzJIgT5zg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MwkJ/MjsuIQXQQMoNXPBeYW5Gy/V/2cPWsyzAKTuqbqTVERVAs9H8qlFsBns19vVP VmbjDtgmFTHc5/gCij2oTNcXtrgvi0XCfoZrhmfL11hmPzuGIw0jPLyVYnIRN/6L2P RXFlsDcJCGrkYrt3VujVS9rvsygtvGkaM7iQoZmo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Daniel=20M=C3=BCller?= , "Masami Hiramatsu (Google)" , Ingo Molnar Subject: [PATCH 5.15 683/779] x86/kprobes: Update kcb status flag after singlestepping Date: Mon, 15 Aug 2022 20:05:27 +0200 Message-Id: <20220815180406.548277051@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Masami Hiramatsu (Google) commit dec8784c9088b131a1523f582c2194cfc8107dc0 upstream. Fix kprobes to update kcb (kprobes control block) status flag to KPROBE_HIT_SSDONE even if the kp->post_handler is not set. This bug may cause a kernel panic if another INT3 user runs right after kprobes because kprobe_int3_handler() misunderstands the INT3 is kprobe's single stepping INT3. Fixes: 6256e668b7af ("x86/kprobes: Use int3 instead of debug trap for singl= e-step") Reported-by: Daniel M=C3=BCller Signed-off-by: Masami Hiramatsu (Google) Signed-off-by: Ingo Molnar Tested-by: Daniel M=C3=BCller Cc: stable@vger.kernel.org Link: https://lore.kernel.org/all/20220727210136.jjgc3lpqeq42yr3m@muellerd-= fedora-PC2BDTX9 Link: https://lore.kernel.org/r/165942025658.342061.12452378391879093249.st= git@devnote2 Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/x86/kernel/kprobes/core.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) --- a/arch/x86/kernel/kprobes/core.c +++ b/arch/x86/kernel/kprobes/core.c @@ -816,16 +816,20 @@ NOKPROBE_SYMBOL(arch_prepare_kretprobe); static void kprobe_post_process(struct kprobe *cur, struct pt_regs *regs, struct kprobe_ctlblk *kcb) { - if ((kcb->kprobe_status !=3D KPROBE_REENTER) && cur->post_handler) { - kcb->kprobe_status =3D KPROBE_HIT_SSDONE; - cur->post_handler(cur, regs, 0); - } - /* Restore back the original saved kprobes variables and continue. */ - if (kcb->kprobe_status =3D=3D KPROBE_REENTER) + if (kcb->kprobe_status =3D=3D KPROBE_REENTER) { + /* This will restore both kcb and current_kprobe */ restore_previous_kprobe(kcb); - else + } else { + /* + * Always update the kcb status because + * reset_curent_kprobe() doesn't update kcb. + */ + kcb->kprobe_status =3D KPROBE_HIT_SSDONE; + if (cur->post_handler) + cur->post_handler(cur, regs, 0); reset_current_kprobe(); + } } NOKPROBE_SYMBOL(kprobe_post_process); =20 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EEF1FC00140 for ; Mon, 15 Aug 2022 19:47:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344888AbiHOTrw (ORCPT ); Mon, 15 Aug 2022 15:47:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345209AbiHOTqN (ORCPT ); Mon, 15 Aug 2022 15:46:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D4766E2D8; Mon, 15 Aug 2022 11:48: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 C2ADBB81057; Mon, 15 Aug 2022 18:48:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02CFBC433C1; Mon, 15 Aug 2022 18:48:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589330; bh=StjgcR6nA87Jhlh+ZwYMvS8/tCMtuZEn7F+G7iUqQg8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T5cf+3qHvAyR8uS9j8xu4yMluUBDcpiV7MkkH8YMW7w7EIP6xXg3VBi8+dPHLPsxa 3dA0tcv5g1CjFgHIGh4qSj9sINVPA5l04KQicl7xTbDBaYWV+waX8Ma16fIV065dFw kGZDiSqmpKfme4wpFC0HXwBobzZb9bytrG/P4OD0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guenter Roeck , kernel test robot , Alexander Lobakin , Yury Norov Subject: [PATCH 5.15 684/779] x86/olpc: fix logical not is only applied to the left hand side Date: Mon, 15 Aug 2022 20:05:28 +0200 Message-Id: <20220815180406.602991701@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Lobakin commit 3a2ba42cbd0b669ce3837ba400905f93dd06c79f upstream. The bitops compile-time optimization series revealed one more problem in olpc-xo1-sci.c:send_ebook_state(), resulted in GCC warnings: arch/x86/platform/olpc/olpc-xo1-sci.c: In function 'send_ebook_state': arch/x86/platform/olpc/olpc-xo1-sci.c:83:63: warning: logical not is only a= pplied to the left hand side of comparison [-Wlogical-not-parentheses] 83 | if (!!test_bit(SW_TABLET_MODE, ebook_switch_idev->sw) =3D= =3D state) | ^~ arch/x86/platform/olpc/olpc-xo1-sci.c:83:13: note: add parentheses around l= eft hand side expression to silence this warning Despite this code working as intended, this redundant double negation of boolean value, together with comparing to `char` with no explicit conversion to bool, makes compilers think the author made some unintentional logical mistakes here. Make it the other way around and negate the char instead to silence the warnings. Fixes: d2aa37411b8e ("x86/olpc/xo1/sci: Produce wakeup events for buttons a= nd switches") Cc: stable@vger.kernel.org # 3.5+ Reported-by: Guenter Roeck Reported-by: kernel test robot Reviewed-and-tested-by: Guenter Roeck Signed-off-by: Alexander Lobakin Signed-off-by: Yury Norov Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/x86/platform/olpc/olpc-xo1-sci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/x86/platform/olpc/olpc-xo1-sci.c +++ b/arch/x86/platform/olpc/olpc-xo1-sci.c @@ -80,7 +80,7 @@ static void send_ebook_state(void) return; } =20 - if (!!test_bit(SW_TABLET_MODE, ebook_switch_idev->sw) =3D=3D state) + if (test_bit(SW_TABLET_MODE, ebook_switch_idev->sw) =3D=3D !!state) return; /* Nothing new to report. */ =20 input_report_switch(ebook_switch_idev, SW_TABLET_MODE, state); From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D1DFC00140 for ; Mon, 15 Aug 2022 19:48:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344936AbiHOTr6 (ORCPT ); Mon, 15 Aug 2022 15:47:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345260AbiHOTqS (ORCPT ); Mon, 15 Aug 2022 15:46: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 3AF846DFB5; Mon, 15 Aug 2022 11:48: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 2237761124; Mon, 15 Aug 2022 18:48:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2863DC433D7; Mon, 15 Aug 2022 18:48:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589333; bh=qQSA96vhbW3gjTNJAjGIG1SqfEp/08zASt479+5WVtE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O4K0m2FA/tqLJ0TY30BDzHs+CG3Pe6uqytR8u4RqsueuGOZVvF9HiOJjdyw4GKGSH zG9ZyH+Z/Z7WefWtJTLl13KDXU6qN8MiftUb8VZFDeaFaXvL3wxGr55dxSFnUn4yuh P2P76eWpwPChAovOhROs2inc+drLKUwyBY/G6c6w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Bharath SM , Steve French Subject: [PATCH 5.15 685/779] SMB3: fix lease break timeout when multiple deferred close handles for the same file. Date: Mon, 15 Aug 2022 20:05:29 +0200 Message-Id: <20220815180406.645771646@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bharath SM commit 9e31678fb403eae0f4fe37c6374be098835c73cd upstream. Solution is to send lease break ack immediately even in case of deferred close handles to avoid lease break request timing out and let deferred closed handle gets closed as scheduled. Later patches could optimize cases where we then close some of these handles sooner for the cases where lease break is to 'none' Cc: stable@kernel.org Signed-off-by: Bharath SM Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/cifs/file.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -4855,8 +4855,6 @@ void cifs_oplock_break(struct work_struc struct TCP_Server_Info *server =3D tcon->ses->server; int rc =3D 0; bool purge_cache =3D false; - bool is_deferred =3D false; - struct cifs_deferred_close *dclose; =20 wait_on_bit(&cinode->flags, CIFS_INODE_PENDING_WRITERS, TASK_UNINTERRUPTIBLE); @@ -4893,22 +4891,6 @@ void cifs_oplock_break(struct work_struc =20 oplock_break_ack: /* - * When oplock break is received and there are no active - * file handles but cached, then schedule deferred close immediately. - * So, new open will not use cached handle. - */ - spin_lock(&CIFS_I(inode)->deferred_lock); - is_deferred =3D cifs_is_deferred_close(cfile, &dclose); - spin_unlock(&CIFS_I(inode)->deferred_lock); - if (is_deferred && - cfile->deferred_close_scheduled && - delayed_work_pending(&cfile->deferred)) { - if (cancel_delayed_work(&cfile->deferred)) { - _cifsFileInfo_put(cfile, false, false); - goto oplock_break_done; - } - } - /* * releasing stale oplock after recent reconnect of smb session using * a now incorrect file handle is not a data integrity issue but do * not bother sending an oplock release if session to server still is @@ -4919,7 +4901,7 @@ oplock_break_ack: cinode); cifs_dbg(FYI, "Oplock release rc =3D %d\n", rc); } -oplock_break_done: + _cifsFileInfo_put(cfile, false /* do not wait for ourself */, false); cifs_done_oplock_break(cinode); } From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2AB37C00140 for ; Mon, 15 Aug 2022 19:48:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344970AbiHOTsD (ORCPT ); Mon, 15 Aug 2022 15:48:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345283AbiHOTqU (ORCPT ); Mon, 15 Aug 2022 15:46: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 4D7DF41D3A; Mon, 15 Aug 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 dfw.source.kernel.org (Postfix) with ESMTPS id 1F49C61200; Mon, 15 Aug 2022 18:48:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C5E0C433C1; Mon, 15 Aug 2022 18:48:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589336; bh=DBfHBJGjSyEq4AwZ7wV8PcjiXMuzz6rmByLGNk29E94=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vd+tfKvQWXHDIZ2+43bTjsNVpQL23WlE4llD4rWD1bphiwWa9yPDCl8Zu+ZsE1OlN XkVP8ZNxt2rlgAQRvjQ7b4jB3FO4UBfJoamZQ9307xzSAKz1t0avUUYEeGbfxgRWDM i1C8Td3gODdOO90HR+rS/XP2RJQdyzex4StgsLX4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thadeu Lima de Souza Cascardo , Thomas Gleixner Subject: [PATCH 5.15 686/779] posix-cpu-timers: Cleanup CPU timers before freeing them during exec Date: Mon, 15 Aug 2022 20:05:30 +0200 Message-Id: <20220815180406.680022485@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Thadeu Lima de Souza Cascardo commit e362359ace6f87c201531872486ff295df306d13 upstream. Commit 55e8c8eb2c7b ("posix-cpu-timers: Store a reference to a pid not a task") started looking up tasks by PID when deleting a CPU timer. When a non-leader thread calls execve, it will switch PIDs with the leader process. Then, as it calls exit_itimers, posix_cpu_timer_del cannot find the task because the timer still points out to the old PID. That means that armed timers won't be disarmed, that is, they won't be removed from the timerqueue_list. exit_itimers will still release their memory, and when that list is later processed, it leads to a use-after-free. Clean up the timers from the de-threaded task before freeing them. This prevents a reported use-after-free. Fixes: 55e8c8eb2c7b ("posix-cpu-timers: Store a reference to a pid not a ta= sk") Signed-off-by: Thadeu Lima de Souza Cascardo Signed-off-by: Thomas Gleixner Reviewed-by: Thomas Gleixner Cc: Link: https://lore.kernel.org/r/20220809170751.164716-1-cascardo@canonical.= com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/exec.c | 3 +++ 1 file changed, 3 insertions(+) --- a/fs/exec.c +++ b/fs/exec.c @@ -1298,6 +1298,9 @@ int begin_new_exec(struct linux_binprm * bprm->mm =3D NULL; =20 #ifdef CONFIG_POSIX_TIMERS + spin_lock_irq(&me->sighand->siglock); + posix_cpu_timers_exit(me); + spin_unlock_irq(&me->sighand->siglock); exit_itimers(me); flush_itimer_signals(); #endif From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C555C00140 for ; Mon, 15 Aug 2022 19:48:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345001AbiHOTsH (ORCPT ); Mon, 15 Aug 2022 15:48:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345308AbiHOTqX (ORCPT ); Mon, 15 Aug 2022 15:46: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 3E1296E2EB; Mon, 15 Aug 2022 11:49: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 34A6E60FB8; Mon, 15 Aug 2022 18:49:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F51CC433D6; Mon, 15 Aug 2022 18:48:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589339; bh=cdnhM6keGBCbekNFSqz0/UM3k8voCBSTZYS+WXXc1WE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GIBRNcikMgrgfZ7qgb74E4aXCRXlCGiu3aBT92uFqpXHtnOg1X3Ws4V08NChk8uzF 45/F/AU9B4V9M8shLugi5akc4q43ZVlohac9OBYfqemlCFdfKNxiapEk+dNgd4fbkr QW2jJGQOg1mayfTLIPp4ghQ+js8PdxgwES1LGqy4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hacash Robot , Xie Shaowen , Helge Deller Subject: [PATCH 5.15 687/779] Input: gscps2 - check return value of ioremap() in gscps2_probe() Date: Mon, 15 Aug 2022 20:05:31 +0200 Message-Id: <20220815180406.712047894@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Shaowen commit e61b3125a4f036b3c6b87ffd656fc1ab00440ae9 upstream. The function ioremap() in gscps2_probe() can fail, so its return value should be checked. Fixes: 4bdc0d676a643 ("remove ioremap_nocache and devm_ioremap_nocache") Cc: # v5.6+ Reported-by: Hacash Robot Signed-off-by: Xie Shaowen Signed-off-by: Helge Deller Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/input/serio/gscps2.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/input/serio/gscps2.c +++ b/drivers/input/serio/gscps2.c @@ -350,6 +350,10 @@ static int __init gscps2_probe(struct pa ps2port->port =3D serio; ps2port->padev =3D dev; ps2port->addr =3D ioremap(hpa, GSC_STATUS + 4); + if (!ps2port->addr) { + ret =3D -ENOMEM; + goto fail_nomem; + } spin_lock_init(&ps2port->lock); =20 gscps2_reset(ps2port); From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A088AC00140 for ; Mon, 15 Aug 2022 19:48:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345021AbiHOTsM (ORCPT ); Mon, 15 Aug 2022 15:48:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345333AbiHOTq0 (ORCPT ); Mon, 15 Aug 2022 15:46: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 A35436CF62; Mon, 15 Aug 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 9049161154; Mon, 15 Aug 2022 18:49:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48340C433D7; Mon, 15 Aug 2022 18:49:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589343; bh=U9HD4eLoKwLkfAjESfyRq2IJZfDXUJqsumUKnIQZxmw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wZMngG0172joGa6Mht0RSIz+DabqCLjZVsJZ3/wyP3XhbbGJ4a1knVsfVuVjUhfbG W6OnwO206oM4dh9Gxl02D5qMojEZ27aCPeSmbnS/T11eEszIpL4rZx21CKBfzqyMnu 87lq8HBaxfg1YEpiNmr38e+D6/f4n/qsCBjhAeQo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Al Viro Subject: [PATCH 5.15 688/779] __follow_mount_rcu(): verify that mount_lock remains unchanged Date: Mon, 15 Aug 2022 20:05:32 +0200 Message-Id: <20220815180406.758484405@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Al Viro commit 20aac6c60981f5bfacd66661d090d907bf1482f0 upstream. Validate mount_lock seqcount as soon as we cross into mount in RCU mode. Sure, ->mnt_root is pinned and will remain so until we do rcu_read_unlock() anyway, and we will eventually fail to unlazy if the mount_lock had been touched, but we might run into a hard error (e.g. -ENOENT) before trying to unlazy. And it's possible to end up with RCU pathwalk racing with rename() and umount() in a way that would fail with -ENOENT while non-RCU pathwalk would've succeeded with any timings. Once upon a time we hadn't needed that, but analysis had been subtle, brittle and went out of window as soon as RENAME_EXCHANGE had been added. It's narrow, hard to hit and won't get you anything other than stray -ENOENT that could be arranged in much easier way with the same priveleges, but it's a bug all the same. Cc: stable@kernel.org X-sky-is-falling: unlikely Fixes: da1ce0670c14 "vfs: add cross-rename" Signed-off-by: Al Viro Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/namei.c | 2 ++ 1 file changed, 2 insertions(+) --- a/fs/namei.c +++ b/fs/namei.c @@ -1461,6 +1461,8 @@ static bool __follow_mount_rcu(struct na * becoming unpinned. */ flags =3D dentry->d_flags; + if (read_seqretry(&mount_lock, nd->m_seq)) + return false; continue; } if (read_seqretry(&mount_lock, nd->m_seq)) From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF383C00140 for ; Mon, 15 Aug 2022 19:48:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345060AbiHOTsR (ORCPT ); Mon, 15 Aug 2022 15:48:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345332AbiHOTq0 (ORCPT ); Mon, 15 Aug 2022 15:46: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 C728B422D2; Mon, 15 Aug 2022 11:49: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 9E3E561212; Mon, 15 Aug 2022 18:49:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7433FC433C1; Mon, 15 Aug 2022 18:49:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589346; bh=SmZYZEpOelWUIJG7oTgTHs2s9xh0YRCxcCr5ctiy6do=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lPuHR647pZbbV2+b4zDUC3+G9wIO8XeY6cYGhml+tJEAbUmLm9qGQ93MzMH7YgtGQ U3jI2loBwPFRVIE7M661TDX8IFHtXtChjqp3q8Ds8ZxONh+0IMCPLW/6Rru1wj03rs WlpvWW0GRBH/YsePF0aHTxug0nTr7eE0jIWOTyyU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephen Boyd , "Steven Rostedt (Google)" , David Collins Subject: [PATCH 5.15 689/779] spmi: trace: fix stack-out-of-bound access in SPMI tracing functions Date: Mon, 15 Aug 2022 20:05:33 +0200 Message-Id: <20220815180406.793849752@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Collins commit 2af28b241eea816e6f7668d1954f15894b45d7e3 upstream. trace_spmi_write_begin() and trace_spmi_read_end() both call memcpy() with a length of "len + 1". This leads to one extra byte being read beyond the end of the specified buffer. Fix this out-of-bound memory access by using a length of "len" instead. Here is a KASAN log showing the issue: BUG: KASAN: stack-out-of-bounds in trace_event_raw_event_spmi_read_end+0x1d= 0/0x234 Read of size 2 at addr ffffffc0265b7540 by task thermal@2.0-ser/1314 ... Call trace: dump_backtrace+0x0/0x3e8 show_stack+0x2c/0x3c dump_stack_lvl+0xdc/0x11c print_address_description+0x74/0x384 kasan_report+0x188/0x268 kasan_check_range+0x270/0x2b0 memcpy+0x90/0xe8 trace_event_raw_event_spmi_read_end+0x1d0/0x234 spmi_read_cmd+0x294/0x3ac spmi_ext_register_readl+0x84/0x9c regmap_spmi_ext_read+0x144/0x1b0 [regmap_spmi] _regmap_raw_read+0x40c/0x754 regmap_raw_read+0x3a0/0x514 regmap_bulk_read+0x418/0x494 adc5_gen3_poll_wait_hs+0xe8/0x1e0 [qcom_spmi_adc5_gen3] ... __arm64_sys_read+0x4c/0x60 invoke_syscall+0x80/0x218 el0_svc_common+0xec/0x1c8 ... addr ffffffc0265b7540 is located in stack of task thermal@2.0-ser/1314 at o= ffset 32 in frame: adc5_gen3_poll_wait_hs+0x0/0x1e0 [qcom_spmi_adc5_gen3] this frame has 1 object: [32, 33) 'status' Memory state around the buggy address: ffffffc0265b7400: 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 ffffffc0265b7480: 04 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00 >ffffffc0265b7500: 00 00 00 00 f1 f1 f1 f1 01 f3 f3 f3 00 00 00 00 ^ ffffffc0265b7580: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ffffffc0265b7600: f1 f1 f1 f1 01 f2 07 f2 f2 f2 01 f3 00 00 00 00 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Fixes: a9fce374815d ("spmi: add command tracepoints for SPMI") Cc: stable@vger.kernel.org Reviewed-by: Stephen Boyd Acked-by: Steven Rostedt (Google) Signed-off-by: David Collins Link: https://lore.kernel.org/r/20220627235512.2272783-1-quic_collinsd@quic= inc.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- include/trace/events/spmi.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- a/include/trace/events/spmi.h +++ b/include/trace/events/spmi.h @@ -21,15 +21,15 @@ TRACE_EVENT(spmi_write_begin, __field ( u8, sid ) __field ( u16, addr ) __field ( u8, len ) - __dynamic_array ( u8, buf, len + 1 ) + __dynamic_array ( u8, buf, len ) ), =20 TP_fast_assign( __entry->opcode =3D opcode; __entry->sid =3D sid; __entry->addr =3D addr; - __entry->len =3D len + 1; - memcpy(__get_dynamic_array(buf), buf, len + 1); + __entry->len =3D len; + memcpy(__get_dynamic_array(buf), buf, len); ), =20 TP_printk("opc=3D%d sid=3D%02d addr=3D0x%04x len=3D%d buf=3D0x[%*phD]", @@ -92,7 +92,7 @@ TRACE_EVENT(spmi_read_end, __field ( u16, addr ) __field ( int, ret ) __field ( u8, len ) - __dynamic_array ( u8, buf, len + 1 ) + __dynamic_array ( u8, buf, len ) ), =20 TP_fast_assign( @@ -100,8 +100,8 @@ TRACE_EVENT(spmi_read_end, __entry->sid =3D sid; __entry->addr =3D addr; __entry->ret =3D ret; - __entry->len =3D len + 1; - memcpy(__get_dynamic_array(buf), buf, len + 1); + __entry->len =3D len; + memcpy(__get_dynamic_array(buf), buf, len); ), =20 TP_printk("opc=3D%d sid=3D%02d addr=3D0x%04x ret=3D%d len=3D%02d buf=3D0x= [%*phD]", From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87E73C00140 for ; Mon, 15 Aug 2022 19:48:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345116AbiHOTsf (ORCPT ); Mon, 15 Aug 2022 15:48:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345405AbiHOTqq (ORCPT ); Mon, 15 Aug 2022 15:46:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB15C6EF1B; Mon, 15 Aug 2022 11:49: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 DA95A60FB8; Mon, 15 Aug 2022 18:49:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C87B8C433D6; Mon, 15 Aug 2022 18:49:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589352; bh=Uwev548IYElSeCQTYrImO0QWItBgX9fBfs9V/XNmhns=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yQtDxplajPUQomnqCtSGYniy3leZv+AocpZdatntfHjuR+IMgDR8DyZfs52tLrX44 t4i6h2PkUFzacdPx2d6KmNA3i0lvJ9WQJQKIe4Ke8INHMBN/0xHJcQ3PSoqEtsmJeV 25Qznnvi+Hk+mPNJmk6+XWi+s6/9efA9PTfmw9M4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Julien STEPHAN , Mattijs Korpershoek , AngeloGioacchino Del Regno , Chun-Kuang Hu , Sasha Levin Subject: [PATCH 5.15 690/779] drm/mediatek: Allow commands to be sent during video mode Date: Mon, 15 Aug 2022 20:05:34 +0200 Message-Id: <20220815180406.830645325@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Julien STEPHAN [ Upstream commit 81cc7e51c4f1686b71e30046437056ece6b2cb4d ] Mipi dsi panel drivers can use mipi_dsi_dcs_{set,get}_display_brightness() to request backlight changes. This can be done during panel initialization (dsi is in command mode) or afterwards (dsi is in Video Mode). When the DSI is in Video Mode, all commands are rejected. Detect current DSI mode in mtk_dsi_host_transfer() and switch modes temporarily to allow commands to be sent. Signed-off-by: Julien STEPHAN Signed-off-by: Mattijs Korpershoek Reviewed-by: AngeloGioacchino Del Regno Signed-off-by: Chun-Kuang Hu Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/mediatek/mtk_dsi.c | 33 ++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/= mtk_dsi.c index b0cb0ba53589..ab51656d5dae 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -910,24 +910,33 @@ static ssize_t mtk_dsi_host_transfer(struct mipi_dsi_= host *host, u8 read_data[16]; void *src_addr; u8 irq_flag =3D CMD_DONE_INT_FLAG; + u32 dsi_mode; + int ret; =20 - if (readl(dsi->regs + DSI_MODE_CTRL) & MODE) { - DRM_ERROR("dsi engine is not command mode\n"); - return -EINVAL; + dsi_mode =3D readl(dsi->regs + DSI_MODE_CTRL); + if (dsi_mode & MODE) { + mtk_dsi_stop(dsi); + ret =3D mtk_dsi_switch_to_cmd_mode(dsi, VM_DONE_INT_FLAG, 500); + if (ret) + goto restore_dsi_mode; } =20 if (MTK_DSI_HOST_IS_READ(msg->type)) irq_flag |=3D LPRX_RD_RDY_INT_FLAG; =20 - if (mtk_dsi_host_send_cmd(dsi, msg, irq_flag) < 0) - return -ETIME; + ret =3D mtk_dsi_host_send_cmd(dsi, msg, irq_flag); + if (ret) + goto restore_dsi_mode; =20 - if (!MTK_DSI_HOST_IS_READ(msg->type)) - return 0; + if (!MTK_DSI_HOST_IS_READ(msg->type)) { + recv_cnt =3D 0; + goto restore_dsi_mode; + } =20 if (!msg->rx_buf) { DRM_ERROR("dsi receive buffer size may be NULL\n"); - return -EINVAL; + ret =3D -EINVAL; + goto restore_dsi_mode; } =20 for (i =3D 0; i < 16; i++) @@ -952,7 +961,13 @@ static ssize_t mtk_dsi_host_transfer(struct mipi_dsi_h= ost *host, DRM_INFO("dsi get %d byte data from the panel address(0x%x)\n", recv_cnt, *((u8 *)(msg->tx_buf))); =20 - return recv_cnt; +restore_dsi_mode: + if (dsi_mode & MODE) { + mtk_dsi_set_mode(dsi); + mtk_dsi_start(dsi); + } + + return ret < 0 ? ret : recv_cnt; } =20 static const struct mipi_dsi_host_ops mtk_dsi_ops =3D { --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEFEDC00140 for ; Mon, 15 Aug 2022 19:48:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345179AbiHOTsp (ORCPT ); Mon, 15 Aug 2022 15:48:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345435AbiHOTqu (ORCPT ); Mon, 15 Aug 2022 15:46:50 -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 39AE26F561; Mon, 15 Aug 2022 11:49: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 8FA3AB810A1; Mon, 15 Aug 2022 18:49:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D621AC433D6; Mon, 15 Aug 2022 18:49:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589355; bh=aoTL0j8aoAOsgFnokFVnd7h3V6pYNwdWdig+Ob+6Xm8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JY0ekJxh5GgTWtJLKEIr6w54VgXppox3g9hNSAJAZ+v/bdl2/nok0/fvmrmhe9te5 5Y2Lv6j5/BhfyXQLtBEAh7AWiA//qAso0YZ9zPILGSb/5Qo2Mvt/+8h/ADxMEr/+oI bxUGFConD3LVPyPfwTkBJ0N/Jgvl7Y+eo9VMBn/Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jitao Shi , Xinlei Lee , AngeloGioacchino Del Regno , Rex-BC Chen , Chun-Kuang Hu , Sasha Levin Subject: [PATCH 5.15 691/779] drm/mediatek: Keep dsi as LP00 before dcs cmds transfer Date: Mon, 15 Aug 2022 20:05:35 +0200 Message-Id: <20220815180406.870421931@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jitao Shi [ Upstream commit 39e8d062b03c3dc257d880d82bd55cdd9e185a3b ] To comply with the panel sequence, hold the mipi signal to LP00 before the dcs cmds transmission, and pull the mipi signal high from LP00 to LP11 until the start of the dcs cmds transmission. The normal panel timing is : (1) pp1800 DC pull up (2) avdd & avee AC pull high (3) lcm_reset pull high -> pull low -> pull high (4) Pull MIPI signal high (LP11) -> initial code -> send video data (HS mode) The power-off sequence is reversed. If dsi is not in cmd mode, then dsi will pull the mipi signal high in the mtk_output_dsi_enable function. The delay in lane_ready func is the reaction time of dsi_rx after pulling up the mipi signal. Fixes: 2dd8075d2185 ("drm/mediatek: mtk_dsi: Use the drm_panel_bridge API") Link: https://patchwork.kernel.org/project/linux-mediatek/patch/1653012007-= 11854-4-git-send-email-xinlei.lee@mediatek.com/ Cc: # 5.10.x: 7f6335c6a258: drm/mediatek: Modify d= si funcs to atomic operations Cc: # 5.10.x: cde7e2e35c28: drm/mediatek: Separate= poweron/poweroff from enable/disable and define new funcs Cc: # 5.10.x Signed-off-by: Jitao Shi Signed-off-by: Xinlei Lee Reviewed-by: AngeloGioacchino Del Regno Reviewed-by: Rex-BC Chen Signed-off-by: Chun-Kuang Hu Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/mediatek/mtk_dsi.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/= mtk_dsi.c index ab51656d5dae..ac14e598a14f 100644 --- a/drivers/gpu/drm/mediatek/mtk_dsi.c +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c @@ -203,6 +203,7 @@ struct mtk_dsi { struct mtk_phy_timing phy_timing; int refcount; bool enabled; + bool lanes_ready; u32 irq_data; wait_queue_head_t irq_wait_queue; const struct mtk_dsi_driver_data *driver_data; @@ -649,18 +650,11 @@ static int mtk_dsi_poweron(struct mtk_dsi *dsi) mtk_dsi_reset_engine(dsi); mtk_dsi_phy_timconfig(dsi); =20 - mtk_dsi_rxtx_control(dsi); - usleep_range(30, 100); - mtk_dsi_reset_dphy(dsi); mtk_dsi_ps_control_vact(dsi); mtk_dsi_set_vm_cmd(dsi); mtk_dsi_config_vdo_timing(dsi); mtk_dsi_set_interrupt_enable(dsi); =20 - mtk_dsi_clk_ulp_mode_leave(dsi); - mtk_dsi_lane0_ulp_mode_leave(dsi); - mtk_dsi_clk_hs_mode(dsi, 0); - return 0; err_disable_engine_clk: clk_disable_unprepare(dsi->engine_clk); @@ -691,6 +685,23 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi) clk_disable_unprepare(dsi->digital_clk); =20 phy_power_off(dsi->phy); + + dsi->lanes_ready =3D false; +} + +static void mtk_dsi_lane_ready(struct mtk_dsi *dsi) +{ + if (!dsi->lanes_ready) { + dsi->lanes_ready =3D true; + mtk_dsi_rxtx_control(dsi); + usleep_range(30, 100); + mtk_dsi_reset_dphy(dsi); + mtk_dsi_clk_ulp_mode_leave(dsi); + mtk_dsi_lane0_ulp_mode_leave(dsi); + mtk_dsi_clk_hs_mode(dsi, 0); + msleep(20); + /* The reaction time after pulling up the mipi signal for dsi_rx */ + } } =20 static void mtk_output_dsi_enable(struct mtk_dsi *dsi) @@ -698,6 +709,7 @@ static void mtk_output_dsi_enable(struct mtk_dsi *dsi) if (dsi->enabled) return; =20 + mtk_dsi_lane_ready(dsi); mtk_dsi_set_mode(dsi); mtk_dsi_clk_hs_mode(dsi, 1); =20 @@ -924,6 +936,8 @@ static ssize_t mtk_dsi_host_transfer(struct mipi_dsi_ho= st *host, if (MTK_DSI_HOST_IS_READ(msg->type)) irq_flag |=3D LPRX_RD_RDY_INT_FLAG; =20 + mtk_dsi_lane_ready(dsi); + ret =3D mtk_dsi_host_send_cmd(dsi, msg, irq_flag); if (ret) goto restore_dsi_mode; --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E0ACC00140 for ; Mon, 15 Aug 2022 19:48:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345198AbiHOTsv (ORCPT ); Mon, 15 Aug 2022 15:48:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345470AbiHOTqz (ORCPT ); Mon, 15 Aug 2022 15:46: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 4F6976FA17; Mon, 15 Aug 2022 11:49: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 F3D45B810A7; Mon, 15 Aug 2022 18:49:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2E0BC433D6; Mon, 15 Aug 2022 18:49:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589358; bh=bX/Tf3yaovk3K546KE/qsFRRx4HoRLDk0G14XLPO7iI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iGiHSKMvHuY926jLMrjrZxpRUwCZ+HTkDp5I5Hr0exHtf8vpc2vrsRRWq79EoTY/v e+jMV07wHvgqLq3BeMTvsIT5BZXEXCHqI4fDBSvVr43PtRHEzVT6RfnQd0gID0i8Hb S0gIaChUhjVGLo5C3b37g76Gaeowt+Do91UH5WeI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, gaochao , Eric Biggers , Ard Biesheuvel , "Jason A. Donenfeld" , Herbert Xu , Sasha Levin Subject: [PATCH 5.15 692/779] crypto: blake2s - remove shash module Date: Mon, 15 Aug 2022 20:05:36 +0200 Message-Id: <20220815180406.912004458@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 2d16803c562ecc644803d42ba98a8e0aef9c014e ] BLAKE2s has no currently known use as an shash. Just remove all of this unnecessary plumbing. Removing this shash was something we talked about back when we were making BLAKE2s a built-in, but I simply never got around to doing it. So this completes that project. Importantly, this fixs a bug in which the lib code depends on crypto_simd_disabled_for_test, causing linker errors. Also add more alignment tests to the selftests and compare SIMD and non-SIMD compression functions, to make up for what we lose from testmgr.c. Reported-by: gaochao Cc: Eric Biggers Cc: Ard Biesheuvel Cc: stable@vger.kernel.org Fixes: 6048fdcc5f26 ("lib/crypto: blake2s: include as built-in") Signed-off-by: Jason A. Donenfeld Signed-off-by: Herbert Xu Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm/crypto/Kconfig | 2 +- arch/arm/crypto/Makefile | 4 +- arch/arm/crypto/blake2s-shash.c | 75 ----------- arch/x86/crypto/Makefile | 4 +- arch/x86/crypto/blake2s-glue.c | 3 +- arch/x86/crypto/blake2s-shash.c | 77 ----------- crypto/Kconfig | 20 +-- crypto/Makefile | 1 - crypto/blake2s_generic.c | 75 ----------- crypto/tcrypt.c | 12 -- crypto/testmgr.c | 24 ---- crypto/testmgr.h | 217 ------------------------------ include/crypto/internal/blake2s.h | 108 --------------- lib/crypto/blake2s-selftest.c | 41 ++++++ lib/crypto/blake2s.c | 37 ++++- 15 files changed, 76 insertions(+), 624 deletions(-) delete mode 100644 arch/arm/crypto/blake2s-shash.c delete mode 100644 arch/x86/crypto/blake2s-shash.c delete mode 100644 crypto/blake2s_generic.c diff --git a/arch/arm/crypto/Kconfig b/arch/arm/crypto/Kconfig index e4dba5461cb3..149a5bd6b88c 100644 --- a/arch/arm/crypto/Kconfig +++ b/arch/arm/crypto/Kconfig @@ -63,7 +63,7 @@ config CRYPTO_SHA512_ARM using optimized ARM assembler and NEON, when available. =20 config CRYPTO_BLAKE2S_ARM - tristate "BLAKE2s digest algorithm (ARM)" + bool "BLAKE2s digest algorithm (ARM)" select CRYPTO_ARCH_HAVE_LIB_BLAKE2S help BLAKE2s digest algorithm optimized with ARM scalar instructions. This diff --git a/arch/arm/crypto/Makefile b/arch/arm/crypto/Makefile index 0274f81cc8ea..971e74546fb1 100644 --- a/arch/arm/crypto/Makefile +++ b/arch/arm/crypto/Makefile @@ -9,8 +9,7 @@ obj-$(CONFIG_CRYPTO_SHA1_ARM) +=3D sha1-arm.o obj-$(CONFIG_CRYPTO_SHA1_ARM_NEON) +=3D sha1-arm-neon.o obj-$(CONFIG_CRYPTO_SHA256_ARM) +=3D sha256-arm.o obj-$(CONFIG_CRYPTO_SHA512_ARM) +=3D sha512-arm.o -obj-$(CONFIG_CRYPTO_BLAKE2S_ARM) +=3D blake2s-arm.o -obj-$(if $(CONFIG_CRYPTO_BLAKE2S_ARM),y) +=3D libblake2s-arm.o +obj-$(CONFIG_CRYPTO_BLAKE2S_ARM) +=3D libblake2s-arm.o obj-$(CONFIG_CRYPTO_BLAKE2B_NEON) +=3D blake2b-neon.o obj-$(CONFIG_CRYPTO_CHACHA20_NEON) +=3D chacha-neon.o obj-$(CONFIG_CRYPTO_POLY1305_ARM) +=3D poly1305-arm.o @@ -32,7 +31,6 @@ sha256-arm-neon-$(CONFIG_KERNEL_MODE_NEON) :=3D sha256_ne= on_glue.o sha256-arm-y :=3D sha256-core.o sha256_glue.o $(sha256-arm-neon-y) sha512-arm-neon-$(CONFIG_KERNEL_MODE_NEON) :=3D sha512-neon-glue.o sha512-arm-y :=3D sha512-core.o sha512-glue.o $(sha512-arm-neon-y) -blake2s-arm-y :=3D blake2s-shash.o libblake2s-arm-y:=3D blake2s-core.o blake2s-glue.o blake2b-neon-y :=3D blake2b-neon-core.o blake2b-neon-glue.o sha1-arm-ce-y :=3D sha1-ce-core.o sha1-ce-glue.o diff --git a/arch/arm/crypto/blake2s-shash.c b/arch/arm/crypto/blake2s-shas= h.c deleted file mode 100644 index 763c73beea2d..000000000000 --- a/arch/arm/crypto/blake2s-shash.c +++ /dev/null @@ -1,75 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-or-later -/* - * BLAKE2s digest algorithm, ARM scalar implementation - * - * Copyright 2020 Google LLC - */ - -#include -#include - -#include - -static int crypto_blake2s_update_arm(struct shash_desc *desc, - const u8 *in, unsigned int inlen) -{ - return crypto_blake2s_update(desc, in, inlen, false); -} - -static int crypto_blake2s_final_arm(struct shash_desc *desc, u8 *out) -{ - return crypto_blake2s_final(desc, out, false); -} - -#define BLAKE2S_ALG(name, driver_name, digest_size) \ - { \ - .base.cra_name =3D name, \ - .base.cra_driver_name =3D driver_name, \ - .base.cra_priority =3D 200, \ - .base.cra_flags =3D CRYPTO_ALG_OPTIONAL_KEY, \ - .base.cra_blocksize =3D BLAKE2S_BLOCK_SIZE, \ - .base.cra_ctxsize =3D sizeof(struct blake2s_tfm_ctx), \ - .base.cra_module =3D THIS_MODULE, \ - .digestsize =3D digest_size, \ - .setkey =3D crypto_blake2s_setkey, \ - .init =3D crypto_blake2s_init, \ - .update =3D crypto_blake2s_update_arm, \ - .final =3D crypto_blake2s_final_arm, \ - .descsize =3D sizeof(struct blake2s_state), \ - } - -static struct shash_alg blake2s_arm_algs[] =3D { - BLAKE2S_ALG("blake2s-128", "blake2s-128-arm", BLAKE2S_128_HASH_SIZE), - BLAKE2S_ALG("blake2s-160", "blake2s-160-arm", BLAKE2S_160_HASH_SIZE), - BLAKE2S_ALG("blake2s-224", "blake2s-224-arm", BLAKE2S_224_HASH_SIZE), - BLAKE2S_ALG("blake2s-256", "blake2s-256-arm", BLAKE2S_256_HASH_SIZE), -}; - -static int __init blake2s_arm_mod_init(void) -{ - return IS_REACHABLE(CONFIG_CRYPTO_HASH) ? - crypto_register_shashes(blake2s_arm_algs, - ARRAY_SIZE(blake2s_arm_algs)) : 0; -} - -static void __exit blake2s_arm_mod_exit(void) -{ - if (IS_REACHABLE(CONFIG_CRYPTO_HASH)) - crypto_unregister_shashes(blake2s_arm_algs, - ARRAY_SIZE(blake2s_arm_algs)); -} - -module_init(blake2s_arm_mod_init); -module_exit(blake2s_arm_mod_exit); - -MODULE_DESCRIPTION("BLAKE2s digest algorithm, ARM scalar implementation"); -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Eric Biggers "); -MODULE_ALIAS_CRYPTO("blake2s-128"); -MODULE_ALIAS_CRYPTO("blake2s-128-arm"); -MODULE_ALIAS_CRYPTO("blake2s-160"); -MODULE_ALIAS_CRYPTO("blake2s-160-arm"); -MODULE_ALIAS_CRYPTO("blake2s-224"); -MODULE_ALIAS_CRYPTO("blake2s-224-arm"); -MODULE_ALIAS_CRYPTO("blake2s-256"); -MODULE_ALIAS_CRYPTO("blake2s-256-arm"); diff --git a/arch/x86/crypto/Makefile b/arch/x86/crypto/Makefile index c3af959648e6..fce05e9df56d 100644 --- a/arch/x86/crypto/Makefile +++ b/arch/x86/crypto/Makefile @@ -61,9 +61,7 @@ sha256-ssse3-$(CONFIG_AS_SHA256_NI) +=3D sha256_ni_asm.o obj-$(CONFIG_CRYPTO_SHA512_SSSE3) +=3D sha512-ssse3.o sha512-ssse3-y :=3D sha512-ssse3-asm.o sha512-avx-asm.o sha512-avx2-asm.o = sha512_ssse3_glue.o =20 -obj-$(CONFIG_CRYPTO_BLAKE2S_X86) +=3D blake2s-x86_64.o -blake2s-x86_64-y :=3D blake2s-shash.o -obj-$(if $(CONFIG_CRYPTO_BLAKE2S_X86),y) +=3D libblake2s-x86_64.o +obj-$(CONFIG_CRYPTO_BLAKE2S_X86) +=3D libblake2s-x86_64.o libblake2s-x86_64-y :=3D blake2s-core.o blake2s-glue.o =20 obj-$(CONFIG_CRYPTO_GHASH_CLMUL_NI_INTEL) +=3D ghash-clmulni-intel.o diff --git a/arch/x86/crypto/blake2s-glue.c b/arch/x86/crypto/blake2s-glue.c index 69853c13e8fb..aaba21230528 100644 --- a/arch/x86/crypto/blake2s-glue.c +++ b/arch/x86/crypto/blake2s-glue.c @@ -4,7 +4,6 @@ */ =20 #include -#include =20 #include #include @@ -33,7 +32,7 @@ void blake2s_compress(struct blake2s_state *state, const = u8 *block, /* SIMD disables preemption, so relax after processing each page. */ BUILD_BUG_ON(SZ_4K / BLAKE2S_BLOCK_SIZE < 8); =20 - if (!static_branch_likely(&blake2s_use_ssse3) || !crypto_simd_usable()) { + if (!static_branch_likely(&blake2s_use_ssse3) || !may_use_simd()) { blake2s_compress_generic(state, block, nblocks, inc); return; } diff --git a/arch/x86/crypto/blake2s-shash.c b/arch/x86/crypto/blake2s-shas= h.c deleted file mode 100644 index 59ae28abe35c..000000000000 --- a/arch/x86/crypto/blake2s-shash.c +++ /dev/null @@ -1,77 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 OR MIT -/* - * Copyright (C) 2015-2019 Jason A. Donenfeld . All Right= s Reserved. - */ - -#include -#include -#include - -#include -#include -#include -#include - -#include -#include - -static int crypto_blake2s_update_x86(struct shash_desc *desc, - const u8 *in, unsigned int inlen) -{ - return crypto_blake2s_update(desc, in, inlen, false); -} - -static int crypto_blake2s_final_x86(struct shash_desc *desc, u8 *out) -{ - return crypto_blake2s_final(desc, out, false); -} - -#define BLAKE2S_ALG(name, driver_name, digest_size) \ - { \ - .base.cra_name =3D name, \ - .base.cra_driver_name =3D driver_name, \ - .base.cra_priority =3D 200, \ - .base.cra_flags =3D CRYPTO_ALG_OPTIONAL_KEY, \ - .base.cra_blocksize =3D BLAKE2S_BLOCK_SIZE, \ - .base.cra_ctxsize =3D sizeof(struct blake2s_tfm_ctx), \ - .base.cra_module =3D THIS_MODULE, \ - .digestsize =3D digest_size, \ - .setkey =3D crypto_blake2s_setkey, \ - .init =3D crypto_blake2s_init, \ - .update =3D crypto_blake2s_update_x86, \ - .final =3D crypto_blake2s_final_x86, \ - .descsize =3D sizeof(struct blake2s_state), \ - } - -static struct shash_alg blake2s_algs[] =3D { - BLAKE2S_ALG("blake2s-128", "blake2s-128-x86", BLAKE2S_128_HASH_SIZE), - BLAKE2S_ALG("blake2s-160", "blake2s-160-x86", BLAKE2S_160_HASH_SIZE), - BLAKE2S_ALG("blake2s-224", "blake2s-224-x86", BLAKE2S_224_HASH_SIZE), - BLAKE2S_ALG("blake2s-256", "blake2s-256-x86", BLAKE2S_256_HASH_SIZE), -}; - -static int __init blake2s_mod_init(void) -{ - if (IS_REACHABLE(CONFIG_CRYPTO_HASH) && boot_cpu_has(X86_FEATURE_SSSE3)) - return crypto_register_shashes(blake2s_algs, ARRAY_SIZE(blake2s_algs)); - return 0; -} - -static void __exit blake2s_mod_exit(void) -{ - if (IS_REACHABLE(CONFIG_CRYPTO_HASH) && boot_cpu_has(X86_FEATURE_SSSE3)) - crypto_unregister_shashes(blake2s_algs, ARRAY_SIZE(blake2s_algs)); -} - -module_init(blake2s_mod_init); -module_exit(blake2s_mod_exit); - -MODULE_ALIAS_CRYPTO("blake2s-128"); -MODULE_ALIAS_CRYPTO("blake2s-128-x86"); -MODULE_ALIAS_CRYPTO("blake2s-160"); -MODULE_ALIAS_CRYPTO("blake2s-160-x86"); -MODULE_ALIAS_CRYPTO("blake2s-224"); -MODULE_ALIAS_CRYPTO("blake2s-224-x86"); -MODULE_ALIAS_CRYPTO("blake2s-256"); -MODULE_ALIAS_CRYPTO("blake2s-256-x86"); -MODULE_LICENSE("GPL v2"); diff --git a/crypto/Kconfig b/crypto/Kconfig index f0743ac4e820..db260ccfba51 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig @@ -684,26 +684,8 @@ config CRYPTO_BLAKE2B =20 See https://blake2.net for further information. =20 -config CRYPTO_BLAKE2S - tristate "BLAKE2s digest algorithm" - select CRYPTO_LIB_BLAKE2S_GENERIC - select CRYPTO_HASH - help - Implementation of cryptographic hash function BLAKE2s - optimized for 8-32bit platforms and can produce digests of any size - between 1 to 32. The keyed hash is also implemented. - - This module provides the following algorithms: - - - blake2s-128 - - blake2s-160 - - blake2s-224 - - blake2s-256 - - See https://blake2.net for further information. - config CRYPTO_BLAKE2S_X86 - tristate "BLAKE2s digest algorithm (x86 accelerated version)" + bool "BLAKE2s digest algorithm (x86 accelerated version)" depends on X86 && 64BIT select CRYPTO_LIB_BLAKE2S_GENERIC select CRYPTO_ARCH_HAVE_LIB_BLAKE2S diff --git a/crypto/Makefile b/crypto/Makefile index 78b5ab05d6ed..429591ffeb5d 100644 --- a/crypto/Makefile +++ b/crypto/Makefile @@ -83,7 +83,6 @@ obj-$(CONFIG_CRYPTO_STREEBOG) +=3D streebog_generic.o obj-$(CONFIG_CRYPTO_WP512) +=3D wp512.o CFLAGS_wp512.o :=3D $(call cc-option,-fno-schedule-insns) # https://gcc.g= nu.org/bugzilla/show_bug.cgi?id=3D79149 obj-$(CONFIG_CRYPTO_BLAKE2B) +=3D blake2b_generic.o -obj-$(CONFIG_CRYPTO_BLAKE2S) +=3D blake2s_generic.o obj-$(CONFIG_CRYPTO_GF128MUL) +=3D gf128mul.o obj-$(CONFIG_CRYPTO_ECB) +=3D ecb.o obj-$(CONFIG_CRYPTO_CBC) +=3D cbc.o diff --git a/crypto/blake2s_generic.c b/crypto/blake2s_generic.c deleted file mode 100644 index 5f96a21f8788..000000000000 --- a/crypto/blake2s_generic.c +++ /dev/null @@ -1,75 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 OR MIT -/* - * shash interface to the generic implementation of BLAKE2s - * - * Copyright (C) 2015-2019 Jason A. Donenfeld . All Right= s Reserved. - */ - -#include -#include - -#include -#include -#include - -static int crypto_blake2s_update_generic(struct shash_desc *desc, - const u8 *in, unsigned int inlen) -{ - return crypto_blake2s_update(desc, in, inlen, true); -} - -static int crypto_blake2s_final_generic(struct shash_desc *desc, u8 *out) -{ - return crypto_blake2s_final(desc, out, true); -} - -#define BLAKE2S_ALG(name, driver_name, digest_size) \ - { \ - .base.cra_name =3D name, \ - .base.cra_driver_name =3D driver_name, \ - .base.cra_priority =3D 100, \ - .base.cra_flags =3D CRYPTO_ALG_OPTIONAL_KEY, \ - .base.cra_blocksize =3D BLAKE2S_BLOCK_SIZE, \ - .base.cra_ctxsize =3D sizeof(struct blake2s_tfm_ctx), \ - .base.cra_module =3D THIS_MODULE, \ - .digestsize =3D digest_size, \ - .setkey =3D crypto_blake2s_setkey, \ - .init =3D crypto_blake2s_init, \ - .update =3D crypto_blake2s_update_generic, \ - .final =3D crypto_blake2s_final_generic, \ - .descsize =3D sizeof(struct blake2s_state), \ - } - -static struct shash_alg blake2s_algs[] =3D { - BLAKE2S_ALG("blake2s-128", "blake2s-128-generic", - BLAKE2S_128_HASH_SIZE), - BLAKE2S_ALG("blake2s-160", "blake2s-160-generic", - BLAKE2S_160_HASH_SIZE), - BLAKE2S_ALG("blake2s-224", "blake2s-224-generic", - BLAKE2S_224_HASH_SIZE), - BLAKE2S_ALG("blake2s-256", "blake2s-256-generic", - BLAKE2S_256_HASH_SIZE), -}; - -static int __init blake2s_mod_init(void) -{ - return crypto_register_shashes(blake2s_algs, ARRAY_SIZE(blake2s_algs)); -} - -static void __exit blake2s_mod_exit(void) -{ - crypto_unregister_shashes(blake2s_algs, ARRAY_SIZE(blake2s_algs)); -} - -subsys_initcall(blake2s_mod_init); -module_exit(blake2s_mod_exit); - -MODULE_ALIAS_CRYPTO("blake2s-128"); -MODULE_ALIAS_CRYPTO("blake2s-128-generic"); -MODULE_ALIAS_CRYPTO("blake2s-160"); -MODULE_ALIAS_CRYPTO("blake2s-160-generic"); -MODULE_ALIAS_CRYPTO("blake2s-224"); -MODULE_ALIAS_CRYPTO("blake2s-224-generic"); -MODULE_ALIAS_CRYPTO("blake2s-256"); -MODULE_ALIAS_CRYPTO("blake2s-256-generic"); -MODULE_LICENSE("GPL v2"); diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index 00149657a4bc..3362897bf61b 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c @@ -1863,10 +1863,6 @@ static int do_test(const char *alg, u32 type, u32 ma= sk, int m, u32 num_mb) ret +=3D tcrypt_test("rmd160"); break; =20 - case 41: - ret +=3D tcrypt_test("blake2s-256"); - break; - case 42: ret +=3D tcrypt_test("blake2b-512"); break; @@ -2434,10 +2430,6 @@ static int do_test(const char *alg, u32 type, u32 ma= sk, int m, u32 num_mb) test_hash_speed("rmd160", sec, generic_hash_speed_template); if (mode > 300 && mode < 400) break; fallthrough; - case 316: - test_hash_speed("blake2s-256", sec, generic_hash_speed_template); - if (mode > 300 && mode < 400) break; - fallthrough; case 317: test_hash_speed("blake2b-512", sec, generic_hash_speed_template); if (mode > 300 && mode < 400) break; @@ -2546,10 +2538,6 @@ static int do_test(const char *alg, u32 type, u32 ma= sk, int m, u32 num_mb) test_ahash_speed("rmd160", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; fallthrough; - case 416: - test_ahash_speed("blake2s-256", sec, generic_hash_speed_template); - if (mode > 400 && mode < 500) break; - fallthrough; case 417: test_ahash_speed("blake2b-512", sec, generic_hash_speed_template); if (mode > 400 && mode < 500) break; diff --git a/crypto/testmgr.c b/crypto/testmgr.c index 70f69f0910c9..163a1283a866 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -4329,30 +4329,6 @@ static const struct alg_test_desc alg_test_descs[] = =3D { .suite =3D { .hash =3D __VECS(blake2b_512_tv_template) } - }, { - .alg =3D "blake2s-128", - .test =3D alg_test_hash, - .suite =3D { - .hash =3D __VECS(blakes2s_128_tv_template) - } - }, { - .alg =3D "blake2s-160", - .test =3D alg_test_hash, - .suite =3D { - .hash =3D __VECS(blakes2s_160_tv_template) - } - }, { - .alg =3D "blake2s-224", - .test =3D alg_test_hash, - .suite =3D { - .hash =3D __VECS(blakes2s_224_tv_template) - } - }, { - .alg =3D "blake2s-256", - .test =3D alg_test_hash, - .suite =3D { - .hash =3D __VECS(blakes2s_256_tv_template) - } }, { .alg =3D "cbc(aes)", .test =3D alg_test_skcipher, diff --git a/crypto/testmgr.h b/crypto/testmgr.h index e6fca34b5b25..2be20a590a60 100644 --- a/crypto/testmgr.h +++ b/crypto/testmgr.h @@ -32583,221 +32583,4 @@ static const struct hash_testvec blake2b_512_tv_t= emplate[] =3D {{ 0xae, 0x15, 0x81, 0x15, 0xd0, 0x88, 0xa0, 0x3c, }, }}; =20 -static const struct hash_testvec blakes2s_128_tv_template[] =3D {{ - .digest =3D (u8[]){ 0x64, 0x55, 0x0d, 0x6f, 0xfe, 0x2c, 0x0a, 0x01, - 0xa1, 0x4a, 0xba, 0x1e, 0xad, 0xe0, 0x20, 0x0c, }, -}, { - .plaintext =3D blake2_ordered_sequence, - .psize =3D 64, - .digest =3D (u8[]){ 0xdc, 0x66, 0xca, 0x8f, 0x03, 0x86, 0x58, 0x01, - 0xb0, 0xff, 0xe0, 0x6e, 0xd8, 0xa1, 0xa9, 0x0e, }, -}, { - .ksize =3D 16, - .key =3D blake2_ordered_sequence, - .plaintext =3D blake2_ordered_sequence, - .psize =3D 1, - .digest =3D (u8[]){ 0x88, 0x1e, 0x42, 0xe7, 0xbb, 0x35, 0x80, 0x82, - 0x63, 0x7c, 0x0a, 0x0f, 0xd7, 0xec, 0x6c, 0x2f, }, -}, { - .ksize =3D 32, - .key =3D blake2_ordered_sequence, - .plaintext =3D blake2_ordered_sequence, - .psize =3D 7, - .digest =3D (u8[]){ 0xcf, 0x9e, 0x07, 0x2a, 0xd5, 0x22, 0xf2, 0xcd, - 0xa2, 0xd8, 0x25, 0x21, 0x80, 0x86, 0x73, 0x1c, }, -}, { - .ksize =3D 1, - .key =3D "B", - .plaintext =3D blake2_ordered_sequence, - .psize =3D 15, - .digest =3D (u8[]){ 0xf6, 0x33, 0x5a, 0x2c, 0x22, 0xa0, 0x64, 0xb2, - 0xb6, 0x3f, 0xeb, 0xbc, 0xd1, 0xc3, 0xe5, 0xb2, }, -}, { - .ksize =3D 16, - .key =3D blake2_ordered_sequence, - .plaintext =3D blake2_ordered_sequence, - .psize =3D 247, - .digest =3D (u8[]){ 0x72, 0x66, 0x49, 0x60, 0xf9, 0x4a, 0xea, 0xbe, - 0x1f, 0xf4, 0x60, 0xce, 0xb7, 0x81, 0xcb, 0x09, }, -}, { - .ksize =3D 32, - .key =3D blake2_ordered_sequence, - .plaintext =3D blake2_ordered_sequence, - .psize =3D 256, - .digest =3D (u8[]){ 0xd5, 0xa4, 0x0e, 0xc3, 0x16, 0xc7, 0x51, 0xa6, - 0x3c, 0xd0, 0xd9, 0x11, 0x57, 0xfa, 0x1e, 0xbb, }, -}}; - -static const struct hash_testvec blakes2s_160_tv_template[] =3D {{ - .plaintext =3D blake2_ordered_sequence, - .psize =3D 7, - .digest =3D (u8[]){ 0xb4, 0xf2, 0x03, 0x49, 0x37, 0xed, 0xb1, 0x3e, - 0x5b, 0x2a, 0xca, 0x64, 0x82, 0x74, 0xf6, 0x62, - 0xe3, 0xf2, 0x84, 0xff, }, -}, { - .plaintext =3D blake2_ordered_sequence, - .psize =3D 256, - .digest =3D (u8[]){ 0xaa, 0x56, 0x9b, 0xdc, 0x98, 0x17, 0x75, 0xf2, - 0xb3, 0x68, 0x83, 0xb7, 0x9b, 0x8d, 0x48, 0xb1, - 0x9b, 0x2d, 0x35, 0x05, }, -}, { - .ksize =3D 1, - .key =3D "B", - .digest =3D (u8[]){ 0x50, 0x16, 0xe7, 0x0c, 0x01, 0xd0, 0xd3, 0xc3, - 0xf4, 0x3e, 0xb1, 0x6e, 0x97, 0xa9, 0x4e, 0xd1, - 0x79, 0x65, 0x32, 0x93, }, -}, { - .ksize =3D 32, - .key =3D blake2_ordered_sequence, - .plaintext =3D blake2_ordered_sequence, - .psize =3D 1, - .digest =3D (u8[]){ 0x1c, 0x2b, 0xcd, 0x9a, 0x68, 0xca, 0x8c, 0x71, - 0x90, 0x29, 0x6c, 0x54, 0xfa, 0x56, 0x4a, 0xef, - 0xa2, 0x3a, 0x56, 0x9c, }, -}, { - .ksize =3D 16, - .key =3D blake2_ordered_sequence, - .plaintext =3D blake2_ordered_sequence, - .psize =3D 15, - .digest =3D (u8[]){ 0x36, 0xc3, 0x5f, 0x9a, 0xdc, 0x7e, 0xbf, 0x19, - 0x68, 0xaa, 0xca, 0xd8, 0x81, 0xbf, 0x09, 0x34, - 0x83, 0x39, 0x0f, 0x30, }, -}, { - .ksize =3D 1, - .key =3D "B", - .plaintext =3D blake2_ordered_sequence, - .psize =3D 64, - .digest =3D (u8[]){ 0x86, 0x80, 0x78, 0xa4, 0x14, 0xec, 0x03, 0xe5, - 0xb6, 0x9a, 0x52, 0x0e, 0x42, 0xee, 0x39, 0x9d, - 0xac, 0xa6, 0x81, 0x63, }, -}, { - .ksize =3D 32, - .key =3D blake2_ordered_sequence, - .plaintext =3D blake2_ordered_sequence, - .psize =3D 247, - .digest =3D (u8[]){ 0x2d, 0xd8, 0xd2, 0x53, 0x66, 0xfa, 0xa9, 0x01, - 0x1c, 0x9c, 0xaf, 0xa3, 0xe2, 0x9d, 0x9b, 0x10, - 0x0a, 0xf6, 0x73, 0xe8, }, -}}; - -static const struct hash_testvec blakes2s_224_tv_template[] =3D {{ - .plaintext =3D blake2_ordered_sequence, - .psize =3D 1, - .digest =3D (u8[]){ 0x61, 0xb9, 0x4e, 0xc9, 0x46, 0x22, 0xa3, 0x91, - 0xd2, 0xae, 0x42, 0xe6, 0x45, 0x6c, 0x90, 0x12, - 0xd5, 0x80, 0x07, 0x97, 0xb8, 0x86, 0x5a, 0xfc, - 0x48, 0x21, 0x97, 0xbb, }, -}, { - .plaintext =3D blake2_ordered_sequence, - .psize =3D 247, - .digest =3D (u8[]){ 0x9e, 0xda, 0xc7, 0x20, 0x2c, 0xd8, 0x48, 0x2e, - 0x31, 0x94, 0xab, 0x46, 0x6d, 0x94, 0xd8, 0xb4, - 0x69, 0xcd, 0xae, 0x19, 0x6d, 0x9e, 0x41, 0xcc, - 0x2b, 0xa4, 0xd5, 0xf6, }, -}, { - .ksize =3D 16, - .key =3D blake2_ordered_sequence, - .digest =3D (u8[]){ 0x32, 0xc0, 0xac, 0xf4, 0x3b, 0xd3, 0x07, 0x9f, - 0xbe, 0xfb, 0xfa, 0x4d, 0x6b, 0x4e, 0x56, 0xb3, - 0xaa, 0xd3, 0x27, 0xf6, 0x14, 0xbf, 0xb9, 0x32, - 0xa7, 0x19, 0xfc, 0xb8, }, -}, { - .ksize =3D 1, - .key =3D "B", - .plaintext =3D blake2_ordered_sequence, - .psize =3D 7, - .digest =3D (u8[]){ 0x73, 0xad, 0x5e, 0x6d, 0xb9, 0x02, 0x8e, 0x76, - 0xf2, 0x66, 0x42, 0x4b, 0x4c, 0xfa, 0x1f, 0xe6, - 0x2e, 0x56, 0x40, 0xe5, 0xa2, 0xb0, 0x3c, 0xe8, - 0x7b, 0x45, 0xfe, 0x05, }, -}, { - .ksize =3D 32, - .key =3D blake2_ordered_sequence, - .plaintext =3D blake2_ordered_sequence, - .psize =3D 15, - .digest =3D (u8[]){ 0x16, 0x60, 0xfb, 0x92, 0x54, 0xb3, 0x6e, 0x36, - 0x81, 0xf4, 0x16, 0x41, 0xc3, 0x3d, 0xd3, 0x43, - 0x84, 0xed, 0x10, 0x6f, 0x65, 0x80, 0x7a, 0x3e, - 0x25, 0xab, 0xc5, 0x02, }, -}, { - .ksize =3D 16, - .key =3D blake2_ordered_sequence, - .plaintext =3D blake2_ordered_sequence, - .psize =3D 64, - .digest =3D (u8[]){ 0xca, 0xaa, 0x39, 0x67, 0x9c, 0xf7, 0x6b, 0xc7, - 0xb6, 0x82, 0xca, 0x0e, 0x65, 0x36, 0x5b, 0x7c, - 0x24, 0x00, 0xfa, 0x5f, 0xda, 0x06, 0x91, 0x93, - 0x6a, 0x31, 0x83, 0xb5, }, -}, { - .ksize =3D 1, - .key =3D "B", - .plaintext =3D blake2_ordered_sequence, - .psize =3D 256, - .digest =3D (u8[]){ 0x90, 0x02, 0x26, 0xb5, 0x06, 0x9c, 0x36, 0x86, - 0x94, 0x91, 0x90, 0x1e, 0x7d, 0x2a, 0x71, 0xb2, - 0x48, 0xb5, 0xe8, 0x16, 0xfd, 0x64, 0x33, 0x45, - 0xb3, 0xd7, 0xec, 0xcc, }, -}}; - -static const struct hash_testvec blakes2s_256_tv_template[] =3D {{ - .plaintext =3D blake2_ordered_sequence, - .psize =3D 15, - .digest =3D (u8[]){ 0xd9, 0x7c, 0x82, 0x8d, 0x81, 0x82, 0xa7, 0x21, - 0x80, 0xa0, 0x6a, 0x78, 0x26, 0x83, 0x30, 0x67, - 0x3f, 0x7c, 0x4e, 0x06, 0x35, 0x94, 0x7c, 0x04, - 0xc0, 0x23, 0x23, 0xfd, 0x45, 0xc0, 0xa5, 0x2d, }, -}, { - .ksize =3D 32, - .key =3D blake2_ordered_sequence, - .digest =3D (u8[]){ 0x48, 0xa8, 0x99, 0x7d, 0xa4, 0x07, 0x87, 0x6b, - 0x3d, 0x79, 0xc0, 0xd9, 0x23, 0x25, 0xad, 0x3b, - 0x89, 0xcb, 0xb7, 0x54, 0xd8, 0x6a, 0xb7, 0x1a, - 0xee, 0x04, 0x7a, 0xd3, 0x45, 0xfd, 0x2c, 0x49, }, -}, { - .ksize =3D 1, - .key =3D "B", - .plaintext =3D blake2_ordered_sequence, - .psize =3D 1, - .digest =3D (u8[]){ 0x22, 0x27, 0xae, 0xaa, 0x6e, 0x81, 0x56, 0x03, - 0xa7, 0xe3, 0xa1, 0x18, 0xa5, 0x9a, 0x2c, 0x18, - 0xf4, 0x63, 0xbc, 0x16, 0x70, 0xf1, 0xe7, 0x4b, - 0x00, 0x6d, 0x66, 0x16, 0xae, 0x9e, 0x74, 0x4e, }, -}, { - .ksize =3D 16, - .key =3D blake2_ordered_sequence, - .plaintext =3D blake2_ordered_sequence, - .psize =3D 7, - .digest =3D (u8[]){ 0x58, 0x5d, 0xa8, 0x60, 0x1c, 0xa4, 0xd8, 0x03, - 0x86, 0x86, 0x84, 0x64, 0xd7, 0xa0, 0x8e, 0x15, - 0x2f, 0x05, 0xa2, 0x1b, 0xbc, 0xef, 0x7a, 0x34, - 0xb3, 0xc5, 0xbc, 0x4b, 0xf0, 0x32, 0xeb, 0x12, }, -}, { - .ksize =3D 32, - .key =3D blake2_ordered_sequence, - .plaintext =3D blake2_ordered_sequence, - .psize =3D 64, - .digest =3D (u8[]){ 0x89, 0x75, 0xb0, 0x57, 0x7f, 0xd3, 0x55, 0x66, - 0xd7, 0x50, 0xb3, 0x62, 0xb0, 0x89, 0x7a, 0x26, - 0xc3, 0x99, 0x13, 0x6d, 0xf0, 0x7b, 0xab, 0xab, - 0xbd, 0xe6, 0x20, 0x3f, 0xf2, 0x95, 0x4e, 0xd4, }, -}, { - .ksize =3D 1, - .key =3D "B", - .plaintext =3D blake2_ordered_sequence, - .psize =3D 247, - .digest =3D (u8[]){ 0x2e, 0x74, 0x1c, 0x1d, 0x03, 0xf4, 0x9d, 0x84, - 0x6f, 0xfc, 0x86, 0x32, 0x92, 0x49, 0x7e, 0x66, - 0xd7, 0xc3, 0x10, 0x88, 0xfe, 0x28, 0xb3, 0xe0, - 0xbf, 0x50, 0x75, 0xad, 0x8e, 0xa4, 0xe6, 0xb2, }, -}, { - .ksize =3D 16, - .key =3D blake2_ordered_sequence, - .plaintext =3D blake2_ordered_sequence, - .psize =3D 256, - .digest =3D (u8[]){ 0xb9, 0xd2, 0x81, 0x0e, 0x3a, 0xb1, 0x62, 0x9b, - 0xad, 0x44, 0x05, 0xf4, 0x92, 0x2e, 0x99, 0xc1, - 0x4a, 0x47, 0xbb, 0x5b, 0x6f, 0xb2, 0x96, 0xed, - 0xd5, 0x06, 0xb5, 0x3a, 0x7c, 0x7a, 0x65, 0x1d, }, -}}; - #endif /* _CRYPTO_TESTMGR_H */ diff --git a/include/crypto/internal/blake2s.h b/include/crypto/internal/bl= ake2s.h index 52363eee2b20..506d56530ca9 100644 --- a/include/crypto/internal/blake2s.h +++ b/include/crypto/internal/blake2s.h @@ -8,7 +8,6 @@ #define _CRYPTO_INTERNAL_BLAKE2S_H =20 #include -#include #include =20 void blake2s_compress_generic(struct blake2s_state *state, const u8 *block, @@ -19,111 +18,4 @@ void blake2s_compress(struct blake2s_state *state, cons= t u8 *block, =20 bool blake2s_selftest(void); =20 -static inline void blake2s_set_lastblock(struct blake2s_state *state) -{ - state->f[0] =3D -1; -} - -/* Helper functions for BLAKE2s shared by the library and shash APIs */ - -static __always_inline void -__blake2s_update(struct blake2s_state *state, const u8 *in, size_t inlen, - bool force_generic) -{ - const size_t fill =3D BLAKE2S_BLOCK_SIZE - state->buflen; - - if (unlikely(!inlen)) - return; - if (inlen > fill) { - memcpy(state->buf + state->buflen, in, fill); - if (force_generic) - blake2s_compress_generic(state, state->buf, 1, - BLAKE2S_BLOCK_SIZE); - else - blake2s_compress(state, state->buf, 1, - BLAKE2S_BLOCK_SIZE); - state->buflen =3D 0; - in +=3D fill; - inlen -=3D fill; - } - if (inlen > BLAKE2S_BLOCK_SIZE) { - const size_t nblocks =3D DIV_ROUND_UP(inlen, BLAKE2S_BLOCK_SIZE); - /* Hash one less (full) block than strictly possible */ - if (force_generic) - blake2s_compress_generic(state, in, nblocks - 1, - BLAKE2S_BLOCK_SIZE); - else - blake2s_compress(state, in, nblocks - 1, - BLAKE2S_BLOCK_SIZE); - in +=3D BLAKE2S_BLOCK_SIZE * (nblocks - 1); - inlen -=3D BLAKE2S_BLOCK_SIZE * (nblocks - 1); - } - memcpy(state->buf + state->buflen, in, inlen); - state->buflen +=3D inlen; -} - -static __always_inline void -__blake2s_final(struct blake2s_state *state, u8 *out, bool force_generic) -{ - blake2s_set_lastblock(state); - memset(state->buf + state->buflen, 0, - BLAKE2S_BLOCK_SIZE - state->buflen); /* Padding */ - if (force_generic) - blake2s_compress_generic(state, state->buf, 1, state->buflen); - else - blake2s_compress(state, state->buf, 1, state->buflen); - cpu_to_le32_array(state->h, ARRAY_SIZE(state->h)); - memcpy(out, state->h, state->outlen); -} - -/* Helper functions for shash implementations of BLAKE2s */ - -struct blake2s_tfm_ctx { - u8 key[BLAKE2S_KEY_SIZE]; - unsigned int keylen; -}; - -static inline int crypto_blake2s_setkey(struct crypto_shash *tfm, - const u8 *key, unsigned int keylen) -{ - struct blake2s_tfm_ctx *tctx =3D crypto_shash_ctx(tfm); - - if (keylen =3D=3D 0 || keylen > BLAKE2S_KEY_SIZE) - return -EINVAL; - - memcpy(tctx->key, key, keylen); - tctx->keylen =3D keylen; - - return 0; -} - -static inline int crypto_blake2s_init(struct shash_desc *desc) -{ - const struct blake2s_tfm_ctx *tctx =3D crypto_shash_ctx(desc->tfm); - struct blake2s_state *state =3D shash_desc_ctx(desc); - unsigned int outlen =3D crypto_shash_digestsize(desc->tfm); - - __blake2s_init(state, outlen, tctx->key, tctx->keylen); - return 0; -} - -static inline int crypto_blake2s_update(struct shash_desc *desc, - const u8 *in, unsigned int inlen, - bool force_generic) -{ - struct blake2s_state *state =3D shash_desc_ctx(desc); - - __blake2s_update(state, in, inlen, force_generic); - return 0; -} - -static inline int crypto_blake2s_final(struct shash_desc *desc, u8 *out, - bool force_generic) -{ - struct blake2s_state *state =3D shash_desc_ctx(desc); - - __blake2s_final(state, out, force_generic); - return 0; -} - #endif /* _CRYPTO_INTERNAL_BLAKE2S_H */ diff --git a/lib/crypto/blake2s-selftest.c b/lib/crypto/blake2s-selftest.c index 409e4b728770..66f505220f43 100644 --- a/lib/crypto/blake2s-selftest.c +++ b/lib/crypto/blake2s-selftest.c @@ -4,6 +4,8 @@ */ =20 #include +#include +#include #include =20 /* @@ -587,5 +589,44 @@ bool __init blake2s_selftest(void) } } =20 + for (i =3D 0; i < 32; ++i) { + enum { TEST_ALIGNMENT =3D 16 }; + u8 unaligned_block[BLAKE2S_BLOCK_SIZE + TEST_ALIGNMENT - 1] + __aligned(TEST_ALIGNMENT); + u8 blocks[BLAKE2S_BLOCK_SIZE * 3]; + struct blake2s_state state1, state2; + + get_random_bytes(blocks, sizeof(blocks)); + get_random_bytes(&state, sizeof(state)); + +#if defined(CONFIG_CRYPTO_LIB_BLAKE2S_GENERIC) && \ + defined(CONFIG_CRYPTO_ARCH_HAVE_LIB_BLAKE2S) + memcpy(&state1, &state, sizeof(state1)); + memcpy(&state2, &state, sizeof(state2)); + blake2s_compress(&state1, blocks, 3, BLAKE2S_BLOCK_SIZE); + blake2s_compress_generic(&state2, blocks, 3, BLAKE2S_BLOCK_SIZE); + if (memcmp(&state1, &state2, sizeof(state1))) { + pr_err("blake2s random compress self-test %d: FAIL\n", + i + 1); + success =3D false; + } +#endif + + memcpy(&state1, &state, sizeof(state1)); + blake2s_compress(&state1, blocks, 1, BLAKE2S_BLOCK_SIZE); + for (l =3D 1; l < TEST_ALIGNMENT; ++l) { + memcpy(unaligned_block + l, blocks, + BLAKE2S_BLOCK_SIZE); + memcpy(&state2, &state, sizeof(state2)); + blake2s_compress(&state2, unaligned_block + l, 1, + BLAKE2S_BLOCK_SIZE); + if (memcmp(&state1, &state2, sizeof(state1))) { + pr_err("blake2s random compress align %d self-test %d: FAIL\n", + l, i + 1); + success =3D false; + } + } + } + return success; } diff --git a/lib/crypto/blake2s.c b/lib/crypto/blake2s.c index c71c09621c09..98e688c6d891 100644 --- a/lib/crypto/blake2s.c +++ b/lib/crypto/blake2s.c @@ -16,16 +16,44 @@ #include #include =20 +static inline void blake2s_set_lastblock(struct blake2s_state *state) +{ + state->f[0] =3D -1; +} + void blake2s_update(struct blake2s_state *state, const u8 *in, size_t inle= n) { - __blake2s_update(state, in, inlen, false); + const size_t fill =3D BLAKE2S_BLOCK_SIZE - state->buflen; + + if (unlikely(!inlen)) + return; + if (inlen > fill) { + memcpy(state->buf + state->buflen, in, fill); + blake2s_compress(state, state->buf, 1, BLAKE2S_BLOCK_SIZE); + state->buflen =3D 0; + in +=3D fill; + inlen -=3D fill; + } + if (inlen > BLAKE2S_BLOCK_SIZE) { + const size_t nblocks =3D DIV_ROUND_UP(inlen, BLAKE2S_BLOCK_SIZE); + blake2s_compress(state, in, nblocks - 1, BLAKE2S_BLOCK_SIZE); + in +=3D BLAKE2S_BLOCK_SIZE * (nblocks - 1); + inlen -=3D BLAKE2S_BLOCK_SIZE * (nblocks - 1); + } + memcpy(state->buf + state->buflen, in, inlen); + state->buflen +=3D inlen; } EXPORT_SYMBOL(blake2s_update); =20 void blake2s_final(struct blake2s_state *state, u8 *out) { WARN_ON(IS_ENABLED(DEBUG) && !out); - __blake2s_final(state, out, false); + blake2s_set_lastblock(state); + memset(state->buf + state->buflen, 0, + BLAKE2S_BLOCK_SIZE - state->buflen); /* Padding */ + blake2s_compress(state, state->buf, 1, state->buflen); + cpu_to_le32_array(state->h, ARRAY_SIZE(state->h)); + memcpy(out, state->h, state->outlen); memzero_explicit(state, sizeof(*state)); } EXPORT_SYMBOL(blake2s_final); @@ -38,12 +66,7 @@ static int __init blake2s_mod_init(void) return 0; } =20 -static void __exit blake2s_mod_exit(void) -{ -} - module_init(blake2s_mod_init); -module_exit(blake2s_mod_exit); MODULE_LICENSE("GPL v2"); MODULE_DESCRIPTION("BLAKE2s hash function"); MODULE_AUTHOR("Jason A. Donenfeld "); --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B94B0C25B0E for ; Mon, 15 Aug 2022 19:48:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345218AbiHOTs5 (ORCPT ); Mon, 15 Aug 2022 15:48:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345517AbiHOTrB (ORCPT ); Mon, 15 Aug 2022 15:47: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 D773C6FA34; Mon, 15 Aug 2022 11:49: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 0D80EB81057; Mon, 15 Aug 2022 18:49:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54B58C433C1; Mon, 15 Aug 2022 18:49:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589361; bh=TRLbzgGhbaLzAl3vigtoJ/UZSgPoInJV6+BZ2ZoZeNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hUpAc7FIxdjLrSVNa1NUjviZQYDrZNF8ELzcoScnWgYZHTsAhjyjd3RtuvFLHJ8ps a/a7/mzSyoeiZsw7+9kdNcEKe8r8JlL+irI5CXrfv+DTiPiNZ8/xBpzPz0EG4/t9Y2 6+stHKr8Ga5eCm/e12/Va2utjIXr/KqDSEgST2v8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lyude Paul , Imre Deak , Jani Nikula , Sasha Levin Subject: [PATCH 5.15 693/779] drm/dp/mst: Read the extended DPCD capabilities during system resume Date: Mon, 15 Aug 2022 20:05:37 +0200 Message-Id: <20220815180406.963345371@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Imre Deak [ Upstream commit 7a710a8bc909313951eb9252d8419924c771d7c2 ] The WD22TB4 Thunderbolt dock at least will revert its DP_MAX_LINK_RATE from HBR3 to HBR2 after system suspend/resume if the DP_DP13_DPCD_REV registers are not read subsequently also as required. Fix this by reading DP_DP13_DPCD_REV registers as well, matching what is done during connector detection. While at it also fix up the same call in drm_dp_mst_dump_topology(). Cc: Lyude Paul Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/5292 Signed-off-by: Imre Deak Reviewed-by: Jani Nikula Cc: # v5.14+ Reviewed-by: Lyude Paul Link: https://patchwork.freedesktop.org/patch/msgid/20220614094537.885472-1= -imre.deak@intel.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/drm_dp_mst_topology.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp= _mst_topology.c index b3e3babe18c0..2a586e6489da 100644 --- a/drivers/gpu/drm/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/drm_dp_mst_topology.c @@ -3860,9 +3860,7 @@ int drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_= topology_mgr *mgr, if (!mgr->mst_primary) goto out_fail; =20 - ret =3D drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, mgr->dpcd, - DP_RECEIVER_CAP_SIZE); - if (ret !=3D DP_RECEIVER_CAP_SIZE) { + if (drm_dp_read_dpcd_caps(mgr->aux, mgr->dpcd) < 0) { drm_dbg_kms(mgr->dev, "dpcd read failed - undocked during suspend?\n"); goto out_fail; } @@ -4894,8 +4892,7 @@ void drm_dp_mst_dump_topology(struct seq_file *m, u8 buf[DP_PAYLOAD_TABLE_SIZE]; int ret; =20 - ret =3D drm_dp_dpcd_read(mgr->aux, DP_DPCD_REV, buf, DP_RECEIVER_CAP_SIZ= E); - if (ret) { + if (drm_dp_read_dpcd_caps(mgr->aux, buf) < 0) { seq_printf(m, "dpcd read failed\n"); goto out; } --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC595C00140 for ; Mon, 15 Aug 2022 19:55:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233473AbiHOTzH (ORCPT ); Mon, 15 Aug 2022 15:55:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244436AbiHOTx1 (ORCPT ); Mon, 15 Aug 2022 15:53:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 744B845076; Mon, 15 Aug 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 144BCB810A3; Mon, 15 Aug 2022 18:51:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A079C433C1; Mon, 15 Aug 2022 18:51:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589490; bh=45uz+rwgHCBS0lVdD6UyCB1stwIcWm/PdZp4hRTGTfU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GSUty2vh5Mz57dXMcLPPrWswexZXt2DyswWsQF8ij+kITsfCnesPNjfrQl9rtQc9t sWq+ch/bsSxxKDgFaFIaITuONxcq+LdxdJ9WXKKe5oe+at1QfhXTbV3XpffYbQm5d/ aPQuGTU7f6t5/usxzc11UjCIvn9rgx6F9Zi5eQzY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Stevenson , Maxime Ripard , Sasha Levin Subject: [PATCH 5.15 694/779] drm/vc4: drv: Adopt the dma configuration from the HVS or V3D component Date: Mon, 15 Aug 2022 20:05:38 +0200 Message-Id: <20220815180407.009803481@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dave Stevenson [ Upstream commit da8e393e23efb60eba8959856c7df88f9859f6eb ] vc4_drv isn't necessarily under the /soc node in DT as it is a virtual device, but it is the one that does the allocations. The DMA addresses are consumed by primarily the HVS or V3D, and those require VideoCore cache alias address mapping, and so will be under /soc. During probe find the a suitable device node for HVS or V3D, and adopt the DMA configuration of that node. Cc: Signed-off-by: Dave Stevenson Link: https://lore.kernel.org/r/20220613144800.326124-2-maxime@cerno.tech Signed-off-by: Maxime Ripard Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_drv.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c index f6c16c5aee68..6e52801e2d99 100644 --- a/drivers/gpu/drm/vc4/vc4_drv.c +++ b/drivers/gpu/drm/vc4/vc4_drv.c @@ -214,6 +214,15 @@ static void vc4_match_add_drivers(struct device *dev, } } =20 +const struct of_device_id vc4_dma_range_matches[] =3D { + { .compatible =3D "brcm,bcm2711-hvs" }, + { .compatible =3D "brcm,bcm2835-hvs" }, + { .compatible =3D "brcm,bcm2835-v3d" }, + { .compatible =3D "brcm,cygnus-v3d" }, + { .compatible =3D "brcm,vc4-v3d" }, + {} +}; + static int vc4_drm_bind(struct device *dev) { struct platform_device *pdev =3D to_platform_device(dev); @@ -231,6 +240,16 @@ static int vc4_drm_bind(struct device *dev) vc4_drm_driver.driver_features &=3D ~DRIVER_RENDER; of_node_put(node); =20 + node =3D of_find_matching_node_and_match(NULL, vc4_dma_range_matches, + NULL); + if (node) { + ret =3D of_dma_configure(dev, node, true); + of_node_put(node); + + if (ret) + return ret; + } + vc4 =3D devm_drm_dev_alloc(dev, &vc4_drm_driver, struct vc4_dev, base); if (IS_ERR(vc4)) return PTR_ERR(vc4); --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75F0EC00140 for ; Mon, 15 Aug 2022 19:51:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242953AbiHOTvs (ORCPT ); Mon, 15 Aug 2022 15:51:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345276AbiHOTtN (ORCPT ); Mon, 15 Aug 2022 15:49: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 C0E3172854; Mon, 15 Aug 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 dfw.source.kernel.org (Postfix) with ESMTPS id 06612611EC; Mon, 15 Aug 2022 18:49:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E546FC433D6; Mon, 15 Aug 2022 18:49:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589387; bh=Oyu8SLvYHA4waZZ1sY8iSpqGSuscCZRhPGnX5EgPg38=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UgLOSITrE+W4uR5mXnSbJ7bPMgLmF7RLewFepynLIRx4qIWf+4OCBCPcrjBdkrHka ARJ72CPDnVhm/fxyy3UnECzA0df3jTATeYtvQfecJY413SeyJ4AF9PrDXIXCqwAz10 3bFErjH9fVeweGTfySOMHH1TJpr4r4Ns6LKBGwgU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Wunner , Andrew Lunn , "David S. Miller" , Sasha Levin , Oleksij Rempel , Ferry Toth Subject: [PATCH 5.15 695/779] usbnet: smsc95xx: Dont clear read-only PHY interrupt Date: Mon, 15 Aug 2022 20:05:39 +0200 Message-Id: <20220815180407.050105261@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 3108871f19221372b251f7da1ac38736928b5b3a ] Upon receiving data from the Interrupt Endpoint, the SMSC LAN95xx driver attempts to clear the signaled interrupts by writing "all ones" to the Interrupt Status Register. However the driver only ever enables a single type of interrupt, namely the PHY Interrupt. And according to page 119 of the LAN950x datasheet, its bit in the Interrupt Status Register is read-only. There's no other way to clear it than in a separate PHY register: https://www.microchip.com/content/dam/mchp/documents/UNG/ProductDocuments/D= ataSheets/LAN950x-Data-Sheet-DS00001875D.pdf Consequently, writing "all ones" to the Interrupt Status Register is pointless and can be dropped. Tested-by: Oleksij Rempel # LAN9514/9512/9500 Tested-by: Ferry Toth # LAN9514 Signed-off-by: Lukas Wunner Reviewed-by: Andrew Lunn Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/usb/smsc95xx.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index 4e39e4345084..c33089168880 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c @@ -570,10 +570,6 @@ static int smsc95xx_link_reset(struct usbnet *dev) unsigned long flags; int ret; =20 - ret =3D smsc95xx_write_reg(dev, INT_STS, INT_STS_CLEAR_ALL_); - if (ret < 0) - return ret; - spin_lock_irqsave(&pdata->mac_cr_lock, flags); if (pdata->phydev->duplex !=3D DUPLEX_FULL) { pdata->mac_cr &=3D ~MAC_CR_FDPX_; --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22885C00140 for ; Mon, 15 Aug 2022 19:52:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345412AbiHOTwt (ORCPT ); Mon, 15 Aug 2022 15:52:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345682AbiHOTvi (ORCPT ); Mon, 15 Aug 2022 15:51: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 0522BA198; Mon, 15 Aug 2022 11:50: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 7054460C0B; Mon, 15 Aug 2022 18:50:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7687AC433D7; Mon, 15 Aug 2022 18:50:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589422; bh=KA1uoX8dztzybu+oQwNd21XsNnUm0jus5zMhqtDVzq4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TncGLM0/sxvqGhRvAOPDyl6xYhkTCCFQfS4Y8JoxH9XpPAMPAbKZ1oYddL6N3vCcM qOtERdviljd/rMduSh0geJoKK9xjwHO3/GuJ52oUZ/kPC1fHc0LJOyT1QBuk1m0bQz UN7JXeFyjYlFq167LCcWmrgrozi/3cO74V2G34Gc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Wunner , Andrew Lunn , "David S. Miller" , Sasha Levin , Oleksij Rempel , Ferry Toth Subject: [PATCH 5.15 696/779] usbnet: smsc95xx: Avoid link settings race on interrupt reception Date: Mon, 15 Aug 2022 20:05:40 +0200 Message-Id: <20220815180407.101084787@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 8960f878e39fadc03d74292a6731f1e914cf2019 ] When a PHY interrupt is signaled, the SMSC LAN95xx driver updates the MAC full duplex mode and PHY flow control registers based on cached data in struct phy_device: smsc95xx_status() # raises EVENT_LINK_RESET usbnet_deferred_kevent() smsc95xx_link_reset() # uses cached data in phydev Simultaneously, phylib polls link status once per second and updates that cached data: phy_state_machine() phy_check_link_status() phy_read_status() lan87xx_read_status() genphy_read_status() # updates cached data in phydev If smsc95xx_link_reset() wins the race against genphy_read_status(), the registers may be updated based on stale data. E.g. if the link was previously down, phydev->duplex is set to DUPLEX_UNKNOWN and that's what smsc95xx_link_reset() will use, even though genphy_read_status() may update it to DUPLEX_FULL afterwards. PHY interrupts are currently only enabled on suspend to trigger wakeup, so the impact of the race is limited, but we're about to enable them perpetually. Avoid the race by delaying execution of smsc95xx_link_reset() until phy_state_machine() has done its job and calls back via smsc95xx_handle_link_change(). Signaling EVENT_LINK_RESET on wakeup is not necessary because phylib picks up link status changes through polling. So drop the declaration of a ->link_reset() callback. Note that the semicolon on a line by itself added in smsc95xx_status() is a placeholder for a function call which will be added in a subsequent commit. That function call will actually handle the INT_ENP_PHY_INT_ interrupt. Tested-by: Oleksij Rempel # LAN9514/9512/9500 Tested-by: Ferry Toth # LAN9514 Signed-off-by: Lukas Wunner Reviewed-by: Andrew Lunn Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/usb/smsc95xx.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index c33089168880..7cf9206638c3 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c @@ -564,7 +564,7 @@ static int smsc95xx_phy_update_flowcontrol(struct usbne= t *dev) return smsc95xx_write_reg(dev, AFC_CFG, afc_cfg); } =20 -static int smsc95xx_link_reset(struct usbnet *dev) +static void smsc95xx_mac_update_fullduplex(struct usbnet *dev) { struct smsc95xx_priv *pdata =3D dev->driver_priv; unsigned long flags; @@ -581,14 +581,16 @@ static int smsc95xx_link_reset(struct usbnet *dev) spin_unlock_irqrestore(&pdata->mac_cr_lock, flags); =20 ret =3D smsc95xx_write_reg(dev, MAC_CR, pdata->mac_cr); - if (ret < 0) - return ret; + if (ret < 0) { + if (ret !=3D -ENODEV) + netdev_warn(dev->net, + "Error updating MAC full duplex mode\n"); + return; + } =20 ret =3D smsc95xx_phy_update_flowcontrol(dev); if (ret < 0) netdev_warn(dev->net, "Error updating PHY flow control\n"); - - return ret; } =20 static void smsc95xx_status(struct usbnet *dev, struct urb *urb) @@ -605,7 +607,7 @@ static void smsc95xx_status(struct usbnet *dev, struct = urb *urb) netif_dbg(dev, link, dev->net, "intdata: 0x%08X\n", intdata); =20 if (intdata & INT_ENP_PHY_INT_) - usbnet_defer_kevent(dev, EVENT_LINK_RESET); + ; else netdev_warn(dev->net, "unexpected interrupt, intdata=3D0x%08X\n", intdata); @@ -1062,6 +1064,7 @@ static void smsc95xx_handle_link_change(struct net_de= vice *net) struct usbnet *dev =3D netdev_priv(net); =20 phy_print_status(net->phydev); + smsc95xx_mac_update_fullduplex(dev); usbnet_defer_kevent(dev, EVENT_LINK_CHANGE); } =20 @@ -1967,7 +1970,6 @@ static const struct driver_info smsc95xx_info =3D { .description =3D "smsc95xx USB 2.0 Ethernet", .bind =3D smsc95xx_bind, .unbind =3D smsc95xx_unbind, - .link_reset =3D smsc95xx_link_reset, .reset =3D smsc95xx_reset, .check_connect =3D smsc95xx_start_phy, .stop =3D smsc95xx_stop, --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 832D7C00140 for ; Mon, 15 Aug 2022 19:54:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245121AbiHOTyQ (ORCPT ); Mon, 15 Aug 2022 15:54:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344447AbiHOTxW (ORCPT ); Mon, 15 Aug 2022 15:53:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2749143321; Mon, 15 Aug 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 ams.source.kernel.org (Postfix) with ESMTPS id 9DDBBB810A2; Mon, 15 Aug 2022 18:50:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDE60C433D6; Mon, 15 Aug 2022 18:50:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589458; bh=nO/+2AX+cazTuNn/aigmzflyJl3MlYx8GE+e0CzwuIU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B/PrNvfnaOR5e1JU/8cGWVi+Pi37GJS4gwYJCRhIfZh/nJnaqYW4slO9Pl7JuQ2j6 V1vgbfBUkEOS98UpqmHVmgOev1tmF0/Uof+Zr2RwvtlVoz9ELKRcQ8Jwe4Rzxd6o1o MYqNmnIu8JHoblBxDuq8tTWFeQA2IdDoXcWg9YmE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Wunner , Andre Edich , "David S. Miller" , Sasha Levin , Oleksij Rempel , Ferry Toth , Andrew Lunn Subject: [PATCH 5.15 697/779] usbnet: smsc95xx: Forward PHY interrupts to PHY driver to avoid polling Date: Mon, 15 Aug 2022 20:05:41 +0200 Message-Id: <20220815180407.143663505@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 1ce8b37241ed291af56f7a49bbdbf20c08728e88 ] Link status of SMSC LAN95xx chips is polled once per second, even though they're capable of signaling PHY interrupts through the MAC layer. Forward those interrupts to the PHY driver to avoid polling. Benefits are reduced bus traffic, reduced CPU overhead and quicker interface bringup. Polling was introduced in 2016 by commit d69d16949346 ("usbnet: smsc95xx: fix link detection for disabled autonegotiation"). Back then, the LAN95xx driver neglected to enable the ENERGYON interrupt, hence couldn't detect link-up events when auto-negotiation was disabled. The proper solution would have been to enable the ENERGYON interrupt instead of polling. Since then, PHY handling was moved from the LAN95xx driver to the SMSC PHY driver with commit 05b35e7eb9a1 ("smsc95xx: add phylib support"). That PHY driver is capable of link detection with auto-negotiation disabled because it enables the ENERGYON interrupt. Note that signaling interrupts through the MAC layer not only works with the integrated PHY, but also with an external PHY, provided its interrupt pin is attached to LAN95xx's nPHY_INT pin. In the unlikely event that the interrupt pin of an external PHY is attached to a GPIO of the SoC (or not connected at all), the driver can be amended to retrieve the irq from the PHY's of_node. To forward PHY interrupts to phylib, it is not sufficient to call phy_mac_interrupt(). Instead, the PHY's interrupt handler needs to run so that PHY interrupts are cleared. That's because according to page 119 of the LAN950x datasheet, "The source of this interrupt is a level. The interrupt persists until it is cleared in the PHY." https://www.microchip.com/content/dam/mchp/documents/UNG/ProductDocuments/D= ataSheets/LAN950x-Data-Sheet-DS00001875D.pdf Therefore, create an IRQ domain with a single IRQ for the PHY. In the future, the IRQ domain may be extended to support the 11 GPIOs on the LAN95xx. Normally the PHY interrupt should be masked until the PHY driver has cleared it. However masking requires a (sleeping) USB transaction and interrupts are received in (non-sleepable) softirq context. I decided not to mask the interrupt at all (by using the dummy_irq_chip's noop ->irq_mask() callback): The USB interrupt endpoint is polled in 1 msec intervals and normally that's sufficient to wake the PHY driver's IRQ thread and have it clear the interrupt. If it does take longer, worst thing that can happen is the IRQ thread is woken again. No big deal. Because PHY interrupts are now perpetually enabled, there's no need to selectively enable them on suspend. So remove all invocations of smsc95xx_enable_phy_wakeup_interrupts(). In smsc95xx_resume(), move the call of phy_init_hw() before usbnet_resume() (which restarts the status URB) to ensure that the PHY is fully initialized when an interrupt is handled. Tested-by: Oleksij Rempel # LAN9514/9512/9500 Tested-by: Ferry Toth # LAN9514 Signed-off-by: Lukas Wunner Reviewed-by: Andrew Lunn # from a PHY perspective Cc: Andre Edich Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/usb/smsc95xx.c | 113 ++++++++++++++++++++----------------- 1 file changed, 61 insertions(+), 52 deletions(-) diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index 7cf9206638c3..3eb62197c2f5 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include #include #include "smsc95xx.h" @@ -51,6 +53,9 @@ #define SUSPEND_ALLMODES (SUSPEND_SUSPEND0 | SUSPEND_SUSPEND1 | \ SUSPEND_SUSPEND2 | SUSPEND_SUSPEND3) =20 +#define SMSC95XX_NR_IRQS (1) /* raise to 12 for GPIOs */ +#define PHY_HWIRQ (SMSC95XX_NR_IRQS - 1) + struct smsc95xx_priv { u32 mac_cr; u32 hash_hi; @@ -59,6 +64,9 @@ struct smsc95xx_priv { spinlock_t mac_cr_lock; u8 features; u8 suspend_flags; + struct irq_chip irqchip; + struct irq_domain *irqdomain; + struct fwnode_handle *irqfwnode; struct mii_bus *mdiobus; struct phy_device *phydev; }; @@ -595,6 +603,8 @@ static void smsc95xx_mac_update_fullduplex(struct usbne= t *dev) =20 static void smsc95xx_status(struct usbnet *dev, struct urb *urb) { + struct smsc95xx_priv *pdata =3D dev->driver_priv; + unsigned long flags; u32 intdata; =20 if (urb->actual_length !=3D 4) { @@ -606,11 +616,15 @@ static void smsc95xx_status(struct usbnet *dev, struc= t urb *urb) intdata =3D get_unaligned_le32(urb->transfer_buffer); netif_dbg(dev, link, dev->net, "intdata: 0x%08X\n", intdata); =20 + local_irq_save(flags); + if (intdata & INT_ENP_PHY_INT_) - ; + generic_handle_domain_irq(pdata->irqdomain, PHY_HWIRQ); else netdev_warn(dev->net, "unexpected interrupt, intdata=3D0x%08X\n", intdata); + + local_irq_restore(flags); } =20 /* Enable or disable Tx & Rx checksum offload engines */ @@ -1072,8 +1086,9 @@ static int smsc95xx_bind(struct usbnet *dev, struct u= sb_interface *intf) { struct smsc95xx_priv *pdata; bool is_internal_phy; + char usb_path[64]; + int ret, phy_irq; u32 val; - int ret; =20 printk(KERN_INFO SMSC_CHIPNAME " v" SMSC_DRIVER_VERSION "\n"); =20 @@ -1113,10 +1128,38 @@ static int smsc95xx_bind(struct usbnet *dev, struct= usb_interface *intf) if (ret) goto free_pdata; =20 + /* create irq domain for use by PHY driver and GPIO consumers */ + usb_make_path(dev->udev, usb_path, sizeof(usb_path)); + pdata->irqfwnode =3D irq_domain_alloc_named_fwnode(usb_path); + if (!pdata->irqfwnode) { + ret =3D -ENOMEM; + goto free_pdata; + } + + pdata->irqdomain =3D irq_domain_create_linear(pdata->irqfwnode, + SMSC95XX_NR_IRQS, + &irq_domain_simple_ops, + pdata); + if (!pdata->irqdomain) { + ret =3D -ENOMEM; + goto free_irqfwnode; + } + + phy_irq =3D irq_create_mapping(pdata->irqdomain, PHY_HWIRQ); + if (!phy_irq) { + ret =3D -ENOENT; + goto remove_irqdomain; + } + + pdata->irqchip =3D dummy_irq_chip; + pdata->irqchip.name =3D SMSC_CHIPNAME; + irq_set_chip_and_handler_name(phy_irq, &pdata->irqchip, + handle_simple_irq, "phy"); + pdata->mdiobus =3D mdiobus_alloc(); if (!pdata->mdiobus) { ret =3D -ENOMEM; - goto free_pdata; + goto dispose_irq; } =20 ret =3D smsc95xx_read_reg(dev, HW_CFG, &val); @@ -1149,6 +1192,7 @@ static int smsc95xx_bind(struct usbnet *dev, struct u= sb_interface *intf) goto unregister_mdio; } =20 + pdata->phydev->irq =3D phy_irq; pdata->phydev->is_internal =3D is_internal_phy; =20 /* detect device revision as different features may be available */ @@ -1191,6 +1235,15 @@ static int smsc95xx_bind(struct usbnet *dev, struct = usb_interface *intf) free_mdio: mdiobus_free(pdata->mdiobus); =20 +dispose_irq: + irq_dispose_mapping(phy_irq); + +remove_irqdomain: + irq_domain_remove(pdata->irqdomain); + +free_irqfwnode: + irq_domain_free_fwnode(pdata->irqfwnode); + free_pdata: kfree(pdata); return ret; @@ -1203,6 +1256,9 @@ static void smsc95xx_unbind(struct usbnet *dev, struc= t usb_interface *intf) phy_disconnect(dev->net->phydev); mdiobus_unregister(pdata->mdiobus); mdiobus_free(pdata->mdiobus); + irq_dispose_mapping(irq_find_mapping(pdata->irqdomain, PHY_HWIRQ)); + irq_domain_remove(pdata->irqdomain); + irq_domain_free_fwnode(pdata->irqfwnode); netif_dbg(dev, ifdown, dev->net, "free pdata\n"); kfree(pdata); } @@ -1227,29 +1283,6 @@ static u32 smsc_crc(const u8 *buffer, size_t len, in= t filter) return crc << ((filter % 2) * 16); } =20 -static int smsc95xx_enable_phy_wakeup_interrupts(struct usbnet *dev, u16 m= ask) -{ - int ret; - - netdev_dbg(dev->net, "enabling PHY wakeup interrupts\n"); - - /* read to clear */ - ret =3D smsc95xx_mdio_read_nopm(dev, PHY_INT_SRC); - if (ret < 0) - return ret; - - /* enable interrupt source */ - ret =3D smsc95xx_mdio_read_nopm(dev, PHY_INT_MASK); - if (ret < 0) - return ret; - - ret |=3D mask; - - smsc95xx_mdio_write_nopm(dev, PHY_INT_MASK, ret); - - return 0; -} - static int smsc95xx_link_ok_nopm(struct usbnet *dev) { int ret; @@ -1416,7 +1449,6 @@ static int smsc95xx_enter_suspend3(struct usbnet *dev) static int smsc95xx_autosuspend(struct usbnet *dev, u32 link_up) { struct smsc95xx_priv *pdata =3D dev->driver_priv; - int ret; =20 if (!netif_running(dev->net)) { /* interface is ifconfig down so fully power down hw */ @@ -1435,27 +1467,10 @@ static int smsc95xx_autosuspend(struct usbnet *dev,= u32 link_up) } =20 netdev_dbg(dev->net, "autosuspend entering SUSPEND1\n"); - - /* enable PHY wakeup events for if cable is attached */ - ret =3D smsc95xx_enable_phy_wakeup_interrupts(dev, - PHY_INT_MASK_ANEG_COMP_); - if (ret < 0) { - netdev_warn(dev->net, "error enabling PHY wakeup ints\n"); - return ret; - } - netdev_info(dev->net, "entering SUSPEND1 mode\n"); return smsc95xx_enter_suspend1(dev); } =20 - /* enable PHY wakeup events so we remote wakeup if cable is pulled */ - ret =3D smsc95xx_enable_phy_wakeup_interrupts(dev, - PHY_INT_MASK_LINK_DOWN_); - if (ret < 0) { - netdev_warn(dev->net, "error enabling PHY wakeup ints\n"); - return ret; - } - netdev_dbg(dev->net, "autosuspend entering SUSPEND3\n"); return smsc95xx_enter_suspend3(dev); } @@ -1521,13 +1536,6 @@ static int smsc95xx_suspend(struct usb_interface *in= tf, pm_message_t message) } =20 if (pdata->wolopts & WAKE_PHY) { - ret =3D smsc95xx_enable_phy_wakeup_interrupts(dev, - (PHY_INT_MASK_ANEG_COMP_ | PHY_INT_MASK_LINK_DOWN_)); - if (ret < 0) { - netdev_warn(dev->net, "error enabling PHY wakeup ints\n"); - goto done; - } - /* if link is down then configure EDPD and enter SUSPEND1, * otherwise enter SUSPEND0 below */ @@ -1761,11 +1769,12 @@ static int smsc95xx_resume(struct usb_interface *in= tf) return ret; } =20 + phy_init_hw(pdata->phydev); + ret =3D usbnet_resume(intf); if (ret < 0) netdev_warn(dev->net, "usbnet_resume error\n"); =20 - phy_init_hw(pdata->phydev); return ret; } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C6F6C00140 for ; Mon, 15 Aug 2022 19:54:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345572AbiHOTyh (ORCPT ); Mon, 15 Aug 2022 15:54:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43008 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344856AbiHOTxX (ORCPT ); Mon, 15 Aug 2022 15:53:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 093D343E62; Mon, 15 Aug 2022 11:51: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 AA86FB81057; Mon, 15 Aug 2022 18:51:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F25AFC433C1; Mon, 15 Aug 2022 18:51:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589470; bh=xwqlsyLT4+wEgeoymS/IaazHbOUWacD/OGFbiM81irw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CtUARHuty1oB7hPZSiN7qfBGf+OZdSySdMlOMpRKNV1znHxRlpi/uaAf9NGE/zEyD o/Cfz15SoPJ4hFI9nTQKnv1Dyiq4TupiELO9Yv071O66riaxuKqjPw8ez4ZOp4j23b pYd0edt6oi575nyUKZSX8bJKr7X0LmBvQgkjN34A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Wunner , Andre Edich , "David S. Miller" , Sasha Levin Subject: [PATCH 5.15 698/779] usbnet: smsc95xx: Fix deadlock on runtime resume Date: Mon, 15 Aug 2022 20:05:42 +0200 Message-Id: <20220815180407.188032005@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 7b960c967f2aa01ab8f45c5a0bd78e754cffdeee ] Commit 05b35e7eb9a1 ("smsc95xx: add phylib support") amended smsc95xx_resume() to call phy_init_hw(). That function waits for the device to runtime resume even though it is placed in the runtime resume path, causing a deadlock. The problem is that phy_init_hw() calls down to smsc95xx_mdiobus_read(), which never uses the _nopm variant of usbnet_read_cmd(). Commit b4df480f68ae ("usbnet: smsc95xx: add reset_resume function with reset operation") causes a similar deadlock on resume if the device was already runtime suspended when entering system sleep: That's because the commit introduced smsc95xx_reset_resume(), which calls down to smsc95xx_reset(), which neglects to use _nopm accessors. Fix by auto-detecting whether a device access is performed by the suspend/resume task_struct and use the _nopm variant if so. This works because the PM core guarantees that suspend/resume callbacks are run in task context. Stacktrace for posterity: INFO: task kworker/2:1:49 blocked for more than 122 seconds. Workqueue: usb_hub_wq hub_event schedule rpm_resume __pm_runtime_resume usb_autopm_get_interface usbnet_read_cmd __smsc95xx_read_reg __smsc95xx_phy_wait_not_busy __smsc95xx_mdio_read smsc95xx_mdiobus_read __mdiobus_read mdiobus_read smsc_phy_reset phy_init_hw smsc95xx_resume usb_resume_interface usb_resume_both usb_runtime_resume __rpm_callback rpm_callback rpm_resume __pm_runtime_resume usb_autoresume_device hub_event process_one_work Fixes: b4df480f68ae ("usbnet: smsc95xx: add reset_resume function with rese= t operation") Signed-off-by: Lukas Wunner Cc: stable@vger.kernel.org # v3.16+ Cc: Andre Edich Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/usb/smsc95xx.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index 3eb62197c2f5..460e90eb528f 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c @@ -69,6 +69,7 @@ struct smsc95xx_priv { struct fwnode_handle *irqfwnode; struct mii_bus *mdiobus; struct phy_device *phydev; + struct task_struct *pm_task; }; =20 static bool turbo_mode =3D true; @@ -78,13 +79,14 @@ MODULE_PARM_DESC(turbo_mode, "Enable multiple frames pe= r Rx transaction"); static int __must_check __smsc95xx_read_reg(struct usbnet *dev, u32 index, u32 *data, int in_pm) { + struct smsc95xx_priv *pdata =3D dev->driver_priv; u32 buf; int ret; int (*fn)(struct usbnet *, u8, u8, u16, u16, void *, u16); =20 BUG_ON(!dev); =20 - if (!in_pm) + if (current !=3D pdata->pm_task) fn =3D usbnet_read_cmd; else fn =3D usbnet_read_cmd_nopm; @@ -108,13 +110,14 @@ static int __must_check __smsc95xx_read_reg(struct us= bnet *dev, u32 index, static int __must_check __smsc95xx_write_reg(struct usbnet *dev, u32 index, u32 data, int in_pm) { + struct smsc95xx_priv *pdata =3D dev->driver_priv; u32 buf; int ret; int (*fn)(struct usbnet *, u8, u8, u16, u16, const void *, u16); =20 BUG_ON(!dev); =20 - if (!in_pm) + if (current !=3D pdata->pm_task) fn =3D usbnet_write_cmd; else fn =3D usbnet_write_cmd_nopm; @@ -1482,9 +1485,12 @@ static int smsc95xx_suspend(struct usb_interface *in= tf, pm_message_t message) u32 val, link_up; int ret; =20 + pdata->pm_task =3D current; + ret =3D usbnet_suspend(intf, message); if (ret < 0) { netdev_warn(dev->net, "usbnet_suspend error\n"); + pdata->pm_task =3D NULL; return ret; } =20 @@ -1724,6 +1730,7 @@ static int smsc95xx_suspend(struct usb_interface *int= f, pm_message_t message) if (ret && PMSG_IS_AUTO(message)) usbnet_resume(intf); =20 + pdata->pm_task =3D NULL; return ret; } =20 @@ -1744,29 +1751,31 @@ static int smsc95xx_resume(struct usb_interface *in= tf) /* do this first to ensure it's cleared even in error case */ pdata->suspend_flags =3D 0; =20 + pdata->pm_task =3D current; + if (suspend_flags & SUSPEND_ALLMODES) { /* clear wake-up sources */ ret =3D smsc95xx_read_reg_nopm(dev, WUCSR, &val); if (ret < 0) - return ret; + goto done; =20 val &=3D ~(WUCSR_WAKE_EN_ | WUCSR_MPEN_); =20 ret =3D smsc95xx_write_reg_nopm(dev, WUCSR, val); if (ret < 0) - return ret; + goto done; =20 /* clear wake-up status */ ret =3D smsc95xx_read_reg_nopm(dev, PM_CTRL, &val); if (ret < 0) - return ret; + goto done; =20 val &=3D ~PM_CTL_WOL_EN_; val |=3D PM_CTL_WUPS_; =20 ret =3D smsc95xx_write_reg_nopm(dev, PM_CTRL, val); if (ret < 0) - return ret; + goto done; } =20 phy_init_hw(pdata->phydev); @@ -1775,15 +1784,20 @@ static int smsc95xx_resume(struct usb_interface *in= tf) if (ret < 0) netdev_warn(dev->net, "usbnet_resume error\n"); =20 +done: + pdata->pm_task =3D NULL; return ret; } =20 static int smsc95xx_reset_resume(struct usb_interface *intf) { struct usbnet *dev =3D usb_get_intfdata(intf); + struct smsc95xx_priv *pdata =3D dev->driver_priv; int ret; =20 + pdata->pm_task =3D current; ret =3D smsc95xx_reset(dev); + pdata->pm_task =3D NULL; if (ret < 0) return ret; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03E80C00140 for ; Mon, 15 Aug 2022 19:54:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345579AbiHOTyl (ORCPT ); Mon, 15 Aug 2022 15:54:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345167AbiHOTxZ (ORCPT ); Mon, 15 Aug 2022 15:53: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 37DBD43E76; Mon, 15 Aug 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 EFFDCB81057; Mon, 15 Aug 2022 18:51:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3CB2BC433D6; Mon, 15 Aug 2022 18:51:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589473; bh=PYKDtfJN7xItE80ybdVMebvz/REKeuxmoiaYOjlu43Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H8iwITNrPjUhSTw1reZe99V4TnnJFNHrJDlBeeqktXj8HXaAiM/4IIS9aGqTBzd/a HDywSR8eCmIO5m9YTDeDkTjprNHHPLrZ21PbD+kpp5J4KunitrPvWItSKLyEZWtpv9 NgyGAcRHscPgXRNGxYfftkMA5bhEg88zaa4TxwFk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, huhai , Jackie Liu , Sudeep Holla , Sasha Levin Subject: [PATCH 5.15 699/779] firmware: arm_scpi: Ensure scpi_info is not assigned if the probe fails Date: Mon, 15 Aug 2022 20:05:43 +0200 Message-Id: <20220815180407.238598936@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sudeep Holla [ Upstream commit 689640efc0a2c4e07e6f88affe6d42cd40cc3f85 ] When scpi probe fails, at any point, we need to ensure that the scpi_info is not set and will remain NULL until the probe succeeds. If it is not taken care, then it could result use-after-free as the value is exported via get_scpi_ops() and could refer to a memory allocated via devm_kzalloc() but freed when the probe fails. Link: https://lore.kernel.org/r/20220701160310.148344-1-sudeep.holla@arm.com Cc: stable@vger.kernel.org # 4.19+ Reported-by: huhai Reviewed-by: Jackie Liu Signed-off-by: Sudeep Holla Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/firmware/arm_scpi.c | 61 +++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a/drivers/firmware/arm_scpi.c b/drivers/firmware/arm_scpi.c index ddf0b9ff9e15..435d0e2658a4 100644 --- a/drivers/firmware/arm_scpi.c +++ b/drivers/firmware/arm_scpi.c @@ -815,7 +815,7 @@ static int scpi_init_versions(struct scpi_drvinfo *info) info->firmware_version =3D le32_to_cpu(caps.platform_version); } /* Ignore error if not implemented */ - if (scpi_info->is_legacy && ret =3D=3D -EOPNOTSUPP) + if (info->is_legacy && ret =3D=3D -EOPNOTSUPP) return 0; =20 return ret; @@ -913,13 +913,14 @@ static int scpi_probe(struct platform_device *pdev) struct resource res; struct device *dev =3D &pdev->dev; struct device_node *np =3D dev->of_node; + struct scpi_drvinfo *scpi_drvinfo; =20 - scpi_info =3D devm_kzalloc(dev, sizeof(*scpi_info), GFP_KERNEL); - if (!scpi_info) + scpi_drvinfo =3D devm_kzalloc(dev, sizeof(*scpi_drvinfo), GFP_KERNEL); + if (!scpi_drvinfo) return -ENOMEM; =20 if (of_match_device(legacy_scpi_of_match, &pdev->dev)) - scpi_info->is_legacy =3D true; + scpi_drvinfo->is_legacy =3D true; =20 count =3D of_count_phandle_with_args(np, "mboxes", "#mbox-cells"); if (count < 0) { @@ -927,19 +928,19 @@ static int scpi_probe(struct platform_device *pdev) return -ENODEV; } =20 - scpi_info->channels =3D devm_kcalloc(dev, count, sizeof(struct scpi_chan), - GFP_KERNEL); - if (!scpi_info->channels) + scpi_drvinfo->channels =3D + devm_kcalloc(dev, count, sizeof(struct scpi_chan), GFP_KERNEL); + if (!scpi_drvinfo->channels) return -ENOMEM; =20 - ret =3D devm_add_action(dev, scpi_free_channels, scpi_info); + ret =3D devm_add_action(dev, scpi_free_channels, scpi_drvinfo); if (ret) return ret; =20 - for (; scpi_info->num_chans < count; scpi_info->num_chans++) { + for (; scpi_drvinfo->num_chans < count; scpi_drvinfo->num_chans++) { resource_size_t size; - int idx =3D scpi_info->num_chans; - struct scpi_chan *pchan =3D scpi_info->channels + idx; + int idx =3D scpi_drvinfo->num_chans; + struct scpi_chan *pchan =3D scpi_drvinfo->channels + idx; struct mbox_client *cl =3D &pchan->cl; struct device_node *shmem =3D of_parse_phandle(np, "shmem", idx); =20 @@ -986,45 +987,53 @@ static int scpi_probe(struct platform_device *pdev) return ret; } =20 - scpi_info->commands =3D scpi_std_commands; + scpi_drvinfo->commands =3D scpi_std_commands; =20 - platform_set_drvdata(pdev, scpi_info); + platform_set_drvdata(pdev, scpi_drvinfo); =20 - if (scpi_info->is_legacy) { + if (scpi_drvinfo->is_legacy) { /* Replace with legacy variants */ scpi_ops.clk_set_val =3D legacy_scpi_clk_set_val; - scpi_info->commands =3D scpi_legacy_commands; + scpi_drvinfo->commands =3D scpi_legacy_commands; =20 /* Fill priority bitmap */ for (idx =3D 0; idx < ARRAY_SIZE(legacy_hpriority_cmds); idx++) set_bit(legacy_hpriority_cmds[idx], - scpi_info->cmd_priority); + scpi_drvinfo->cmd_priority); } =20 - ret =3D scpi_init_versions(scpi_info); + scpi_info =3D scpi_drvinfo; + + ret =3D scpi_init_versions(scpi_drvinfo); if (ret) { dev_err(dev, "incorrect or no SCP firmware found\n"); + scpi_info =3D NULL; return ret; } =20 - if (scpi_info->is_legacy && !scpi_info->protocol_version && - !scpi_info->firmware_version) + if (scpi_drvinfo->is_legacy && !scpi_drvinfo->protocol_version && + !scpi_drvinfo->firmware_version) dev_info(dev, "SCP Protocol legacy pre-1.0 firmware\n"); else dev_info(dev, "SCP Protocol %lu.%lu Firmware %lu.%lu.%lu version\n", FIELD_GET(PROTO_REV_MAJOR_MASK, - scpi_info->protocol_version), + scpi_drvinfo->protocol_version), FIELD_GET(PROTO_REV_MINOR_MASK, - scpi_info->protocol_version), + scpi_drvinfo->protocol_version), FIELD_GET(FW_REV_MAJOR_MASK, - scpi_info->firmware_version), + scpi_drvinfo->firmware_version), FIELD_GET(FW_REV_MINOR_MASK, - scpi_info->firmware_version), + scpi_drvinfo->firmware_version), FIELD_GET(FW_REV_PATCH_MASK, - scpi_info->firmware_version)); - scpi_info->scpi_ops =3D &scpi_ops; + scpi_drvinfo->firmware_version)); + + scpi_drvinfo->scpi_ops =3D &scpi_ops; =20 - return devm_of_platform_populate(dev); + ret =3D devm_of_platform_populate(dev); + if (ret) + scpi_info =3D NULL; + + return ret; } =20 static const struct of_device_id scpi_of_match[] =3D { --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40A0EC282E7 for ; Mon, 15 Aug 2022 19:54:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243503AbiHOTyr (ORCPT ); Mon, 15 Aug 2022 15:54:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345281AbiHOTxZ (ORCPT ); Mon, 15 Aug 2022 15:53: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 1901B45047; Mon, 15 Aug 2022 11:51:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 98A8D611F9; Mon, 15 Aug 2022 18:51:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54DE7C433D6; Mon, 15 Aug 2022 18:51:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589477; bh=dKazzpAFWzOaHCSaPPCObbfczVjo3Xo3sjYmNNBL5rM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DTOEbBQDIFq0coPmVBJ01LDDXujiulgkWWIfBCD0j1L0tkZlUuu2opoqj+UO7eeSH NitBltswKzNkYK5Ic6auGHQ7r1SWPW4l5ee6AzHgre6FjmAKychTFR3vhkTDdSj/5r M8C9VwpIXKddLXvS4cD94nDT5VwwvfqsAlRTo4d4= 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.15 700/779] scsi: lpfc: Fix EEH support for NVMe I/O Date: Mon, 15 Aug 2022 20:05:44 +0200 Message-Id: <20220815180407.290844270@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 25ac2c970be32993f1dff607f8354f3c053d42bc ] Injecting errors on the PCI slot while the driver is handling NVMe I/O will cause crashes and hangs. There are several rather difficult scenarios occurring. The main issue is that the adapter can report a PCI error before or simultaneously to the PCI subsystem reporting the error. Both paths have different entry points and currently there is no interlock between them. Thus multiple teardown paths are competing and all heck breaks loose. Complicating things is the NVMs path. To a large degree, I/O was able to be shutdown for a full FC port on the SCSI stack. But on NVMe, there isn't a similar call. At best, it works on a per-controller basis, but even at the controller level, it's a controller "reset" call. All of which means I/O is still flowing on different CPUs with reset paths expecting hw access (mailbox commands) to execute properly. The following modifications are made: - A new flag is set in PCI error entrypoints so the driver can track being called by that path. - An interlock is added in the SLI hw error path and the PCI error path such that only one of the paths proceeds with the teardown logic. - RPI cleanup is patched such that RPIs are marked unregistered w/o mbx cmds in cases of hw error. - If entering the SLI port re-init calls, a case where SLI error teardown was quick and beat the PCI calls now reporting error, check whether the SLI port is still live on the PCI bus. - In the PCI reset code to bring the adapter back, recheck the IRQ settings. Different checks for SLI3 vs SLI4. - In I/O completions, that may be called as part of the cleanup or underway just before the hw error, check the state of the adapter. If in error, shortcut handling that would expect further adapter completions as the hw error won't be sending them. - In routines waiting on I/O completions, which may have been in progress prior to the hw error, detect the device is being torn down and abort from their waits and just give up. This points to a larger issue in the driver on ref-counting for data structures, as it doesn't have ref-counting on q and port structures. We'll do this fix for now as it would be a major rework to be done differently. - Fix the NVMe cleanup to simulate NVMe I/O completions if I/O is being failed back due to hw error. - In I/O buf allocation, done at the start of new I/Os, check hw state and fail if hw error. Link: https://lore.kernel.org/r/20210910233159.115896-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 Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/lpfc/lpfc.h | 1 + drivers/scsi/lpfc/lpfc_hbadisc.c | 1 + drivers/scsi/lpfc/lpfc_init.c | 31 +++++++++++++++- drivers/scsi/lpfc/lpfc_nvme.c | 53 ++++++++++++++++++++++++++- drivers/scsi/lpfc/lpfc_scsi.c | 63 +++++++++++++++++++++----------- drivers/scsi/lpfc/lpfc_sli.c | 31 +++++++++++++++- drivers/scsi/lpfc/lpfc_sli4.h | 2 + 7 files changed, 154 insertions(+), 28 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index 1044832b6054..b2508a00bafd 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -1028,6 +1028,7 @@ struct lpfc_hba { * Firmware supports Forced Link Speed * capability */ +#define HBA_PCI_ERR 0x80000 /* The PCI slot is offline */ #define HBA_FLOGI_ISSUED 0x100000 /* FLOGI was issued */ #define HBA_CGN_RSVD1 0x200000 /* Reserved CGN flag */ #define HBA_CGN_DAY_WRAP 0x400000 /* HBA Congestion info day wraps */ diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbad= isc.c index 3bb7c2aa949f..4bb0a15cfcc0 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -5349,6 +5349,7 @@ lpfc_unreg_rpi(struct lpfc_vport *vport, struct lpfc_= nodelist *ndlp) =20 rc =3D lpfc_sli_issue_mbox(phba, mbox, MBX_NOWAIT); if (rc =3D=3D MBX_NOT_FINISHED) { + ndlp->nlp_flag &=3D ~NLP_UNREG_INP; mempool_free(mbox, phba->mbox_mem_pool); acc_plogi =3D 1; } diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index a2694fb32b5d..cda571393a5f 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -1606,6 +1606,11 @@ void lpfc_sli4_offline_eratt(struct lpfc_hba *phba) { spin_lock_irq(&phba->hbalock); + if (phba->link_state =3D=3D LPFC_HBA_ERROR && + phba->hba_flag & HBA_PCI_ERR) { + spin_unlock_irq(&phba->hbalock); + return; + } phba->link_state =3D LPFC_HBA_ERROR; spin_unlock_irq(&phba->hbalock); =20 @@ -1945,7 +1950,6 @@ lpfc_handle_eratt_s4(struct lpfc_hba *phba) if (pci_channel_offline(phba->pcidev)) { lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, "3166 pci channel is offline\n"); - lpfc_sli4_offline_eratt(phba); return; } =20 @@ -3643,6 +3647,7 @@ lpfc_offline_prep(struct lpfc_hba *phba, int mbx_acti= on) struct lpfc_vport **vports; struct Scsi_Host *shost; int i; + int offline =3D 0; =20 if (vport->fc_flag & FC_OFFLINE_MODE) return; @@ -3651,6 +3656,8 @@ lpfc_offline_prep(struct lpfc_hba *phba, int mbx_acti= on) =20 lpfc_linkdown(phba); =20 + offline =3D pci_channel_offline(phba->pcidev); + /* Issue an unreg_login to all nodes on all vports */ vports =3D lpfc_create_vport_work_array(phba); if (vports !=3D NULL) { @@ -3673,7 +3680,14 @@ lpfc_offline_prep(struct lpfc_hba *phba, int mbx_act= ion) ndlp->nlp_flag &=3D ~NLP_NPR_ADISC; spin_unlock_irq(&ndlp->lock); =20 - lpfc_unreg_rpi(vports[i], ndlp); + if (offline) { + spin_lock_irq(&ndlp->lock); + ndlp->nlp_flag &=3D ~(NLP_UNREG_INP | + NLP_RPI_REGISTERED); + spin_unlock_irq(&ndlp->lock); + } else { + lpfc_unreg_rpi(vports[i], ndlp); + } /* * Whenever an SLI4 port goes offline, free the * RPI. Get a new RPI when the adapter port @@ -14070,6 +14084,10 @@ lpfc_pci_resume_one_s3(struct device *dev_d) return error; } =20 + /* Init cpu_map array */ + lpfc_cpu_map_array_init(phba); + /* Init hba_eq_hdl array */ + lpfc_hba_eq_hdl_array_init(phba); /* Configure and enable interrupt */ intr_mode =3D lpfc_sli_enable_intr(phba, phba->intr_mode); if (intr_mode =3D=3D LPFC_INTR_ERROR) { @@ -15023,14 +15041,17 @@ lpfc_io_error_detected_s4(struct pci_dev *pdev, p= ci_channel_state_t state) lpfc_sli4_prep_dev_for_recover(phba); return PCI_ERS_RESULT_CAN_RECOVER; case pci_channel_io_frozen: + phba->hba_flag |=3D HBA_PCI_ERR; /* Fatal error, prepare for slot reset */ lpfc_sli4_prep_dev_for_reset(phba); return PCI_ERS_RESULT_NEED_RESET; case pci_channel_io_perm_failure: + phba->hba_flag |=3D HBA_PCI_ERR; /* Permanent failure, prepare for device down */ lpfc_sli4_prep_dev_for_perm_failure(phba); return PCI_ERS_RESULT_DISCONNECT; default: + phba->hba_flag |=3D HBA_PCI_ERR; /* Unknown state, prepare and request slot reset */ lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, "2825 Unknown PCI error state: x%x\n", state); @@ -15074,6 +15095,7 @@ lpfc_io_slot_reset_s4(struct pci_dev *pdev) =20 pci_restore_state(pdev); =20 + phba->hba_flag &=3D ~HBA_PCI_ERR; /* * As the new kernel behavior of pci_restore_state() API call clears * device saved_state flag, need to save the restored state again. @@ -15098,6 +15120,7 @@ lpfc_io_slot_reset_s4(struct pci_dev *pdev) return PCI_ERS_RESULT_DISCONNECT; } else phba->intr_mode =3D intr_mode; + lpfc_cpu_affinity_check(phba, phba->cfg_irq_chann); =20 /* Log the current active interrupt mode */ lpfc_log_intr_mode(phba, phba->intr_mode); @@ -15299,6 +15322,10 @@ lpfc_io_error_detected(struct pci_dev *pdev, pci_c= hannel_state_t state) struct lpfc_hba *phba =3D ((struct lpfc_vport *)shost->hostdata)->phba; pci_ers_result_t rc =3D PCI_ERS_RESULT_DISCONNECT; =20 + if (phba->link_state =3D=3D LPFC_HBA_ERROR && + phba->hba_flag & HBA_IOQ_FLUSH) + return PCI_ERS_RESULT_NEED_RESET; + switch (phba->pci_dev_grp) { case LPFC_PCI_DEV_LP: rc =3D lpfc_io_error_detected_s3(pdev, state); diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c index 4fb3dc5092f5..4e0c0b273e5f 100644 --- a/drivers/scsi/lpfc/lpfc_nvme.c +++ b/drivers/scsi/lpfc/lpfc_nvme.c @@ -937,6 +937,7 @@ lpfc_nvme_io_cmd_wqe_cmpl(struct lpfc_hba *phba, struct= lpfc_iocbq *pwqeIn, #ifdef CONFIG_SCSI_LPFC_DEBUG_FS int cpu; #endif + int offline =3D 0; =20 /* Sanity check on return of outstanding command */ if (!lpfc_ncmd) { @@ -1098,11 +1099,12 @@ lpfc_nvme_io_cmd_wqe_cmpl(struct lpfc_hba *phba, st= ruct lpfc_iocbq *pwqeIn, nCmd->transferred_length =3D 0; nCmd->rcv_rsplen =3D 0; nCmd->status =3D NVME_SC_INTERNAL; + offline =3D pci_channel_offline(vport->phba->pcidev); } } =20 /* pick up SLI4 exhange busy condition */ - if (bf_get(lpfc_wcqe_c_xb, wcqe)) + if (bf_get(lpfc_wcqe_c_xb, wcqe) && !offline) lpfc_ncmd->flags |=3D LPFC_SBUF_XBUSY; else lpfc_ncmd->flags &=3D ~LPFC_SBUF_XBUSY; @@ -2174,6 +2176,10 @@ lpfc_nvme_lport_unreg_wait(struct lpfc_vport *vport, abts_nvme =3D 0; for (i =3D 0; i < phba->cfg_hdw_queue; i++) { qp =3D &phba->sli4_hba.hdwq[i]; + if (!vport || !vport->localport || + !qp || !qp->io_wq) + return; + pring =3D qp->io_wq->pring; if (!pring) continue; @@ -2181,6 +2187,10 @@ lpfc_nvme_lport_unreg_wait(struct lpfc_vport *vport, abts_scsi +=3D qp->abts_scsi_io_bufs; abts_nvme +=3D qp->abts_nvme_io_bufs; } + if (!vport || !vport->localport || + vport->phba->hba_flag & HBA_PCI_ERR) + return; + lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, "6176 Lport x%px Localport x%px wait " "timed out. Pending %d [%d:%d]. " @@ -2220,6 +2230,8 @@ lpfc_nvme_destroy_localport(struct lpfc_vport *vport) return; =20 localport =3D vport->localport; + if (!localport) + return; lport =3D (struct lpfc_nvme_lport *)localport->private; =20 lpfc_printf_vlog(vport, KERN_INFO, LOG_NVME, @@ -2536,7 +2548,8 @@ lpfc_nvme_unregister_port(struct lpfc_vport *vport, s= truct lpfc_nodelist *ndlp) * return values is ignored. The upcall is a courtesy to the * transport. */ - if (vport->load_flag & FC_UNLOADING) + if (vport->load_flag & FC_UNLOADING || + unlikely(vport->phba->hba_flag & HBA_PCI_ERR)) (void)nvme_fc_set_remoteport_devloss(remoteport, 0); =20 ret =3D nvme_fc_unregister_remoteport(remoteport); @@ -2564,6 +2577,42 @@ lpfc_nvme_unregister_port(struct lpfc_vport *vport, = struct lpfc_nodelist *ndlp) vport->localport, ndlp->rport, ndlp->nlp_DID); } =20 +/** + * lpfc_sli4_nvme_pci_offline_aborted - Fast-path process of NVME xri abort + * @phba: pointer to lpfc hba data structure. + * @lpfc_ncmd: The nvme job structure for the request being aborted. + * + * This routine is invoked by the worker thread to process a SLI4 fast-path + * NVME aborted xri. Aborted NVME IO commands are completed to the transp= ort + * here. + **/ +void +lpfc_sli4_nvme_pci_offline_aborted(struct lpfc_hba *phba, + struct lpfc_io_buf *lpfc_ncmd) +{ + struct nvmefc_fcp_req *nvme_cmd =3D NULL; + + lpfc_printf_log(phba, KERN_INFO, LOG_NVME_ABTS, + "6533 %s nvme_cmd %p tag x%x abort complete and " + "xri released\n", __func__, + lpfc_ncmd->nvmeCmd, + lpfc_ncmd->cur_iocbq.iotag); + + /* Aborted NVME commands are required to not complete + * before the abort exchange command fully completes. + * Once completed, it is available via the put list. + */ + if (lpfc_ncmd->nvmeCmd) { + nvme_cmd =3D lpfc_ncmd->nvmeCmd; + nvme_cmd->transferred_length =3D 0; + nvme_cmd->rcv_rsplen =3D 0; + nvme_cmd->status =3D NVME_SC_INTERNAL; + nvme_cmd->done(nvme_cmd); + lpfc_ncmd->nvmeCmd =3D NULL; + } + lpfc_release_nvme_buf(phba, lpfc_ncmd); +} + /** * lpfc_sli4_nvme_xri_aborted - Fast-path process of NVME xri abort * @phba: pointer to lpfc hba data structure. diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index c6944b282e21..ea93b7e07b7e 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -493,8 +493,8 @@ void lpfc_sli4_io_xri_aborted(struct lpfc_hba *phba, struct sli4_wcqe_xri_aborted *axri, int idx) { - uint16_t xri =3D bf_get(lpfc_wcqe_xa_xri, axri); - uint16_t rxid =3D bf_get(lpfc_wcqe_xa_remote_xid, axri); + u16 xri =3D 0; + u16 rxid =3D 0; struct lpfc_io_buf *psb, *next_psb; struct lpfc_sli4_hdw_queue *qp; unsigned long iflag =3D 0; @@ -504,15 +504,22 @@ lpfc_sli4_io_xri_aborted(struct lpfc_hba *phba, int rrq_empty =3D 0; struct lpfc_sli_ring *pring =3D phba->sli4_hba.els_wq->pring; struct scsi_cmnd *cmd; + int offline =3D 0; =20 if (!(phba->cfg_enable_fc4_type & LPFC_ENABLE_FCP)) return; - + offline =3D pci_channel_offline(phba->pcidev); + if (!offline) { + xri =3D bf_get(lpfc_wcqe_xa_xri, axri); + rxid =3D bf_get(lpfc_wcqe_xa_remote_xid, axri); + } qp =3D &phba->sli4_hba.hdwq[idx]; spin_lock_irqsave(&phba->hbalock, iflag); spin_lock(&qp->abts_io_buf_list_lock); list_for_each_entry_safe(psb, next_psb, &qp->lpfc_abts_io_buf_list, list) { + if (offline) + xri =3D psb->cur_iocbq.sli4_xritag; if (psb->cur_iocbq.sli4_xritag =3D=3D xri) { list_del_init(&psb->list); psb->flags &=3D ~LPFC_SBUF_XBUSY; @@ -521,8 +528,15 @@ lpfc_sli4_io_xri_aborted(struct lpfc_hba *phba, qp->abts_nvme_io_bufs--; spin_unlock(&qp->abts_io_buf_list_lock); spin_unlock_irqrestore(&phba->hbalock, iflag); - lpfc_sli4_nvme_xri_aborted(phba, axri, psb); - return; + if (!offline) { + lpfc_sli4_nvme_xri_aborted(phba, axri, + psb); + return; + } + lpfc_sli4_nvme_pci_offline_aborted(phba, psb); + spin_lock_irqsave(&phba->hbalock, iflag); + spin_lock(&qp->abts_io_buf_list_lock); + continue; } qp->abts_scsi_io_bufs--; spin_unlock(&qp->abts_io_buf_list_lock); @@ -534,13 +548,13 @@ lpfc_sli4_io_xri_aborted(struct lpfc_hba *phba, =20 rrq_empty =3D list_empty(&phba->active_rrq_list); spin_unlock_irqrestore(&phba->hbalock, iflag); - if (ndlp) { + if (ndlp && !offline) { lpfc_set_rrq_active(phba, ndlp, psb->cur_iocbq.sli4_lxritag, rxid, 1); lpfc_sli4_abts_err_handler(phba, ndlp, axri); } =20 - if (phba->cfg_fcp_wait_abts_rsp) { + if (phba->cfg_fcp_wait_abts_rsp || offline) { spin_lock_irqsave(&psb->buf_lock, iflag); cmd =3D psb->pCmd; psb->pCmd =3D NULL; @@ -567,25 +581,30 @@ lpfc_sli4_io_xri_aborted(struct lpfc_hba *phba, lpfc_release_scsi_buf_s4(phba, psb); if (rrq_empty) lpfc_worker_wake_up(phba); - return; + if (!offline) + return; + spin_lock_irqsave(&phba->hbalock, iflag); + spin_lock(&qp->abts_io_buf_list_lock); + continue; } } spin_unlock(&qp->abts_io_buf_list_lock); - for (i =3D 1; i <=3D phba->sli.last_iotag; i++) { - iocbq =3D phba->sli.iocbq_lookup[i]; - - if (!(iocbq->iocb_flag & LPFC_IO_FCP) || - (iocbq->iocb_flag & LPFC_IO_LIBDFC)) - continue; - if (iocbq->sli4_xritag !=3D xri) - continue; - psb =3D container_of(iocbq, struct lpfc_io_buf, cur_iocbq); - psb->flags &=3D ~LPFC_SBUF_XBUSY; - spin_unlock_irqrestore(&phba->hbalock, iflag); - if (!list_empty(&pring->txq)) - lpfc_worker_wake_up(phba); - return; + if (!offline) { + for (i =3D 1; i <=3D phba->sli.last_iotag; i++) { + iocbq =3D phba->sli.iocbq_lookup[i]; =20 + if (!(iocbq->iocb_flag & LPFC_IO_FCP) || + (iocbq->iocb_flag & LPFC_IO_LIBDFC)) + continue; + if (iocbq->sli4_xritag !=3D xri) + continue; + psb =3D container_of(iocbq, struct lpfc_io_buf, cur_iocbq); + psb->flags &=3D ~LPFC_SBUF_XBUSY; + spin_unlock_irqrestore(&phba->hbalock, iflag); + if (!list_empty(&pring->txq)) + lpfc_worker_wake_up(phba); + return; + } } spin_unlock_irqrestore(&phba->hbalock, iflag); } diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index d8d26cde70b6..e905a246a2d6 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -1404,7 +1404,8 @@ __lpfc_sli_release_iocbq_s4(struct lpfc_hba *phba, st= ruct lpfc_iocbq *iocbq) } =20 if ((iocbq->iocb_flag & LPFC_EXCHANGE_BUSY) && - (sglq->state !=3D SGL_XRI_ABORTED)) { + (!(unlikely(pci_channel_offline(phba->pcidev)))) && + sglq->state !=3D SGL_XRI_ABORTED) { spin_lock_irqsave(&phba->sli4_hba.sgl_list_lock, iflag); =20 @@ -4583,10 +4584,12 @@ lpfc_sli_flush_io_rings(struct lpfc_hba *phba) lpfc_sli_cancel_iocbs(phba, &txq, IOSTAT_LOCAL_REJECT, IOERR_SLI_DOWN); - /* Flush the txcmpq */ + /* Flush the txcmplq */ lpfc_sli_cancel_iocbs(phba, &txcmplq, IOSTAT_LOCAL_REJECT, IOERR_SLI_DOWN); + if (unlikely(pci_channel_offline(phba->pcidev))) + lpfc_sli4_io_xri_aborted(phba, NULL, 0); } } else { pring =3D &psli->sli3_ring[LPFC_FCP_RING]; @@ -22035,8 +22038,26 @@ lpfc_get_io_buf_from_multixri_pools(struct lpfc_hb= a *phba, =20 qp =3D &phba->sli4_hba.hdwq[hwqid]; lpfc_ncmd =3D NULL; + if (!qp) { + lpfc_printf_log(phba, KERN_INFO, + LOG_SLI | LOG_NVME_ABTS | LOG_FCP, + "5556 NULL qp for hwqid x%x\n", hwqid); + return lpfc_ncmd; + } multixri_pool =3D qp->p_multixri_pool; + if (!multixri_pool) { + lpfc_printf_log(phba, KERN_INFO, + LOG_SLI | LOG_NVME_ABTS | LOG_FCP, + "5557 NULL multixri for hwqid x%x\n", hwqid); + return lpfc_ncmd; + } pvt_pool =3D &multixri_pool->pvt_pool; + if (!pvt_pool) { + lpfc_printf_log(phba, KERN_INFO, + LOG_SLI | LOG_NVME_ABTS | LOG_FCP, + "5558 NULL pvt_pool for hwqid x%x\n", hwqid); + return lpfc_ncmd; + } multixri_pool->io_req_count++; =20 /* If pvt_pool is empty, move some XRIs from public to private pool */ @@ -22112,6 +22133,12 @@ struct lpfc_io_buf *lpfc_get_io_buf(struct lpfc_hb= a *phba, =20 qp =3D &phba->sli4_hba.hdwq[hwqid]; lpfc_cmd =3D NULL; + if (!qp) { + lpfc_printf_log(phba, KERN_WARNING, + LOG_SLI | LOG_NVME_ABTS | LOG_FCP, + "5555 NULL qp for hwqid x%x\n", hwqid); + return lpfc_cmd; + } =20 if (phba->cfg_xri_rebalancing) lpfc_cmd =3D lpfc_get_io_buf_from_multixri_pools( diff --git a/drivers/scsi/lpfc/lpfc_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h index 99c5d1e4da5e..5962cf508842 100644 --- a/drivers/scsi/lpfc/lpfc_sli4.h +++ b/drivers/scsi/lpfc/lpfc_sli4.h @@ -1116,6 +1116,8 @@ void lpfc_sli4_fcf_redisc_event_proc(struct lpfc_hba = *); int lpfc_sli4_resume_rpi(struct lpfc_nodelist *, void (*)(struct lpfc_hba *, LPFC_MBOXQ_t *), void *); void lpfc_sli4_els_xri_abort_event_proc(struct lpfc_hba *phba); +void lpfc_sli4_nvme_pci_offline_aborted(struct lpfc_hba *phba, + struct lpfc_io_buf *lpfc_ncmd); void lpfc_sli4_nvme_xri_aborted(struct lpfc_hba *phba, struct sli4_wcqe_xri_aborted *axri, struct lpfc_io_buf *lpfc_ncmd); --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D54BC28B2B for ; Mon, 15 Aug 2022 19:54:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243534AbiHOTyx (ORCPT ); Mon, 15 Aug 2022 15:54:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345455AbiHOTx0 (ORCPT ); Mon, 15 Aug 2022 15:53:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44F1A40BC9; Mon, 15 Aug 2022 11:51: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 AC946611D6; Mon, 15 Aug 2022 18:51:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C91C6C433C1; Mon, 15 Aug 2022 18:51:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589481; bh=lV4Gsv+c4xLxjd32Gp4jm+pQd7wKwaKZPCuVo+dMiT8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zjysR3d/JB5unwzRlhqggsyOYyWzVwfiz93257K0nzCTcP65i0FzBJonM/NAOM3dD vSmXPllbEhDe4FEfpwFXOf76//cG+jS7Djy/s9gH+Hidy3tAijFjR7iA6qlnQ2IPI8 bi36qEWJkBcnFz9nJv6SJ/cqy1aXyOciaTCpHx8s= 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.15 701/779] scsi: lpfc: SLI path split: Refactor lpfc_iocbq Date: Mon, 15 Aug 2022 20:05:45 +0200 Message-Id: <20220815180407.345738179@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 a680a9298e7b4ff344aca3456177356b276e5038 ] Currently, SLI3 and SLI4 data paths use the same lpfc_iocbq structure. This is a "common" structure but many of the components refer to sli-rev specific entities which can lead the developer astray as to what they actually mean, should be set to, or when they should be used. This first patch prepares the lpfc_iocbq structure so that elements common to both SLI3 and SLI4 data paths are more appropriately named, making it clear they apply generically. Fieldnames based on 'iocb' (sli3) or 'wqe' (sli4) which are actually generic to the paths are renamed to 'cmd': - iocb_flag is renamed to cmd_flag - lpfc_vmid_iocb_tag is renamed to lpfc_vmid_tag - fabric_iocb_cmpl is renamed to fabric_cmd_cmpl - wait_iocb_cmpl is renamed to wait_cmd_cmpl - iocb_cmpl and wqe_cmpl are combined and renamed to cmd_cmpl - rsvd2 member is renamed to num_bdes due to pre-existing usage The structure name itself will retain the iocb reference as changing to a more relevant "job" or "cmd" title induces many hundreds of line changes for only a name change. lpfc_post_buffer is also renamed to lpfc_sli3_post_buffer to indicate use in the SLI3 path only. Link: https://lore.kernel.org/r/20220225022308.16486-2-jsmart2021@gmail.com Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/lpfc/lpfc_bsg.c | 50 ++--- drivers/scsi/lpfc/lpfc_crtn.h | 2 +- drivers/scsi/lpfc/lpfc_ct.c | 8 +- drivers/scsi/lpfc/lpfc_els.c | 139 ++++++------ drivers/scsi/lpfc/lpfc_init.c | 11 +- drivers/scsi/lpfc/lpfc_nportdisc.c | 4 +- drivers/scsi/lpfc/lpfc_nvme.c | 34 +-- drivers/scsi/lpfc/lpfc_nvme.h | 6 +- drivers/scsi/lpfc/lpfc_nvmet.c | 83 +++---- drivers/scsi/lpfc/lpfc_scsi.c | 75 +++---- drivers/scsi/lpfc/lpfc_sli.c | 340 ++++++++++++++--------------- drivers/scsi/lpfc/lpfc_sli.h | 24 +- 12 files changed, 385 insertions(+), 391 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c index fdf08cb57207..6688a575904f 100644 --- a/drivers/scsi/lpfc/lpfc_bsg.c +++ b/drivers/scsi/lpfc/lpfc_bsg.c @@ -325,7 +325,7 @@ lpfc_bsg_send_mgmt_cmd_cmp(struct lpfc_hba *phba, =20 /* Close the timeout handler abort window */ spin_lock_irqsave(&phba->hbalock, flags); - cmdiocbq->iocb_flag &=3D ~LPFC_IO_CMD_OUTSTANDING; + cmdiocbq->cmd_flag &=3D ~LPFC_IO_CMD_OUTSTANDING; spin_unlock_irqrestore(&phba->hbalock, flags); =20 iocb =3D &dd_data->context_un.iocb; @@ -481,11 +481,11 @@ lpfc_bsg_send_mgmt_cmd(struct bsg_job *job) cmd->ulpOwner =3D OWN_CHIP; cmdiocbq->vport =3D phba->pport; cmdiocbq->context3 =3D bmp; - cmdiocbq->iocb_flag |=3D LPFC_IO_LIBDFC; + cmdiocbq->cmd_flag |=3D LPFC_IO_LIBDFC; timeout =3D phba->fc_ratov * 2; cmd->ulpTimeout =3D timeout; =20 - cmdiocbq->iocb_cmpl =3D lpfc_bsg_send_mgmt_cmd_cmp; + cmdiocbq->cmd_cmpl =3D lpfc_bsg_send_mgmt_cmd_cmp; cmdiocbq->context1 =3D dd_data; cmdiocbq->context2 =3D cmp; cmdiocbq->context3 =3D bmp; @@ -516,9 +516,9 @@ lpfc_bsg_send_mgmt_cmd(struct bsg_job *job) if (iocb_stat =3D=3D IOCB_SUCCESS) { spin_lock_irqsave(&phba->hbalock, flags); /* make sure the I/O had not been completed yet */ - if (cmdiocbq->iocb_flag & LPFC_IO_LIBDFC) { + if (cmdiocbq->cmd_flag & LPFC_IO_LIBDFC) { /* open up abort window to timeout handler */ - cmdiocbq->iocb_flag |=3D LPFC_IO_CMD_OUTSTANDING; + cmdiocbq->cmd_flag |=3D LPFC_IO_CMD_OUTSTANDING; } spin_unlock_irqrestore(&phba->hbalock, flags); return 0; /* done for now */ @@ -600,7 +600,7 @@ lpfc_bsg_rport_els_cmp(struct lpfc_hba *phba, =20 /* Close the timeout handler abort window */ spin_lock_irqsave(&phba->hbalock, flags); - cmdiocbq->iocb_flag &=3D ~LPFC_IO_CMD_OUTSTANDING; + cmdiocbq->cmd_flag &=3D ~LPFC_IO_CMD_OUTSTANDING; spin_unlock_irqrestore(&phba->hbalock, flags); =20 rsp =3D &rspiocbq->iocb; @@ -726,10 +726,10 @@ lpfc_bsg_rport_els(struct bsg_job *job) cmdiocbq->iocb.ulpContext =3D phba->sli4_hba.rpi_ids[rpi]; else cmdiocbq->iocb.ulpContext =3D rpi; - cmdiocbq->iocb_flag |=3D LPFC_IO_LIBDFC; + cmdiocbq->cmd_flag |=3D LPFC_IO_LIBDFC; cmdiocbq->context1 =3D dd_data; cmdiocbq->context_un.ndlp =3D ndlp; - cmdiocbq->iocb_cmpl =3D lpfc_bsg_rport_els_cmp; + cmdiocbq->cmd_cmpl =3D lpfc_bsg_rport_els_cmp; dd_data->type =3D TYPE_IOCB; dd_data->set_job =3D job; dd_data->context_un.iocb.cmdiocbq =3D cmdiocbq; @@ -757,9 +757,9 @@ lpfc_bsg_rport_els(struct bsg_job *job) if (rc =3D=3D IOCB_SUCCESS) { spin_lock_irqsave(&phba->hbalock, flags); /* make sure the I/O had not been completed/released */ - if (cmdiocbq->iocb_flag & LPFC_IO_LIBDFC) { + if (cmdiocbq->cmd_flag & LPFC_IO_LIBDFC) { /* open up abort window to timeout handler */ - cmdiocbq->iocb_flag |=3D LPFC_IO_CMD_OUTSTANDING; + cmdiocbq->cmd_flag |=3D LPFC_IO_CMD_OUTSTANDING; } spin_unlock_irqrestore(&phba->hbalock, flags); return 0; /* done for now */ @@ -1053,7 +1053,7 @@ lpfc_bsg_ct_unsol_event(struct lpfc_hba *phba, struct= lpfc_sli_ring *pring, lpfc_in_buf_free(phba, dmabuf); } else { - lpfc_post_buffer(phba, + lpfc_sli3_post_buffer(phba, pring, 1); } @@ -1061,7 +1061,7 @@ lpfc_bsg_ct_unsol_event(struct lpfc_hba *phba, struct= lpfc_sli_ring *pring, default: if (!(phba->sli3_options & LPFC_SLI3_HBQ_ENABLED)) - lpfc_post_buffer(phba, + lpfc_sli3_post_buffer(phba, pring, 1); break; @@ -1395,7 +1395,7 @@ lpfc_issue_ct_rsp_cmp(struct lpfc_hba *phba, =20 /* Close the timeout handler abort window */ spin_lock_irqsave(&phba->hbalock, flags); - cmdiocbq->iocb_flag &=3D ~LPFC_IO_CMD_OUTSTANDING; + cmdiocbq->cmd_flag &=3D ~LPFC_IO_CMD_OUTSTANDING; spin_unlock_irqrestore(&phba->hbalock, flags); =20 ndlp =3D dd_data->context_un.iocb.ndlp; @@ -1549,13 +1549,13 @@ lpfc_issue_ct_rsp(struct lpfc_hba *phba, struct bsg= _job *job, uint32_t tag, "2722 Xmit CT response on exchange x%x Data: x%x x%x x%x\n", icmd->ulpContext, icmd->ulpIoTag, tag, phba->link_state); =20 - ctiocb->iocb_flag |=3D LPFC_IO_LIBDFC; + ctiocb->cmd_flag |=3D LPFC_IO_LIBDFC; ctiocb->vport =3D phba->pport; ctiocb->context1 =3D dd_data; ctiocb->context2 =3D cmp; ctiocb->context3 =3D bmp; ctiocb->context_un.ndlp =3D ndlp; - ctiocb->iocb_cmpl =3D lpfc_issue_ct_rsp_cmp; + ctiocb->cmd_cmpl =3D lpfc_issue_ct_rsp_cmp; =20 dd_data->type =3D TYPE_IOCB; dd_data->set_job =3D job; @@ -1582,9 +1582,9 @@ lpfc_issue_ct_rsp(struct lpfc_hba *phba, struct bsg_j= ob *job, uint32_t tag, if (rc =3D=3D IOCB_SUCCESS) { spin_lock_irqsave(&phba->hbalock, flags); /* make sure the I/O had not been completed/released */ - if (ctiocb->iocb_flag & LPFC_IO_LIBDFC) { + if (ctiocb->cmd_flag & LPFC_IO_LIBDFC) { /* open up abort window to timeout handler */ - ctiocb->iocb_flag |=3D LPFC_IO_CMD_OUTSTANDING; + ctiocb->cmd_flag |=3D LPFC_IO_CMD_OUTSTANDING; } spin_unlock_irqrestore(&phba->hbalock, flags); return 0; /* done for now */ @@ -2713,9 +2713,9 @@ static int lpfcdiag_loop_get_xri(struct lpfc_hba *phb= a, uint16_t rpi, cmd->ulpClass =3D CLASS3; cmd->ulpContext =3D rpi; =20 - cmdiocbq->iocb_flag |=3D LPFC_IO_LIBDFC; + cmdiocbq->cmd_flag |=3D LPFC_IO_LIBDFC; cmdiocbq->vport =3D phba->pport; - cmdiocbq->iocb_cmpl =3D NULL; + cmdiocbq->cmd_cmpl =3D NULL; =20 iocb_stat =3D lpfc_sli_issue_iocb_wait(phba, LPFC_ELS_RING, cmdiocbq, rspiocbq, @@ -3286,10 +3286,10 @@ lpfc_bsg_diag_loopback_run(struct bsg_job *job) cmdiocbq->sli4_xritag =3D NO_XRI; cmd->unsli3.rcvsli3.ox_id =3D 0xffff; } - cmdiocbq->iocb_flag |=3D LPFC_IO_LIBDFC; - cmdiocbq->iocb_flag |=3D LPFC_IO_LOOPBACK; + cmdiocbq->cmd_flag |=3D LPFC_IO_LIBDFC; + cmdiocbq->cmd_flag |=3D LPFC_IO_LOOPBACK; cmdiocbq->vport =3D phba->pport; - cmdiocbq->iocb_cmpl =3D NULL; + cmdiocbq->cmd_cmpl =3D NULL; iocb_stat =3D lpfc_sli_issue_iocb_wait(phba, LPFC_ELS_RING, cmdiocbq, rspiocbq, (phba->fc_ratov * 2) + LPFC_DRVR_TIMEOUT); @@ -5273,11 +5273,11 @@ lpfc_menlo_cmd(struct bsg_job *job) cmd->ulpClass =3D CLASS3; cmd->ulpOwner =3D OWN_CHIP; cmd->ulpLe =3D 1; /* Limited Edition */ - cmdiocbq->iocb_flag |=3D LPFC_IO_LIBDFC; + cmdiocbq->cmd_flag |=3D LPFC_IO_LIBDFC; cmdiocbq->vport =3D phba->pport; /* We want the firmware to timeout before we do */ cmd->ulpTimeout =3D MENLO_TIMEOUT - 5; - cmdiocbq->iocb_cmpl =3D lpfc_bsg_menlo_cmd_cmp; + cmdiocbq->cmd_cmpl =3D lpfc_bsg_menlo_cmd_cmp; cmdiocbq->context1 =3D dd_data; cmdiocbq->context2 =3D cmp; cmdiocbq->context3 =3D bmp; @@ -6001,7 +6001,7 @@ lpfc_bsg_timeout(struct bsg_job *job) =20 spin_lock_irqsave(&phba->hbalock, flags); /* make sure the I/O abort window is still open */ - if (!(cmdiocb->iocb_flag & LPFC_IO_CMD_OUTSTANDING)) { + if (!(cmdiocb->cmd_flag & LPFC_IO_CMD_OUTSTANDING)) { spin_unlock_irqrestore(&phba->hbalock, flags); return -EAGAIN; } diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h index c9770b1d2366..ed27a0afcb8b 100644 --- a/drivers/scsi/lpfc/lpfc_crtn.h +++ b/drivers/scsi/lpfc/lpfc_crtn.h @@ -210,7 +210,7 @@ int lpfc_config_port_post(struct lpfc_hba *); int lpfc_hba_down_prep(struct lpfc_hba *); int lpfc_hba_down_post(struct lpfc_hba *); void lpfc_hba_init(struct lpfc_hba *, uint32_t *); -int lpfc_post_buffer(struct lpfc_hba *, struct lpfc_sli_ring *, int); +int lpfc_sli3_post_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pri= ng, int cnt); void lpfc_decode_firmware_rev(struct lpfc_hba *, char *, int); int lpfc_online(struct lpfc_hba *); void lpfc_unblock_mgmt_io(struct lpfc_hba *); diff --git a/drivers/scsi/lpfc/lpfc_ct.c b/drivers/scsi/lpfc/lpfc_ct.c index dfcb7d4bd7fa..19e2f8086a6d 100644 --- a/drivers/scsi/lpfc/lpfc_ct.c +++ b/drivers/scsi/lpfc/lpfc_ct.c @@ -239,7 +239,7 @@ lpfc_ct_reject_event(struct lpfc_nodelist *ndlp, cmdiocbq->context1 =3D lpfc_nlp_get(ndlp); cmdiocbq->context2 =3D (uint8_t *)mp; cmdiocbq->context3 =3D (uint8_t *)bmp; - cmdiocbq->iocb_cmpl =3D lpfc_ct_unsol_cmpl; + cmdiocbq->cmd_cmpl =3D lpfc_ct_unsol_cmpl; icmd->ulpContext =3D rx_id; /* Xri / rx_id */ icmd->unsli3.rcvsli3.ox_id =3D ox_id; icmd->un.ulpWord[3] =3D @@ -370,7 +370,7 @@ lpfc_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_= sli_ring *pring, /* Not enough posted buffers; Try posting more buffers */ phba->fc_stat.NoRcvBuf++; if (!(phba->sli3_options & LPFC_SLI3_HBQ_ENABLED)) - lpfc_post_buffer(phba, pring, 2); + lpfc_sli3_post_buffer(phba, pring, 2); return; } =20 @@ -447,7 +447,7 @@ lpfc_ct_unsol_event(struct lpfc_hba *phba, struct lpfc_= sli_ring *pring, lpfc_ct_unsol_buffer(phba, iocbq, mp, size); lpfc_in_buf_free(phba, mp); } - lpfc_post_buffer(phba, pring, i); + lpfc_sli3_post_buffer(phba, pring, i); } list_del(&head); } @@ -652,7 +652,7 @@ lpfc_gen_req(struct lpfc_vport *vport, struct lpfc_dmab= uf *bmp, "Data: x%x x%x\n", ndlp->nlp_DID, icmd->ulpIoTag, vport->port_state); - geniocb->iocb_cmpl =3D cmpl; + geniocb->cmd_cmpl =3D cmpl; geniocb->drvrTimeout =3D icmd->ulpTimeout + LPFC_DRVR_TIMEOUT; geniocb->vport =3D vport; geniocb->retry =3D retry; diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 5f44a0763f37..0d34a03164f5 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -192,23 +192,23 @@ lpfc_prep_els_iocb(struct lpfc_vport *vport, uint8_t = expectRsp, (elscmd =3D=3D ELS_CMD_LOGO))) switch (elscmd) { case ELS_CMD_FLOGI: - elsiocb->iocb_flag |=3D + elsiocb->cmd_flag |=3D ((LPFC_ELS_ID_FLOGI << LPFC_FIP_ELS_ID_SHIFT) & LPFC_FIP_ELS_ID_MASK); break; case ELS_CMD_FDISC: - elsiocb->iocb_flag |=3D + elsiocb->cmd_flag |=3D ((LPFC_ELS_ID_FDISC << LPFC_FIP_ELS_ID_SHIFT) & LPFC_FIP_ELS_ID_MASK); break; case ELS_CMD_LOGO: - elsiocb->iocb_flag |=3D + elsiocb->cmd_flag |=3D ((LPFC_ELS_ID_LOGO << LPFC_FIP_ELS_ID_SHIFT) & LPFC_FIP_ELS_ID_MASK); break; } else - elsiocb->iocb_flag &=3D ~LPFC_FIP_ELS_ID_MASK; + elsiocb->cmd_flag &=3D ~LPFC_FIP_ELS_ID_MASK; =20 icmd =3D &elsiocb->iocb; =20 @@ -1252,10 +1252,10 @@ lpfc_cmpl_els_link_down(struct lpfc_hba *phba, stru= ct lpfc_iocbq *cmdiocb, "6445 ELS completes after LINK_DOWN: " " Status %x/%x cmd x%x flg x%x\n", irsp->ulpStatus, irsp->un.ulpWord[4], cmd, - cmdiocb->iocb_flag); + cmdiocb->cmd_flag); =20 - if (cmdiocb->iocb_flag & LPFC_IO_FABRIC) { - cmdiocb->iocb_flag &=3D ~LPFC_IO_FABRIC; + if (cmdiocb->cmd_flag & LPFC_IO_FABRIC) { + cmdiocb->cmd_flag &=3D ~LPFC_IO_FABRIC; atomic_dec(&phba->fabric_iocb_count); } lpfc_els_free_iocb(phba, cmdiocb); @@ -1370,7 +1370,7 @@ lpfc_issue_els_flogi(struct lpfc_vport *vport, struct= lpfc_nodelist *ndlp, phba->fc_ratov =3D tmo; =20 phba->fc_stat.elsXmitFLOGI++; - elsiocb->iocb_cmpl =3D lpfc_cmpl_els_flogi; + elsiocb->cmd_cmpl =3D lpfc_cmpl_els_flogi; =20 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_CMD, "Issue FLOGI: opt:x%x", @@ -1463,7 +1463,7 @@ lpfc_els_abort_flogi(struct lpfc_hba *phba) if (ndlp && ndlp->nlp_DID =3D=3D Fabric_DID) { if ((phba->pport->fc_flag & FC_PT2PT) && !(phba->pport->fc_flag & FC_PT2PT_PLOGI)) - iocb->fabric_iocb_cmpl =3D + iocb->fabric_cmd_cmpl =3D lpfc_ignore_els_cmpl; lpfc_sli_issue_abort_iotag(phba, pring, iocb, NULL); @@ -2226,7 +2226,7 @@ lpfc_issue_els_plogi(struct lpfc_vport *vport, uint32= _t did, uint8_t retry) } =20 phba->fc_stat.elsXmitPLOGI++; - elsiocb->iocb_cmpl =3D lpfc_cmpl_els_plogi; + elsiocb->cmd_cmpl =3D lpfc_cmpl_els_plogi; =20 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_CMD, "Issue PLOGI: did:x%x refcnt %d", @@ -2478,7 +2478,7 @@ lpfc_issue_els_prli(struct lpfc_vport *vport, struct = lpfc_nodelist *ndlp, /* For FCP support */ npr->prliType =3D PRLI_FCP_TYPE; npr->initiatorFunc =3D 1; - elsiocb->iocb_flag |=3D LPFC_PRLI_FCP_REQ; + elsiocb->cmd_flag |=3D LPFC_PRLI_FCP_REQ; =20 /* Remove FCP type - processed. */ local_nlp_type &=3D ~NLP_FC4_FCP; @@ -2512,14 +2512,14 @@ lpfc_issue_els_prli(struct lpfc_vport *vport, struc= t lpfc_nodelist *ndlp, =20 npr_nvme->word1 =3D cpu_to_be32(npr_nvme->word1); npr_nvme->word4 =3D cpu_to_be32(npr_nvme->word4); - elsiocb->iocb_flag |=3D LPFC_PRLI_NVME_REQ; + elsiocb->cmd_flag |=3D LPFC_PRLI_NVME_REQ; =20 /* Remove NVME type - processed. */ local_nlp_type &=3D ~NLP_FC4_NVME; } =20 phba->fc_stat.elsXmitPRLI++; - elsiocb->iocb_cmpl =3D lpfc_cmpl_els_prli; + elsiocb->cmd_cmpl =3D lpfc_cmpl_els_prli; spin_lock_irq(&ndlp->lock); ndlp->nlp_flag |=3D NLP_PRLI_SND; =20 @@ -2842,7 +2842,7 @@ lpfc_issue_els_adisc(struct lpfc_vport *vport, struct= lpfc_nodelist *ndlp, ap->DID =3D be32_to_cpu(vport->fc_myDID); =20 phba->fc_stat.elsXmitADISC++; - elsiocb->iocb_cmpl =3D lpfc_cmpl_els_adisc; + elsiocb->cmd_cmpl =3D lpfc_cmpl_els_adisc; spin_lock_irq(&ndlp->lock); ndlp->nlp_flag |=3D NLP_ADISC_SND; spin_unlock_irq(&ndlp->lock); @@ -3065,7 +3065,7 @@ lpfc_issue_els_logo(struct lpfc_vport *vport, struct = lpfc_nodelist *ndlp, memcpy(pcmd, &vport->fc_portname, sizeof(struct lpfc_name)); =20 phba->fc_stat.elsXmitLOGO++; - elsiocb->iocb_cmpl =3D lpfc_cmpl_els_logo; + elsiocb->cmd_cmpl =3D lpfc_cmpl_els_logo; spin_lock_irq(&ndlp->lock); ndlp->nlp_flag |=3D NLP_LOGO_SND; ndlp->nlp_flag &=3D ~NLP_ISSUE_LOGO; @@ -3417,7 +3417,7 @@ lpfc_issue_els_scr(struct lpfc_vport *vport, uint8_t = retry) ndlp->nlp_DID, 0, 0); =20 phba->fc_stat.elsXmitSCR++; - elsiocb->iocb_cmpl =3D lpfc_cmpl_els_disc_cmd; + elsiocb->cmd_cmpl =3D lpfc_cmpl_els_disc_cmd; elsiocb->context1 =3D lpfc_nlp_get(ndlp); if (!elsiocb->context1) { lpfc_els_free_iocb(phba, elsiocb); @@ -3514,7 +3514,7 @@ lpfc_issue_els_rscn(struct lpfc_vport *vport, uint8_t= retry) event->portid.rscn_fid[2] =3D nportid & 0x000000FF; =20 phba->fc_stat.elsXmitRSCN++; - elsiocb->iocb_cmpl =3D lpfc_cmpl_els_cmd; + elsiocb->cmd_cmpl =3D lpfc_cmpl_els_cmd; elsiocb->context1 =3D lpfc_nlp_get(ndlp); if (!elsiocb->context1) { lpfc_els_free_iocb(phba, elsiocb); @@ -3613,7 +3613,7 @@ lpfc_issue_els_farpr(struct lpfc_vport *vport, uint32= _t nportid, uint8_t retry) ndlp->nlp_DID, 0, 0); =20 phba->fc_stat.elsXmitFARPR++; - elsiocb->iocb_cmpl =3D lpfc_cmpl_els_cmd; + elsiocb->cmd_cmpl =3D lpfc_cmpl_els_cmd; elsiocb->context1 =3D lpfc_nlp_get(ndlp); if (!elsiocb->context1) { lpfc_els_free_iocb(phba, elsiocb); @@ -3704,7 +3704,7 @@ lpfc_issue_els_rdf(struct lpfc_vport *vport, uint8_t = retry) phba->cgn_reg_fpin); =20 phba->cgn_fpin_frequency =3D LPFC_FPIN_INIT_FREQ; - elsiocb->iocb_cmpl =3D lpfc_cmpl_els_disc_cmd; + elsiocb->cmd_cmpl =3D lpfc_cmpl_els_disc_cmd; elsiocb->context1 =3D lpfc_nlp_get(ndlp); if (!elsiocb->context1) { lpfc_els_free_iocb(phba, elsiocb); @@ -4154,7 +4154,7 @@ lpfc_issue_els_edc(struct lpfc_vport *vport, uint8_t = retry) ndlp->nlp_DID, phba->cgn_reg_signal, phba->cgn_reg_fpin); =20 - elsiocb->iocb_cmpl =3D lpfc_cmpl_els_disc_cmd; + elsiocb->cmd_cmpl =3D lpfc_cmpl_els_disc_cmd; elsiocb->context1 =3D lpfc_nlp_get(ndlp); if (!elsiocb->context1) { lpfc_els_free_iocb(phba, elsiocb); @@ -4968,12 +4968,12 @@ lpfc_els_free_iocb(struct lpfc_hba *phba, struct lp= fc_iocbq *elsiocb) =20 /* context2 =3D cmd, context2->next =3D rsp, context3 =3D bpl */ if (elsiocb->context2) { - if (elsiocb->iocb_flag & LPFC_DELAY_MEM_FREE) { + if (elsiocb->cmd_flag & LPFC_DELAY_MEM_FREE) { /* Firmware could still be in progress of DMAing * payload, so don't free data buffer till after * a hbeat. */ - elsiocb->iocb_flag &=3D ~LPFC_DELAY_MEM_FREE; + elsiocb->cmd_flag &=3D ~LPFC_DELAY_MEM_FREE; buf_ptr =3D elsiocb->context2; elsiocb->context2 =3D NULL; if (buf_ptr) { @@ -5480,9 +5480,9 @@ lpfc_els_rsp_acc(struct lpfc_vport *vport, uint32_t f= lag, ndlp->nlp_flag & NLP_REG_LOGIN_SEND)) ndlp->nlp_flag &=3D ~NLP_LOGO_ACC; spin_unlock_irq(&ndlp->lock); - elsiocb->iocb_cmpl =3D lpfc_cmpl_els_logo_acc; + elsiocb->cmd_cmpl =3D lpfc_cmpl_els_logo_acc; } else { - elsiocb->iocb_cmpl =3D lpfc_cmpl_els_rsp; + elsiocb->cmd_cmpl =3D lpfc_cmpl_els_rsp; } =20 phba->fc_stat.elsXmitACC++; @@ -5577,7 +5577,7 @@ lpfc_els_rsp_reject(struct lpfc_vport *vport, uint32_= t rejectError, ndlp->nlp_DID, ndlp->nlp_flag, rejectError); =20 phba->fc_stat.elsXmitLSRJT++; - elsiocb->iocb_cmpl =3D lpfc_cmpl_els_rsp; + elsiocb->cmd_cmpl =3D lpfc_cmpl_els_rsp; elsiocb->context1 =3D lpfc_nlp_get(ndlp); if (!elsiocb->context1) { lpfc_els_free_iocb(phba, elsiocb); @@ -5657,7 +5657,7 @@ lpfc_issue_els_edc_rsp(struct lpfc_vport *vport, stru= ct lpfc_iocbq *cmdiocb, "Issue EDC ACC: did:x%x flg:x%x refcnt %d", ndlp->nlp_DID, ndlp->nlp_flag, kref_read(&ndlp->kref)); - elsiocb->iocb_cmpl =3D lpfc_cmpl_els_rsp; + elsiocb->cmd_cmpl =3D lpfc_cmpl_els_rsp; =20 phba->fc_stat.elsXmitACC++; elsiocb->context1 =3D lpfc_nlp_get(ndlp); @@ -5750,7 +5750,7 @@ lpfc_els_rsp_adisc_acc(struct lpfc_vport *vport, stru= ct lpfc_iocbq *oldiocb, ndlp->nlp_DID, ndlp->nlp_flag, kref_read(&ndlp->kref)); =20 phba->fc_stat.elsXmitACC++; - elsiocb->iocb_cmpl =3D lpfc_cmpl_els_rsp; + elsiocb->cmd_cmpl =3D lpfc_cmpl_els_rsp; elsiocb->context1 =3D lpfc_nlp_get(ndlp); if (!elsiocb->context1) { lpfc_els_free_iocb(phba, elsiocb); @@ -5924,7 +5924,7 @@ lpfc_els_rsp_prli_acc(struct lpfc_vport *vport, struc= t lpfc_iocbq *oldiocb, ndlp->nlp_DID, ndlp->nlp_flag, kref_read(&ndlp->kref)); =20 phba->fc_stat.elsXmitACC++; - elsiocb->iocb_cmpl =3D lpfc_cmpl_els_rsp; + elsiocb->cmd_cmpl =3D lpfc_cmpl_els_rsp; elsiocb->context1 =3D lpfc_nlp_get(ndlp); if (!elsiocb->context1) { lpfc_els_free_iocb(phba, elsiocb); @@ -6025,7 +6025,7 @@ lpfc_els_rsp_rnid_acc(struct lpfc_vport *vport, uint8= _t format, ndlp->nlp_DID, ndlp->nlp_flag, kref_read(&ndlp->kref)); =20 phba->fc_stat.elsXmitACC++; - elsiocb->iocb_cmpl =3D lpfc_cmpl_els_rsp; + elsiocb->cmd_cmpl =3D lpfc_cmpl_els_rsp; elsiocb->context1 =3D lpfc_nlp_get(ndlp); if (!elsiocb->context1) { lpfc_els_free_iocb(phba, elsiocb); @@ -6139,7 +6139,7 @@ lpfc_els_rsp_echo_acc(struct lpfc_vport *vport, uint8= _t *data, ndlp->nlp_DID, ndlp->nlp_flag, kref_read(&ndlp->kref)); =20 phba->fc_stat.elsXmitACC++; - elsiocb->iocb_cmpl =3D lpfc_cmpl_els_rsp; + elsiocb->cmd_cmpl =3D lpfc_cmpl_els_rsp; elsiocb->context1 =3D lpfc_nlp_get(ndlp); if (!elsiocb->context1) { lpfc_els_free_iocb(phba, elsiocb); @@ -6803,7 +6803,7 @@ lpfc_els_rdp_cmpl(struct lpfc_hba *phba, struct lpfc_= rdp_context *rdp_context, rdp_context->page_a0, vport); =20 rdp_res->length =3D cpu_to_be32(len - 8); - elsiocb->iocb_cmpl =3D lpfc_cmpl_els_rsp; + elsiocb->cmd_cmpl =3D lpfc_cmpl_els_rsp; =20 /* Now that we know the true size of the payload, update the BPL */ bpl =3D (struct ulp_bde64 *) @@ -6844,7 +6844,7 @@ lpfc_els_rdp_cmpl(struct lpfc_hba *phba, struct lpfc_= rdp_context *rdp_context, stat->un.b.lsRjtRsnCode =3D LSRJT_UNABLE_TPC; =20 phba->fc_stat.elsXmitLSRJT++; - elsiocb->iocb_cmpl =3D lpfc_cmpl_els_rsp; + elsiocb->cmd_cmpl =3D lpfc_cmpl_els_rsp; elsiocb->context1 =3D lpfc_nlp_get(ndlp); if (!elsiocb->context1) { lpfc_els_free_iocb(phba, elsiocb); @@ -7066,7 +7066,7 @@ lpfc_els_lcb_rsp(struct lpfc_hba *phba, LPFC_MBOXQ_t = *pmb) lcb_res->capability =3D lcb_context->capability; lcb_res->lcb_frequency =3D lcb_context->frequency; lcb_res->lcb_duration =3D lcb_context->duration; - elsiocb->iocb_cmpl =3D lpfc_cmpl_els_rsp; + elsiocb->cmd_cmpl =3D lpfc_cmpl_els_rsp; phba->fc_stat.elsXmitACC++; =20 elsiocb->context1 =3D lpfc_nlp_get(ndlp); @@ -7105,7 +7105,7 @@ lpfc_els_lcb_rsp(struct lpfc_hba *phba, LPFC_MBOXQ_t = *pmb) if (shdr_add_status =3D=3D ADD_STATUS_OPERATION_ALREADY_ACTIVE) stat->un.b.lsRjtRsnCodeExp =3D LSEXP_CMD_IN_PROGRESS; =20 - elsiocb->iocb_cmpl =3D lpfc_cmpl_els_rsp; + elsiocb->cmd_cmpl =3D lpfc_cmpl_els_rsp; phba->fc_stat.elsXmitLSRJT++; elsiocb->context1 =3D lpfc_nlp_get(ndlp); if (!elsiocb->context1) { @@ -8172,7 +8172,7 @@ lpfc_els_rsp_rls_acc(struct lpfc_hba *phba, LPFC_MBOX= Q_t *pmb) elsiocb->iotag, elsiocb->iocb.ulpContext, ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); - elsiocb->iocb_cmpl =3D lpfc_cmpl_els_rsp; + elsiocb->cmd_cmpl =3D lpfc_cmpl_els_rsp; phba->fc_stat.elsXmitACC++; elsiocb->context1 =3D lpfc_nlp_get(ndlp); if (!elsiocb->context1) { @@ -8324,7 +8324,7 @@ lpfc_els_rcv_rtv(struct lpfc_vport *vport, struct lpf= c_iocbq *cmdiocb, ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi, rtv_rsp->ratov, rtv_rsp->edtov, rtv_rsp->qtov); - elsiocb->iocb_cmpl =3D lpfc_cmpl_els_rsp; + elsiocb->cmd_cmpl =3D lpfc_cmpl_els_rsp; phba->fc_stat.elsXmitACC++; elsiocb->context1 =3D lpfc_nlp_get(ndlp); if (!elsiocb->context1) { @@ -8401,7 +8401,7 @@ lpfc_issue_els_rrq(struct lpfc_vport *vport, struct l= pfc_nodelist *ndlp, "Issue RRQ: did:x%x", did, rrq->xritag, rrq->rxid); elsiocb->context_un.rrq =3D rrq; - elsiocb->iocb_cmpl =3D lpfc_cmpl_els_rrq; + elsiocb->cmd_cmpl =3D lpfc_cmpl_els_rrq; =20 lpfc_nlp_get(ndlp); elsiocb->context1 =3D ndlp; @@ -8507,7 +8507,7 @@ lpfc_els_rsp_rpl_acc(struct lpfc_vport *vport, uint16= _t cmdsize, elsiocb->iotag, elsiocb->iocb.ulpContext, ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi); - elsiocb->iocb_cmpl =3D lpfc_cmpl_els_rsp; + elsiocb->cmd_cmpl =3D lpfc_cmpl_els_rsp; phba->fc_stat.elsXmitACC++; elsiocb->context1 =3D lpfc_nlp_get(ndlp); if (!elsiocb->context1) { @@ -8947,7 +8947,7 @@ lpfc_els_timeout_handler(struct lpfc_vport *vport) list_for_each_entry_safe(piocb, tmp_iocb, &pring->txcmplq, list) { cmd =3D &piocb->iocb; =20 - if ((piocb->iocb_flag & LPFC_IO_LIBDFC) !=3D 0 || + if ((piocb->cmd_flag & LPFC_IO_LIBDFC) !=3D 0 || piocb->iocb.ulpCommand =3D=3D CMD_ABORT_XRI_CN || piocb->iocb.ulpCommand =3D=3D CMD_CLOSE_XRI_CN) continue; @@ -9060,13 +9060,13 @@ lpfc_els_flush_cmd(struct lpfc_vport *vport) =20 /* First we need to issue aborts to outstanding cmds on txcmpl */ list_for_each_entry_safe(piocb, tmp_iocb, &pring->txcmplq, list) { - if (piocb->iocb_flag & LPFC_IO_LIBDFC) + if (piocb->cmd_flag & LPFC_IO_LIBDFC) continue; =20 if (piocb->vport !=3D vport) continue; =20 - if (piocb->iocb_flag & LPFC_DRIVER_ABORTED) + if (piocb->cmd_flag & LPFC_DRIVER_ABORTED) continue; =20 /* On the ELS ring we can have ELS_REQUESTs or @@ -9084,7 +9084,7 @@ lpfc_els_flush_cmd(struct lpfc_vport *vport) * and avoid any retry logic. */ if (phba->link_state =3D=3D LPFC_LINK_DOWN) - piocb->iocb_cmpl =3D lpfc_cmpl_els_link_down; + piocb->cmd_cmpl =3D lpfc_cmpl_els_link_down; } if (cmd->ulpCommand =3D=3D CMD_GEN_REQUEST64_CR) list_add_tail(&piocb->dlist, &abort_list); @@ -9119,9 +9119,8 @@ lpfc_els_flush_cmd(struct lpfc_vport *vport) list_for_each_entry_safe(piocb, tmp_iocb, &pring->txq, list) { cmd =3D &piocb->iocb; =20 - if (piocb->iocb_flag & LPFC_IO_LIBDFC) { + if (piocb->cmd_flag & LPFC_IO_LIBDFC) continue; - } =20 /* Do not flush out the QUE_RING and ABORT/CLOSE iocbs */ if (cmd->ulpCommand =3D=3D CMD_QUE_RING_BUF_CN || @@ -9766,7 +9765,7 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct l= pfc_sli_ring *pring, payload_len =3D elsiocb->iocb.unsli3.rcvsli3.acc_len; cmd =3D *payload; if ((phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) =3D=3D 0) - lpfc_post_buffer(phba, pring, 1); + lpfc_sli3_post_buffer(phba, pring, 1); =20 did =3D icmd->un.rcvels.remoteID; if (icmd->ulpStatus) { @@ -10239,7 +10238,7 @@ lpfc_els_unsol_event(struct lpfc_hba *phba, struct = lpfc_sli_ring *pring, phba->fc_stat.NoRcvBuf++; /* Not enough posted buffers; Try posting more buffers */ if (!(phba->sli3_options & LPFC_SLI3_HBQ_ENABLED)) - lpfc_post_buffer(phba, pring, 0); + lpfc_sli3_post_buffer(phba, pring, 0); return; } =20 @@ -10875,7 +10874,7 @@ lpfc_issue_els_fdisc(struct lpfc_vport *vport, stru= ct lpfc_nodelist *ndlp, lpfc_set_disctmo(vport); =20 phba->fc_stat.elsXmitFDISC++; - elsiocb->iocb_cmpl =3D lpfc_cmpl_els_fdisc; + elsiocb->cmd_cmpl =3D lpfc_cmpl_els_fdisc; =20 lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_CMD, "Issue FDISC: did:x%x", @@ -10999,7 +10998,7 @@ lpfc_issue_els_npiv_logo(struct lpfc_vport *vport, = struct lpfc_nodelist *ndlp) "Issue LOGO npiv did:x%x flg:x%x", ndlp->nlp_DID, ndlp->nlp_flag, 0); =20 - elsiocb->iocb_cmpl =3D lpfc_cmpl_els_npiv_logo; + elsiocb->cmd_cmpl =3D lpfc_cmpl_els_npiv_logo; spin_lock_irq(&ndlp->lock); ndlp->nlp_flag |=3D NLP_LOGO_SND; spin_unlock_irq(&ndlp->lock); @@ -11084,9 +11083,9 @@ lpfc_resume_fabric_iocbs(struct lpfc_hba *phba) } spin_unlock_irqrestore(&phba->hbalock, iflags); if (iocb) { - iocb->fabric_iocb_cmpl =3D iocb->iocb_cmpl; - iocb->iocb_cmpl =3D lpfc_cmpl_fabric_iocb; - iocb->iocb_flag |=3D LPFC_IO_FABRIC; + iocb->fabric_cmd_cmpl =3D iocb->cmd_cmpl; + iocb->cmd_cmpl =3D lpfc_cmpl_fabric_iocb; + iocb->cmd_flag |=3D LPFC_IO_FABRIC; =20 lpfc_debugfs_disc_trc(iocb->vport, LPFC_DISC_TRC_ELS_CMD, "Fabric sched1: ste:x%x", @@ -11095,13 +11094,13 @@ lpfc_resume_fabric_iocbs(struct lpfc_hba *phba) ret =3D lpfc_sli_issue_iocb(phba, LPFC_ELS_RING, iocb, 0); =20 if (ret =3D=3D IOCB_ERROR) { - iocb->iocb_cmpl =3D iocb->fabric_iocb_cmpl; - iocb->fabric_iocb_cmpl =3D NULL; - iocb->iocb_flag &=3D ~LPFC_IO_FABRIC; + iocb->cmd_cmpl =3D iocb->fabric_cmd_cmpl; + iocb->fabric_cmd_cmpl =3D NULL; + iocb->cmd_flag &=3D ~LPFC_IO_FABRIC; cmd =3D &iocb->iocb; cmd->ulpStatus =3D IOSTAT_LOCAL_REJECT; cmd->un.ulpWord[4] =3D IOERR_SLI_ABORTED; - iocb->iocb_cmpl(phba, iocb, iocb); + iocb->cmd_cmpl(phba, iocb, iocb); =20 atomic_dec(&phba->fabric_iocb_count); goto repeat; @@ -11157,8 +11156,8 @@ lpfc_block_fabric_iocbs(struct lpfc_hba *phba) * @rspiocb: pointer to lpfc response iocb data structure. * * This routine is the callback function that is put to the fabric iocb's - * callback function pointer (iocb->iocb_cmpl). The original iocb's callba= ck - * function pointer has been stored in iocb->fabric_iocb_cmpl. This callba= ck + * callback function pointer (iocb->cmd_cmpl). The original iocb's callback + * function pointer has been stored in iocb->fabric_cmd_cmpl. This callback * function first restores and invokes the original iocb's callback functi= on * and then invokes the lpfc_resume_fabric_iocbs() routine to issue the ne= xt * fabric bound iocb from the driver internal fabric iocb list onto the wi= re. @@ -11169,7 +11168,7 @@ lpfc_cmpl_fabric_iocb(struct lpfc_hba *phba, struct= lpfc_iocbq *cmdiocb, { struct ls_rjt stat; =20 - BUG_ON((cmdiocb->iocb_flag & LPFC_IO_FABRIC) !=3D LPFC_IO_FABRIC); + WARN_ON((cmdiocb->cmd_flag & LPFC_IO_FABRIC) !=3D LPFC_IO_FABRIC); =20 switch (rspiocb->iocb.ulpStatus) { case IOSTAT_NPORT_RJT: @@ -11195,10 +11194,10 @@ lpfc_cmpl_fabric_iocb(struct lpfc_hba *phba, stru= ct lpfc_iocbq *cmdiocb, =20 BUG_ON(atomic_read(&phba->fabric_iocb_count) =3D=3D 0); =20 - cmdiocb->iocb_cmpl =3D cmdiocb->fabric_iocb_cmpl; - cmdiocb->fabric_iocb_cmpl =3D NULL; - cmdiocb->iocb_flag &=3D ~LPFC_IO_FABRIC; - cmdiocb->iocb_cmpl(phba, cmdiocb, rspiocb); + cmdiocb->cmd_cmpl =3D cmdiocb->fabric_cmd_cmpl; + cmdiocb->fabric_cmd_cmpl =3D NULL; + cmdiocb->cmd_flag &=3D ~LPFC_IO_FABRIC; + cmdiocb->cmd_cmpl(phba, cmdiocb, rspiocb); =20 atomic_dec(&phba->fabric_iocb_count); if (!test_bit(FABRIC_COMANDS_BLOCKED, &phba->bit_flags)) { @@ -11249,9 +11248,9 @@ lpfc_issue_fabric_iocb(struct lpfc_hba *phba, struc= t lpfc_iocbq *iocb) atomic_inc(&phba->fabric_iocb_count); spin_unlock_irqrestore(&phba->hbalock, iflags); if (ready) { - iocb->fabric_iocb_cmpl =3D iocb->iocb_cmpl; - iocb->iocb_cmpl =3D lpfc_cmpl_fabric_iocb; - iocb->iocb_flag |=3D LPFC_IO_FABRIC; + iocb->fabric_cmd_cmpl =3D iocb->cmd_cmpl; + iocb->cmd_cmpl =3D lpfc_cmpl_fabric_iocb; + iocb->cmd_flag |=3D LPFC_IO_FABRIC; =20 lpfc_debugfs_disc_trc(iocb->vport, LPFC_DISC_TRC_ELS_CMD, "Fabric sched2: ste:x%x", @@ -11260,9 +11259,9 @@ lpfc_issue_fabric_iocb(struct lpfc_hba *phba, struc= t lpfc_iocbq *iocb) ret =3D lpfc_sli_issue_iocb(phba, LPFC_ELS_RING, iocb, 0); =20 if (ret =3D=3D IOCB_ERROR) { - iocb->iocb_cmpl =3D iocb->fabric_iocb_cmpl; - iocb->fabric_iocb_cmpl =3D NULL; - iocb->iocb_flag &=3D ~LPFC_IO_FABRIC; + iocb->cmd_cmpl =3D iocb->fabric_cmd_cmpl; + iocb->fabric_cmd_cmpl =3D NULL; + iocb->cmd_flag &=3D ~LPFC_IO_FABRIC; atomic_dec(&phba->fabric_iocb_count); } } else { @@ -11655,7 +11654,7 @@ int lpfc_issue_els_qfpa(struct lpfc_vport *vport) *((u32 *)(pcmd)) =3D ELS_CMD_QFPA; pcmd +=3D 4; =20 - elsiocb->iocb_cmpl =3D lpfc_cmpl_els_qfpa; + elsiocb->cmd_cmpl =3D lpfc_cmpl_els_qfpa; =20 elsiocb->context1 =3D lpfc_nlp_get(ndlp); if (!elsiocb->context1) { @@ -11738,7 +11737,7 @@ lpfc_vmid_uvem(struct lpfc_vport *vport, } inst_desc->word6 =3D cpu_to_be32(inst_desc->word6); =20 - elsiocb->iocb_cmpl =3D lpfc_cmpl_els_uvem; + elsiocb->cmd_cmpl =3D lpfc_cmpl_els_uvem; =20 elsiocb->context1 =3D lpfc_nlp_get(ndlp); if (!elsiocb->context1) { diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index cda571393a5f..2aa729a10b50 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -982,7 +982,7 @@ lpfc_hba_clean_txcmplq(struct lpfc_hba *phba) spin_lock_irq(&pring->ring_lock); list_for_each_entry_safe(piocb, next_iocb, &pring->txcmplq, list) - piocb->iocb_flag &=3D ~LPFC_IO_ON_TXCMPLQ; + piocb->cmd_flag &=3D ~LPFC_IO_ON_TXCMPLQ; list_splice_init(&pring->txcmplq, &completions); pring->txcmplq_cnt =3D 0; spin_unlock_irq(&pring->ring_lock); @@ -2643,7 +2643,7 @@ lpfc_get_hba_model_desc(struct lpfc_hba *phba, uint8_= t *mdp, uint8_t *descp) } =20 /** - * lpfc_post_buffer - Post IOCB(s) with DMA buffer descriptor(s) to a IOCB= ring + * lpfc_sli3_post_buffer - Post IOCB(s) with DMA buffer descriptor(s) to a= IOCB ring * @phba: pointer to lpfc hba data structure. * @pring: pointer to a IOCB ring. * @cnt: the number of IOCBs to be posted to the IOCB ring. @@ -2655,7 +2655,7 @@ lpfc_get_hba_model_desc(struct lpfc_hba *phba, uint8_= t *mdp, uint8_t *descp) * The number of IOCBs NOT able to be posted to the IOCB ring. **/ int -lpfc_post_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, int c= nt) +lpfc_sli3_post_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, = int cnt) { IOCB_t *icmd; struct lpfc_iocbq *iocb; @@ -2761,7 +2761,7 @@ lpfc_post_rcv_buf(struct lpfc_hba *phba) struct lpfc_sli *psli =3D &phba->sli; =20 /* Ring 0, ELS / CT buffers */ - lpfc_post_buffer(phba, &psli->sli3_ring[LPFC_ELS_RING], LPFC_BUF_RING0); + lpfc_sli3_post_buffer(phba, &psli->sli3_ring[LPFC_ELS_RING], LPFC_BUF_RIN= G0); /* Ring 2 - FCP no buffers needed */ =20 return 0; @@ -4215,8 +4215,7 @@ lpfc_io_buf_replenish(struct lpfc_hba *phba, struct l= ist_head *cbuf) qp =3D &phba->sli4_hba.hdwq[idx]; lpfc_cmd->hdwq_no =3D idx; lpfc_cmd->hdwq =3D qp; - lpfc_cmd->cur_iocbq.wqe_cmpl =3D NULL; - lpfc_cmd->cur_iocbq.iocb_cmpl =3D NULL; + lpfc_cmd->cur_iocbq.cmd_cmpl =3D NULL; spin_lock(&qp->io_buf_list_put_lock); list_add_tail(&lpfc_cmd->list, &qp->lpfc_io_buf_list_put); diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_np= ortdisc.c index 2bd35a7424c2..e788610bc996 100644 --- a/drivers/scsi/lpfc/lpfc_nportdisc.c +++ b/drivers/scsi/lpfc/lpfc_nportdisc.c @@ -2139,9 +2139,9 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_vport *vport, s= truct lpfc_nodelist *ndlp, npr =3D NULL; nvpr =3D NULL; temp_ptr =3D lpfc_check_elscmpl_iocb(phba, cmdiocb, rspiocb); - if (cmdiocb->iocb_flag & LPFC_PRLI_FCP_REQ) + if (cmdiocb->cmd_flag & LPFC_PRLI_FCP_REQ) npr =3D (PRLI *) temp_ptr; - else if (cmdiocb->iocb_flag & LPFC_PRLI_NVME_REQ) + else if (cmdiocb->cmd_flag & LPFC_PRLI_NVME_REQ) nvpr =3D (struct lpfc_nvme_prli *) temp_ptr; =20 irsp =3D &rspiocb->iocb; diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c index 4e0c0b273e5f..c74b2187dbad 100644 --- a/drivers/scsi/lpfc/lpfc_nvme.c +++ b/drivers/scsi/lpfc/lpfc_nvme.c @@ -352,11 +352,12 @@ __lpfc_nvme_ls_req_cmp(struct lpfc_hba *phba, struct= lpfc_vport *vport, =20 static void lpfc_nvme_ls_req_cmp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdwqe, - struct lpfc_wcqe_complete *wcqe) + struct lpfc_iocbq *rspwqe) { struct lpfc_vport *vport =3D cmdwqe->vport; struct lpfc_nvme_lport *lport; uint32_t status; + struct lpfc_wcqe_complete *wcqe =3D &rspwqe->wcqe_cmpl; =20 status =3D bf_get(lpfc_wcqe_c_status, wcqe) & LPFC_IOCB_STATUS_MASK; =20 @@ -380,7 +381,7 @@ lpfc_nvme_gen_req(struct lpfc_vport *vport, struct lpfc= _dmabuf *bmp, struct lpfc_dmabuf *inp, struct nvmefc_ls_req *pnvme_lsreq, void (*cmpl)(struct lpfc_hba *, struct lpfc_iocbq *, - struct lpfc_wcqe_complete *), + struct lpfc_iocbq *), struct lpfc_nodelist *ndlp, uint32_t num_entry, uint32_t tmo, uint8_t retry) { @@ -401,7 +402,7 @@ lpfc_nvme_gen_req(struct lpfc_vport *vport, struct lpfc= _dmabuf *bmp, memset(wqe, 0, sizeof(union lpfc_wqe)); =20 genwqe->context3 =3D (uint8_t *)bmp; - genwqe->iocb_flag |=3D LPFC_IO_NVME_LS; + genwqe->cmd_flag |=3D LPFC_IO_NVME_LS; =20 /* Save for completion so we can release these resources */ genwqe->context1 =3D lpfc_nlp_get(ndlp); @@ -432,7 +433,7 @@ lpfc_nvme_gen_req(struct lpfc_vport *vport, struct lpfc= _dmabuf *bmp, first_len =3D xmit_len; } =20 - genwqe->rsvd2 =3D num_entry; + genwqe->num_bdes =3D num_entry; genwqe->hba_wqidx =3D 0; =20 /* Words 0 - 2 */ @@ -483,8 +484,7 @@ lpfc_nvme_gen_req(struct lpfc_vport *vport, struct lpfc= _dmabuf *bmp, =20 =20 /* Issue GEN REQ WQE for NPORT */ - genwqe->wqe_cmpl =3D cmpl; - genwqe->iocb_cmpl =3D NULL; + genwqe->cmd_cmpl =3D cmpl; genwqe->drvrTimeout =3D tmo + LPFC_DRVR_TIMEOUT; genwqe->vport =3D vport; genwqe->retry =3D retry; @@ -534,7 +534,7 @@ __lpfc_nvme_ls_req(struct lpfc_vport *vport, struct lpf= c_nodelist *ndlp, struct nvmefc_ls_req *pnvme_lsreq, void (*gen_req_cmp)(struct lpfc_hba *phba, struct lpfc_iocbq *cmdwqe, - struct lpfc_wcqe_complete *wcqe)) + struct lpfc_iocbq *rspwqe)) { struct lpfc_dmabuf *bmp; struct ulp_bde64 *bpl; @@ -722,7 +722,7 @@ __lpfc_nvme_ls_abort(struct lpfc_vport *vport, struct l= pfc_nodelist *ndlp, spin_lock(&pring->ring_lock); list_for_each_entry_safe(wqe, next_wqe, &pring->txcmplq, list) { if (wqe->context2 =3D=3D pnvme_lsreq) { - wqe->iocb_flag |=3D LPFC_DRIVER_ABORTED; + wqe->cmd_flag |=3D LPFC_DRIVER_ABORTED; foundit =3D true; break; } @@ -906,7 +906,7 @@ lpfc_nvme_adj_fcp_sgls(struct lpfc_vport *vport, =20 =20 /* - * lpfc_nvme_io_cmd_wqe_cmpl - Complete an NVME-over-FCP IO + * lpfc_nvme_io_cmd_cmpl - Complete an NVME-over-FCP IO * * Driver registers this routine as it io request handler. This * routine issues an fcp WQE with data from the @lpfc_nvme_fcpreq @@ -917,11 +917,12 @@ lpfc_nvme_adj_fcp_sgls(struct lpfc_vport *vport, * TODO: What are the failure codes. **/ static void -lpfc_nvme_io_cmd_wqe_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pwqeIn, - struct lpfc_wcqe_complete *wcqe) +lpfc_nvme_io_cmd_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pwqeIn, + struct lpfc_iocbq *pwqeOut) { struct lpfc_io_buf *lpfc_ncmd =3D (struct lpfc_io_buf *)pwqeIn->context1; + struct lpfc_wcqe_complete *wcqe =3D &pwqeOut->wcqe_cmpl; struct lpfc_vport *vport =3D pwqeIn->vport; struct nvmefc_fcp_req *nCmd; struct nvme_fc_ersp_iu *ep; @@ -1873,7 +1874,7 @@ lpfc_nvme_fcp_abort(struct nvme_fc_local_port *pnvme_= lport, } =20 /* Don't abort IOs no longer on the pending queue. */ - if (!(nvmereq_wqe->iocb_flag & LPFC_IO_ON_TXCMPLQ)) { + if (!(nvmereq_wqe->cmd_flag & LPFC_IO_ON_TXCMPLQ)) { lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, "6142 NVME IO req x%px not queued - skipping " "abort req xri x%x\n", @@ -1887,7 +1888,7 @@ lpfc_nvme_fcp_abort(struct nvme_fc_local_port *pnvme_= lport, nvmereq_wqe->hba_wqidx, pnvme_rport->port_id); =20 /* Outstanding abort is in progress */ - if (nvmereq_wqe->iocb_flag & LPFC_DRIVER_ABORTED) { + if (nvmereq_wqe->cmd_flag & LPFC_DRIVER_ABORTED) { lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, "6144 Outstanding NVME I/O Abort Request " "still pending on nvme_fcreq x%px, " @@ -1982,8 +1983,8 @@ lpfc_get_nvme_buf(struct lpfc_hba *phba, struct lpfc_= nodelist *ndlp, /* Setup key fields in buffer that may have been changed * if other protocols used this buffer. */ - pwqeq->iocb_flag =3D LPFC_IO_NVME; - pwqeq->wqe_cmpl =3D lpfc_nvme_io_cmd_wqe_cmpl; + pwqeq->cmd_flag =3D LPFC_IO_NVME; + pwqeq->cmd_cmpl =3D lpfc_nvme_io_cmd_cmpl; lpfc_ncmd->start_time =3D jiffies; lpfc_ncmd->flags =3D 0; =20 @@ -2749,6 +2750,7 @@ lpfc_nvme_cancel_iocb(struct lpfc_hba *phba, struct l= pfc_iocbq *pwqeIn, if (phba->sli.sli_flag & LPFC_SLI_ACTIVE) bf_set(lpfc_wcqe_c_xb, wcqep, 1); =20 - (pwqeIn->wqe_cmpl)(phba, pwqeIn, wcqep); + memcpy(&pwqeIn->wcqe_cmpl, wcqep, sizeof(*wcqep)); + (pwqeIn->cmd_cmpl)(phba, pwqeIn, pwqeIn); #endif } diff --git a/drivers/scsi/lpfc/lpfc_nvme.h b/drivers/scsi/lpfc/lpfc_nvme.h index cc54ffb5c205..d7698977725e 100644 --- a/drivers/scsi/lpfc/lpfc_nvme.h +++ b/drivers/scsi/lpfc/lpfc_nvme.h @@ -234,7 +234,7 @@ int __lpfc_nvme_ls_req(struct lpfc_vport *vport, struct= lpfc_nodelist *ndlp, struct nvmefc_ls_req *pnvme_lsreq, void (*gen_req_cmp)(struct lpfc_hba *phba, struct lpfc_iocbq *cmdwqe, - struct lpfc_wcqe_complete *wcqe)); + struct lpfc_iocbq *rspwqe)); void __lpfc_nvme_ls_req_cmp(struct lpfc_hba *phba, struct lpfc_vport *vpo= rt, struct lpfc_iocbq *cmdwqe, struct lpfc_wcqe_complete *wcqe); int __lpfc_nvme_ls_abort(struct lpfc_vport *vport, @@ -248,6 +248,6 @@ int __lpfc_nvme_xmt_ls_rsp(struct lpfc_async_xchg_ctx *= axchg, struct nvmefc_ls_rsp *ls_rsp, void (*xmt_ls_rsp_cmp)(struct lpfc_hba *phba, struct lpfc_iocbq *cmdwqe, - struct lpfc_wcqe_complete *wcqe)); + struct lpfc_iocbq *rspwqe)); void __lpfc_nvme_xmt_ls_rsp_cmp(struct lpfc_hba *phba, - struct lpfc_iocbq *cmdwqe, struct lpfc_wcqe_complete *wcqe); + struct lpfc_iocbq *cmdwqe, struct lpfc_iocbq *rspwqe); diff --git a/drivers/scsi/lpfc/lpfc_nvmet.c b/drivers/scsi/lpfc/lpfc_nvmet.c index 6e3dd0b9bcfa..5188cc8e2413 100644 --- a/drivers/scsi/lpfc/lpfc_nvmet.c +++ b/drivers/scsi/lpfc/lpfc_nvmet.c @@ -285,7 +285,7 @@ lpfc_nvmet_defer_release(struct lpfc_hba *phba, * transmission of an NVME LS response. * @phba: Pointer to HBA context object. * @cmdwqe: Pointer to driver command WQE object. - * @wcqe: Pointer to driver response CQE object. + * @rspwqe: Pointer to driver response WQE object. * * The function is called from SLI ring event handler with no * lock held. The function frees memory resources used for the command @@ -293,9 +293,10 @@ lpfc_nvmet_defer_release(struct lpfc_hba *phba, **/ void __lpfc_nvme_xmt_ls_rsp_cmp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdwq= e, - struct lpfc_wcqe_complete *wcqe) + struct lpfc_iocbq *rspwqe) { struct lpfc_async_xchg_ctx *axchg =3D cmdwqe->context2; + struct lpfc_wcqe_complete *wcqe =3D &rspwqe->wcqe_cmpl; struct nvmefc_ls_rsp *ls_rsp =3D &axchg->ls_rsp; uint32_t status, result; =20 @@ -331,7 +332,7 @@ __lpfc_nvme_xmt_ls_rsp_cmp(struct lpfc_hba *phba, struc= t lpfc_iocbq *cmdwqe, * lpfc_nvmet_xmt_ls_rsp_cmp - Completion handler for LS Response * @phba: Pointer to HBA context object. * @cmdwqe: Pointer to driver command WQE object. - * @wcqe: Pointer to driver response CQE object. + * @rspwqe: Pointer to driver response WQE object. * * The function is called from SLI ring event handler with no * lock held. This function is the completion handler for NVME LS commands @@ -340,10 +341,11 @@ __lpfc_nvme_xmt_ls_rsp_cmp(struct lpfc_hba *phba, str= uct lpfc_iocbq *cmdwqe, **/ static void lpfc_nvmet_xmt_ls_rsp_cmp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdwqe, - struct lpfc_wcqe_complete *wcqe) + struct lpfc_iocbq *rspwqe) { struct lpfc_nvmet_tgtport *tgtp; uint32_t status, result; + struct lpfc_wcqe_complete *wcqe =3D &rspwqe->wcqe_cmpl; =20 if (!phba->targetport) goto finish; @@ -365,7 +367,7 @@ lpfc_nvmet_xmt_ls_rsp_cmp(struct lpfc_hba *phba, struct= lpfc_iocbq *cmdwqe, } =20 finish: - __lpfc_nvme_xmt_ls_rsp_cmp(phba, cmdwqe, wcqe); + __lpfc_nvme_xmt_ls_rsp_cmp(phba, cmdwqe, rspwqe); } =20 /** @@ -707,7 +709,7 @@ lpfc_nvmet_ktime(struct lpfc_hba *phba, * lpfc_nvmet_xmt_fcp_op_cmp - Completion handler for FCP Response * @phba: Pointer to HBA context object. * @cmdwqe: Pointer to driver command WQE object. - * @wcqe: Pointer to driver response CQE object. + * @rspwqe: Pointer to driver response WQE object. * * The function is called from SLI ring event handler with no * lock held. This function is the completion handler for NVME FCP commands @@ -715,12 +717,13 @@ lpfc_nvmet_ktime(struct lpfc_hba *phba, **/ static void lpfc_nvmet_xmt_fcp_op_cmp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdwqe, - struct lpfc_wcqe_complete *wcqe) + struct lpfc_iocbq *rspwqe) { struct lpfc_nvmet_tgtport *tgtp; struct nvmefc_tgt_fcp_req *rsp; struct lpfc_async_xchg_ctx *ctxp; uint32_t status, result, op, start_clean, logerr; + struct lpfc_wcqe_complete *wcqe =3D &rspwqe->wcqe_cmpl; #ifdef CONFIG_SCSI_LPFC_DEBUG_FS int id; #endif @@ -817,7 +820,7 @@ lpfc_nvmet_xmt_fcp_op_cmp(struct lpfc_hba *phba, struct= lpfc_iocbq *cmdwqe, /* lpfc_nvmet_xmt_fcp_release() will recycle the context */ } else { ctxp->entry_cnt++; - start_clean =3D offsetof(struct lpfc_iocbq, iocb_flag); + start_clean =3D offsetof(struct lpfc_iocbq, cmd_flag); memset(((char *)cmdwqe) + start_clean, 0, (sizeof(struct lpfc_iocbq) - start_clean)); #ifdef CONFIG_SCSI_LPFC_DEBUG_FS @@ -862,7 +865,7 @@ __lpfc_nvme_xmt_ls_rsp(struct lpfc_async_xchg_ctx *axch= g, struct nvmefc_ls_rsp *ls_rsp, void (*xmt_ls_rsp_cmp)(struct lpfc_hba *phba, struct lpfc_iocbq *cmdwqe, - struct lpfc_wcqe_complete *wcqe)) + struct lpfc_iocbq *rspwqe)) { struct lpfc_hba *phba =3D axchg->phba; struct hbq_dmabuf *nvmebuf =3D (struct hbq_dmabuf *)axchg->rqb_buffer; @@ -898,7 +901,7 @@ __lpfc_nvme_xmt_ls_rsp(struct lpfc_async_xchg_ctx *axch= g, } =20 /* Save numBdes for bpl2sgl */ - nvmewqeq->rsvd2 =3D 1; + nvmewqeq->num_bdes =3D 1; nvmewqeq->hba_wqidx =3D 0; nvmewqeq->context3 =3D &dmabuf; dmabuf.virt =3D &bpl; @@ -913,8 +916,7 @@ __lpfc_nvme_xmt_ls_rsp(struct lpfc_async_xchg_ctx *axch= g, * be referenced after it returns back to this routine. */ =20 - nvmewqeq->wqe_cmpl =3D xmt_ls_rsp_cmp; - nvmewqeq->iocb_cmpl =3D NULL; + nvmewqeq->cmd_cmpl =3D xmt_ls_rsp_cmp; nvmewqeq->context2 =3D axchg; =20 lpfc_nvmeio_data(phba, "NVMEx LS RSP: xri x%x wqidx x%x len x%x\n", @@ -1072,10 +1074,9 @@ lpfc_nvmet_xmt_fcp_op(struct nvmet_fc_target_port *t= gtport, goto aerr; } =20 - nvmewqeq->wqe_cmpl =3D lpfc_nvmet_xmt_fcp_op_cmp; - nvmewqeq->iocb_cmpl =3D NULL; + nvmewqeq->cmd_cmpl =3D lpfc_nvmet_xmt_fcp_op_cmp; nvmewqeq->context2 =3D ctxp; - nvmewqeq->iocb_flag |=3D LPFC_IO_NVMET; + nvmewqeq->cmd_flag |=3D LPFC_IO_NVMET; ctxp->wqeq->hba_wqidx =3D rsp->hwqid; =20 lpfc_nvmeio_data(phba, "NVMET FCP CMND: xri x%x op x%x len x%x\n", @@ -1275,7 +1276,7 @@ lpfc_nvmet_defer_rcv(struct nvmet_fc_target_port *tgt= port, * lpfc_nvmet_ls_req_cmp - completion handler for a nvme ls request * @phba: Pointer to HBA context object * @cmdwqe: Pointer to driver command WQE object. - * @wcqe: Pointer to driver response CQE object. + * @rspwqe: Pointer to driver response WQE object. * * This function is the completion handler for NVME LS requests. * The function updates any states and statistics, then calls the @@ -1283,8 +1284,9 @@ lpfc_nvmet_defer_rcv(struct nvmet_fc_target_port *tgt= port, **/ static void lpfc_nvmet_ls_req_cmp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdwqe, - struct lpfc_wcqe_complete *wcqe) + struct lpfc_iocbq *rspwqe) { + struct lpfc_wcqe_complete *wcqe =3D &rspwqe->wcqe_cmpl; __lpfc_nvme_ls_req_cmp(phba, cmdwqe->vport, cmdwqe, wcqe); } =20 @@ -1581,7 +1583,7 @@ lpfc_nvmet_setup_io_context(struct lpfc_hba *phba) "6406 Ran out of NVMET iocb/WQEs\n"); return -ENOMEM; } - ctx_buf->iocbq->iocb_flag =3D LPFC_IO_NVMET; + ctx_buf->iocbq->cmd_flag =3D LPFC_IO_NVMET; nvmewqe =3D ctx_buf->iocbq; wqe =3D &nvmewqe->wqe; =20 @@ -2027,8 +2029,10 @@ lpfc_nvmet_wqfull_flush(struct lpfc_hba *phba, struc= t lpfc_queue *wq, list_del(&nvmewqeq->list); spin_unlock_irqrestore(&pring->ring_lock, iflags); + memcpy(&nvmewqeq->wcqe_cmpl, wcqep, + sizeof(*wcqep)); lpfc_nvmet_xmt_fcp_op_cmp(phba, nvmewqeq, - wcqep); + nvmewqeq); return; } continue; @@ -2036,7 +2040,8 @@ lpfc_nvmet_wqfull_flush(struct lpfc_hba *phba, struct= lpfc_queue *wq, /* Flush all IOs */ list_del(&nvmewqeq->list); spin_unlock_irqrestore(&pring->ring_lock, iflags); - lpfc_nvmet_xmt_fcp_op_cmp(phba, nvmewqeq, wcqep); + memcpy(&nvmewqeq->wcqe_cmpl, wcqep, sizeof(*wcqep)); + lpfc_nvmet_xmt_fcp_op_cmp(phba, nvmewqeq, nvmewqeq); spin_lock_irqsave(&pring->ring_lock, iflags); } } @@ -2676,7 +2681,7 @@ lpfc_nvmet_prep_ls_wqe(struct lpfc_hba *phba, nvmewqe->retry =3D 1; nvmewqe->vport =3D phba->pport; nvmewqe->drvrTimeout =3D (phba->fc_ratov * 3) + LPFC_DRVR_TIMEOUT; - nvmewqe->iocb_flag |=3D LPFC_IO_NVME_LS; + nvmewqe->cmd_flag |=3D LPFC_IO_NVME_LS; =20 /* Xmit NVMET response to remote NPORT */ lpfc_printf_log(phba, KERN_INFO, LOG_NVME_DISC, @@ -3033,7 +3038,7 @@ lpfc_nvmet_prep_fcp_wqe(struct lpfc_hba *phba, * lpfc_nvmet_sol_fcp_abort_cmp - Completion handler for ABTS * @phba: Pointer to HBA context object. * @cmdwqe: Pointer to driver command WQE object. - * @wcqe: Pointer to driver response CQE object. + * @rspwqe: Pointer to driver response WQE object. * * The function is called from SLI ring event handler with no * lock held. This function is the completion handler for NVME ABTS for FC= P cmds @@ -3041,13 +3046,14 @@ lpfc_nvmet_prep_fcp_wqe(struct lpfc_hba *phba, **/ static void lpfc_nvmet_sol_fcp_abort_cmp(struct lpfc_hba *phba, struct lpfc_iocbq *cmd= wqe, - struct lpfc_wcqe_complete *wcqe) + struct lpfc_iocbq *rspwqe) { struct lpfc_async_xchg_ctx *ctxp; struct lpfc_nvmet_tgtport *tgtp; uint32_t result; unsigned long flags; bool released =3D false; + struct lpfc_wcqe_complete *wcqe =3D &rspwqe->wcqe_cmpl; =20 ctxp =3D cmdwqe->context2; result =3D wcqe->parameter; @@ -3102,7 +3108,7 @@ lpfc_nvmet_sol_fcp_abort_cmp(struct lpfc_hba *phba, s= truct lpfc_iocbq *cmdwqe, * lpfc_nvmet_unsol_fcp_abort_cmp - Completion handler for ABTS * @phba: Pointer to HBA context object. * @cmdwqe: Pointer to driver command WQE object. - * @wcqe: Pointer to driver response CQE object. + * @rspwqe: Pointer to driver response WQE object. * * The function is called from SLI ring event handler with no * lock held. This function is the completion handler for NVME ABTS for FC= P cmds @@ -3110,13 +3116,14 @@ lpfc_nvmet_sol_fcp_abort_cmp(struct lpfc_hba *phba,= struct lpfc_iocbq *cmdwqe, **/ static void lpfc_nvmet_unsol_fcp_abort_cmp(struct lpfc_hba *phba, struct lpfc_iocbq *c= mdwqe, - struct lpfc_wcqe_complete *wcqe) + struct lpfc_iocbq *rspwqe) { struct lpfc_async_xchg_ctx *ctxp; struct lpfc_nvmet_tgtport *tgtp; unsigned long flags; uint32_t result; bool released =3D false; + struct lpfc_wcqe_complete *wcqe =3D &rspwqe->wcqe_cmpl; =20 ctxp =3D cmdwqe->context2; result =3D wcqe->parameter; @@ -3183,7 +3190,7 @@ lpfc_nvmet_unsol_fcp_abort_cmp(struct lpfc_hba *phba,= struct lpfc_iocbq *cmdwqe, * lpfc_nvmet_xmt_ls_abort_cmp - Completion handler for ABTS * @phba: Pointer to HBA context object. * @cmdwqe: Pointer to driver command WQE object. - * @wcqe: Pointer to driver response CQE object. + * @rspwqe: Pointer to driver response WQE object. * * The function is called from SLI ring event handler with no * lock held. This function is the completion handler for NVME ABTS for LS= cmds @@ -3191,11 +3198,12 @@ lpfc_nvmet_unsol_fcp_abort_cmp(struct lpfc_hba *phb= a, struct lpfc_iocbq *cmdwqe, **/ static void lpfc_nvmet_xmt_ls_abort_cmp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdw= qe, - struct lpfc_wcqe_complete *wcqe) + struct lpfc_iocbq *rspwqe) { struct lpfc_async_xchg_ctx *ctxp; struct lpfc_nvmet_tgtport *tgtp; uint32_t result; + struct lpfc_wcqe_complete *wcqe =3D &rspwqe->wcqe_cmpl; =20 ctxp =3D cmdwqe->context2; result =3D wcqe->parameter; @@ -3319,7 +3327,7 @@ lpfc_nvmet_unsol_issue_abort(struct lpfc_hba *phba, abts_wqeq->context1 =3D ndlp; abts_wqeq->context2 =3D ctxp; abts_wqeq->context3 =3D NULL; - abts_wqeq->rsvd2 =3D 0; + abts_wqeq->num_bdes =3D 0; /* hba_wqidx should already be setup from command we are aborting */ abts_wqeq->iocb.ulpCommand =3D CMD_XMIT_SEQUENCE64_CR; abts_wqeq->iocb.ulpLe =3D 1; @@ -3448,7 +3456,7 @@ lpfc_nvmet_sol_fcp_issue_abort(struct lpfc_hba *phba, } =20 /* Outstanding abort is in progress */ - if (abts_wqeq->iocb_flag & LPFC_DRIVER_ABORTED) { + if (abts_wqeq->cmd_flag & LPFC_DRIVER_ABORTED) { spin_unlock_irqrestore(&phba->hbalock, flags); atomic_inc(&tgtp->xmt_abort_rsp_error); lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, @@ -3463,15 +3471,14 @@ lpfc_nvmet_sol_fcp_issue_abort(struct lpfc_hba *phb= a, } =20 /* Ready - mark outstanding as aborted by driver. */ - abts_wqeq->iocb_flag |=3D LPFC_DRIVER_ABORTED; + abts_wqeq->cmd_flag |=3D LPFC_DRIVER_ABORTED; =20 lpfc_nvmet_prep_abort_wqe(abts_wqeq, ctxp->wqeq->sli4_xritag, opt); =20 /* ABTS WQE must go to the same WQ as the WQE to be aborted */ abts_wqeq->hba_wqidx =3D ctxp->wqeq->hba_wqidx; - abts_wqeq->wqe_cmpl =3D lpfc_nvmet_sol_fcp_abort_cmp; - abts_wqeq->iocb_cmpl =3D NULL; - abts_wqeq->iocb_flag |=3D LPFC_IO_NVME; + abts_wqeq->cmd_cmpl =3D lpfc_nvmet_sol_fcp_abort_cmp; + abts_wqeq->cmd_flag |=3D LPFC_IO_NVME; abts_wqeq->context2 =3D ctxp; abts_wqeq->vport =3D phba->pport; if (!ctxp->hdwq) @@ -3528,9 +3535,8 @@ lpfc_nvmet_unsol_fcp_issue_abort(struct lpfc_hba *phb= a, =20 spin_lock_irqsave(&phba->hbalock, flags); abts_wqeq =3D ctxp->wqeq; - abts_wqeq->wqe_cmpl =3D lpfc_nvmet_unsol_fcp_abort_cmp; - abts_wqeq->iocb_cmpl =3D NULL; - abts_wqeq->iocb_flag |=3D LPFC_IO_NVMET; + abts_wqeq->cmd_cmpl =3D lpfc_nvmet_unsol_fcp_abort_cmp; + abts_wqeq->cmd_flag |=3D LPFC_IO_NVMET; if (!ctxp->hdwq) ctxp->hdwq =3D &phba->sli4_hba.hdwq[abts_wqeq->hba_wqidx]; =20 @@ -3614,9 +3620,8 @@ lpfc_nvme_unsol_ls_issue_abort(struct lpfc_hba *phba, } =20 spin_lock_irqsave(&phba->hbalock, flags); - abts_wqeq->wqe_cmpl =3D lpfc_nvmet_xmt_ls_abort_cmp; - abts_wqeq->iocb_cmpl =3D NULL; - abts_wqeq->iocb_flag |=3D LPFC_IO_NVME_LS; + abts_wqeq->cmd_cmpl =3D lpfc_nvmet_xmt_ls_abort_cmp; + abts_wqeq->cmd_flag |=3D LPFC_IO_NVME_LS; rc =3D lpfc_sli4_issue_wqe(phba, ctxp->hdwq, abts_wqeq); spin_unlock_irqrestore(&phba->hbalock, flags); if (rc =3D=3D WQE_SUCCESS) { diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index ea93b7e07b7e..765849643aed 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -362,7 +362,7 @@ lpfc_new_scsi_buf_s3(struct lpfc_vport *vport, int num_= to_alloc) kfree(psb); break; } - psb->cur_iocbq.iocb_flag |=3D LPFC_IO_FCP; + psb->cur_iocbq.cmd_flag |=3D LPFC_IO_FCP; =20 psb->fcp_cmnd =3D psb->data; psb->fcp_rsp =3D psb->data + sizeof(struct fcp_cmnd); @@ -468,7 +468,7 @@ lpfc_sli4_vport_delete_fcp_xri_aborted(struct lpfc_vpor= t *vport) spin_lock(&qp->abts_io_buf_list_lock); list_for_each_entry_safe(psb, next_psb, &qp->lpfc_abts_io_buf_list, list) { - if (psb->cur_iocbq.iocb_flag & LPFC_IO_NVME) + if (psb->cur_iocbq.cmd_flag & LPFC_IO_NVME) continue; =20 if (psb->rdata && psb->rdata->pnode && @@ -524,7 +524,7 @@ lpfc_sli4_io_xri_aborted(struct lpfc_hba *phba, list_del_init(&psb->list); psb->flags &=3D ~LPFC_SBUF_XBUSY; psb->status =3D IOSTAT_SUCCESS; - if (psb->cur_iocbq.iocb_flag & LPFC_IO_NVME) { + if (psb->cur_iocbq.cmd_flag & LPFC_IO_NVME) { qp->abts_nvme_io_bufs--; spin_unlock(&qp->abts_io_buf_list_lock); spin_unlock_irqrestore(&phba->hbalock, iflag); @@ -571,7 +571,7 @@ lpfc_sli4_io_xri_aborted(struct lpfc_hba *phba, * for command completion wake up the thread. */ spin_lock_irqsave(&psb->buf_lock, iflag); - psb->cur_iocbq.iocb_flag &=3D + psb->cur_iocbq.cmd_flag &=3D ~LPFC_DRIVER_ABORTED; if (psb->waitq) wake_up(psb->waitq); @@ -593,8 +593,8 @@ lpfc_sli4_io_xri_aborted(struct lpfc_hba *phba, for (i =3D 1; i <=3D phba->sli.last_iotag; i++) { iocbq =3D phba->sli.iocbq_lookup[i]; =20 - if (!(iocbq->iocb_flag & LPFC_IO_FCP) || - (iocbq->iocb_flag & LPFC_IO_LIBDFC)) + if (!(iocbq->cmd_flag & LPFC_IO_FCP) || + (iocbq->cmd_flag & LPFC_IO_LIBDFC)) continue; if (iocbq->sli4_xritag !=3D xri) continue; @@ -695,7 +695,7 @@ lpfc_get_scsi_buf_s4(struct lpfc_hba *phba, struct lpfc= _nodelist *ndlp, /* Setup key fields in buffer that may have been changed * if other protocols used this buffer. */ - lpfc_cmd->cur_iocbq.iocb_flag =3D LPFC_IO_FCP; + lpfc_cmd->cur_iocbq.cmd_flag =3D LPFC_IO_FCP; lpfc_cmd->prot_seg_cnt =3D 0; lpfc_cmd->seg_cnt =3D 0; lpfc_cmd->timeout =3D 0; @@ -783,7 +783,7 @@ lpfc_release_scsi_buf_s3(struct lpfc_hba *phba, struct = lpfc_io_buf *psb) =20 spin_lock_irqsave(&phba->scsi_buf_list_put_lock, iflag); psb->pCmd =3D NULL; - psb->cur_iocbq.iocb_flag =3D LPFC_IO_FCP; + psb->cur_iocbq.cmd_flag =3D LPFC_IO_FCP; list_add_tail(&psb->list, &phba->lpfc_scsi_buf_list_put); spin_unlock_irqrestore(&phba->scsi_buf_list_put_lock, iflag); } @@ -931,7 +931,7 @@ lpfc_scsi_prep_dma_buf_s3(struct lpfc_hba *phba, struct= lpfc_io_buf *lpfc_cmd) physaddr =3D sg_dma_address(sgel); if (phba->sli_rev =3D=3D 3 && !(phba->sli3_options & LPFC_SLI3_BG_ENABLED) && - !(iocbq->iocb_flag & DSS_SECURITY_OP) && + !(iocbq->cmd_flag & DSS_SECURITY_OP) && nseg <=3D LPFC_EXT_DATA_BDE_COUNT) { data_bde->tus.f.bdeFlags =3D BUFF_TYPE_BDE_64; data_bde->tus.f.bdeSize =3D sg_dma_len(sgel); @@ -959,7 +959,7 @@ lpfc_scsi_prep_dma_buf_s3(struct lpfc_hba *phba, struct= lpfc_io_buf *lpfc_cmd) */ if (phba->sli_rev =3D=3D 3 && !(phba->sli3_options & LPFC_SLI3_BG_ENABLED) && - !(iocbq->iocb_flag & DSS_SECURITY_OP)) { + !(iocbq->cmd_flag & DSS_SECURITY_OP)) { if (num_bde > LPFC_EXT_DATA_BDE_COUNT) { /* * The extended IOCB format can only fit 3 BDE or a BPL. @@ -3434,7 +3434,7 @@ lpfc_scsi_prep_dma_buf_s4(struct lpfc_hba *phba, stru= ct lpfc_io_buf *lpfc_cmd) */ if ((phba->cfg_fof) && ((struct lpfc_device_data *) scsi_cmnd->device->hostdata)->oas_enabled) { - lpfc_cmd->cur_iocbq.iocb_flag |=3D (LPFC_IO_OAS | LPFC_IO_FOF); + lpfc_cmd->cur_iocbq.cmd_flag |=3D (LPFC_IO_OAS | LPFC_IO_FOF); lpfc_cmd->cur_iocbq.priority =3D ((struct lpfc_device_data *) scsi_cmnd->device->hostdata)->priority; =20 @@ -3591,15 +3591,15 @@ lpfc_bg_scsi_prep_dma_buf_s4(struct lpfc_hba *phba, switch (scsi_get_prot_op(scsi_cmnd)) { case SCSI_PROT_WRITE_STRIP: case SCSI_PROT_READ_STRIP: - lpfc_cmd->cur_iocbq.iocb_flag |=3D LPFC_IO_DIF_STRIP; + lpfc_cmd->cur_iocbq.cmd_flag |=3D LPFC_IO_DIF_STRIP; break; case SCSI_PROT_WRITE_INSERT: case SCSI_PROT_READ_INSERT: - lpfc_cmd->cur_iocbq.iocb_flag |=3D LPFC_IO_DIF_INSERT; + lpfc_cmd->cur_iocbq.cmd_flag |=3D LPFC_IO_DIF_INSERT; break; case SCSI_PROT_WRITE_PASS: case SCSI_PROT_READ_PASS: - lpfc_cmd->cur_iocbq.iocb_flag |=3D LPFC_IO_DIF_PASS; + lpfc_cmd->cur_iocbq.cmd_flag |=3D LPFC_IO_DIF_PASS; break; } =20 @@ -3630,7 +3630,7 @@ lpfc_bg_scsi_prep_dma_buf_s4(struct lpfc_hba *phba, */ if ((phba->cfg_fof) && ((struct lpfc_device_data *) scsi_cmnd->device->hostdata)->oas_enabled) { - lpfc_cmd->cur_iocbq.iocb_flag |=3D (LPFC_IO_OAS | LPFC_IO_FOF); + lpfc_cmd->cur_iocbq.cmd_flag |=3D (LPFC_IO_OAS | LPFC_IO_FOF); =20 /* Word 10 */ bf_set(wqe_oas, &wqe->generic.wqe_com, 1); @@ -3640,14 +3640,14 @@ lpfc_bg_scsi_prep_dma_buf_s4(struct lpfc_hba *phba, } =20 /* Word 7. DIF Flags */ - if (lpfc_cmd->cur_iocbq.iocb_flag & LPFC_IO_DIF_PASS) + if (lpfc_cmd->cur_iocbq.cmd_flag & LPFC_IO_DIF_PASS) bf_set(wqe_dif, &wqe->generic.wqe_com, LPFC_WQE_DIF_PASSTHRU); - else if (lpfc_cmd->cur_iocbq.iocb_flag & LPFC_IO_DIF_STRIP) + else if (lpfc_cmd->cur_iocbq.cmd_flag & LPFC_IO_DIF_STRIP) bf_set(wqe_dif, &wqe->generic.wqe_com, LPFC_WQE_DIF_STRIP); - else if (lpfc_cmd->cur_iocbq.iocb_flag & LPFC_IO_DIF_INSERT) + else if (lpfc_cmd->cur_iocbq.cmd_flag & LPFC_IO_DIF_INSERT) bf_set(wqe_dif, &wqe->generic.wqe_com, LPFC_WQE_DIF_INSERT); =20 - lpfc_cmd->cur_iocbq.iocb_flag &=3D ~(LPFC_IO_DIF_PASS | + lpfc_cmd->cur_iocbq.cmd_flag &=3D ~(LPFC_IO_DIF_PASS | LPFC_IO_DIF_STRIP | LPFC_IO_DIF_INSERT); =20 return 0; @@ -4172,7 +4172,7 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct = lpfc_io_buf *lpfc_cmd, * lpfc_fcp_io_cmd_wqe_cmpl - Complete a FCP IO * @phba: The hba for which this call is being executed. * @pwqeIn: The command WQE for the scsi cmnd. - * @wcqe: Pointer to driver response CQE object. + * @pwqeOut: Pointer to driver response WQE object. * * This routine assigns scsi command result by looking into response WQE * status field appropriately. This routine handles QUEUE FULL condition as @@ -4180,10 +4180,11 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struc= t lpfc_io_buf *lpfc_cmd, **/ static void lpfc_fcp_io_cmd_wqe_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pwqeIn, - struct lpfc_wcqe_complete *wcqe) + struct lpfc_iocbq *pwqeOut) { struct lpfc_io_buf *lpfc_cmd =3D (struct lpfc_io_buf *)pwqeIn->context1; + struct lpfc_wcqe_complete *wcqe =3D &pwqeOut->wcqe_cmpl; struct lpfc_vport *vport =3D pwqeIn->vport; struct lpfc_rport_data *rdata; struct lpfc_nodelist *ndlp; @@ -4216,7 +4217,7 @@ lpfc_fcp_io_cmd_wqe_cmpl(struct lpfc_hba *phba, struc= t lpfc_iocbq *pwqeIn, * This needs to be done outside buf_lock */ spin_lock_irqsave(&phba->hbalock, iflags); - lpfc_cmd->cur_iocbq.iocb_flag |=3D LPFC_EXCHANGE_BUSY; + lpfc_cmd->cur_iocbq.cmd_flag |=3D LPFC_EXCHANGE_BUSY; spin_unlock_irqrestore(&phba->hbalock, iflags); } =20 @@ -4507,7 +4508,7 @@ lpfc_fcp_io_cmd_wqe_cmpl(struct lpfc_hba *phba, struc= t lpfc_iocbq *pwqeIn, * wake up the thread. */ spin_lock(&lpfc_cmd->buf_lock); - lpfc_cmd->cur_iocbq.iocb_flag &=3D ~LPFC_DRIVER_ABORTED; + lpfc_cmd->cur_iocbq.cmd_flag &=3D ~LPFC_DRIVER_ABORTED; if (lpfc_cmd->waitq) wake_up(lpfc_cmd->waitq); spin_unlock(&lpfc_cmd->buf_lock); @@ -4567,7 +4568,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct= lpfc_iocbq *pIocbIn, lpfc_cmd->status =3D pIocbOut->iocb.ulpStatus; /* pick up SLI4 exchange busy status from HBA */ lpfc_cmd->flags &=3D ~LPFC_SBUF_XBUSY; - if (pIocbOut->iocb_flag & LPFC_EXCHANGE_BUSY) + if (pIocbOut->cmd_flag & LPFC_EXCHANGE_BUSY) lpfc_cmd->flags |=3D LPFC_SBUF_XBUSY; =20 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS @@ -4776,7 +4777,7 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct= lpfc_iocbq *pIocbIn, * wake up the thread. */ spin_lock(&lpfc_cmd->buf_lock); - lpfc_cmd->cur_iocbq.iocb_flag &=3D ~LPFC_DRIVER_ABORTED; + lpfc_cmd->cur_iocbq.cmd_flag &=3D ~LPFC_DRIVER_ABORTED; if (lpfc_cmd->waitq) wake_up(lpfc_cmd->waitq); spin_unlock(&lpfc_cmd->buf_lock); @@ -4854,8 +4855,8 @@ static int lpfc_scsi_prep_cmnd_buf_s3(struct lpfc_vpo= rt *vport, =20 piocbq->iocb.ulpClass =3D (pnode->nlp_fcp_info & 0x0f); piocbq->context1 =3D lpfc_cmd; - if (!piocbq->iocb_cmpl) - piocbq->iocb_cmpl =3D lpfc_scsi_cmd_iocb_cmpl; + if (!piocbq->cmd_cmpl) + piocbq->cmd_cmpl =3D lpfc_scsi_cmd_iocb_cmpl; piocbq->iocb.ulpTimeout =3D tmo; piocbq->vport =3D vport; return 0; @@ -4968,7 +4969,7 @@ static int lpfc_scsi_prep_cmnd_buf_s4(struct lpfc_vpo= rt *vport, pwqeq->vport =3D vport; pwqeq->context1 =3D lpfc_cmd; pwqeq->hba_wqidx =3D lpfc_cmd->hdwq_no; - pwqeq->wqe_cmpl =3D lpfc_fcp_io_cmd_wqe_cmpl; + pwqeq->cmd_cmpl =3D lpfc_fcp_io_cmd_wqe_cmpl; =20 return 0; } @@ -5690,7 +5691,7 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scs= i_cmnd *cmnd) lpfc_cmd->pCmd =3D cmnd; lpfc_cmd->rdata =3D rdata; lpfc_cmd->ndlp =3D ndlp; - lpfc_cmd->cur_iocbq.iocb_cmpl =3D NULL; + lpfc_cmd->cur_iocbq.cmd_cmpl =3D NULL; cmnd->host_scribble =3D (unsigned char *)lpfc_cmd; =20 err =3D lpfc_scsi_prep_cmnd(vport, lpfc_cmd, ndlp); @@ -5747,7 +5748,7 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scs= i_cmnd *cmnd) (union lpfc_vmid_io_tag *) &lpfc_cmd->cur_iocbq.vmid_tag); if (!err) - lpfc_cmd->cur_iocbq.iocb_flag |=3D LPFC_IO_VMID; + lpfc_cmd->cur_iocbq.cmd_flag |=3D LPFC_IO_VMID; } } =20 @@ -5935,7 +5936,7 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) spin_lock(&pring_s4->ring_lock); } /* the command is in process of being cancelled */ - if (!(iocb->iocb_flag & LPFC_IO_ON_TXCMPLQ)) { + if (!(iocb->cmd_flag & LPFC_IO_ON_TXCMPLQ)) { lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, "3169 SCSI Layer abort requested I/O has been " "cancelled by LLD.\n"); @@ -5958,7 +5959,7 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) BUG_ON(iocb->context1 !=3D lpfc_cmd); =20 /* abort issued in recovery is still in progress */ - if (iocb->iocb_flag & LPFC_DRIVER_ABORTED) { + if (iocb->cmd_flag & LPFC_DRIVER_ABORTED) { lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP, "3389 SCSI Layer I/O Abort Request is pending\n"); if (phba->sli_rev =3D=3D LPFC_SLI_REV4) @@ -5999,7 +6000,7 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd) =20 wait_for_cmpl: /* - * iocb_flag is set to LPFC_DRIVER_ABORTED before we wait + * cmd_flag is set to LPFC_DRIVER_ABORTED before we wait * for abort to complete. */ wait_event_timeout(waitq, @@ -6187,14 +6188,14 @@ lpfc_send_taskmgmt(struct lpfc_vport *vport, struct= scsi_cmnd *cmnd, lpfc_release_scsi_buf(phba, lpfc_cmd); return FAILED; } - iocbq->iocb_cmpl =3D lpfc_tskmgmt_def_cmpl; + iocbq->cmd_cmpl =3D lpfc_tskmgmt_def_cmpl; =20 lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP, "0702 Issue %s to TGT %d LUN %llu " "rpi x%x nlp_flag x%x Data: x%x x%x\n", lpfc_taskmgmt_name(task_mgmt_cmd), tgt_id, lun_id, pnode->nlp_rpi, pnode->nlp_flag, iocbq->sli4_xritag, - iocbq->iocb_flag); + iocbq->cmd_flag); =20 status =3D lpfc_sli_issue_iocb_wait(phba, LPFC_FCP_RING, iocbq, iocbqrsp, lpfc_cmd->timeout); @@ -6204,12 +6205,12 @@ lpfc_send_taskmgmt(struct lpfc_vport *vport, struct= scsi_cmnd *cmnd, iocbqrsp->iocb.ulpStatus !=3D IOSTAT_FCP_RSP_ERROR) lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, "0727 TMF %s to TGT %d LUN %llu " - "failed (%d, %d) iocb_flag x%x\n", + "failed (%d, %d) cmd_flag x%x\n", lpfc_taskmgmt_name(task_mgmt_cmd), tgt_id, lun_id, iocbqrsp->iocb.ulpStatus, iocbqrsp->iocb.un.ulpWord[4], - iocbq->iocb_flag); + iocbq->cmd_flag); /* if ulpStatus !=3D IOCB_SUCCESS, then status =3D=3D IOCB_SUCCESS */ if (status =3D=3D IOCB_SUCCESS) { if (iocbqrsp->iocb.ulpStatus =3D=3D IOSTAT_FCP_RSP_ERROR) diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index e905a246a2d6..413824fc9533 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -1254,21 +1254,21 @@ __lpfc_sli_get_els_sglq(struct lpfc_hba *phba, stru= ct lpfc_iocbq *piocbq) struct lpfc_sli_ring *pring =3D NULL; int found =3D 0; =20 - if (piocbq->iocb_flag & LPFC_IO_NVME_LS) + if (piocbq->cmd_flag & LPFC_IO_NVME_LS) pring =3D phba->sli4_hba.nvmels_wq->pring; else pring =3D lpfc_phba_elsring(phba); =20 lockdep_assert_held(&pring->ring_lock); =20 - if (piocbq->iocb_flag & LPFC_IO_FCP) { + if (piocbq->cmd_flag & LPFC_IO_FCP) { lpfc_cmd =3D (struct lpfc_io_buf *) piocbq->context1; ndlp =3D lpfc_cmd->rdata->pnode; } else if ((piocbq->iocb.ulpCommand =3D=3D CMD_GEN_REQUEST64_CR) && - !(piocbq->iocb_flag & LPFC_IO_LIBDFC)) { + !(piocbq->cmd_flag & LPFC_IO_LIBDFC)) { ndlp =3D piocbq->context_un.ndlp; - } else if (piocbq->iocb_flag & LPFC_IO_LIBDFC) { - if (piocbq->iocb_flag & LPFC_IO_LOOPBACK) + } else if (piocbq->cmd_flag & LPFC_IO_LIBDFC) { + if (piocbq->cmd_flag & LPFC_IO_LOOPBACK) ndlp =3D NULL; else ndlp =3D piocbq->context_un.ndlp; @@ -1391,7 +1391,7 @@ __lpfc_sli_release_iocbq_s4(struct lpfc_hba *phba, st= ruct lpfc_iocbq *iocbq) =20 =20 if (sglq) { - if (iocbq->iocb_flag & LPFC_IO_NVMET) { + if (iocbq->cmd_flag & LPFC_IO_NVMET) { spin_lock_irqsave(&phba->sli4_hba.sgl_list_lock, iflag); sglq->state =3D SGL_FREED; @@ -1403,7 +1403,7 @@ __lpfc_sli_release_iocbq_s4(struct lpfc_hba *phba, st= ruct lpfc_iocbq *iocbq) goto out; } =20 - if ((iocbq->iocb_flag & LPFC_EXCHANGE_BUSY) && + if ((iocbq->cmd_flag & LPFC_EXCHANGE_BUSY) && (!(unlikely(pci_channel_offline(phba->pcidev)))) && sglq->state !=3D SGL_XRI_ABORTED) { spin_lock_irqsave(&phba->sli4_hba.sgl_list_lock, @@ -1440,7 +1440,7 @@ __lpfc_sli_release_iocbq_s4(struct lpfc_hba *phba, st= ruct lpfc_iocbq *iocbq) memset((char *)iocbq + start_clean, 0, sizeof(*iocbq) - start_clean); iocbq->sli4_lxritag =3D NO_XRI; iocbq->sli4_xritag =3D NO_XRI; - iocbq->iocb_flag &=3D ~(LPFC_IO_NVME | LPFC_IO_NVMET | LPFC_IO_CMF | + iocbq->cmd_flag &=3D ~(LPFC_IO_NVME | LPFC_IO_NVMET | LPFC_IO_CMF | LPFC_IO_NVME_LS); list_add_tail(&iocbq->list, &phba->lpfc_iocb_list); } @@ -1530,17 +1530,17 @@ lpfc_sli_cancel_iocbs(struct lpfc_hba *phba, struct= list_head *iocblist, =20 while (!list_empty(iocblist)) { list_remove_head(iocblist, piocb, struct lpfc_iocbq, list); - if (piocb->wqe_cmpl) { - if (piocb->iocb_flag & LPFC_IO_NVME) + if (piocb->cmd_cmpl) { + if (piocb->cmd_flag & LPFC_IO_NVME) lpfc_nvme_cancel_iocb(phba, piocb, ulpstatus, ulpWord4); else lpfc_sli_release_iocbq(phba, piocb); =20 - } else if (piocb->iocb_cmpl) { + } else if (piocb->cmd_cmpl) { piocb->iocb.ulpStatus =3D ulpstatus; piocb->iocb.un.ulpWord[4] =3D ulpWord4; - (piocb->iocb_cmpl) (phba, piocb, piocb); + (piocb->cmd_cmpl) (phba, piocb, piocb); } else { lpfc_sli_release_iocbq(phba, piocb); } @@ -1732,7 +1732,7 @@ lpfc_sli_ringtxcmpl_put(struct lpfc_hba *phba, struct= lpfc_sli_ring *pring, BUG_ON(!piocb); =20 list_add_tail(&piocb->list, &pring->txcmplq); - piocb->iocb_flag |=3D LPFC_IO_ON_TXCMPLQ; + piocb->cmd_flag |=3D LPFC_IO_ON_TXCMPLQ; pring->txcmplq_cnt++; =20 if ((unlikely(pring->ringno =3D=3D LPFC_ELS_RING)) && @@ -1773,7 +1773,7 @@ lpfc_sli_ringtx_get(struct lpfc_hba *phba, struct lpf= c_sli_ring *pring) * lpfc_cmf_sync_cmpl - Process a CMF_SYNC_WQE cmpl * @phba: Pointer to HBA context object. * @cmdiocb: Pointer to driver command iocb object. - * @cmf_cmpl: Pointer to completed WCQE. + * @rspiocb: Pointer to driver response iocb object. * * This routine will inform the driver of any BW adjustments we need * to make. These changes will be picked up during the next CMF @@ -1782,10 +1782,11 @@ lpfc_sli_ringtx_get(struct lpfc_hba *phba, struct l= pfc_sli_ring *pring) **/ static void lpfc_cmf_sync_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, - struct lpfc_wcqe_complete *cmf_cmpl) + struct lpfc_iocbq *rspiocb) { union lpfc_wqe128 *wqe; uint32_t status, info; + struct lpfc_wcqe_complete *wcqe =3D &rspiocb->wcqe_cmpl; uint64_t bw, bwdif, slop; uint64_t pcent, bwpcent; int asig, afpin, sigcnt, fpincnt; @@ -1793,22 +1794,22 @@ lpfc_cmf_sync_cmpl(struct lpfc_hba *phba, struct lp= fc_iocbq *cmdiocb, char *s; =20 /* First check for error */ - status =3D bf_get(lpfc_wcqe_c_status, cmf_cmpl); + status =3D bf_get(lpfc_wcqe_c_status, wcqe); if (status) { lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, "6211 CMF_SYNC_WQE Error " "req_tag x%x status x%x hwstatus x%x " "tdatap x%x parm x%x\n", - bf_get(lpfc_wcqe_c_request_tag, cmf_cmpl), - bf_get(lpfc_wcqe_c_status, cmf_cmpl), - bf_get(lpfc_wcqe_c_hw_status, cmf_cmpl), - cmf_cmpl->total_data_placed, - cmf_cmpl->parameter); + bf_get(lpfc_wcqe_c_request_tag, wcqe), + bf_get(lpfc_wcqe_c_status, wcqe), + bf_get(lpfc_wcqe_c_hw_status, wcqe), + wcqe->total_data_placed, + wcqe->parameter); goto out; } =20 /* Gather congestion information on a successful cmpl */ - info =3D cmf_cmpl->parameter; + info =3D wcqe->parameter; phba->cmf_active_info =3D info; =20 /* See if firmware info count is valid or has changed */ @@ -1817,15 +1818,15 @@ lpfc_cmf_sync_cmpl(struct lpfc_hba *phba, struct lp= fc_iocbq *cmdiocb, else phba->cmf_info_per_interval =3D info; =20 - tdp =3D bf_get(lpfc_wcqe_c_cmf_bw, cmf_cmpl); - cg =3D bf_get(lpfc_wcqe_c_cmf_cg, cmf_cmpl); + tdp =3D bf_get(lpfc_wcqe_c_cmf_bw, wcqe); + cg =3D bf_get(lpfc_wcqe_c_cmf_cg, wcqe); =20 /* Get BW requirement from firmware */ bw =3D (uint64_t)tdp * LPFC_CMF_BLK_SIZE; if (!bw) { lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, "6212 CMF_SYNC_WQE x%x: NULL bw\n", - bf_get(lpfc_wcqe_c_request_tag, cmf_cmpl)); + bf_get(lpfc_wcqe_c_request_tag, wcqe)); goto out; } =20 @@ -1999,14 +2000,13 @@ lpfc_issue_cmf_sync_wqe(struct lpfc_hba *phba, u32 = ms, u64 total) bf_set(cmf_sync_cqid, &wqe->cmf_sync, LPFC_WQE_CQ_ID_DEFAULT); =20 sync_buf->vport =3D phba->pport; - sync_buf->wqe_cmpl =3D lpfc_cmf_sync_cmpl; - sync_buf->iocb_cmpl =3D NULL; + sync_buf->cmd_cmpl =3D lpfc_cmf_sync_cmpl; sync_buf->context1 =3D NULL; sync_buf->context2 =3D NULL; sync_buf->context3 =3D NULL; sync_buf->sli4_xritag =3D NO_XRI; =20 - sync_buf->iocb_flag |=3D LPFC_IO_CMF; + sync_buf->cmd_flag |=3D LPFC_IO_CMF; ret_val =3D lpfc_sli4_issue_wqe(phba, &phba->sli4_hba.hdwq[0], sync_buf); if (ret_val) lpfc_printf_log(phba, KERN_INFO, LOG_CGN_MGMT, @@ -2173,7 +2173,7 @@ lpfc_sli_submit_iocb(struct lpfc_hba *phba, struct lp= fc_sli_ring *pring, /* * Set up an iotag */ - nextiocb->iocb.ulpIoTag =3D (nextiocb->iocb_cmpl) ? nextiocb->iotag : 0; + nextiocb->iocb.ulpIoTag =3D (nextiocb->cmd_cmpl) ? nextiocb->iotag : 0; =20 =20 if (pring->ringno =3D=3D LPFC_ELS_RING) { @@ -2194,9 +2194,9 @@ lpfc_sli_submit_iocb(struct lpfc_hba *phba, struct lp= fc_sli_ring *pring, /* * If there is no completion routine to call, we can release the * IOCB buffer back right now. For IOCBs, like QUE_RING_BUF, - * that have no rsp ring completion, iocb_cmpl MUST be NULL. + * that have no rsp ring completion, cmd_cmpl MUST be NULL. */ - if (nextiocb->iocb_cmpl) + if (nextiocb->cmd_cmpl) lpfc_sli_ringtxcmpl_put(phba, pring, nextiocb); else __lpfc_sli_release_iocbq(phba, nextiocb); @@ -3564,10 +3564,10 @@ lpfc_sli_iocbq_lookup(struct lpfc_hba *phba, =20 if (iotag !=3D 0 && iotag <=3D phba->sli.last_iotag) { cmd_iocb =3D phba->sli.iocbq_lookup[iotag]; - if (cmd_iocb->iocb_flag & LPFC_IO_ON_TXCMPLQ) { + if (cmd_iocb->cmd_flag & LPFC_IO_ON_TXCMPLQ) { /* remove from txcmpl queue list */ list_del_init(&cmd_iocb->list); - cmd_iocb->iocb_flag &=3D ~LPFC_IO_ON_TXCMPLQ; + cmd_iocb->cmd_flag &=3D ~LPFC_IO_ON_TXCMPLQ; pring->txcmplq_cnt--; spin_unlock_irqrestore(temp_lock, iflag); return cmd_iocb; @@ -3611,10 +3611,10 @@ lpfc_sli_iocbq_lookup_by_tag(struct lpfc_hba *phba, spin_lock_irqsave(temp_lock, iflag); if (iotag !=3D 0 && iotag <=3D phba->sli.last_iotag) { cmd_iocb =3D phba->sli.iocbq_lookup[iotag]; - if (cmd_iocb->iocb_flag & LPFC_IO_ON_TXCMPLQ) { + if (cmd_iocb->cmd_flag & LPFC_IO_ON_TXCMPLQ) { /* remove from txcmpl queue list */ list_del_init(&cmd_iocb->list); - cmd_iocb->iocb_flag &=3D ~LPFC_IO_ON_TXCMPLQ; + cmd_iocb->cmd_flag &=3D ~LPFC_IO_ON_TXCMPLQ; pring->txcmplq_cnt--; spin_unlock_irqrestore(temp_lock, iflag); return cmd_iocb; @@ -3624,9 +3624,9 @@ lpfc_sli_iocbq_lookup_by_tag(struct lpfc_hba *phba, spin_unlock_irqrestore(temp_lock, iflag); lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, "0372 iotag x%x lookup error: max iotag (x%x) " - "iocb_flag x%x\n", + "cmd_flag x%x\n", iotag, phba->sli.last_iotag, - cmd_iocb ? cmd_iocb->iocb_flag : 0xffff); + cmd_iocb ? cmd_iocb->cmd_flag : 0xffff); return NULL; } =20 @@ -3657,7 +3657,7 @@ lpfc_sli_process_sol_iocb(struct lpfc_hba *phba, stru= ct lpfc_sli_ring *pring, =20 cmdiocbp =3D lpfc_sli_iocbq_lookup(phba, pring, saveq); if (cmdiocbp) { - if (cmdiocbp->iocb_cmpl) { + if (cmdiocbp->cmd_cmpl) { /* * If an ELS command failed send an event to mgmt * application. @@ -3675,11 +3675,11 @@ lpfc_sli_process_sol_iocb(struct lpfc_hba *phba, st= ruct lpfc_sli_ring *pring, */ if (pring->ringno =3D=3D LPFC_ELS_RING) { if ((phba->sli_rev < LPFC_SLI_REV4) && - (cmdiocbp->iocb_flag & + (cmdiocbp->cmd_flag & LPFC_DRIVER_ABORTED)) { spin_lock_irqsave(&phba->hbalock, iflag); - cmdiocbp->iocb_flag &=3D + cmdiocbp->cmd_flag &=3D ~LPFC_DRIVER_ABORTED; spin_unlock_irqrestore(&phba->hbalock, iflag); @@ -3694,12 +3694,12 @@ lpfc_sli_process_sol_iocb(struct lpfc_hba *phba, st= ruct lpfc_sli_ring *pring, */ spin_lock_irqsave(&phba->hbalock, iflag); - saveq->iocb_flag |=3D LPFC_DELAY_MEM_FREE; + saveq->cmd_flag |=3D LPFC_DELAY_MEM_FREE; spin_unlock_irqrestore(&phba->hbalock, iflag); } if (phba->sli_rev =3D=3D LPFC_SLI_REV4) { - if (saveq->iocb_flag & + if (saveq->cmd_flag & LPFC_EXCHANGE_BUSY) { /* Set cmdiocb flag for the * exchange busy so sgl (xri) @@ -3709,12 +3709,12 @@ lpfc_sli_process_sol_iocb(struct lpfc_hba *phba, st= ruct lpfc_sli_ring *pring, */ spin_lock_irqsave( &phba->hbalock, iflag); - cmdiocbp->iocb_flag |=3D + cmdiocbp->cmd_flag |=3D LPFC_EXCHANGE_BUSY; spin_unlock_irqrestore( &phba->hbalock, iflag); } - if (cmdiocbp->iocb_flag & + if (cmdiocbp->cmd_flag & LPFC_DRIVER_ABORTED) { /* * Clear LPFC_DRIVER_ABORTED @@ -3723,7 +3723,7 @@ lpfc_sli_process_sol_iocb(struct lpfc_hba *phba, stru= ct lpfc_sli_ring *pring, */ spin_lock_irqsave( &phba->hbalock, iflag); - cmdiocbp->iocb_flag &=3D + cmdiocbp->cmd_flag &=3D ~LPFC_DRIVER_ABORTED; spin_unlock_irqrestore( &phba->hbalock, iflag); @@ -3743,14 +3743,14 @@ lpfc_sli_process_sol_iocb(struct lpfc_hba *phba, st= ruct lpfc_sli_ring *pring, IOERR_SLI_ABORTED; spin_lock_irqsave( &phba->hbalock, iflag); - saveq->iocb_flag |=3D + saveq->cmd_flag |=3D LPFC_DELAY_MEM_FREE; spin_unlock_irqrestore( &phba->hbalock, iflag); } } } - (cmdiocbp->iocb_cmpl) (phba, cmdiocbp, saveq); + (cmdiocbp->cmd_cmpl) (phba, cmdiocbp, saveq); } else lpfc_sli_release_iocbq(phba, cmdiocbp); } else { @@ -3992,11 +3992,11 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *ph= ba, spin_lock_irqsave(&phba->hbalock, iflag); if (unlikely(!cmdiocbq)) break; - if (cmdiocbq->iocb_flag & LPFC_DRIVER_ABORTED) - cmdiocbq->iocb_flag &=3D ~LPFC_DRIVER_ABORTED; - if (cmdiocbq->iocb_cmpl) { + if (cmdiocbq->cmd_flag & LPFC_DRIVER_ABORTED) + cmdiocbq->cmd_flag &=3D ~LPFC_DRIVER_ABORTED; + if (cmdiocbq->cmd_cmpl) { spin_unlock_irqrestore(&phba->hbalock, iflag); - (cmdiocbq->iocb_cmpl)(phba, cmdiocbq, + (cmdiocbq->cmd_cmpl)(phba, cmdiocbq, &rspiocbq); spin_lock_irqsave(&phba->hbalock, iflag); } @@ -4191,10 +4191,10 @@ lpfc_sli_sp_handle_rspiocb(struct lpfc_hba *phba, s= truct lpfc_sli_ring *pring, } if (cmdiocbp) { /* Call the specified completion routine */ - if (cmdiocbp->iocb_cmpl) { + if (cmdiocbp->cmd_cmpl) { spin_unlock_irqrestore(&phba->hbalock, iflag); - (cmdiocbp->iocb_cmpl)(phba, cmdiocbp, + (cmdiocbp->cmd_cmpl)(phba, cmdiocbp, saveq); spin_lock_irqsave(&phba->hbalock, iflag); @@ -4573,7 +4573,7 @@ lpfc_sli_flush_io_rings(struct lpfc_hba *phba) list_splice_init(&pring->txq, &txq); list_for_each_entry_safe(piocb, next_iocb, &pring->txcmplq, list) - piocb->iocb_flag &=3D ~LPFC_IO_ON_TXCMPLQ; + piocb->cmd_flag &=3D ~LPFC_IO_ON_TXCMPLQ; /* Retrieve everything on the txcmplq */ list_splice_init(&pring->txcmplq, &txcmplq); pring->txq_cnt =3D 0; @@ -4599,7 +4599,7 @@ lpfc_sli_flush_io_rings(struct lpfc_hba *phba) list_splice_init(&pring->txq, &txq); list_for_each_entry_safe(piocb, next_iocb, &pring->txcmplq, list) - piocb->iocb_flag &=3D ~LPFC_IO_ON_TXCMPLQ; + piocb->cmd_flag &=3D ~LPFC_IO_ON_TXCMPLQ; /* Retrieve everything on the txcmplq */ list_splice_init(&pring->txcmplq, &txcmplq); pring->txq_cnt =3D 0; @@ -10115,7 +10115,7 @@ __lpfc_sli_issue_iocb_s3(struct lpfc_hba *phba, uin= t32_t ring_number, =20 lockdep_assert_held(&phba->hbalock); =20 - if (piocb->iocb_cmpl && (!piocb->vport) && + if (piocb->cmd_cmpl && (!piocb->vport) && (piocb->iocb.ulpCommand !=3D CMD_ABORT_XRI_CN) && (piocb->iocb.ulpCommand !=3D CMD_CLOSE_XRI_CN)) { lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, @@ -10167,10 +10167,10 @@ __lpfc_sli_issue_iocb_s3(struct lpfc_hba *phba, u= int32_t ring_number, case CMD_QUE_RING_BUF64_CN: /* * For IOCBs, like QUE_RING_BUF, that have no rsp ring - * completion, iocb_cmpl MUST be 0. + * completion, cmd_cmpl MUST be 0. */ - if (piocb->iocb_cmpl) - piocb->iocb_cmpl =3D NULL; + if (piocb->cmd_cmpl) + piocb->cmd_cmpl =3D NULL; fallthrough; case CMD_CREATE_XRI_CR: case CMD_CLOSE_XRI_CN: @@ -10361,9 +10361,9 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lp= fc_iocbq *iocbq, =20 fip =3D phba->hba_flag & HBA_FIP_SUPPORT; /* The fcp commands will set command type */ - if (iocbq->iocb_flag & LPFC_IO_FCP) + if (iocbq->cmd_flag & LPFC_IO_FCP) command_type =3D FCP_COMMAND; - else if (fip && (iocbq->iocb_flag & LPFC_FIP_ELS_ID_MASK)) + else if (fip && (iocbq->cmd_flag & LPFC_FIP_ELS_ID_MASK)) command_type =3D ELS_COMMAND_FIP; else command_type =3D ELS_COMMAND_NON_FIP; @@ -10408,7 +10408,7 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lp= fc_iocbq *iocbq, =20 switch (iocbq->iocb.ulpCommand) { case CMD_ELS_REQUEST64_CR: - if (iocbq->iocb_flag & LPFC_IO_LIBDFC) + if (iocbq->cmd_flag & LPFC_IO_LIBDFC) ndlp =3D iocbq->context_un.ndlp; else ndlp =3D (struct lpfc_nodelist *)iocbq->context1; @@ -10435,7 +10435,7 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lp= fc_iocbq *iocbq, bf_set(wqe_pu, &wqe->els_req.wqe_com, 0); /* CCP CCPE PV PRI in word10 were set in the memcpy */ if (command_type =3D=3D ELS_COMMAND_FIP) - els_id =3D ((iocbq->iocb_flag & LPFC_FIP_ELS_ID_MASK) + els_id =3D ((iocbq->cmd_flag & LPFC_FIP_ELS_ID_MASK) >> LPFC_FIP_ELS_ID_SHIFT); pcmd =3D (uint32_t *) (((struct lpfc_dmabuf *) iocbq->context2)->virt); @@ -10537,7 +10537,7 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lp= fc_iocbq *iocbq, LPFC_WQE_LENLOC_WORD4); bf_set(wqe_pu, &wqe->fcp_iwrite.wqe_com, iocbq->iocb.ulpPU); bf_set(wqe_dbde, &wqe->fcp_iwrite.wqe_com, 1); - if (iocbq->iocb_flag & LPFC_IO_OAS) { + if (iocbq->cmd_flag & LPFC_IO_OAS) { bf_set(wqe_oas, &wqe->fcp_iwrite.wqe_com, 1); bf_set(wqe_ccpe, &wqe->fcp_iwrite.wqe_com, 1); if (iocbq->priority) { @@ -10601,7 +10601,7 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lp= fc_iocbq *iocbq, LPFC_WQE_LENLOC_WORD4); bf_set(wqe_pu, &wqe->fcp_iread.wqe_com, iocbq->iocb.ulpPU); bf_set(wqe_dbde, &wqe->fcp_iread.wqe_com, 1); - if (iocbq->iocb_flag & LPFC_IO_OAS) { + if (iocbq->cmd_flag & LPFC_IO_OAS) { bf_set(wqe_oas, &wqe->fcp_iread.wqe_com, 1); bf_set(wqe_ccpe, &wqe->fcp_iread.wqe_com, 1); if (iocbq->priority) { @@ -10664,7 +10664,7 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lp= fc_iocbq *iocbq, LPFC_WQE_LENLOC_NONE); bf_set(wqe_erp, &wqe->fcp_icmd.wqe_com, iocbq->iocb.ulpFCP2Rcvy); - if (iocbq->iocb_flag & LPFC_IO_OAS) { + if (iocbq->cmd_flag & LPFC_IO_OAS) { bf_set(wqe_oas, &wqe->fcp_icmd.wqe_com, 1); bf_set(wqe_ccpe, &wqe->fcp_icmd.wqe_com, 1); if (iocbq->priority) { @@ -10798,7 +10798,7 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct lp= fc_iocbq *iocbq, abrt_iotag =3D iocbq->iocb.un.acxri.abortContextTag; if (abrt_iotag !=3D 0 && abrt_iotag <=3D phba->sli.last_iotag) { abrtiocbq =3D phba->sli.iocbq_lookup[abrt_iotag]; - fip =3D abrtiocbq->iocb_flag & LPFC_FIP_ELS_ID_MASK; + fip =3D abrtiocbq->cmd_flag & LPFC_FIP_ELS_ID_MASK; } else fip =3D 0; =20 @@ -10907,13 +10907,13 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba, struct = lpfc_iocbq *iocbq, return IOCB_ERROR; } =20 - if (iocbq->iocb_flag & LPFC_IO_DIF_PASS) + if (iocbq->cmd_flag & LPFC_IO_DIF_PASS) bf_set(wqe_dif, &wqe->generic.wqe_com, LPFC_WQE_DIF_PASSTHRU); - else if (iocbq->iocb_flag & LPFC_IO_DIF_STRIP) + else if (iocbq->cmd_flag & LPFC_IO_DIF_STRIP) bf_set(wqe_dif, &wqe->generic.wqe_com, LPFC_WQE_DIF_STRIP); - else if (iocbq->iocb_flag & LPFC_IO_DIF_INSERT) + else if (iocbq->cmd_flag & LPFC_IO_DIF_INSERT) bf_set(wqe_dif, &wqe->generic.wqe_com, LPFC_WQE_DIF_INSERT); - iocbq->iocb_flag &=3D ~(LPFC_IO_DIF_PASS | LPFC_IO_DIF_STRIP | + iocbq->cmd_flag &=3D ~(LPFC_IO_DIF_PASS | LPFC_IO_DIF_STRIP | LPFC_IO_DIF_INSERT); bf_set(wqe_xri_tag, &wqe->generic.wqe_com, xritag); bf_set(wqe_reqtag, &wqe->generic.wqe_com, iocbq->iotag); @@ -11012,7 +11012,7 @@ __lpfc_sli_issue_fcp_io_s4(struct lpfc_hba *phba, u= int32_t ring_number, } =20 /* add the VMID tags as per switch response */ - if (unlikely(piocb->iocb_flag & LPFC_IO_VMID)) { + if (unlikely(piocb->cmd_flag & LPFC_IO_VMID)) { if (phba->pport->vmid_priority_tagging) { bf_set(wqe_ccpe, &wqe->fcp_iwrite.wqe_com, 1); bf_set(wqe_ccp, &wqe->fcp_iwrite.wqe_com, @@ -11051,8 +11051,8 @@ __lpfc_sli_issue_iocb_s4(struct lpfc_hba *phba, uin= t32_t ring_number, struct lpfc_sli_ring *pring; =20 /* Get the WQ */ - if ((piocb->iocb_flag & LPFC_IO_FCP) || - (piocb->iocb_flag & LPFC_USE_FCPWQIDX)) { + if ((piocb->cmd_flag & LPFC_IO_FCP) || + (piocb->cmd_flag & LPFC_USE_FCPWQIDX)) { wq =3D phba->sli4_hba.hdwq[piocb->hba_wqidx].io_wq; } else { wq =3D phba->sli4_hba.els_wq; @@ -11093,7 +11093,7 @@ __lpfc_sli_issue_iocb_s4(struct lpfc_hba *phba, uin= t32_t ring_number, } } } - } else if (piocb->iocb_flag & LPFC_IO_FCP) { + } else if (piocb->cmd_flag & LPFC_IO_FCP) { /* These IO's already have an XRI and a mapped sgl. */ sglq =3D NULL; } @@ -11210,14 +11210,14 @@ lpfc_sli4_calc_ring(struct lpfc_hba *phba, struct= lpfc_iocbq *piocb) { struct lpfc_io_buf *lpfc_cmd; =20 - if (piocb->iocb_flag & (LPFC_IO_FCP | LPFC_USE_FCPWQIDX)) { + if (piocb->cmd_flag & (LPFC_IO_FCP | LPFC_USE_FCPWQIDX)) { if (unlikely(!phba->sli4_hba.hdwq)) return NULL; /* * for abort iocb hba_wqidx should already * be setup based on what work queue we used. */ - if (!(piocb->iocb_flag & LPFC_USE_FCPWQIDX)) { + if (!(piocb->cmd_flag & LPFC_USE_FCPWQIDX)) { lpfc_cmd =3D (struct lpfc_io_buf *)piocb->context1; piocb->hba_wqidx =3D lpfc_cmd->hdwq_no; } @@ -12359,14 +12359,14 @@ lpfc_sli_issue_abort_iotag(struct lpfc_hba *phba,= struct lpfc_sli_ring *pring, icmd =3D &cmdiocb->iocb; if (icmd->ulpCommand =3D=3D CMD_ABORT_XRI_CN || icmd->ulpCommand =3D=3D CMD_CLOSE_XRI_CN || - cmdiocb->iocb_flag & LPFC_DRIVER_ABORTED) + cmdiocb->cmd_flag & LPFC_DRIVER_ABORTED) return IOCB_ABORTING; =20 if (!pring) { - if (cmdiocb->iocb_flag & LPFC_IO_FABRIC) - cmdiocb->fabric_iocb_cmpl =3D lpfc_ignore_els_cmpl; + if (cmdiocb->cmd_flag & LPFC_IO_FABRIC) + cmdiocb->fabric_cmd_cmpl =3D lpfc_ignore_els_cmpl; else - cmdiocb->iocb_cmpl =3D lpfc_ignore_els_cmpl; + cmdiocb->cmd_cmpl =3D lpfc_ignore_els_cmpl; return retval; } =20 @@ -12376,10 +12376,10 @@ lpfc_sli_issue_abort_iotag(struct lpfc_hba *phba,= struct lpfc_sli_ring *pring, */ if ((vport->load_flag & FC_UNLOADING) && pring->ringno =3D=3D LPFC_ELS_RING) { - if (cmdiocb->iocb_flag & LPFC_IO_FABRIC) - cmdiocb->fabric_iocb_cmpl =3D lpfc_ignore_els_cmpl; + if (cmdiocb->cmd_flag & LPFC_IO_FABRIC) + cmdiocb->fabric_cmd_cmpl =3D lpfc_ignore_els_cmpl; else - cmdiocb->iocb_cmpl =3D lpfc_ignore_els_cmpl; + cmdiocb->cmd_cmpl =3D lpfc_ignore_els_cmpl; return retval; } =20 @@ -12391,7 +12391,7 @@ lpfc_sli_issue_abort_iotag(struct lpfc_hba *phba, s= truct lpfc_sli_ring *pring, /* This signals the response to set the correct status * before calling the completion handler */ - cmdiocb->iocb_flag |=3D LPFC_DRIVER_ABORTED; + cmdiocb->cmd_flag |=3D LPFC_DRIVER_ABORTED; =20 iabt =3D &abtsiocbp->iocb; iabt->un.acxri.abortType =3D ABORT_TYPE_ABTS; @@ -12412,10 +12412,10 @@ lpfc_sli_issue_abort_iotag(struct lpfc_hba *phba,= struct lpfc_sli_ring *pring, =20 /* ABTS WQE must go to the same WQ as the WQE to be aborted */ abtsiocbp->hba_wqidx =3D cmdiocb->hba_wqidx; - if (cmdiocb->iocb_flag & LPFC_IO_FCP) - abtsiocbp->iocb_flag |=3D (LPFC_IO_FCP | LPFC_USE_FCPWQIDX); - if (cmdiocb->iocb_flag & LPFC_IO_FOF) - abtsiocbp->iocb_flag |=3D LPFC_IO_FOF; + if (cmdiocb->cmd_flag & LPFC_IO_FCP) + abtsiocbp->cmd_flag |=3D (LPFC_IO_FCP | LPFC_USE_FCPWQIDX); + if (cmdiocb->cmd_flag & LPFC_IO_FOF) + abtsiocbp->cmd_flag |=3D LPFC_IO_FOF; =20 if (phba->link_state < LPFC_LINK_UP || (phba->sli_rev =3D=3D LPFC_SLI_REV4 && @@ -12425,9 +12425,9 @@ lpfc_sli_issue_abort_iotag(struct lpfc_hba *phba, s= truct lpfc_sli_ring *pring, iabt->ulpCommand =3D CMD_ABORT_XRI_CN; =20 if (cmpl) - abtsiocbp->iocb_cmpl =3D cmpl; + abtsiocbp->cmd_cmpl =3D cmpl; else - abtsiocbp->iocb_cmpl =3D lpfc_sli_abort_els_cmpl; + abtsiocbp->cmd_cmpl =3D lpfc_sli_abort_els_cmpl; abtsiocbp->vport =3D vport; =20 if (phba->sli_rev =3D=3D LPFC_SLI_REV4) { @@ -12454,7 +12454,7 @@ lpfc_sli_issue_abort_iotag(struct lpfc_hba *phba, s= truct lpfc_sli_ring *pring, abtsiocbp->iotag, retval); =20 if (retval) { - cmdiocb->iocb_flag &=3D ~LPFC_DRIVER_ABORTED; + cmdiocb->cmd_flag &=3D ~LPFC_DRIVER_ABORTED; __lpfc_sli_release_iocbq(phba, abtsiocbp); } =20 @@ -12522,9 +12522,9 @@ lpfc_sli_validate_fcp_iocb_for_abort(struct lpfc_io= cbq *iocbq, * can't be premarked as driver aborted, nor be an ABORT iocb itself */ icmd =3D &iocbq->iocb; - if (!(iocbq->iocb_flag & LPFC_IO_FCP) || - !(iocbq->iocb_flag & LPFC_IO_ON_TXCMPLQ) || - (iocbq->iocb_flag & LPFC_DRIVER_ABORTED) || + if (!(iocbq->cmd_flag & LPFC_IO_FCP) || + !(iocbq->cmd_flag & LPFC_IO_ON_TXCMPLQ) || + (iocbq->cmd_flag & LPFC_DRIVER_ABORTED) || (icmd->ulpCommand =3D=3D CMD_ABORT_XRI_CN || icmd->ulpCommand =3D=3D CMD_CLOSE_XRI_CN)) return -EINVAL; @@ -12628,8 +12628,8 @@ lpfc_sli_sum_iocb(struct lpfc_vport *vport, uint16_= t tgt_id, uint64_t lun_id, =20 if (!iocbq || iocbq->vport !=3D vport) continue; - if (!(iocbq->iocb_flag & LPFC_IO_FCP) || - !(iocbq->iocb_flag & LPFC_IO_ON_TXCMPLQ)) + if (!(iocbq->cmd_flag & LPFC_IO_FCP) || + !(iocbq->cmd_flag & LPFC_IO_ON_TXCMPLQ)) continue; =20 /* Include counting outstanding aborts */ @@ -12855,8 +12855,8 @@ lpfc_sli_abort_taskmgmt(struct lpfc_vport *vport, s= truct lpfc_sli_ring *pring, * If the iocbq is already being aborted, don't take a second * action, but do count it. */ - if ((iocbq->iocb_flag & LPFC_DRIVER_ABORTED) || - !(iocbq->iocb_flag & LPFC_IO_ON_TXCMPLQ)) { + if ((iocbq->cmd_flag & LPFC_DRIVER_ABORTED) || + !(iocbq->cmd_flag & LPFC_IO_ON_TXCMPLQ)) { if (phba->sli_rev =3D=3D LPFC_SLI_REV4) spin_unlock(&pring_s4->ring_lock); spin_unlock(&lpfc_cmd->buf_lock); @@ -12886,10 +12886,10 @@ lpfc_sli_abort_taskmgmt(struct lpfc_vport *vport,= struct lpfc_sli_ring *pring, =20 /* ABTS WQE must go to the same WQ as the WQE to be aborted */ abtsiocbq->hba_wqidx =3D iocbq->hba_wqidx; - if (iocbq->iocb_flag & LPFC_IO_FCP) - abtsiocbq->iocb_flag |=3D LPFC_USE_FCPWQIDX; - if (iocbq->iocb_flag & LPFC_IO_FOF) - abtsiocbq->iocb_flag |=3D LPFC_IO_FOF; + if (iocbq->cmd_flag & LPFC_IO_FCP) + abtsiocbq->cmd_flag |=3D LPFC_USE_FCPWQIDX; + if (iocbq->cmd_flag & LPFC_IO_FOF) + abtsiocbq->cmd_flag |=3D LPFC_IO_FOF; =20 ndlp =3D lpfc_cmd->rdata->pnode; =20 @@ -12900,13 +12900,13 @@ lpfc_sli_abort_taskmgmt(struct lpfc_vport *vport,= struct lpfc_sli_ring *pring, abtsiocbq->iocb.ulpCommand =3D CMD_CLOSE_XRI_CN; =20 /* Setup callback routine and issue the command. */ - abtsiocbq->iocb_cmpl =3D lpfc_sli_abort_fcp_cmpl; + abtsiocbq->cmd_cmpl =3D lpfc_sli_abort_fcp_cmpl; =20 /* * Indicate the IO is being aborted by the driver and set * the caller's flag into the aborted IO. */ - iocbq->iocb_flag |=3D LPFC_DRIVER_ABORTED; + iocbq->cmd_flag |=3D LPFC_DRIVER_ABORTED; =20 if (phba->sli_rev =3D=3D LPFC_SLI_REV4) { ret_val =3D __lpfc_sli_issue_iocb(phba, pring_s4->ringno, @@ -12955,7 +12955,7 @@ lpfc_sli_wake_iocb_wait(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd; =20 spin_lock_irqsave(&phba->hbalock, iflags); - if (cmdiocbq->iocb_flag & LPFC_IO_WAKE_TMO) { + if (cmdiocbq->cmd_flag & LPFC_IO_WAKE_TMO) { =20 /* * A time out has occurred for the iocb. If a time out @@ -12964,26 +12964,26 @@ lpfc_sli_wake_iocb_wait(struct lpfc_hba *phba, */ =20 spin_unlock_irqrestore(&phba->hbalock, iflags); - cmdiocbq->iocb_cmpl =3D cmdiocbq->wait_iocb_cmpl; - cmdiocbq->wait_iocb_cmpl =3D NULL; - if (cmdiocbq->iocb_cmpl) - (cmdiocbq->iocb_cmpl)(phba, cmdiocbq, NULL); + cmdiocbq->cmd_cmpl =3D cmdiocbq->wait_cmd_cmpl; + cmdiocbq->wait_cmd_cmpl =3D NULL; + if (cmdiocbq->cmd_cmpl) + (cmdiocbq->cmd_cmpl)(phba, cmdiocbq, NULL); else lpfc_sli_release_iocbq(phba, cmdiocbq); return; } =20 - cmdiocbq->iocb_flag |=3D LPFC_IO_WAKE; + cmdiocbq->cmd_flag |=3D LPFC_IO_WAKE; if (cmdiocbq->context2 && rspiocbq) memcpy(&((struct lpfc_iocbq *)cmdiocbq->context2)->iocb, &rspiocbq->iocb, sizeof(IOCB_t)); =20 /* Set the exchange busy flag for task management commands */ - if ((cmdiocbq->iocb_flag & LPFC_IO_FCP) && - !(cmdiocbq->iocb_flag & LPFC_IO_LIBDFC)) { + if ((cmdiocbq->cmd_flag & LPFC_IO_FCP) && + !(cmdiocbq->cmd_flag & LPFC_IO_LIBDFC)) { lpfc_cmd =3D container_of(cmdiocbq, struct lpfc_io_buf, cur_iocbq); - if (rspiocbq && (rspiocbq->iocb_flag & LPFC_EXCHANGE_BUSY)) + if (rspiocbq && (rspiocbq->cmd_flag & LPFC_EXCHANGE_BUSY)) lpfc_cmd->flags |=3D LPFC_SBUF_XBUSY; else lpfc_cmd->flags &=3D ~LPFC_SBUF_XBUSY; @@ -13002,7 +13002,7 @@ lpfc_sli_wake_iocb_wait(struct lpfc_hba *phba, * @piocbq: Pointer to command iocb. * @flag: Flag to test. * - * This routine grabs the hbalock and then test the iocb_flag to + * This routine grabs the hbalock and then test the cmd_flag to * see if the passed in flag is set. * Returns: * 1 if flag is set. @@ -13016,7 +13016,7 @@ lpfc_chk_iocb_flg(struct lpfc_hba *phba, int ret; =20 spin_lock_irqsave(&phba->hbalock, iflags); - ret =3D piocbq->iocb_flag & flag; + ret =3D piocbq->cmd_flag & flag; spin_unlock_irqrestore(&phba->hbalock, iflags); return ret; =20 @@ -13031,14 +13031,14 @@ lpfc_chk_iocb_flg(struct lpfc_hba *phba, * @timeout: Timeout in number of seconds. * * This function issues the iocb to firmware and waits for the - * iocb to complete. The iocb_cmpl field of the shall be used + * iocb to complete. The cmd_cmpl field of the shall be used * to handle iocbs which time out. If the field is NULL, the * function shall free the iocbq structure. If more clean up is * needed, the caller is expected to provide a completion function * that will provide the needed clean up. If the iocb command is * not completed within timeout seconds, the function will either - * free the iocbq structure (if iocb_cmpl =3D=3D NULL) or execute the - * completion function set in the iocb_cmpl field and then return + * free the iocbq structure (if cmd_cmpl =3D=3D NULL) or execute the + * completion function set in the cmd_cmpl field and then return * a status of IOCB_TIMEDOUT. The caller should not free the iocb * resources if this function returns IOCB_TIMEDOUT. * The function waits for the iocb completion using an @@ -13050,7 +13050,7 @@ lpfc_chk_iocb_flg(struct lpfc_hba *phba, * This function assumes that the iocb completions occur while * this function sleep. So, this function cannot be called from * the thread which process iocb completion for this ring. - * This function clears the iocb_flag of the iocb object before + * This function clears the cmd_flag of the iocb object before * issuing the iocb and the iocb completion handler sets this * flag and wakes this thread when the iocb completes. * The contents of the response iocb will be copied to prspiocbq @@ -13090,10 +13090,10 @@ lpfc_sli_issue_iocb_wait(struct lpfc_hba *phba, piocb->context2 =3D prspiocbq; } =20 - piocb->wait_iocb_cmpl =3D piocb->iocb_cmpl; - piocb->iocb_cmpl =3D lpfc_sli_wake_iocb_wait; + piocb->wait_cmd_cmpl =3D piocb->cmd_cmpl; + piocb->cmd_cmpl =3D lpfc_sli_wake_iocb_wait; piocb->context_un.wait_queue =3D &done_q; - piocb->iocb_flag &=3D ~(LPFC_IO_WAKE | LPFC_IO_WAKE_TMO); + piocb->cmd_flag &=3D ~(LPFC_IO_WAKE | LPFC_IO_WAKE_TMO); =20 if (phba->cfg_poll & DISABLE_FCP_RING_INT) { if (lpfc_readl(phba->HCregaddr, &creg_val)) @@ -13111,7 +13111,7 @@ lpfc_sli_issue_iocb_wait(struct lpfc_hba *phba, lpfc_chk_iocb_flg(phba, piocb, LPFC_IO_WAKE), timeout_req); spin_lock_irqsave(&phba->hbalock, iflags); - if (!(piocb->iocb_flag & LPFC_IO_WAKE)) { + if (!(piocb->cmd_flag & LPFC_IO_WAKE)) { =20 /* * IOCB timed out. Inform the wake iocb wait @@ -13119,7 +13119,7 @@ lpfc_sli_issue_iocb_wait(struct lpfc_hba *phba, */ =20 iocb_completed =3D false; - piocb->iocb_flag |=3D LPFC_IO_WAKE_TMO; + piocb->cmd_flag |=3D LPFC_IO_WAKE_TMO; } spin_unlock_irqrestore(&phba->hbalock, iflags); if (iocb_completed) { @@ -13174,7 +13174,7 @@ lpfc_sli_issue_iocb_wait(struct lpfc_hba *phba, piocb->context2 =3D NULL; =20 piocb->context_un.wait_queue =3D NULL; - piocb->iocb_cmpl =3D NULL; + piocb->cmd_cmpl =3D NULL; return retval; } =20 @@ -14143,7 +14143,7 @@ lpfc_sli4_iocb_param_transfer(struct lpfc_hba *phba, /* Map WCQE parameters into irspiocb parameters */ status =3D bf_get(lpfc_wcqe_c_status, wcqe); pIocbIn->iocb.ulpStatus =3D (status & LPFC_IOCB_STATUS_MASK); - if (pIocbOut->iocb_flag & LPFC_IO_FCP) + if (pIocbOut->cmd_flag & LPFC_IO_FCP) if (pIocbIn->iocb.ulpStatus =3D=3D IOSTAT_FCP_RSP_ERROR) pIocbIn->iocb.un.fcpi.fcpi_parm =3D pIocbOut->iocb.un.fcpi.fcpi_parm - @@ -14225,7 +14225,7 @@ lpfc_sli4_iocb_param_transfer(struct lpfc_hba *phba, /* Pick up HBA exchange busy condition */ if (bf_get(lpfc_wcqe_c_xb, wcqe)) { spin_lock_irqsave(&phba->hbalock, iflags); - pIocbIn->iocb_flag |=3D LPFC_EXCHANGE_BUSY; + pIocbIn->cmd_flag |=3D LPFC_EXCHANGE_BUSY; spin_unlock_irqrestore(&phba->hbalock, iflags); } } @@ -15076,7 +15076,6 @@ lpfc_sli4_fp_handle_fcp_wcqe(struct lpfc_hba *phba,= struct lpfc_queue *cq, { struct lpfc_sli_ring *pring =3D cq->pring; struct lpfc_iocbq *cmdiocbq; - struct lpfc_iocbq irspiocbq; unsigned long iflags; =20 /* Check for response status */ @@ -15115,39 +15114,31 @@ lpfc_sli4_fp_handle_fcp_wcqe(struct lpfc_hba *phb= a, struct lpfc_queue *cq, #ifdef CONFIG_SCSI_LPFC_DEBUG_FS cmdiocbq->isr_timestamp =3D cq->isr_timestamp; #endif - if (cmdiocbq->iocb_cmpl =3D=3D NULL) { - if (cmdiocbq->wqe_cmpl) { - /* For FCP the flag is cleared in wqe_cmpl */ - if (!(cmdiocbq->iocb_flag & LPFC_IO_FCP) && - cmdiocbq->iocb_flag & LPFC_DRIVER_ABORTED) { - spin_lock_irqsave(&phba->hbalock, iflags); - cmdiocbq->iocb_flag &=3D ~LPFC_DRIVER_ABORTED; - spin_unlock_irqrestore(&phba->hbalock, iflags); - } + if (bf_get(lpfc_wcqe_c_xb, wcqe)) { + spin_lock_irqsave(&phba->hbalock, iflags); + cmdiocbq->cmd_flag |=3D LPFC_EXCHANGE_BUSY; + spin_unlock_irqrestore(&phba->hbalock, iflags); + } =20 - /* Pass the cmd_iocb and the wcqe to the upper layer */ - (cmdiocbq->wqe_cmpl)(phba, cmdiocbq, wcqe); - return; + if (cmdiocbq->cmd_cmpl) { + /* For FCP the flag is cleared in cmd_cmpl */ + if (!(cmdiocbq->cmd_flag & LPFC_IO_FCP) && + cmdiocbq->cmd_flag & LPFC_DRIVER_ABORTED) { + spin_lock_irqsave(&phba->hbalock, iflags); + cmdiocbq->cmd_flag &=3D ~LPFC_DRIVER_ABORTED; + spin_unlock_irqrestore(&phba->hbalock, iflags); } + + /* Pass the cmd_iocb and the wcqe to the upper layer */ + memcpy(&cmdiocbq->wcqe_cmpl, wcqe, + sizeof(struct lpfc_wcqe_complete)); + (cmdiocbq->cmd_cmpl)(phba, cmdiocbq, cmdiocbq); + } else { lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, "0375 FCP cmdiocb not callback function " "iotag: (%d)\n", bf_get(lpfc_wcqe_c_request_tag, wcqe)); - return; - } - - /* Only SLI4 non-IO commands stil use IOCB */ - /* Fake the irspiocb and copy necessary response information */ - lpfc_sli4_iocb_param_transfer(phba, &irspiocbq, cmdiocbq, wcqe); - - if (cmdiocbq->iocb_flag & LPFC_DRIVER_ABORTED) { - spin_lock_irqsave(&phba->hbalock, iflags); - cmdiocbq->iocb_flag &=3D ~LPFC_DRIVER_ABORTED; - spin_unlock_irqrestore(&phba->hbalock, iflags); } - - /* Pass the cmd_iocb and the rsp state to the upper layer */ - (cmdiocbq->iocb_cmpl)(phba, cmdiocbq, &irspiocbq); } =20 /** @@ -18969,7 +18960,7 @@ lpfc_sli4_seq_abort_rsp(struct lpfc_vport *vport, } =20 ctiocb->vport =3D phba->pport; - ctiocb->iocb_cmpl =3D lpfc_sli4_seq_abort_rsp_cmpl; + ctiocb->cmd_cmpl =3D lpfc_sli4_seq_abort_rsp_cmpl; ctiocb->sli4_lxritag =3D NO_XRI; ctiocb->sli4_xritag =3D NO_XRI; =20 @@ -19372,8 +19363,8 @@ lpfc_sli4_handle_mds_loopback(struct lpfc_vport *vp= ort, =20 iocbq->context2 =3D pcmd; iocbq->vport =3D vport; - iocbq->iocb_flag &=3D ~LPFC_FIP_ELS_ID_MASK; - iocbq->iocb_flag |=3D LPFC_USE_FCPWQIDX; + iocbq->cmd_flag &=3D ~LPFC_FIP_ELS_ID_MASK; + iocbq->cmd_flag |=3D LPFC_USE_FCPWQIDX; =20 /* * Setup rest of the iocb as though it were a WQE @@ -19391,7 +19382,7 @@ lpfc_sli4_handle_mds_loopback(struct lpfc_vport *vp= ort, =20 iocbq->iocb.ulpCommand =3D CMD_SEND_FRAME; iocbq->iocb.ulpLe =3D 1; - iocbq->iocb_cmpl =3D lpfc_sli4_mds_loopback_cmpl; + iocbq->cmd_cmpl =3D lpfc_sli4_mds_loopback_cmpl; rc =3D lpfc_sli_issue_iocb(phba, LPFC_ELS_RING, iocbq, 0); if (rc =3D=3D IOCB_ERROR) goto exit; @@ -21233,7 +21224,7 @@ lpfc_wqe_bpl2sgl(struct lpfc_hba *phba, struct lpfc= _iocbq *pwqeq, cmd =3D bf_get(wqe_cmnd, &wqe->generic.wqe_com); if (cmd =3D=3D CMD_XMIT_BLS_RSP64_WQE) return sglq->sli4_xritag; - numBdes =3D pwqeq->rsvd2; + numBdes =3D pwqeq->num_bdes; if (numBdes) { /* The addrHigh and addrLow fields within the WQE * have not been byteswapped yet so there is no @@ -21334,7 +21325,7 @@ lpfc_sli4_issue_wqe(struct lpfc_hba *phba, struct l= pfc_sli4_hdw_queue *qp, uint32_t ret =3D 0; =20 /* NVME_LS and NVME_LS ABTS requests. */ - if (pwqe->iocb_flag & LPFC_IO_NVME_LS) { + if (pwqe->cmd_flag & LPFC_IO_NVME_LS) { pring =3D phba->sli4_hba.nvmels_wq->pring; lpfc_qp_spin_lock_irqsave(&pring->ring_lock, iflags, qp, wq_access); @@ -21365,7 +21356,7 @@ lpfc_sli4_issue_wqe(struct lpfc_hba *phba, struct l= pfc_sli4_hdw_queue *qp, } =20 /* NVME_FCREQ and NVME_ABTS requests */ - if (pwqe->iocb_flag & (LPFC_IO_NVME | LPFC_IO_FCP | LPFC_IO_CMF)) { + if (pwqe->cmd_flag & (LPFC_IO_NVME | LPFC_IO_FCP | LPFC_IO_CMF)) { /* Get the IO distribution (hba_wqidx) for WQ assignment. */ wq =3D qp->io_wq; pring =3D wq->pring; @@ -21387,7 +21378,7 @@ lpfc_sli4_issue_wqe(struct lpfc_hba *phba, struct l= pfc_sli4_hdw_queue *qp, } =20 /* NVMET requests */ - if (pwqe->iocb_flag & LPFC_IO_NVMET) { + if (pwqe->cmd_flag & LPFC_IO_NVMET) { /* Get the IO distribution (hba_wqidx) for WQ assignment. */ wq =3D qp->io_wq; pring =3D wq->pring; @@ -21453,7 +21444,7 @@ lpfc_sli4_issue_abort_iotag(struct lpfc_hba *phba, = struct lpfc_iocbq *cmdiocb, return WQE_NORESOURCE; =20 /* Indicate the IO is being aborted by the driver. */ - cmdiocb->iocb_flag |=3D LPFC_DRIVER_ABORTED; + cmdiocb->cmd_flag |=3D LPFC_DRIVER_ABORTED; =20 abtswqe =3D &abtsiocb->wqe; memset(abtswqe, 0, sizeof(*abtswqe)); @@ -21472,15 +21463,15 @@ lpfc_sli4_issue_abort_iotag(struct lpfc_hba *phba= , struct lpfc_iocbq *cmdiocb, =20 /* ABTS WQE must go to the same WQ as the WQE to be aborted */ abtsiocb->hba_wqidx =3D cmdiocb->hba_wqidx; - abtsiocb->iocb_flag |=3D LPFC_USE_FCPWQIDX; - if (cmdiocb->iocb_flag & LPFC_IO_FCP) - abtsiocb->iocb_flag |=3D LPFC_IO_FCP; - if (cmdiocb->iocb_flag & LPFC_IO_NVME) - abtsiocb->iocb_flag |=3D LPFC_IO_NVME; - if (cmdiocb->iocb_flag & LPFC_IO_FOF) - abtsiocb->iocb_flag |=3D LPFC_IO_FOF; + abtsiocb->cmd_flag |=3D LPFC_USE_FCPWQIDX; + if (cmdiocb->cmd_flag & LPFC_IO_FCP) + abtsiocb->cmd_flag |=3D LPFC_IO_FCP; + if (cmdiocb->cmd_flag & LPFC_IO_NVME) + abtsiocb->cmd_flag |=3D LPFC_IO_NVME; + if (cmdiocb->cmd_flag & LPFC_IO_FOF) + abtsiocb->cmd_flag |=3D LPFC_IO_FOF; abtsiocb->vport =3D vport; - abtsiocb->wqe_cmpl =3D cmpl; + abtsiocb->cmd_cmpl =3D cmpl; =20 lpfc_cmd =3D container_of(cmdiocb, struct lpfc_io_buf, cur_iocbq); retval =3D lpfc_sli4_issue_wqe(phba, lpfc_cmd->hdwq, abtsiocb); @@ -21491,7 +21482,7 @@ lpfc_sli4_issue_abort_iotag(struct lpfc_hba *phba, = struct lpfc_iocbq *cmdiocb, xritag, cmdiocb->iotag, abtsiocb->iotag, retval); =20 if (retval) { - cmdiocb->iocb_flag &=3D ~LPFC_DRIVER_ABORTED; + cmdiocb->cmd_flag &=3D ~LPFC_DRIVER_ABORTED; __lpfc_sli_release_iocbq(phba, abtsiocb); } =20 @@ -21853,8 +21844,7 @@ void lpfc_release_io_buf(struct lpfc_hba *phba, str= uct lpfc_io_buf *lpfc_ncmd, =20 /* MUST zero fields if buffer is reused by another protocol */ lpfc_ncmd->nvmeCmd =3D NULL; - lpfc_ncmd->cur_iocbq.wqe_cmpl =3D NULL; - lpfc_ncmd->cur_iocbq.iocb_cmpl =3D NULL; + lpfc_ncmd->cur_iocbq.cmd_cmpl =3D NULL; =20 if (phba->cfg_xpsgl && !phba->nvmet_support && !list_empty(&lpfc_ncmd->dma_sgl_xtra_list)) diff --git a/drivers/scsi/lpfc/lpfc_sli.h b/drivers/scsi/lpfc/lpfc_sli.h index 5161ccacea3e..968c83182643 100644 --- a/drivers/scsi/lpfc/lpfc_sli.h +++ b/drivers/scsi/lpfc/lpfc_sli.h @@ -35,7 +35,7 @@ typedef enum _lpfc_ctx_cmd { LPFC_CTX_HOST } lpfc_ctx_cmd; =20 -union lpfc_vmid_iocb_tag { +union lpfc_vmid_tag { uint32_t app_id; uint8_t cs_ctl_vmid; struct lpfc_vmid_context *vmid_context; /* UVEM context information */ @@ -69,16 +69,16 @@ struct lpfc_iocbq { uint16_t sli4_xritag; /* pre-assigned XRI, (OXID) tag. */ uint16_t hba_wqidx; /* index to HBA work queue */ struct lpfc_cq_event cq_event; - struct lpfc_wcqe_complete wcqe_cmpl; /* WQE cmpl */ uint64_t isr_timestamp; =20 union lpfc_wqe128 wqe; /* SLI-4 */ IOCB_t iocb; /* SLI-3 */ + struct lpfc_wcqe_complete wcqe_cmpl; /* WQE cmpl */ =20 - uint8_t rsvd2; + uint8_t num_bdes; uint8_t priority; /* OAS priority */ uint8_t retry; /* retry counter for IOCB cmd - if needed */ - uint32_t iocb_flag; + u32 cmd_flag; #define LPFC_IO_LIBDFC 1 /* libdfc iocb */ #define LPFC_IO_WAKE 2 /* Synchronous I/O completed */ #define LPFC_IO_WAKE_TMO LPFC_IO_WAKE /* Synchronous I/O timed out */ @@ -123,15 +123,13 @@ struct lpfc_iocbq { struct lpfc_node_rrq *rrq; } context_un; =20 - union lpfc_vmid_iocb_tag vmid_tag; - void (*fabric_iocb_cmpl)(struct lpfc_hba *, struct lpfc_iocbq *, - struct lpfc_iocbq *); - void (*wait_iocb_cmpl)(struct lpfc_hba *, struct lpfc_iocbq *, - struct lpfc_iocbq *); - void (*iocb_cmpl)(struct lpfc_hba *, struct lpfc_iocbq *, - struct lpfc_iocbq *); - void (*wqe_cmpl)(struct lpfc_hba *, struct lpfc_iocbq *, - struct lpfc_wcqe_complete *); + union lpfc_vmid_tag vmid_tag; + void (*fabric_cmd_cmpl)(struct lpfc_hba *phba, struct lpfc_iocbq *cmd, + struct lpfc_iocbq *rsp); + void (*wait_cmd_cmpl)(struct lpfc_hba *phba, struct lpfc_iocbq *cmd, + struct lpfc_iocbq *rsp); + void (*cmd_cmpl)(struct lpfc_hba *phba, struct lpfc_iocbq *cmd, + struct lpfc_iocbq *rsp); }; =20 #define SLI_IOCB_RET_IOCB 1 /* Return IOCB if cmd ring full */ --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F28E4C00140 for ; Mon, 15 Aug 2022 19:54:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244823AbiHOTy5 (ORCPT ); Mon, 15 Aug 2022 15:54:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345293AbiHOTx0 (ORCPT ); Mon, 15 Aug 2022 15:53:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BD974505B; Mon, 15 Aug 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 98834B810A1; Mon, 15 Aug 2022 18:51:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD612C433D6; Mon, 15 Aug 2022 18:51:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589484; bh=BUwVhQTD92/VVI9ssqFU7NLwhjOLZtI/bNYSOwwmOu4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IlSphzDeSbK8GvOFlxUjilPUuZMoqRvJDC7Zb9hvBOUFj7tWXQaZGFGpASge8nC70 0t2ekyuJaVJNnIR3HtMz6uSwyMObTNmytMKzjoXhZ6R0OAOpdWMv54gvgc1VzQiSqZ KydKxrh8MWvojpLbxN/pqrt5lD/Hnj/RTfLQTlyY= 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.15 702/779] scsi: lpfc: SLI path split: Refactor fast and slow paths to native SLI4 Date: Mon, 15 Aug 2022 20:05:46 +0200 Message-Id: <20220815180407.397253940@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 1b64aa9eae28ac598a03ed3d62a63ac5e5b295fc ] Convert the SLI4 fast and slow paths to use native SLI4 wqe constructs instead of iocb SLI3-isms. Includes the following: - Create simple get_xxx and set_xxx routines to wrapper access to common elements in both SLI3 and SLI4 commands - allowing calling routines to avoid sli-rev-specific structures to access the elements. - using the wqe in the job structure as the primary element - use defines from SLI-4, not SLI-3 - Removal of iocb to wqe conversion from fast and slow path - Add below routines to handle fast path lpfc_prep_embed_io - prepares the wqe for fast path lpfc_wqe_bpl2sgl - manages bpl to sgl conversion lpfc_sli_wqe2iocb - converts a WQE to IOCB for SLI-3 path - Add lpfc_sli3_iocb2wcqecmpl in completion path to convert an SLI-3 iocb completion to wcqe completion - Refactor some of the code that works on both revs for clarity Link: https://lore.kernel.org/r/20220225022308.16486-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 Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/lpfc/lpfc.h | 36 +++ drivers/scsi/lpfc/lpfc_crtn.h | 1 + drivers/scsi/lpfc/lpfc_hw4.h | 7 + drivers/scsi/lpfc/lpfc_sli.c | 513 ++++++++++++++-------------------- drivers/scsi/lpfc/lpfc_sli.h | 2 + 5 files changed, 257 insertions(+), 302 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index b2508a00bafd..266d980667b8 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -1803,3 +1803,39 @@ static inline int lpfc_is_vmid_enabled(struct lpfc_h= ba *phba) { return phba->cfg_vmid_app_header || phba->cfg_vmid_priority_tagging; } + +static inline +u8 get_job_ulpstatus(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq) +{ + if (phba->sli_rev =3D=3D LPFC_SLI_REV4) + return bf_get(lpfc_wcqe_c_status, &iocbq->wcqe_cmpl); + else + return iocbq->iocb.ulpStatus; +} + +static inline +u32 get_job_word4(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq) +{ + if (phba->sli_rev =3D=3D LPFC_SLI_REV4) + return iocbq->wcqe_cmpl.parameter; + else + return iocbq->iocb.un.ulpWord[4]; +} + +static inline +u8 get_job_cmnd(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq) +{ + if (phba->sli_rev =3D=3D LPFC_SLI_REV4) + return bf_get(wqe_cmnd, &iocbq->wqe.generic.wqe_com); + else + return iocbq->iocb.ulpCommand; +} + +static inline +u16 get_job_ulpcontext(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq) +{ + if (phba->sli_rev =3D=3D LPFC_SLI_REV4) + return bf_get(wqe_ctxt_tag, &iocbq->wqe.generic.wqe_com); + else + return iocbq->iocb.ulpContext; +} diff --git a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h index ed27a0afcb8b..f7bf589b63fb 100644 --- a/drivers/scsi/lpfc/lpfc_crtn.h +++ b/drivers/scsi/lpfc/lpfc_crtn.h @@ -129,6 +129,7 @@ void lpfc_disc_list_loopmap(struct lpfc_vport *); void lpfc_disc_start(struct lpfc_vport *); void lpfc_cleanup_discovery_resources(struct lpfc_vport *); void lpfc_cleanup(struct lpfc_vport *); +void lpfc_prep_embed_io(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_nc= md); void lpfc_disc_timeout(struct timer_list *); =20 int lpfc_unregister_fcf_prep(struct lpfc_hba *); diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h index 824fc8c08840..215fbf1c777e 100644 --- a/drivers/scsi/lpfc/lpfc_hw4.h +++ b/drivers/scsi/lpfc/lpfc_hw4.h @@ -60,6 +60,13 @@ ((ptr)->name##_WORD =3D ((((value) & name##_MASK) << name##_SHIFT) | \ ((ptr)->name##_WORD & ~(name##_MASK << name##_SHIFT)))) =20 +#define get_wqe_reqtag(x) (((x)->wqe.words[9] >> 0) & 0xFFFF) + +#define get_job_ulpword(x, y) ((x)->iocb.un.ulpWord[y]) + +#define set_job_ulpstatus(x, y) bf_set(lpfc_wcqe_c_status, &(x)->wcqe_cmpl= , y) +#define set_job_ulpword4(x, y) ((&(x)->wcqe_cmpl)->parameter =3D y) + struct dma_address { uint32_t addr_lo; uint32_t addr_hi; diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 413824fc9533..464a251bcc88 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -70,8 +70,9 @@ static int lpfc_sli_issue_mbox_s4(struct lpfc_hba *, LPFC= _MBOXQ_t *, uint32_t); static int lpfc_sli4_read_rev(struct lpfc_hba *, LPFC_MBOXQ_t *, uint8_t *, uint32_t *); -static struct lpfc_iocbq *lpfc_sli4_els_wcqe_to_rspiocbq(struct lpfc_hba *, - struct lpfc_iocbq *); +static struct lpfc_iocbq * +lpfc_sli4_els_preprocess_rspiocbq(struct lpfc_hba *phba, + struct lpfc_iocbq *rspiocbq); static void lpfc_sli4_send_seq_to_ulp(struct lpfc_vport *, struct hbq_dmabuf *); static void lpfc_sli4_handle_mds_loopback(struct lpfc_vport *vport, @@ -89,6 +90,9 @@ static struct lpfc_cqe *lpfc_sli4_cq_get(struct lpfc_queu= e *q); static void __lpfc_sli4_consume_cqe(struct lpfc_hba *phba, struct lpfc_queue *cq, struct lpfc_cqe *cqe); +static uint16_t lpfc_wqe_bpl2sgl(struct lpfc_hba *phba, + struct lpfc_iocbq *pwqeq, + struct lpfc_sglq *sglq); =20 union lpfc_wqe128 lpfc_iread_cmd_template; union lpfc_wqe128 lpfc_iwrite_cmd_template; @@ -3550,17 +3554,12 @@ lpfc_sli_iocbq_lookup(struct lpfc_hba *phba, struct lpfc_iocbq *prspiocb) { struct lpfc_iocbq *cmd_iocb =3D NULL; - uint16_t iotag; - spinlock_t *temp_lock =3D NULL; - unsigned long iflag =3D 0; + u16 iotag; =20 if (phba->sli_rev =3D=3D LPFC_SLI_REV4) - temp_lock =3D &pring->ring_lock; + iotag =3D get_wqe_reqtag(prspiocb); else - temp_lock =3D &phba->hbalock; - - spin_lock_irqsave(temp_lock, iflag); - iotag =3D prspiocb->iocb.ulpIoTag; + iotag =3D prspiocb->iocb.ulpIoTag; =20 if (iotag !=3D 0 && iotag <=3D phba->sli.last_iotag) { cmd_iocb =3D phba->sli.iocbq_lookup[iotag]; @@ -3569,17 +3568,14 @@ lpfc_sli_iocbq_lookup(struct lpfc_hba *phba, list_del_init(&cmd_iocb->list); cmd_iocb->cmd_flag &=3D ~LPFC_IO_ON_TXCMPLQ; pring->txcmplq_cnt--; - spin_unlock_irqrestore(temp_lock, iflag); return cmd_iocb; } } =20 - spin_unlock_irqrestore(temp_lock, iflag); lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, "0317 iotag x%x is out of " - "range: max iotag x%x wd0 x%x\n", - iotag, phba->sli.last_iotag, - *(((uint32_t *) &prspiocb->iocb) + 7)); + "range: max iotag x%x\n", + iotag, phba->sli.last_iotag); return NULL; } =20 @@ -3600,15 +3596,7 @@ lpfc_sli_iocbq_lookup_by_tag(struct lpfc_hba *phba, struct lpfc_sli_ring *pring, uint16_t iotag) { struct lpfc_iocbq *cmd_iocb =3D NULL; - spinlock_t *temp_lock =3D NULL; - unsigned long iflag =3D 0; =20 - if (phba->sli_rev =3D=3D LPFC_SLI_REV4) - temp_lock =3D &pring->ring_lock; - else - temp_lock =3D &phba->hbalock; - - spin_lock_irqsave(temp_lock, iflag); if (iotag !=3D 0 && iotag <=3D phba->sli.last_iotag) { cmd_iocb =3D phba->sli.iocbq_lookup[iotag]; if (cmd_iocb->cmd_flag & LPFC_IO_ON_TXCMPLQ) { @@ -3616,12 +3604,10 @@ lpfc_sli_iocbq_lookup_by_tag(struct lpfc_hba *phba, list_del_init(&cmd_iocb->list); cmd_iocb->cmd_flag &=3D ~LPFC_IO_ON_TXCMPLQ; pring->txcmplq_cnt--; - spin_unlock_irqrestore(temp_lock, iflag); return cmd_iocb; } } =20 - spin_unlock_irqrestore(temp_lock, iflag); lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, "0372 iotag x%x lookup error: max iotag (x%x) " "cmd_flag x%x\n", @@ -3654,18 +3640,29 @@ lpfc_sli_process_sol_iocb(struct lpfc_hba *phba, st= ruct lpfc_sli_ring *pring, struct lpfc_iocbq *cmdiocbp; int rc =3D 1; unsigned long iflag; + u32 ulp_command, ulp_status, ulp_word4, ulp_context, iotag; =20 cmdiocbp =3D lpfc_sli_iocbq_lookup(phba, pring, saveq); + + ulp_command =3D get_job_cmnd(phba, saveq); + ulp_status =3D get_job_ulpstatus(phba, saveq); + ulp_word4 =3D get_job_word4(phba, saveq); + ulp_context =3D get_job_ulpcontext(phba, saveq); + if (phba->sli_rev =3D=3D LPFC_SLI_REV4) + iotag =3D get_wqe_reqtag(saveq); + else + iotag =3D saveq->iocb.ulpIoTag; + if (cmdiocbp) { + ulp_command =3D get_job_cmnd(phba, cmdiocbp); if (cmdiocbp->cmd_cmpl) { /* * If an ELS command failed send an event to mgmt * application. */ - if (saveq->iocb.ulpStatus && + if (ulp_status && (pring->ringno =3D=3D LPFC_ELS_RING) && - (cmdiocbp->iocb.ulpCommand =3D=3D - CMD_ELS_REQUEST64_CR)) + (ulp_command =3D=3D CMD_ELS_REQUEST64_CR)) lpfc_send_els_failure_event(phba, cmdiocbp, saveq); =20 @@ -3727,20 +3724,20 @@ lpfc_sli_process_sol_iocb(struct lpfc_hba *phba, st= ruct lpfc_sli_ring *pring, ~LPFC_DRIVER_ABORTED; spin_unlock_irqrestore( &phba->hbalock, iflag); - cmdiocbp->iocb.ulpStatus =3D - IOSTAT_LOCAL_REJECT; - cmdiocbp->iocb.un.ulpWord[4] =3D - IOERR_ABORT_REQUESTED; + set_job_ulpstatus(cmdiocbp, + IOSTAT_LOCAL_REJECT); + set_job_ulpword4(cmdiocbp, + IOERR_ABORT_REQUESTED); /* * For SLI4, irsiocb contains * NO_XRI in sli_xritag, it * shall not affect releasing * sgl (xri) process. */ - saveq->iocb.ulpStatus =3D - IOSTAT_LOCAL_REJECT; - saveq->iocb.un.ulpWord[4] =3D - IOERR_SLI_ABORTED; + set_job_ulpstatus(saveq, + IOSTAT_LOCAL_REJECT); + set_job_ulpword4(saveq, + IOERR_SLI_ABORTED); spin_lock_irqsave( &phba->hbalock, iflag); saveq->cmd_flag |=3D @@ -3768,12 +3765,8 @@ lpfc_sli_process_sol_iocb(struct lpfc_hba *phba, str= uct lpfc_sli_ring *pring, "0322 Ring %d handler: " "unexpected completion IoTag x%x " "Data: x%x x%x x%x x%x\n", - pring->ringno, - saveq->iocb.ulpIoTag, - saveq->iocb.ulpStatus, - saveq->iocb.un.ulpWord[4], - saveq->iocb.ulpCommand, - saveq->iocb.ulpContext); + pring->ringno, iotag, ulp_status, + ulp_word4, ulp_command, ulp_context); } } =20 @@ -4088,155 +4081,159 @@ lpfc_sli_sp_handle_rspiocb(struct lpfc_hba *phba,= struct lpfc_sli_ring *pring, struct lpfc_iocbq *rspiocbp) { struct lpfc_iocbq *saveq; - struct lpfc_iocbq *cmdiocbp; + struct lpfc_iocbq *cmdiocb; struct lpfc_iocbq *next_iocb; - IOCB_t *irsp =3D NULL; + IOCB_t *irsp; uint32_t free_saveq; - uint8_t iocb_cmd_type; + u8 cmd_type; lpfc_iocb_type type; unsigned long iflag; + u32 ulp_status =3D get_job_ulpstatus(phba, rspiocbp); + u32 ulp_word4 =3D get_job_word4(phba, rspiocbp); + u32 ulp_command =3D get_job_cmnd(phba, rspiocbp); int rc; =20 spin_lock_irqsave(&phba->hbalock, iflag); /* First add the response iocb to the countinueq list */ - list_add_tail(&rspiocbp->list, &(pring->iocb_continueq)); + list_add_tail(&rspiocbp->list, &pring->iocb_continueq); pring->iocb_continueq_cnt++; =20 - /* Now, determine whether the list is completed for processing */ - irsp =3D &rspiocbp->iocb; - if (irsp->ulpLe) { - /* - * By default, the driver expects to free all resources - * associated with this iocb completion. - */ - free_saveq =3D 1; - saveq =3D list_get_first(&pring->iocb_continueq, - struct lpfc_iocbq, list); - irsp =3D &(saveq->iocb); - list_del_init(&pring->iocb_continueq); - pring->iocb_continueq_cnt =3D 0; + /* + * By default, the driver expects to free all resources + * associated with this iocb completion. + */ + free_saveq =3D 1; + saveq =3D list_get_first(&pring->iocb_continueq, + struct lpfc_iocbq, list); + list_del_init(&pring->iocb_continueq); + pring->iocb_continueq_cnt =3D 0; =20 - pring->stats.iocb_rsp++; + pring->stats.iocb_rsp++; =20 - /* - * If resource errors reported from HBA, reduce - * queuedepths of the SCSI device. - */ - if ((irsp->ulpStatus =3D=3D IOSTAT_LOCAL_REJECT) && - ((irsp->un.ulpWord[4] & IOERR_PARAM_MASK) =3D=3D - IOERR_NO_RESOURCES)) { - spin_unlock_irqrestore(&phba->hbalock, iflag); - phba->lpfc_rampdown_queue_depth(phba); - spin_lock_irqsave(&phba->hbalock, iflag); - } + /* + * If resource errors reported from HBA, reduce + * queuedepths of the SCSI device. + */ + if (ulp_status =3D=3D IOSTAT_LOCAL_REJECT && + ((ulp_word4 & IOERR_PARAM_MASK) =3D=3D + IOERR_NO_RESOURCES)) { + spin_unlock_irqrestore(&phba->hbalock, iflag); + phba->lpfc_rampdown_queue_depth(phba); + spin_lock_irqsave(&phba->hbalock, iflag); + } =20 - if (irsp->ulpStatus) { - /* Rsp ring error: IOCB */ + if (ulp_status) { + /* Rsp ring error: IOCB */ + if (phba->sli_rev < LPFC_SLI_REV4) { + irsp =3D &rspiocbp->iocb; lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, - "0328 Rsp Ring %d error: " + "0328 Rsp Ring %d error: ulp_status x%x " + "IOCB Data: " + "x%08x x%08x x%08x x%08x " + "x%08x x%08x x%08x x%08x " + "x%08x x%08x x%08x x%08x " + "x%08x x%08x x%08x x%08x\n", + pring->ringno, ulp_status, + get_job_ulpword(rspiocbp, 0), + get_job_ulpword(rspiocbp, 1), + get_job_ulpword(rspiocbp, 2), + get_job_ulpword(rspiocbp, 3), + get_job_ulpword(rspiocbp, 4), + get_job_ulpword(rspiocbp, 5), + *(((uint32_t *)irsp) + 6), + *(((uint32_t *)irsp) + 7), + *(((uint32_t *)irsp) + 8), + *(((uint32_t *)irsp) + 9), + *(((uint32_t *)irsp) + 10), + *(((uint32_t *)irsp) + 11), + *(((uint32_t *)irsp) + 12), + *(((uint32_t *)irsp) + 13), + *(((uint32_t *)irsp) + 14), + *(((uint32_t *)irsp) + 15)); + } else { + lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, + "0321 Rsp Ring %d error: " "IOCB Data: " - "x%x x%x x%x x%x " - "x%x x%x x%x x%x " - "x%x x%x x%x x%x " "x%x x%x x%x x%x\n", pring->ringno, - irsp->un.ulpWord[0], - irsp->un.ulpWord[1], - irsp->un.ulpWord[2], - irsp->un.ulpWord[3], - irsp->un.ulpWord[4], - irsp->un.ulpWord[5], - *(((uint32_t *) irsp) + 6), - *(((uint32_t *) irsp) + 7), - *(((uint32_t *) irsp) + 8), - *(((uint32_t *) irsp) + 9), - *(((uint32_t *) irsp) + 10), - *(((uint32_t *) irsp) + 11), - *(((uint32_t *) irsp) + 12), - *(((uint32_t *) irsp) + 13), - *(((uint32_t *) irsp) + 14), - *(((uint32_t *) irsp) + 15)); + rspiocbp->wcqe_cmpl.word0, + rspiocbp->wcqe_cmpl.total_data_placed, + rspiocbp->wcqe_cmpl.parameter, + rspiocbp->wcqe_cmpl.word3); } + } =20 - /* - * Fetch the IOCB command type and call the correct completion - * routine. Solicited and Unsolicited IOCBs on the ELS ring - * get freed back to the lpfc_iocb_list by the discovery - * kernel thread. - */ - iocb_cmd_type =3D irsp->ulpCommand & CMD_IOCB_MASK; - type =3D lpfc_sli_iocb_cmd_type(iocb_cmd_type); - switch (type) { - case LPFC_SOL_IOCB: - spin_unlock_irqrestore(&phba->hbalock, iflag); - rc =3D lpfc_sli_process_sol_iocb(phba, pring, saveq); - spin_lock_irqsave(&phba->hbalock, iflag); - break; =20 - case LPFC_UNSOL_IOCB: - spin_unlock_irqrestore(&phba->hbalock, iflag); - rc =3D lpfc_sli_process_unsol_iocb(phba, pring, saveq); - spin_lock_irqsave(&phba->hbalock, iflag); - if (!rc) - free_saveq =3D 0; - break; - - case LPFC_ABORT_IOCB: - cmdiocbp =3D NULL; - if (irsp->ulpCommand !=3D CMD_XRI_ABORTED_CX) { + /* + * Fetch the iocb command type and call the correct completion + * routine. Solicited and Unsolicited IOCBs on the ELS ring + * get freed back to the lpfc_iocb_list by the discovery + * kernel thread. + */ + cmd_type =3D ulp_command & CMD_IOCB_MASK; + type =3D lpfc_sli_iocb_cmd_type(cmd_type); + switch (type) { + case LPFC_SOL_IOCB: + spin_unlock_irqrestore(&phba->hbalock, iflag); + rc =3D lpfc_sli_process_sol_iocb(phba, pring, saveq); + spin_lock_irqsave(&phba->hbalock, iflag); + break; + case LPFC_UNSOL_IOCB: + spin_unlock_irqrestore(&phba->hbalock, iflag); + rc =3D lpfc_sli_process_unsol_iocb(phba, pring, saveq); + spin_lock_irqsave(&phba->hbalock, iflag); + if (!rc) + free_saveq =3D 0; + break; + case LPFC_ABORT_IOCB: + cmdiocb =3D NULL; + if (ulp_command !=3D CMD_XRI_ABORTED_CX) + cmdiocb =3D lpfc_sli_iocbq_lookup(phba, pring, + saveq); + if (cmdiocb) { + /* Call the specified completion routine */ + if (cmdiocb->cmd_cmpl) { spin_unlock_irqrestore(&phba->hbalock, iflag); - cmdiocbp =3D lpfc_sli_iocbq_lookup(phba, pring, - saveq); + cmdiocb->cmd_cmpl(phba, cmdiocb, saveq); spin_lock_irqsave(&phba->hbalock, iflag); - } - if (cmdiocbp) { - /* Call the specified completion routine */ - if (cmdiocbp->cmd_cmpl) { - spin_unlock_irqrestore(&phba->hbalock, - iflag); - (cmdiocbp->cmd_cmpl)(phba, cmdiocbp, - saveq); - spin_lock_irqsave(&phba->hbalock, - iflag); - } else - __lpfc_sli_release_iocbq(phba, - cmdiocbp); - } - break; - - case LPFC_UNKNOWN_IOCB: - if (irsp->ulpCommand =3D=3D CMD_ADAPTER_MSG) { - char adaptermsg[LPFC_MAX_ADPTMSG]; - memset(adaptermsg, 0, LPFC_MAX_ADPTMSG); - memcpy(&adaptermsg[0], (uint8_t *)irsp, - MAX_MSG_DATA); - dev_warn(&((phba->pcidev)->dev), - "lpfc%d: %s\n", - phba->brd_no, adaptermsg); } else { - /* Unknown IOCB command */ - lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, - "0335 Unknown IOCB " - "command Data: x%x " - "x%x x%x x%x\n", - irsp->ulpCommand, - irsp->ulpStatus, - irsp->ulpIoTag, - irsp->ulpContext); + __lpfc_sli_release_iocbq(phba, cmdiocb); } - break; } + break; + case LPFC_UNKNOWN_IOCB: + if (ulp_command =3D=3D CMD_ADAPTER_MSG) { + char adaptermsg[LPFC_MAX_ADPTMSG]; + + memset(adaptermsg, 0, LPFC_MAX_ADPTMSG); + memcpy(&adaptermsg[0], (uint8_t *)&rspiocbp->wqe, + MAX_MSG_DATA); + dev_warn(&((phba->pcidev)->dev), + "lpfc%d: %s\n", + phba->brd_no, adaptermsg); + } else { + /* Unknown command */ + lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, + "0335 Unknown IOCB " + "command Data: x%x " + "x%x x%x x%x\n", + ulp_command, + ulp_status, + get_wqe_reqtag(rspiocbp), + get_job_ulpcontext(phba, rspiocbp)); + } + break; + } =20 - if (free_saveq) { - list_for_each_entry_safe(rspiocbp, next_iocb, - &saveq->list, list) { - list_del_init(&rspiocbp->list); - __lpfc_sli_release_iocbq(phba, rspiocbp); - } - __lpfc_sli_release_iocbq(phba, saveq); + if (free_saveq) { + list_for_each_entry_safe(rspiocbp, next_iocb, + &saveq->list, list) { + list_del_init(&rspiocbp->list); + __lpfc_sli_release_iocbq(phba, rspiocbp); } - rspiocbp =3D NULL; + __lpfc_sli_release_iocbq(phba, saveq); } + rspiocbp =3D NULL; spin_unlock_irqrestore(&phba->hbalock, iflag); return rspiocbp; } @@ -4429,8 +4426,8 @@ lpfc_sli_handle_slow_ring_event_s4(struct lpfc_hba *p= hba, irspiocbq =3D container_of(cq_event, struct lpfc_iocbq, cq_event); /* Translate ELS WCQE to response IOCBQ */ - irspiocbq =3D lpfc_sli4_els_wcqe_to_rspiocbq(phba, - irspiocbq); + irspiocbq =3D lpfc_sli4_els_preprocess_rspiocbq(phba, + irspiocbq); if (irspiocbq) lpfc_sli_sp_handle_rspiocb(phba, pring, irspiocbq); @@ -10974,7 +10971,17 @@ __lpfc_sli_issue_fcp_io_s4(struct lpfc_hba *phba, = uint32_t ring_number, int rc; struct lpfc_io_buf *lpfc_cmd =3D (struct lpfc_io_buf *)piocb->context1; - union lpfc_wqe128 *wqe =3D &piocb->wqe; + + lpfc_prep_embed_io(phba, lpfc_cmd); + rc =3D lpfc_sli4_issue_wqe(phba, lpfc_cmd->hdwq, piocb); + return rc; +} + +void +lpfc_prep_embed_io(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd) +{ + struct lpfc_iocbq *piocb =3D &lpfc_cmd->cur_iocbq; + union lpfc_wqe128 *wqe =3D &lpfc_cmd->cur_iocbq.wqe; struct sli4_sge *sgl; =20 /* 128 byte wqe support here */ @@ -11023,8 +11030,6 @@ __lpfc_sli_issue_fcp_io_s4(struct lpfc_hba *phba, u= int32_t ring_number, wqe->words[31] =3D piocb->vmid_tag.app_id; } } - rc =3D lpfc_sli4_issue_wqe(phba, lpfc_cmd->hdwq, piocb); - return rc; } =20 /** @@ -11046,9 +11051,10 @@ __lpfc_sli_issue_iocb_s4(struct lpfc_hba *phba, ui= nt32_t ring_number, struct lpfc_iocbq *piocb, uint32_t flag) { struct lpfc_sglq *sglq; - union lpfc_wqe128 wqe; + union lpfc_wqe128 *wqe; struct lpfc_queue *wq; struct lpfc_sli_ring *pring; + u32 ulp_command =3D get_job_cmnd(phba, piocb); =20 /* Get the WQ */ if ((piocb->cmd_flag & LPFC_IO_FCP) || @@ -11066,10 +11072,9 @@ __lpfc_sli_issue_iocb_s4(struct lpfc_hba *phba, ui= nt32_t ring_number, */ =20 lockdep_assert_held(&pring->ring_lock); - + wqe =3D &piocb->wqe; if (piocb->sli4_xritag =3D=3D NO_XRI) { - if (piocb->iocb.ulpCommand =3D=3D CMD_ABORT_XRI_CN || - piocb->iocb.ulpCommand =3D=3D CMD_CLOSE_XRI_CN) + if (ulp_command =3D=3D CMD_ABORT_XRI_WQE) sglq =3D NULL; else { if (!list_empty(&pring->txq)) { @@ -11110,14 +11115,24 @@ __lpfc_sli_issue_iocb_s4(struct lpfc_hba *phba, u= int32_t ring_number, if (sglq) { piocb->sli4_lxritag =3D sglq->sli4_lxritag; piocb->sli4_xritag =3D sglq->sli4_xritag; - if (NO_XRI =3D=3D lpfc_sli4_bpl2sgl(phba, piocb, sglq)) + + /* ABTS sent by initiator to CT exchange, the + * RX_ID field will be filled with the newly + * allocated responder XRI. + */ + if (ulp_command =3D=3D CMD_XMIT_BLS_RSP64_CX && + piocb->abort_bls =3D=3D LPFC_ABTS_UNSOL_INT) + bf_set(xmit_bls_rsp64_rxid, &wqe->xmit_bls_rsp, + piocb->sli4_xritag); + + bf_set(wqe_xri_tag, &wqe->generic.wqe_com, + piocb->sli4_xritag); + + if (lpfc_wqe_bpl2sgl(phba, piocb, sglq) =3D=3D NO_XRI) return IOCB_ERROR; } =20 - if (lpfc_sli4_iocb2wqe(phba, piocb, &wqe)) - return IOCB_ERROR; - - if (lpfc_sli4_wq_put(wq, &wqe)) + if (lpfc_sli4_wq_put(wq, wqe)) return IOCB_ERROR; lpfc_sli_ringtxcmpl_put(phba, pring, piocb); =20 @@ -14115,123 +14130,7 @@ void lpfc_sli4_els_xri_abort_event_proc(struct lp= fc_hba *phba) } =20 /** - * lpfc_sli4_iocb_param_transfer - Transfer pIocbOut and cmpl status to pI= ocbIn - * @phba: pointer to lpfc hba data structure - * @pIocbIn: pointer to the rspiocbq - * @pIocbOut: pointer to the cmdiocbq - * @wcqe: pointer to the complete wcqe - * - * This routine transfers the fields of a command iocbq to a response iocbq - * by copying all the IOCB fields from command iocbq and transferring the - * completion status information from the complete wcqe. - **/ -static void -lpfc_sli4_iocb_param_transfer(struct lpfc_hba *phba, - struct lpfc_iocbq *pIocbIn, - struct lpfc_iocbq *pIocbOut, - struct lpfc_wcqe_complete *wcqe) -{ - int numBdes, i; - unsigned long iflags; - uint32_t status, max_response; - struct lpfc_dmabuf *dmabuf; - struct ulp_bde64 *bpl, bde; - size_t offset =3D offsetof(struct lpfc_iocbq, iocb); - - memcpy((char *)pIocbIn + offset, (char *)pIocbOut + offset, - sizeof(struct lpfc_iocbq) - offset); - /* Map WCQE parameters into irspiocb parameters */ - status =3D bf_get(lpfc_wcqe_c_status, wcqe); - pIocbIn->iocb.ulpStatus =3D (status & LPFC_IOCB_STATUS_MASK); - if (pIocbOut->cmd_flag & LPFC_IO_FCP) - if (pIocbIn->iocb.ulpStatus =3D=3D IOSTAT_FCP_RSP_ERROR) - pIocbIn->iocb.un.fcpi.fcpi_parm =3D - pIocbOut->iocb.un.fcpi.fcpi_parm - - wcqe->total_data_placed; - else - pIocbIn->iocb.un.ulpWord[4] =3D wcqe->parameter; - else { - pIocbIn->iocb.un.ulpWord[4] =3D wcqe->parameter; - switch (pIocbOut->iocb.ulpCommand) { - case CMD_ELS_REQUEST64_CR: - dmabuf =3D (struct lpfc_dmabuf *)pIocbOut->context3; - bpl =3D (struct ulp_bde64 *)dmabuf->virt; - bde.tus.w =3D le32_to_cpu(bpl[1].tus.w); - max_response =3D bde.tus.f.bdeSize; - break; - case CMD_GEN_REQUEST64_CR: - max_response =3D 0; - if (!pIocbOut->context3) - break; - numBdes =3D pIocbOut->iocb.un.genreq64.bdl.bdeSize/ - sizeof(struct ulp_bde64); - dmabuf =3D (struct lpfc_dmabuf *)pIocbOut->context3; - bpl =3D (struct ulp_bde64 *)dmabuf->virt; - for (i =3D 0; i < numBdes; i++) { - bde.tus.w =3D le32_to_cpu(bpl[i].tus.w); - if (bde.tus.f.bdeFlags !=3D BUFF_TYPE_BDE_64) - max_response +=3D bde.tus.f.bdeSize; - } - break; - default: - max_response =3D wcqe->total_data_placed; - break; - } - if (max_response < wcqe->total_data_placed) - pIocbIn->iocb.un.genreq64.bdl.bdeSize =3D max_response; - else - pIocbIn->iocb.un.genreq64.bdl.bdeSize =3D - wcqe->total_data_placed; - } - - /* Convert BG errors for completion status */ - if (status =3D=3D CQE_STATUS_DI_ERROR) { - pIocbIn->iocb.ulpStatus =3D IOSTAT_LOCAL_REJECT; - - if (bf_get(lpfc_wcqe_c_bg_edir, wcqe)) - pIocbIn->iocb.un.ulpWord[4] =3D IOERR_RX_DMA_FAILED; - else - pIocbIn->iocb.un.ulpWord[4] =3D IOERR_TX_DMA_FAILED; - - pIocbIn->iocb.unsli3.sli3_bg.bgstat =3D 0; - if (bf_get(lpfc_wcqe_c_bg_ge, wcqe)) /* Guard Check failed */ - pIocbIn->iocb.unsli3.sli3_bg.bgstat |=3D - BGS_GUARD_ERR_MASK; - if (bf_get(lpfc_wcqe_c_bg_ae, wcqe)) /* App Tag Check failed */ - pIocbIn->iocb.unsli3.sli3_bg.bgstat |=3D - BGS_APPTAG_ERR_MASK; - if (bf_get(lpfc_wcqe_c_bg_re, wcqe)) /* Ref Tag Check failed */ - pIocbIn->iocb.unsli3.sli3_bg.bgstat |=3D - BGS_REFTAG_ERR_MASK; - - /* Check to see if there was any good data before the error */ - if (bf_get(lpfc_wcqe_c_bg_tdpv, wcqe)) { - pIocbIn->iocb.unsli3.sli3_bg.bgstat |=3D - BGS_HI_WATER_MARK_PRESENT_MASK; - pIocbIn->iocb.unsli3.sli3_bg.bghm =3D - wcqe->total_data_placed; - } - - /* - * Set ALL the error bits to indicate we don't know what - * type of error it is. - */ - if (!pIocbIn->iocb.unsli3.sli3_bg.bgstat) - pIocbIn->iocb.unsli3.sli3_bg.bgstat |=3D - (BGS_REFTAG_ERR_MASK | BGS_APPTAG_ERR_MASK | - BGS_GUARD_ERR_MASK); - } - - /* Pick up HBA exchange busy condition */ - if (bf_get(lpfc_wcqe_c_xb, wcqe)) { - spin_lock_irqsave(&phba->hbalock, iflags); - pIocbIn->cmd_flag |=3D LPFC_EXCHANGE_BUSY; - spin_unlock_irqrestore(&phba->hbalock, iflags); - } -} - -/** - * lpfc_sli4_els_wcqe_to_rspiocbq - Get response iocbq from els wcqe + * lpfc_sli4_els_preprocess_rspiocbq - Get response iocbq from els wcqe * @phba: Pointer to HBA context object. * @irspiocbq: Pointer to work-queue completion queue entry. * @@ -14242,8 +14141,8 @@ lpfc_sli4_iocb_param_transfer(struct lpfc_hba *phba, * Return: Pointer to the receive IOCBQ, NULL otherwise. **/ static struct lpfc_iocbq * -lpfc_sli4_els_wcqe_to_rspiocbq(struct lpfc_hba *phba, - struct lpfc_iocbq *irspiocbq) +lpfc_sli4_els_preprocess_rspiocbq(struct lpfc_hba *phba, + struct lpfc_iocbq *irspiocbq) { struct lpfc_sli_ring *pring; struct lpfc_iocbq *cmdiocbq; @@ -14255,11 +14154,13 @@ lpfc_sli4_els_wcqe_to_rspiocbq(struct lpfc_hba *p= hba, return NULL; =20 wcqe =3D &irspiocbq->cq_event.cqe.wcqe_cmpl; + spin_lock_irqsave(&pring->ring_lock, iflags); pring->stats.iocb_event++; /* Look up the ELS command IOCB and create pseudo response IOCB */ cmdiocbq =3D lpfc_sli_iocbq_lookup_by_tag(phba, pring, bf_get(lpfc_wcqe_c_request_tag, wcqe)); if (unlikely(!cmdiocbq)) { + spin_unlock_irqrestore(&pring->ring_lock, iflags); lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, "0386 ELS complete with no corresponding " "cmdiocb: 0x%x 0x%x 0x%x 0x%x\n", @@ -14269,13 +14170,18 @@ lpfc_sli4_els_wcqe_to_rspiocbq(struct lpfc_hba *p= hba, return NULL; } =20 - spin_lock_irqsave(&pring->ring_lock, iflags); + memcpy(&irspiocbq->wqe, &cmdiocbq->wqe, sizeof(union lpfc_wqe128)); + memcpy(&irspiocbq->wcqe_cmpl, wcqe, sizeof(*wcqe)); + /* Put the iocb back on the txcmplq */ lpfc_sli_ringtxcmpl_put(phba, pring, cmdiocbq); spin_unlock_irqrestore(&pring->ring_lock, iflags); =20 - /* Fake the irspiocbq and copy necessary response information */ - lpfc_sli4_iocb_param_transfer(phba, irspiocbq, cmdiocbq, wcqe); + if (bf_get(lpfc_wcqe_c_xb, wcqe)) { + spin_lock_irqsave(&phba->hbalock, iflags); + cmdiocbq->cmd_flag |=3D LPFC_EXCHANGE_BUSY; + spin_unlock_irqrestore(&phba->hbalock, iflags); + } =20 return irspiocbq; } @@ -15101,9 +15007,9 @@ lpfc_sli4_fp_handle_fcp_wcqe(struct lpfc_hba *phba,= struct lpfc_queue *cq, /* Look up the FCP command IOCB and create pseudo response IOCB */ spin_lock_irqsave(&pring->ring_lock, iflags); pring->stats.iocb_event++; - spin_unlock_irqrestore(&pring->ring_lock, iflags); cmdiocbq =3D lpfc_sli_iocbq_lookup_by_tag(phba, pring, bf_get(lpfc_wcqe_c_request_tag, wcqe)); + spin_unlock_irqrestore(&pring->ring_lock, iflags); if (unlikely(!cmdiocbq)) { lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, "0374 FCP complete with no corresponding " @@ -18964,13 +18870,16 @@ lpfc_sli4_seq_abort_rsp(struct lpfc_vport *vport, ctiocb->sli4_lxritag =3D NO_XRI; ctiocb->sli4_xritag =3D NO_XRI; =20 - if (fctl & FC_FC_EX_CTX) + if (fctl & FC_FC_EX_CTX) { /* Exchange responder sent the abort so we * own the oxid. */ + ctiocb->abort_bls =3D LPFC_ABTS_UNSOL_RSP; xri =3D oxid; - else + } else { + ctiocb->abort_bls =3D LPFC_ABTS_UNSOL_INT; xri =3D rxid; + } lxri =3D lpfc_sli4_xri_inrange(phba, xri); if (lxri !=3D NO_XRI) lpfc_set_rrq_active(phba, ndlp, lxri, diff --git a/drivers/scsi/lpfc/lpfc_sli.h b/drivers/scsi/lpfc/lpfc_sli.h index 968c83182643..06682ad8bbe1 100644 --- a/drivers/scsi/lpfc/lpfc_sli.h +++ b/drivers/scsi/lpfc/lpfc_sli.h @@ -76,6 +76,8 @@ struct lpfc_iocbq { struct lpfc_wcqe_complete wcqe_cmpl; /* WQE cmpl */ =20 uint8_t num_bdes; + uint8_t abort_bls; /* ABTS by initiator or responder */ + uint8_t priority; /* OAS priority */ uint8_t retry; /* retry counter for IOCB cmd - if needed */ u32 cmd_flag; --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C07BC00140 for ; Mon, 15 Aug 2022 19:55:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345625AbiHOTzF (ORCPT ); Mon, 15 Aug 2022 15:55:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345297AbiHOTx0 (ORCPT ); Mon, 15 Aug 2022 15:53: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 C95D94505E; Mon, 15 Aug 2022 11:51: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 57AEA611D6; Mon, 15 Aug 2022 18:51:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 169BEC433C1; Mon, 15 Aug 2022 18:51:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589487; bh=KaRwMdakcBb5rKD7XNnIjtnCcpndb2WwlEEQbtt0y/o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ubMFw5FFDRvzjoc5B0+afQECr3deVQ2nZyGx2THfbKKYyvw0/gayPI9YY5ce1otay bPMSpd43O0wmGuz0g9xDQF/pK8IXkTAy75wPCM8hcyU8zvMea1m979Da4TovTm9qsu o5anVbAQ2ZEY4JtjW1LiZisxt/7WuJYL3MOSqYAM= 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.15 703/779] scsi: lpfc: SLI path split: Refactor SCSI paths Date: Mon, 15 Aug 2022 20:05:47 +0200 Message-Id: <20220815180407.450621383@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 3512ac0942938d6977e7999ee69765d948d2faf1 ] This patch refactors the SCSI paths to use SLI-4 as the primary interface. - Conversion away from using SLI-3 iocb structures to set/access fields in common routines. Use the new generic get/set routines that were added. This move changes code from indirect structure references to using local variables with the generic routines. - Refactor routines when setting non-generic fields, to have both SLI3 and SLI4 specific sections. This replaces the set-as-SLI3 then translate to SLI4 behavior of the past. Link: https://lore.kernel.org/r/20220225022308.16486-14-jsmart2021@gmail.com Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/lpfc/lpfc.h | 4 + drivers/scsi/lpfc/lpfc_scsi.c | 374 +++++++++++++++------------------- drivers/scsi/lpfc/lpfc_sli.c | 6 +- 3 files changed, 174 insertions(+), 210 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h index 266d980667b8..f3bcb56e9ef2 100644 --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -920,6 +920,10 @@ struct lpfc_hba { (struct lpfc_vport *vport, struct lpfc_io_buf *lpfc_cmd, uint8_t tmo); + int (*lpfc_scsi_prep_task_mgmt_cmd) + (struct lpfc_vport *vport, + struct lpfc_io_buf *lpfc_cmd, + u64 lun, u8 task_mgmt_cmd); =20 /* IOCB interface function jump table entries */ int (*__lpfc_sli_issue_iocb) diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index 765849643aed..b43dfcb81185 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -2942,154 +2942,58 @@ lpfc_calc_bg_err(struct lpfc_hba *phba, struct lpf= c_io_buf *lpfc_cmd) * -1 - Internal error (bad profile, ...etc) */ static int -lpfc_sli4_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd, - struct lpfc_wcqe_complete *wcqe) +lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd, + struct lpfc_iocbq *pIocbOut) { struct scsi_cmnd *cmd =3D lpfc_cmd->pCmd; + struct sli3_bg_fields *bgf; int ret =3D 0; - u32 status =3D bf_get(lpfc_wcqe_c_status, wcqe); + struct lpfc_wcqe_complete *wcqe; + u32 status; u32 bghm =3D 0; u32 bgstat =3D 0; u64 failing_sector =3D 0; =20 - if (status =3D=3D CQE_STATUS_DI_ERROR) { - if (bf_get(lpfc_wcqe_c_bg_ge, wcqe)) /* Guard Check failed */ - bgstat |=3D BGS_GUARD_ERR_MASK; - if (bf_get(lpfc_wcqe_c_bg_ae, wcqe)) /* AppTag Check failed */ - bgstat |=3D BGS_APPTAG_ERR_MASK; - if (bf_get(lpfc_wcqe_c_bg_re, wcqe)) /* RefTag Check failed */ - bgstat |=3D BGS_REFTAG_ERR_MASK; - - /* Check to see if there was any good data before the error */ - if (bf_get(lpfc_wcqe_c_bg_tdpv, wcqe)) { - bgstat |=3D BGS_HI_WATER_MARK_PRESENT_MASK; - bghm =3D wcqe->total_data_placed; - } - - /* - * Set ALL the error bits to indicate we don't know what - * type of error it is. - */ - if (!bgstat) - bgstat |=3D (BGS_REFTAG_ERR_MASK | BGS_APPTAG_ERR_MASK | - BGS_GUARD_ERR_MASK); - } - - if (lpfc_bgs_get_guard_err(bgstat)) { - ret =3D 1; - - scsi_build_sense(cmd, 1, ILLEGAL_REQUEST, 0x10, 0x1); - set_host_byte(cmd, DID_ABORT); - phba->bg_guard_err_cnt++; - lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, - "9059 BLKGRD: Guard Tag error in cmd" - " 0x%x lba 0x%llx blk cnt 0x%x " - "bgstat=3Dx%x bghm=3Dx%x\n", cmd->cmnd[0], - (unsigned long long)scsi_get_lba(cmd), - scsi_logical_block_count(cmd), bgstat, bghm); - } - - if (lpfc_bgs_get_reftag_err(bgstat)) { - ret =3D 1; - - scsi_build_sense(cmd, 1, ILLEGAL_REQUEST, 0x10, 0x3); - set_host_byte(cmd, DID_ABORT); - - phba->bg_reftag_err_cnt++; - lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, - "9060 BLKGRD: Ref Tag error in cmd" - " 0x%x lba 0x%llx blk cnt 0x%x " - "bgstat=3Dx%x bghm=3Dx%x\n", cmd->cmnd[0], - (unsigned long long)scsi_get_lba(cmd), - scsi_logical_block_count(cmd), bgstat, bghm); - } + if (phba->sli_rev =3D=3D LPFC_SLI_REV4) { + wcqe =3D &pIocbOut->wcqe_cmpl; + status =3D bf_get(lpfc_wcqe_c_status, wcqe); =20 - if (lpfc_bgs_get_apptag_err(bgstat)) { - ret =3D 1; + if (status =3D=3D CQE_STATUS_DI_ERROR) { + /* Guard Check failed */ + if (bf_get(lpfc_wcqe_c_bg_ge, wcqe)) + bgstat |=3D BGS_GUARD_ERR_MASK; =20 - scsi_build_sense(cmd, 1, ILLEGAL_REQUEST, 0x10, 0x2); - set_host_byte(cmd, DID_ABORT); + /* AppTag Check failed */ + if (bf_get(lpfc_wcqe_c_bg_ae, wcqe)) + bgstat |=3D BGS_APPTAG_ERR_MASK; =20 - phba->bg_apptag_err_cnt++; - lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, - "9062 BLKGRD: App Tag error in cmd" - " 0x%x lba 0x%llx blk cnt 0x%x " - "bgstat=3Dx%x bghm=3Dx%x\n", cmd->cmnd[0], - (unsigned long long)scsi_get_lba(cmd), - scsi_logical_block_count(cmd), bgstat, bghm); - } + /* RefTag Check failed */ + if (bf_get(lpfc_wcqe_c_bg_re, wcqe)) + bgstat |=3D BGS_REFTAG_ERR_MASK; =20 - if (lpfc_bgs_get_hi_water_mark_present(bgstat)) { - /* - * setup sense data descriptor 0 per SPC-4 as an information - * field, and put the failing LBA in it. - * This code assumes there was also a guard/app/ref tag error - * indication. - */ - cmd->sense_buffer[7] =3D 0xc; /* Additional sense length */ - cmd->sense_buffer[8] =3D 0; /* Information descriptor type */ - cmd->sense_buffer[9] =3D 0xa; /* Additional descriptor length */ - cmd->sense_buffer[10] =3D 0x80; /* Validity bit */ + /* Check to see if there was any good data before the + * error + */ + if (bf_get(lpfc_wcqe_c_bg_tdpv, wcqe)) { + bgstat |=3D BGS_HI_WATER_MARK_PRESENT_MASK; + bghm =3D wcqe->total_data_placed; + } =20 - /* bghm is a "on the wire" FC frame based count */ - switch (scsi_get_prot_op(cmd)) { - case SCSI_PROT_READ_INSERT: - case SCSI_PROT_WRITE_STRIP: - bghm /=3D cmd->device->sector_size; - break; - case SCSI_PROT_READ_STRIP: - case SCSI_PROT_WRITE_INSERT: - case SCSI_PROT_READ_PASS: - case SCSI_PROT_WRITE_PASS: - bghm /=3D (cmd->device->sector_size + - sizeof(struct scsi_dif_tuple)); - break; + /* + * Set ALL the error bits to indicate we don't know what + * type of error it is. + */ + if (!bgstat) + bgstat |=3D (BGS_REFTAG_ERR_MASK | + BGS_APPTAG_ERR_MASK | + BGS_GUARD_ERR_MASK); } =20 - failing_sector =3D scsi_get_lba(cmd); - failing_sector +=3D bghm; - - /* Descriptor Information */ - put_unaligned_be64(failing_sector, &cmd->sense_buffer[12]); - } - - if (!ret) { - /* No error was reported - problem in FW? */ - lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, - "9068 BLKGRD: Unknown error in cmd" - " 0x%x lba 0x%llx blk cnt 0x%x " - "bgstat=3Dx%x bghm=3Dx%x\n", cmd->cmnd[0], - (unsigned long long)scsi_get_lba(cmd), - scsi_logical_block_count(cmd), bgstat, bghm); - - /* Calculate what type of error it was */ - lpfc_calc_bg_err(phba, lpfc_cmd); + } else { + bgf =3D &pIocbOut->iocb.unsli3.sli3_bg; + bghm =3D bgf->bghm; + bgstat =3D bgf->bgstat; } - return ret; -} - -/* - * This function checks for BlockGuard errors detected by - * the HBA. In case of errors, the ASC/ASCQ fields in the - * sense buffer will be set accordingly, paired with - * ILLEGAL_REQUEST to signal to the kernel that the HBA - * detected corruption. - * - * Returns: - * 0 - No error found - * 1 - BlockGuard error found - * -1 - Internal error (bad profile, ...etc) - */ -static int -lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_io_buf *lpfc_cmd, - struct lpfc_iocbq *pIocbOut) -{ - struct scsi_cmnd *cmd =3D lpfc_cmd->pCmd; - struct sli3_bg_fields *bgf =3D &pIocbOut->iocb.unsli3.sli3_bg; - int ret =3D 0; - uint32_t bghm =3D bgf->bghm; - uint32_t bgstat =3D bgf->bgstat; - uint64_t failing_sector =3D 0; =20 if (lpfc_bgs_get_invalid_prof(bgstat)) { cmd->result =3D DID_ERROR << 16; @@ -3117,7 +3021,6 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc_= io_buf *lpfc_cmd, =20 if (lpfc_bgs_get_guard_err(bgstat)) { ret =3D 1; - scsi_build_sense(cmd, 1, ILLEGAL_REQUEST, 0x10, 0x1); set_host_byte(cmd, DID_ABORT); phba->bg_guard_err_cnt++; @@ -3131,10 +3034,8 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc= _io_buf *lpfc_cmd, =20 if (lpfc_bgs_get_reftag_err(bgstat)) { ret =3D 1; - scsi_build_sense(cmd, 1, ILLEGAL_REQUEST, 0x10, 0x3); set_host_byte(cmd, DID_ABORT); - phba->bg_reftag_err_cnt++; lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, "9056 BLKGRD: Ref Tag error in cmd " @@ -3146,10 +3047,8 @@ lpfc_parse_bg_err(struct lpfc_hba *phba, struct lpfc= _io_buf *lpfc_cmd, =20 if (lpfc_bgs_get_apptag_err(bgstat)) { ret =3D 1; - scsi_build_sense(cmd, 1, ILLEGAL_REQUEST, 0x10, 0x2); set_host_byte(cmd, DID_ABORT); - phba->bg_apptag_err_cnt++; lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_BG, "9061 BLKGRD: App Tag error in cmd " @@ -4194,7 +4093,6 @@ lpfc_fcp_io_cmd_wqe_cmpl(struct lpfc_hba *phba, struc= t lpfc_iocbq *pwqeIn, struct Scsi_Host *shost; u32 logit =3D LOG_FCP; u32 status, idx; - unsigned long iflags =3D 0; u32 lat; u8 wait_xb_clr =3D 0; =20 @@ -4209,30 +4107,16 @@ lpfc_fcp_io_cmd_wqe_cmpl(struct lpfc_hba *phba, str= uct lpfc_iocbq *pwqeIn, rdata =3D lpfc_cmd->rdata; ndlp =3D rdata->pnode; =20 - if (bf_get(lpfc_wcqe_c_xb, wcqe)) { - /* TOREMOVE - currently this flag is checked during - * the release of lpfc_iocbq. Remove once we move - * to lpfc_wqe_job construct. - * - * This needs to be done outside buf_lock - */ - spin_lock_irqsave(&phba->hbalock, iflags); - lpfc_cmd->cur_iocbq.cmd_flag |=3D LPFC_EXCHANGE_BUSY; - spin_unlock_irqrestore(&phba->hbalock, iflags); - } - - /* Guard against abort handler being called at same time */ - spin_lock(&lpfc_cmd->buf_lock); - /* Sanity check on return of outstanding command */ cmd =3D lpfc_cmd->pCmd; if (!cmd) { lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, "9042 I/O completion: Not an active IO\n"); - spin_unlock(&lpfc_cmd->buf_lock); lpfc_release_scsi_buf(phba, lpfc_cmd); return; } + /* Guard against abort handler being called at same time */ + spin_lock(&lpfc_cmd->buf_lock); idx =3D lpfc_cmd->cur_iocbq.hba_wqidx; if (phba->sli4_hba.hdwq) phba->sli4_hba.hdwq[idx].scsi_cstat.io_cmpls++; @@ -4406,12 +4290,14 @@ lpfc_fcp_io_cmd_wqe_cmpl(struct lpfc_hba *phba, str= uct lpfc_iocbq *pwqeIn, * This is a response for a BG enabled * cmd. Parse BG error */ - lpfc_sli4_parse_bg_err(phba, lpfc_cmd, - wcqe); + lpfc_parse_bg_err(phba, lpfc_cmd, pwqeOut); break; + } else { + lpfc_printf_vlog(vport, KERN_WARNING, + LOG_BG, + "9040 non-zero BGSTAT " + "on unprotected cmd\n"); } - lpfc_printf_vlog(vport, KERN_WARNING, LOG_BG, - "9040 non-zero BGSTAT on unprotected cmd\n"); } lpfc_printf_vlog(vport, KERN_WARNING, logit, "9036 Local Reject FCP cmd x%x failed" @@ -5016,7 +4902,7 @@ lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct = lpfc_io_buf *lpfc_cmd, } =20 /** - * lpfc_scsi_prep_task_mgmt_cmd - Convert SLI3 scsi TM cmd to FCP info unit + * lpfc_scsi_prep_task_mgmt_cmd_s3 - Convert SLI3 scsi TM cmd to FCP info = unit * @vport: The virtual port for which this call is being executed. * @lpfc_cmd: Pointer to lpfc_io_buf data structure. * @lun: Logical unit number. @@ -5030,10 +4916,9 @@ lpfc_scsi_prep_cmnd(struct lpfc_vport *vport, struct= lpfc_io_buf *lpfc_cmd, * 1 - Success **/ static int -lpfc_scsi_prep_task_mgmt_cmd(struct lpfc_vport *vport, - struct lpfc_io_buf *lpfc_cmd, - uint64_t lun, - uint8_t task_mgmt_cmd) +lpfc_scsi_prep_task_mgmt_cmd_s3(struct lpfc_vport *vport, + struct lpfc_io_buf *lpfc_cmd, + u64 lun, u8 task_mgmt_cmd) { struct lpfc_iocbq *piocbq; IOCB_t *piocb; @@ -5054,15 +4939,10 @@ lpfc_scsi_prep_task_mgmt_cmd(struct lpfc_vport *vpo= rt, memset(fcp_cmnd, 0, sizeof(struct fcp_cmnd)); int_to_scsilun(lun, &fcp_cmnd->fcp_lun); fcp_cmnd->fcpCntl2 =3D task_mgmt_cmd; - if (vport->phba->sli_rev =3D=3D 3 && - !(vport->phba->sli3_options & LPFC_SLI3_BG_ENABLED)) + if (!(vport->phba->sli3_options & LPFC_SLI3_BG_ENABLED)) lpfc_fcpcmd_to_iocb(piocb->unsli3.fcp_ext.icd, fcp_cmnd); piocb->ulpCommand =3D CMD_FCP_ICMND64_CR; piocb->ulpContext =3D ndlp->nlp_rpi; - if (vport->phba->sli_rev =3D=3D LPFC_SLI_REV4) { - piocb->ulpContext =3D - vport->phba->sli4_hba.rpi_ids[ndlp->nlp_rpi]; - } piocb->ulpFCP2Rcvy =3D (ndlp->nlp_fcp_info & NLP_FCP_2_DEVICE) ? 1 : 0; piocb->ulpClass =3D (ndlp->nlp_fcp_info & 0x0f); piocb->ulpPU =3D 0; @@ -5078,8 +4958,79 @@ lpfc_scsi_prep_task_mgmt_cmd(struct lpfc_vport *vpor= t, } else piocb->ulpTimeout =3D lpfc_cmd->timeout; =20 - if (vport->phba->sli_rev =3D=3D LPFC_SLI_REV4) - lpfc_sli4_set_rsp_sgl_last(vport->phba, lpfc_cmd); + return 1; +} + +/** + * lpfc_scsi_prep_task_mgmt_cmd_s4 - Convert SLI4 scsi TM cmd to FCP info = unit + * @vport: The virtual port for which this call is being executed. + * @lpfc_cmd: Pointer to lpfc_io_buf data structure. + * @lun: Logical unit number. + * @task_mgmt_cmd: SCSI task management command. + * + * This routine creates FCP information unit corresponding to @task_mgmt_c= md + * for device with SLI-4 interface spec. + * + * Return codes: + * 0 - Error + * 1 - Success + **/ +static int +lpfc_scsi_prep_task_mgmt_cmd_s4(struct lpfc_vport *vport, + struct lpfc_io_buf *lpfc_cmd, + u64 lun, u8 task_mgmt_cmd) +{ + struct lpfc_iocbq *pwqeq =3D &lpfc_cmd->cur_iocbq; + union lpfc_wqe128 *wqe =3D &pwqeq->wqe; + struct fcp_cmnd *fcp_cmnd; + struct lpfc_rport_data *rdata =3D lpfc_cmd->rdata; + struct lpfc_nodelist *ndlp =3D rdata->pnode; + + if (!ndlp || ndlp->nlp_state !=3D NLP_STE_MAPPED_NODE) + return 0; + + pwqeq->vport =3D vport; + /* Initialize 64 bytes only */ + memset(wqe, 0, sizeof(union lpfc_wqe128)); + + /* From the icmnd template, initialize words 4 - 11 */ + memcpy(&wqe->words[4], &lpfc_icmnd_cmd_template.words[4], + sizeof(uint32_t) * 8); + + fcp_cmnd =3D lpfc_cmd->fcp_cmnd; + /* Clear out any old data in the FCP command area */ + memset(fcp_cmnd, 0, sizeof(struct fcp_cmnd)); + int_to_scsilun(lun, &fcp_cmnd->fcp_lun); + fcp_cmnd->fcpCntl3 =3D 0; + fcp_cmnd->fcpCntl2 =3D task_mgmt_cmd; + + bf_set(payload_offset_len, &wqe->fcp_icmd, + sizeof(struct fcp_cmnd) + sizeof(struct fcp_rsp)); + bf_set(cmd_buff_len, &wqe->fcp_icmd, 0); + bf_set(wqe_ctxt_tag, &wqe->generic.wqe_com, /* ulpContext */ + vport->phba->sli4_hba.rpi_ids[ndlp->nlp_rpi]); + bf_set(wqe_erp, &wqe->fcp_icmd.wqe_com, + ((ndlp->nlp_fcp_info & NLP_FCP_2_DEVICE) ? 1 : 0)); + bf_set(wqe_class, &wqe->fcp_icmd.wqe_com, + (ndlp->nlp_fcp_info & 0x0f)); + + /* ulpTimeout is only one byte */ + if (lpfc_cmd->timeout > 0xff) { + /* + * Do not timeout the command at the firmware level. + * The driver will provide the timeout mechanism. + */ + bf_set(wqe_tmo, &wqe->fcp_icmd.wqe_com, 0); + } else { + bf_set(wqe_tmo, &wqe->fcp_icmd.wqe_com, lpfc_cmd->timeout); + } + + lpfc_prep_embed_io(vport->phba, lpfc_cmd); + bf_set(wqe_xri_tag, &wqe->generic.wqe_com, pwqeq->sli4_xritag); + wqe->generic.wqe_com.abort_tag =3D pwqeq->iotag; + bf_set(wqe_reqtag, &wqe->generic.wqe_com, pwqeq->iotag); + + lpfc_sli4_set_rsp_sgl_last(vport->phba, lpfc_cmd); =20 return 1; } @@ -5106,6 +5057,8 @@ lpfc_scsi_api_table_setup(struct lpfc_hba *phba, uint= 8_t dev_grp) phba->lpfc_release_scsi_buf =3D lpfc_release_scsi_buf_s3; phba->lpfc_get_scsi_buf =3D lpfc_get_scsi_buf_s3; phba->lpfc_scsi_prep_cmnd_buf =3D lpfc_scsi_prep_cmnd_buf_s3; + phba->lpfc_scsi_prep_task_mgmt_cmd =3D + lpfc_scsi_prep_task_mgmt_cmd_s3; break; case LPFC_PCI_DEV_OC: phba->lpfc_scsi_prep_dma_buf =3D lpfc_scsi_prep_dma_buf_s4; @@ -5113,6 +5066,8 @@ lpfc_scsi_api_table_setup(struct lpfc_hba *phba, uint= 8_t dev_grp) phba->lpfc_release_scsi_buf =3D lpfc_release_scsi_buf_s4; phba->lpfc_get_scsi_buf =3D lpfc_get_scsi_buf_s4; phba->lpfc_scsi_prep_cmnd_buf =3D lpfc_scsi_prep_cmnd_buf_s4; + phba->lpfc_scsi_prep_task_mgmt_cmd =3D + lpfc_scsi_prep_task_mgmt_cmd_s4; break; default: lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, @@ -5591,6 +5546,7 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scs= i_cmnd *cmnd) { struct lpfc_vport *vport =3D (struct lpfc_vport *) shost->hostdata; struct lpfc_hba *phba =3D vport->phba; + struct lpfc_iocbq *cur_iocbq =3D NULL; struct lpfc_rport_data *rdata; struct lpfc_nodelist *ndlp; struct lpfc_io_buf *lpfc_cmd; @@ -5684,6 +5640,7 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scs= i_cmnd *cmnd) } lpfc_cmd->rx_cmd_start =3D start; =20 + cur_iocbq =3D &lpfc_cmd->cur_iocbq; /* * Store the midlayer's command structure for the completion phase * and complete the command initialization. @@ -5691,7 +5648,7 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scs= i_cmnd *cmnd) lpfc_cmd->pCmd =3D cmnd; lpfc_cmd->rdata =3D rdata; lpfc_cmd->ndlp =3D ndlp; - lpfc_cmd->cur_iocbq.cmd_cmpl =3D NULL; + cur_iocbq->cmd_cmpl =3D NULL; cmnd->host_scribble =3D (unsigned char *)lpfc_cmd; =20 err =3D lpfc_scsi_prep_cmnd(vport, lpfc_cmd, ndlp); @@ -5733,7 +5690,6 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scs= i_cmnd *cmnd) goto out_host_busy_free_buf; } =20 - /* check the necessary and sufficient condition to support VMID */ if (lpfc_is_vmid_enabled(phba) && (ndlp->vmid_support || @@ -5746,20 +5702,19 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct s= csi_cmnd *cmnd) if (uuid) { err =3D lpfc_vmid_get_appid(vport, uuid, cmnd, (union lpfc_vmid_io_tag *) - &lpfc_cmd->cur_iocbq.vmid_tag); + &cur_iocbq->vmid_tag); if (!err) - lpfc_cmd->cur_iocbq.cmd_flag |=3D LPFC_IO_VMID; + cur_iocbq->cmd_flag |=3D LPFC_IO_VMID; } } - atomic_inc(&ndlp->cmd_pending); + #ifdef CONFIG_SCSI_LPFC_DEBUG_FS if (unlikely(phba->hdwqstat_on & LPFC_CHECK_SCSI_IO)) this_cpu_inc(phba->sli4_hba.c_stat->xmt_io); #endif /* Issue I/O to adapter */ - err =3D lpfc_sli_issue_fcp_io(phba, LPFC_FCP_RING, - &lpfc_cmd->cur_iocbq, + err =3D lpfc_sli_issue_fcp_io(phba, LPFC_FCP_RING, cur_iocbq, SLI_IOCB_RET_IOCB); #ifdef CONFIG_SCSI_LPFC_DEBUG_FS if (start) { @@ -5772,25 +5727,25 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct s= csi_cmnd *cmnd) #endif if (err) { lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP, - "3376 FCP could not issue IOCB err %x " - "FCP cmd x%x <%d/%llu> " - "sid: x%x did: x%x oxid: x%x " - "Data: x%x x%x x%x x%x\n", - err, cmnd->cmnd[0], - cmnd->device ? cmnd->device->id : 0xffff, - cmnd->device ? cmnd->device->lun : (u64)-1, - vport->fc_myDID, ndlp->nlp_DID, - phba->sli_rev =3D=3D LPFC_SLI_REV4 ? - lpfc_cmd->cur_iocbq.sli4_xritag : 0xffff, - phba->sli_rev =3D=3D LPFC_SLI_REV4 ? - phba->sli4_hba.rpi_ids[ndlp->nlp_rpi] : - lpfc_cmd->cur_iocbq.iocb.ulpContext, - lpfc_cmd->cur_iocbq.iotag, - phba->sli_rev =3D=3D LPFC_SLI_REV4 ? - bf_get(wqe_tmo, - &lpfc_cmd->cur_iocbq.wqe.generic.wqe_com) : - lpfc_cmd->cur_iocbq.iocb.ulpTimeout, - (uint32_t)(scsi_cmd_to_rq(cmnd)->timeout / 1000)); + "3376 FCP could not issue iocb err %x " + "FCP cmd x%x <%d/%llu> " + "sid: x%x did: x%x oxid: x%x " + "Data: x%x x%x x%x x%x\n", + err, cmnd->cmnd[0], + cmnd->device ? cmnd->device->id : 0xffff, + cmnd->device ? cmnd->device->lun : (u64)-1, + vport->fc_myDID, ndlp->nlp_DID, + phba->sli_rev =3D=3D LPFC_SLI_REV4 ? + cur_iocbq->sli4_xritag : 0xffff, + phba->sli_rev =3D=3D LPFC_SLI_REV4 ? + phba->sli4_hba.rpi_ids[ndlp->nlp_rpi] : + cur_iocbq->iocb.ulpContext, + cur_iocbq->iotag, + phba->sli_rev =3D=3D LPFC_SLI_REV4 ? + bf_get(wqe_tmo, + &cur_iocbq->wqe.generic.wqe_com) : + cur_iocbq->iocb.ulpTimeout, + (uint32_t)(scsi_cmd_to_rq(cmnd)->timeout / 1000)); =20 goto out_host_busy_free_buf; } @@ -6167,7 +6122,7 @@ lpfc_send_taskmgmt(struct lpfc_vport *vport, struct s= csi_cmnd *cmnd, return FAILED; pnode =3D rdata->pnode; =20 - lpfc_cmd =3D lpfc_get_scsi_buf(phba, pnode, NULL); + lpfc_cmd =3D lpfc_get_scsi_buf(phba, rdata->pnode, NULL); if (lpfc_cmd =3D=3D NULL) return FAILED; lpfc_cmd->timeout =3D phba->cfg_task_mgmt_tmo; @@ -6175,8 +6130,8 @@ lpfc_send_taskmgmt(struct lpfc_vport *vport, struct s= csi_cmnd *cmnd, lpfc_cmd->pCmd =3D cmnd; lpfc_cmd->ndlp =3D pnode; =20 - status =3D lpfc_scsi_prep_task_mgmt_cmd(vport, lpfc_cmd, lun_id, - task_mgmt_cmd); + status =3D phba->lpfc_scsi_prep_task_mgmt_cmd(vport, lpfc_cmd, lun_id, + task_mgmt_cmd); if (!status) { lpfc_release_scsi_buf(phba, lpfc_cmd); return FAILED; @@ -6189,6 +6144,7 @@ lpfc_send_taskmgmt(struct lpfc_vport *vport, struct s= csi_cmnd *cmnd, return FAILED; } iocbq->cmd_cmpl =3D lpfc_tskmgmt_def_cmpl; + iocbq->vport =3D vport; =20 lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP, "0702 Issue %s to TGT %d LUN %llu " @@ -6200,26 +6156,28 @@ lpfc_send_taskmgmt(struct lpfc_vport *vport, struct= scsi_cmnd *cmnd, status =3D lpfc_sli_issue_iocb_wait(phba, LPFC_FCP_RING, iocbq, iocbqrsp, lpfc_cmd->timeout); if ((status !=3D IOCB_SUCCESS) || - (iocbqrsp->iocb.ulpStatus !=3D IOSTAT_SUCCESS)) { + (get_job_ulpstatus(phba, iocbqrsp) !=3D IOSTAT_SUCCESS)) { if (status !=3D IOCB_SUCCESS || - iocbqrsp->iocb.ulpStatus !=3D IOSTAT_FCP_RSP_ERROR) + get_job_ulpstatus(phba, iocbqrsp) !=3D IOSTAT_FCP_RSP_ERROR) lpfc_printf_vlog(vport, KERN_ERR, LOG_TRACE_EVENT, "0727 TMF %s to TGT %d LUN %llu " "failed (%d, %d) cmd_flag x%x\n", lpfc_taskmgmt_name(task_mgmt_cmd), tgt_id, lun_id, - iocbqrsp->iocb.ulpStatus, - iocbqrsp->iocb.un.ulpWord[4], + get_job_ulpstatus(phba, iocbqrsp), + get_job_word4(phba, iocbqrsp), iocbq->cmd_flag); /* if ulpStatus !=3D IOCB_SUCCESS, then status =3D=3D IOCB_SUCCESS */ if (status =3D=3D IOCB_SUCCESS) { - if (iocbqrsp->iocb.ulpStatus =3D=3D IOSTAT_FCP_RSP_ERROR) + if (get_job_ulpstatus(phba, iocbqrsp) =3D=3D + IOSTAT_FCP_RSP_ERROR) /* Something in the FCP_RSP was invalid. * Check conditions */ ret =3D lpfc_check_fcp_rsp(vport, lpfc_cmd); else ret =3D FAILED; - } else if (status =3D=3D IOCB_TIMEDOUT) { + } else if ((status =3D=3D IOCB_TIMEDOUT) || + (status =3D=3D IOCB_ABORTED)) { ret =3D TIMEOUT_ERROR; } else { ret =3D FAILED; @@ -6229,7 +6187,7 @@ lpfc_send_taskmgmt(struct lpfc_vport *vport, struct s= csi_cmnd *cmnd, =20 lpfc_sli_release_iocbq(phba, iocbqrsp); =20 - if (ret !=3D TIMEOUT_ERROR) + if (status !=3D IOCB_TIMEDOUT) lpfc_release_scsi_buf(phba, lpfc_cmd); =20 return ret; diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 464a251bcc88..972251dd35a9 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -12968,6 +12968,7 @@ lpfc_sli_wake_iocb_wait(struct lpfc_hba *phba, wait_queue_head_t *pdone_q; unsigned long iflags; struct lpfc_io_buf *lpfc_cmd; + size_t offset =3D offsetof(struct lpfc_iocbq, wqe); =20 spin_lock_irqsave(&phba->hbalock, iflags); if (cmdiocbq->cmd_flag & LPFC_IO_WAKE_TMO) { @@ -12988,10 +12989,11 @@ lpfc_sli_wake_iocb_wait(struct lpfc_hba *phba, return; } =20 + /* Copy the contents of the local rspiocb into the caller's buffer. */ cmdiocbq->cmd_flag |=3D LPFC_IO_WAKE; if (cmdiocbq->context2 && rspiocbq) - memcpy(&((struct lpfc_iocbq *)cmdiocbq->context2)->iocb, - &rspiocbq->iocb, sizeof(IOCB_t)); + memcpy((char *)cmdiocbq->context2 + offset, + (char *)rspiocbq + offset, sizeof(*rspiocbq) - offset); =20 /* Set the exchange busy flag for task management commands */ if ((cmdiocbq->cmd_flag & LPFC_IO_FCP) && --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88CB8C28B2B for ; Mon, 15 Aug 2022 19:51:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245034AbiHOTvx (ORCPT ); Mon, 15 Aug 2022 15:51:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345328AbiHOTte (ORCPT ); Mon, 15 Aug 2022 15:49:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91AFA72EE3; Mon, 15 Aug 2022 11:49: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 C98ECB810A2; Mon, 15 Aug 2022 18:49:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1EC13C433D7; Mon, 15 Aug 2022 18:49:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589390; bh=ev8eCZf7nG2UYA4LnbFQTNpzxmmKDb0z0eXAbIoA9Po=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q3F9mYkahY6QsODM9Z1HXds+xaWtMVfbiTJX1uIVKSD4dshiefHHdYViS7F8RSVFI 0siRjOda+dWG9rRSIpGSNCffEcYeNDvHbDmO83sMF6maDrUeYMaoMVlk/BLu5lUqPG VbF78yd/+gtphOyWijxB4HR/gx+ecHb7+Wi0dVRY= 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.15 704/779] scsi: lpfc: Remove extra atomic_inc on cmd_pending in queuecommand after VMID Date: Mon, 15 Aug 2022 20:05:48 +0200 Message-Id: <20220815180407.487035010@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 0948a9c5386095baae4012190a6b65aba684a907 ] VMID introduced an extra increment of cmd_pending, causing double-counting of the I/O. The normal increment ios performed in lpfc_get_scsi_buf. Link: https://lore.kernel.org/r/20220701211425.2708-5-jsmart2021@gmail.com Fixes: 33c79741deaf ("scsi: lpfc: vmid: Introduce VMID in I/O path") Cc: # v5.14+ Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/lpfc/lpfc_scsi.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index b43dfcb81185..7da8e4c845df 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -5707,7 +5707,6 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scs= i_cmnd *cmnd) cur_iocbq->cmd_flag |=3D LPFC_IO_VMID; } } - atomic_inc(&ndlp->cmd_pending); =20 #ifdef CONFIG_SCSI_LPFC_DEBUG_FS if (unlikely(phba->hdwqstat_on & LPFC_CHECK_SCSI_IO)) --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B48EC28B2B for ; Mon, 15 Aug 2022 19:51:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239899AbiHOTv5 (ORCPT ); Mon, 15 Aug 2022 15:51:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345339AbiHOTt6 (ORCPT ); Mon, 15 Aug 2022 15:49:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B946472EFB; Mon, 15 Aug 2022 11:49: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 03D8AB81057; Mon, 15 Aug 2022 18:49:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47DF2C433D6; Mon, 15 Aug 2022 18:49:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589393; bh=ideHvfhDE9wq+JxMMdoFAQuD3viIDQ424rCtYQY44JA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tJKHqfgUnDztxh4lJIhPIHmiJ0p2KRlkkMQKkDuzemuC0+zykc8OS3apibl67UEM3 F2BZlUF4x2pXORwCIia86EE8+B4xkYuPHNe4t6IxLdUM77ruQUVHDS7xx7NZHkmreD g1OBQvYgSvBim/FsxWo6vXDpMQH7nnQ/JtD00eF4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , stable , Alexander Shishkin , Sasha Levin Subject: [PATCH 5.15 705/779] intel_th: pci: Add Meteor Lake-P support Date: Mon, 15 Aug 2022 20:05:49 +0200 Message-Id: <20220815180407.540418544@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Shishkin [ Upstream commit 802a9a0b1d91274ef10d9fe429b4cc1e8c200aef ] Add support for the Trace Hub in Meteor Lake-P. Reviewed-by: Andy Shevchenko Cc: stable Signed-off-by: Alexander Shishkin Link: https://lore.kernel.org/r/20220705082637.59979-5-alexander.shishkin@l= inux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/hwtracing/intel_th/pci.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/hwtracing/intel_th/pci.c b/drivers/hwtracing/intel_th/= pci.c index fcd0aca75007..41a31c7f505f 100644 --- a/drivers/hwtracing/intel_th/pci.c +++ b/drivers/hwtracing/intel_th/pci.c @@ -284,6 +284,11 @@ static const struct pci_device_id intel_th_pci_id_tabl= e[] =3D { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x54a6), .driver_data =3D (kernel_ulong_t)&intel_th_2x, }, + { + /* Meteor Lake-P */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x7e24), + .driver_data =3D (kernel_ulong_t)&intel_th_2x, + }, { /* Alder Lake CPU */ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x466f), --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C490AC00140 for ; Mon, 15 Aug 2022 19:52:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233526AbiHOTwB (ORCPT ); Mon, 15 Aug 2022 15:52:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231167AbiHOTuR (ORCPT ); Mon, 15 Aug 2022 15:50:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9ED2373312; Mon, 15 Aug 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 2668DB810A1; Mon, 15 Aug 2022 18:49:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 589CCC433C1; Mon, 15 Aug 2022 18:49:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589396; bh=3bSndzRHGwDoEIiOezBILBR3x1ANK+Rt3C1uwr4VLqQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wuqn8AmPXAKrgf+c+KJofTDs0ezRNHfZU+wIoezd1PeY82hbgF5Snlz4oOnqa2j18 8sHXVt+EXX+qZEE3NDNLwOYV/eMkcPJ8/8QoTQVdf99/JkwKuTqyM9wkVZSM9/go8a IWw8qA/r6sM7jjJVuzvHl5Kf2uf/pnI2s22huEnU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , stable , Alexander Shishkin , Sasha Levin Subject: [PATCH 5.15 706/779] intel_th: pci: Add Raptor Lake-S PCH support Date: Mon, 15 Aug 2022 20:05:50 +0200 Message-Id: <20220815180407.591751767@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Shishkin [ Upstream commit 23e2de5826e2fc4dd43e08bab3a2ea1a5338b063 ] Add support for the Trace Hub in Raptor Lake-S PCH. Reviewed-by: Andy Shevchenko Cc: stable Signed-off-by: Alexander Shishkin Link: https://lore.kernel.org/r/20220705082637.59979-6-alexander.shishkin@l= inux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/hwtracing/intel_th/pci.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/hwtracing/intel_th/pci.c b/drivers/hwtracing/intel_th/= pci.c index 41a31c7f505f..5b6da26f1b63 100644 --- a/drivers/hwtracing/intel_th/pci.c +++ b/drivers/hwtracing/intel_th/pci.c @@ -289,6 +289,11 @@ static const struct pci_device_id intel_th_pci_id_tabl= e[] =3D { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x7e24), .driver_data =3D (kernel_ulong_t)&intel_th_2x, }, + { + /* Raptor Lake-S */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x7a26), + .driver_data =3D (kernel_ulong_t)&intel_th_2x, + }, { /* Alder Lake CPU */ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x466f), --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDCE7C00140 for ; Mon, 15 Aug 2022 19:52:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244302AbiHOTwH (ORCPT ); Mon, 15 Aug 2022 15:52:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345165AbiHOTum (ORCPT ); Mon, 15 Aug 2022 15:50: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 3AFC673325; Mon, 15 Aug 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 8A3B660C0B; Mon, 15 Aug 2022 18:50:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AF5FC433C1; Mon, 15 Aug 2022 18:49:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589399; bh=Ay0IweHselRBK0obV5DxogBP40yGNMeQhj7FwCdegvc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P8fV9hpmM+mw6NOoqFvCbrslLzTmPKjUT+4vNQPTHnbwpSBE7NSJFdDnLSJMwBFHM fIqqLDgEqOXs+dYJTo4iM0EdT8ZqMrE1LBF+YENP/RbMUZc2UsGg5jdOgoFlB5XRnx yGAjTN2xt+i43t4rC39PPc740XD3N76ZnLSxvxXg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , stable , Alexander Shishkin , Sasha Levin Subject: [PATCH 5.15 707/779] intel_th: pci: Add Raptor Lake-S CPU support Date: Mon, 15 Aug 2022 20:05:51 +0200 Message-Id: <20220815180407.642765913@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Shishkin [ Upstream commit ff46a601afc5a66a81c3945b83d0a2caeb88e8bc ] Add support for the Trace Hub in Raptor Lake-S CPU. Reviewed-by: Andy Shevchenko Cc: stable Signed-off-by: Alexander Shishkin Link: https://lore.kernel.org/r/20220705082637.59979-7-alexander.shishkin@l= inux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/hwtracing/intel_th/pci.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/hwtracing/intel_th/pci.c b/drivers/hwtracing/intel_th/= pci.c index 5b6da26f1b63..147d338c191e 100644 --- a/drivers/hwtracing/intel_th/pci.c +++ b/drivers/hwtracing/intel_th/pci.c @@ -294,6 +294,11 @@ static const struct pci_device_id intel_th_pci_id_tabl= e[] =3D { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x7a26), .driver_data =3D (kernel_ulong_t)&intel_th_2x, }, + { + /* Raptor Lake-S CPU */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa76f), + .driver_data =3D (kernel_ulong_t)&intel_th_2x, + }, { /* Alder Lake CPU */ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x466f), --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B223EC00140 for ; Mon, 15 Aug 2022 19:52:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233416AbiHOTwN (ORCPT ); Mon, 15 Aug 2022 15:52:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345452AbiHOTvM (ORCPT ); Mon, 15 Aug 2022 15:51: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 4038073917; Mon, 15 Aug 2022 11:50: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 4D8F3B810A0; Mon, 15 Aug 2022 18:50:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95244C433D6; Mon, 15 Aug 2022 18:50:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589403; bh=0e3KF+qI57KTHNycoInlGErLM+dGABZAMKRt2dMdo/g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cp7X1vCdSnXv5QvN/ALGJkyrGKbblh7Xsn7vYgE0zMlZgQ0l08MGeAkcSejmYLnyl XzBVQ3m44U4uRIdZwtwbLa184syEi8u4I8sJ4AOvjYvtbJeSnem8LGzc3Um37T1Tpo qabqLe2uG1YAlRhOnQdoJSqL2I/iUVD9UzY8ZXMQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lev Kujawski , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.15 708/779] KVM: set_msr_mce: Permit guests to ignore single-bit ECC errors Date: Mon, 15 Aug 2022 20:05:52 +0200 Message-Id: <20220815180407.691309003@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lev Kujawski [ Upstream commit 0471a7bd1bca2a47a5f378f2222c5cf39ce94152 ] Certain guest operating systems (e.g., UNIXWARE) clear bit 0 of MC1_CTL to ignore single-bit ECC data errors. Single-bit ECC data errors are always correctable and thus are safe to ignore because they are informational in nature rather than signaling a loss of data integrity. Prior to this patch, these guests would crash upon writing MC1_CTL, with resultant error messages like the following: error: kvm run failed Operation not permitted EAX=3Dfffffffe EBX=3Dfffffffe ECX=3D00000404 EDX=3Dffffffff ESI=3Dffffffff EDI=3D00000001 EBP=3Dfffdaba4 ESP=3Dfffdab20 EIP=3Dc01333a5 EFL=3D00000246 [---Z-P-] CPL=3D0 II=3D0 A20=3D1 SMM=3D0 HLT= =3D0 ES =3D0108 00000000 ffffffff 00c09300 DPL=3D0 DS [-WA] CS =3D0100 00000000 ffffffff 00c09b00 DPL=3D0 CS32 [-RA] SS =3D0108 00000000 ffffffff 00c09300 DPL=3D0 DS [-WA] DS =3D0108 00000000 ffffffff 00c09300 DPL=3D0 DS [-WA] FS =3D0000 00000000 ffffffff 00c00000 GS =3D0000 00000000 ffffffff 00c00000 LDT=3D0118 c1026390 00000047 00008200 DPL=3D0 LDT TR =3D0110 ffff5af0 00000067 00008b00 DPL=3D0 TSS32-busy GDT=3D ffff5020 000002cf IDT=3D ffff52f0 000007ff CR0=3D8001003b CR2=3D00000000 CR3=3D0100a000 CR4=3D00000230 DR0=3D00000000 DR1=3D00000000 DR2=3D00000000 DR3=3D00000000 DR6=3Dffff0ff0 DR7=3D00000400 EFER=3D0000000000000000 Code=3D08 89 01 89 51 04 c3 8b 4c 24 08 8b 01 8b 51 04 8b 4c 24 04 <0f> 30 c3 f7 05 a4 6d ff ff 10 00 00 00 74 03 0f 31 c3 33 c0 33 d2 c3 8d 74 26 00 0f 31 c3 Signed-off-by: Lev Kujawski Message-Id: <20220521081511.187388-1-lkujaw@member.fsf.org> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/x86/kvm/x86.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 24875dc87b13..dac2892d095c 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -3102,10 +3102,13 @@ static int set_msr_mce(struct kvm_vcpu *vcpu, struc= t msr_data *msr_info) /* only 0 or all 1s can be written to IA32_MCi_CTL * some Linux kernels though clear bit 10 in bank 4 to * workaround a BIOS/GART TBL issue on AMD K8s, ignore - * this to avoid an uncatched #GP in the guest + * this to avoid an uncatched #GP in the guest. + * + * UNIXWARE clears bit 0 of MC1_CTL to ignore + * correctable, single-bit ECC data errors. */ if ((offset & 0x3) =3D=3D 0 && - data !=3D 0 && (data | (1 << 10)) !=3D ~(u64)0) + data !=3D 0 && (data | (1 << 10) | 1) !=3D ~(u64)0) return -1; =20 /* MCi_STATUS */ --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF47AC25B08 for ; Mon, 15 Aug 2022 19:52:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240837AbiHOTwS (ORCPT ); Mon, 15 Aug 2022 15:52:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345447AbiHOTvM (ORCPT ); Mon, 15 Aug 2022 15:51:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99E0B73920; Mon, 15 Aug 2022 11:50: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 9EAB260C0B; Mon, 15 Aug 2022 18:50:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C782C433D7; Mon, 15 Aug 2022 18:50:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589406; bh=8XzudxK/GSx4m9rQfdc62GIvbtc4ybw1doK19hUJQ7I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UEji6HJ04i5hCnlTUfexXbGMQ2b/3Je23muWXSlyGNiAP3cyh4KJgZ7wdGJxMW0Ar XL4LWYOA1mN4vQA2+faIzNsrl7alMY/XSiwLzECoWLOm5hFD8DiT2F/4kaRiEVACe8 cg7xHZ39AOYpl+GjC18QEupdGyV6yb3e7qcvYLzg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Jim Mattson , Sasha Levin Subject: [PATCH 5.15 709/779] KVM: x86: Signal #GP, not -EPERM, on bad WRMSR(MCi_CTL/STATUS) Date: Mon, 15 Aug 2022 20:05:53 +0200 Message-Id: <20220815180407.739335099@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson [ Upstream commit 2368048bf5c2ec4b604ac3431564071e89a0bc71 ] Return '1', not '-1', when handling an illegal WRMSR to a MCi_CTL or MCi_STATUS MSR. The behavior of "all zeros' or "all ones" for CTL MSRs is architectural, as is the "only zeros" behavior for STATUS MSRs. I.e. the intent is to inject a #GP, not exit to userspace due to an unhandled emulation case. Returning '-1' gets interpreted as -EPERM up the stack and effecitvely kills the guest. Fixes: 890ca9aefa78 ("KVM: Add MCE support") Fixes: 9ffd986c6e4e ("KVM: X86: #GP when guest attempts to write MCi_STATUS= register w/o 0") Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson Reviewed-by: Jim Mattson Link: https://lore.kernel.org/r/20220512222716.4112548-2-seanjc@google.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/x86/kvm/x86.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index dac2892d095c..f5b7a05530eb 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -3109,13 +3109,13 @@ static int set_msr_mce(struct kvm_vcpu *vcpu, struc= t msr_data *msr_info) */ if ((offset & 0x3) =3D=3D 0 && data !=3D 0 && (data | (1 << 10) | 1) !=3D ~(u64)0) - return -1; + return 1; =20 /* MCi_STATUS */ if (!msr_info->host_initiated && (offset & 0x3) =3D=3D 1 && data !=3D 0) { if (!can_set_mci_status(vcpu)) - return -1; + return 1; } =20 vcpu->arch.mce_banks[offset] =3D data; --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EA3AC00140 for ; Mon, 15 Aug 2022 19:52:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229457AbiHOTwc (ORCPT ); Mon, 15 Aug 2022 15:52:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345485AbiHOTvP (ORCPT ); Mon, 15 Aug 2022 15:51:15 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFF927393A; Mon, 15 Aug 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 dfw.source.kernel.org (Postfix) with ESMTPS id 7630B61222; Mon, 15 Aug 2022 18:50:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81843C43140; Mon, 15 Aug 2022 18:50:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589408; bh=Pd14DUx2djKqDmo7dFo2PzHYQKAi5IQau5aRLPoz2w8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZwN4no2BE7DBhKBz4Kn0vHtThVcz2ZhboX/xEOPRVgA+aPepij/y5OOftF0Gjttki Bt4ftA0cLmu1Dwwz4fKwVAd3kmH6SVC7uzSAiHsbh9c6WQxc66C7QfrXcJel+gTmQH cuL/TWAMX2bZLqL4pgum4TTuFkKG6Z/UQ5m+sXSc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Alexander Lobakin , Andy Shevchenko , Lu Baolu , Yury Norov , Sasha Levin Subject: [PATCH 5.15 710/779] iommu/vt-d: avoid invalid memory access via node_online(NUMA_NO_NODE) Date: Mon, 15 Aug 2022 20:05:54 +0200 Message-Id: <20220815180407.789363254@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Lobakin [ Upstream commit b0b0b77ea611e3088e9523e60860f4f41b62b235 ] KASAN reports: [ 4.668325][ T0] BUG: KASAN: wild-memory-access in dmar_parse_one_rhsa (arc= h/x86/include/asm/bitops.h:214 arch/x86/include/asm/bitops.h:226 include/as= m-generic/bitops/instrumented-non-atomic.h:142 include/linux/nodemask.h:415= drivers/iommu/intel/dmar.c:497) [ 4.676149][ T0] Read of size 8 at addr 1fffffff85115558 by task swap= per/0/0 [ 4.683454][ T0] [ 4.685638][ T0] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.19.0-rc3= -00004-g0e862838f290 #1 [ 4.694331][ T0] Hardware name: Supermicro SYS-5018D-FN4T/X10SDV-8C-T= LN4F, BIOS 1.1 03/02/2016 [ 4.703196][ T0] Call Trace: [ 4.706334][ T0] [ 4.709133][ T0] ? dmar_parse_one_rhsa (arch/x86/include/asm/bitops.h:214 a= rch/x86/include/asm/bitops.h:226 include/asm-generic/bitops/instrumented-no= n-atomic.h:142 include/linux/nodemask.h:415 drivers/iommu/intel/dmar.c:497) after converting the type of the first argument (@nr, bit number) of arch_test_bit() from `long` to `unsigned long`[0]. Under certain conditions (for example, when ACPI NUMA is disabled via command line), pxm_to_node() can return %NUMA_NO_NODE (-1). It is valid 'magic' number of NUMA node, but not valid bit number to use in bitops. node_online() eventually descends to test_bit() without checking for the input, assuming it's on caller side (which might be good for perf-critical tasks). There, -1 becomes %ULONG_MAX which leads to an insane array index when calculating bit position in memory. For now, add an explicit check for @node being not %NUMA_NO_NODE before calling test_bit(). The actual logics didn't change here at all. [0] https://github.com/norov/linux/commit/0e862838f290147ea9c16db852d8d494b= 552d38d Fixes: ee34b32d8c29 ("dmar: support for parsing Remapping Hardware Static A= ffinity structure") Cc: stable@vger.kernel.org # 2.6.33+ Reported-by: kernel test robot Signed-off-by: Alexander Lobakin Reviewed-by: Andy Shevchenko Reviewed-by: Lu Baolu Signed-off-by: Yury Norov Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/iommu/intel/dmar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iommu/intel/dmar.c b/drivers/iommu/intel/dmar.c index 3d9cb711e87b..f026bd269cb0 100644 --- a/drivers/iommu/intel/dmar.c +++ b/drivers/iommu/intel/dmar.c @@ -497,7 +497,7 @@ static int dmar_parse_one_rhsa(struct acpi_dmar_header = *header, void *arg) if (drhd->reg_base_addr =3D=3D rhsa->base_address) { int node =3D pxm_to_node(rhsa->proximity_domain); =20 - if (!node_online(node)) + if (node !=3D NUMA_NO_NODE && !node_online(node)) node =3D NUMA_NO_NODE; drhd->iommu->node =3D node; return 0; --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB846C00140 for ; Mon, 15 Aug 2022 19:52:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345389AbiHOTwi (ORCPT ); Mon, 15 Aug 2022 15:52:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345505AbiHOTvR (ORCPT ); Mon, 15 Aug 2022 15:51:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF6F874355; Mon, 15 Aug 2022 11:50: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 AB05861124; Mon, 15 Aug 2022 18:50:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 957DBC433D6; Mon, 15 Aug 2022 18:50:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589412; bh=wIP0tre4XAdIXUpGoEeyoIt7D31dame4Q6q1eC3tl/c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JX5UI19fvviiDB9GR0YCuLoxN4TUS6N22kF35qr3ACQ/timEJlYY1s0mcH+bXBFDY HNqgWcxikuhYEpx6LQBTGpBVnXXo3PQ7nbDO+Ni0Sbc86GeHm4fG2aS52G8o7g2xAT +II/CVk9OR/fxpQ+sM6XUOzwZrMGM0/VoiVLRBy8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Meeta Saggi , Mohamed Khalfella , Bjorn Helgaas , Eric Badger , Sasha Levin Subject: [PATCH 5.15 711/779] PCI/AER: Iterate over error counters instead of error strings Date: Mon, 15 Aug 2022 20:05:55 +0200 Message-Id: <20220815180407.830078370@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mohamed Khalfella [ Upstream commit 5e6ae050955b566484f3cc6a66e3925eae87a0ed ] Previously we iterated over AER stat *names*, e.g., aer_correctable_error_string[32], but the actual stat *counters* may not be that large, e.g., pdev->aer_stats->dev_cor_errs[16], which means that we printed junk in the sysfs stats files. Iterate over the stat counter arrays instead of the names to avoid this junk. Also, added a build time check to make sure all counters have entries in strings array. Fixes: 0678e3109a3c ("PCI/AER: Simplify __aer_print_error()") Link: https://lore.kernel.org/r/20220509181441.31884-1-mkhalfella@purestora= ge.com Reported-by: Meeta Saggi Signed-off-by: Mohamed Khalfella Signed-off-by: Bjorn Helgaas Reviewed-by: Meeta Saggi Reviewed-by: Eric Badger Cc: stable@vger.kernel.org Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/pci/pcie/aer.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index 80fe3e83c9f5..ca9ac8c6a202 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -538,7 +538,7 @@ static const char *aer_agent_string[] =3D { u64 *stats =3D pdev->aer_stats->stats_array; \ size_t len =3D 0; \ \ - for (i =3D 0; i < ARRAY_SIZE(strings_array); i++) { \ + for (i =3D 0; i < ARRAY_SIZE(pdev->aer_stats->stats_array); i++) {\ if (strings_array[i]) \ len +=3D sysfs_emit_at(buf, len, "%s %llu\n", \ strings_array[i], \ @@ -1347,6 +1347,11 @@ static int aer_probe(struct pcie_device *dev) struct device *device =3D &dev->device; struct pci_dev *port =3D dev->port; =20 + BUILD_BUG_ON(ARRAY_SIZE(aer_correctable_error_string) < + AER_MAX_TYPEOF_COR_ERRS); + BUILD_BUG_ON(ARRAY_SIZE(aer_uncorrectable_error_string) < + AER_MAX_TYPEOF_UNCOR_ERRS); + /* Limit to Root Ports or Root Complex Event Collectors */ if ((pci_pcie_type(port) !=3D PCI_EXP_TYPE_RC_EC) && (pci_pcie_type(port) !=3D PCI_EXP_TYPE_ROOT_PORT)) --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F23E9C00140 for ; Mon, 15 Aug 2022 19:52:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231509AbiHOTwo (ORCPT ); Mon, 15 Aug 2022 15:52:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345562AbiHOTvX (ORCPT ); Mon, 15 Aug 2022 15:51: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 1A41CBF5; Mon, 15 Aug 2022 11:50: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 75E58B81057; Mon, 15 Aug 2022 18:50:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BDC2FC433C1; Mon, 15 Aug 2022 18:50:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589415; bh=Sb91+bbitPA5w9k3+HZtSANwboT+0M5/j4bRBi8RhoQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WA6Mh1npD36e4cVzuve7Q38Wcl2oTcxYxF755izG86Qd8vcMmmVhFezt8RyKTWxIo wVvruduyhrbW0ZkXcPrhtcI/4sWY6kk2CuAgGbgJ5J2N73ZbtPPcUiK4B/dvzEDPS/ qP1tiVx7cHBVmSNVUCFqqa6Ts16PIq3h9mb2cHgQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Marko , Bjorn Helgaas , Dmitry Baryshkov , Sasha Levin Subject: [PATCH 5.15 712/779] PCI: qcom: Power on PHY before IPQ8074 DBI register accesses Date: Mon, 15 Aug 2022 20:05:56 +0200 Message-Id: <20220815180407.880522922@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Robert Marko [ Upstream commit a0e43bb9973b06ce5c666f0901e104e2037c1b34 ] Currently the Gen2 port in IPQ8074 will cause the system to hang as it accesses DBI registers in qcom_pcie_init_2_3_3(), and those are only accesible after phy_power_on(). Move the DBI read/writes to a new qcom_pcie_post_init_2_3_3(), which is executed after phy_power_on(). Link: https://lore.kernel.org/r/20220623155004.688090-1-robimarko@gmail.com Fixes: a0fd361db8e5 ("PCI: dwc: Move "dbi", "dbi2", and "addr_space" resour= ce setup into common code") Signed-off-by: Robert Marko Signed-off-by: Bjorn Helgaas Reviewed-by: Dmitry Baryshkov Cc: stable@vger.kernel.org # v5.11+ Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/pci/controller/dwc/pcie-qcom.c | 48 +++++++++++++++----------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controlle= r/dwc/pcie-qcom.c index 45210c6380b1..4c599699e3c8 100644 --- a/drivers/pci/controller/dwc/pcie-qcom.c +++ b/drivers/pci/controller/dwc/pcie-qcom.c @@ -1024,9 +1024,7 @@ static int qcom_pcie_init_2_3_3(struct qcom_pcie *pci= e) struct qcom_pcie_resources_2_3_3 *res =3D &pcie->res.v2_3_3; struct dw_pcie *pci =3D pcie->pci; struct device *dev =3D pci->dev; - u16 offset =3D dw_pcie_find_capability(pci, PCI_CAP_ID_EXP); int i, ret; - u32 val; =20 for (i =3D 0; i < ARRAY_SIZE(res->rst); i++) { ret =3D reset_control_assert(res->rst[i]); @@ -1083,6 +1081,33 @@ static int qcom_pcie_init_2_3_3(struct qcom_pcie *pc= ie) goto err_clk_aux; } =20 + return 0; + +err_clk_aux: + clk_disable_unprepare(res->ahb_clk); +err_clk_ahb: + clk_disable_unprepare(res->axi_s_clk); +err_clk_axi_s: + clk_disable_unprepare(res->axi_m_clk); +err_clk_axi_m: + clk_disable_unprepare(res->iface); +err_clk_iface: + /* + * Not checking for failure, will anyway return + * the original failure in 'ret'. + */ + for (i =3D 0; i < ARRAY_SIZE(res->rst); i++) + reset_control_assert(res->rst[i]); + + return ret; +} + +static int qcom_pcie_post_init_2_3_3(struct qcom_pcie *pcie) +{ + struct dw_pcie *pci =3D pcie->pci; + u16 offset =3D dw_pcie_find_capability(pci, PCI_CAP_ID_EXP); + u32 val; + writel(SLV_ADDR_SPACE_SZ, pcie->parf + PCIE20_v3_PARF_SLV_ADDR_SPACE_SIZE); =20 @@ -1110,24 +1135,6 @@ static int qcom_pcie_init_2_3_3(struct qcom_pcie *pc= ie) PCI_EXP_DEVCTL2); =20 return 0; - -err_clk_aux: - clk_disable_unprepare(res->ahb_clk); -err_clk_ahb: - clk_disable_unprepare(res->axi_s_clk); -err_clk_axi_s: - clk_disable_unprepare(res->axi_m_clk); -err_clk_axi_m: - clk_disable_unprepare(res->iface); -err_clk_iface: - /* - * Not checking for failure, will anyway return - * the original failure in 'ret'. - */ - for (i =3D 0; i < ARRAY_SIZE(res->rst); i++) - reset_control_assert(res->rst[i]); - - return ret; } =20 static int qcom_pcie_get_resources_2_7_0(struct qcom_pcie *pcie) @@ -1423,6 +1430,7 @@ static const struct qcom_pcie_ops ops_2_4_0 =3D { static const struct qcom_pcie_ops ops_2_3_3 =3D { .get_resources =3D qcom_pcie_get_resources_2_3_3, .init =3D qcom_pcie_init_2_3_3, + .post_init =3D qcom_pcie_post_init_2_3_3, .deinit =3D qcom_pcie_deinit_2_3_3, .ltssm_enable =3D qcom_pcie_2_3_2_ltssm_enable, }; --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E282C2BB41 for ; Tue, 16 Aug 2022 09:40:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233842AbiHPJkD (ORCPT ); Tue, 16 Aug 2022 05:40:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233769AbiHPJja (ORCPT ); Tue, 16 Aug 2022 05:39: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 34E9F1365F8; Tue, 16 Aug 2022 01:28: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 9116F611F2; Tue, 16 Aug 2022 08:28:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94A48C433C1; Tue, 16 Aug 2022 08:28:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660638492; bh=kn/cDzx5wgLfYQgDaZMLwVmKJJDcenaMUgsJ7D0lmXg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OWKY8C2GcbgTNqhHhuZhYFir9funE6n/P4pENhoRIJd/oAk2M+cpmYlGh0tHRvzur LNzpuaA/0+J6Y2PrMjqHHO+lWiRWkJpjGm2beJvCpG4rKjlahzhyrAo8/NN2UijSLV +P15i/QlyobPuje8dvZKtv3dlGcUxhsbo4euUq2k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , Sasha Levin Subject: [PATCH 5.15 713/779] serial: 8250_pci: Refactor the loop in pci_ite887x_init() Date: Mon, 15 Aug 2022 20:05:57 +0200 Message-Id: <20220815180407.929169761@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andy Shevchenko [ Upstream commit 35b4f17231923e2f64521bdf7a2793ce2c3c74a6 ] The loop can be refactored by using ARRAY_SIZE() instead of NULL terminator. This reduces code base and makes it easier to read and understand. Signed-off-by: Andy Shevchenko Reviewed-by: Jiri Slaby Link: https://lore.kernel.org/r/20211022135147.70965-1-andriy.shevchenko@li= nux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/tty/serial/8250/8250_pci.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8= 250_pci.c index e7b9805903f4..ef44e5320bef 100644 --- a/drivers/tty/serial/8250/8250_pci.c +++ b/drivers/tty/serial/8250/8250_pci.c @@ -897,18 +897,16 @@ static int pci_netmos_init(struct pci_dev *dev) /* enable IO_Space bit */ #define ITE_887x_POSIO_ENABLE (1 << 31) =20 +/* inta_addr are the configuration addresses of the ITE */ +static const short inta_addr[] =3D { 0x2a0, 0x2c0, 0x220, 0x240, 0x1e0, 0x= 200, 0x280 }; static int pci_ite887x_init(struct pci_dev *dev) { - /* inta_addr are the configuration addresses of the ITE */ - static const short inta_addr[] =3D { 0x2a0, 0x2c0, 0x220, 0x240, 0x1e0, - 0x200, 0x280, 0 }; int ret, i, type; struct resource *iobase =3D NULL; u32 miscr, uartbar, ioport; =20 /* search for the base-ioport */ - i =3D 0; - while (inta_addr[i] && iobase =3D=3D NULL) { + for (i =3D 0; i < ARRAY_SIZE(inta_addr); i++) { iobase =3D request_region(inta_addr[i], ITE_887x_IOSIZE, "ite887x"); if (iobase !=3D NULL) { @@ -925,12 +923,10 @@ static int pci_ite887x_init(struct pci_dev *dev) break; } release_region(iobase->start, ITE_887x_IOSIZE); - iobase =3D NULL; } - i++; } =20 - if (!inta_addr[i]) { + if (i =3D=3D ARRAY_SIZE(inta_addr)) { dev_err(&dev->dev, "ite887x: could not find iobase\n"); return -ENODEV; } --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D5EAC32771 for ; Tue, 16 Aug 2022 10:12:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234369AbiHPKMA (ORCPT ); Tue, 16 Aug 2022 06:12:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234188AbiHPKLa (ORCPT ); Tue, 16 Aug 2022 06: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 59AB21372B2; Tue, 16 Aug 2022 01:28: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 BFF23611A1; Tue, 16 Aug 2022 08:28:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B49AC433C1; Tue, 16 Aug 2022 08:28:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660638495; bh=EmPoDDOrmxZizY34vsnNzHSlCf7i+dCyUot8tQaZBjg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XI95BQPQh6RpNOD0Bs5nBCKpR0pqBZQyYCa18uzfz70pZq9O8PW9cn03ovIHTj4ng ii6Kz+lUG0CJw2+CRc5WpRLz7qBWPpBcyBevINsmGrdrrhhN0vD3wbVFsLBklQDSx3 wvCfPENpwGeattgqY45/ARnmvoK+l2XG3HTBrS+A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Shevchenko , Sasha Levin Subject: [PATCH 5.15 714/779] serial: 8250_pci: Replace dev_*() by pci_*() macros Date: Mon, 15 Aug 2022 20:05:58 +0200 Message-Id: <20220815180407.976919968@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andy Shevchenko [ Upstream commit 1177384179416c7136e1348f07609e0da1ae6b91 ] PCI subsystem provides convenient shortcut macros for message printing. Use those macros instead of dev_*(). Signed-off-by: Andy Shevchenko Reviewed-by: Jiri Slaby Link: https://lore.kernel.org/r/20211022135147.70965-3-andriy.shevchenko@li= nux.intel.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/tty/serial/8250/8250_pci.c | 52 +++++++++++++----------------- 1 file changed, 22 insertions(+), 30 deletions(-) diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8= 250_pci.c index ef44e5320bef..1994d2db213c 100644 --- a/drivers/tty/serial/8250/8250_pci.c +++ b/drivers/tty/serial/8250/8250_pci.c @@ -75,13 +75,12 @@ static int pci_default_setup(struct serial_private*, =20 static void moan_device(const char *str, struct pci_dev *dev) { - dev_err(&dev->dev, - "%s: %s\n" + pci_err(dev, "%s\n" "Please send the output of lspci -vv, this\n" "message (0x%04x,0x%04x,0x%04x,0x%04x), the\n" "manufacturer and name of serial board or\n" "modem board to .\n", - pci_name(dev), str, dev->vendor, dev->device, + str, dev->vendor, dev->device, dev->subsystem_vendor, dev->subsystem_device); } =20 @@ -238,7 +237,7 @@ static int pci_inteli960ni_init(struct pci_dev *dev) /* is firmware started? */ pci_read_config_dword(dev, 0x44, &oldval); if (oldval =3D=3D 0x00001000L) { /* RESET value */ - dev_dbg(&dev->dev, "Local i960 firmware missing\n"); + pci_dbg(dev, "Local i960 firmware missing\n"); return -ENODEV; } return 0; @@ -588,9 +587,8 @@ static int pci_timedia_probe(struct pci_dev *dev) * (0,2,3,5,6: serial only -- 7,8,9: serial + parallel) */ if ((dev->subsystem_device & 0x00f0) >=3D 0x70) { - dev_info(&dev->dev, - "ignoring Timedia subdevice %04x for parport_serial\n", - dev->subsystem_device); + pci_info(dev, "ignoring Timedia subdevice %04x for parport_serial\n", + dev->subsystem_device); return -ENODEV; } =20 @@ -827,8 +825,7 @@ static int pci_netmos_9900_numports(struct pci_dev *dev) if (sub_serports > 0) return sub_serports; =20 - dev_err(&dev->dev, - "NetMos/Mostech serial driver ignoring port on ambiguous config.\n"); + pci_err(dev, "NetMos/Mostech serial driver ignoring port on ambiguous co= nfig.\n"); return 0; } =20 @@ -927,7 +924,7 @@ static int pci_ite887x_init(struct pci_dev *dev) } =20 if (i =3D=3D ARRAY_SIZE(inta_addr)) { - dev_err(&dev->dev, "ite887x: could not find iobase\n"); + pci_err(dev, "could not find iobase\n"); return -ENODEV; } =20 @@ -1022,9 +1019,7 @@ static int pci_endrun_init(struct pci_dev *dev) /* EndRun device */ if (deviceID =3D=3D 0x07000200) { number_uarts =3D ioread8(p + 4); - dev_dbg(&dev->dev, - "%d ports detected on EndRun PCI Express device\n", - number_uarts); + pci_dbg(dev, "%d ports detected on EndRun PCI Express device\n", number_= uarts); } pci_iounmap(dev, p); return number_uarts; @@ -1054,9 +1049,7 @@ static int pci_oxsemi_tornado_init(struct pci_dev *de= v) /* Tornado device */ if (deviceID =3D=3D 0x07000200) { number_uarts =3D ioread8(p + 4); - dev_dbg(&dev->dev, - "%d ports detected on Oxford PCI Express device\n", - number_uarts); + pci_dbg(dev, "%d ports detected on Oxford PCI Express device\n", number_= uarts); } pci_iounmap(dev, p); return number_uarts; @@ -1116,15 +1109,15 @@ static struct quatech_feature quatech_cards[] =3D { { 0, } }; =20 -static int pci_quatech_amcc(u16 devid) +static int pci_quatech_amcc(struct pci_dev *dev) { struct quatech_feature *qf =3D &quatech_cards[0]; while (qf->devid) { - if (qf->devid =3D=3D devid) + if (qf->devid =3D=3D dev->device) return qf->amcc; qf++; } - pr_err("quatech: unknown port type '0x%04X'.\n", devid); + pci_err(dev, "unknown port type '0x%04X'.\n", dev->device); return 0; }; =20 @@ -1287,7 +1280,7 @@ static int pci_quatech_rs422(struct uart_8250_port *p= ort) =20 static int pci_quatech_init(struct pci_dev *dev) { - if (pci_quatech_amcc(dev->device)) { + if (pci_quatech_amcc(dev)) { unsigned long base =3D pci_resource_start(dev, 0); if (base) { u32 tmp; @@ -1311,7 +1304,7 @@ static int pci_quatech_setup(struct serial_private *p= riv, port->port.uartclk =3D pci_quatech_clock(port); /* For now just warn about RS422 */ if (pci_quatech_rs422(port)) - pr_warn("quatech: software control of RS422 features not currently suppo= rted.\n"); + pci_warn(priv->dev, "software control of RS422 features not currently su= pported.\n"); return pci_default_setup(priv, board, port, idx); } =20 @@ -1525,7 +1518,7 @@ static int pci_fintek_setup(struct serial_private *pr= iv, /* Get the io address from configuration space */ pci_read_config_word(pdev, config_base + 4, &iobase); =20 - dev_dbg(&pdev->dev, "%s: idx=3D%d iobase=3D0x%x", __func__, idx, iobase); + pci_dbg(pdev, "idx=3D%d iobase=3D0x%x", idx, iobase); =20 port->port.iotype =3D UPIO_PORT; port->port.iobase =3D iobase; @@ -1689,7 +1682,7 @@ static int skip_tx_en_setup(struct serial_private *pr= iv, struct uart_8250_port *port, int idx) { port->port.quirks |=3D UPQ_NO_TXEN_TEST; - dev_dbg(&priv->dev->dev, + pci_dbg(priv->dev, "serial8250: skipping TxEn test for device [%04x:%04x] subsystem [%04x:%= 04x]\n", priv->dev->vendor, priv->dev->device, priv->dev->subsystem_vendor, priv->dev->subsystem_device); @@ -4007,12 +4000,12 @@ pciserial_init_ports(struct pci_dev *dev, const str= uct pciserial_board *board) uart.port.irq =3D 0; } else { if (pci_match_id(pci_use_msi, dev)) { - dev_dbg(&dev->dev, "Using MSI(-X) interrupts\n"); + pci_dbg(dev, "Using MSI(-X) interrupts\n"); pci_set_master(dev); uart.port.flags &=3D ~UPF_SHARE_IRQ; rc =3D pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_ALL_TYPES); } else { - dev_dbg(&dev->dev, "Using legacy interrupts\n"); + pci_dbg(dev, "Using legacy interrupts\n"); rc =3D pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_LEGACY); } if (rc < 0) { @@ -4030,12 +4023,12 @@ pciserial_init_ports(struct pci_dev *dev, const str= uct pciserial_board *board) if (quirk->setup(priv, board, &uart, i)) break; =20 - dev_dbg(&dev->dev, "Setup PCI port: port %lx, irq %d, type %d\n", + pci_dbg(dev, "Setup PCI port: port %lx, irq %d, type %d\n", uart.port.iobase, uart.port.irq, uart.port.iotype); =20 priv->line[i] =3D serial8250_register_8250_port(&uart); if (priv->line[i] < 0) { - dev_err(&dev->dev, + pci_err(dev, "Couldn't register serial port %lx, irq %d, type %d, error %d\n", uart.port.iobase, uart.port.irq, uart.port.iotype, priv->line[i]); @@ -4131,8 +4124,7 @@ pciserial_init_one(struct pci_dev *dev, const struct = pci_device_id *ent) } =20 if (ent->driver_data >=3D ARRAY_SIZE(pci_boards)) { - dev_err(&dev->dev, "invalid driver_data: %ld\n", - ent->driver_data); + pci_err(dev, "invalid driver_data: %ld\n", ent->driver_data); return -EINVAL; } =20 @@ -4215,7 +4207,7 @@ static int pciserial_resume_one(struct device *dev) err =3D pci_enable_device(pdev); /* FIXME: We cannot simply error out here */ if (err) - dev_err(dev, "Unable to re-enable ports, trying to continue.\n"); + pci_err(pdev, "Unable to re-enable ports, trying to continue.\n"); pciserial_resume_ports(priv); } return 0; --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45E24C00140 for ; Mon, 15 Aug 2022 19:52:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345427AbiHOTwz (ORCPT ); Mon, 15 Aug 2022 15:52:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345696AbiHOTvj (ORCPT ); Mon, 15 Aug 2022 15:51: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 8BCE613E8E; Mon, 15 Aug 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 dfw.source.kernel.org (Postfix) with ESMTPS id 6D65C61222; Mon, 15 Aug 2022 18:50:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 723FBC433C1; Mon, 15 Aug 2022 18:50:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589430; bh=c0bClNS72sNAo2pxTQ9SWVynqPIMMbNhfPr2VEzrvv4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mSiOT0GJKaUS9rwianyWuNUa5EDDgGQzdKM60uTwWXd+1JvblyGmqKxqAch1KZrCV rA/xY8OUkDgAGFSEWHckkMaCZJPgnl3gNnbLp8ahDXJ4VZFWCzy9hvm7HZICRI6P5F VwveTMA5d+vvwM9ASJ30hHUV+/DAvbkQZOQYtXRg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Maciej W. Rozycki" , Andy Shevchenko , Sasha Levin Subject: [PATCH 5.15 715/779] serial: 8250: Fold EndRun device support into OxSemi Tornado code Date: Mon, 15 Aug 2022 20:05:59 +0200 Message-Id: <20220815180408.028001214@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maciej W. Rozycki [ Upstream commit 1f32c65bad24b9787d3e52843de375430e3df822 ] The EndRun PTP/1588 dual serial port device is based on the Oxford Semiconductor OXPCIe952 UART device with the PCI vendor:device ID set for EndRun Technologies and uses the same sequence to determine the number of ports available. Despite that we have duplicate code specific to the EndRun device. Remove redundant code then and factor out OxSemi Tornado device detection. Signed-off-by: Maciej W. Rozycki Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/alpine.DEB.2.21.2204181516220.9383@angie.or= cam.me.uk Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/tty/serial/8250/8250_pci.c | 76 ++++++++++-------------------- 1 file changed, 25 insertions(+), 51 deletions(-) diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8= 250_pci.c index 1994d2db213c..20ce812a069c 100644 --- a/drivers/tty/serial/8250/8250_pci.c +++ b/drivers/tty/serial/8250/8250_pci.c @@ -994,41 +994,29 @@ static void pci_ite887x_exit(struct pci_dev *dev) } =20 /* - * EndRun Technologies. - * Determine the number of ports available on the device. + * Oxford Semiconductor Inc. + * Check if an OxSemi device is part of the Tornado range of devices. */ #define PCI_VENDOR_ID_ENDRUN 0x7401 #define PCI_DEVICE_ID_ENDRUN_1588 0xe100 =20 -static int pci_endrun_init(struct pci_dev *dev) +static bool pci_oxsemi_tornado_p(struct pci_dev *dev) { - u8 __iomem *p; - unsigned long deviceID; - unsigned int number_uarts =3D 0; + /* OxSemi Tornado devices are all 0xCxxx */ + if (dev->vendor =3D=3D PCI_VENDOR_ID_OXSEMI && + (dev->device & 0xf000) !=3D 0xc000) + return false; =20 - /* EndRun device is all 0xexxx */ + /* EndRun devices are all 0xExxx */ if (dev->vendor =3D=3D PCI_VENDOR_ID_ENDRUN && - (dev->device & 0xf000) !=3D 0xe000) - return 0; - - p =3D pci_iomap(dev, 0, 5); - if (p =3D=3D NULL) - return -ENOMEM; + (dev->device & 0xf000) !=3D 0xe000) + return false; =20 - deviceID =3D ioread32(p); - /* EndRun device */ - if (deviceID =3D=3D 0x07000200) { - number_uarts =3D ioread8(p + 4); - pci_dbg(dev, "%d ports detected on EndRun PCI Express device\n", number_= uarts); - } - pci_iounmap(dev, p); - return number_uarts; + return true; } =20 /* - * Oxford Semiconductor Inc. - * Check that device is part of the Tornado range of devices, then determi= ne - * the number of ports available on the device. + * Determine the number of ports available on a Tornado device. */ static int pci_oxsemi_tornado_init(struct pci_dev *dev) { @@ -1036,9 +1024,7 @@ static int pci_oxsemi_tornado_init(struct pci_dev *de= v) unsigned long deviceID; unsigned int number_uarts =3D 0; =20 - /* OxSemi Tornado devices are all 0xCxxx */ - if (dev->vendor =3D=3D PCI_VENDOR_ID_OXSEMI && - (dev->device & 0xF000) !=3D 0xC000) + if (!pci_oxsemi_tornado_p(dev)) return 0; =20 p =3D pci_iomap(dev, 0, 5); @@ -1049,7 +1035,10 @@ static int pci_oxsemi_tornado_init(struct pci_dev *d= ev) /* Tornado device */ if (deviceID =3D=3D 0x07000200) { number_uarts =3D ioread8(p + 4); - pci_dbg(dev, "%d ports detected on Oxford PCI Express device\n", number_= uarts); + pci_dbg(dev, "%d ports detected on %s PCI Express device\n", + number_uarts, + dev->vendor =3D=3D PCI_VENDOR_ID_ENDRUN ? + "EndRun" : "Oxford"); } pci_iounmap(dev, p); return number_uarts; @@ -2506,7 +2495,7 @@ static struct pci_serial_quirk pci_serial_quirks[] = =3D { .device =3D PCI_ANY_ID, .subvendor =3D PCI_ANY_ID, .subdevice =3D PCI_ANY_ID, - .init =3D pci_endrun_init, + .init =3D pci_oxsemi_tornado_init, .setup =3D pci_default_setup, }, /* @@ -2929,7 +2918,6 @@ enum pci_board_num_t { pbn_panacom2, pbn_panacom4, pbn_plx_romulus, - pbn_endrun_2_3906250, pbn_oxsemi, pbn_oxsemi_1_3906250, pbn_oxsemi_2_3906250, @@ -3455,20 +3443,6 @@ static struct pciserial_board pci_boards[] =3D { .first_offset =3D 0x03, }, =20 - /* - * EndRun Technologies - * Uses the size of PCI Base region 0 to - * signal now many ports are available - * 2 port 952 Uart support - */ - [pbn_endrun_2_3906250] =3D { - .flags =3D FL_BASE0, - .num_ports =3D 2, - .base_baud =3D 3906250, - .uart_offset =3D 0x200, - .first_offset =3D 0x1000, - }, - /* * This board uses the size of PCI Base region 0 to * signal now many ports are available @@ -4400,13 +4374,6 @@ static const struct pci_device_id serial_pci_tbl[] = =3D { { PCI_VENDOR_ID_PLX, PCI_DEVICE_ID_PLX_ROMULUS, 0x10b5, 0x106a, 0, 0, pbn_plx_romulus }, - /* - * EndRun Technologies. PCI express device range. - * EndRun PTP/1588 has 2 Native UARTs. - */ - { PCI_VENDOR_ID_ENDRUN, PCI_DEVICE_ID_ENDRUN_1588, - PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_endrun_2_3906250 }, /* * Quatech cards. These actually have configurable clocks but for * now we just use the default. @@ -4668,6 +4635,13 @@ static const struct pci_device_id serial_pci_tbl[] = =3D { { PCI_VENDOR_ID_DIGI, PCIE_DEVICE_ID_NEO_2_OX_IBM, PCI_SUBVENDOR_ID_IBM, PCI_ANY_ID, 0, 0, pbn_oxsemi_2_3906250 }, + /* + * EndRun Technologies. PCI express device range. + * EndRun PTP/1588 has 2 Native UARTs utilizing OxSemi 952. + */ + { PCI_VENDOR_ID_ENDRUN, PCI_DEVICE_ID_ENDRUN_1588, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, + pbn_oxsemi_2_3906250 }, =20 /* * SBS Technologies, Inc. P-Octal and PMC-OCTPRO cards, --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C38A2C00140 for ; Mon, 15 Aug 2022 19:53:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243670AbiHOTxH (ORCPT ); Mon, 15 Aug 2022 15:53:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345274AbiHOTvs (ORCPT ); Mon, 15 Aug 2022 15:51:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D4A12F38E; Mon, 15 Aug 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 dfw.source.kernel.org (Postfix) with ESMTPS id C973C611C6; Mon, 15 Aug 2022 18:50:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C391C433C1; Mon, 15 Aug 2022 18:50:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589434; bh=TOQpsev0olH4lUngRU7vAzR9MA+3OUqldnMzhK/oqUs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ejxRDZiXlxCQimBYfW94I96nkmjBrlphF0hkzle7w9VE3SRZWtLEwqlTE1lUb0vYC +DXW90NjApse+rljYvsWaNohYhfmv4DqXFikTff4o5t06r7nlkmgFPWF9OP6lUmy+n wyww0VnCdR6c3RfTCckaseQjpcLTFxAGrvupDuaY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Maciej W. Rozycki" , Sasha Levin Subject: [PATCH 5.15 716/779] serial: 8250: Add proper clock handling for OxSemi PCIe devices Date: Mon, 15 Aug 2022 20:06:00 +0200 Message-Id: <20220815180408.063042925@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maciej W. Rozycki [ Upstream commit 366f6c955d4d1a5125ffcd6875ead26a3c7a2a1c ] Oxford Semiconductor PCIe (Tornado) 950 serial port devices are driven by a fixed 62.5MHz clock input derived from the 100MHz PCI Express clock. We currently drive the device using its default oversampling rate of 16 and the clock prescaler disabled, consequently yielding the baud base of 3906250. This base is inadequate for some of the high-speed baud rates such as 460800bps, for which the closest rate possible can be obtained by dividing the baud base by 8, yielding the baud rate of 488281.25bps, which is off by 5.9638%. This is enough for data communication to break with the remote end talking actual 460800bps, where missed stop bits have been observed. We can do better however, by taking advantage of a reduced oversampling rate, which can be set to any integer value from 4 to 16 inclusive by programming the TCR register, and by using the clock prescaler, which can be set to any value from 1 to 63.875 in increments of 0.125 in the CPR/CPR2 register pair. The prescaler has to be explicitly enabled though by setting bit 7 in the MCR or otherwise it is bypassed (in the enhanced mode that we enable) as if the value of 1 was used. Make use of these features then as follows: - Set the baud base to 15625000, reflecting the minimum oversampling rate of 4 with the clock prescaler and divisor both set to 1. - Override the `set_mctrl' and set the MCR shadow there so as to have MCR[7] always set and have the 8250 core propagate these settings. - Override the `get_divisor' handler and determine a good combination of parameters by using a lookup table with predetermined value pairs of the oversampling rate and the clock prescaler and finding a pair that divides the input clock such that the quotient, when rounded to the nearest integer, deviates the least from the exact result. Calculate the clock divisor accordingly. Scale the resulting oversampling rate (only by powers of two) if possible so as to maximise it, reducing the divisor accordingly, and avoid a divisor overflow for very low baud rates by scaling the oversampling rate and/or the prescaler even if that causes some accuracy loss. Also handle the historic spd_cust feature so as to allow one to set all the three parameters manually to arbitrary values, by keeping the low 16 bits for the divisor and then putting TCR in bits 19:16 and CPR/CPR2 in bits 28:20, sanitising the bit pattern supplied such as to clamp CPR/CPR2 values between 0.000 and 0.875 inclusive to 33.875. This preserves compatibility with any existing setups, that is where requesting a custom divisor that only has any bits set among the low 16 the oversampling rate of 16 and the clock prescaler of 33.875 will be used as with the original 8250. Finally abuse the `frac' argument to store the determined bit patterns for the TCR, CPR and CPR2 registers. - Override the `set_divisor' handler so as to set the TCR, CPR and CPR2 registers from the `frac' value supplied. Set the divisor as usual. With the baud base set to 15625000 and the unsigned 16-bit UART_DIV_MAX limitation imposed by `serial8250_get_baud_rate' standard baud rates below 300bps become unavailable in the regular way, e.g. the rate of 200bps requires the baud base to be divided by 78125 and that is beyond the unsigned 16-bit range. The historic spd_cust feature can still be used to obtain such rates if so required. See Documentation/tty/device_drivers/oxsemi-tornado.rst for more details. Signed-off-by: Maciej W. Rozycki Link: https://lore.kernel.org/r/alpine.DEB.2.21.2204181519450.9383@angie.or= cam.me.uk Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- .../tty/device_drivers/oxsemi-tornado.rst | 129 +++++++ drivers/tty/serial/8250/8250_pci.c | 339 ++++++++++++++---- 2 files changed, 400 insertions(+), 68 deletions(-) create mode 100644 Documentation/tty/device_drivers/oxsemi-tornado.rst diff --git a/Documentation/tty/device_drivers/oxsemi-tornado.rst b/Document= ation/tty/device_drivers/oxsemi-tornado.rst new file mode 100644 index 000000000000..0180d8bb0881 --- /dev/null +++ b/Documentation/tty/device_drivers/oxsemi-tornado.rst @@ -0,0 +1,129 @@ +.. SPDX-License-Identifier: GPL-2.0 + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D +Notes on Oxford Semiconductor PCIe (Tornado) 950 serial port devices +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D + +Oxford Semiconductor PCIe (Tornado) 950 serial port devices are driven +by a fixed 62.5MHz clock input derived from the 100MHz PCI Express clock. + +The baud rate produced by the baud generator is obtained from this input +frequency by dividing it by the clock prescaler, which can be set to any +value from 1 to 63.875 in increments of 0.125, and then the usual 16-bit +divisor is used as with the original 8250, to divide the frequency by a +value from 1 to 65535. Finally a programmable oversampling rate is used +that can take any value from 4 to 16 to divide the frequency further and +determine the actual baud rate used. Baud rates from 15625000bps down +to 0.933bps can be obtained this way. + +By default the oversampling rate is set to 16 and the clock prescaler is +set to 33.875, meaning that the frequency to be used as the reference +for the usual 16-bit divisor is 115313.653, which is close enough to the +frequency of 115200 used by the original 8250 for the same values to be +used for the divisor to obtain the requested baud rates by software that +is unaware of the extra clock controls available. + +The oversampling rate is programmed with the TCR register and the clock +prescaler is programmed with the CPR/CPR2 register pair[1][2][3][4]. +To switch away from the default value of 33.875 for the prescaler the +the enhanced mode has to be explicitly enabled though, by setting bit 4 +of the EFR. In that mode setting bit 7 in the MCR enables the prescaler +or otherwise it is bypassed as if the value of 1 was used. Additionally +writing any value to CPR clears CPR2 for compatibility with old software +written for older conventional PCI Oxford Semiconductor devices that do +not have the extra prescaler's 9th bit in CPR2, so the CPR/CPR2 register +pair has to be programmed in the right order. + +By using these parameters rates from 15625000bps down to 1bps can be +obtained, with either exact or highly-accurate actual bit rates for +standard and many non-standard rates. + +Here are the figures for the standard and some non-standard baud rates +(including those quoted in Oxford Semiconductor documentation), giving +the requested rate (r), the actual rate yielded (a) and its deviation +from the requested rate (d), and the values of the oversampling rate +(tcr), the clock prescaler (cpr) and the divisor (div) produced by the +new `get_divisor' handler: + +r: 15625000, a: 15625000.00, d: 0.0000%, tcr: 4, cpr: 1.000, div: 1 +r: 12500000, a: 12500000.00, d: 0.0000%, tcr: 5, cpr: 1.000, div: 1 +r: 10416666, a: 10416666.67, d: 0.0000%, tcr: 6, cpr: 1.000, div: 1 +r: 8928571, a: 8928571.43, d: 0.0000%, tcr: 7, cpr: 1.000, div: 1 +r: 7812500, a: 7812500.00, d: 0.0000%, tcr: 8, cpr: 1.000, div: 1 +r: 4000000, a: 4000000.00, d: 0.0000%, tcr: 5, cpr: 3.125, div: 1 +r: 3686400, a: 3676470.59, d: -0.2694%, tcr: 8, cpr: 2.125, div: 1 +r: 3500000, a: 3496503.50, d: -0.0999%, tcr: 13, cpr: 1.375, div: 1 +r: 3000000, a: 2976190.48, d: -0.7937%, tcr: 14, cpr: 1.500, div: 1 +r: 2500000, a: 2500000.00, d: 0.0000%, tcr: 10, cpr: 2.500, div: 1 +r: 2000000, a: 2000000.00, d: 0.0000%, tcr: 10, cpr: 3.125, div: 1 +r: 1843200, a: 1838235.29, d: -0.2694%, tcr: 16, cpr: 2.125, div: 1 +r: 1500000, a: 1492537.31, d: -0.4975%, tcr: 5, cpr: 8.375, div: 1 +r: 1152000, a: 1152073.73, d: 0.0064%, tcr: 14, cpr: 3.875, div: 1 +r: 921600, a: 919117.65, d: -0.2694%, tcr: 16, cpr: 2.125, div: 2 +r: 576000, a: 576036.87, d: 0.0064%, tcr: 14, cpr: 3.875, div: 2 +r: 460800, a: 460829.49, d: 0.0064%, tcr: 7, cpr: 3.875, div: 5 +r: 230400, a: 230414.75, d: 0.0064%, tcr: 14, cpr: 3.875, div: 5 +r: 115200, a: 115207.37, d: 0.0064%, tcr: 14, cpr: 1.250, div: 31 +r: 57600, a: 57603.69, d: 0.0064%, tcr: 8, cpr: 3.875, div: 35 +r: 38400, a: 38402.46, d: 0.0064%, tcr: 14, cpr: 3.875, div: 30 +r: 19200, a: 19201.23, d: 0.0064%, tcr: 8, cpr: 3.875, div: 105 +r: 9600, a: 9600.06, d: 0.0006%, tcr: 9, cpr: 1.125, div: 643 +r: 4800, a: 4799.98, d: -0.0004%, tcr: 7, cpr: 2.875, div: 647 +r: 2400, a: 2400.02, d: 0.0008%, tcr: 9, cpr: 2.250, div: 1286 +r: 1200, a: 1200.00, d: 0.0000%, tcr: 14, cpr: 2.875, div: 1294 +r: 300, a: 300.00, d: 0.0000%, tcr: 11, cpr: 2.625, div: 7215 +r: 200, a: 200.00, d: 0.0000%, tcr: 16, cpr: 1.250, div: 15625 +r: 150, a: 150.00, d: 0.0000%, tcr: 13, cpr: 2.250, div: 14245 +r: 134, a: 134.00, d: 0.0000%, tcr: 11, cpr: 2.625, div: 16153 +r: 110, a: 110.00, d: 0.0000%, tcr: 12, cpr: 1.000, div: 47348 +r: 75, a: 75.00, d: 0.0000%, tcr: 4, cpr: 5.875, div: 35461 +r: 50, a: 50.00, d: 0.0000%, tcr: 16, cpr: 1.250, div: 62500 +r: 25, a: 25.00, d: 0.0000%, tcr: 16, cpr: 2.500, div: 62500 +r: 4, a: 4.00, d: 0.0000%, tcr: 16, cpr: 20.000, div: 48828 +r: 2, a: 2.00, d: 0.0000%, tcr: 16, cpr: 40.000, div: 48828 +r: 1, a: 1.00, d: 0.0000%, tcr: 16, cpr: 63.875, div: 61154 + +With the baud base set to 15625000 and the unsigned 16-bit UART_DIV_MAX +limitation imposed by `serial8250_get_baud_rate' standard baud rates +below 300bps become unavailable in the regular way, e.g. the rate of +200bps requires the baud base to be divided by 78125 and that is beyond +the unsigned 16-bit range. The historic spd_cust feature can still be +used by encoding the values for, the prescaler, the oversampling rate +and the clock divisor (DLM/DLL) as follows to obtain such rates if so +required: + + 31 29 28 20 19 16 15 0 ++-----+-----------------+-------+-------------------------------+ +|0 0 0| CPR2:CPR | TCR | DLM:DLL | ++-----+-----------------+-------+-------------------------------+ + +Use a value such encoded for the `custom_divisor' field along with the +ASYNC_SPD_CUST flag set in the `flags' field in `struct serial_struct' +passed with the TIOCSSERIAL ioctl(2), such as with the setserial(8) +utility and its `divisor' and `spd_cust' parameters, and the select +the baud rate of 38400bps. Note that the value of 0 in TCR sets the +oversampling rate to 16 and prescaler values below 1 in CPR2/CPR are +clamped by the driver to 1. + +For example the value of 0x1f4004e2 will set CPR2/CPR, TCR and DLM/DLL +respectively to 0x1f4, 0x0 and 0x04e2, choosing the prescaler value, +the oversampling rate and the clock divisor of 62.500, 16 and 1250 +respectively. These parameters will set the baud rate for the serial +port to 62500000 / 62.500 / 1250 / 16 =3D 50bps. + +References: + +[1] "OXPCIe200 PCI Express Multi-Port Bridge", Oxford Semiconductor, + Inc., DS-0045, 10 Nov 2008, Section "950 Mode", pp. 64-65 + +[2] "OXPCIe952 PCI Express Bridge to Dual Serial & Parallel Port", + Oxford Semiconductor, Inc., DS-0046, Mar 06 08, Section "950 Mode", + p. 20 + +[3] "OXPCIe954 PCI Express Bridge to Quad Serial Port", Oxford + Semiconductor, Inc., DS-0047, Feb 08, Section "950 Mode", p. 20 + +[4] "OXPCIe958 PCI Express Bridge to Octal Serial Port", Oxford + Semiconductor, Inc., DS-0048, Feb 08, Section "950 Mode", p. 20 + +Maciej W. Rozycki diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8= 250_pci.c index 20ce812a069c..1860fc969433 100644 --- a/drivers/tty/serial/8250/8250_pci.c +++ b/drivers/tty/serial/8250/8250_pci.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -1044,6 +1045,208 @@ static int pci_oxsemi_tornado_init(struct pci_dev *= dev) return number_uarts; } =20 +/* Tornado-specific constants for the TCR and CPR registers; see below. */ +#define OXSEMI_TORNADO_TCR_MASK 0xf +#define OXSEMI_TORNADO_CPR_MASK 0x1ff +#define OXSEMI_TORNADO_CPR_MIN 0x008 +#define OXSEMI_TORNADO_CPR_DEF 0x10f + +/* + * Determine the oversampling rate, the clock prescaler, and the clock + * divisor for the requested baud rate. The clock rate is 62.5 MHz, + * which is four times the baud base, and the prescaler increments in + * steps of 1/8. Therefore to make calculations on integers we need + * to use a scaled clock rate, which is the baud base multiplied by 32 + * (or our assumed UART clock rate multiplied by 2). + * + * The allowed oversampling rates are from 4 up to 16 inclusive (values + * from 0 to 3 inclusive map to 16). Likewise the clock prescaler allows + * values between 1.000 and 63.875 inclusive (operation for values from + * 0.000 to 0.875 has not been specified). The clock divisor is the usual + * unsigned 16-bit integer. + * + * For the most accurate baud rate we use a table of predetermined + * oversampling rates and clock prescalers that records all possible + * products of the two parameters in the range from 4 up to 255 inclusive, + * and additionally 335 for the 1500000bps rate, with the prescaler scaled + * by 8. The table is sorted by the decreasing value of the oversampling + * rate and ties are resolved by sorting by the decreasing value of the + * product. This way preference is given to higher oversampling rates. + * + * We iterate over the table and choose the product of an oversampling + * rate and a clock prescaler that gives the lowest integer division + * result deviation, or if an exact integer divider is found we stop + * looking for it right away. We do some fixup if the resulting clock + * divisor required would be out of its unsigned 16-bit integer range. + * + * Finally we abuse the supposed fractional part returned to encode the + * 4-bit value of the oversampling rate and the 9-bit value of the clock + * prescaler which will end up in the TCR and CPR/CPR2 registers. + */ +static unsigned int pci_oxsemi_tornado_get_divisor(struct uart_port *port, + unsigned int baud, + unsigned int *frac) +{ + static u8 p[][2] =3D { + { 16, 14, }, { 16, 13, }, { 16, 12, }, { 16, 11, }, + { 16, 10, }, { 16, 9, }, { 16, 8, }, { 15, 17, }, + { 15, 16, }, { 15, 15, }, { 15, 14, }, { 15, 13, }, + { 15, 12, }, { 15, 11, }, { 15, 10, }, { 15, 9, }, + { 15, 8, }, { 14, 18, }, { 14, 17, }, { 14, 14, }, + { 14, 13, }, { 14, 12, }, { 14, 11, }, { 14, 10, }, + { 14, 9, }, { 14, 8, }, { 13, 19, }, { 13, 18, }, + { 13, 17, }, { 13, 13, }, { 13, 12, }, { 13, 11, }, + { 13, 10, }, { 13, 9, }, { 13, 8, }, { 12, 19, }, + { 12, 18, }, { 12, 17, }, { 12, 11, }, { 12, 9, }, + { 12, 8, }, { 11, 23, }, { 11, 22, }, { 11, 21, }, + { 11, 20, }, { 11, 19, }, { 11, 18, }, { 11, 17, }, + { 11, 11, }, { 11, 10, }, { 11, 9, }, { 11, 8, }, + { 10, 25, }, { 10, 23, }, { 10, 20, }, { 10, 19, }, + { 10, 17, }, { 10, 10, }, { 10, 9, }, { 10, 8, }, + { 9, 27, }, { 9, 23, }, { 9, 21, }, { 9, 19, }, + { 9, 18, }, { 9, 17, }, { 9, 9, }, { 9, 8, }, + { 8, 31, }, { 8, 29, }, { 8, 23, }, { 8, 19, }, + { 8, 17, }, { 8, 8, }, { 7, 35, }, { 7, 31, }, + { 7, 29, }, { 7, 25, }, { 7, 23, }, { 7, 21, }, + { 7, 19, }, { 7, 17, }, { 7, 15, }, { 7, 14, }, + { 7, 13, }, { 7, 12, }, { 7, 11, }, { 7, 10, }, + { 7, 9, }, { 7, 8, }, { 6, 41, }, { 6, 37, }, + { 6, 31, }, { 6, 29, }, { 6, 23, }, { 6, 19, }, + { 6, 17, }, { 6, 13, }, { 6, 11, }, { 6, 10, }, + { 6, 9, }, { 6, 8, }, { 5, 67, }, { 5, 47, }, + { 5, 43, }, { 5, 41, }, { 5, 37, }, { 5, 31, }, + { 5, 29, }, { 5, 25, }, { 5, 23, }, { 5, 19, }, + { 5, 17, }, { 5, 15, }, { 5, 13, }, { 5, 11, }, + { 5, 10, }, { 5, 9, }, { 5, 8, }, { 4, 61, }, + { 4, 59, }, { 4, 53, }, { 4, 47, }, { 4, 43, }, + { 4, 41, }, { 4, 37, }, { 4, 31, }, { 4, 29, }, + { 4, 23, }, { 4, 19, }, { 4, 17, }, { 4, 13, }, + { 4, 9, }, { 4, 8, }, + }; + /* Scale the quotient for comparison to get the fractional part. */ + const unsigned int quot_scale =3D 65536; + unsigned int sclk =3D port->uartclk * 2; + unsigned int sdiv =3D DIV_ROUND_CLOSEST(sclk, baud); + unsigned int best_squot; + unsigned int squot; + unsigned int quot; + u16 cpr; + u8 tcr; + int i; + + /* Old custom speed handling. */ + if (baud =3D=3D 38400 && (port->flags & UPF_SPD_MASK) =3D=3D UPF_SPD_CUST= ) { + unsigned int cust_div =3D port->custom_divisor; + + quot =3D cust_div & UART_DIV_MAX; + tcr =3D (cust_div >> 16) & OXSEMI_TORNADO_TCR_MASK; + cpr =3D (cust_div >> 20) & OXSEMI_TORNADO_CPR_MASK; + if (cpr < OXSEMI_TORNADO_CPR_MIN) + cpr =3D OXSEMI_TORNADO_CPR_DEF; + } else { + best_squot =3D quot_scale; + for (i =3D 0; i < ARRAY_SIZE(p); i++) { + unsigned int spre; + unsigned int srem; + u8 cp; + u8 tc; + + tc =3D p[i][0]; + cp =3D p[i][1]; + spre =3D tc * cp; + + srem =3D sdiv % spre; + if (srem > spre / 2) + srem =3D spre - srem; + squot =3D DIV_ROUND_CLOSEST(srem * quot_scale, spre); + + if (srem =3D=3D 0) { + tcr =3D tc; + cpr =3D cp; + quot =3D sdiv / spre; + break; + } else if (squot < best_squot) { + best_squot =3D squot; + tcr =3D tc; + cpr =3D cp; + quot =3D DIV_ROUND_CLOSEST(sdiv, spre); + } + } + while (tcr <=3D (OXSEMI_TORNADO_TCR_MASK + 1) >> 1 && + quot % 2 =3D=3D 0) { + quot >>=3D 1; + tcr <<=3D 1; + } + while (quot > UART_DIV_MAX) { + if (tcr <=3D (OXSEMI_TORNADO_TCR_MASK + 1) >> 1) { + quot >>=3D 1; + tcr <<=3D 1; + } else if (cpr <=3D OXSEMI_TORNADO_CPR_MASK >> 1) { + quot >>=3D 1; + cpr <<=3D 1; + } else { + quot =3D quot * cpr / OXSEMI_TORNADO_CPR_MASK; + cpr =3D OXSEMI_TORNADO_CPR_MASK; + } + } + } + + *frac =3D (cpr << 8) | (tcr & OXSEMI_TORNADO_TCR_MASK); + return quot; +} + +/* + * Set the oversampling rate in the transmitter clock cycle register (TCR), + * the clock prescaler in the clock prescaler register (CPR and CPR2), and + * the clock divisor in the divisor latch (DLL and DLM). Note that for + * backwards compatibility any write to CPR clears CPR2 and therefore CPR + * has to be written first, followed by CPR2, which occupies the location + * of CKS used with earlier UART designs. + */ +static void pci_oxsemi_tornado_set_divisor(struct uart_port *port, + unsigned int baud, + unsigned int quot, + unsigned int quot_frac) +{ + struct uart_8250_port *up =3D up_to_u8250p(port); + u8 cpr2 =3D quot_frac >> 16; + u8 cpr =3D quot_frac >> 8; + u8 tcr =3D quot_frac; + + serial_icr_write(up, UART_TCR, tcr); + serial_icr_write(up, UART_CPR, cpr); + serial_icr_write(up, UART_CKS, cpr2); + serial8250_do_set_divisor(port, baud, quot, 0); +} + +/* + * For Tornado devices we force MCR[7] set for the Divide-by-M N/8 baud ra= te + * generator prescaler (CPR and CPR2). Otherwise no prescaler would be us= ed. + */ +static void pci_oxsemi_tornado_set_mctrl(struct uart_port *port, + unsigned int mctrl) +{ + struct uart_8250_port *up =3D up_to_u8250p(port); + + up->mcr |=3D UART_MCR_CLKSEL; + serial8250_do_set_mctrl(port, mctrl); +} + +static int pci_oxsemi_tornado_setup(struct serial_private *priv, + const struct pciserial_board *board, + struct uart_8250_port *up, int idx) +{ + struct pci_dev *dev =3D priv->dev; + + if (pci_oxsemi_tornado_p(dev)) { + up->port.get_divisor =3D pci_oxsemi_tornado_get_divisor; + up->port.set_divisor =3D pci_oxsemi_tornado_set_divisor; + up->port.set_mctrl =3D pci_oxsemi_tornado_set_mctrl; + } + + return pci_default_setup(priv, board, up, idx); +} + static int pci_asix_setup(struct serial_private *priv, const struct pciserial_board *board, struct uart_8250_port *port, int idx) @@ -2507,7 +2710,7 @@ static struct pci_serial_quirk pci_serial_quirks[] = =3D { .subvendor =3D PCI_ANY_ID, .subdevice =3D PCI_ANY_ID, .init =3D pci_oxsemi_tornado_init, - .setup =3D pci_default_setup, + .setup =3D pci_oxsemi_tornado_setup, }, { .vendor =3D PCI_VENDOR_ID_MAINPINE, @@ -2515,7 +2718,7 @@ static struct pci_serial_quirk pci_serial_quirks[] = =3D { .subvendor =3D PCI_ANY_ID, .subdevice =3D PCI_ANY_ID, .init =3D pci_oxsemi_tornado_init, - .setup =3D pci_default_setup, + .setup =3D pci_oxsemi_tornado_setup, }, { .vendor =3D PCI_VENDOR_ID_DIGI, @@ -2523,7 +2726,7 @@ static struct pci_serial_quirk pci_serial_quirks[] = =3D { .subvendor =3D PCI_SUBVENDOR_ID_IBM, .subdevice =3D PCI_ANY_ID, .init =3D pci_oxsemi_tornado_init, - .setup =3D pci_default_setup, + .setup =3D pci_oxsemi_tornado_setup, }, { .vendor =3D PCI_VENDOR_ID_INTEL, @@ -2840,7 +3043,7 @@ enum pci_board_num_t { pbn_b0_2_1843200, pbn_b0_4_1843200, =20 - pbn_b0_1_3906250, + pbn_b0_1_15625000, =20 pbn_b0_bt_1_115200, pbn_b0_bt_2_115200, @@ -2919,10 +3122,10 @@ enum pci_board_num_t { pbn_panacom4, pbn_plx_romulus, pbn_oxsemi, - pbn_oxsemi_1_3906250, - pbn_oxsemi_2_3906250, - pbn_oxsemi_4_3906250, - pbn_oxsemi_8_3906250, + pbn_oxsemi_1_15625000, + pbn_oxsemi_2_15625000, + pbn_oxsemi_4_15625000, + pbn_oxsemi_8_15625000, pbn_intel_i960, pbn_sgi_ioc3, pbn_computone_4, @@ -3069,10 +3272,10 @@ static struct pciserial_board pci_boards[] =3D { .uart_offset =3D 8, }, =20 - [pbn_b0_1_3906250] =3D { + [pbn_b0_1_15625000] =3D { .flags =3D FL_BASE0, .num_ports =3D 1, - .base_baud =3D 3906250, + .base_baud =3D 15625000, .uart_offset =3D 8, }, =20 @@ -3453,31 +3656,31 @@ static struct pciserial_board pci_boards[] =3D { .base_baud =3D 115200, .uart_offset =3D 8, }, - [pbn_oxsemi_1_3906250] =3D { + [pbn_oxsemi_1_15625000] =3D { .flags =3D FL_BASE0, .num_ports =3D 1, - .base_baud =3D 3906250, + .base_baud =3D 15625000, .uart_offset =3D 0x200, .first_offset =3D 0x1000, }, - [pbn_oxsemi_2_3906250] =3D { + [pbn_oxsemi_2_15625000] =3D { .flags =3D FL_BASE0, .num_ports =3D 2, - .base_baud =3D 3906250, + .base_baud =3D 15625000, .uart_offset =3D 0x200, .first_offset =3D 0x1000, }, - [pbn_oxsemi_4_3906250] =3D { + [pbn_oxsemi_4_15625000] =3D { .flags =3D FL_BASE0, .num_ports =3D 4, - .base_baud =3D 3906250, + .base_baud =3D 15625000, .uart_offset =3D 0x200, .first_offset =3D 0x1000, }, - [pbn_oxsemi_8_3906250] =3D { + [pbn_oxsemi_8_15625000] =3D { .flags =3D FL_BASE0, .num_ports =3D 8, - .base_baud =3D 3906250, + .base_baud =3D 15625000, .uart_offset =3D 0x200, .first_offset =3D 0x1000, }, @@ -4483,165 +4686,165 @@ static const struct pci_device_id serial_pci_tbl[= ] =3D { */ { PCI_VENDOR_ID_OXSEMI, 0xc101, /* OXPCIe952 1 Legacy UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_b0_1_3906250 }, + pbn_b0_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc105, /* OXPCIe952 1 Legacy UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_b0_1_3906250 }, + pbn_b0_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc11b, /* OXPCIe952 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc11f, /* OXPCIe952 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc120, /* OXPCIe952 1 Legacy UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_b0_1_3906250 }, + pbn_b0_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc124, /* OXPCIe952 1 Legacy UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_b0_1_3906250 }, + pbn_b0_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc138, /* OXPCIe952 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc13d, /* OXPCIe952 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc140, /* OXPCIe952 1 Legacy UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_b0_1_3906250 }, + pbn_b0_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc141, /* OXPCIe952 1 Legacy UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_b0_1_3906250 }, + pbn_b0_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc144, /* OXPCIe952 1 Legacy UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_b0_1_3906250 }, + pbn_b0_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc145, /* OXPCIe952 1 Legacy UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_b0_1_3906250 }, + pbn_b0_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc158, /* OXPCIe952 2 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_2_3906250 }, + pbn_oxsemi_2_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc15d, /* OXPCIe952 2 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_2_3906250 }, + pbn_oxsemi_2_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc208, /* OXPCIe954 4 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_4_3906250 }, + pbn_oxsemi_4_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc20d, /* OXPCIe954 4 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_4_3906250 }, + pbn_oxsemi_4_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc308, /* OXPCIe958 8 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_8_3906250 }, + pbn_oxsemi_8_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc30d, /* OXPCIe958 8 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_8_3906250 }, + pbn_oxsemi_8_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc40b, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc40f, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc41b, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc41f, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc42b, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc42f, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc43b, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc43f, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc44b, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc44f, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc45b, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc45f, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc46b, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc46f, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc47b, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc47f, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc48b, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc48f, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc49b, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc49f, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc4ab, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc4af, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc4bb, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc4bf, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc4cb, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_OXSEMI, 0xc4cf, /* OXPCIe200 1 Native UART */ PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, /* * Mainpine Inc. IQ Express "Rev3" utilizing OxSemi Tornado */ { PCI_VENDOR_ID_MAINPINE, 0x4000, /* IQ Express 1 Port V.34 Super-G3 Fax = */ PCI_VENDOR_ID_MAINPINE, 0x4001, 0, 0, - pbn_oxsemi_1_3906250 }, + pbn_oxsemi_1_15625000 }, { PCI_VENDOR_ID_MAINPINE, 0x4000, /* IQ Express 2 Port V.34 Super-G3 Fax = */ PCI_VENDOR_ID_MAINPINE, 0x4002, 0, 0, - pbn_oxsemi_2_3906250 }, + pbn_oxsemi_2_15625000 }, { PCI_VENDOR_ID_MAINPINE, 0x4000, /* IQ Express 4 Port V.34 Super-G3 Fax = */ PCI_VENDOR_ID_MAINPINE, 0x4004, 0, 0, - pbn_oxsemi_4_3906250 }, + pbn_oxsemi_4_15625000 }, { PCI_VENDOR_ID_MAINPINE, 0x4000, /* IQ Express 8 Port V.34 Super-G3 Fax = */ PCI_VENDOR_ID_MAINPINE, 0x4008, 0, 0, - pbn_oxsemi_8_3906250 }, + pbn_oxsemi_8_15625000 }, =20 /* * Digi/IBM PCIe 2-port Async EIA-232 Adapter utilizing OxSemi Tornado */ { PCI_VENDOR_ID_DIGI, PCIE_DEVICE_ID_NEO_2_OX_IBM, PCI_SUBVENDOR_ID_IBM, PCI_ANY_ID, 0, 0, - pbn_oxsemi_2_3906250 }, + pbn_oxsemi_2_15625000 }, /* * EndRun Technologies. PCI express device range. * EndRun PTP/1588 has 2 Native UARTs utilizing OxSemi 952. */ { PCI_VENDOR_ID_ENDRUN, PCI_DEVICE_ID_ENDRUN_1588, PCI_ANY_ID, PCI_ANY_ID, 0, 0, - pbn_oxsemi_2_3906250 }, + pbn_oxsemi_2_15625000 }, =20 /* * SBS Technologies, Inc. P-Octal and PMC-OCTPRO cards, --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7C48C25B0E for ; Mon, 15 Aug 2022 19:53:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345298AbiHOTx1 (ORCPT ); Mon, 15 Aug 2022 15:53:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345165AbiHOTwI (ORCPT ); Mon, 15 Aug 2022 15:52:08 -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 CF42260500; Mon, 15 Aug 2022 11:50: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 DB884CE1277; Mon, 15 Aug 2022 18:50:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8521C433D6; Mon, 15 Aug 2022 18:50:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589437; bh=VjXw7mw98BXRNt1NRsj+eecy9hUP/8ZjEFUqTCTCbWo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jJKUpiUuG9ePB6KCOoR4IJ7kp7T+qd0X+ZIwD0pstpZt8s5HnUnsJvbqKrUlKI7N3 sXPSV2HKWHOa1JeQ99/utnJQpr8TngcR4TebB2cLn1sOAOmrc2Db6baKk1T30SgWFL fcNWHgHTksjNB4IQ5sp9hN+dVNCDUy0HnpGYAbes= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cameron Williams , stable , Sasha Levin Subject: [PATCH 5.15 717/779] tty: 8250: Add support for Brainboxes PX cards. Date: Mon, 15 Aug 2022 20:06:01 +0200 Message-Id: <20220815180408.097183815@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Cameron Williams [ Upstream commit ef5a03a26c87a760bc3d86b5af7b773e82f8b1b7 ] Add support for some of the Brainboxes PCIe (PX) range of serial cards, including the PX-101, PX-235/PX-246, PX-203/PX-257, PX-260/PX-701, PX-310, PX-313, PX-320/PX-324/PX-376/PX-387, PX-335/PX-346, PX-368, PX-420, PX-803 and PX-846. Signed-off-by: Cameron Williams Cc: stable Link: https://lore.kernel.org/r/AM5PR0202MB2564669252BDC59BF55A6E87C4879@AM= 5PR0202MB2564.eurprd02.prod.outlook.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/tty/serial/8250/8250_pci.c | 109 +++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8= 250_pci.c index 1860fc969433..a16743856fc7 100644 --- a/drivers/tty/serial/8250/8250_pci.c +++ b/drivers/tty/serial/8250/8250_pci.c @@ -5475,6 +5475,115 @@ static const struct pci_device_id serial_pci_tbl[] = =3D { PCI_ANY_ID, PCI_ANY_ID, 0, 0, pbn_b2_4_115200 }, + /* + * Brainboxes PX-101 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x4005, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b0_2_115200 }, + { PCI_VENDOR_ID_INTASHIELD, 0x4019, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_oxsemi_2_15625000 }, + /* + * Brainboxes PX-235/246 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x4004, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b0_1_115200 }, + { PCI_VENDOR_ID_INTASHIELD, 0x4016, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_oxsemi_1_15625000 }, + /* + * Brainboxes PX-203/PX-257 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x4006, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b0_2_115200 }, + { PCI_VENDOR_ID_INTASHIELD, 0x4015, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_oxsemi_4_15625000 }, + /* + * Brainboxes PX-260/PX-701 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x400A, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_oxsemi_4_15625000 }, + /* + * Brainboxes PX-310 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x400E, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_oxsemi_2_15625000 }, + /* + * Brainboxes PX-313 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x400C, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_oxsemi_2_15625000 }, + /* + * Brainboxes PX-320/324/PX-376/PX-387 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x400B, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_oxsemi_1_15625000 }, + /* + * Brainboxes PX-335/346 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x400F, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_oxsemi_4_15625000 }, + /* + * Brainboxes PX-368 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x4010, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_oxsemi_4_15625000 }, + /* + * Brainboxes PX-420 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x4000, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b0_4_115200 }, + { PCI_VENDOR_ID_INTASHIELD, 0x4011, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_oxsemi_4_15625000 }, + /* + * Brainboxes PX-803 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x4009, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b0_1_115200 }, + { PCI_VENDOR_ID_INTASHIELD, 0x401E, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_oxsemi_1_15625000 }, + /* + * Brainboxes PX-846 + */ + { PCI_VENDOR_ID_INTASHIELD, 0x4008, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_b0_1_115200 }, + { PCI_VENDOR_ID_INTASHIELD, 0x4017, + PCI_ANY_ID, PCI_ANY_ID, + 0, 0, + pbn_oxsemi_1_15625000 }, + /* * Perle PCI-RAS cards */ --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1997C00140 for ; Mon, 15 Aug 2022 19:53:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345473AbiHOTxb (ORCPT ); Mon, 15 Aug 2022 15:53:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240661AbiHOTwN (ORCPT ); Mon, 15 Aug 2022 15:52:13 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 578DA101E6; Mon, 15 Aug 2022 11:50: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 sin.source.kernel.org (Postfix) with ESMTPS id 48DDBCE1279; Mon, 15 Aug 2022 18:50:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE86CC433C1; Mon, 15 Aug 2022 18:50:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589440; bh=rDVCFEShSGxdUo+XdGyKcO4VNAALXJshOd6PFfNegSY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gnpZpXXOsydabcUO+iw1zONhNZrvZw2KOeYk4ASKWnZNGbJVoCFgGUyism/sqc26W iEilsY5QNmU8kuOpYPkX6WocgN+GROH5bLxzjozu2agpd0lh9Bz4ERcS6XCaMV1C7f 8AK4M2ciCbSCZ1pFZABEkYwNlZYduIrb0WS4OAuU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , Mike Snitzer , Sasha Levin Subject: [PATCH 5.15 718/779] dm writecache: set a default MAX_WRITEBACK_JOBS Date: Mon, 15 Aug 2022 20:06:02 +0200 Message-Id: <20220815180408.148101902@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 ca7dc242e358e46d963b32f9d9dd829785a9e957 ] dm-writecache has the capability to limit the number of writeback jobs in progress. However, this feature was off by default. As such there were some out-of-memory crashes observed when lowering the low watermark while the cache is full. This commit enables writeback limit by default. It is set to 256MiB or 1/16 of total system memory, whichever is smaller. Cc: stable@vger.kernel.org Signed-off-by: Mikulas Patocka Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/md/dm-writecache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c index c3e59d8af76f..dfb55fe09ce1 100644 --- a/drivers/md/dm-writecache.c +++ b/drivers/md/dm-writecache.c @@ -22,7 +22,7 @@ =20 #define HIGH_WATERMARK 50 #define LOW_WATERMARK 45 -#define MAX_WRITEBACK_JOBS 0 +#define MAX_WRITEBACK_JOBS min(0x10000000 / PAGE_SIZE, totalram_pages() /= 16) #define ENDIO_LATENCY 16 #define WRITEBACK_LATENCY 64 #define AUTOCOMMIT_BLOCKS_SSD 65536 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFFD5C00140 for ; Mon, 15 Aug 2022 19:53:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243759AbiHOTxk (ORCPT ); Mon, 15 Aug 2022 15:53:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345314AbiHOTwO (ORCPT ); Mon, 15 Aug 2022 15:52:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8572A42AFA; Mon, 15 Aug 2022 11:50: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 E9D0AB810A4; Mon, 15 Aug 2022 18:50:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0FA69C433C1; Mon, 15 Aug 2022 18:50:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589443; bh=i3e/A4Zn400OOB+vPxUgs7Ypq6tOijgt4jkqF0Vp0po=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CHaNkVhg7GK3j8VoPJlTa1gGkscOjJfHuM4n3giZj1Xtcs6FsSQ73o1VqQLTn3e0H KxZ4IRY5hcEyYxKLciaOLkVxwCGw4oWuS2nBUjpmp35LbxtSiAJeKHtCYvR3tfMvgQ mL4qsXb45LiabAngYZFjCSqQbKGrZKT1Qyx4L1tE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Philipp Rudo , kexec@lists.infradead.org, keyrings@vger.kernel.org, linux-security-module@vger.kernel.org, Michal Suchanek , "Lee, Chun-Yi" , Baoquan He , Coiby Xu , Heiko Carstens , Mimi Zohar , Sasha Levin Subject: [PATCH 5.15 719/779] kexec, KEYS, s390: Make use of built-in and secondary keyring for signature verification Date: Mon, 15 Aug 2022 20:06:03 +0200 Message-Id: <20220815180408.186099124@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michal Suchanek [ Upstream commit 0828c4a39be57768b8788e8cbd0d84683ea757e5 ] commit e23a8020ce4e ("s390/kexec_file: Signature verification prototype") adds support for KEXEC_SIG verification with keys from platform keyring but the built-in keys and secondary keyring are not used. Add support for the built-in keys and secondary keyring as x86 does. Fixes: e23a8020ce4e ("s390/kexec_file: Signature verification prototype") Cc: stable@vger.kernel.org Cc: Philipp Rudo Cc: kexec@lists.infradead.org Cc: keyrings@vger.kernel.org Cc: linux-security-module@vger.kernel.org Signed-off-by: Michal Suchanek Reviewed-by: "Lee, Chun-Yi" Acked-by: Baoquan He Signed-off-by: Coiby Xu Acked-by: Heiko Carstens Signed-off-by: Mimi Zohar Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/s390/kernel/machine_kexec_file.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/arch/s390/kernel/machine_kexec_file.c b/arch/s390/kernel/machi= ne_kexec_file.c index a81d6c43b9b6..3459362c54ac 100644 --- a/arch/s390/kernel/machine_kexec_file.c +++ b/arch/s390/kernel/machine_kexec_file.c @@ -29,6 +29,7 @@ int s390_verify_sig(const char *kernel, unsigned long ker= nel_len) const unsigned long marker_len =3D sizeof(MODULE_SIG_STRING) - 1; struct module_signature *ms; unsigned long sig_len; + int ret; =20 /* Skip signature verification when not secure IPLed. */ if (!ipl_secure_flag) @@ -63,11 +64,18 @@ int s390_verify_sig(const char *kernel, unsigned long k= ernel_len) return -EBADMSG; } =20 - return verify_pkcs7_signature(kernel, kernel_len, - kernel + kernel_len, sig_len, - VERIFY_USE_PLATFORM_KEYRING, - VERIFYING_MODULE_SIGNATURE, - NULL, NULL); + ret =3D verify_pkcs7_signature(kernel, kernel_len, + kernel + kernel_len, sig_len, + VERIFY_USE_SECONDARY_KEYRING, + VERIFYING_MODULE_SIGNATURE, + NULL, NULL); + if (ret =3D=3D -ENOKEY && IS_ENABLED(CONFIG_INTEGRITY_PLATFORM_KEYRING)) + ret =3D verify_pkcs7_signature(kernel, kernel_len, + kernel + kernel_len, sig_len, + VERIFY_USE_PLATFORM_KEYRING, + VERIFYING_MODULE_SIGNATURE, + NULL, NULL); + return ret; } #endif /* CONFIG_KEXEC_SIG */ =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAD17C00140 for ; Mon, 15 Aug 2022 19:53:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345482AbiHOTxg (ORCPT ); Mon, 15 Aug 2022 15:53:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345315AbiHOTwO (ORCPT ); Mon, 15 Aug 2022 15:52:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B00B74CD9; Mon, 15 Aug 2022 11:50: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 1803B60C0B; Mon, 15 Aug 2022 18:50:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2207EC433C1; Mon, 15 Aug 2022 18:50:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589446; bh=tIKz9+929NqT6PMMyUvDAwRYbPa62dFJflF7B2Y/k20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gqBh8Hu8ZmBT90NtKdPXWjgbIaeq82N5fL8YcqMHuQwBXiL4yfQ8UPebV5UpMx2EB AHmgvZ+XT2uT6NSD/llPdRMdHjcNMei3T/hEd+Jtkj3mfdiXGwEBM+Hd7XhX93uC2H OCbjZU62L/iw8ch20g9p/QJ3PTOwQkzA2LmBQcAE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Luo Meng , Mike Snitzer , Sasha Levin Subject: [PATCH 5.15 720/779] dm thin: fix use-after-free crash in dm_sm_register_threshold_callback Date: Mon, 15 Aug 2022 20:06:04 +0200 Message-Id: <20220815180408.240186221@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Luo Meng [ Upstream commit 3534e5a5ed2997ca1b00f44a0378a075bd05e8a3 ] Fault inject on pool metadata device reports: BUG: KASAN: use-after-free in dm_pool_register_metadata_threshold+0x40/0x= 80 Read of size 8 at addr ffff8881b9d50068 by task dmsetup/950 CPU: 7 PID: 950 Comm: dmsetup Tainted: G W 5.19.0-rc6 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-1.fc33= 04/01/2014 Call Trace: dump_stack_lvl+0x34/0x44 print_address_description.constprop.0.cold+0xeb/0x3f4 kasan_report.cold+0xe6/0x147 dm_pool_register_metadata_threshold+0x40/0x80 pool_ctr+0xa0a/0x1150 dm_table_add_target+0x2c8/0x640 table_load+0x1fd/0x430 ctl_ioctl+0x2c4/0x5a0 dm_ctl_ioctl+0xa/0x10 __x64_sys_ioctl+0xb3/0xd0 do_syscall_64+0x35/0x80 entry_SYSCALL_64_after_hwframe+0x46/0xb0 This can be easily reproduced using: echo offline > /sys/block/sda/device/state dd if=3D/dev/zero of=3D/dev/mapper/thin bs=3D4k count=3D10 dmsetup load pool --table "0 20971520 thin-pool /dev/sda /dev/sdb 128 0 0" If a metadata commit fails, the transaction will be aborted and the metadata space maps will be destroyed. If a DM table reload then happens for this failed thin-pool, a use-after-free will occur in dm_sm_register_threshold_callback (called from dm_pool_register_metadata_threshold). Fix this by in dm_pool_register_metadata_threshold() by returning the -EINVAL error if the thin-pool is in fail mode. Also fail pool_ctr() with a new error message: "Error registering metadata threshold". Fixes: ac8c3f3df65e4 ("dm thin: generate event when metadata threshold pass= ed") Cc: stable@vger.kernel.org Reported-by: Hulk Robot Signed-off-by: Luo Meng Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/md/dm-thin-metadata.c | 7 +++++-- drivers/md/dm-thin.c | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/md/dm-thin-metadata.c b/drivers/md/dm-thin-metadata.c index c88ed14d49e6..0ada99572b68 100644 --- a/drivers/md/dm-thin-metadata.c +++ b/drivers/md/dm-thin-metadata.c @@ -2073,10 +2073,13 @@ int dm_pool_register_metadata_threshold(struct dm_p= ool_metadata *pmd, dm_sm_threshold_fn fn, void *context) { - int r; + int r =3D -EINVAL; =20 pmd_write_lock_in_core(pmd); - r =3D dm_sm_register_threshold_callback(pmd->metadata_sm, threshold, fn, = context); + if (!pmd->fail_io) { + r =3D dm_sm_register_threshold_callback(pmd->metadata_sm, + threshold, fn, context); + } pmd_write_unlock(pmd); =20 return r; diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index 4c67b77c23c1..0a85e4cd607c 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c @@ -3401,8 +3401,10 @@ static int pool_ctr(struct dm_target *ti, unsigned a= rgc, char **argv) calc_metadata_threshold(pt), metadata_low_callback, pool); - if (r) + if (r) { + ti->error =3D "Error registering metadata threshold"; goto out_flags_changed; + } =20 dm_pool_register_pre_commit_callback(pool->pmd, metadata_pre_commit_callback, pool); --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF265C00140 for ; Mon, 15 Aug 2022 19:54:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345440AbiHOTyD (ORCPT ); Mon, 15 Aug 2022 15:54:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241834AbiHOTw5 (ORCPT ); Mon, 15 Aug 2022 15:52:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 434E174CF8; Mon, 15 Aug 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 D51A861124; Mon, 15 Aug 2022 18:50:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E398DC433C1; Mon, 15 Aug 2022 18:50:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589449; bh=q44A+jOKC2968I3FZ8Bj23bK8j+2x2m6xVfyNM+BKh8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c6kOC/tI2MY9Ymwj2PtSwSPytNTKhNHooM1YTmK9R1S/SrgPlIqzGwdRscMGyGGy8 AA/VOn6hNyL1LUNxt2gVx2dE39llAMGW4boOxZ+hpzwkKmwxIL5nvy5lZEMpzRi5V6 d97m787wz2LuUfv98JQUlcaENXmXX6Z+zdthmMNU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tyler Hicks , Christian Schoenebeck , Dominique Martinet , Sasha Levin Subject: [PATCH 5.15 721/779] net/9p: Initialize the iounit field during fid creation Date: Mon, 15 Aug 2022 20:06:05 +0200 Message-Id: <20220815180408.290651873@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tyler Hicks [ Upstream commit aa7aeee169480e98cf41d83c01290a37e569be6d ] Ensure that the fid's iounit field is set to zero when a new fid is created. Certain 9P operations, such as OPEN and CREATE, allow the server to reply with an iounit size which the client code assigns to the p9_fid struct shortly after the fid is created by p9_fid_create(). On the other hand, an XATTRWALK operation doesn't allow for the server to specify an iounit value. The iounit field of the newly allocated p9_fid struct remained uninitialized in that case. Depending on allocation patterns, the iounit value could have been something reasonable that was carried over from previously freed fids or, in the worst case, could have been arbitrary values from non-fid related usages of the memory location. The bug was detected in the Windows Subsystem for Linux 2 (WSL2) kernel after the uninitialized iounit field resulted in the typical sequence of two getxattr(2) syscalls, one to get the size of an xattr and another after allocating a sufficiently sized buffer to fit the xattr value, to hit an unexpected ERANGE error in the second call to getxattr(2). An uninitialized iounit field would sometimes force rsize to be smaller than the xattr value size in p9_client_read_once() and the 9P server in WSL refused to chunk up the READ on the attr_fid and, instead, returned ERANGE to the client. The virtfs server in QEMU seems happy to chunk up the READ and this problem goes undetected there. Link: https://lkml.kernel.org/r/20220710141402.803295-1-tyhicks@linux.micro= soft.com Fixes: ebf46264a004 ("fs/9p: Add support user. xattr") Cc: stable@vger.kernel.org Signed-off-by: Tyler Hicks Reviewed-by: Christian Schoenebeck Signed-off-by: Dominique Martinet Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- net/9p/client.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/net/9p/client.c b/net/9p/client.c index 866f02e88c79..565aee6dfcc6 100644 --- a/net/9p/client.c +++ b/net/9p/client.c @@ -888,16 +888,13 @@ static struct p9_fid *p9_fid_create(struct p9_client = *clnt) struct p9_fid *fid; =20 p9_debug(P9_DEBUG_FID, "clnt %p\n", clnt); - fid =3D kmalloc(sizeof(*fid), GFP_KERNEL); + fid =3D kzalloc(sizeof(*fid), GFP_KERNEL); if (!fid) return NULL; =20 - memset(&fid->qid, 0, sizeof(fid->qid)); fid->mode =3D -1; fid->uid =3D current_fsuid(); fid->clnt =3D clnt; - fid->rdir =3D NULL; - fid->fid =3D 0; refcount_set(&fid->count, 1); =20 idr_preload(GFP_KERNEL); --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBB35C00140 for ; Mon, 15 Aug 2022 19:53:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232865AbiHOTxz (ORCPT ); Mon, 15 Aug 2022 15:53:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345407AbiHOTwt (ORCPT ); Mon, 15 Aug 2022 15:52:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BFA674DC9; Mon, 15 Aug 2022 11:50: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 B4607611F9; Mon, 15 Aug 2022 18:50:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB479C433D6; Mon, 15 Aug 2022 18:50:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589452; bh=Usk5Rcc72gd/aV45Alw/CxdbW2k19I0U8Vws3hmYVRY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GHg+S9856e0n590uaYgk3nd3c7pGqfaNH7b+jNCUDu4jSjOfbToaDXlMKOL09uto0 w8Pl0XHS8HzsK6d2JPZbDd6Y+GaTNHXw/WbSdUH9Qc6Ce4kwoJbDtARWVoE97d3AGG 7j3RQ6PUDA3GZD7a0ST3tJ9T3UmuDCcnxdpT1QPU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ard Biesheuvel , Arnd Bergmann , Linus Walleij , Keith Packard , Marc Zyngier , Sasha Levin , Vladimir Murzin Subject: [PATCH 5.15 722/779] ARM: remove some dead code Date: Mon, 15 Aug 2022 20:06:06 +0200 Message-Id: <20220815180408.330932233@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ard Biesheuvel [ Upstream commit 08572cd41955166e387d9b4984294d37f8f7526c ] This code appears to be no longer used so let's get rid of it. Signed-off-by: Ard Biesheuvel Reviewed-by: Arnd Bergmann Acked-by: Linus Walleij Tested-by: Keith Packard Tested-by: Marc Zyngier Tested-by: Vladimir Murzin # ARMv7M Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/arm/include/asm/entry-macro-multi.S | 24 ------------------------ arch/arm/include/asm/smp.h | 5 ----- arch/arm/kernel/smp.c | 5 ----- 3 files changed, 34 deletions(-) diff --git a/arch/arm/include/asm/entry-macro-multi.S b/arch/arm/include/as= m/entry-macro-multi.S index dfc6bfa43012..24486dad9e19 100644 --- a/arch/arm/include/asm/entry-macro-multi.S +++ b/arch/arm/include/asm/entry-macro-multi.S @@ -13,28 +13,4 @@ @ badrne lr, 1b bne asm_do_IRQ - -#ifdef CONFIG_SMP - /* - * XXX - * - * this macro assumes that irqstat (r2) and base (r6) are - * preserved from get_irqnr_and_base above - */ - ALT_SMP(test_for_ipi r0, r2, r6, lr) - ALT_UP_B(9997f) - movne r1, sp - badrne lr, 1b - bne do_IPI -#endif -9997: - .endm - - .macro arch_irq_handler, symbol_name - .align 5 - .global \symbol_name -\symbol_name: - mov r8, lr - arch_irq_handler_default - ret r8 .endm diff --git a/arch/arm/include/asm/smp.h b/arch/arm/include/asm/smp.h index 5d508f5d56c4..fc11ddf13b8f 100644 --- a/arch/arm/include/asm/smp.h +++ b/arch/arm/include/asm/smp.h @@ -24,11 +24,6 @@ struct seq_file; */ extern void show_ipi_list(struct seq_file *, int); =20 -/* - * Called from assembly code, this handles an IPI. - */ -asmlinkage void do_IPI(int ipinr, struct pt_regs *regs); - /* * Called from C code, this handles an IPI. */ diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c index 842427ff2b3c..23d369ab7e03 100644 --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c @@ -622,11 +622,6 @@ static void ipi_complete(unsigned int cpu) /* * Main handler for inter-processor interrupts */ -asmlinkage void __exception_irq_entry do_IPI(int ipinr, struct pt_regs *re= gs) -{ - handle_IPI(ipinr, regs); -} - static void do_handle_IPI(int ipinr) { unsigned int cpu =3D smp_processor_id(); --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19E6AC00140 for ; Mon, 15 Aug 2022 19:54:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241961AbiHOTyH (ORCPT ); Mon, 15 Aug 2022 15:54:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241858AbiHOTxD (ORCPT ); Mon, 15 Aug 2022 15:53:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7023AE3A; Mon, 15 Aug 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 ams.source.kernel.org (Postfix) with ESMTPS id 84D16B810A0; Mon, 15 Aug 2022 18:50:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B49BBC433D6; Mon, 15 Aug 2022 18:50:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589455; bh=PjvIlGHNLRN6F/T3nDYHHiN9EJ37PSPnqadsUE8gwZo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GmEh6MvrhqmWHwp9dPhNc00L1+oWLTWAiYHrysx1cXWbrEpdtpwGaUyZP1KyvcgVW H+5EIJlbl/16jjLO+2QfCHPWuy5z2W4sBZkc4sIw8YoNVd8XRx5V8/P+tYqNkkQ/QU AVZzbDypRBaiZIoJ7rh4VeuxDx/3bs2hn+DdW1KU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Gleixner , Eric Biggers , "Jason A. Donenfeld" , Sasha Levin Subject: [PATCH 5.15 723/779] timekeeping: contribute wall clock to rng on time change Date: Mon, 15 Aug 2022 20:06:07 +0200 Message-Id: <20220815180408.368575578@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 b8ac29b40183a6038919768b5d189c9bd91ce9b4 ] The rng's random_init() function contributes the real time to the rng at boot time, so that events can at least start in relation to something particular in the real world. But this clock might not yet be set that point in boot, so nothing is contributed. In addition, the relation between minor clock changes from, say, NTP, and the cycle counter is potentially useful entropic data. This commit addresses this by mixing in a time stamp on calls to settimeofday and adjtimex. No entropy is credited in doing so, so it doesn't make initialization faster, but it is still useful input to have. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Cc: stable@vger.kernel.org Reviewed-by: Thomas Gleixner Reviewed-by: Eric Biggers Signed-off-by: Jason A. Donenfeld Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- kernel/time/timekeeping.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index 871c912860ed..d6a0ff68df41 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -23,6 +23,7 @@ #include #include #include +#include =20 #include "tick-internal.h" #include "ntp_internal.h" @@ -1326,8 +1327,10 @@ int do_settimeofday64(const struct timespec64 *ts) /* Signal hrtimers about time change */ clock_was_set(CLOCK_SET_WALL); =20 - if (!ret) + if (!ret) { audit_tk_injoffset(ts_delta); + add_device_randomness(ts, sizeof(*ts)); + } =20 return ret; } @@ -2413,6 +2416,7 @@ int do_adjtimex(struct __kernel_timex *txc) ret =3D timekeeping_validate_timex(txc); if (ret) return ret; + add_device_randomness(txc, sizeof(*txc)); =20 if (txc->modes & ADJ_SETOFFSET) { struct timespec64 delta; @@ -2430,6 +2434,7 @@ int do_adjtimex(struct __kernel_timex *txc) audit_ntp_init(&ad); =20 ktime_get_real_ts64(&ts); + add_device_randomness(&ts, sizeof(ts)); =20 raw_spin_lock_irqsave(&timekeeper_lock, flags); write_seqcount_begin(&tk_core.seq); --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F6D0C00140 for ; Mon, 15 Aug 2022 19:54:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345545AbiHOTyW (ORCPT ); Mon, 15 Aug 2022 15:54:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344612AbiHOTxW (ORCPT ); Mon, 15 Aug 2022 15:53: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 3FDAF75381; Mon, 15 Aug 2022 11:51: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 D0BE860C0B; Mon, 15 Aug 2022 18:51:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CF283C433C1; Mon, 15 Aug 2022 18:51:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589461; bh=LR3N5+oQRgb7cEg49ztNE+Ds4xKavOMtfP3KjrzlCi4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1D8fU87JzlKk94yuryPXtPZNXsLKsxdZP3eMn2/V0lU9aqRZ8YAqU3Y5hZvsen5va qQeteEo5FkISC4KCdOcYkpN9F9tyRn9GSAvNGs1fcQJnUDIFdeYXASNcCySkAvm53V w9KvPtBOpdNGCDIKGoOg5R+l35fYV82UKTlG84AU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen jingwen , Chen Zhongjin , "Paul E. McKenney" , Sasha Levin Subject: [PATCH 5.15 724/779] locking/csd_lock: Change csdlock_debug from early_param to __setup Date: Mon, 15 Aug 2022 20:06:08 +0200 Message-Id: <20220815180408.415618303@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Zhongjin [ Upstream commit 9c9b26b0df270d4f9246e483a44686fca951a29c ] The csdlock_debug kernel-boot parameter is parsed by the early_param() function csdlock_debug(). If set, csdlock_debug() invokes static_branch_enable() to enable csd_lock_wait feature, which triggers a panic on arm64 for kernels built with CONFIG_SPARSEMEM=3Dy and CONFIG_SPARSEMEM_VMEMMAP=3Dn. With CONFIG_SPARSEMEM_VMEMMAP=3Dn, __nr_to_section is called in static_key_enable() and returns NULL, resulting in a NULL dereference because mem_section is initialized only later in sparse_init(). This is also a problem for powerpc because early_param() functions are invoked earlier than jump_label_init(), also resulting in static_key_enable() failures. These failures cause the warning "static key 'xxx' used before call to jump_label_init()". Thus, early_param is too early for csd_lock_wait to run static_branch_enable(), so changes it to __setup to fix these. Fixes: 8d0968cc6b8f ("locking/csd_lock: Add boot parameter for controlling = CSD lock debugging") Cc: stable@vger.kernel.org Reported-by: Chen jingwen Signed-off-by: Chen Zhongjin Signed-off-by: Paul E. McKenney Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- kernel/smp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/smp.c b/kernel/smp.c index b68d63e965db..82825345432c 100644 --- a/kernel/smp.c +++ b/kernel/smp.c @@ -174,9 +174,9 @@ static int __init csdlock_debug(char *str) if (val) static_branch_enable(&csdlock_debug_enabled); =20 - return 0; + return 1; } -early_param("csdlock_debug", csdlock_debug); +__setup("csdlock_debug=3D", csdlock_debug); =20 static DEFINE_PER_CPU(call_single_data_t *, cur_csd); static DEFINE_PER_CPU(smp_call_func_t, cur_csd_func); --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 580E3C3F6B0 for ; Mon, 15 Aug 2022 19:54:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245168AbiHOTyb (ORCPT ); Mon, 15 Aug 2022 15:54:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344820AbiHOTxX (ORCPT ); Mon, 15 Aug 2022 15:53:23 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 977A243E46; Mon, 15 Aug 2022 11:51: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 sin.source.kernel.org (Postfix) with ESMTPS id 08B1ACE1277; Mon, 15 Aug 2022 18:51:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CD10C433D6; Mon, 15 Aug 2022 18:51:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589464; bh=+UQocnMN1Hys/RDGl1WvOX6ccTsJTrL1UgEDQi+5uQs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XyFGDH9BoyuVP9HPmbqz4k7Xk3Xn658RX9g/9AcSJxpUCJue1ukjb2fcWpP4XS9bT jrEb6fHjPJKFUi5J3bPA8bOyDG+kIv2bms9SmPApc2g1BjfWAwmRz8fsOzjSYhe45f O+LB3Cl470orn+Zx19LTaIVQKhxthUUGxKd1ON2I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Johannes Thumshirn , Jens Axboe , Sasha Levin Subject: [PATCH 5.15 725/779] block: remove the struct blk_queue_ctx forward declaration Date: Mon, 15 Aug 2022 20:06:09 +0200 Message-Id: <20220815180408.455240860@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 9778ac77c2027827ffdbb33d3e936b3a0ae9f0f9 ] This type doesn't exist at all, so no need to forward declare it. Signed-off-by: Christoph Hellwig Reviewed-by: Johannes Thumshirn Link: https://lore.kernel.org/r/20210920123328.1399408-12-hch@lst.de Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- include/linux/blkdev.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index aebe67ed7a73..8863b4a378af 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -261,8 +261,6 @@ static inline unsigned short req_get_ioprio(struct requ= est *req) =20 #include =20 -struct blk_queue_ctx; - struct bio_vec; =20 enum blk_eh_timer_return { --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6482C00140 for ; Mon, 15 Aug 2022 19:54:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344894AbiHOTy1 (ORCPT ); Mon, 15 Aug 2022 15:54:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344797AbiHOTxX (ORCPT ); Mon, 15 Aug 2022 15:53: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 491B132045; Mon, 15 Aug 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 dfw.source.kernel.org (Postfix) with ESMTPS id DA24260C0B; Mon, 15 Aug 2022 18:51:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E194AC433D6; Mon, 15 Aug 2022 18:51:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589467; bh=ZDedPVNiO2p3vtp2hCa02ePm6bGyq2JGqgfFc1XihvI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FOIrey3DikGD1H/5HqZsfc5bdx6F24eTLUFvaOX6woMldCAMYD1vuJ4HcW0Z2/2tO McZbOYml9tr6cEtm66CThX0+vXzeKOAVkg0V2UlwBCBtp+EYQh4y945Eyon4jymnXO V3vSFi/uaLqmXTjrVkVvA9bksfTE8xMTHRykc318= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jinke Han , Muchun Song , Tejun Heo , Jens Axboe , Sasha Levin Subject: [PATCH 5.15 726/779] block: dont allow the same type rq_qos add more than once Date: Mon, 15 Aug 2022 20:06:10 +0200 Message-Id: <20220815180408.498309603@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jinke Han [ Upstream commit 14a6e2eb7df5c7897c15b109cba29ab0c4a791b6 ] In our test of iocost, we encountered some list add/del corruptions of inner_walk list in ioc_timer_fn. The reason can be described as follows: cpu 0 cpu 1 ioc_qos_write ioc_qos_write ioc =3D q_to_ioc(queue); if (!ioc) { ioc =3D kzalloc(); ioc =3D q_to_ioc(queue); if (!ioc) { ioc =3D kzalloc(); ... rq_qos_add(q, rqos); } ... rq_qos_add(q, rqos); ... } When the io.cost.qos file is written by two cpus concurrently, rq_qos may be added to one disk twice. In that case, there will be two iocs enabled and running on one disk. They own different iocgs on their active list. In the ioc_timer_fn function, because of the iocgs from two iocs have the same root iocg, the root iocg's walk_list may be overwritten by each other and this leads to list add/del corruptions in building or destroying the inner_walk list. And so far, the blk-rq-qos framework works in case that one instance for one type rq_qos per queue by default. This patch make this explicit and also fix the crash above. Signed-off-by: Jinke Han Reviewed-by: Muchun Song Acked-by: Tejun Heo Cc: Link: https://lore.kernel.org/r/20220720093616.70584-1-hanjinke.666@bytedan= ce.com Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- block/blk-iocost.c | 20 +++++++++++++------- block/blk-iolatency.c | 18 +++++++++++------- block/blk-rq-qos.h | 11 ++++++++++- block/blk-wbt.c | 12 +++++++++++- 4 files changed, 45 insertions(+), 16 deletions(-) diff --git a/block/blk-iocost.c b/block/blk-iocost.c index 10851493940c..069193dee95b 100644 --- a/block/blk-iocost.c +++ b/block/blk-iocost.c @@ -2893,15 +2893,21 @@ static int blk_iocost_init(struct request_queue *q) * called before policy activation completion, can't assume that the * target bio has an iocg associated and need to test for NULL iocg. */ - rq_qos_add(q, rqos); + ret =3D rq_qos_add(q, rqos); + if (ret) + goto err_free_ioc; + ret =3D blkcg_activate_policy(q, &blkcg_policy_iocost); - if (ret) { - rq_qos_del(q, rqos); - free_percpu(ioc->pcpu_stat); - kfree(ioc); - return ret; - } + if (ret) + goto err_del_qos; return 0; + +err_del_qos: + rq_qos_del(q, rqos); +err_free_ioc: + free_percpu(ioc->pcpu_stat); + kfree(ioc); + return ret; } =20 static struct blkcg_policy_data *ioc_cpd_alloc(gfp_t gfp) diff --git a/block/blk-iolatency.c b/block/blk-iolatency.c index d85f30a85ee7..bdef8395af6e 100644 --- a/block/blk-iolatency.c +++ b/block/blk-iolatency.c @@ -772,19 +772,23 @@ int blk_iolatency_init(struct request_queue *q) rqos->ops =3D &blkcg_iolatency_ops; rqos->q =3D q; =20 - rq_qos_add(q, rqos); - + ret =3D rq_qos_add(q, rqos); + if (ret) + goto err_free; ret =3D blkcg_activate_policy(q, &blkcg_policy_iolatency); - if (ret) { - rq_qos_del(q, rqos); - kfree(blkiolat); - return ret; - } + if (ret) + goto err_qos_del; =20 timer_setup(&blkiolat->timer, blkiolatency_timer_fn, 0); INIT_WORK(&blkiolat->enable_work, blkiolatency_enable_work_fn); =20 return 0; + +err_qos_del: + rq_qos_del(q, rqos); +err_free: + kfree(blkiolat); + return ret; } =20 static void iolatency_set_min_lat_nsec(struct blkcg_gq *blkg, u64 val) diff --git a/block/blk-rq-qos.h b/block/blk-rq-qos.h index 68267007da1c..1655f76b6a1b 100644 --- a/block/blk-rq-qos.h +++ b/block/blk-rq-qos.h @@ -86,7 +86,7 @@ static inline void rq_wait_init(struct rq_wait *rq_wait) init_waitqueue_head(&rq_wait->wait); } =20 -static inline void rq_qos_add(struct request_queue *q, struct rq_qos *rqos) +static inline int rq_qos_add(struct request_queue *q, struct rq_qos *rqos) { /* * No IO can be in-flight when adding rqos, so freeze queue, which @@ -98,6 +98,8 @@ static inline void rq_qos_add(struct request_queue *q, st= ruct rq_qos *rqos) blk_mq_freeze_queue(q); =20 spin_lock_irq(&q->queue_lock); + if (rq_qos_id(q, rqos->id)) + goto ebusy; rqos->next =3D q->rq_qos; q->rq_qos =3D rqos; spin_unlock_irq(&q->queue_lock); @@ -106,6 +108,13 @@ static inline void rq_qos_add(struct request_queue *q,= struct rq_qos *rqos) =20 if (rqos->ops->debugfs_attrs) blk_mq_debugfs_register_rqos(rqos); + + return 0; +ebusy: + spin_unlock_irq(&q->queue_lock); + blk_mq_unfreeze_queue(q); + return -EBUSY; + } =20 static inline void rq_qos_del(struct request_queue *q, struct rq_qos *rqos) diff --git a/block/blk-wbt.c b/block/blk-wbt.c index 0c119be0e813..ae6ea0b54579 100644 --- a/block/blk-wbt.c +++ b/block/blk-wbt.c @@ -820,6 +820,7 @@ int wbt_init(struct request_queue *q) { struct rq_wb *rwb; int i; + int ret; =20 rwb =3D kzalloc(sizeof(*rwb), GFP_KERNEL); if (!rwb) @@ -846,7 +847,10 @@ int wbt_init(struct request_queue *q) /* * Assign rwb and add the stats callback. */ - rq_qos_add(q, &rwb->rqos); + ret =3D rq_qos_add(q, &rwb->rqos); + if (ret) + goto err_free; + blk_stat_add_callback(q, rwb->cb); =20 rwb->min_lat_nsec =3D wbt_default_latency_nsec(q); @@ -855,4 +859,10 @@ int wbt_init(struct request_queue *q) wbt_set_write_cache(q, test_bit(QUEUE_FLAG_WC, &q->queue_flags)); =20 return 0; + +err_free: + blk_stat_free_callback(rwb->cb); + kfree(rwb); + return ret; + } --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D254C00140 for ; Mon, 15 Aug 2022 20:02:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242709AbiHOUCy (ORCPT ); Mon, 15 Aug 2022 16:02:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243336AbiHOUAC (ORCPT ); Mon, 15 Aug 2022 16:00:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D8487A502; Mon, 15 Aug 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 B235D61019; Mon, 15 Aug 2022 18:53:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7150C433D7; Mon, 15 Aug 2022 18:53:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589598; bh=Ka6V+AblFDor05JzdQLDm0z12H0wakbdE/hDgZPiTH8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p4rHM8OMnG7dean6qUv29rX7QPI+OR08Dt4U5cBeH4BxZOee8gG4OX9bZA5BB+qvy o3pEU4yOckREeFwPPKPNkCjX0r2/7+rJVunwfBTTMHGQp9VdS+yTBhhsDHnSbivAvn +TvBHWB5CkZvhaPM1AQLeL6KxHa0MZ3Pb4cLo3jA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Filipe Manana , Naohiro Aota , David Sterba , Sasha Levin Subject: [PATCH 5.15 727/779] btrfs: ensure pages are unlocked on cow_file_range() failure Date: Mon, 15 Aug 2022 20:06:11 +0200 Message-Id: <20220815180408.538286096@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 [ Upstream commit 9ce7466f372d83054c7494f6b3e4b9abaf3f0355 ] There is a hung_task report on zoned btrfs like below. https://github.com/naota/linux/issues/59 [726.328648] INFO: task rocksdb:high0:11085 blocked for more than 241 sec= onds. [726.329839] Not tainted 5.16.0-rc1+ #1 [726.330484] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables = this message. [726.331603] task:rocksdb:high0 state:D stack: 0 pid:11085 ppid: 110= 82 flags:0x00000000 [726.331608] Call Trace: [726.331611] [726.331614] __schedule+0x2e5/0x9d0 [726.331622] schedule+0x58/0xd0 [726.331626] io_schedule+0x3f/0x70 [726.331629] __folio_lock+0x125/0x200 [726.331634] ? find_get_entries+0x1bc/0x240 [726.331638] ? filemap_invalidate_unlock_two+0x40/0x40 [726.331642] truncate_inode_pages_range+0x5b2/0x770 [726.331649] truncate_inode_pages_final+0x44/0x50 [726.331653] btrfs_evict_inode+0x67/0x480 [726.331658] evict+0xd0/0x180 [726.331661] iput+0x13f/0x200 [726.331664] do_unlinkat+0x1c0/0x2b0 [726.331668] __x64_sys_unlink+0x23/0x30 [726.331670] do_syscall_64+0x3b/0xc0 [726.331674] entry_SYSCALL_64_after_hwframe+0x44/0xae [726.331677] RIP: 0033:0x7fb9490a171b [726.331681] RSP: 002b:00007fb943ffac68 EFLAGS: 00000246 ORIG_RAX: 000000= 0000000057 [726.331684] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fb9490= a171b [726.331686] RDX: 00007fb943ffb040 RSI: 000055a6bbe6ec20 RDI: 00007fb9440= 0d300 [726.331687] RBP: 00007fb943ffad00 R08: 0000000000000000 R09: 00000000000= 00000 [726.331688] R10: 0000000000000031 R11: 0000000000000246 R12: 00007fb943f= fb000 [726.331690] R13: 00007fb943ffb040 R14: 0000000000000000 R15: 00007fb943f= fd260 [726.331693] While we debug the issue, we found running fstests generic/551 on 5GB non-zoned null_blk device in the emulated zoned mode also had a similar hung issue. Also, we can reproduce the same symptom with an error injected cow_file_range() setup. The hang occurs when cow_file_range() fails in the middle of allocation. cow_file_range() called from do_allocation_zoned() can split the give region ([start, end]) for allocation depending on current block group usages. When btrfs can allocate bytes for one part of the split regions but fails for the other region (e.g. because of -ENOSPC), we return the error leaving the pages in the succeeded regions locked. Technically, this occurs only when @unlock =3D=3D 0. Otherwise, we unlock the pages in an allocated region after creating an ordered extent. Considering the callers of cow_file_range(unlock=3D0) won't write out the pages, we can unlock the pages on error exit from cow_file_range(). So, we can ensure all the pages except @locked_page are unlocked on error case. In summary, cow_file_range now behaves like this: - page_started =3D=3D 1 (return value) - All the pages are unlocked. IO is started. - unlock =3D=3D 1 - All the pages except @locked_page are unlocked in any case - unlock =3D=3D 0 - On success, all the pages are locked for writing out them - On failure, all the pages except @locked_page are unlocked Fixes: 42c011000963 ("btrfs: zoned: introduce dedicated data write path for= zoned filesystems") CC: stable@vger.kernel.org # 5.12+ Reviewed-by: Filipe Manana Signed-off-by: Naohiro Aota Signed-off-by: David Sterba Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/btrfs/inode.c | 72 ++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 64 insertions(+), 8 deletions(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 1b4fee8a2f28..20d0dea1d0c4 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -1053,6 +1053,28 @@ static u64 get_extent_allocation_hint(struct btrfs_i= node *inode, u64 start, * *page_started is set to one if we unlock locked_page and do everything * required to start IO on it. It may be clean and already done with * IO when we return. + * + * When unlock =3D=3D 1, we unlock the pages in successfully allocated reg= ions. + * When unlock =3D=3D 0, we leave them locked for writing them out. + * + * However, we unlock all the pages except @locked_page in case of failure. + * + * In summary, page locking state will be as follow: + * + * - page_started =3D=3D 1 (return value) + * - All the pages are unlocked. IO is started. + * - Note that this can happen only on success + * - unlock =3D=3D 1 + * - All the pages except @locked_page are unlocked in any case + * - unlock =3D=3D 0 + * - On success, all the pages are locked for writing out them + * - On failure, all the pages except @locked_page are unlocked + * + * When a failure happens in the second or later iteration of the + * while-loop, the ordered extents created in previous iterations are kept + * intact. So, the caller must clean them up by calling + * btrfs_cleanup_ordered_extents(). See btrfs_run_delalloc_range() for + * example. */ static noinline int cow_file_range(struct btrfs_inode *inode, struct page *locked_page, @@ -1062,6 +1084,7 @@ static noinline int cow_file_range(struct btrfs_inode= *inode, struct btrfs_root *root =3D inode->root; struct btrfs_fs_info *fs_info =3D root->fs_info; u64 alloc_hint =3D 0; + u64 orig_start =3D start; u64 num_bytes; unsigned long ram_size; u64 cur_alloc_size =3D 0; @@ -1245,18 +1268,44 @@ static noinline int cow_file_range(struct btrfs_ino= de *inode, btrfs_dec_block_group_reservations(fs_info, ins.objectid); btrfs_free_reserved_extent(fs_info, ins.objectid, ins.offset, 1); out_unlock: + /* + * Now, we have three regions to clean up: + * + * |-------(1)----|---(2)---|-------------(3)----------| + * `- orig_start `- start `- start + cur_alloc_size `- end + * + * We process each region below. + */ + clear_bits =3D EXTENT_LOCKED | EXTENT_DELALLOC | EXTENT_DELALLOC_NEW | EXTENT_DEFRAG | EXTENT_CLEAR_META_RESV; page_ops =3D PAGE_UNLOCK | PAGE_START_WRITEBACK | PAGE_END_WRITEBACK; + /* - * If we reserved an extent for our delalloc range (or a subrange) and - * failed to create the respective ordered extent, then it means that - * when we reserved the extent we decremented the extent's size from - * the data space_info's bytes_may_use counter and incremented the - * space_info's bytes_reserved counter by the same amount. We must make - * sure extent_clear_unlock_delalloc() does not try to decrement again - * the data space_info's bytes_may_use counter, therefore we do not pass - * it the flag EXTENT_CLEAR_DATA_RESV. + * For the range (1). We have already instantiated the ordered extents + * for this region. They are cleaned up by + * btrfs_cleanup_ordered_extents() in e.g, + * btrfs_run_delalloc_range(). EXTENT_LOCKED | EXTENT_DELALLOC are + * already cleared in the above loop. And, EXTENT_DELALLOC_NEW | + * EXTENT_DEFRAG | EXTENT_CLEAR_META_RESV are handled by the cleanup + * function. + * + * However, in case of unlock =3D=3D 0, we still need to unlock the pages + * (except @locked_page) to ensure all the pages are unlocked. + */ + if (!unlock && orig_start < start) + extent_clear_unlock_delalloc(inode, orig_start, start - 1, + locked_page, 0, page_ops); + + /* + * For the range (2). If we reserved an extent for our delalloc range + * (or a subrange) and failed to create the respective ordered extent, + * then it means that when we reserved the extent we decremented the + * extent's size from the data space_info's bytes_may_use counter and + * incremented the space_info's bytes_reserved counter by the same + * amount. We must make sure extent_clear_unlock_delalloc() does not try + * to decrement again the data space_info's bytes_may_use counter, + * therefore we do not pass it the flag EXTENT_CLEAR_DATA_RESV. */ if (extent_reserved) { extent_clear_unlock_delalloc(inode, start, @@ -1268,6 +1317,13 @@ static noinline int cow_file_range(struct btrfs_inod= e *inode, if (start >=3D end) goto out; } + + /* + * For the range (3). We never touched the region. In addition to the + * clear_bits above, we add EXTENT_CLEAR_DATA_RESV to release the data + * space_info's bytes_may_use counter, reserved in + * btrfs_check_data_free_space(). + */ extent_clear_unlock_delalloc(inode, start, end, locked_page, clear_bits | EXTENT_CLEAR_DATA_RESV, page_ops); --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2FFDC00140 for ; Mon, 15 Aug 2022 19:55:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244282AbiHOTzS (ORCPT ); Mon, 15 Aug 2022 15:55:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243301AbiHOTx1 (ORCPT ); Mon, 15 Aug 2022 15:53:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E0824507A; Mon, 15 Aug 2022 11:51: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 02927611D6; Mon, 15 Aug 2022 18:51:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E84A8C433C1; Mon, 15 Aug 2022 18:51:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589494; bh=KgM26IDDNeoeGPt3vo1EHsfuuNWehWz9F9mk5GOilFA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zDY5cRNggENnN4/U10hQqt0RxcOQaK9Fl7IDPlBbXbna+UOgsFJWA2ko/pgqfkoVF BRFpAWu5Dg1bT7TgyfItWng4YHF3hwAvWzw0Rleo4ApSsR3IHEF0cH8Pa99VKCXvPI PlwtWzE3BcIZUu3TZHLwT8X4cfR4SN/ENUaHrmR8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Filipe Manana , Josef Bacik , David Sterba , Sasha Levin Subject: [PATCH 5.15 728/779] btrfs: reset block group chunk force if we have to wait Date: Mon, 15 Aug 2022 20:06:12 +0200 Message-Id: <20220815180408.573445546@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Josef Bacik [ Upstream commit 1314ca78b2c35d3e7d0f097268a2ee6dc0d369ef ] If you try to force a chunk allocation, but you race with another chunk allocation, you will end up waiting on the chunk allocation that just occurred and then allocate another chunk. If you have many threads all doing this at once you can way over-allocate chunks. Fix this by resetting force to NO_FORCE, that way if we think we need to allocate we can, otherwise we don't force another chunk allocation if one is already happening. Reviewed-by: Filipe Manana CC: stable@vger.kernel.org # 5.4+ Signed-off-by: Josef Bacik Signed-off-by: David Sterba Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/btrfs/block-group.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/btrfs/block-group.c b/fs/btrfs/block-group.c index c6c5a22ff6e8..4b2282aa274e 100644 --- a/fs/btrfs/block-group.c +++ b/fs/btrfs/block-group.c @@ -3632,6 +3632,7 @@ int btrfs_chunk_alloc(struct btrfs_trans_handle *tran= s, u64 flags, * attempt. */ wait_for_alloc =3D true; + force =3D CHUNK_ALLOC_NO_FORCE; spin_unlock(&space_info->lock); mutex_lock(&fs_info->chunk_mutex); mutex_unlock(&fs_info->chunk_mutex); --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 416DAC00140 for ; Mon, 15 Aug 2022 19:58:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239749AbiHOT6D (ORCPT ); Mon, 15 Aug 2022 15:58:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345593AbiHOTyq (ORCPT ); Mon, 15 Aug 2022 15:54:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FAB5474D0; Mon, 15 Aug 2022 11:52: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 3316C6122A; Mon, 15 Aug 2022 18:52:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40180C433C1; Mon, 15 Aug 2022 18:52:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589528; bh=vRllzNOW7z4C9KZEF8OVgn21/Jd/wEYuUh01kNRgf3A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n55nGjSPQrB5eYpvE+A/vhwhm0nI2bsa3T86fCCq6seoaUtNhN0bLAjkX9Gb4mzpS 2QmqLymPy7egZZNMq9XiHvvV8J9rquzeTGHDPKzsE9Gfjw3/XuV+CQes0wWzTvwlXd 8On3lP9V+WBQBic3jtBS+I7dI9FThL2AZTHgY1+E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qu Wenruo , Nikolay Borisov , David Sterba , Sasha Levin Subject: [PATCH 5.15 729/779] btrfs: properly flag filesystem with BTRFS_FEATURE_INCOMPAT_BIG_METADATA Date: Mon, 15 Aug 2022 20:06:13 +0200 Message-Id: <20220815180408.608022252@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 e26b04c4c91925dba57324db177a24e18e2d0013 ] Commit 6f93e834fa7c seemingly inadvertently moved the code responsible for flagging the filesystem as having BIG_METADATA to a place where setting the flag was essentially lost. This means that filesystems created with kernels containing this bug (starting with 5.15) can potentially be mounted by older (pre-3.4) kernels. In reality chances for this happening are low because there are other incompat flags introduced in the mean time. Still the correct behavior is to set INCOMPAT_BIG_METADATA flag and persist this in the superblock. Fixes: 6f93e834fa7c ("btrfs: fix upper limit for max_inline for page size 6= 4K") CC: stable@vger.kernel.org # 5.4+ Reviewed-by: Qu Wenruo Signed-off-by: Nikolay Borisov Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/btrfs/disk-io.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 383e9c861306..e65c3039caf1 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -3337,16 +3337,6 @@ int __cold open_ctree(struct super_block *sb, struct= btrfs_fs_devices *fs_device */ fs_info->compress_type =3D BTRFS_COMPRESS_ZLIB; =20 - /* - * Flag our filesystem as having big metadata blocks if they are bigger - * than the page size. - */ - if (btrfs_super_nodesize(disk_super) > PAGE_SIZE) { - if (!(features & BTRFS_FEATURE_INCOMPAT_BIG_METADATA)) - btrfs_info(fs_info, - "flagging fs with big metadata feature"); - features |=3D BTRFS_FEATURE_INCOMPAT_BIG_METADATA; - } =20 /* Set up fs_info before parsing mount options */ nodesize =3D btrfs_super_nodesize(disk_super); @@ -3387,6 +3377,17 @@ int __cold open_ctree(struct super_block *sb, struct= btrfs_fs_devices *fs_device if (features & BTRFS_FEATURE_INCOMPAT_SKINNY_METADATA) btrfs_info(fs_info, "has skinny extents"); =20 + /* + * Flag our filesystem as having big metadata blocks if they are bigger + * than the page size. + */ + if (btrfs_super_nodesize(disk_super) > PAGE_SIZE) { + if (!(features & BTRFS_FEATURE_INCOMPAT_BIG_METADATA)) + btrfs_info(fs_info, + "flagging fs with big metadata feature"); + features |=3D BTRFS_FEATURE_INCOMPAT_BIG_METADATA; + } + /* * mixed block groups end up with duplicate but slightly offset * extent buffers for the same range. It leads to corruptions --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F00BC00140 for ; Mon, 15 Aug 2022 19:59:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230123AbiHOT67 (ORCPT ); Mon, 15 Aug 2022 15:58:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345997AbiHOT4w (ORCPT ); Mon, 15 Aug 2022 15:56:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1BB578200; Mon, 15 Aug 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 39D4FB810AB; Mon, 15 Aug 2022 18:52:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FAF0C433C1; Mon, 15 Aug 2022 18:52:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589562; bh=eFaHFkpV57iAEFT1udc1njZg4czBYhPhe2DlhD1mYqw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BtpWjTC6wzHXVStPWPzc4P8fkfBb5UYkcHR+WEYJyLnAkWKYZG6ONFGLkH9kXic4G Ld4WuPPxbLY3i/MEl210b8ZAVSJ1X6RnjlYIKDw/bfSzWL6MsLgBFkvIYGQl0xh1uF UGNQY8UYW2fb7Ra8O8TfGgRusBfGmOuTYhbuclm8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.15 730/779] ACPI: CPPC: Do not prevent CPPC from working in the future Date: Mon, 15 Aug 2022 20:06:14 +0200 Message-Id: <20220815180408.656338304@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rafael J. Wysocki [ Upstream commit 4f4179fcf420873002035cf1941d844c9e0e7cb3 ] There is a problem with the current revision checks in is_cppc_supported() that they essentially prevent the CPPC support from working if a new _CPC package format revision being a proper superset of the v3 and only causing _CPC to return a package with more entries (while retaining the types and meaning of the entries defined by the v3) is introduced in the future and used by the platform firmware. In that case, as long as the number of entries in the _CPC return package is at least CPPC_V3_NUM_ENT, it should be perfectly fine to use the v3 support code and disregard the additional package entries added by the new package format revision. For this reason, drop is_cppc_supported() altogether, put the revision checks directly into acpi_cppc_processor_probe() so they are easier to follow and rework them to take the case mentioned above into account. Fixes: 4773e77cdc9b ("ACPI / CPPC: Add support for CPPC v3") Cc: 4.18+ # 4.18+ Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/acpi/cppc_acpi.c | 54 ++++++++++++++++++---------------------- include/acpi/cppc_acpi.h | 2 +- 2 files changed, 25 insertions(+), 31 deletions(-) diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c index ed1341030684..7cc9183c8dc8 100644 --- a/drivers/acpi/cppc_acpi.c +++ b/drivers/acpi/cppc_acpi.c @@ -597,33 +597,6 @@ static int pcc_data_alloc(int pcc_ss_id) return 0; } =20 -/* Check if CPPC revision + num_ent combination is supported */ -static bool is_cppc_supported(int revision, int num_ent) -{ - int expected_num_ent; - - switch (revision) { - case CPPC_V2_REV: - expected_num_ent =3D CPPC_V2_NUM_ENT; - break; - case CPPC_V3_REV: - expected_num_ent =3D CPPC_V3_NUM_ENT; - break; - default: - pr_debug("Firmware exports unsupported CPPC revision: %d\n", - revision); - return false; - } - - if (expected_num_ent !=3D num_ent) { - pr_debug("Firmware exports %d entries. Expected: %d for CPPC rev:%d\n", - num_ent, expected_num_ent, revision); - return false; - } - - return true; -} - /* * An example CPC table looks like the following. * @@ -723,7 +696,6 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr) cpc_obj->type); goto out_free; } - cpc_ptr->num_entries =3D num_ent; =20 /* Second entry should be revision. */ cpc_obj =3D &out_obj->package.elements[1]; @@ -734,10 +706,32 @@ int acpi_cppc_processor_probe(struct acpi_processor *= pr) cpc_obj->type); goto out_free; } - cpc_ptr->version =3D cpc_rev; =20 - if (!is_cppc_supported(cpc_rev, num_ent)) + if (cpc_rev < CPPC_V2_REV) { + pr_debug("Unsupported _CPC Revision (%d) for CPU:%d\n", cpc_rev, + pr->id); + goto out_free; + } + + /* + * Disregard _CPC if the number of entries in the return pachage is not + * as expected, but support future revisions being proper supersets of + * the v3 and only causing more entries to be returned by _CPC. + */ + if ((cpc_rev =3D=3D CPPC_V2_REV && num_ent !=3D CPPC_V2_NUM_ENT) || + (cpc_rev =3D=3D CPPC_V3_REV && num_ent !=3D CPPC_V3_NUM_ENT) || + (cpc_rev > CPPC_V3_REV && num_ent <=3D CPPC_V3_NUM_ENT)) { + pr_debug("Unexpected number of _CPC return package entries (%d) for CPU:= %d\n", + num_ent, pr->id); goto out_free; + } + if (cpc_rev > CPPC_V3_REV) { + num_ent =3D CPPC_V3_NUM_ENT; + cpc_rev =3D CPPC_V3_REV; + } + + cpc_ptr->num_entries =3D num_ent; + cpc_ptr->version =3D cpc_rev; =20 /* Iterate through remaining entries in _CPC */ for (i =3D 2; i < num_ent; i++) { diff --git a/include/acpi/cppc_acpi.h b/include/acpi/cppc_acpi.h index bc159a9b4a73..6b14414b9ec1 100644 --- a/include/acpi/cppc_acpi.h +++ b/include/acpi/cppc_acpi.h @@ -17,7 +17,7 @@ #include #include =20 -/* Support CPPCv2 and CPPCv3 */ +/* CPPCv2 and CPPCv3 support */ #define CPPC_V2_REV 2 #define CPPC_V3_REV 3 #define CPPC_V2_NUM_ENT 21 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48B21C00140 for ; Mon, 15 Aug 2022 19:59:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345364AbiHOT71 (ORCPT ); Mon, 15 Aug 2022 15:59:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346122AbiHOT5M (ORCPT ); Mon, 15 Aug 2022 15:57: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 766CF78239; Mon, 15 Aug 2022 11:53: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 B3C20B810A2; Mon, 15 Aug 2022 18:52:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08C8FC433D6; Mon, 15 Aug 2022 18:52:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589578; bh=Mm2TQnNtAU1OIa9pBcT16BOP94kV2EU0Mc9jDIVa3Rs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=llK3758Nd4M/3hu6Gtk5Z1psApLfY302/P6Gyoy4sU0MTMQk1MsyGpZYkGpBt72M1 tlHPO9J4QJMt4cAZxrUOzeBAqI7CjYv6GkHgD0nof5qW7Dz6Uzq4PQHojWPOARR5+H 0hDOd81vYhUaYSGFnSGQhei7v35nhnmIltdKUcUI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Jason A. Donenfeld" , Sachin Sant , Michael Ellerman , Sasha Levin Subject: [PATCH 5.15 731/779] powerpc/powernv/kvm: Use darn for H_RANDOM on Power9 Date: Mon, 15 Aug 2022 20:06:15 +0200 Message-Id: <20220815180408.693168428@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 7ef3d06f1bc4a5e62273726f3dc2bd258ae1c71f ] The existing logic in KVM to support guests calling H_RANDOM only works on Power8, because it looks for an RNG in the device tree, but on Power9 we just use darn. In addition the existing code needs to work in real mode, so we have the special cased powernv_get_random_real_mode() to deal with that. Instead just have KVM call ppc_md.get_random_seed(), and do the real mode check inside of there, that way we use whatever RNG is available, including darn on Power9. Fixes: e928e9cb3601 ("KVM: PPC: Book3S HV: Add fast real-mode H_RANDOM impl= ementation.") Cc: stable@vger.kernel.org # v4.1+ Signed-off-by: Jason A. Donenfeld Tested-by: Sachin Sant [mpe: Rebase on previous commit, update change log appropriately] Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220727143219.2684192-2-mpe@ellerman.id.au Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/powerpc/include/asm/archrandom.h | 5 ---- arch/powerpc/kvm/book3s_hv_builtin.c | 7 +++--- arch/powerpc/platforms/powernv/rng.c | 36 ++++++--------------------- 3 files changed, 12 insertions(+), 36 deletions(-) diff --git a/arch/powerpc/include/asm/archrandom.h b/arch/powerpc/include/a= sm/archrandom.h index 9a53e29680f4..258174304904 100644 --- a/arch/powerpc/include/asm/archrandom.h +++ b/arch/powerpc/include/asm/archrandom.h @@ -38,12 +38,7 @@ static inline bool __must_check arch_get_random_seed_int= (unsigned int *v) #endif /* CONFIG_ARCH_RANDOM */ =20 #ifdef CONFIG_PPC_POWERNV -int powernv_hwrng_present(void); int powernv_get_random_long(unsigned long *v); -int powernv_get_random_real_mode(unsigned long *v); -#else -static inline int powernv_hwrng_present(void) { return 0; } -static inline int powernv_get_random_real_mode(unsigned long *v) { return = 0; } #endif =20 #endif /* _ASM_POWERPC_ARCHRANDOM_H */ diff --git a/arch/powerpc/kvm/book3s_hv_builtin.c b/arch/powerpc/kvm/book3s= _hv_builtin.c index 70b7a8f97153..b148629b7f03 100644 --- a/arch/powerpc/kvm/book3s_hv_builtin.c +++ b/arch/powerpc/kvm/book3s_hv_builtin.c @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include @@ -177,13 +177,14 @@ EXPORT_SYMBOL_GPL(kvmppc_hcall_impl_hv_realmode); =20 int kvmppc_hwrng_present(void) { - return powernv_hwrng_present(); + return ppc_md.get_random_seed !=3D NULL; } EXPORT_SYMBOL_GPL(kvmppc_hwrng_present); =20 long kvmppc_rm_h_random(struct kvm_vcpu *vcpu) { - if (powernv_get_random_real_mode(&vcpu->arch.regs.gpr[4])) + if (ppc_md.get_random_seed && + ppc_md.get_random_seed(&vcpu->arch.regs.gpr[4])) return H_SUCCESS; =20 return H_HARDWARE; diff --git a/arch/powerpc/platforms/powernv/rng.c b/arch/powerpc/platforms/= powernv/rng.c index a99033c3dce7..5f81ff9b5265 100644 --- a/arch/powerpc/platforms/powernv/rng.c +++ b/arch/powerpc/platforms/powernv/rng.c @@ -29,15 +29,6 @@ struct powernv_rng { =20 static DEFINE_PER_CPU(struct powernv_rng *, powernv_rng); =20 -int powernv_hwrng_present(void) -{ - struct powernv_rng *rng; - - rng =3D get_cpu_var(powernv_rng); - put_cpu_var(rng); - return rng !=3D NULL; -} - static unsigned long rng_whiten(struct powernv_rng *rng, unsigned long val) { unsigned long parity; @@ -58,19 +49,6 @@ static unsigned long rng_whiten(struct powernv_rng *rng,= unsigned long val) return val; } =20 -int powernv_get_random_real_mode(unsigned long *v) -{ - struct powernv_rng *rng; - - rng =3D raw_cpu_read(powernv_rng); - if (!rng) - return 0; - - *v =3D rng_whiten(rng, __raw_rm_readq(rng->regs_real)); - - return 1; -} - static int powernv_get_random_darn(unsigned long *v) { unsigned long val; @@ -107,12 +85,14 @@ int powernv_get_random_long(unsigned long *v) { struct powernv_rng *rng; =20 - rng =3D get_cpu_var(powernv_rng); - - *v =3D rng_whiten(rng, in_be64(rng->regs)); - - put_cpu_var(rng); - + if (mfmsr() & MSR_DR) { + rng =3D get_cpu_var(powernv_rng); + *v =3D rng_whiten(rng, in_be64(rng->regs)); + put_cpu_var(rng); + } else { + rng =3D raw_cpu_read(powernv_rng); + *v =3D rng_whiten(rng, __raw_rm_readq(rng->regs_real)); + } return 1; } EXPORT_SYMBOL_GPL(powernv_get_random_long); --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 752B9C00140 for ; Mon, 15 Aug 2022 19:59:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240830AbiHOT7v (ORCPT ); Mon, 15 Aug 2022 15:59:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345660AbiHOT6W (ORCPT ); Mon, 15 Aug 2022 15:58:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99692792FE; Mon, 15 Aug 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 ams.source.kernel.org (Postfix) with ESMTPS id DCD63B81057; Mon, 15 Aug 2022 18:53:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27ACAC433D6; Mon, 15 Aug 2022 18:53:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589581; bh=1Cpy7+aPtuEzJ22bqjta9zfttknw7/UCqccOdf11h9E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E/+M8AwcyaD+tBkSgU34HvVNY86YmMSjp+VzSamu3FWrFyu14BrmWXfStrZYgf4O/ Lpj/pENhdRx6ndaP2TcoTJUzWDPii7428a8NtlaZBrAMOZ+EkwNicCjA8Z76lzCBtL Uu+os3uafeWCtu0M/L7+JNXoOPcdDROZpG+uto4Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Luwei Kang , Like Xu , "Peter Zijlstra (Intel)" , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.15 732/779] KVM: x86/pmu: Introduce the ctrl_mask value for fixed counter Date: Mon, 15 Aug 2022 20:06:16 +0200 Message-Id: <20220815180408.743931626@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Like Xu [ Upstream commit 2c985527dd8d283e786ad7a67e532ef7f6f00fac ] The mask value of fixed counter control register should be dynamic adjusted with the number of fixed counters. This patch introduces a variable that includes the reserved bits of fixed counter control registers. This is a generic code refactoring. Co-developed-by: Luwei Kang Signed-off-by: Luwei Kang Signed-off-by: Like Xu Acked-by: Peter Zijlstra (Intel) Message-Id: <20220411101946.20262-6-likexu@tencent.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/x86/include/asm/kvm_host.h | 1 + arch/x86/kvm/vmx/pmu_intel.c | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_hos= t.h index 83ec98a527a3..74b5819120da 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -498,6 +498,7 @@ struct kvm_pmu { unsigned nr_arch_fixed_counters; unsigned available_event_types; u64 fixed_ctr_ctrl; + u64 fixed_ctr_ctrl_mask; u64 global_ctrl; u64 global_status; u64 global_ovf_ctrl; diff --git a/arch/x86/kvm/vmx/pmu_intel.c b/arch/x86/kvm/vmx/pmu_intel.c index e7275ce15a8b..9aee082deee9 100644 --- a/arch/x86/kvm/vmx/pmu_intel.c +++ b/arch/x86/kvm/vmx/pmu_intel.c @@ -402,7 +402,7 @@ static int intel_pmu_set_msr(struct kvm_vcpu *vcpu, str= uct msr_data *msr_info) case MSR_CORE_PERF_FIXED_CTR_CTRL: if (pmu->fixed_ctr_ctrl =3D=3D data) return 0; - if (!(data & 0xfffffffffffff444ull)) { + if (!(data & pmu->fixed_ctr_ctrl_mask)) { reprogram_fixed_counters(pmu, data); return 0; } @@ -472,6 +472,7 @@ static void intel_pmu_refresh(struct kvm_vcpu *vcpu) struct kvm_cpuid_entry2 *entry; union cpuid10_eax eax; union cpuid10_edx edx; + int i; =20 pmu->nr_arch_gp_counters =3D 0; pmu->nr_arch_fixed_counters =3D 0; @@ -480,6 +481,7 @@ static void intel_pmu_refresh(struct kvm_vcpu *vcpu) pmu->version =3D 0; pmu->reserved_bits =3D 0xffffffff00200000ull; pmu->raw_event_mask =3D X86_RAW_EVENT_MASK; + pmu->fixed_ctr_ctrl_mask =3D ~0ull; =20 entry =3D kvm_find_cpuid_entry(vcpu, 0xa, 0); if (!entry) @@ -513,6 +515,8 @@ static void intel_pmu_refresh(struct kvm_vcpu *vcpu) ((u64)1 << edx.split.bit_width_fixed) - 1; } =20 + for (i =3D 0; i < pmu->nr_arch_fixed_counters; i++) + pmu->fixed_ctr_ctrl_mask &=3D ~(0xbull << (i * 4)); pmu->global_ctrl =3D ((1ull << pmu->nr_arch_gp_counters) - 1) | (((1ull << pmu->nr_arch_fixed_counters) - 1) << INTEL_PMC_IDX_FIXED); pmu->global_ctrl_mask =3D ~pmu->global_ctrl; --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A004C00140 for ; Mon, 15 Aug 2022 20:00:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345772AbiHOT76 (ORCPT ); Mon, 15 Aug 2022 15:59:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345778AbiHOT6s (ORCPT ); Mon, 15 Aug 2022 15:58:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2A3A7969F; Mon, 15 Aug 2022 11:53: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 21381B810A1; Mon, 15 Aug 2022 18:53:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55E58C433D6; Mon, 15 Aug 2022 18:53:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589584; bh=9jS12HDIWC0T9azvy4cCObcvIYGFP6TeIXYbDNOHqdg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tr2WcezsiqjsC1vb2Fcir6NyEbrZ4djtBTy3k3cJVx4I2n+U3BO+vxtRPOKaoovlt GO4zvlyriDWCxLB2r5xQ5CZej15MaYr0cGO7qgM7/sYK7ai+sY/qyJFY2Tc6CkPvAI BSuIP2W2OPNd+gRhet48lc91ZCi/kFJMUno7HC6g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.15 733/779] KVM: VMX: Mark all PERF_GLOBAL_(OVF)_CTRL bits reserved if theres no vPMU Date: Mon, 15 Aug 2022 20:06:17 +0200 Message-Id: <20220815180408.784807511@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson [ Upstream commit 93255bf92939d948bc86d81c6bb70bb0fecc5db1 ] Mark all MSR_CORE_PERF_GLOBAL_CTRL and MSR_CORE_PERF_GLOBAL_OVF_CTRL bits as reserved if there is no guest vPMU. The nVMX VM-Entry consistency checks do not check for a valid vPMU prior to consuming the masks via kvm_valid_perf_global_ctrl(), i.e. may incorrectly allow a non-zero mask to be loaded via VM-Enter or VM-Exit (well, attempted to be loaded, the actual MSR load will be rejected by intel_is_valid_msr()). Fixes: f5132b01386b ("KVM: Expose a version 2 architectural PMU to a guests= ") Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson Message-Id: <20220722224409.1336532-3-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/x86/kvm/vmx/pmu_intel.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/x86/kvm/vmx/pmu_intel.c b/arch/x86/kvm/vmx/pmu_intel.c index 9aee082deee9..c66edf93e4a8 100644 --- a/arch/x86/kvm/vmx/pmu_intel.c +++ b/arch/x86/kvm/vmx/pmu_intel.c @@ -481,6 +481,8 @@ static void intel_pmu_refresh(struct kvm_vcpu *vcpu) pmu->version =3D 0; pmu->reserved_bits =3D 0xffffffff00200000ull; pmu->raw_event_mask =3D X86_RAW_EVENT_MASK; + pmu->global_ctrl_mask =3D ~0ull; + pmu->global_ovf_ctrl_mask =3D ~0ull; pmu->fixed_ctr_ctrl_mask =3D ~0ull; =20 entry =3D kvm_find_cpuid_entry(vcpu, 0xa, 0); --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D279EC00140 for ; Mon, 15 Aug 2022 20:00:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345806AbiHOUAD (ORCPT ); Mon, 15 Aug 2022 16:00:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241858AbiHOT7G (ORCPT ); Mon, 15 Aug 2022 15:59:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A317796B5; Mon, 15 Aug 2022 11:53: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 716D9B810A6; Mon, 15 Aug 2022 18:53:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85AD9C433C1; Mon, 15 Aug 2022 18:53:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589588; bh=WFP8opjL5wR21vO6sG4t40QfsjTNuVfWGHPP07Rlybo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HtzVKsv/EIu50ovEQn3dS1UPbheZ2qYSZeHhJGWbv9NFg70W5hWRsTVgf874cVeee uxQylTKNmtR6P2Hihvo72DzgeqnbfTu9Lwn71aSO6xH37PpL1f+5YCRu66sXvsNsUH vgbtuHjBL5XIoc0wgAeoFoFogepf56MGBPSWsKX4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Like Xu , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.15 734/779] KVM: x86/pmu: Ignore pmu->global_ctrl check if vPMU doesnt support global_ctrl Date: Mon, 15 Aug 2022 20:06:18 +0200 Message-Id: <20220815180408.824384578@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Like Xu [ Upstream commit 98defd2e17803263f49548fea930cfc974d505aa ] MSR_CORE_PERF_GLOBAL_CTRL is introduced as part of Architecture PMU V2, as indicated by Intel SDM 19.2.2 and the intel_is_valid_msr() function. So in the absence of global_ctrl support, all PMCs are enabled as AMD does. Signed-off-by: Like Xu Message-Id: <20220509102204.62389-1-likexu@tencent.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/x86/kvm/vmx/pmu_intel.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/kvm/vmx/pmu_intel.c b/arch/x86/kvm/vmx/pmu_intel.c index c66edf93e4a8..f9054e7ec89e 100644 --- a/arch/x86/kvm/vmx/pmu_intel.c +++ b/arch/x86/kvm/vmx/pmu_intel.c @@ -104,6 +104,9 @@ static bool intel_pmc_is_enabled(struct kvm_pmc *pmc) { struct kvm_pmu *pmu =3D pmc_to_pmu(pmc); =20 + if (pmu->version < 2) + return true; + return test_bit(pmc->idx, (unsigned long *)&pmu->global_ctrl); } =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E4FFC00140 for ; Mon, 15 Aug 2022 20:03:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242545AbiHOUDF (ORCPT ); Mon, 15 Aug 2022 16:03:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345765AbiHOT7z (ORCPT ); Mon, 15 Aug 2022 15:59:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C03B379A5C; Mon, 15 Aug 2022 11:53: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 338836122A; Mon, 15 Aug 2022 18:53:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F84AC433C1; Mon, 15 Aug 2022 18:53:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589591; bh=9RVo2cv9gTDUf/SygOdjGWEFi20yyH/rO62XiMle2Yg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mjra04/jiIL0YyyhWSGe/ef/oa3xAV0wLl3IkcxzHbZmtDxGSV6OUbTwMPQ0lgvXh ZlYzzt1rH+k5Jy1vnWOBjXOoiGt+gpAJN6lXLzcT+/X1PVONdo6cTzmC49WNbg9N4R TuPW39ZBkSALzuS3kWBLrOJVOMKUKtUMGjrqVLJo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.15 735/779] KVM: VMX: Add helper to check if the guest PMU has PERF_GLOBAL_CTRL Date: Mon, 15 Aug 2022 20:06:19 +0200 Message-Id: <20220815180408.866071215@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson [ Upstream commit b663f0b5f3d665c261256d1f76e98f077c6e56af ] Add a helper to check of the guest PMU has PERF_GLOBAL_CTRL, which is unintuitive _and_ diverges from Intel's architecturally defined behavior. Even worse, KVM currently implements the check using two different (but equivalent) checks, _and_ there has been at least one attempt to add a _third_ flavor. Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson Message-Id: <20220722224409.1336532-4-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/x86/kvm/vmx/pmu_intel.c | 4 ++-- arch/x86/kvm/vmx/vmx.h | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/vmx/pmu_intel.c b/arch/x86/kvm/vmx/pmu_intel.c index f9054e7ec89e..e624a39365ec 100644 --- a/arch/x86/kvm/vmx/pmu_intel.c +++ b/arch/x86/kvm/vmx/pmu_intel.c @@ -104,7 +104,7 @@ static bool intel_pmc_is_enabled(struct kvm_pmc *pmc) { struct kvm_pmu *pmu =3D pmc_to_pmu(pmc); =20 - if (pmu->version < 2) + if (!intel_pmu_has_perf_global_ctrl(pmu)) return true; =20 return test_bit(pmc->idx, (unsigned long *)&pmu->global_ctrl); @@ -222,7 +222,7 @@ static bool intel_is_valid_msr(struct kvm_vcpu *vcpu, u= 32 msr) case MSR_CORE_PERF_GLOBAL_STATUS: case MSR_CORE_PERF_GLOBAL_CTRL: case MSR_CORE_PERF_GLOBAL_OVF_CTRL: - ret =3D pmu->version > 1; + return intel_pmu_has_perf_global_ctrl(pmu); break; default: ret =3D get_gp_pmc(pmu, msr, MSR_IA32_PERFCTR0) || diff --git a/arch/x86/kvm/vmx/vmx.h b/arch/x86/kvm/vmx/vmx.h index a8b8150252bb..20f1213a9368 100644 --- a/arch/x86/kvm/vmx/vmx.h +++ b/arch/x86/kvm/vmx/vmx.h @@ -92,6 +92,18 @@ union vmx_exit_reason { u32 full; }; =20 +static inline bool intel_pmu_has_perf_global_ctrl(struct kvm_pmu *pmu) +{ + /* + * Architecturally, Intel's SDM states that IA32_PERF_GLOBAL_CTRL is + * supported if "CPUID.0AH: EAX[7:0] > 0", i.e. if the PMU version is + * greater than zero. However, KVM only exposes and emulates the MSR + * to/for the guest if the guest PMU supports at least "Architectural + * Performance Monitoring Version 2". + */ + return pmu->version > 1; +} + #define vcpu_to_lbr_desc(vcpu) (&to_vmx(vcpu)->lbr_desc) #define vcpu_to_lbr_records(vcpu) (&to_vmx(vcpu)->lbr_desc.records) =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7FB4C00140 for ; Mon, 15 Aug 2022 20:02:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240315AbiHOUCk (ORCPT ); Mon, 15 Aug 2022 16:02:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345851AbiHOT7s (ORCPT ); Mon, 15 Aug 2022 15:59:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E9F479ECB; Mon, 15 Aug 2022 11:53: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 4F502B810A2; Mon, 15 Aug 2022 18:53:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C4B7C433D7; Mon, 15 Aug 2022 18:53:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589595; bh=PMPYjq2JiHZbSUHAfzaeQfLG/lMgdualaXIQxXHhGVE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DgadFkyYnJk9t331kHufPlvxUTJ/Ta2FcRFzdvpU4T6zEaFZl0MSEQyY5uLLoaZZP 4c7In0bkRwcG80U5SsslJKifFjkdmjhVH/BknO0zEAOzJFEXVStivxoU/9zWbOa6K7 NMpyYqbWG8jRZcbIeN5PaeoumOD53vAtN80YeFdw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.15 736/779] KVM: nVMX: Attempt to load PERF_GLOBAL_CTRL on nVMX xfer iff it exists Date: Mon, 15 Aug 2022 20:06:20 +0200 Message-Id: <20220815180408.906188557@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sean Christopherson [ Upstream commit 4496a6f9b45e8cd83343ad86a3984d614e22cf54 ] Attempt to load PERF_GLOBAL_CTRL during nested VM-Enter/VM-Exit if and only if the MSR exists (according to the guest vCPU model). KVM has very misguided handling of VM_{ENTRY,EXIT}_LOAD_IA32_PERF_GLOBAL_CTRL and attempts to force the nVMX MSR settings to match the vPMU model, i.e. to hide/expose the control based on whether or not the MSR exists from the guest's perspective. KVM's modifications fail to handle the scenario where the vPMU is hidden from the guest _after_ being exposed to the guest, e.g. by userspace doing multiple KVM_SET_CPUID2 calls, which is allowed if done before any KVM_RUN. nested_vmx_pmu_refresh() is called if and only if there's a recognized vPMU, i.e. KVM will leave the bits in the allow state and then ultimately reject the MSR load and WARN. KVM should not force the VMX MSRs in the first place. KVM taking control of the MSRs was a misguided attempt at mimicking what commit 5f76f6f5ff96 ("KVM: nVMX: Do not expose MPX VMX controls when guest MPX disabled", 2018-10-01) did for MPX. However, the MPX commit was a workaround for another KVM bug and not something that should be imitated (and it should never been done in the first place). In other words, KVM's ABI _should_ be that userspace has full control over the MSRs, at which point triggering the WARN that loading the MSR must not fail is trivial. The intent of the WARN is still valid; KVM has consistency checks to ensure that vmcs12->{guest,host}_ia32_perf_global_ctrl is valid. The problem is that '0' must be considered a valid value at all times, and so the simple/obvious solution is to just not actually load the MSR when it does not exist. It is userspace's responsibility to provide a sane vCPU model, i.e. KVM is well within its ABI and Intel's VMX architecture to skip the loads if the MSR does not exist. Fixes: 03a8871add95 ("KVM: nVMX: Expose load IA32_PERF_GLOBAL_CTRL VM-{Entr= y,Exit} control") Cc: stable@vger.kernel.org Signed-off-by: Sean Christopherson Message-Id: <20220722224409.1336532-5-seanjc@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/x86/kvm/vmx/nested.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c index 9f845556dde8..61d601387058 100644 --- a/arch/x86/kvm/vmx/nested.c +++ b/arch/x86/kvm/vmx/nested.c @@ -2611,6 +2611,7 @@ static int prepare_vmcs02(struct kvm_vcpu *vcpu, stru= ct vmcs12 *vmcs12, vcpu->arch.walk_mmu->inject_page_fault =3D vmx_inject_page_fault_nested; =20 if ((vmcs12->vm_entry_controls & VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL) && + intel_pmu_has_perf_global_ctrl(vcpu_to_pmu(vcpu)) && WARN_ON_ONCE(kvm_set_msr(vcpu, MSR_CORE_PERF_GLOBAL_CTRL, vmcs12->guest_ia32_perf_global_ctrl))) { *entry_failure_code =3D ENTRY_FAIL_DEFAULT; @@ -4329,7 +4330,8 @@ static void load_vmcs12_host_state(struct kvm_vcpu *v= cpu, vmcs_write64(GUEST_IA32_PAT, vmcs12->host_ia32_pat); vcpu->arch.pat =3D vmcs12->host_ia32_pat; } - if (vmcs12->vm_exit_controls & VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL) + if ((vmcs12->vm_exit_controls & VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL) && + intel_pmu_has_perf_global_ctrl(vcpu_to_pmu(vcpu))) WARN_ON_ONCE(kvm_set_msr(vcpu, MSR_CORE_PERF_GLOBAL_CTRL, vmcs12->host_ia32_perf_global_ctrl)); =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ADE2CC25B0E for ; Mon, 15 Aug 2022 19:55:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241289AbiHOTzZ (ORCPT ); Mon, 15 Aug 2022 15:55:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345468AbiHOTx2 (ORCPT ); Mon, 15 Aug 2022 15:53:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECD4E45982; Mon, 15 Aug 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 ams.source.kernel.org (Postfix) with ESMTPS id A218AB81057; Mon, 15 Aug 2022 18:51:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0C7DC433D6; Mon, 15 Aug 2022 18:51:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589497; bh=r2kVNVinlWkjZTWdJsscXrmKGXmHoK6A7xEXISd9w5I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BhQKH3n9dCOhbKx1wGmVbAn/xje7V/hIHJtZqtzNTc72nYnEPGnGQy6sZoxOFWshq 2fYGum1m5eflWYYlDxufRXMHVk6AJYrROJhtPKr39gijLHkumNbEXaX0+QJZFq8zz9 9vYktU85aKmFuu34XC8DNbXhRHCEEyHU9hM8tkRY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , Mike Snitzer , Sasha Levin Subject: [PATCH 5.15 737/779] dm raid: fix address sanitizer warning in raid_status Date: Mon, 15 Aug 2022 20:06:21 +0200 Message-Id: <20220815180408.946194050@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 1fbeea217d8f297fe0e0956a1516d14ba97d0396 ] There is this warning when using a kernel with the address sanitizer and running this testsuite: https://gitlab.com/cki-project/kernel-tests/-/tree/main/storage/swraid/scsi= _raid =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D BUG: KASAN: slab-out-of-bounds in raid_status+0x1747/0x2820 [dm_raid] Read of size 4 at addr ffff888079d2c7e8 by task lvcreate/13319 CPU: 0 PID: 13319 Comm: lvcreate Not tainted 5.18.0-0.rc3. #1 Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011 Call Trace: dump_stack_lvl+0x6a/0x9c print_address_description.constprop.0+0x1f/0x1e0 print_report.cold+0x55/0x244 kasan_report+0xc9/0x100 raid_status+0x1747/0x2820 [dm_raid] dm_ima_measure_on_table_load+0x4b8/0xca0 [dm_mod] table_load+0x35c/0x630 [dm_mod] ctl_ioctl+0x411/0x630 [dm_mod] dm_ctl_ioctl+0xa/0x10 [dm_mod] __x64_sys_ioctl+0x12a/0x1a0 do_syscall_64+0x5b/0x80 The warning is caused by reading conf->max_nr_stripes in raid_status. The code in raid_status reads mddev->private, casts it to struct r5conf and reads the entry max_nr_stripes. However, if we have different raid type than 4/5/6, mddev->private doesn't point to struct r5conf; it may point to struct r0conf, struct r1conf, struct r10conf or struct mpconf. If we cast a pointer to one of these structs to struct r5conf, we will be reading invalid memory and KASAN warns about it. Fix this bug by reading struct r5conf only if raid type is 4, 5 or 6. Cc: stable@vger.kernel.org Signed-off-by: Mikulas Patocka Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/md/dm-raid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index b0566aabc186..5f7e40c48e47 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c @@ -3514,7 +3514,7 @@ static void raid_status(struct dm_target *ti, status_= type_t type, { struct raid_set *rs =3D ti->private; struct mddev *mddev =3D &rs->md; - struct r5conf *conf =3D mddev->private; + struct r5conf *conf =3D rs_is_raid456(rs) ? mddev->private : NULL; int i, max_nr_stripes =3D conf ? conf->max_nr_stripes : 0; unsigned long recovery; unsigned int raid_param_cnt =3D 1; /* at least 1 for chunksize */ --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57A66C00140 for ; Mon, 15 Aug 2022 19:55:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345637AbiHOTza (ORCPT ); Mon, 15 Aug 2022 15:55:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345475AbiHOTxb (ORCPT ); Mon, 15 Aug 2022 15:53:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08CF43205A; Mon, 15 Aug 2022 11:51: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 A97B6B810A0; Mon, 15 Aug 2022 18:51:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1650CC433D6; Mon, 15 Aug 2022 18:51:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589500; bh=TxKAbx4QRMRivSlFf4ukwAugW2WTjATdCUdXwMbEo6w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lv3/okeiv1yeL6R35tpxVFk4JHyeasWAm2ag1NRnrhVasJu1K63ZvRElrtN+VpNKP kNTH3T5earBbb4Jx0TTkfLXOHCLRRAp/WHR1uPvgutyIXz4dZuVUvheUthhyhgcNfn JtsZxvfj7xu/acwsH+tWKdukNqZNvl3yq7IXM9eM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , Mike Snitzer , Sasha Levin Subject: [PATCH 5.15 738/779] dm raid: fix address sanitizer warning in raid_resume Date: Mon, 15 Aug 2022 20:06:22 +0200 Message-Id: <20220815180408.984998844@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 7dad24db59d2d2803576f2e3645728866a056dab ] There is a KASAN warning in raid_resume when running the lvm test lvconvert-raid.sh. The reason for the warning is that mddev->raid_disks is greater than rs->raid_disks, so the loop touches one entry beyond the allocated length. Cc: stable@vger.kernel.org Signed-off-by: Mikulas Patocka Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/md/dm-raid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c index 5f7e40c48e47..eba277bb8a1f 100644 --- a/drivers/md/dm-raid.c +++ b/drivers/md/dm-raid.c @@ -3824,7 +3824,7 @@ static void attempt_restore_of_faulty_devices(struct = raid_set *rs) =20 memset(cleared_failed_devices, 0, sizeof(cleared_failed_devices)); =20 - for (i =3D 0; i < mddev->raid_disks; i++) { + for (i =3D 0; i < rs->raid_disks; i++) { r =3D &rs->dev[i].rdev; /* HM FIXME: enhance journal device recovery processing */ if (test_bit(Journal, &r->flags)) --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16950C00140 for ; Mon, 15 Aug 2022 19:57:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345641AbiHOTzf (ORCPT ); Mon, 15 Aug 2022 15:55:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345339AbiHOTxh (ORCPT ); Mon, 15 Aug 2022 15:53: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 4B92A45988; Mon, 15 Aug 2022 11:51: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 042FEB81057; Mon, 15 Aug 2022 18:51:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41FB6C433D7; Mon, 15 Aug 2022 18:51:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589503; bh=p/uunIcwHwU9V4FTm8SLUQ3eqGXCzIV40IeJ/52XdO0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kl9037RHxhDU7+dtP0gnkI7IqVkhMJpbzvjTMVW5QzMoJOMs61CHeDe50nUQlXFfE j2T5RDvhbAkP734uHHV7CrLodGyOvs56P8H7nleYjLHr/B/E69En9xUIaZUzhYl2/H Cykj5r8A0QGWLGHDn/DLO37MTzaYwCMEEVmGXPf4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Beau Belgrave , Namhyung Kim , Tom Zanussi , Masami Hiramatsu , "Steven Rostedt (VMware)" , Sasha Levin Subject: [PATCH 5.15 739/779] tracing: Add __rel_loc using trace event macros Date: Mon, 15 Aug 2022 20:06:23 +0200 Message-Id: <20220815180409.037077480@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Masami Hiramatsu [ Upstream commit 55de2c0b5610cba5a5a93c0788031133c457e689 ] Add '__rel_loc' using trace event macros. These macros are usually not used in the kernel, except for testing purpose. This also add "rel_" variant of macros for dynamic_array string, and bitmask. Link: https://lkml.kernel.org/r/163757342119.510314.816029622439099016.stgi= t@devnote2 Cc: Beau Belgrave Cc: Namhyung Kim Cc: Tom Zanussi Signed-off-by: Masami Hiramatsu Signed-off-by: Steven Rostedt (VMware) Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- include/trace/bpf_probe.h | 16 +++++ include/trace/perf.h | 16 +++++ include/trace/trace_events.h | 120 ++++++++++++++++++++++++++++++++++- kernel/trace/trace.h | 3 + 4 files changed, 153 insertions(+), 2 deletions(-) diff --git a/include/trace/bpf_probe.h b/include/trace/bpf_probe.h index a23be89119aa..04939b2d2f19 100644 --- a/include/trace/bpf_probe.h +++ b/include/trace/bpf_probe.h @@ -21,6 +21,22 @@ #undef __get_bitmask #define __get_bitmask(field) (char *)__get_dynamic_array(field) =20 +#undef __get_rel_dynamic_array +#define __get_rel_dynamic_array(field) \ + ((void *)(&__entry->__rel_loc_##field) + \ + sizeof(__entry->__rel_loc_##field) + \ + (__entry->__rel_loc_##field & 0xffff)) + +#undef __get_rel_dynamic_array_len +#define __get_rel_dynamic_array_len(field) \ + ((__entry->__rel_loc_##field >> 16) & 0xffff) + +#undef __get_rel_str +#define __get_rel_str(field) ((char *)__get_rel_dynamic_array(field)) + +#undef __get_rel_bitmask +#define __get_rel_bitmask(field) (char *)__get_rel_dynamic_array(field) + #undef __perf_count #define __perf_count(c) (c) =20 diff --git a/include/trace/perf.h b/include/trace/perf.h index dbc6c74defc3..ea4405de175a 100644 --- a/include/trace/perf.h +++ b/include/trace/perf.h @@ -21,6 +21,22 @@ #undef __get_bitmask #define __get_bitmask(field) (char *)__get_dynamic_array(field) =20 +#undef __get_rel_dynamic_array +#define __get_rel_dynamic_array(field) \ + ((void *)(&__entry->__rel_loc_##field) + \ + sizeof(__entry->__rel_loc_##field) + \ + (__entry->__rel_loc_##field & 0xffff)) + +#undef __get_rel_dynamic_array_len +#define __get_rel_dynamic_array_len(field) \ + ((__entry->__rel_loc_##field >> 16) & 0xffff) + +#undef __get_rel_str +#define __get_rel_str(field) ((char *)__get_rel_dynamic_array(field)) + +#undef __get_rel_bitmask +#define __get_rel_bitmask(field) (char *)__get_rel_dynamic_array(field) + #undef __perf_count #define __perf_count(c) (__count =3D (c)) =20 diff --git a/include/trace/trace_events.h b/include/trace/trace_events.h index 08810a463880..8c6f7c433518 100644 --- a/include/trace/trace_events.h +++ b/include/trace/trace_events.h @@ -108,6 +108,18 @@ TRACE_MAKE_SYSTEM_STR(); #undef __bitmask #define __bitmask(item, nr_bits) __dynamic_array(char, item, -1) =20 +#undef __rel_dynamic_array +#define __rel_dynamic_array(type, item, len) u32 __rel_loc_##item; + +#undef __rel_string +#define __rel_string(item, src) __rel_dynamic_array(char, item, -1) + +#undef __rel_string_len +#define __rel_string_len(item, src, len) __rel_dynamic_array(char, item, -= 1) + +#undef __rel_bitmask +#define __rel_bitmask(item, nr_bits) __rel_dynamic_array(char, item, -1) + #undef TP_STRUCT__entry #define TP_STRUCT__entry(args...) args =20 @@ -200,11 +212,23 @@ TRACE_MAKE_SYSTEM_STR(); #undef __string #define __string(item, src) __dynamic_array(char, item, -1) =20 +#undef __bitmask +#define __bitmask(item, nr_bits) __dynamic_array(unsigned long, item, -1) + #undef __string_len #define __string_len(item, src, len) __dynamic_array(char, item, -1) =20 -#undef __bitmask -#define __bitmask(item, nr_bits) __dynamic_array(unsigned long, item, -1) +#undef __rel_dynamic_array +#define __rel_dynamic_array(type, item, len) u32 item; + +#undef __rel_string +#define __rel_string(item, src) __rel_dynamic_array(char, item, -1) + +#undef __rel_string_len +#define __rel_string_len(item, src, len) __rel_dynamic_array(char, item, -= 1) + +#undef __rel_bitmask +#define __rel_bitmask(item, nr_bits) __rel_dynamic_array(unsigned long, it= em, -1) =20 #undef DECLARE_EVENT_CLASS #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ @@ -293,6 +317,19 @@ TRACE_MAKE_SYSTEM_STR(); #undef __get_str #define __get_str(field) ((char *)__get_dynamic_array(field)) =20 +#undef __get_rel_dynamic_array +#define __get_rel_dynamic_array(field) \ + ((void *)(&__entry->__rel_loc_##field) + \ + sizeof(__entry->__rel_loc_##field) + \ + (__entry->__rel_loc_##field & 0xffff)) + +#undef __get_rel_dynamic_array_len +#define __get_rel_dynamic_array_len(field) \ + ((__entry->__rel_loc_##field >> 16) & 0xffff) + +#undef __get_rel_str +#define __get_rel_str(field) ((char *)__get_rel_dynamic_array(field)) + #undef __get_bitmask #define __get_bitmask(field) \ ({ \ @@ -302,6 +339,15 @@ TRACE_MAKE_SYSTEM_STR(); trace_print_bitmask_seq(p, __bitmask, __bitmask_size); \ }) =20 +#undef __get_rel_bitmask +#define __get_rel_bitmask(field) \ + ({ \ + void *__bitmask =3D __get_rel_dynamic_array(field); \ + unsigned int __bitmask_size; \ + __bitmask_size =3D __get_rel_dynamic_array_len(field); \ + trace_print_bitmask_seq(p, __bitmask, __bitmask_size); \ + }) + #undef __print_flags #define __print_flags(flag, delim, flag_array...) \ ({ \ @@ -471,6 +517,21 @@ static struct trace_event_functions trace_event_type_f= uncs_##call =3D { \ #undef __bitmask #define __bitmask(item, nr_bits) __dynamic_array(unsigned long, item, -1) =20 +#undef __rel_dynamic_array +#define __rel_dynamic_array(_type, _item, _len) { \ + .type =3D "__rel_loc " #_type "[]", .name =3D #_item, \ + .size =3D 4, .align =3D 4, \ + .is_signed =3D is_signed_type(_type), .filter_type =3D FILTER_OTHER }, + +#undef __rel_string +#define __rel_string(item, src) __rel_dynamic_array(char, item, -1) + +#undef __rel_string_len +#define __rel_string_len(item, src, len) __rel_dynamic_array(char, item, -= 1) + +#undef __rel_bitmask +#define __rel_bitmask(item, nr_bits) __rel_dynamic_array(unsigned long, it= em, -1) + #undef DECLARE_EVENT_CLASS #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, func, print) \ static struct trace_event_fields trace_event_fields_##call[] =3D { \ @@ -519,6 +580,22 @@ static struct trace_event_fields trace_event_fields_##= call[] =3D { \ #undef __string_len #define __string_len(item, src, len) __dynamic_array(char, item, (len) + 1) =20 +#undef __rel_dynamic_array +#define __rel_dynamic_array(type, item, len) \ + __item_length =3D (len) * sizeof(type); \ + __data_offsets->item =3D __data_size + \ + offsetof(typeof(*entry), __data) - \ + offsetof(typeof(*entry), __rel_loc_##item) - \ + sizeof(u32); \ + __data_offsets->item |=3D __item_length << 16; \ + __data_size +=3D __item_length; + +#undef __rel_string +#define __rel_string(item, src) __rel_dynamic_array(char, item, \ + strlen((src) ? (const char *)(src) : "(null)") + 1) + +#undef __rel_string_len +#define __rel_string_len(item, src, len) __rel_dynamic_array(char, item, (= len) + 1) /* * __bitmask_size_in_bytes_raw is the number of bytes needed to hold * num_possible_cpus(). @@ -542,6 +619,10 @@ static struct trace_event_fields trace_event_fields_##= call[] =3D { \ #define __bitmask(item, nr_bits) __dynamic_array(unsigned long, item, \ __bitmask_size_in_longs(nr_bits)) =20 +#undef __rel_bitmask +#define __rel_bitmask(item, nr_bits) __rel_dynamic_array(unsigned long, it= em, \ + __bitmask_size_in_longs(nr_bits)) + #undef DECLARE_EVENT_CLASS #define DECLARE_EVENT_CLASS(call, proto, args, tstruct, assign, print) \ static inline notrace int trace_event_get_offsets_##call( \ @@ -706,6 +787,37 @@ static inline notrace int trace_event_get_offsets_##ca= ll( \ #define __assign_bitmask(dst, src, nr_bits) \ memcpy(__get_bitmask(dst), (src), __bitmask_size_in_bytes(nr_bits)) =20 +#undef __rel_dynamic_array +#define __rel_dynamic_array(type, item, len) \ + __entry->__rel_loc_##item =3D __data_offsets.item; + +#undef __rel_string +#define __rel_string(item, src) __rel_dynamic_array(char, item, -1) + +#undef __rel_string_len +#define __rel_string_len(item, src, len) __rel_dynamic_array(char, item, -= 1) + +#undef __assign_rel_str +#define __assign_rel_str(dst, src) \ + strcpy(__get_rel_str(dst), (src) ? (const char *)(src) : "(null)"); + +#undef __assign_rel_str_len +#define __assign_rel_str_len(dst, src, len) \ + do { \ + memcpy(__get_rel_str(dst), (src), (len)); \ + __get_rel_str(dst)[len] =3D '\0'; \ + } while (0) + +#undef __rel_bitmask +#define __rel_bitmask(item, nr_bits) __rel_dynamic_array(unsigned long, it= em, -1) + +#undef __get_rel_bitmask +#define __get_rel_bitmask(field) (char *)__get_rel_dynamic_array(field) + +#undef __assign_rel_bitmask +#define __assign_rel_bitmask(dst, src, nr_bits) \ + memcpy(__get_rel_bitmask(dst), (src), __bitmask_size_in_bytes(nr_bits)) + #undef TP_fast_assign #define TP_fast_assign(args...) args =20 @@ -770,6 +882,10 @@ static inline void ftrace_test_probe_##call(void) \ #undef __get_dynamic_array_len #undef __get_str #undef __get_bitmask +#undef __get_rel_dynamic_array +#undef __get_rel_dynamic_array_len +#undef __get_rel_str +#undef __get_rel_bitmask #undef __print_array #undef __print_hex_dump =20 diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index d6763366a320..28ea6c0be495 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h @@ -83,6 +83,9 @@ enum trace_type { #undef __dynamic_array #define __dynamic_array(type, item) type item[]; =20 +#undef __rel_dynamic_array +#define __rel_dynamic_array(type, item) type item[]; + #undef F_STRUCT #define F_STRUCT(args...) args =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A8E2C28B2B for ; Mon, 15 Aug 2022 19:57:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240366AbiHOT5T (ORCPT ); Mon, 15 Aug 2022 15:57:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244214AbiHOTxs (ORCPT ); Mon, 15 Aug 2022 15:53:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAC7E45996; Mon, 15 Aug 2022 11:51: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 3AAEAB810A2; Mon, 15 Aug 2022 18:51:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C5F6C433C1; Mon, 15 Aug 2022 18:51:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589506; bh=hnv1XE0p9Z6h0Gz83S5EsiaobBnLS3/MzDyCxzBMYV0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xgkhp+5VRR1Mc75Hyui8YL21ASzf5F4QNzagsLe0L2SOsWDge3ik86MXg7BHsOrY/ MUyHuJLesproGOGhIehryohv6VkCi+EruRzvgAH6Xiu6y/N1TA79M/B3O0/cXUzqDj POhqEoz391K/Z9C7KJitrl2wIe9OQ8bYnrsEYEaU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephen Rothwell , Kees Cook , Masami Hiramatsu , "Steven Rostedt (Google)" , Sasha Levin Subject: [PATCH 5.15 740/779] tracing: Avoid -Warray-bounds warning for __rel_loc macro Date: Mon, 15 Aug 2022 20:06:24 +0200 Message-Id: <20220815180409.073906833@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Masami Hiramatsu [ Upstream commit 58c5724ec2cdd72b22107ec5de00d90cc4797796 ] Since -Warray-bounds checks the destination size from the type of given pointer, __assign_rel_str() macro gets warned because it passes the pointer to the 'u32' field instead of 'trace_event_raw_*' data structure. Pass the data address calculated from the 'trace_event_raw_*' instead of 'u32' __rel_loc field. Link: https://lkml.kernel.org/r/20220125233154.dac280ed36944c0c2fe6f3ac@ker= nel.org Cc: Stephen Rothwell Cc: Kees Cook Signed-off-by: Masami Hiramatsu [ This did not fix the warning, but is still a nice clean up ] Signed-off-by: Steven Rostedt (Google) Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- include/trace/trace_events.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/trace/trace_events.h b/include/trace/trace_events.h index 8c6f7c433518..65d927e059d3 100644 --- a/include/trace/trace_events.h +++ b/include/trace/trace_events.h @@ -318,9 +318,10 @@ TRACE_MAKE_SYSTEM_STR(); #define __get_str(field) ((char *)__get_dynamic_array(field)) =20 #undef __get_rel_dynamic_array -#define __get_rel_dynamic_array(field) \ - ((void *)(&__entry->__rel_loc_##field) + \ - sizeof(__entry->__rel_loc_##field) + \ +#define __get_rel_dynamic_array(field) \ + ((void *)__entry + \ + offsetof(typeof(*__entry), __rel_loc_##field) + \ + sizeof(__entry->__rel_loc_##field) + \ (__entry->__rel_loc_##field & 0xffff)) =20 #undef __get_rel_dynamic_array_len --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58012C25B0E for ; Mon, 15 Aug 2022 19:57:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243146AbiHOT5Y (ORCPT ); Mon, 15 Aug 2022 15:57:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345505AbiHOTxv (ORCPT ); Mon, 15 Aug 2022 15:53: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 7B1D9459A3; Mon, 15 Aug 2022 11:51: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 sin.source.kernel.org (Postfix) with ESMTPS id CC2D3CE1277; Mon, 15 Aug 2022 18:51:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0332C433C1; Mon, 15 Aug 2022 18:51:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589510; bh=DYUehsMPqaq4yxszzIlykNT+p1BYZ2hwXXP23RFc51M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HUWtJgXpQIHXZ5FRHwspvuCIe94SuYBgoy5ypSdAuQqkpwL47h2SZn/kY19+dt2cc nRDSsemWVSIPDQDx1eUbNP6u1h4qC7ee+3QFuzhaRM4ouSErPBZSDaqKrW2ql3+qg8 uxfqz02B74UZKJRhK4KlAxIADhIrHQLomvvWGlQ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Theodore Tso , stable@kernel.org, Andreas Dilger , Sasha Levin Subject: [PATCH 5.15 741/779] ext4: update s_overhead_clusters in the superblock during an on-line resize Date: Mon, 15 Aug 2022 20:06:25 +0200 Message-Id: <20220815180409.123189877@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Theodore Ts'o [ Upstream commit de394a86658ffe4e89e5328fd4993abfe41b7435 ] When doing an online resize, the on-disk superblock on-disk wasn't updated. This means that when the file system is unmounted and remounted, and the on-disk overhead value is non-zero, this would result in the results of statfs(2) to be incorrect. This was partially fixed by Commits 10b01ee92df5 ("ext4: fix overhead calculation to account for the reserved gdt blocks"), 85d825dbf489 ("ext4: force overhead calculation if the s_overhead_cluster makes no sense"), and eb7054212eac ("ext4: update the cached overhead value in the superblock"). However, since it was too expensive to forcibly recalculate the overhead for bigalloc file systems at every mount, this didn't fix the problem for bigalloc file systems. This commit should address the problem when resizing file systems with the bigalloc feature enabled. Signed-off-by: Theodore Ts'o Cc: stable@kernel.org Reviewed-by: Andreas Dilger Link: https://lore.kernel.org/r/20220629040026.112371-1-tytso@mit.edu Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/ext4/resize.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index 56c9ef0687fc..fa3c854125bb 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c @@ -1472,6 +1472,7 @@ static void ext4_update_super(struct super_block *sb, * Update the fs overhead information */ ext4_calculate_overhead(sb); + es->s_overhead_clusters =3D cpu_to_le32(sbi->s_overhead); =20 if (test_opt(sb, DEBUG)) printk(KERN_DEBUG "EXT4-fs: added group %u:" --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A68EC3F6B0 for ; Mon, 15 Aug 2022 19:57:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244173AbiHOT53 (ORCPT ); Mon, 15 Aug 2022 15:57:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345509AbiHOTxv (ORCPT ); Mon, 15 Aug 2022 15:53:51 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF4733DBE2; Mon, 15 Aug 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 79974B810A1; Mon, 15 Aug 2022 18:51:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DACD8C433C1; Mon, 15 Aug 2022 18:51:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589513; bh=jc2ts41zMqojvvjdU1jX3aRBnALxG3ccpzWTrixxG9g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VOeAfSwWlnrabIb4fAscYEyYIRTcIP3cwZOJyBasPIDwTd5D/nKP9RhzNS2jHHkRB Epv3WiO4tE28WZq99xLlJDRV7DXfGFdckVWFumonmSVh23Z2Zzo0Yd6edsVzYBC7fk eBYQL0kX3/9P5zigNb+0CPF7rd5PI6wvxUi5JklE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Ye Bin , Eric Whitney , Theodore Tso , Sasha Levin Subject: [PATCH 5.15 742/779] ext4: fix extent status tree race in writeback error recovery path Date: Mon, 15 Aug 2022 20:06:26 +0200 Message-Id: <20220815180409.173312722@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 Whitney [ Upstream commit 7f0d8e1d607c1a4fa9a27362a108921d82230874 ] A race can occur in the unlikely event ext4 is unable to allocate a physical cluster for a delayed allocation in a bigalloc file system during writeback. Failure to allocate a cluster forces error recovery that includes a call to mpage_release_unused_pages(). That function removes any corresponding delayed allocated blocks from the extent status tree. If a new delayed write is in progress on the same cluster simultaneously, resulting in the addition of an new extent containing one or more blocks in that cluster to the extent status tree, delayed block accounting can be thrown off if that delayed write then encounters a similar cluster allocation failure during future writeback. Write lock the i_data_sem in mpage_release_unused_pages() to fix this problem. Ext4's block/cluster accounting code for bigalloc relies on i_data_sem for mutual exclusion, as is found in the delayed write path, and the locking in mpage_release_unused_pages() is missing. Cc: stable@kernel.org Reported-by: Ye Bin Signed-off-by: Eric Whitney Link: https://lore.kernel.org/r/20220615160530.1928801-1-enwlinux@gmail.com Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/ext4/inode.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index f0350d60ba50..149377c849ee 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -1560,7 +1560,14 @@ static void mpage_release_unused_pages(struct mpage_= da_data *mpd, ext4_lblk_t start, last; start =3D index << (PAGE_SHIFT - inode->i_blkbits); last =3D end << (PAGE_SHIFT - inode->i_blkbits); + + /* + * avoid racing with extent status tree scans made by + * ext4_insert_delayed_block() + */ + down_write(&EXT4_I(inode)->i_data_sem); ext4_es_remove_extent(inode, start, last - start + 1); + up_write(&EXT4_I(inode)->i_data_sem); } =20 pagevec_init(&pvec); --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97CA8C25B08 for ; Mon, 15 Aug 2022 19:57:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242805AbiHOT5f (ORCPT ); Mon, 15 Aug 2022 15:57:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243313AbiHOTxz (ORCPT ); Mon, 15 Aug 2022 15:53:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EF6D45F50; Mon, 15 Aug 2022 11:51: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 A3EEDB810A1; Mon, 15 Aug 2022 18:51:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5EBDC433D6; Mon, 15 Aug 2022 18:51:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589516; bh=AJ9Cae9twUPm3oRt+U4Os2vYeJaUHtnMyscaHzAnWyY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bGvKYFnyM13mz3bm65rT9IyxHfGxxXGOZIQBzABL2bNy0ZT6o61Ci5BvPgGM6icsH SqViV+XMDz39vFQvUYwqhLS74bBa+uSxG7XPpfztBdPm7A8JLiLQu5grAwQKStcSFb DlTAaihp4zqOD7R0urSZPq9YNigI7gkkW7Inw4so= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Baokun Li , Jan Kara , "Ritesh Harjani (IBM)" , Theodore Tso , Sasha Levin Subject: [PATCH 5.15 743/779] ext4: add EXT4_INODE_HAS_XATTR_SPACE macro in xattr.h Date: Mon, 15 Aug 2022 20:06:27 +0200 Message-Id: <20220815180409.224874033@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Baokun Li [ Upstream commit 179b14152dcb6a24c3415200603aebca70ff13af ] When adding an xattr to an inode, we must ensure that the inode_size is not less than EXT4_GOOD_OLD_INODE_SIZE + extra_isize + pad. Otherwise, the end position may be greater than the start position, resulting in UAF. Signed-off-by: Baokun Li Reviewed-by: Jan Kara Reviewed-by: Ritesh Harjani (IBM) Link: https://lore.kernel.org/r/20220616021358.2504451-2-libaokun1@huawei.c= om Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/ext4/xattr.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/fs/ext4/xattr.h b/fs/ext4/xattr.h index 77efb9a627ad..f885f362add4 100644 --- a/fs/ext4/xattr.h +++ b/fs/ext4/xattr.h @@ -95,6 +95,19 @@ struct ext4_xattr_entry { =20 #define EXT4_ZERO_XATTR_VALUE ((void *)-1) =20 +/* + * If we want to add an xattr to the inode, we should make sure that + * i_extra_isize is not 0 and that the inode size is not less than + * EXT4_GOOD_OLD_INODE_SIZE + extra_isize + pad. + * EXT4_GOOD_OLD_INODE_SIZE extra_isize header entry pad data + * |--------------------------|------------|------|---------|---|-------| + */ +#define EXT4_INODE_HAS_XATTR_SPACE(inode) \ + ((EXT4_I(inode)->i_extra_isize !=3D 0) && \ + (EXT4_GOOD_OLD_INODE_SIZE + EXT4_I(inode)->i_extra_isize + \ + sizeof(struct ext4_xattr_ibody_header) + EXT4_XATTR_PAD <=3D \ + EXT4_INODE_SIZE((inode)->i_sb))) + struct ext4_xattr_info { const char *name; const void *value; --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61CC6C25B0E for ; Mon, 15 Aug 2022 19:57:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243692AbiHOT5q (ORCPT ); Mon, 15 Aug 2022 15:57:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345271AbiHOTyE (ORCPT ); Mon, 15 Aug 2022 15:54:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4864B45F71; Mon, 15 Aug 2022 11:52: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 7EA84B810A0; Mon, 15 Aug 2022 18:52:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5609C433D7; Mon, 15 Aug 2022 18:51:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589519; bh=wlL1Y8aNRe0v0Bc7HGBJS/rY5In1hAG+X05x15i94HY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XXxHNnWfDXc1DEDS3fPywQ7+sfnSyyMMXBCslnPtpuYBdEN7EtFWXTRzJMA4zDJPc eSfMR1Rtpzz/sxUfzKzfmnfHNdxYkRvFcYRL6hLTwQ+3e/zplV1wD86/gzNDLmhwGO 7S1HTk/5ovu9yviDRjNgr49/QIJp/yrDF0xHWq1U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Hulk Robot , Baokun Li , "Ritesh Harjani (IBM)" , Jan Kara , Theodore Tso , Sasha Levin Subject: [PATCH 5.15 744/779] ext4: fix use-after-free in ext4_xattr_set_entry Date: Mon, 15 Aug 2022 20:06:28 +0200 Message-Id: <20220815180409.277987970@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Baokun Li [ Upstream commit 67d7d8ad99beccd9fe92d585b87f1760dc9018e3 ] Hulk Robot reported a issue: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D BUG: KASAN: use-after-free in ext4_xattr_set_entry+0x18ab/0x3500 Write of size 4105 at addr ffff8881675ef5f4 by task syz-executor.0/7092 CPU: 1 PID: 7092 Comm: syz-executor.0 Not tainted 4.19.90-dirty #17 Call Trace: [...] memcpy+0x34/0x50 mm/kasan/kasan.c:303 ext4_xattr_set_entry+0x18ab/0x3500 fs/ext4/xattr.c:1747 ext4_xattr_ibody_inline_set+0x86/0x2a0 fs/ext4/xattr.c:2205 ext4_xattr_set_handle+0x940/0x1300 fs/ext4/xattr.c:2386 ext4_xattr_set+0x1da/0x300 fs/ext4/xattr.c:2498 __vfs_setxattr+0x112/0x170 fs/xattr.c:149 __vfs_setxattr_noperm+0x11b/0x2a0 fs/xattr.c:180 __vfs_setxattr_locked+0x17b/0x250 fs/xattr.c:238 vfs_setxattr+0xed/0x270 fs/xattr.c:255 setxattr+0x235/0x330 fs/xattr.c:520 path_setxattr+0x176/0x190 fs/xattr.c:539 __do_sys_lsetxattr fs/xattr.c:561 [inline] __se_sys_lsetxattr fs/xattr.c:557 [inline] __x64_sys_lsetxattr+0xc2/0x160 fs/xattr.c:557 do_syscall_64+0xdf/0x530 arch/x86/entry/common.c:298 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x459fe9 RSP: 002b:00007fa5e54b4c08 EFLAGS: 00000246 ORIG_RAX: 00000000000000bd RAX: ffffffffffffffda RBX: 000000000051bf60 RCX: 0000000000459fe9 RDX: 00000000200003c0 RSI: 0000000020000180 RDI: 0000000020000140 RBP: 000000000051bf60 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000001009 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffc73c93fc0 R14: 000000000051bf60 R15: 00007fa5e54b4d80 [...] =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Above issue may happen as follows: Reported-by: Hulk Robot Reported-by: Linux Kernel Functional Testing Reviewed-by: Jan Kara Reviewed-by: Ritesh Harjani (IBM) Tested-by: Bagas Sanjaya Tested-by: Shuah Khan ------------------------------------- ext4_xattr_set ext4_xattr_set_handle ext4_xattr_ibody_find >> s->end < s->base >> no EXT4_STATE_XATTR >> xattr_check_inode is not executed ext4_xattr_ibody_set ext4_xattr_set_entry >> size_t min_offs =3D s->end - s->base >> UAF in memcpy we can easily reproduce this problem with the following commands: mkfs.ext4 -F /dev/sda mount -o debug_want_extra_isize=3D128 /dev/sda /mnt touch /mnt/file setfattr -n user.cat -v `seq -s z 4096|tr -d '[:digit:]'` /mnt/file In ext4_xattr_ibody_find, we have the following assignment logic: header =3D IHDR(inode, raw_inode) =3D raw_inode + EXT4_GOOD_OLD_INODE_SIZE + i_extra_isize is->s.base =3D IFIRST(header) =3D header + sizeof(struct ext4_xattr_ibody_header) is->s.end =3D raw_inode + s_inode_size In ext4_xattr_set_entry min_offs =3D s->end - s->base =3D s_inode_size - EXT4_GOOD_OLD_INODE_SIZE - i_extra_isize - sizeof(struct ext4_xattr_ibody_header) last =3D s->first free =3D min_offs - ((void *)last - s->base) - sizeof(__u32) =3D s_inode_size - EXT4_GOOD_OLD_INODE_SIZE - i_extra_isize - sizeof(struct ext4_xattr_ibody_header) - sizeof(__u32) In the calculation formula, all values except s_inode_size and i_extra_size are fixed values. When i_extra_size is the maximum value s_inode_size - EXT4_GOOD_OLD_INODE_SIZE, min_offs is -4 and free is -8. The value overflows. As a result, the preceding issue is triggered when memcpy is executed. Therefore, when finding xattr or setting xattr, check whether there is space for storing xattr in the inode to resolve this issue. Cc: stable@kernel.org Reported-by: Hulk Robot Signed-off-by: Baokun Li Reviewed-by: Ritesh Harjani (IBM) Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220616021358.2504451-3-libaokun1@huawei.c= om Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin --- fs/ext4/xattr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index 042325349098..c3c3194f3ee1 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -2176,8 +2176,9 @@ int ext4_xattr_ibody_find(struct inode *inode, struct= ext4_xattr_info *i, struct ext4_inode *raw_inode; int error; =20 - if (EXT4_I(inode)->i_extra_isize =3D=3D 0) + if (!EXT4_INODE_HAS_XATTR_SPACE(inode)) return 0; + raw_inode =3D ext4_raw_inode(&is->iloc); header =3D IHDR(inode, raw_inode); is->s.base =3D is->s.first =3D IFIRST(header); @@ -2205,8 +2206,9 @@ int ext4_xattr_ibody_set(handle_t *handle, struct ino= de *inode, struct ext4_xattr_search *s =3D &is->s; int error; =20 - if (EXT4_I(inode)->i_extra_isize =3D=3D 0) + if (!EXT4_INODE_HAS_XATTR_SPACE(inode)) return -ENOSPC; + error =3D ext4_xattr_set_entry(i, s, handle, inode, false /* is_block */); if (error) return error; --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC682C00140 for ; Mon, 15 Aug 2022 19:57:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344114AbiHOT5k (ORCPT ); Mon, 15 Aug 2022 15:57:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345520AbiHOTyE (ORCPT ); Mon, 15 Aug 2022 15:54: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 D143F46D82; Mon, 15 Aug 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 dfw.source.kernel.org (Postfix) with ESMTPS id 4AD1D61231; Mon, 15 Aug 2022 18:52:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AE8BC433D6; Mon, 15 Aug 2022 18:52:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589522; bh=JwXt754lUHTq1FlSGA1oDJZEx7coBxOMoSh2XBZ6ym4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VhbghhjimPRqktpcMrdsOC8fxivxbeON9dQ3+GyiKUubVgjpveqzpVQr5ClzpG+dR jVEefUl/ydOONrf4bPEqoZcZEfpjxrj+9W6QjbkrhlHoEjUxZxcgbIL6lu9K4gvlVe 1H+C8ShvJQuV9PVWUDOZ1yGw7Su0P7Ok3wvsdbO0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Baokun Li , "Ritesh Harjani (IBM)" , Jan Kara , Theodore Tso , Sasha Levin Subject: [PATCH 5.15 745/779] ext4: correct max_inline_xattr_value_size computing Date: Mon, 15 Aug 2022 20:06:29 +0200 Message-Id: <20220815180409.317249940@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Baokun Li [ Upstream commit c9fd167d57133c5b748d16913c4eabc55e531c73 ] If the ext4 inode does not have xattr space, 0 is returned in the get_max_inline_xattr_value_size function. Otherwise, the function returns a negative value when the inode does not contain EXT4_STATE_XATTR. Cc: stable@kernel.org Signed-off-by: Baokun Li Reviewed-by: Ritesh Harjani (IBM) Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220616021358.2504451-4-libaokun1@huawei.c= om Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/ext4/inline.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index 28bc431cf5ba..38ad09e802e4 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c @@ -35,6 +35,9 @@ static int get_max_inline_xattr_value_size(struct inode *= inode, struct ext4_inode *raw_inode; int free, min_offs; =20 + if (!EXT4_INODE_HAS_XATTR_SPACE(inode)) + return 0; + min_offs =3D EXT4_SB(inode->i_sb)->s_inode_size - EXT4_GOOD_OLD_INODE_SIZE - EXT4_I(inode)->i_extra_isize - --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 819FDC00140 for ; Mon, 15 Aug 2022 19:57:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345521AbiHOT5t (ORCPT ); Mon, 15 Aug 2022 15:57:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344837AbiHOTyU (ORCPT ); Mon, 15 Aug 2022 15:54: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 83CF146DAB; Mon, 15 Aug 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 E5ADEB810A1; Mon, 15 Aug 2022 18:52:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 464E1C433D6; Mon, 15 Aug 2022 18:52:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589525; bh=0KD7QWSgaLCh+FTKLs8Nuov2UeaSqaFCWzUcFIzW7MY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HG9d90tEWjCXpX9RZRNQ4abvldWMAEIE3a5fISfwwpHEt/mLYByu+7tShsZWVXTV2 wwMqO5oABXHegYbBZ/tqezklTWcTdCOTPInm2Xf9Y3qY2D3Yz57Y6fcLclMMxoZQUL Mi8DMbuy23XRA6kutiv5wHp6t+tYeOe5qkXyD2N4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Baokun Li , "Ritesh Harjani (IBM)" , Jan Kara , Theodore Tso , Sasha Levin Subject: [PATCH 5.15 746/779] ext4: correct the misjudgment in ext4_iget_extra_inode Date: Mon, 15 Aug 2022 20:06:30 +0200 Message-Id: <20220815180409.361550591@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Baokun Li [ Upstream commit fd7e672ea98b95b9d4c9dae316639f03c16a749d ] Use the EXT4_INODE_HAS_XATTR_SPACE macro to more accurately determine whether the inode have xattr space. Cc: stable@kernel.org Signed-off-by: Baokun Li Reviewed-by: Ritesh Harjani (IBM) Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220616021358.2504451-5-libaokun1@huawei.c= om Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/ext4/inode.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 149377c849ee..f95c73defe05 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4516,8 +4516,7 @@ static inline int ext4_iget_extra_inode(struct inode = *inode, __le32 *magic =3D (void *)raw_inode + EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize; =20 - if (EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize + sizeof(__le32) <=3D - EXT4_INODE_SIZE(inode->i_sb) && + if (EXT4_INODE_HAS_XATTR_SPACE(inode) && *magic =3D=3D cpu_to_le32(EXT4_XATTR_MAGIC)) { ext4_set_inode_state(inode, EXT4_STATE_XATTR); return ext4_find_inline_data_nolock(inode); --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EBADC00140 for ; Mon, 15 Aug 2022 19:58:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244136AbiHOT6U (ORCPT ); Mon, 15 Aug 2022 15:58:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345663AbiHOTzo (ORCPT ); Mon, 15 Aug 2022 15:55: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 C9744753A9; Mon, 15 Aug 2022 11:52: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 06E2EB810A1; Mon, 15 Aug 2022 18:52:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4EBCEC433C1; Mon, 15 Aug 2022 18:52:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589531; bh=APtv4foR+rRmZJqDLFR4Cl4QW7N0TbC0NruzopgwTAI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=catq3+AB0NxgBXd6HklMcr865CVqkP3K0VSqhYscDZKCD/1Y+pDtRlJBNJh+5kKWd 1fHZjLz/H8RBT9JMUT1IeUXNXa2eM5q+wuV0k7L0TKoXpi0pxLTv8RfY/JjwbJ1q2q LdF1UWuZkz7h+E1L9WGwAA5iY5dkYUeaJ7RPj4PQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ye Bin , Theodore Tso , stable@kernel.org, Sasha Levin Subject: [PATCH 5.15 747/779] ext4: fix warning in ext4_iomap_begin as race between bmap and write Date: Mon, 15 Aug 2022 20:06:31 +0200 Message-Id: <20220815180409.414095463@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ye Bin [ Upstream commit 51ae846cff568c8c29921b1b28eb2dfbcd4ac12d ] We got issue as follows: Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan ------------[ cut here ]------------ WARNING: CPU: 3 PID: 9310 at fs/ext4/inode.c:3441 ext4_iomap_begin+0x182/0x= 5d0 RIP: 0010:ext4_iomap_begin+0x182/0x5d0 RSP: 0018:ffff88812460fa08 EFLAGS: 00010293 RAX: ffff88811f168000 RBX: 0000000000000000 RCX: ffffffff97793c12 RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000003 RBP: ffff88812c669160 R08: ffff88811f168000 R09: ffffed10258cd20f R10: ffff88812c669077 R11: ffffed10258cd20e R12: 0000000000000001 R13: 00000000000000a4 R14: 000000000000000c R15: ffff88812c6691ee FS: 00007fd0d6ff3740(0000) GS:ffff8883af180000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fd0d6dda290 CR3: 0000000104a62000 CR4: 00000000000006e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: iomap_apply+0x119/0x570 iomap_bmap+0x124/0x150 ext4_bmap+0x14f/0x250 bmap+0x55/0x80 do_vfs_ioctl+0x952/0xbd0 __x64_sys_ioctl+0xc6/0x170 do_syscall_64+0x33/0x40 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Above issue may happen as follows: bmap write bmap ext4_bmap iomap_bmap ext4_iomap_begin ext4_file_write_iter ext4_buffered_write_iter generic_perform_write ext4_da_write_begin ext4_da_write_inline_data_begin ext4_prepare_inline_data ext4_create_inline_data ext4_set_inode_flag(inode, EXT4_INODE_INLINE_DATA); if (WARN_ON_ONCE(ext4_has_inline_data(inode))) ->trigger bug_on To solved above issue hold inode lock in ext4_bamp. Signed-off-by: Ye Bin Link: https://lore.kernel.org/r/20220617013935.397596-1-yebin10@huawei.com Signed-off-by: Theodore Ts'o Cc: stable@kernel.org Signed-off-by: Sasha Levin --- fs/ext4/inode.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index f95c73defe05..360a7d153955 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -3137,13 +3137,15 @@ static sector_t ext4_bmap(struct address_space *map= ping, sector_t block) { struct inode *inode =3D mapping->host; journal_t *journal; + sector_t ret =3D 0; int err; =20 + inode_lock_shared(inode); /* * We can get here for an inline file via the FIBMAP ioctl */ if (ext4_has_inline_data(inode)) - return 0; + goto out; =20 if (mapping_tagged(mapping, PAGECACHE_TAG_DIRTY) && test_opt(inode->i_sb, DELALLOC)) { @@ -3182,10 +3184,14 @@ static sector_t ext4_bmap(struct address_space *map= ping, sector_t block) jbd2_journal_unlock_updates(journal); =20 if (err) - return 0; + goto out; } =20 - return iomap_bmap(mapping, block, &ext4_iomap_ops); + ret =3D iomap_bmap(mapping, block, &ext4_iomap_ops); + +out: + inode_unlock_shared(inode); + return ret; } =20 static int ext4_readpage(struct file *file, struct page *page) --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A78C4C00140 for ; Mon, 15 Aug 2022 19:58:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345591AbiHOT6O (ORCPT ); Mon, 15 Aug 2022 15:58:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345684AbiHOTzt (ORCPT ); Mon, 15 Aug 2022 15:55:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6568975FD3; Mon, 15 Aug 2022 11:52: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 6F5D961019; Mon, 15 Aug 2022 18:52:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 613FFC433D6; Mon, 15 Aug 2022 18:52:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589534; bh=RPFvDBopYVsLgn+huv5j8AZAu+3Kbq4r/71DAohIOE4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ccvQC8sHTUwJfgm7P6nKUA79KdcozmU9VUUuxrekJr/ruXFqQlkHu0L0NKh/WkSu8 28JII4MOod/cbB2Isak6COilOzyMKsSv5IhLQZvAEnSPHBmdyLucoL+Fsh0cQwFWPJ 6LfBvvBKcb/UDLGPeh5X96Nic4ZZ5S0zaKWP0sY8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lukas Czerner , Andreas Dilger , Theodore Tso , Sasha Levin Subject: [PATCH 5.15 748/779] ext4: check if directory block is within i_size Date: Mon, 15 Aug 2022 20:06:32 +0200 Message-Id: <20220815180409.450413762@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lukas Czerner [ Upstream commit 65f8ea4cd57dbd46ea13b41dc8bac03176b04233 ] Currently ext4 directory handling code implicitly assumes that the directory blocks are always within the i_size. In fact ext4_append() will attempt to allocate next directory block based solely on i_size and the i_size is then appropriately increased after a successful allocation. However, for this to work it requires i_size to be correct. If, for any reason, the directory inode i_size is corrupted in a way that the directory tree refers to a valid directory block past i_size, we could end up corrupting parts of the directory tree structure by overwriting already used directory blocks when modifying the directory. Fix it by catching the corruption early in __ext4_read_dirblock(). Addresses Red-Hat-Bugzilla: #2070205 CVE: CVE-2022-1184 Signed-off-by: Lukas Czerner Cc: stable@vger.kernel.org Reviewed-by: Andreas Dilger Link: https://lore.kernel.org/r/20220704142721.157985-1-lczerner@redhat.com Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/ext4/namei.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 871eebf12bf4..ac0b7e53591f 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -110,6 +110,13 @@ static struct buffer_head *__ext4_read_dirblock(struct= inode *inode, struct ext4_dir_entry *dirent; int is_dx_block =3D 0; =20 + if (block >=3D inode->i_size) { + ext4_error_inode(inode, func, line, block, + "Attempting to read directory block (%u) that is past i_size (%ll= u)", + block, inode->i_size); + return ERR_PTR(-EFSCORRUPTED); + } + if (ext4_simulate_fail(inode->i_sb, EXT4_SIM_DIRBLOCK_EIO)) bh =3D ERR_PTR(-EIO); else --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E373BC00140 for ; Mon, 15 Aug 2022 19:58:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241362AbiHOT6h (ORCPT ); Mon, 15 Aug 2022 15:58:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345885AbiHOT4T (ORCPT ); Mon, 15 Aug 2022 15:56: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 922787645E; Mon, 15 Aug 2022 11:52: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 2D996B810A5; Mon, 15 Aug 2022 18:52:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 734E5C433C1; Mon, 15 Aug 2022 18:52:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589537; bh=UJmdtNp9UclGRqO3oGh5Wh3J+d7Eg6EFFK3qiBFPpdU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q5ZY1KHTY8dXVjLSX9IcXkXJUdM18qN/jD1nIZPSNJZgOINlbK0sCxv2AKtML3bcY wiNdQFg0fSpC4alx79nLcOAI1+0p7rytdEXEWpPVbAeW5ACdhT6xPyg3sBCSH8VQit iHER1zihIA0kZfFd2cXoN1izv7lXbrjBkLcoykNY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Lukas Czerner , Andreas Dilger , Theodore Tso , Sasha Levin Subject: [PATCH 5.15 749/779] ext4: make sure ext4_append() always allocates new block Date: Mon, 15 Aug 2022 20:06:33 +0200 Message-Id: <20220815180409.494538455@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lukas Czerner [ Upstream commit b8a04fe77ef1360fbf73c80fddbdfeaa9407ed1b ] ext4_append() must always allocate a new block, otherwise we run the risk of overwriting existing directory block corrupting the directory tree in the process resulting in all manner of problems later on. Add a sanity check to see if the logical block is already allocated and error out if it is. Cc: stable@kernel.org Signed-off-by: Lukas Czerner Reviewed-by: Andreas Dilger Link: https://lore.kernel.org/r/20220704142721.157985-2-lczerner@redhat.com Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/ext4/namei.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index ac0b7e53591f..5821638cb893 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -54,6 +54,7 @@ static struct buffer_head *ext4_append(handle_t *handle, struct inode *inode, ext4_lblk_t *block) { + struct ext4_map_blocks map; struct buffer_head *bh; int err; =20 @@ -63,6 +64,21 @@ static struct buffer_head *ext4_append(handle_t *handle, return ERR_PTR(-ENOSPC); =20 *block =3D inode->i_size >> inode->i_sb->s_blocksize_bits; + map.m_lblk =3D *block; + map.m_len =3D 1; + + /* + * We're appending new directory block. Make sure the block is not + * allocated yet, otherwise we will end up corrupting the + * directory. + */ + err =3D ext4_map_blocks(NULL, inode, &map, 0); + if (err < 0) + return ERR_PTR(err); + if (err) { + EXT4_ERROR_INODE(inode, "Logical block already allocated"); + return ERR_PTR(-EFSCORRUPTED); + } =20 bh =3D ext4_bread(handle, inode, *block, EXT4_GET_BLOCKS_CREATE); if (IS_ERR(bh)) --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D6E9C25B08 for ; Mon, 15 Aug 2022 19:58:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240092AbiHOT6Y (ORCPT ); Mon, 15 Aug 2022 15:58:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345849AbiHOT4M (ORCPT ); Mon, 15 Aug 2022 15:56:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2DA1760F0; Mon, 15 Aug 2022 11:52: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 908F86122E; Mon, 15 Aug 2022 18:52:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97F39C433D7; Mon, 15 Aug 2022 18:52:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589541; bh=zLusqmtt8FCzf2eQCnY3drYtt3XHjinfQgVkLkJZbKE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZtqKpptIY8BgHd+2m69YtkhsPlf0r2LP2qkerFXRwO2wPGuojeOBXIRGrkWPcwLIm VUSZsyFmhMSWcbikGSFgnR3C/J/IeDCj8qeCMcozQJM8hCNFmjyIokdcGUl6M1+VZP vwcF3HmlZvxNnWiflrHlREoLP28dZbGrFFRMqxRU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Kara , Theodore Tso , Sasha Levin Subject: [PATCH 5.15 750/779] ext4: remove EA inode entry from mbcache on inode eviction Date: Mon, 15 Aug 2022 20:06:34 +0200 Message-Id: <20220815180409.535130622@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jan Kara [ Upstream commit 6bc0d63dad7f9f54d381925ee855b402f652fa39 ] Currently we remove EA inode from mbcache as soon as its xattr refcount drops to zero. However there can be pending attempts to reuse the inode and thus refcount handling code has to handle the situation when refcount increases from zero anyway. So save some work and just keep EA inode in mbcache until it is getting evicted. At that moment we are sure following iget() of EA inode will fail anyway (or wait for eviction to finish and load things from the disk again) and so removing mbcache entry at that moment is fine and simplifies the code a bit. CC: stable@vger.kernel.org Fixes: 82939d7999df ("ext4: convert to mbcache2") Signed-off-by: Jan Kara Link: https://lore.kernel.org/r/20220712105436.32204-3-jack@suse.cz Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/ext4/inode.c | 2 ++ fs/ext4/xattr.c | 24 ++++++++---------------- fs/ext4/xattr.h | 1 + 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 360a7d153955..98f381f6fc18 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -179,6 +179,8 @@ void ext4_evict_inode(struct inode *inode) =20 trace_ext4_evict_inode(inode); =20 + if (EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL) + ext4_evict_ea_inode(inode); if (inode->i_nlink) { /* * When journalling data dirty buffers are tracked only in the diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index c3c3194f3ee1..b57fd07fbdba 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -436,6 +436,14 @@ static int ext4_xattr_inode_iget(struct inode *parent,= unsigned long ea_ino, return err; } =20 +/* Remove entry from mbcache when EA inode is getting evicted */ +void ext4_evict_ea_inode(struct inode *inode) +{ + if (EA_INODE_CACHE(inode)) + mb_cache_entry_delete(EA_INODE_CACHE(inode), + ext4_xattr_inode_get_hash(inode), inode->i_ino); +} + static int ext4_xattr_inode_verify_hashes(struct inode *ea_inode, struct ext4_xattr_entry *entry, void *buffer, @@ -976,10 +984,8 @@ int __ext4_xattr_set_credits(struct super_block *sb, s= truct inode *inode, static int ext4_xattr_inode_update_ref(handle_t *handle, struct inode *ea_= inode, int ref_change) { - struct mb_cache *ea_inode_cache =3D EA_INODE_CACHE(ea_inode); struct ext4_iloc iloc; s64 ref_count; - u32 hash; int ret; =20 inode_lock(ea_inode); @@ -1002,14 +1008,6 @@ static int ext4_xattr_inode_update_ref(handle_t *han= dle, struct inode *ea_inode, =20 set_nlink(ea_inode, 1); ext4_orphan_del(handle, ea_inode); - - if (ea_inode_cache) { - hash =3D ext4_xattr_inode_get_hash(ea_inode); - mb_cache_entry_create(ea_inode_cache, - GFP_NOFS, hash, - ea_inode->i_ino, - true /* reusable */); - } } } else { WARN_ONCE(ref_count < 0, "EA inode %lu ref_count=3D%lld", @@ -1022,12 +1020,6 @@ static int ext4_xattr_inode_update_ref(handle_t *han= dle, struct inode *ea_inode, =20 clear_nlink(ea_inode); ext4_orphan_add(handle, ea_inode); - - if (ea_inode_cache) { - hash =3D ext4_xattr_inode_get_hash(ea_inode); - mb_cache_entry_delete(ea_inode_cache, hash, - ea_inode->i_ino); - } } } =20 diff --git a/fs/ext4/xattr.h b/fs/ext4/xattr.h index f885f362add4..e5e36bd11f05 100644 --- a/fs/ext4/xattr.h +++ b/fs/ext4/xattr.h @@ -191,6 +191,7 @@ extern void ext4_xattr_inode_array_free(struct ext4_xat= tr_inode_array *array); =20 extern int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_i= size, struct ext4_inode *raw_inode, handle_t *handle); +extern void ext4_evict_ea_inode(struct inode *inode); =20 extern const struct xattr_handler *ext4_xattr_handlers[]; =20 --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D2E8C00140 for ; Mon, 15 Aug 2022 19:58:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345704AbiHOT61 (ORCPT ); Mon, 15 Aug 2022 15:58:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345890AbiHOT4T (ORCPT ); Mon, 15 Aug 2022 15:56: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 C852976474; Mon, 15 Aug 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 19B6DB810A1; Mon, 15 Aug 2022 18:52:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7EC60C433C1; Mon, 15 Aug 2022 18:52:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589543; bh=Ohh3paW8dP4iCobD3rCYKby9TRKkA45xwCV8Vho5sgU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kCllPtutsnL4C5Gw9J1z5d6sH/tWDyLnFFuy77YO9AFz64KqHbqrD4z8Zpnzc3MNr Fsc/gGBWbE8bYEEfuRMT+RZw0/FNYBiQOOZdonhXKQJTs7I4Cjg5453YcO3SSCGByK jratSqprwQHB0AGIth9+ru14EYSltjP2MfkGaedk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shuqi Zhang , Ritesh Harjani , Theodore Tso , Sasha Levin Subject: [PATCH 5.15 751/779] ext4: use kmemdup() to replace kmalloc + memcpy Date: Mon, 15 Aug 2022 20:06:35 +0200 Message-Id: <20220815180409.581858100@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shuqi Zhang [ Upstream commit 4efd9f0d120c55b08852ee5605dbb02a77089a5d ] Replace kmalloc + memcpy with kmemdup() Signed-off-by: Shuqi Zhang Reviewed-by: Ritesh Harjani Link: https://lore.kernel.org/r/20220525030120.803330-1-zhangshuqi3@huawei.= com Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/ext4/xattr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index b57fd07fbdba..d92d50de5a01 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -1887,11 +1887,10 @@ ext4_xattr_block_set(handle_t *handle, struct inode= *inode, =20 unlock_buffer(bs->bh); ea_bdebug(bs->bh, "cloning"); - s->base =3D kmalloc(bs->bh->b_size, GFP_NOFS); + s->base =3D kmemdup(BHDR(bs->bh), bs->bh->b_size, GFP_NOFS); error =3D -ENOMEM; if (s->base =3D=3D NULL) goto cleanup; - memcpy(s->base, BHDR(bs->bh), bs->bh->b_size); s->first =3D ENTRY(header(s->base)+1); header(s->base)->h_refcount =3D cpu_to_le32(1); s->here =3D ENTRY(s->base + offset); --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46D41C25B08 for ; Mon, 15 Aug 2022 19:58:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243486AbiHOT6l (ORCPT ); Mon, 15 Aug 2022 15:58:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345921AbiHOT40 (ORCPT ); Mon, 15 Aug 2022 15:56:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A27CA7647D; Mon, 15 Aug 2022 11:52:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A553D61224; Mon, 15 Aug 2022 18:52:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F192C433C1; Mon, 15 Aug 2022 18:52:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589547; bh=FMs/sWj9WFMQUIEfGyLx6NRo6/tJlhfm8nDKhrM5/EY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e5Fhz1+uElVcsmJIbQJSk5s+VJTRMB2eFJmAFJ2LIrbPTItg7wAwLdhY6+QArCj05 GDq3+nydU0kl56PKyAIJAIZkMcPUksTAD5DDWIeUQPIkVr/FRU327zldUiML/WSEcz w8AEFkHf5WLIRvn/8ygYPNNicye9YbKMbr3Ymuvk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Kara , Theodore Tso , Sasha Levin Subject: [PATCH 5.15 752/779] ext4: unindent codeblock in ext4_xattr_block_set() Date: Mon, 15 Aug 2022 20:06:36 +0200 Message-Id: <20220815180409.623950024@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jan Kara [ Upstream commit fd48e9acdf26d0cbd80051de07d4a735d05d29b2 ] Remove unnecessary else (and thus indentation level) from a code block in ext4_xattr_block_set(). It will also make following code changes easier. No functional changes. CC: stable@vger.kernel.org Fixes: 82939d7999df ("ext4: convert to mbcache2") Signed-off-by: Jan Kara Link: https://lore.kernel.org/r/20220712105436.32204-4-jack@suse.cz Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/ext4/xattr.c | 77 ++++++++++++++++++++++++------------------------- 1 file changed, 38 insertions(+), 39 deletions(-) diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index d92d50de5a01..a25942a74929 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -1850,6 +1850,8 @@ ext4_xattr_block_set(handle_t *handle, struct inode *= inode, #define header(x) ((struct ext4_xattr_header *)(x)) =20 if (s->base) { + int offset =3D (char *)s->here - bs->bh->b_data; + BUFFER_TRACE(bs->bh, "get_write_access"); error =3D ext4_journal_get_write_access(handle, sb, bs->bh, EXT4_JTR_NONE); @@ -1882,49 +1884,46 @@ ext4_xattr_block_set(handle_t *handle, struct inode= *inode, if (error) goto cleanup; goto inserted; - } else { - int offset =3D (char *)s->here - bs->bh->b_data; + } + unlock_buffer(bs->bh); + ea_bdebug(bs->bh, "cloning"); + s->base =3D kmemdup(BHDR(bs->bh), bs->bh->b_size, GFP_NOFS); + error =3D -ENOMEM; + if (s->base =3D=3D NULL) + goto cleanup; + s->first =3D ENTRY(header(s->base)+1); + header(s->base)->h_refcount =3D cpu_to_le32(1); + s->here =3D ENTRY(s->base + offset); + s->end =3D s->base + bs->bh->b_size; =20 - unlock_buffer(bs->bh); - ea_bdebug(bs->bh, "cloning"); - s->base =3D kmemdup(BHDR(bs->bh), bs->bh->b_size, GFP_NOFS); - error =3D -ENOMEM; - if (s->base =3D=3D NULL) + /* + * If existing entry points to an xattr inode, we need + * to prevent ext4_xattr_set_entry() from decrementing + * ref count on it because the reference belongs to the + * original block. In this case, make the entry look + * like it has an empty value. + */ + if (!s->not_found && s->here->e_value_inum) { + ea_ino =3D le32_to_cpu(s->here->e_value_inum); + error =3D ext4_xattr_inode_iget(inode, ea_ino, + le32_to_cpu(s->here->e_hash), + &tmp_inode); + if (error) goto cleanup; - s->first =3D ENTRY(header(s->base)+1); - header(s->base)->h_refcount =3D cpu_to_le32(1); - s->here =3D ENTRY(s->base + offset); - s->end =3D s->base + bs->bh->b_size; =20 - /* - * If existing entry points to an xattr inode, we need - * to prevent ext4_xattr_set_entry() from decrementing - * ref count on it because the reference belongs to the - * original block. In this case, make the entry look - * like it has an empty value. - */ - if (!s->not_found && s->here->e_value_inum) { - ea_ino =3D le32_to_cpu(s->here->e_value_inum); - error =3D ext4_xattr_inode_iget(inode, ea_ino, - le32_to_cpu(s->here->e_hash), - &tmp_inode); - if (error) - goto cleanup; - - if (!ext4_test_inode_state(tmp_inode, - EXT4_STATE_LUSTRE_EA_INODE)) { - /* - * Defer quota free call for previous - * inode until success is guaranteed. - */ - old_ea_inode_quota =3D le32_to_cpu( - s->here->e_value_size); - } - iput(tmp_inode); - - s->here->e_value_inum =3D 0; - s->here->e_value_size =3D 0; + if (!ext4_test_inode_state(tmp_inode, + EXT4_STATE_LUSTRE_EA_INODE)) { + /* + * Defer quota free call for previous + * inode until success is guaranteed. + */ + old_ea_inode_quota =3D le32_to_cpu( + s->here->e_value_size); } + iput(tmp_inode); + + s->here->e_value_inum =3D 0; + s->here->e_value_size =3D 0; } } else { /* Allocate a buffer where we construct the new block. */ --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7212C00140 for ; Mon, 15 Aug 2022 19:58:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242165AbiHOT6b (ORCPT ); Mon, 15 Aug 2022 15:58:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55246 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345899AbiHOT4U (ORCPT ); Mon, 15 Aug 2022 15:56: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 D1C9776942; Mon, 15 Aug 2022 11:52:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6F43DB8105D; Mon, 15 Aug 2022 18:52:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB85AC433D6; Mon, 15 Aug 2022 18:52:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589550; bh=v79BDIz+bJxNdmMCpKkjIK9UA5+kvyKRUyd0IFt9G2Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KGLRaF1HoNIP5kFqZdNZFLcnZOLzanLOJwsxRrx+vxFEzNslrauEomrC+EK8xNyWh 2UCd1vVtO2osoPfjSPQ/IHgXEUrggSxICrkXlEvzXa7h06YSK7E3+6VAanHpNxpBxl bPXF0ENfsKY8RvrIsneFyKNWIunjSsK2tsENpohw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Kara , Theodore Tso , Sasha Levin , Ritesh Harjani Subject: [PATCH 5.15 753/779] ext4: fix race when reusing xattr blocks Date: Mon, 15 Aug 2022 20:06:37 +0200 Message-Id: <20220815180409.659525049@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jan Kara [ Upstream commit 65f8b80053a1b2fd602daa6814e62d6fa90e5e9b ] When ext4_xattr_block_set() decides to remove xattr block the following race can happen: CPU1 CPU2 ext4_xattr_block_set() ext4_xattr_release_block() new_bh =3D ext4_xattr_block_cache_find() lock_buffer(bh); ref =3D le32_to_cpu(BHDR(bh)->h_r= efcount); if (ref =3D=3D 1) { ... mb_cache_entry_delete(); unlock_buffer(bh); ext4_free_blocks(); ... ext4_forget(..., bh, ...); jbd2_journal_revoke(..., bh= ); ext4_journal_get_write_access(..., new_bh, ...) do_get_write_access() jbd2_journal_cancel_revoke(..., new_bh); Later the code in ext4_xattr_block_set() finds out the block got freed and cancels reusal of the block but the revoke stays canceled and so in case of block reuse and journal replay the filesystem can get corrupted. If the race works out slightly differently, we can also hit assertions in the jbd2 code. Fix the problem by making sure that once matching mbcache entry is found, code dropping the last xattr block reference (or trying to modify xattr block in place) waits until the mbcache entry reference is dropped. This way code trying to reuse xattr block is protected from someone trying to drop the last reference to xattr block. Reported-and-tested-by: Ritesh Harjani CC: stable@vger.kernel.org Fixes: 82939d7999df ("ext4: convert to mbcache2") Signed-off-by: Jan Kara Link: https://lore.kernel.org/r/20220712105436.32204-5-jack@suse.cz Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/ext4/xattr.c | 67 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 45 insertions(+), 22 deletions(-) diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index a25942a74929..533216e80fa2 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -439,9 +439,16 @@ static int ext4_xattr_inode_iget(struct inode *parent,= unsigned long ea_ino, /* Remove entry from mbcache when EA inode is getting evicted */ void ext4_evict_ea_inode(struct inode *inode) { - if (EA_INODE_CACHE(inode)) - mb_cache_entry_delete(EA_INODE_CACHE(inode), - ext4_xattr_inode_get_hash(inode), inode->i_ino); + struct mb_cache_entry *oe; + + if (!EA_INODE_CACHE(inode)) + return; + /* Wait for entry to get unused so that we can remove it */ + while ((oe =3D mb_cache_entry_delete_or_get(EA_INODE_CACHE(inode), + ext4_xattr_inode_get_hash(inode), inode->i_ino))) { + mb_cache_entry_wait_unused(oe); + mb_cache_entry_put(EA_INODE_CACHE(inode), oe); + } } =20 static int @@ -1229,6 +1236,7 @@ ext4_xattr_release_block(handle_t *handle, struct ino= de *inode, if (error) goto out; =20 +retry_ref: lock_buffer(bh); hash =3D le32_to_cpu(BHDR(bh)->h_hash); ref =3D le32_to_cpu(BHDR(bh)->h_refcount); @@ -1238,9 +1246,18 @@ ext4_xattr_release_block(handle_t *handle, struct in= ode *inode, * This must happen under buffer lock for * ext4_xattr_block_set() to reliably detect freed block */ - if (ea_block_cache) - mb_cache_entry_delete(ea_block_cache, hash, - bh->b_blocknr); + if (ea_block_cache) { + struct mb_cache_entry *oe; + + oe =3D mb_cache_entry_delete_or_get(ea_block_cache, hash, + bh->b_blocknr); + if (oe) { + unlock_buffer(bh); + mb_cache_entry_wait_unused(oe); + mb_cache_entry_put(ea_block_cache, oe); + goto retry_ref; + } + } get_bh(bh); unlock_buffer(bh); =20 @@ -1867,9 +1884,20 @@ ext4_xattr_block_set(handle_t *handle, struct inode = *inode, * ext4_xattr_block_set() to reliably detect modified * block */ - if (ea_block_cache) - mb_cache_entry_delete(ea_block_cache, hash, - bs->bh->b_blocknr); + if (ea_block_cache) { + struct mb_cache_entry *oe; + + oe =3D mb_cache_entry_delete_or_get(ea_block_cache, + hash, bs->bh->b_blocknr); + if (oe) { + /* + * Xattr block is getting reused. Leave + * it alone. + */ + mb_cache_entry_put(ea_block_cache, oe); + goto clone_block; + } + } ea_bdebug(bs->bh, "modifying in-place"); error =3D ext4_xattr_set_entry(i, s, handle, inode, true /* is_block */); @@ -1885,6 +1913,7 @@ ext4_xattr_block_set(handle_t *handle, struct inode *= inode, goto cleanup; goto inserted; } +clone_block: unlock_buffer(bs->bh); ea_bdebug(bs->bh, "cloning"); s->base =3D kmemdup(BHDR(bs->bh), bs->bh->b_size, GFP_NOFS); @@ -1990,18 +2019,13 @@ ext4_xattr_block_set(handle_t *handle, struct inode= *inode, lock_buffer(new_bh); /* * We have to be careful about races with - * freeing, rehashing or adding references to - * xattr block. Once we hold buffer lock xattr - * block's state is stable so we can check - * whether the block got freed / rehashed or - * not. Since we unhash mbcache entry under - * buffer lock when freeing / rehashing xattr - * block, checking whether entry is still - * hashed is reliable. Same rules hold for - * e_reusable handling. + * adding references to xattr block. Once we + * hold buffer lock xattr block's state is + * stable so we can check the additional + * reference fits. */ - if (hlist_bl_unhashed(&ce->e_hash_list) || - !ce->e_reusable) { + ref =3D le32_to_cpu(BHDR(new_bh)->h_refcount) + 1; + if (ref > EXT4_XATTR_REFCOUNT_MAX) { /* * Undo everything and check mbcache * again. @@ -2016,9 +2040,8 @@ ext4_xattr_block_set(handle_t *handle, struct inode *= inode, new_bh =3D NULL; goto inserted; } - ref =3D le32_to_cpu(BHDR(new_bh)->h_refcount) + 1; BHDR(new_bh)->h_refcount =3D cpu_to_le32(ref); - if (ref >=3D EXT4_XATTR_REFCOUNT_MAX) + if (ref =3D=3D EXT4_XATTR_REFCOUNT_MAX) ce->e_reusable =3D 0; ea_bdebug(new_bh, "reusing; refcount now=3D%d", ref); --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5EB0C00140 for ; Mon, 15 Aug 2022 19:58:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229962AbiHOT6u (ORCPT ); Mon, 15 Aug 2022 15:58:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345973AbiHOT4r (ORCPT ); Mon, 15 Aug 2022 15:56:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 715457694A; Mon, 15 Aug 2022 11:52:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A198CB810A6; Mon, 15 Aug 2022 18:52:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4BD2C433D6; Mon, 15 Aug 2022 18:52:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589553; bh=kxzoYOEPOH9+Y+3lO+DaaJftUEo51nXgjw+Ns0g0fJM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1YpEdVdY6rh9wDsl+Djmr7sWCsbvzWX45GNMYxJSvOnqNPn4AsVMpHY1V0/TyZOr5 yIFROq7w9ZvxyXsTTq63to8rjUu8Zx/EowE+7rll2asKLNHLv3e0AmGg2TcW04wbcV 9VTZkwN5Ln/MyuLEcGtk+Kx86kC6+IBiiEzl7qro= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Biggers , Tianjia Zhang , Jarkko Sakkinen , Sasha Levin Subject: [PATCH 5.15 754/779] KEYS: asymmetric: enforce SM2 signature use pkey algo Date: Mon, 15 Aug 2022 20:06:38 +0200 Message-Id: <20220815180409.709757173@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tianjia Zhang [ Upstream commit 0815291a8fd66cdcf7db1445d4d99b0d16065829 ] The signature verification of SM2 needs to add the Za value and recalculate sig->digest, which requires the detection of the pkey_algo in public_key_verify_signature(). As Eric Biggers said, the pkey_algo field in sig is attacker-controlled and should be use pkey->pkey_algo instead of sig->pkey_algo, and secondly, if sig->pkey_algo is NULL, it will also cause signature verification failure. The software_key_determine_akcipher() already forces the algorithms are matched, so the SM3 algorithm is enforced in the SM2 signature, although this has been checked, we still avoid using any algorithm information in the signature as input. Fixes: 215525639631 ("X.509: support OSCCA SM2-with-SM3 certificate verific= ation") Reported-by: Eric Biggers Cc: stable@vger.kernel.org # v5.10+ Signed-off-by: Tianjia Zhang Reviewed-by: Jarkko Sakkinen Signed-off-by: Jarkko Sakkinen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- crypto/asymmetric_keys/public_key.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crypto/asymmetric_keys/public_key.c b/crypto/asymmetric_keys/p= ublic_key.c index 7c9e6be35c30..2f8352e88860 100644 --- a/crypto/asymmetric_keys/public_key.c +++ b/crypto/asymmetric_keys/public_key.c @@ -304,6 +304,10 @@ static int cert_sig_digest_update(const struct public_= key_signature *sig, =20 BUG_ON(!sig->data); =20 + /* SM2 signatures always use the SM3 hash algorithm */ + if (!sig->hash_algo || strcmp(sig->hash_algo, "sm3") !=3D 0) + return -EINVAL; + ret =3D sm2_compute_z_digest(tfm_pkey, SM2_DEFAULT_USERID, SM2_DEFAULT_USERID_LEN, dgst); if (ret) @@ -414,8 +418,7 @@ int public_key_verify_signature(const struct public_key= *pkey, if (ret) goto error_free_key; =20 - if (sig->pkey_algo && strcmp(sig->pkey_algo, "sm2") =3D=3D 0 && - sig->data_size) { + if (strcmp(pkey->pkey_algo, "sm2") =3D=3D 0 && sig->data_size) { ret =3D cert_sig_digest_update(sig, tfm); if (ret) goto error_free_key; --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F06CC25B0E for ; Mon, 15 Aug 2022 19:58:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345764AbiHOT6r (ORCPT ); Mon, 15 Aug 2022 15:58:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345955AbiHOT4o (ORCPT ); Mon, 15 Aug 2022 15:56: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 D586A7696B; Mon, 15 Aug 2022 11:52: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 95010B810A2; Mon, 15 Aug 2022 18:52:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5F44C433C1; Mon, 15 Aug 2022 18:52:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589556; bh=dg9/iLNoP90yeUEWFEyZvSjml0J6j+qZ3W5XqIRkfYM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=voq344sRwzQfxV3F662+LFY/UiHyiwji+Npaj27Brmz9PcidsZ9BFv5D9tG34g990 kO6opZISg4a76Hzh7JpkcqTD43B89sH5SwzfwSma1gyLxM2m7uow8WPazoZ/brusJn SFO09vVhU/IQPSDqICpi+gQoOWaVS+hqUBeONknA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, WANG Xuerui , Huacai Chen , Jarkko Sakkinen , Sasha Levin Subject: [PATCH 5.15 755/779] tpm: eventlog: Fix section mismatch for DEBUG_SECTION_MISMATCH Date: Mon, 15 Aug 2022 20:06:39 +0200 Message-Id: <20220815180409.746917394@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Huacai Chen [ Upstream commit bed4593645366ad7362a3aa7bc0d100d8d8236a8 ] If DEBUG_SECTION_MISMATCH enabled, __calc_tpm2_event_size() will not be inlined, this cause section mismatch like this: WARNING: modpost: vmlinux.o(.text.unlikely+0xe30c): Section mismatch in ref= erence from the variable L0 to the function .init.text:early_ioremap() The function L0() references the function __init early_memremap(). This is often because L0 lacks a __init annotation or the annotation of early_ioremap is wrong. Fix it by using __always_inline instead of inline for the called-once function __calc_tpm2_event_size(). Fixes: 44038bc514a2 ("tpm: Abstract crypto agile event size calculations") Cc: stable@vger.kernel.org # v5.3 Reported-by: WANG Xuerui Signed-off-by: Huacai Chen Signed-off-by: Jarkko Sakkinen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- include/linux/tpm_eventlog.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/tpm_eventlog.h b/include/linux/tpm_eventlog.h index 739ba9a03ec1..20c0ff54b7a0 100644 --- a/include/linux/tpm_eventlog.h +++ b/include/linux/tpm_eventlog.h @@ -157,7 +157,7 @@ struct tcg_algorithm_info { * Return: size of the event on success, 0 on failure */ =20 -static inline int __calc_tpm2_event_size(struct tcg_pcr_event2_head *event, +static __always_inline int __calc_tpm2_event_size(struct tcg_pcr_event2_he= ad *event, struct tcg_pcr_event *event_header, bool do_mapping) { --=20 2.35.1 From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9423C00140 for ; Mon, 15 Aug 2022 19:58:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241918AbiHOT6z (ORCPT ); Mon, 15 Aug 2022 15:58:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345975AbiHOT4r (ORCPT ); Mon, 15 Aug 2022 15:56:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 719D57697E; Mon, 15 Aug 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 ams.source.kernel.org (Postfix) with ESMTPS id D89C7B810A1; Mon, 15 Aug 2022 18:52:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CD67C433C1; Mon, 15 Aug 2022 18:52:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589559; bh=J49d4DEptKMWjWx4b8cin41uCtkezrgo6ZY79QE+qhg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XVge0nTwV7rBPzYflRo9xPNfPMtZpNoeAwUIw/+NuLk71VBO8froQTopdyRJvhUW5 GhiaUoh1bCLsXjMHGwh0Okr1L3vz/lnHuTjV9YrQP/p4ZC9NzL0bIUn3r8VsYb6xmk p2lWNURIThBWr4SibMgStP9qKSzptlRCCA4LRBx8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maximilian Heyne , SeongJae Park , Juergen Gross Subject: [PATCH 5.15 756/779] xen-blkback: fix persistent grants negotiation Date: Mon, 15 Aug 2022 20:06:40 +0200 Message-Id: <20220815180409.784025415@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: SeongJae Park commit fc9be616bb8f3ed9cf560308f86904f5c06be205 upstream. Persistent grants feature can be used only when both backend and the frontend supports the feature. The feature was always supported by 'blkback', but commit aac8a70db24b ("xen-blkback: add a parameter for disabling of persistent grants") has introduced a parameter for disabling it runtime. To avoid the parameter be updated while being used by 'blkback', the commit caches the parameter into 'vbd->feature_gnt_persistent' in 'xen_vbd_create()', and then check if the guest also supports the feature and finally updates the field in 'connect_ring()'. However, 'connect_ring()' could be called before 'xen_vbd_create()', so later execution of 'xen_vbd_create()' can wrongly overwrite 'true' to 'vbd->feature_gnt_persistent'. As a result, 'blkback' could try to use 'persistent grants' feature even if the guest doesn't support the feature. This commit fixes the issue by moving the parameter value caching to 'xen_blkif_alloc()', which allocates the 'blkif'. Because the struct embeds 'vbd' object, which will be used by 'connect_ring()' later, this should be called before 'connect_ring()' and therefore this should be the right and safe place to do the caching. Fixes: aac8a70db24b ("xen-blkback: add a parameter for disabling of persist= ent grants") Cc: # 5.10.x Signed-off-by: Maximilian Heyne Signed-off-by: SeongJae Park Reviewed-by: Maximilian Heyne Reviewed-by: Juergen Gross Link: https://lore.kernel.org/r/20220715225108.193398-2-sj@kernel.org Signed-off-by: Juergen Gross Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/block/xen-blkback/xenbus.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c @@ -156,6 +156,11 @@ static int xen_blkif_alloc_rings(struct return 0; } =20 +/* Enable the persistent grants feature. */ +static bool feature_persistent =3D true; +module_param(feature_persistent, bool, 0644); +MODULE_PARM_DESC(feature_persistent, "Enables the persistent grants featur= e"); + static struct xen_blkif *xen_blkif_alloc(domid_t domid) { struct xen_blkif *blkif; @@ -180,6 +185,8 @@ static struct xen_blkif *xen_blkif_alloc __module_get(THIS_MODULE); INIT_WORK(&blkif->free_work, xen_blkif_deferred_free); =20 + blkif->vbd.feature_gnt_persistent =3D feature_persistent; + return blkif; } =20 @@ -471,12 +478,6 @@ static void xen_vbd_free(struct xen_vbd vbd->bdev =3D NULL; } =20 -/* Enable the persistent grants feature. */ -static bool feature_persistent =3D true; -module_param(feature_persistent, bool, 0644); -MODULE_PARM_DESC(feature_persistent, - "Enables the persistent grants feature"); - static int xen_vbd_create(struct xen_blkif *blkif, blkif_vdev_t handle, unsigned major, unsigned minor, int readonly, int cdrom) @@ -522,8 +523,6 @@ static int xen_vbd_create(struct xen_blk if (q && blk_queue_secure_erase(q)) vbd->discard_secure =3D true; =20 - vbd->feature_gnt_persistent =3D feature_persistent; - pr_debug("Successful creation of handle=3D%04x (dom=3D%u)\n", handle, blkif->domid); return 0; From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 047BEC25B0E for ; Mon, 15 Aug 2022 19:59:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229845AbiHOT7C (ORCPT ); Mon, 15 Aug 2022 15:59:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346018AbiHOT4z (ORCPT ); Mon, 15 Aug 2022 15:56:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1455A78209; Mon, 15 Aug 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 ams.source.kernel.org (Postfix) with ESMTPS id 60D82B8105D; Mon, 15 Aug 2022 18:52:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B2F0C433D6; Mon, 15 Aug 2022 18:52:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589566; bh=unY1VYk0+hldZ4DhLs3vctXkk1Ytvke2vPTh8XgIwj0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xbqIpywIczTc66V9ID0gkd/cxkwXelvbEcovPO18gKOu9QpmWI5EnlcqbaMPAUVNA rkfJ+5zxj1XzRZ9Y5jewOSG6TSErIZobyeYTuoCocw6Ih17TEN+9sKY5wk8O4e4Kox 1zSRqtKeY+og1/GtJWPf53fLJy4gqpUkZ5xpUjlg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrii Chepurnyi , Maximilian Heyne , SeongJae Park , Juergen Gross Subject: [PATCH 5.15 757/779] xen-blkback: Apply feature_persistent parameter when connect Date: Mon, 15 Aug 2022 20:06:41 +0200 Message-Id: <20220815180409.816622620@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maximilian Heyne commit e94c6101e151b019b8babc518ac2a6ada644a5a1 upstream. In some use cases[1], the backend is created while the frontend doesn't support the persistent grants feature, but later the frontend can be changed to support the feature and reconnect. In the past, 'blkback' enabled the persistent grants feature since it unconditionally checked if frontend supports the persistent grants feature for every connect ('connect_ring()') and decided whether it should use persistent grans or not. However, commit aac8a70db24b ("xen-blkback: add a parameter for disabling of persistent grants") has mistakenly changed the behavior. It made the frontend feature support check to not be repeated once it shown the 'feature_persistent' as 'false', or the frontend doesn't support persistent grants. This commit changes the behavior of the parameter to make effect for every connect, so that the previous workflow can work again as expected. [1] https://lore.kernel.org/xen-devel/CAJwUmVB6H3iTs-C+U=3Dv-pwJB7-_ZRHPxHz= KRJZ22xEPW7z8a=3Dg@mail.gmail.com/ Reported-by: Andrii Chepurnyi Fixes: aac8a70db24b ("xen-blkback: add a parameter for disabling of persist= ent grants") Cc: # 5.10.x Signed-off-by: Maximilian Heyne Signed-off-by: SeongJae Park Reviewed-by: Maximilian Heyne Reviewed-by: Juergen Gross Link: https://lore.kernel.org/r/20220715225108.193398-3-sj@kernel.org Signed-off-by: Juergen Gross Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- Documentation/ABI/testing/sysfs-driver-xen-blkback | 2 +- drivers/block/xen-blkback/xenbus.c | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) --- a/Documentation/ABI/testing/sysfs-driver-xen-blkback +++ b/Documentation/ABI/testing/sysfs-driver-xen-blkback @@ -42,5 +42,5 @@ KernelVersion: 5.10 Contact: SeongJae Park Description: Whether to enable the persistent grants feature or not. N= ote - that this option only takes effect on newly created backen= ds. + that this option only takes effect on newly connected back= ends. The default is Y (enable). --- a/drivers/block/xen-blkback/xenbus.c +++ b/drivers/block/xen-blkback/xenbus.c @@ -185,8 +185,6 @@ static struct xen_blkif *xen_blkif_alloc __module_get(THIS_MODULE); INIT_WORK(&blkif->free_work, xen_blkif_deferred_free); =20 - blkif->vbd.feature_gnt_persistent =3D feature_persistent; - return blkif; } =20 @@ -1089,10 +1087,9 @@ static int connect_ring(struct backend_i xenbus_dev_fatal(dev, err, "unknown fe protocol %s", protocol); return -ENOSYS; } - if (blkif->vbd.feature_gnt_persistent) - blkif->vbd.feature_gnt_persistent =3D - xenbus_read_unsigned(dev->otherend, - "feature-persistent", 0); + + blkif->vbd.feature_gnt_persistent =3D feature_persistent && + xenbus_read_unsigned(dev->otherend, "feature-persistent", 0); =20 blkif->vbd.overflow_max_grants =3D 0; From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A912C00140 for ; Mon, 15 Aug 2022 19:59:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241698AbiHOT7K (ORCPT ); Mon, 15 Aug 2022 15:59:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346061AbiHOT5D (ORCPT ); Mon, 15 Aug 2022 15:57: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 498DE78229; Mon, 15 Aug 2022 11:52: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 60909B810A1; Mon, 15 Aug 2022 18:52:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C4457C433C1; Mon, 15 Aug 2022 18:52:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589569; bh=6OwoQ0RGXBhOQVY/1FcNs69u0WinqpaeV3J8bWF2GDc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G2BlLQH82L1tldILYobwfRPapdZk+0OGFmt45ZUh2W+2n/JbuGhxEe8V25tmAW+h1 Wbinhc05FcJQt2yZV1bUNJFBQH4fR8m4/5hqF5pHydE0cziluWKxzyJycMWjqS24R8 GLNqaWBDmtAXqYysFoW2uQE53usBpJt5Qb61POoc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, SeongJae Park , Maximilian Heyne , Juergen Gross Subject: [PATCH 5.15 758/779] xen-blkfront: Apply feature_persistent parameter when connect Date: Mon, 15 Aug 2022 20:06:42 +0200 Message-Id: <20220815180409.853377245@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: SeongJae Park commit 402c43ea6b34a1b371ffeed9adf907402569eaf5 upstream. In some use cases[1], the backend is created while the frontend doesn't support the persistent grants feature, but later the frontend can be changed to support the feature and reconnect. In the past, 'blkback' enabled the persistent grants feature since it unconditionally checked if frontend supports the persistent grants feature for every connect ('connect_ring()') and decided whether it should use persistent grans or not. However, commit aac8a70db24b ("xen-blkback: add a parameter for disabling of persistent grants") has mistakenly changed the behavior. It made the frontend feature support check to not be repeated once it shown the 'feature_persistent' as 'false', or the frontend doesn't support persistent grants. Similar behavioral change has made on 'blkfront' by commit 74a852479c68 ("xen-blkfront: add a parameter for disabling of persistent grants"). This commit changes the behavior of the parameter to make effect for every connect, so that the previous behavior of 'blkfront' can be restored. [1] https://lore.kernel.org/xen-devel/CAJwUmVB6H3iTs-C+U=3Dv-pwJB7-_ZRHPxHz= KRJZ22xEPW7z8a=3Dg@mail.gmail.com/ Fixes: 74a852479c68 ("xen-blkfront: add a parameter for disabling of persis= tent grants") Cc: # 5.10.x Signed-off-by: SeongJae Park Reviewed-by: Maximilian Heyne Reviewed-by: Juergen Gross Link: https://lore.kernel.org/r/20220715225108.193398-4-sj@kernel.org Signed-off-by: Juergen Gross Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- Documentation/ABI/testing/sysfs-driver-xen-blkfront | 2 +- drivers/block/xen-blkfront.c | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) --- a/Documentation/ABI/testing/sysfs-driver-xen-blkfront +++ b/Documentation/ABI/testing/sysfs-driver-xen-blkfront @@ -15,5 +15,5 @@ KernelVersion: 5.10 Contact: SeongJae Park Description: Whether to enable the persistent grants feature or not. N= ote - that this option only takes effect on newly created fronte= nds. + that this option only takes effect on newly connected fron= tends. The default is Y (enable). --- a/drivers/block/xen-blkfront.c +++ b/drivers/block/xen-blkfront.c @@ -2014,8 +2014,6 @@ static int blkfront_probe(struct xenbus_ info->vdevice =3D vdevice; info->connected =3D BLKIF_STATE_DISCONNECTED; =20 - info->feature_persistent =3D feature_persistent; - /* Front end dir is a number, which is used as the id. */ info->handle =3D simple_strtoul(strrchr(dev->nodename, '/')+1, NULL, 0); dev_set_drvdata(&dev->dev, info); @@ -2309,7 +2307,7 @@ static void blkfront_gather_backend_feat if (xenbus_read_unsigned(info->xbdev->otherend, "feature-discard", 0)) blkfront_setup_discard(info); =20 - if (info->feature_persistent) + if (feature_persistent) info->feature_persistent =3D !!xenbus_read_unsigned(info->xbdev->otherend, "feature-persistent", 0); From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53217C00140 for ; Mon, 15 Aug 2022 19:59:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345821AbiHOT7Q (ORCPT ); Mon, 15 Aug 2022 15:59:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346073AbiHOT5F (ORCPT ); Mon, 15 Aug 2022 15:57:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21C1578235; Mon, 15 Aug 2022 11:52: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 84C5AB810A2; Mon, 15 Aug 2022 18:52:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BECC6C433D7; Mon, 15 Aug 2022 18:52:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589572; bh=kzeU9tDf5ZnnhwhFYJgUGea/xFAtBz4ef9sqrhgUL+s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r1uBCdzG0JbezJIZZVk7UB0cpyBbkfMMGXDLyOBvsJGdIKawsLLx7EgTSGAxW5m6m 5N0SQTGVAcYNtT7IyrPYyXf9isTWp82awHww/Oq02ZuzVG7TQdQst7KZFM7SNbLUB7 ylRfvUIcf9IANMBZPQvqnW6IJtLiukMAqQ/9Pa9c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Pali=20Roh=C3=A1r?= , Christophe Leroy , Segher Boessenkool , Michael Ellerman Subject: [PATCH 5.15 759/779] powerpc: Fix eh field when calling lwarx on PPC32 Date: Mon, 15 Aug 2022 20:06:43 +0200 Message-Id: <20220815180409.887837961@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christophe Leroy commit 18db466a9a306406dab3b134014d9f6ed642471c upstream. Commit 9401f4e46cf6 ("powerpc: Use lwarx/ldarx directly instead of PPC_LWARX/LDARX macros") properly handled the eh field of lwarx in asm/bitops.h but failed to clear it for PPC32 in asm/simple_spinlock.h So, do as in arch_atomic_try_cmpxchg_lock(), set it to 1 if PPC64 but set it to 0 if PPC32. For that use IS_ENABLED(CONFIG_PPC64) which returns 1 when CONFIG_PPC64 is set and 0 otherwise. Fixes: 9401f4e46cf6 ("powerpc: Use lwarx/ldarx directly instead of PPC_LWAR= X/LDARX macros") Cc: stable@vger.kernel.org # v5.15+ Reported-by: Pali Roh=C3=A1r Signed-off-by: Christophe Leroy Tested-by: Pali Roh=C3=A1r Reviewed-by: Segher Boessenkool [mpe: Use symbolic names, use 'n' constraint per Segher] Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/a1176e19e627dd6a1b8d24c6c457a8ab874b7d12.16= 59430931.git.christophe.leroy@csgroup.eu Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/powerpc/include/asm/simple_spinlock.h | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) --- a/arch/powerpc/include/asm/simple_spinlock.h +++ b/arch/powerpc/include/asm/simple_spinlock.h @@ -48,10 +48,11 @@ static inline int arch_spin_is_locked(ar static inline unsigned long __arch_spin_trylock(arch_spinlock_t *lock) { unsigned long tmp, token; + unsigned int eh =3D IS_ENABLED(CONFIG_PPC64); =20 token =3D LOCK_TOKEN; __asm__ __volatile__( -"1: lwarx %0,0,%2,1\n\ +"1: lwarx %0,0,%2,%[eh]\n\ cmpwi 0,%0,0\n\ bne- 2f\n\ stwcx. %1,0,%2\n\ @@ -59,7 +60,7 @@ static inline unsigned long __arch_spin_ PPC_ACQUIRE_BARRIER "2:" : "=3D&r" (tmp) - : "r" (token), "r" (&lock->slock) + : "r" (token), "r" (&lock->slock), [eh] "n" (eh) : "cr0", "memory"); =20 return tmp; @@ -177,9 +178,10 @@ static inline void arch_spin_unlock(arch static inline long __arch_read_trylock(arch_rwlock_t *rw) { long tmp; + unsigned int eh =3D IS_ENABLED(CONFIG_PPC64); =20 __asm__ __volatile__( -"1: lwarx %0,0,%1,1\n" +"1: lwarx %0,0,%1,%[eh]\n" __DO_SIGN_EXTEND " addic. %0,%0,1\n\ ble- 2f\n" @@ -187,7 +189,7 @@ static inline long __arch_read_trylock(a bne- 1b\n" PPC_ACQUIRE_BARRIER "2:" : "=3D&r" (tmp) - : "r" (&rw->lock) + : "r" (&rw->lock), [eh] "n" (eh) : "cr0", "xer", "memory"); =20 return tmp; @@ -200,17 +202,18 @@ static inline long __arch_read_trylock(a static inline long __arch_write_trylock(arch_rwlock_t *rw) { long tmp, token; + unsigned int eh =3D IS_ENABLED(CONFIG_PPC64); =20 token =3D WRLOCK_TOKEN; __asm__ __volatile__( -"1: lwarx %0,0,%2,1\n\ +"1: lwarx %0,0,%2,%[eh]\n\ cmpwi 0,%0,0\n\ bne- 2f\n" " stwcx. %1,0,%2\n\ bne- 1b\n" PPC_ACQUIRE_BARRIER "2:" : "=3D&r" (tmp) - : "r" (token), "r" (&rw->lock) + : "r" (token), "r" (&rw->lock), [eh] "n" (eh) : "cr0", "memory"); =20 return tmp; From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08B66C00140 for ; Mon, 15 Aug 2022 19:59:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345828AbiHOT7X (ORCPT ); Mon, 15 Aug 2022 15:59:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346109AbiHOT5L (ORCPT ); Mon, 15 Aug 2022 15:57:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8CC7785A3; Mon, 15 Aug 2022 11:52: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 0815B611ED; Mon, 15 Aug 2022 18:52:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB991C433C1; Mon, 15 Aug 2022 18:52:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589575; bh=zm5yPCSka08KCN9psAi49vcukmwi+nuzh5ZWb1E34GA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yOXhaAMsxTcUB3DUPgaPMgfEkfdfMHAXOozOQTXdzilp8tLCzOVsLeWz4XSfKDBLy QFhqMPSfct3lfbOIISnPC5DXQkeCiZXXJkEI69rXr8Tt6TFCyi5LJi8k+zWtBeNVL6 jnf5OloM7SesjNP+2IAwx9k/AKO3h4bZY0pcRgG4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ingo Molnar , Andrew Morton , Peter Zijlstra , Thomas Gleixner , Masami Hiramatsu , "Steven Rostedt (Google)" Subject: [PATCH 5.15 760/779] tracing: Use a struct alignof to determine trace event field alignment Date: Mon, 15 Aug 2022 20:06:44 +0200 Message-Id: <20220815180409.926703705@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Steven Rostedt (Google) commit 4c3d2f9388d36eb28640a220a6f908328442d873 upstream. alignof() gives an alignment of types as they would be as standalone variables. But alignment in structures might be different, and when building the fields of events, the alignment must be the actual alignment otherwise the field offsets may not match what they actually are. This caused trace-cmd to crash, as libtraceevent did not check if the field offset was bigger than the event. The write_msr and read_msr events on 32 bit had their fields incorrect, because it had a u64 field between two ints. alignof(u64) would give 8, but the u64 field was at a 4 byte alignment. Define a macro as: ALIGN_STRUCTFIELD(type) ((int)(offsetof(struct {char a; type b;}, b))) which gives the actual alignment of types in a structure. Link: https://lkml.kernel.org/r/20220731015928.7ab3a154@rorschach.local.home Cc: Ingo Molnar Cc: Andrew Morton Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Masami Hiramatsu Cc: stable@vger.kernel.org Fixes: 04ae87a52074e ("ftrace: Rework event_create_dir()") Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- include/trace/trace_events.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/include/trace/trace_events.h +++ b/include/trace/trace_events.h @@ -479,16 +479,18 @@ static struct trace_event_functions trac =20 #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) =20 +#define ALIGN_STRUCTFIELD(type) ((int)(offsetof(struct {char a; type b;}, = b))) + #undef __field_ext #define __field_ext(_type, _item, _filter_type) { \ .type =3D #_type, .name =3D #_item, \ - .size =3D sizeof(_type), .align =3D __alignof__(_type), \ + .size =3D sizeof(_type), .align =3D ALIGN_STRUCTFIELD(_type), \ .is_signed =3D is_signed_type(_type), .filter_type =3D _filter_type }, =20 #undef __field_struct_ext #define __field_struct_ext(_type, _item, _filter_type) { \ .type =3D #_type, .name =3D #_item, \ - .size =3D sizeof(_type), .align =3D __alignof__(_type), \ + .size =3D sizeof(_type), .align =3D ALIGN_STRUCTFIELD(_type), \ 0, .filter_type =3D _filter_type }, =20 #undef __field @@ -500,7 +502,7 @@ static struct trace_event_functions trac #undef __array #define __array(_type, _item, _len) { \ .type =3D #_type"["__stringify(_len)"]", .name =3D #_item, \ - .size =3D sizeof(_type[_len]), .align =3D __alignof__(_type), \ + .size =3D sizeof(_type[_len]), .align =3D ALIGN_STRUCTFIELD(_type), \ .is_signed =3D is_signed_type(_type), .filter_type =3D FILTER_OTHER }, =20 #undef __dynamic_array From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CF6AC00140 for ; Mon, 15 Aug 2022 20:04:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239805AbiHOUEc (ORCPT ); Mon, 15 Aug 2022 16:04:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230438AbiHOUDn (ORCPT ); Mon, 15 Aug 2022 16:03: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 614027E310; Mon, 15 Aug 2022 11:54:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7BD23B8105D; Mon, 15 Aug 2022 18:54:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C189CC433D6; Mon, 15 Aug 2022 18:54:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589658; bh=ScgBIY3HQMCcOzB+zPgCsLe9LaGbzeQNrwHYt+biqjc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lMo7c5wPmVajByEIjqnR1dSWAhL4IK9516rtYaSjZgtcOZFzZS5biOBqkcMMYpSG7 SHhnTxdRWnAL7O/AK+Hdj7duj4NZlrM+kpmVAAi826HGVblHxyqlxhniHv6+DB9CBR kFqAhJTLZm9MVjm1YwL8Nq14oBdaYWWdToE18QuE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhenpeng Lin , Thadeu Lima de Souza Cascardo , Kamal Mostafa , Jamal Hadi Salim , Jakub Kicinski Subject: [PATCH 5.15 761/779] net_sched: cls_route: remove from list when handle is 0 Date: Mon, 15 Aug 2022 20:06:45 +0200 Message-Id: <20220815180409.960854834@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Thadeu Lima de Souza Cascardo commit 9ad36309e2719a884f946678e0296be10f0bb4c1 upstream. When a route filter is replaced and the old filter has a 0 handle, the old one won't be removed from the hashtable, while it will still be freed. The test was there since before commit 1109c00547fc ("net: sched: RCU cls_route"), when a new filter was not allocated when there was an old one. The old filter was reused and the reinserting would only be necessary if an old filter was replaced. That was still wrong for the same case where the old handle was 0. Remove the old filter from the list independently from its handle value. This fixes CVE-2022-2588, also reported as ZDI-CAN-17440. Reported-by: Zhenpeng Lin Signed-off-by: Thadeu Lima de Souza Cascardo Reviewed-by: Kamal Mostafa Cc: Acked-by: Jamal Hadi Salim Link: https://lore.kernel.org/r/20220809170518.164662-1-cascardo@canonical.= com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- net/sched/cls_route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/sched/cls_route.c +++ b/net/sched/cls_route.c @@ -526,7 +526,7 @@ static int route4_change(struct net *net rcu_assign_pointer(f->next, f1); rcu_assign_pointer(*fp, f); =20 - if (fold && fold->handle && f->handle !=3D fold->handle) { + if (fold) { th =3D to_hash(fold->handle); h =3D from_hash(fold->handle >> 16); b =3D rtnl_dereference(head->table[th]); From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BE88C00140 for ; Mon, 15 Aug 2022 20:03:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345540AbiHOUDJ (ORCPT ); Mon, 15 Aug 2022 16:03:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346007AbiHOUB0 (ORCPT ); Mon, 15 Aug 2022 16:01:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B2327A530; Mon, 15 Aug 2022 11:53: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 897EAB81057; Mon, 15 Aug 2022 18:53:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2F20C433C1; Mon, 15 Aug 2022 18:53:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589601; bh=6hATWuGjC+v5hX5HKJfRtz4fpdLRzt5zZwyjJviBpEI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s9DhqUzSADCnol1VnntN/0tX39ed6qKSrVoyAzZiHoDLD0BxyIF5ILJWY9RfstBUX aw9gGpdwg+9n582zQO6Qib7yohR5uEbKqFyc0f/it2QFPufyHqZYnJ6mF/0to+AM08 yospz+FqCNfCqUDqIpmDVtQ+jmdVv22skzaxv3FU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ahmed Zaki , Johannes Berg , Viacheslav Sablin Subject: [PATCH 5.15 762/779] mac80211: fix a memory leak where sta_info is not freed Date: Mon, 15 Aug 2022 20:06:46 +0200 Message-Id: <20220815180409.996306392@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ahmed Zaki commit 8f9dcc29566626f683843ccac6113a12208315ca upstream. The following is from a system that went OOM due to a memory leak: wlan0: Allocated STA 74:83:c2:64:0b:87 wlan0: Allocated STA 74:83:c2:64:0b:87 wlan0: IBSS finish 74:83:c2:64:0b:87 (---from ieee80211_ibss_add_sta) wlan0: Adding new IBSS station 74:83:c2:64:0b:87 wlan0: moving STA 74:83:c2:64:0b:87 to state 2 wlan0: moving STA 74:83:c2:64:0b:87 to state 3 wlan0: Inserted STA 74:83:c2:64:0b:87 wlan0: IBSS finish 74:83:c2:64:0b:87 (---from ieee80211_ibss_work) wlan0: Adding new IBSS station 74:83:c2:64:0b:87 wlan0: moving STA 74:83:c2:64:0b:87 to state 2 wlan0: moving STA 74:83:c2:64:0b:87 to state 3 =2E =2E wlan0: expiring inactive not authorized STA 74:83:c2:64:0b:87 wlan0: moving STA 74:83:c2:64:0b:87 to state 2 wlan0: moving STA 74:83:c2:64:0b:87 to state 1 wlan0: Removed STA 74:83:c2:64:0b:87 wlan0: Destroyed STA 74:83:c2:64:0b:87 The ieee80211_ibss_finish_sta() is called twice on the same STA from 2 different locations. On the second attempt, the allocated STA is not destroyed creating a kernel memory leak. This is happening because sta_info_insert_finish() does not call sta_info_free() the second time when the STA already exists (returns -EEXIST). Note that the caller sta_info_insert_rcu() assumes STA is destroyed upon errors. Same fix is applied to -ENOMEM. Signed-off-by: Ahmed Zaki Link: https://lore.kernel.org/r/20211002145329.3125293-1-anzaki@gmail.com [change the error path label to use the existing code] Signed-off-by: Johannes Berg Signed-off-by: Viacheslav Sablin Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- net/mac80211/sta_info.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c @@ -641,13 +641,13 @@ static int sta_info_insert_finish(struct /* check if STA exists already */ if (sta_info_get_bss(sdata, sta->sta.addr)) { err =3D -EEXIST; - goto out_err; + goto out_cleanup; } =20 sinfo =3D kzalloc(sizeof(struct station_info), GFP_KERNEL); if (!sinfo) { err =3D -ENOMEM; - goto out_err; + goto out_cleanup; } =20 local->num_sta++; @@ -703,8 +703,8 @@ static int sta_info_insert_finish(struct out_drop_sta: local->num_sta--; synchronize_net(); + out_cleanup: cleanup_single_sta(sta); - out_err: mutex_unlock(&local->sta_mtx); kfree(sinfo); rcu_read_lock(); From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1424C00140 for ; Mon, 15 Aug 2022 20:03:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243890AbiHOUC7 (ORCPT ); Mon, 15 Aug 2022 16:02:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346138AbiHOUBp (ORCPT ); Mon, 15 Aug 2022 16:01:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CAE17CB64; Mon, 15 Aug 2022 11:53: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 1343FB810A0; Mon, 15 Aug 2022 18:53:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48776C43470; Mon, 15 Aug 2022 18:53:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589632; bh=lO4agyz0ZSzI8UkHKUsysasIuHutY5jQ8FqjF1ZH5tE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RjKG6pmjqr0gp964v9nJ9byIbVWtcw3OnhNjnBlEXov8+dYxqx6DOBByGP2plGTqv q2FJrDXKun2V9Dt/CsN0/tnlVo95K2RJretPossv8j8meSS3r2UL/680AKbpoqQ7JR /SEt/hI4CalonqCefe3EOS/jffkMR6PFMWcTIA0M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , Soheil Hassas Yeganeh , Shakeel Butt , Wei Wang , "David S. Miller" Subject: [PATCH 5.15 763/779] tcp: fix over estimation in sk_forced_mem_schedule() Date: Mon, 15 Aug 2022 20:06:47 +0200 Message-Id: <20220815180410.031894477@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Eric Dumazet commit c4ee118561a0f74442439b7b5b486db1ac1ddfeb upstream. sk_forced_mem_schedule() has a bug similar to ones fixed in commit 7c80b038d23e ("net: fix sk_wmem_schedule() and sk_rmem_schedule() errors") While this bug has little chance to trigger in old kernels, we need to fix it before the following patch. Fixes: d83769a580f1 ("tcp: fix possible deadlock in tcp_send_fin()") Signed-off-by: Eric Dumazet Acked-by: Soheil Hassas Yeganeh Reviewed-by: Shakeel Butt Reviewed-by: Wei Wang Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- net/ipv4/tcp_output.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -3372,11 +3372,12 @@ void tcp_xmit_retransmit_queue(struct so */ void sk_forced_mem_schedule(struct sock *sk, int size) { - int amt; + int delta, amt; =20 - if (size <=3D sk->sk_forward_alloc) + delta =3D size - sk->sk_forward_alloc; + if (delta <=3D 0) return; - amt =3D sk_mem_pages(size); + amt =3D sk_mem_pages(delta); sk->sk_forward_alloc +=3D amt * SK_MEM_QUANTUM; sk_memory_allocated_add(sk, amt); From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 659F2C00140 for ; Mon, 15 Aug 2022 20:03:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233255AbiHOUD1 (ORCPT ); Mon, 15 Aug 2022 16:03:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346211AbiHOUBx (ORCPT ); Mon, 15 Aug 2022 16:01:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC0F17D1D2; Mon, 15 Aug 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 29147B810A2; Mon, 15 Aug 2022 18:53:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 746FBC433C1; Mon, 15 Aug 2022 18:53:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589635; bh=vDkvebUt7MZA8+U3hS5joEOkD7qc/yPP/d1mBQwSSSQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v0c/NMwkaW1FioGdS3uC/aME3rs3lNq+8Lo83Rl7X93MqcyT9tbKH28Rn6DMZnRpj /++reb+quQuAhhz/9SIxT6PEKSmYIVpOj3OSdve7wnmnvNjnPk8p/3lC/+1+M1oEVv U2k2TdPpczjZ1+ViJhU4iyH/5FJ9U/CSqFbKpBd0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , "Jason A. Donenfeld" , Herbert Xu Subject: [PATCH 5.15 764/779] crypto: lib/blake2s - reduce stack frame usage in self test Date: Mon, 15 Aug 2022 20:06:48 +0200 Message-Id: <20220815180410.068767541@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-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 commit d6c14da474bf260d73953fbf7992c98d9112aec7 upstream. Using 3 blocks here doesn't give us much more than using 2, and it causes a stack frame size warning on certain compiler/config/arch combinations: lib/crypto/blake2s-selftest.c: In function 'blake2s_selftest': >> lib/crypto/blake2s-selftest.c:632:1: warning: the frame size of 1088 byt= es is larger than 1024 bytes [-Wframe-larger-than=3D] 632 | } | ^ So this patch just reduces the block from 3 to 2, which makes the warning go away. Reported-by: kernel test robot Link: https://lore.kernel.org/linux-crypto/202206200851.gE3MHCgd-lkp@intel.= com Fixes: 2d16803c562e ("crypto: blake2s - remove shash module") Signed-off-by: Jason A. Donenfeld Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- lib/crypto/blake2s-selftest.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/lib/crypto/blake2s-selftest.c +++ b/lib/crypto/blake2s-selftest.c @@ -593,7 +593,7 @@ bool __init blake2s_selftest(void) enum { TEST_ALIGNMENT =3D 16 }; u8 unaligned_block[BLAKE2S_BLOCK_SIZE + TEST_ALIGNMENT - 1] __aligned(TEST_ALIGNMENT); - u8 blocks[BLAKE2S_BLOCK_SIZE * 3]; + u8 blocks[BLAKE2S_BLOCK_SIZE * 2]; struct blake2s_state state1, state2; =20 get_random_bytes(blocks, sizeof(blocks)); @@ -603,8 +603,8 @@ bool __init blake2s_selftest(void) defined(CONFIG_CRYPTO_ARCH_HAVE_LIB_BLAKE2S) memcpy(&state1, &state, sizeof(state1)); memcpy(&state2, &state, sizeof(state2)); - blake2s_compress(&state1, blocks, 3, BLAKE2S_BLOCK_SIZE); - blake2s_compress_generic(&state2, blocks, 3, BLAKE2S_BLOCK_SIZE); + blake2s_compress(&state1, blocks, 2, BLAKE2S_BLOCK_SIZE); + blake2s_compress_generic(&state2, blocks, 2, BLAKE2S_BLOCK_SIZE); if (memcmp(&state1, &state2, sizeof(state1))) { pr_err("blake2s random compress self-test %d: FAIL\n", i + 1); From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BEBDC00140 for ; Mon, 15 Aug 2022 20:03:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233208AbiHOUDh (ORCPT ); Mon, 15 Aug 2022 16:03:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39310 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346268AbiHOUCA (ORCPT ); Mon, 15 Aug 2022 16:02:00 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E26817D1CA; Mon, 15 Aug 2022 11:54: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 5A9B7B81057; Mon, 15 Aug 2022 18:54:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F654C433C1; Mon, 15 Aug 2022 18:53:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589639; bh=lduLUySsI1WUtQlgUnp59GOTkb0x8BOtWEUvizrx5lg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pJCinDvNKpYEmcOpGTwMT6p9olAkv8kMNPRLZwvgV2yT80hCJ/gHJtNsH322xMNUl FoPkAfblv5xTlOcVJwSx1AOieeP2KMyVZzbk8upVgiwXCcKna00XnryaY7sKAZKCMD i0AkLVu/OOL5PxwOmQ6VVwMVhEjRMLrYnYX2gOMo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Duoming Zhou , Brian Norris , Johannes Berg , Stephen Rothwell Subject: [PATCH 5.15 765/779] Revert "mwifiex: fix sleep in atomic context bugs caused by dev_coredumpv" Date: Mon, 15 Aug 2022 20:06:49 +0200 Message-Id: <20220815180410.114354620@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Greg Kroah-Hartman commit 5f8954e099b8ae96e7de1bb95950e00c85bedd40 upstream. This reverts commit a52ed4866d2b90dd5e4ae9dabd453f3ed8fa3cbc as it causes build problems in linux-next. It needs to be reintroduced in a way that can allow the api to evolve and not require a "flag day" to catch all users. Link: https://lore.kernel.org/r/20220623160723.7a44b573@canb.auug.org.au Cc: Duoming Zhou Cc: Brian Norris Cc: Johannes Berg Reported-by: Stephen Rothwell Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/wireless/marvell/mwifiex/init.c | 9 ++++----- drivers/net/wireless/marvell/mwifiex/main.h | 3 +-- drivers/net/wireless/marvell/mwifiex/sta_event.c | 6 +++--- 3 files changed, 8 insertions(+), 10 deletions(-) --- a/drivers/net/wireless/marvell/mwifiex/init.c +++ b/drivers/net/wireless/marvell/mwifiex/init.c @@ -63,10 +63,9 @@ static void wakeup_timer_fn(struct timer adapter->if_ops.card_reset(adapter); } =20 -static void fw_dump_work(struct work_struct *work) +static void fw_dump_timer_fn(struct timer_list *t) { - struct mwifiex_adapter *adapter =3D - container_of(work, struct mwifiex_adapter, devdump_work.work); + struct mwifiex_adapter *adapter =3D from_timer(adapter, t, devdump_timer); =20 mwifiex_upload_device_dump(adapter); } @@ -322,7 +321,7 @@ static void mwifiex_init_adapter(struct adapter->active_scan_triggered =3D false; timer_setup(&adapter->wakeup_timer, wakeup_timer_fn, 0); adapter->devdump_len =3D 0; - INIT_DELAYED_WORK(&adapter->devdump_work, fw_dump_work); + timer_setup(&adapter->devdump_timer, fw_dump_timer_fn, 0); } =20 /* @@ -401,7 +400,7 @@ static void mwifiex_adapter_cleanup(struct mwifiex_adapter *adapter) { del_timer(&adapter->wakeup_timer); - cancel_delayed_work_sync(&adapter->devdump_work); + del_timer_sync(&adapter->devdump_timer); mwifiex_cancel_all_pending_cmd(adapter); wake_up_interruptible(&adapter->cmd_wait_q.wait); wake_up_interruptible(&adapter->hs_activate_wait_q); --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -49,7 +49,6 @@ #include #include #include -#include =20 #include "decl.h" #include "ioctl.h" @@ -1054,7 +1053,7 @@ struct mwifiex_adapter { /* Device dump data/length */ void *devdump_data; int devdump_len; - struct delayed_work devdump_work; + struct timer_list devdump_timer; =20 bool ignore_btcoex_events; }; --- a/drivers/net/wireless/marvell/mwifiex/sta_event.c +++ b/drivers/net/wireless/marvell/mwifiex/sta_event.c @@ -623,8 +623,8 @@ mwifiex_fw_dump_info_event(struct mwifie * transmission event get lost, in this cornel case, * user would still get partial of the dump. */ - schedule_delayed_work(&adapter->devdump_work, - msecs_to_jiffies(MWIFIEX_TIMER_10S)); + mod_timer(&adapter->devdump_timer, + jiffies + msecs_to_jiffies(MWIFIEX_TIMER_10S)); } =20 /* Overflow check */ @@ -643,7 +643,7 @@ mwifiex_fw_dump_info_event(struct mwifie return; =20 upload_dump: - cancel_delayed_work_sync(&adapter->devdump_work); + del_timer_sync(&adapter->devdump_timer); mwifiex_upload_device_dump(adapter); } From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81AD7C25B0E for ; Mon, 15 Aug 2022 20:03:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239960AbiHOUDe (ORCPT ); Mon, 15 Aug 2022 16:03:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346264AbiHOUB7 (ORCPT ); Mon, 15 Aug 2022 16: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 631037D1FE; Mon, 15 Aug 2022 11:54: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 5F904B810A4; Mon, 15 Aug 2022 18:54:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8A99C433C1; Mon, 15 Aug 2022 18:54:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589642; bh=ADDZENk4U535ezQ9Bwf0xtyUCnQSO4AeE9KEO3JLlTc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YX7EdM/54O/E7e8AeQWfyNCnpXNBFN9ITo6NhKYpy9vdWpuyGnL/bPDKJTnEc55SY GouvJuFIA50KuP5gvx7dVxEimtmYnCh0P7UjQ7+dtJSo6+Q8Xm3aj3+kCvrP71XK3p Yj2bSHTU0XGMTj2nht4j+vQB2QYkWpodQyL/tDcQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Gordeev Subject: [PATCH 5.15 766/779] Revert "s390/smp: enforce lowcore protection on CPU restart" Date: Mon, 15 Aug 2022 20:06:50 +0200 Message-Id: <20220815180410.150840368@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Gordeev commit 953503751a426413ea8aee2299ae3ee971b70d9b upstream. This reverts commit 6f5c672d17f583b081e283927f5040f726c54598. This breaks normal crash dump when CPU0 is offline. Signed-off-by: Alexander Gordeev Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- arch/s390/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/s390/kernel/setup.c +++ b/arch/s390/kernel/setup.c @@ -507,8 +507,8 @@ static void __init setup_lowcore_dat_on( S390_lowcore.svc_new_psw.mask |=3D PSW_MASK_DAT; S390_lowcore.program_new_psw.mask |=3D PSW_MASK_DAT; S390_lowcore.io_new_psw.mask |=3D PSW_MASK_DAT; - __ctl_set_bit(0, 28); __ctl_store(S390_lowcore.cregs_save_area, 0, 15); + __ctl_set_bit(0, 28); put_abs_lowcore(restart_flags, RESTART_FLAG_CTLREGS); put_abs_lowcore(program_new_psw, lc->program_new_psw); for (cr =3D 0; cr < ARRAY_SIZE(lc->cregs_save_area); cr++) From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D47F8C00140 for ; Mon, 15 Aug 2022 20:04:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242753AbiHOUEF (ORCPT ); Mon, 15 Aug 2022 16:04:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344447AbiHOUDH (ORCPT ); Mon, 15 Aug 2022 16:03:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95C4B7D793; Mon, 15 Aug 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 ams.source.kernel.org (Postfix) with ESMTPS id 9FF6DB810A5; Mon, 15 Aug 2022 18:54:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9FF6C433C1; Mon, 15 Aug 2022 18:54:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589645; bh=MezgPMKIrRoCLy1vw1mfpOkaaDTLL/QVc33MHS2Qw4A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qQk2OtTc48bVVtKB22m2abV7/WebA6acXid06RoVWs8WFxxQW+AYTKLw4Al5wR1LL QrA00C/9TjSqEQMDD8SUYIHqsC6nyYImzLzXv31E6Y9Kz90RDQRyIgEV43RqEboUdh W4tvBvYC8wvsDozTXM1+eHzOSTfhPsg6GphbnF9o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Vasut , Jonas Karlman , Laurent Pinchart , Lucas Stach , Maxime Ripard , Neil Armstrong , Robert Foss , Sam Ravnborg Subject: [PATCH 5.15 767/779] drm/bridge: tc358767: Fix (e)DP bridge endpoint parsing in dedicated function Date: Mon, 15 Aug 2022 20:06:51 +0200 Message-Id: <20220815180410.180744819@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marek Vasut commit 9030a9e571b3ba250d3d450a98310e3c74ecaff4 upstream. Per toshiba,tc358767.yaml DT binding document, port@2 the output (e)DP port is optional. In case this port is not described in DT, the bridge driver operates in DPI-to-DP mode. The drm_of_find_panel_or_bridge() call in tc_probe_edp_bridge_endpoint() returns -ENODEV in case port@2 is not present in DT and this specific return value is incorrectly propagated outside of tc_probe_edp_bridge_endpoint() function. All other error values must be propagated and are propagated correctly. Return 0 in case the port@2 is missing instead, that reinstates the original behavior before the commit this patch fixes. Fixes: 8478095a8c4b ("drm/bridge: tc358767: Move (e)DP bridge endpoint pars= ing into dedicated function") Signed-off-by: Marek Vasut Cc: Jonas Karlman Cc: Laurent Pinchart Cc: Lucas Stach Cc: Marek Vasut Cc: Maxime Ripard Cc: Neil Armstrong Cc: Robert Foss Cc: Sam Ravnborg Reviewed-by: Lucas Stach Link: https://patchwork.freedesktop.org/patch/msgid/20220428213132.447890-1= -marex@denx.de Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/bridge/tc358767.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/bridge/tc358767.c +++ b/drivers/gpu/drm/bridge/tc358767.c @@ -1573,7 +1573,7 @@ static int tc_probe_edp_bridge_endpoint( tc->bridge.type =3D DRM_MODE_CONNECTOR_DisplayPort; } =20 - return ret; + return 0; } =20 static int tc_probe(struct i2c_client *client, const struct i2c_device_id = *id) From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46C96C00140 for ; Mon, 15 Aug 2022 20:03:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240290AbiHOUDs (ORCPT ); Mon, 15 Aug 2022 16:03:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239498AbiHOUCT (ORCPT ); Mon, 15 Aug 2022 16:02:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 638AA7CB7F; Mon, 15 Aug 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 E4FF461228; Mon, 15 Aug 2022 18:54:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECDCFC433C1; Mon, 15 Aug 2022 18:54:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589648; bh=sCNQHxIcqQE3JOMnC1htlcE1nC/bTIllDvjHDq3ZsNs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kp2kNMgi+KK1wTkhw+Wh5ypVbNvhZqSVmcyqBvnsMCV2R2qyto1TyA3qOZDnQzs6g +45HT2gfmG+1tpbAaSOlVjATcwxr9b6eZF5KlhzG+vDJIwQH3KlvS6oeumD0w/IhDT DdDNXx6c0+Y4XGs+7uSSyJTC6x05CPpM/jWfCEWQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Simon Han , Lukas Wunner , Jakub Kicinski Subject: [PATCH 5.15 768/779] net: phy: smsc: Disable Energy Detect Power-Down in interrupt mode Date: Mon, 15 Aug 2022 20:06:52 +0200 Message-Id: <20220815180410.211874258@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lukas Wunner commit 2642cc6c3bbe0900ba15bab078fd15ad8baccbc5 upstream. Simon reports that if two LAN9514 USB adapters are directly connected without an intermediate switch, the link fails to come up and link LEDs remain dark. The issue was introduced by commit 1ce8b37241ed ("usbnet: smsc95xx: Forward PHY interrupts to PHY driver to avoid polling"). The PHY suffers from a known erratum wherein link detection becomes unreliable if Energy Detect Power-Down is used. In poll mode, the driver works around the erratum by briefly disabling EDPD for 640 msec to detect a neighbor, then re-enabling it to save power. In interrupt mode, no interrupt is signaled if EDPD is used by both link partners, so it must not be enabled at all. We'll recoup the power savings by enabling SUSPEND1 mode on affected LAN95xx chips in a forthcoming commit. Fixes: 1ce8b37241ed ("usbnet: smsc95xx: Forward PHY interrupts to PHY drive= r to avoid polling") Reported-by: Simon Han Signed-off-by: Lukas Wunner Link: https://lore.kernel.org/r/439a3f3168c2f9d44b5fd9bb8d2b551711316be6.16= 55714438.git.lukas@wunner.de Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/phy/smsc.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/net/phy/smsc.c +++ b/drivers/net/phy/smsc.c @@ -110,7 +110,7 @@ static int smsc_phy_config_init(struct p struct smsc_phy_priv *priv =3D phydev->priv; int rc; =20 - if (!priv->energy_enable) + if (!priv->energy_enable || phydev->irq !=3D PHY_POLL) return 0; =20 rc =3D phy_read(phydev, MII_LAN83C185_CTRL_STATUS); @@ -210,6 +210,8 @@ static int lan95xx_config_aneg_ext(struc * response on link pulses to detect presence of plugged Ethernet cable. * The Energy Detect Power-Down mode is enabled again in the end of proced= ure to * save approximately 220 mW of power if cable is unplugged. + * The workaround is only applicable to poll mode. Energy Detect Power-Dow= n may + * not be used in interrupt mode lest link change detection becomes unreli= able. */ static int lan87xx_read_status(struct phy_device *phydev) { @@ -217,7 +219,7 @@ static int lan87xx_read_status(struct ph =20 int err =3D genphy_read_status(phydev); =20 - if (!phydev->link && priv->energy_enable) { + if (!phydev->link && priv->energy_enable && phydev->irq =3D=3D PHY_POLL) { /* Disable EDPD to wake up PHY */ int rc =3D phy_read(phydev, MII_LAN83C185_CTRL_STATUS); if (rc < 0) From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 676D6C00140 for ; Mon, 15 Aug 2022 20:04:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242329AbiHOUEL (ORCPT ); Mon, 15 Aug 2022 16:04:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345748AbiHOUDX (ORCPT ); Mon, 15 Aug 2022 16:03: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 159EF7E00A; Mon, 15 Aug 2022 11:54: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 AEA97B81057; Mon, 15 Aug 2022 18:54:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F32D6C433D6; Mon, 15 Aug 2022 18:54:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589651; bh=bG6WZEtkvJKQQRwopgdToLYNGAltD+83E8byvLpG5wc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T2T9K2OIy7b3SAWaolpI+F5jG7OX7RUS5XypPwxR/gh2LFNcMjSk4denlRnVGloQi 3pQq1mcgxzopBn6TS4GxvfO92BTmAi4HXh5iQmPLVOBbqJedH7kOpuxx1cSBG4OVIO 97PcT5RGrc1C4D5fRjZjWjsLUp01j/FsbW21WqC8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tom Rix , Maxime Ripard Subject: [PATCH 5.15 769/779] drm/vc4: change vc4_dma_range_matches from a global to static Date: Mon, 15 Aug 2022 20:06:53 +0200 Message-Id: <20220815180410.252197458@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tom Rix commit 63569d90863ff26c8b10c8971d1271c17a45224b upstream. sparse reports drivers/gpu/drm/vc4/vc4_drv.c:270:27: warning: symbol 'vc4_dma_range_matche= s' was not declared. Should it be static? vc4_dma_range_matches is only used in vc4_drv.c, so it's storage class spec= ifier should be static. Fixes: da8e393e23ef ("drm/vc4: drv: Adopt the dma configuration from the HV= S or V3D component") Signed-off-by: Tom Rix Signed-off-by: Maxime Ripard Link: https://patchwork.freedesktop.org/patch/msgid/20220629200101.498138-1= -trix@redhat.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/vc4/vc4_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/vc4/vc4_drv.c +++ b/drivers/gpu/drm/vc4/vc4_drv.c @@ -214,7 +214,7 @@ static void vc4_match_add_drivers(struct } } =20 -const struct of_device_id vc4_dma_range_matches[] =3D { +static const struct of_device_id vc4_dma_range_matches[] =3D { { .compatible =3D "brcm,bcm2711-hvs" }, { .compatible =3D "brcm,bcm2835-hvs" }, { .compatible =3D "brcm,bcm2835-v3d" }, From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D5FFC00140 for ; Mon, 15 Aug 2022 20:04:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229684AbiHOUES (ORCPT ); Mon, 15 Aug 2022 16:04:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345780AbiHOUD0 (ORCPT ); Mon, 15 Aug 2022 16:03:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FF107E022; Mon, 15 Aug 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 91102611D6; Mon, 15 Aug 2022 18:54:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16186C433D6; Mon, 15 Aug 2022 18:54:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589655; bh=0dG4uuL291nO1aV8Tjx0Cq3qOuuLfuwV842Ght+TL5Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mac2T1PVCxmOtUJ1WiFKMJVHTVvUKAvZGGMWgQAEsJspn6v0L/LcO94ps8y4mGpFi DhwRpf6kYrCWZg40NCyxmpWJAleQNVUDCRXzZAjd4i5ORE2XVqCIK26ZSsVLxL+RI8 0eb3oWG9oS0P+TvSMrEC1yGU4wkoX7diWgPVKl3s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Steven Rostedt , Masami Hiramatsu , Stephen Rothwell , Kees Cook Subject: [PATCH 5.15 770/779] tracing/perf: Avoid -Warray-bounds warning for __rel_loc macro Date: Mon, 15 Aug 2022 20:06:54 +0200 Message-Id: <20220815180410.302077206@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kees Cook commit c6d777acdf8f62d4ebaef0e5c6cd8fedbd6e8546 upstream. As done for trace_events.h, also fix the __rel_loc macro in perf.h, which silences the -Warray-bounds warning: In file included from ./include/linux/string.h:253, from ./include/linux/bitmap.h:11, from ./include/linux/cpumask.h:12, from ./include/linux/mm_types_task.h:14, from ./include/linux/mm_types.h:5, from ./include/linux/buildid.h:5, from ./include/linux/module.h:14, from samples/trace_events/trace-events-sample.c:2: In function '__fortify_strcpy', inlined from 'perf_trace_foo_rel_loc' at samples/trace_events/./trace-e= vents-sample.h:519:1: ./include/linux/fortify-string.h:47:33: warning: '__builtin_strcpy' offset = 12 is out of the bounds [ 0, 4] [-Warray-bounds] 47 | #define __underlying_strcpy __builtin_strcpy | ^ ./include/linux/fortify-string.h:445:24: note: in expansion of macro '__und= erlying_strcpy' 445 | return __underlying_strcpy(p, q); | ^~~~~~~~~~~~~~~~~~~ Also make __data struct member a proper flexible array to avoid future problems. Link: https://lkml.kernel.org/r/20220125220037.2738923-1-keescook@chromium.= org Cc: Steven Rostedt Cc: Masami Hiramatsu Fixes: 55de2c0b5610c ("tracing: Add '__rel_loc' using trace event macros") Reported-by: Stephen Rothwell Signed-off-by: Kees Cook Signed-off-by: Steven Rostedt (Google) Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- include/trace/perf.h | 5 +++-- include/trace/trace_events.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) --- a/include/trace/perf.h +++ b/include/trace/perf.h @@ -23,8 +23,9 @@ =20 #undef __get_rel_dynamic_array #define __get_rel_dynamic_array(field) \ - ((void *)(&__entry->__rel_loc_##field) + \ - sizeof(__entry->__rel_loc_##field) + \ + ((void *)__entry + \ + offsetof(typeof(*__entry), __rel_loc_##field) + \ + sizeof(__entry->__rel_loc_##field) + \ (__entry->__rel_loc_##field & 0xffff)) =20 #undef __get_rel_dynamic_array_len --- a/include/trace/trace_events.h +++ b/include/trace/trace_events.h @@ -128,7 +128,7 @@ TRACE_MAKE_SYSTEM_STR(); struct trace_event_raw_##name { \ struct trace_entry ent; \ tstruct \ - char __data[0]; \ + char __data[]; \ }; \ \ static struct trace_event_class event_class_##name; From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 165C1C00140 for ; Mon, 15 Aug 2022 20:02:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241444AbiHOUCe (ORCPT ); Mon, 15 Aug 2022 16:02:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345921AbiHOUA7 (ORCPT ); Mon, 15 Aug 2022 16:00: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 E9ACB7A51D; Mon, 15 Aug 2022 11:53: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 9AD70B810A0; Mon, 15 Aug 2022 18:53:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07DADC433D7; Mon, 15 Aug 2022 18:53:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589604; bh=gSo018KO7yciQS/cs61HZj9oE5g4mjzMJegIb32bSyo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gSAdD2kACO7rTuxfMGzgeUMwm5tWDrswNP342T4DPStdBeRTqG+4MiHrGpvN0zHdP 8Pl1Ny13LGH70LboPFNpdjVqG+f4fNL1K10KPwBNN5lAQ7cOzrREERzgNGrSNLUyWb ZfsKlUnnr+dzpf+++5Tv8CC3yBInidhgvBjseoVo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rob Clark Subject: [PATCH 5.15 771/779] drm/msm: Fix dirtyfb refcounting Date: Mon, 15 Aug 2022 20:06:55 +0200 Message-Id: <20220815180410.350724076@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rob Clark commit 9225b337072a10bf9b09df8bf281437488dd8a26 upstream. refcount_t complains about 0->1 transitions, which isn't *quite* what we wanted. So use dirtyfb=3D=3D1 to mean that the fb is not connected to any output that requires dirtyfb flushing, so that we can keep the underflow and overflow checking. Fixes: 9e4dde28e9cd ("drm/msm: Avoid dirtyfb stalls on video mode displays = (v2)") Signed-off-by: Rob Clark Link: https://lore.kernel.org/r/20220304202146.845566-1-robdclark@gmail.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/msm/msm_fb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/msm/msm_fb.c +++ b/drivers/gpu/drm/msm/msm_fb.c @@ -37,7 +37,7 @@ static int msm_framebuffer_dirtyfb(struc /* If this fb is not used on any display requiring pixel data to be * flushed, then skip dirtyfb */ - if (refcount_read(&msm_fb->dirtyfb) =3D=3D 0) + if (refcount_read(&msm_fb->dirtyfb) =3D=3D 1) return 0; =20 return drm_atomic_helper_dirtyfb(fb, file_priv, flags, color, @@ -221,6 +221,8 @@ static struct drm_framebuffer *msm_frame goto fail; } =20 + refcount_set(&msm_fb->dirtyfb, 1); + drm_dbg_state(dev, "create: FB ID: %d (%p)", fb->base.id, fb); =20 return fb; From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43F92C00140 for ; Mon, 15 Aug 2022 20:06:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233022AbiHOUCC (ORCPT ); Mon, 15 Aug 2022 16:02:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345940AbiHOUBE (ORCPT ); Mon, 15 Aug 2022 16:01:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCCC77B1F4; Mon, 15 Aug 2022 11:53: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 2D41561227; Mon, 15 Aug 2022 18:53:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A22FC433C1; Mon, 15 Aug 2022 18:53:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589607; bh=qmAwL4dfCbVkHN98smibt7siZPH+IcCOgX81JiDmpik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M8kM0y3Iqp9+BKVF0lcSIR2JcS8nGqVv0goczF6VeZy4x3ZlTcARhzCpHzBBNpoq+ CTkCcSMIeDBL8c7wg6aG8DlcQAm5GzxGGQqb+fwDU1OkdJzFOt02W2cTQfygvI8roW gqITkQS//GvnD6yfZgM2tDOuLmm2Hyan2512SrQE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Martin Blumenstingl , Neil Armstrong Subject: [PATCH 5.15 772/779] drm/meson: Fix refcount leak in meson_encoder_hdmi_init Date: Mon, 15 Aug 2022 20:06:56 +0200 Message-Id: <20220815180410.395878169@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin commit 7381076809586528e2a812a709e2758916318a99 upstream. of_find_device_by_node() takes reference, we should use put_device() to release it when not need anymore. Add missing put_device() in error path to avoid refcount leak. Fixes: 0af5e0b41110 ("drm/meson: encoder_hdmi: switch to bridge DRM_BRIDGE_= ATTACH_NO_CONNECTOR") Signed-off-by: Miaoqian Lin Reviewed-by: Martin Blumenstingl Reviewed-by: Neil Armstrong Signed-off-by: Neil Armstrong Link: https://patchwork.freedesktop.org/patch/msgid/20220511054052.51981-1-= linmq006@gmail.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/meson/meson_encoder_hdmi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/meson/meson_encoder_hdmi.c +++ b/drivers/gpu/drm/meson/meson_encoder_hdmi.c @@ -438,8 +438,10 @@ int meson_encoder_hdmi_init(struct meson cec_fill_conn_info_from_drm(&conn_info, meson_encoder_hdmi->connector); =20 notifier =3D cec_notifier_conn_register(&pdev->dev, NULL, &conn_info); - if (!notifier) + if (!notifier) { + put_device(&pdev->dev); return -ENOMEM; + } =20 meson_encoder_hdmi->cec_notifier =3D notifier; } From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E46EEC00140 for ; Mon, 15 Aug 2022 20:02:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241341AbiHOUCr (ORCPT ); Mon, 15 Aug 2022 16:02:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345919AbiHOUA7 (ORCPT ); Mon, 15 Aug 2022 16:00: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 D15217B1E3; Mon, 15 Aug 2022 11:53: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 F22E8B8105D; Mon, 15 Aug 2022 18:53:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44177C433D6; Mon, 15 Aug 2022 18:53:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589610; bh=6lz2YdPTiZjJvSA/4Pbq2dAES/xNXwk3Yc/pcvU3EkA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X4mdesZSS+tdyfZ/qJb2wX5d0gdM2maZQkqQvAjp3ug3B5yzvOaCMG0KVccVB1vfJ nL+OhTWYAL4y66rUpUInfd81Qc0xdFCzTjYz0inhPmMUI4jWCIbNcJ4c4gcMjPRxjW XW/t4Np5SWg48mgdSpHnqPyETQZjP3FH65nTGWTY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Begunkov , Jens Axboe Subject: [PATCH 5.15 773/779] io_uring: mem-account pbuf buckets Date: Mon, 15 Aug 2022 20:06:57 +0200 Message-Id: <20220815180410.444136632@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pavel Begunkov commit cc18cc5e82033d406f54144ad6f8092206004684 upstream. Potentially, someone may create as many pbuf bucket as there are indexes in an xarray without any other restrictions bounding our memory usage, put memory needed for the buckets under memory accounting. Cc: Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/d34c452e45793e978d26e2606211ec9070d329ea.16= 59622312.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- fs/io_uring.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -4477,7 +4477,8 @@ static int io_provide_buffers(struct io_ =20 ret =3D io_add_buffers(p, &head); if (ret >=3D 0 && !list) { - ret =3D xa_insert(&ctx->io_buffers, p->bgid, head, GFP_KERNEL); + ret =3D xa_insert(&ctx->io_buffers, p->bgid, head, + GFP_KERNEL_ACCOUNT); if (ret < 0) __io_remove_buffers(ctx, head, p->bgid, -1U); } From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74E6FC00140 for ; Mon, 15 Aug 2022 20:03:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345740AbiHOUDW (ORCPT ); Mon, 15 Aug 2022 16:03:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346069AbiHOUBj (ORCPT ); Mon, 15 Aug 2022 16:01:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CBC57C196; Mon, 15 Aug 2022 11:53:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4D6B461019; Mon, 15 Aug 2022 18:53:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55651C433D7; Mon, 15 Aug 2022 18:53:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589613; bh=AMlWcZjBdByjeCvbHrodQDRtAK5e6/sYLxTWDNuMlm4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xq0H3OCDJIESm35H26f8QWdo5eRX+aEF2zW+t7h70RysvRdG05ywCenZMhBtVxNCb DOSqU4zIb0qmFHldREuqsCOOJReeNzX0bgZbSdhitSn57knVQitNrzMQ354TOFl/Z7 Ho6VCCBeAevlPKMIi2H7vUUWyEtxlILXQpwc1/94= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ronald Wahl , Jose Alonso , "David S. Miller" Subject: [PATCH 5.15 774/779] Revert "net: usb: ax88179_178a needs FLAG_SEND_ZLP" Date: Mon, 15 Aug 2022 20:06:58 +0200 Message-Id: <20220815180410.484211155@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jose Alonso commit 6fd2c17fb6e02a8c0ab51df1cfec82ce96b8e83d upstream. This reverts commit 36a15e1cb134c0395261ba1940762703f778438c. The usage of FLAG_SEND_ZLP causes problems to other firmware/hardware versions that have no issues. The FLAG_SEND_ZLP is not safe to use in this context. See: https://patchwork.ozlabs.org/project/netdev/patch/1270599787.8900.8.camel@L= inuxdev4-laptop/#118378 The original problem needs another way to solve. Fixes: 36a15e1cb134 ("net: usb: ax88179_178a needs FLAG_SEND_ZLP") Cc: stable@vger.kernel.org Reported-by: Ronald Wahl Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D216327 Link: https://bugs.archlinux.org/task/75491 Signed-off-by: Jose Alonso Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/net/usb/ax88179_178a.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) --- a/drivers/net/usb/ax88179_178a.c +++ b/drivers/net/usb/ax88179_178a.c @@ -1796,7 +1796,7 @@ static const struct driver_info ax88179_ .link_reset =3D ax88179_link_reset, .reset =3D ax88179_reset, .stop =3D ax88179_stop, - .flags =3D FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, + .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, .tx_fixup =3D ax88179_tx_fixup, }; @@ -1809,7 +1809,7 @@ static const struct driver_info ax88178a .link_reset =3D ax88179_link_reset, .reset =3D ax88179_reset, .stop =3D ax88179_stop, - .flags =3D FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, + .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, .tx_fixup =3D ax88179_tx_fixup, }; @@ -1822,7 +1822,7 @@ static const struct driver_info cypress_ .link_reset =3D ax88179_link_reset, .reset =3D ax88179_reset, .stop =3D ax88179_stop, - .flags =3D FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, + .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, .tx_fixup =3D ax88179_tx_fixup, }; @@ -1835,7 +1835,7 @@ static const struct driver_info dlink_du .link_reset =3D ax88179_link_reset, .reset =3D ax88179_reset, .stop =3D ax88179_stop, - .flags =3D FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, + .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, .tx_fixup =3D ax88179_tx_fixup, }; @@ -1848,7 +1848,7 @@ static const struct driver_info sitecom_ .link_reset =3D ax88179_link_reset, .reset =3D ax88179_reset, .stop =3D ax88179_stop, - .flags =3D FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, + .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, .tx_fixup =3D ax88179_tx_fixup, }; @@ -1861,7 +1861,7 @@ static const struct driver_info samsung_ .link_reset =3D ax88179_link_reset, .reset =3D ax88179_reset, .stop =3D ax88179_stop, - .flags =3D FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, + .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, .tx_fixup =3D ax88179_tx_fixup, }; @@ -1874,7 +1874,7 @@ static const struct driver_info lenovo_i .link_reset =3D ax88179_link_reset, .reset =3D ax88179_reset, .stop =3D ax88179_stop, - .flags =3D FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, + .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, .tx_fixup =3D ax88179_tx_fixup, }; @@ -1887,7 +1887,7 @@ static const struct driver_info belkin_i .link_reset =3D ax88179_link_reset, .reset =3D ax88179_reset, .stop =3D ax88179_stop, - .flags =3D FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, + .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, .tx_fixup =3D ax88179_tx_fixup, }; @@ -1900,7 +1900,7 @@ static const struct driver_info toshiba_ .link_reset =3D ax88179_link_reset, .reset =3D ax88179_reset, .stop =3D ax88179_stop, - .flags =3D FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, + .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, .tx_fixup =3D ax88179_tx_fixup, }; @@ -1913,7 +1913,7 @@ static const struct driver_info mct_info .link_reset =3D ax88179_link_reset, .reset =3D ax88179_reset, .stop =3D ax88179_stop, - .flags =3D FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, + .flags =3D FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup =3D ax88179_rx_fixup, .tx_fixup =3D ax88179_tx_fixup, }; From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9294C25B08 for ; Mon, 15 Aug 2022 20:02:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232917AbiHOUCR (ORCPT ); Mon, 15 Aug 2022 16:02:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345945AbiHOUBF (ORCPT ); Mon, 15 Aug 2022 16:01: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 D008A7B7BA; Mon, 15 Aug 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 1A924B810A2; Mon, 15 Aug 2022 18:53:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66D49C433C1; Mon, 15 Aug 2022 18:53:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589616; bh=ypcTEHAAN56lMkwcSW2kJ2Sjqa0FjUipNQmNtZq0vRg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vu4BZZgAMZeyDKNUDDpYHvxGRlDoO8AXwvxq4wzjgYuMbmPGxHdLlWphziANjqWMc v0gm4a6FIeJ2RoDtqUZCls6sAV4fPZsbykLyc3l/Cs+6uhW3Ps8qjNWsWpn9mNZDUH RSvKu887ROlAse51yr9XTufGb0i5ANvAG7ZMYds4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Luiz Augusto von Dentz Subject: [PATCH 5.15 775/779] Bluetooth: L2CAP: Fix l2cap_global_chan_by_psm regression Date: Mon, 15 Aug 2022 20:06:59 +0200 Message-Id: <20220815180410.517422014@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Luiz Augusto von Dentz commit 332f1795ca202489c665a75e62e18ff6284de077 upstream. The patch d0be8347c623: "Bluetooth: L2CAP: Fix use-after-free caused by l2cap_chan_put" from Jul 21, 2022, leads to the following Smatch static checker warning: net/bluetooth/l2cap_core.c:1977 l2cap_global_chan_by_psm() error: we previously assumed 'c' could be null (see line 1996) Fixes: d0be8347c623 ("Bluetooth: L2CAP: Fix use-after-free caused by l2cap_= chan_put") Reported-by: Dan Carpenter Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- net/bluetooth/l2cap_core.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c @@ -1970,11 +1970,11 @@ static struct l2cap_chan *l2cap_global_c bdaddr_t *dst, u8 link_type) { - struct l2cap_chan *c, *c1 =3D NULL; + struct l2cap_chan *c, *tmp, *c1 =3D NULL; =20 read_lock(&chan_list_lock); =20 - list_for_each_entry(c, &chan_list, global_l) { + list_for_each_entry_safe(c, tmp, &chan_list, global_l) { if (state && c->state !=3D state) continue; =20 @@ -1993,11 +1993,10 @@ static struct l2cap_chan *l2cap_global_c dst_match =3D !bacmp(&c->dst, dst); if (src_match && dst_match) { c =3D l2cap_chan_hold_unless_zero(c); - if (!c) - continue; - - read_unlock(&chan_list_lock); - return c; + if (c) { + read_unlock(&chan_list_lock); + return c; + } } =20 /* Closest match */ From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D966EC282E7 for ; Mon, 15 Aug 2022 20:06:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232495AbiHOUGx (ORCPT ); Mon, 15 Aug 2022 16:06:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346163AbiHOUBr (ORCPT ); Mon, 15 Aug 2022 16:01:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73FCE7C75F; Mon, 15 Aug 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 34BC8B810A9; Mon, 15 Aug 2022 18:53:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 932ADC433D7; Mon, 15 Aug 2022 18:53:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589620; bh=TwC/Maq0bEmceLwEg6k3SJsZPI6n3Zfns4vrT8h+7i4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mwp2C2Ft75VWzPyIjeupAzZiqG2xJiJ8Hj94DhzvIboYyYQdo5gwj0k3iqDFSDuiC mNmFsyY8cdufBETHDmTgfOC12d2AALIC+toqpvN3yJf1U7wt+rDfUim6yTEvI7R7FJ Kd3HiM1txyO4M2CKJqoS0jtSA20IZrsp2BDaNvVo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephen Rothwell , Maxime Ripard , Heiko Stuebner , Thomas Zimmermann Subject: [PATCH 5.15 776/779] drm/bridge: Move devm_drm_of_get_bridge to bridge/panel.c Date: Mon, 15 Aug 2022 20:07:00 +0200 Message-Id: <20220815180410.553384486@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maxime Ripard commit d4ae66f10c8b9959dce1766d9a87070e567236eb upstream. By depending on devm_drm_panel_bridge_add(), devm_drm_of_get_bridge() introduces a circular dependency between the modules drm (where devm_drm_of_get_bridge() ends up) and drm_kms_helper (where devm_drm_panel_bridge_add() is). Fix this by moving devm_drm_of_get_bridge() to bridge/panel.c and thus drm_kms_helper. Fixes: 87ea95808d53 ("drm/bridge: Add a function to abstract away panels") Reported-by: Stephen Rothwell Signed-off-by: Maxime Ripard Tested-by: Heiko Stuebner Acked-by: Thomas Zimmermann Link: https://patchwork.freedesktop.org/patch/msgid/20210917180925.2602266-= 1-maxime@cerno.tech Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/gpu/drm/bridge/panel.c | 37 +++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/drm_bridge.c | 34 ---------------------------------- 2 files changed, 37 insertions(+), 34 deletions(-) --- a/drivers/gpu/drm/bridge/panel.c +++ b/drivers/gpu/drm/bridge/panel.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -332,3 +333,39 @@ struct drm_connector *drm_panel_bridge_c return &panel_bridge->connector; } EXPORT_SYMBOL(drm_panel_bridge_connector); + +#ifdef CONFIG_OF +/** + * devm_drm_of_get_bridge - Return next bridge in the chain + * @dev: device to tie the bridge lifetime to + * @np: device tree node containing encoder output ports + * @port: port in the device tree node + * @endpoint: endpoint in the device tree node + * + * Given a DT node's port and endpoint number, finds the connected node + * and returns the associated bridge if any, or creates and returns a + * drm panel bridge instance if a panel is connected. + * + * Returns a pointer to the bridge if successful, or an error pointer + * otherwise. + */ +struct drm_bridge *devm_drm_of_get_bridge(struct device *dev, + struct device_node *np, + u32 port, u32 endpoint) +{ + struct drm_bridge *bridge; + struct drm_panel *panel; + int ret; + + ret =3D drm_of_find_panel_or_bridge(np, port, endpoint, + &panel, &bridge); + if (ret) + return ERR_PTR(ret); + + if (panel) + bridge =3D devm_drm_panel_bridge_add(dev, panel); + + return bridge; +} +EXPORT_SYMBOL(devm_drm_of_get_bridge); +#endif --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -1232,40 +1232,6 @@ struct drm_bridge *of_drm_find_bridge(st return NULL; } EXPORT_SYMBOL(of_drm_find_bridge); - -/** - * devm_drm_of_get_bridge - Return next bridge in the chain - * @dev: device to tie the bridge lifetime to - * @np: device tree node containing encoder output ports - * @port: port in the device tree node - * @endpoint: endpoint in the device tree node - * - * Given a DT node's port and endpoint number, finds the connected node - * and returns the associated bridge if any, or creates and returns a - * drm panel bridge instance if a panel is connected. - * - * Returns a pointer to the bridge if successful, or an error pointer - * otherwise. - */ -struct drm_bridge *devm_drm_of_get_bridge(struct device *dev, - struct device_node *np, - u32 port, u32 endpoint) -{ - struct drm_bridge *bridge; - struct drm_panel *panel; - int ret; - - ret =3D drm_of_find_panel_or_bridge(np, port, endpoint, - &panel, &bridge); - if (ret) - return ERR_PTR(ret); - - if (panel) - bridge =3D devm_drm_panel_bridge_add(dev, panel); - - return bridge; -} -EXPORT_SYMBOL(devm_drm_of_get_bridge); #endif =20 MODULE_AUTHOR("Ajay Kumar "); From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE384C00140 for ; Mon, 15 Aug 2022 20:03:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345655AbiHOUDR (ORCPT ); Mon, 15 Aug 2022 16:03:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346022AbiHOUBa (ORCPT ); Mon, 15 Aug 2022 16:01: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 2B5CBEA4; Mon, 15 Aug 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 A2D85B810A0; Mon, 15 Aug 2022 18:53:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A381BC433C1; Mon, 15 Aug 2022 18:53:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589623; bh=Ki9OpC+liXeodytwk+5NFoK0HolAbgb1uPiEuSySNmw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cob0tQlRDxrmAQCaH8v5hQWj5sP6AyZoYbwj6odXAOF+HDoPiHdLbU/KyfbYfcI35 JCkPtZr3M+0WBHcQrO9xS56P4F+LuR6qjpeRIN0oiPqt2gMfaknThBr0O7B4ZGgt0c MmPq6/k+f3Y9UlTNhvYj4p21JB4VyCs7yvyw1xuI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dick Kennedy , James Smart , "Martin K. Petersen" Subject: [PATCH 5.15 777/779] scsi: lpfc: Fix locking for lpfc_sli_iocbq_lookup() Date: Mon, 15 Aug 2022 20:07:01 +0200 Message-Id: <20220815180410.592934784@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: James Smart commit c26bd6602e1d348bfa754dc55e5608c922dd2801 upstream. The rules changed for lpfc_sli_iocbq_lookup() vs locking. Prior, the routine properly took out the lock. In newly refactored code, the locks must be held when calling the routine. Fix lpfc_sli_process_sol_iocb() to take the locks before calling the routine. Fix lpfc_sli_handle_fast_ring_event() to not release the locks to call the routine. Link: https://lore.kernel.org/r/20220323205545.81814-3-jsmart2021@gmail.com Fixes: 1b64aa9eae28 ("scsi: lpfc: SLI path split: Refactor fast and slow pa= ths to native SLI4") Co-developed-by: Dick Kennedy Signed-off-by: Dick Kennedy Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/lpfc/lpfc_sli.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -3642,7 +3642,15 @@ lpfc_sli_process_sol_iocb(struct lpfc_hb unsigned long iflag; u32 ulp_command, ulp_status, ulp_word4, ulp_context, iotag; =20 + if (phba->sli_rev =3D=3D LPFC_SLI_REV4) + spin_lock_irqsave(&pring->ring_lock, iflag); + else + spin_lock_irqsave(&phba->hbalock, iflag); cmdiocbp =3D lpfc_sli_iocbq_lookup(phba, pring, saveq); + if (phba->sli_rev =3D=3D LPFC_SLI_REV4) + spin_unlock_irqrestore(&pring->ring_lock, iflag); + else + spin_unlock_irqrestore(&phba->hbalock, iflag); =20 ulp_command =3D get_job_cmnd(phba, saveq); ulp_status =3D get_job_ulpstatus(phba, saveq); @@ -3979,10 +3987,8 @@ lpfc_sli_handle_fast_ring_event(struct l break; } =20 - spin_unlock_irqrestore(&phba->hbalock, iflag); cmdiocbq =3D lpfc_sli_iocbq_lookup(phba, pring, &rspiocbq); - spin_lock_irqsave(&phba->hbalock, iflag); if (unlikely(!cmdiocbq)) break; if (cmdiocbq->cmd_flag & LPFC_DRIVER_ABORTED) From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCE67C282E7 for ; Mon, 15 Aug 2022 20:02:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232900AbiHOUC0 (ORCPT ); Mon, 15 Aug 2022 16:02:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346109AbiHOUBn (ORCPT ); Mon, 15 Aug 2022 16:01:43 -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 596117C1B6; Mon, 15 Aug 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 dfw.source.kernel.org (Postfix) with ESMTPS id F33EE61228; Mon, 15 Aug 2022 18:53:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04CB0C433D7; Mon, 15 Aug 2022 18:53:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589626; bh=GSRSy1yZuQhA2CaBbz79GviUyu39lfhsVDrX4xOYh84=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MB/aqPbppJptO5MIb12Ixghb7OQ7XflOyjGfmNVIGVXvx3kbfjtjKrMchr6d0EkKo +Tjvr/Jg/zCJj3hN94uCg3DRwwwCkt07HGYPRwDJIEvLfInYtTdZSW7ELV8m4H/DmZ YK2Cfu2SGgtObx87K8DcjIEcP8tTR4GeD3WP45hA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Justin Tee , James Smart , "Martin K. Petersen" Subject: [PATCH 5.15 778/779] scsi: lpfc: Fix element offset in __lpfc_sli_release_iocbq_s4() Date: Mon, 15 Aug 2022 20:07:02 +0200 Message-Id: <20220815180410.626739527@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: James Smart commit 84c6f99e39074d45f75986e42ca28e27c140fd0d upstream. The prior commit that moved from iocb elements to explicit wqe elements missed a name change. Correct __lpfc_sli_release_iocbq_s4() to reference wqe rather than iocb. Link: https://lore.kernel.org/r/20220506035519.50908-2-jsmart2021@gmail.com Fixes: a680a9298e7b ("scsi: lpfc: SLI path split: Refactor lpfc_iocbq") Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/lpfc/lpfc_sli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -1384,7 +1384,7 @@ static void __lpfc_sli_release_iocbq_s4(struct lpfc_hba *phba, struct lpfc_iocbq *iocb= q) { struct lpfc_sglq *sglq; - size_t start_clean =3D offsetof(struct lpfc_iocbq, iocb); + size_t start_clean =3D offsetof(struct lpfc_iocbq, wqe); unsigned long iflag =3D 0; struct lpfc_sli_ring *pring; From nobody Sun Dec 14 03:24:46 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97FA7C25B0E for ; Mon, 15 Aug 2022 20:06:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233505AbiHOUG5 (ORCPT ); Mon, 15 Aug 2022 16:06:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346165AbiHOUBs (ORCPT ); Mon, 15 Aug 2022 16:01:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70325FC; Mon, 15 Aug 2022 11:53: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 EE754B81057; Mon, 15 Aug 2022 18:53:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E3F8C433D6; Mon, 15 Aug 2022 18:53:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660589629; bh=831V3Yq52zNLvCLhnmdB7nVvxEFk2hDomNDpBbMwZIo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DG2va3syTcOWbNXosh7UlnmIXtSIqfA/AxR0WeW1BjND/B0R4LsquAkdel1Wd/jkX 4h7e5sAFlw4WcG3Bax+YIJhHS85LHk3/hKj6cFhR+uffy/xJVwoH/PqLXgX9ZeIkWt 0qc7ZYHeLalA44CTLlKLB9Gx9bK+XZ3ii/+YR52Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Justin Tee , James Smart , "Martin K. Petersen" Subject: [PATCH 5.15 779/779] scsi: lpfc: Resolve some cleanup issues following SLI path refactoring Date: Mon, 15 Aug 2022 20:07:03 +0200 Message-Id: <20220815180410.658725498@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180337.130757997@linuxfoundation.org> References: <20220815180337.130757997@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: James Smart commit e27f05147bff21408c1b8410ad8e90cd286e7952 upstream. Following refactoring and consolidation in SLI processing, fix up some minor issues related to SLI path: - Correct the setting of LPFC_EXCHANGE_BUSY flag in response IOCB. - Fix some typographical errors. - Fix duplicate log messages. Link: https://lore.kernel.org/r/20220603174329.63777-4-jsmart2021@gmail.com Fixes: 1b64aa9eae28 ("scsi: lpfc: SLI path split: Refactor fast and slow pa= ths to native SLI4") Cc: # v5.18 Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Shuah Khan --- drivers/scsi/lpfc/lpfc_init.c | 2 +- drivers/scsi/lpfc/lpfc_sli.c | 25 ++++++++++++------------- 2 files changed, 13 insertions(+), 14 deletions(-) --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -11964,7 +11964,7 @@ lpfc_sli_enable_msi(struct lpfc_hba *phb rc =3D pci_enable_msi(phba->pcidev); if (!rc) lpfc_printf_log(phba, KERN_INFO, LOG_INIT, - "0462 PCI enable MSI mode success.\n"); + "0012 PCI enable MSI mode success.\n"); else { lpfc_printf_log(phba, KERN_INFO, LOG_INIT, "0471 PCI enable MSI mode failed (%d)\n", rc); --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -1939,7 +1939,7 @@ lpfc_issue_cmf_sync_wqe(struct lpfc_hba sync_buf =3D __lpfc_sli_get_iocbq(phba); if (!sync_buf) { lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT, - "6213 No available WQEs for CMF_SYNC_WQE\n"); + "6244 No available WQEs for CMF_SYNC_WQE\n"); ret_val =3D ENOMEM; goto out_unlock; } @@ -3737,7 +3737,7 @@ lpfc_sli_process_sol_iocb(struct lpfc_hb set_job_ulpword4(cmdiocbp, IOERR_ABORT_REQUESTED); /* - * For SLI4, irsiocb contains + * For SLI4, irspiocb contains * NO_XRI in sli_xritag, it * shall not affect releasing * sgl (xri) process. @@ -3755,7 +3755,7 @@ lpfc_sli_process_sol_iocb(struct lpfc_hb } } } - (cmdiocbp->cmd_cmpl) (phba, cmdiocbp, saveq); + cmdiocbp->cmd_cmpl(phba, cmdiocbp, saveq); } else lpfc_sli_release_iocbq(phba, cmdiocbp); } else { @@ -3995,8 +3995,7 @@ lpfc_sli_handle_fast_ring_event(struct l cmdiocbq->cmd_flag &=3D ~LPFC_DRIVER_ABORTED; if (cmdiocbq->cmd_cmpl) { spin_unlock_irqrestore(&phba->hbalock, iflag); - (cmdiocbq->cmd_cmpl)(phba, cmdiocbq, - &rspiocbq); + cmdiocbq->cmd_cmpl(phba, cmdiocbq, &rspiocbq); spin_lock_irqsave(&phba->hbalock, iflag); } break; @@ -10936,7 +10935,7 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba * @flag: Flag indicating if this command can be put into txq. * * __lpfc_sli_issue_fcp_io_s3 is wrapper function to invoke lockless func = to - * send an iocb command to an HBA with SLI-4 interface spec. + * send an iocb command to an HBA with SLI-3 interface spec. * * This function takes the hbalock before invoking the lockless version. * The function will return success after it successfully submit the wqe to @@ -12989,7 +12988,7 @@ lpfc_sli_wake_iocb_wait(struct lpfc_hba cmdiocbq->cmd_cmpl =3D cmdiocbq->wait_cmd_cmpl; cmdiocbq->wait_cmd_cmpl =3D NULL; if (cmdiocbq->cmd_cmpl) - (cmdiocbq->cmd_cmpl)(phba, cmdiocbq, NULL); + cmdiocbq->cmd_cmpl(phba, cmdiocbq, NULL); else lpfc_sli_release_iocbq(phba, cmdiocbq); return; @@ -13003,9 +13002,9 @@ lpfc_sli_wake_iocb_wait(struct lpfc_hba =20 /* Set the exchange busy flag for task management commands */ if ((cmdiocbq->cmd_flag & LPFC_IO_FCP) && - !(cmdiocbq->cmd_flag & LPFC_IO_LIBDFC)) { + !(cmdiocbq->cmd_flag & LPFC_IO_LIBDFC)) { lpfc_cmd =3D container_of(cmdiocbq, struct lpfc_io_buf, - cur_iocbq); + cur_iocbq); if (rspiocbq && (rspiocbq->cmd_flag & LPFC_EXCHANGE_BUSY)) lpfc_cmd->flags |=3D LPFC_SBUF_XBUSY; else @@ -14143,7 +14142,7 @@ void lpfc_sli4_els_xri_abort_event_proc( * @irspiocbq: Pointer to work-queue completion queue entry. * * This routine handles an ELS work-queue completion event and construct - * a pseudo response ELS IODBQ from the SLI4 ELS WCQE for the common + * a pseudo response ELS IOCBQ from the SLI4 ELS WCQE for the common * discovery engine to handle. * * Return: Pointer to the receive IOCBQ, NULL otherwise. @@ -14187,7 +14186,7 @@ lpfc_sli4_els_preprocess_rspiocbq(struct =20 if (bf_get(lpfc_wcqe_c_xb, wcqe)) { spin_lock_irqsave(&phba->hbalock, iflags); - cmdiocbq->cmd_flag |=3D LPFC_EXCHANGE_BUSY; + irspiocbq->cmd_flag |=3D LPFC_EXCHANGE_BUSY; spin_unlock_irqrestore(&phba->hbalock, iflags); } =20 @@ -15046,7 +15045,7 @@ lpfc_sli4_fp_handle_fcp_wcqe(struct lpfc /* Pass the cmd_iocb and the wcqe to the upper layer */ memcpy(&cmdiocbq->wcqe_cmpl, wcqe, sizeof(struct lpfc_wcqe_complete)); - (cmdiocbq->cmd_cmpl)(phba, cmdiocbq, cmdiocbq); + cmdiocbq->cmd_cmpl(phba, cmdiocbq, cmdiocbq); } else { lpfc_printf_log(phba, KERN_WARNING, LOG_SLI, "0375 FCP cmdiocb not callback function " @@ -19210,7 +19209,7 @@ lpfc_sli4_send_seq_to_ulp(struct lpfc_vp =20 /* Free iocb created in lpfc_prep_seq */ list_for_each_entry_safe(curr_iocb, next_iocb, - &iocbq->list, list) { + &iocbq->list, list) { list_del_init(&curr_iocb->list); lpfc_sli_release_iocbq(phba, curr_iocb); }