From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F7FEC4332F for ; Mon, 14 Feb 2022 10:21:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347057AbiBNKUr (ORCPT ); Mon, 14 Feb 2022 05:20:47 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347210AbiBNKQX (ORCPT ); Mon, 14 Feb 2022 05:16:23 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C8F189CC4; Mon, 14 Feb 2022 01:53:43 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 34666B80DC4; Mon, 14 Feb 2022 09:53:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 644D9C340E9; Mon, 14 Feb 2022 09:53:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832420; bh=0SNWPaXymZm3bX46jRXr1RWWCMk24h+5vqzYav0VjV8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bjZjaKQNhzyHBAiGhob4yZZxoSNzSbU3/wgE1DGk4VKCq0K1R1d1Db2Lzuceq8z+8 0/mJgKpfoiaLLoq0tCECAwLJb58EANuhQqPVUTlmaYYGVcufgU9hZPwv4yIAvOfuEu N2/RvT1LszvlORJR/ymZY+aWSED1SjTC4icvx5jQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiaoke Wang , Paul Moore , Mimi Zohar Subject: [PATCH 5.16 001/203] integrity: check the return value of audit_log_start() Date: Mon, 14 Feb 2022 10:24:05 +0100 Message-Id: <20220214092510.273014505@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xiaoke Wang commit 83230351c523b04ff8a029a4bdf97d881ecb96fc upstream. audit_log_start() returns audit_buffer pointer on success or NULL on error, so it is better to check the return value of it. Fixes: 3323eec921ef ("integrity: IMA as an integrity service provider") Signed-off-by: Xiaoke Wang Cc: Reviewed-by: Paul Moore Signed-off-by: Mimi Zohar Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- security/integrity/integrity_audit.c | 2 ++ 1 file changed, 2 insertions(+) --- a/security/integrity/integrity_audit.c +++ b/security/integrity/integrity_audit.c @@ -45,6 +45,8 @@ void integrity_audit_message(int audit_m return; =20 ab =3D audit_log_start(audit_context(), GFP_KERNEL, audit_msgno); + if (!ab) + return; audit_log_format(ab, "pid=3D%d uid=3D%u auid=3D%u ses=3D%u", task_pid_nr(current), from_kuid(&init_user_ns, current_uid()), From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0ECD9C433F5 for ; Mon, 14 Feb 2022 10:21:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346921AbiBNKUo (ORCPT ); Mon, 14 Feb 2022 05:20:44 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:42578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347229AbiBNKQY (ORCPT ); Mon, 14 Feb 2022 05:16:24 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62DA36D94B; Mon, 14 Feb 2022 01:53:44 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 380BF60F31; Mon, 14 Feb 2022 09:53:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7C12FC340E9; Mon, 14 Feb 2022 09:53:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832423; bh=PoUyA5KKq3J9IjaPm3usTUQS7Ay5dQPs/VrJy+udfcc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ovaDAX4/DMv1HnCAO2Dudxy75I6Tj3w98nR3VC9/p1xX5JM7Gp2IN5MiwFMiUQvuU SiWNKAnLg3myPlt98ppNfCyMmS1c+OOu05D5dJ4TUCo5O334r7RxREwZTGyOF3UjT2 9YF3rUs63trMSliFYbKwE7ziPU8MvPHhL9UlNfzc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeff Mahoney , Paul Moore Subject: [PATCH 5.16 002/203] audit: dont deref the syscall args when checking the openat2 open_how::flags Date: Mon, 14 Feb 2022 10:24:06 +0100 Message-Id: <20220214092510.304262461@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Paul Moore commit 7a82f89de92aac5a244d3735b2bd162c1147620c upstream. As reported by Jeff, dereferencing the openat2 syscall argument in audit_match_perm() to obtain the open_how::flags can result in an oops/page-fault. This patch fixes this by using the open_how struct that we store in the audit_context with audit_openat2_how(). Independent of this patch, Richard Guy Briggs posted a similar patch to the audit mailing list roughly 40 minutes after this patch was posted. Cc: stable@vger.kernel.org Fixes: 1c30e3af8a79 ("audit: add support for the openat2 syscall") Reported-by: Jeff Mahoney Signed-off-by: Paul Moore Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- kernel/auditsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/auditsc.c +++ b/kernel/auditsc.c @@ -185,7 +185,7 @@ static int audit_match_perm(struct audit case AUDITSC_EXECVE: return mask & AUDIT_PERM_EXEC; case AUDITSC_OPENAT2: - return mask & ACC_MODE((u32)((struct open_how *)ctx->argv[2])->flags); + return mask & ACC_MODE((u32)ctx->openat2.flags); default: return 0; } From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65615C43217 for ; Mon, 14 Feb 2022 10:21:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347196AbiBNKVB (ORCPT ); Mon, 14 Feb 2022 05:21:01 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:47978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347361AbiBNKQ1 (ORCPT ); Mon, 14 Feb 2022 05:16:27 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD71569CED; Mon, 14 Feb 2022 01:53:50 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E6765B80DC6; Mon, 14 Feb 2022 09:53:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0FB9AC340E9; Mon, 14 Feb 2022 09:53:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832426; bh=LBylFngLp5Sc0TB3vzfnAJqZtAbcj0oRjimFAAhmYCQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a+5JXt5JjHrsi+F8wUWDJ0pJC0eJ5p4P8fKXTsfuz/MuEGpPjNymkZEt4VYOtOkGi yxNuhiPQBEkPKPEYZJiUSpKnHvAel3w1BO5IJR78dTB+79wHkOv3P1MT32/HauNHjL srCqJ1J04we7kIa/CRehf0pfnhKUq3P8aufjn9TQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Biggers , Stefan Berger , Tianjia Zhang , Mimi Zohar Subject: [PATCH 5.16 003/203] ima: fix reference leak in asymmetric_verify() Date: Mon, 14 Feb 2022 10:24:07 +0100 Message-Id: <20220214092510.337512879@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Biggers commit 926fd9f23b27ca6587492c3f58f4c7f4cd01dad5 upstream. Don't leak a reference to the key if its algorithm is unknown. Fixes: 947d70597236 ("ima: Support EC keys for signature verification") Cc: # v5.13+ Signed-off-by: Eric Biggers Reviewed-by: Stefan Berger Reviewed-by: Tianjia Zhang Signed-off-by: Mimi Zohar Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- security/integrity/digsig_asymmetric.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) --- a/security/integrity/digsig_asymmetric.c +++ b/security/integrity/digsig_asymmetric.c @@ -109,22 +109,25 @@ int asymmetric_verify(struct key *keyrin =20 pk =3D asymmetric_key_public_key(key); pks.pkey_algo =3D pk->pkey_algo; - if (!strcmp(pk->pkey_algo, "rsa")) + if (!strcmp(pk->pkey_algo, "rsa")) { pks.encoding =3D "pkcs1"; - else if (!strncmp(pk->pkey_algo, "ecdsa-", 6)) + } else if (!strncmp(pk->pkey_algo, "ecdsa-", 6)) { /* edcsa-nist-p192 etc. */ pks.encoding =3D "x962"; - else if (!strcmp(pk->pkey_algo, "ecrdsa") || - !strcmp(pk->pkey_algo, "sm2")) + } else if (!strcmp(pk->pkey_algo, "ecrdsa") || + !strcmp(pk->pkey_algo, "sm2")) { pks.encoding =3D "raw"; - else - return -ENOPKG; + } else { + ret =3D -ENOPKG; + goto out; + } =20 pks.digest =3D (u8 *)data; pks.digest_size =3D datalen; pks.s =3D hdr->sig; pks.s_size =3D siglen; ret =3D verify_signature(key, &pks); +out: key_put(key); pr_debug("%s() =3D %d\n", __func__, ret); return ret; From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CDEBC433F5 for ; Mon, 14 Feb 2022 10:22:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230182AbiBNKWs (ORCPT ); Mon, 14 Feb 2022 05:22:48 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:50562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347373AbiBNKVP (ORCPT ); Mon, 14 Feb 2022 05:21:15 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8817E6E286; Mon, 14 Feb 2022 01:55:38 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1DE02B80DC6; Mon, 14 Feb 2022 09:55:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3850DC340E9; Mon, 14 Feb 2022 09:55:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832535; bh=4RIDEAq+c22nmmG4y8cxqHGvT85mUiWcK7yNYU3i7IM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fEFvnzG1plFV8qUFBk2B9FkOhygkVyvxxxMMqpd1tauezahnKNHW9R08rRHNsKHCr lQCxf7yHwYLyIOvV6CcNvWoVujtwwZGdFEK76gplJHk6ltn0Zo5eAYWH3K3rLZRCOO Yse/vdF7CjOLxNLDkLP1W2YYO/pJIZTYB/n97gIs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Berger , Christian Brauner , Mimi Zohar Subject: [PATCH 5.16 004/203] ima: Remove ima_policy file before directory Date: Mon, 14 Feb 2022 10:24:08 +0100 Message-Id: <20220214092510.374057258@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stefan Berger commit f7333b9572d0559e00352a926c92f29f061b4569 upstream. The removal of ima_dir currently fails since ima_policy still exists, so remove the ima_policy file before removing the directory. Fixes: 4af4662fa4a9 ("integrity: IMA policy") Signed-off-by: Stefan Berger Cc: Acked-by: Christian Brauner Signed-off-by: Mimi Zohar Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- security/integrity/ima/ima_fs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/security/integrity/ima/ima_fs.c +++ b/security/integrity/ima/ima_fs.c @@ -496,12 +496,12 @@ int __init ima_fs_init(void) =20 return 0; out: + securityfs_remove(ima_policy); securityfs_remove(violations); securityfs_remove(runtime_measurements_count); securityfs_remove(ascii_runtime_measurements); securityfs_remove(binary_runtime_measurements); securityfs_remove(ima_symlink); securityfs_remove(ima_dir); - securityfs_remove(ima_policy); return -1; } From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6CE7C433F5 for ; Mon, 14 Feb 2022 10:18:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346091AbiBNKSs (ORCPT ); Mon, 14 Feb 2022 05:18:48 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347401AbiBNKQa (ORCPT ); Mon, 14 Feb 2022 05:16:30 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7576B6D970; Mon, 14 Feb 2022 01:53:54 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A209960F86; Mon, 14 Feb 2022 09:53:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 828AFC340E9; Mon, 14 Feb 2022 09:53:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832433; bh=lyJPkVECiprsua+kfLo7vwcWYPr4vADc2/aJV5dQ37A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B3gYunt78+C4R9JOOMSDo4c4XEVIRZcnD8Fv8HakgGQoDb5k6kfdlNEiruxpxq3cA jSq2fwa6qL+nJjn18BeUDk+g2vnnmMq8Q5e677Ae6s6k6zZTr76LJUOjL/F7JARrCM IX1V3yAHsY74iDzzfVZy7pRRC5S1AYyNxZ5EGLnM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guo Zihua , Roberto Sassu , Mimi Zohar Subject: [PATCH 5.16 005/203] ima: Allow template selection with ima_template[_fmt]= after ima_hash= Date: Mon, 14 Feb 2022 10:24:09 +0100 Message-Id: <20220214092510.404600708@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Roberto Sassu commit bb8e52e4906f148c2faf6656b5106cf7233e9301 upstream. Commit c2426d2ad5027 ("ima: added support for new kernel cmdline parameter ima_template_fmt") introduced an additional check on the ima_template variable to avoid multiple template selection. Unfortunately, ima_template could be also set by the setup function of the ima_hash=3D parameter, when it calls ima_template_desc_current(). This caus= es attempts to choose a new template with ima_template=3D or with ima_template_fmt=3D, after ima_hash=3D, to be ignored. Achieve the goal of the commit mentioned with the new static variable template_setup_done, so that template selection requests after ima_hash=3D are not ignored. Finally, call ima_init_template_list(), if not already done, to initialize the list of templates before lookup_template_desc() is called. Reported-by: Guo Zihua Signed-off-by: Roberto Sassu Cc: stable@vger.kernel.org Fixes: c2426d2ad5027 ("ima: added support for new kernel cmdline parameter = ima_template_fmt") Signed-off-by: Mimi Zohar Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- security/integrity/ima/ima_template.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) --- a/security/integrity/ima/ima_template.c +++ b/security/integrity/ima/ima_template.c @@ -29,6 +29,7 @@ static struct ima_template_desc builtin_ =20 static LIST_HEAD(defined_templates); static DEFINE_SPINLOCK(template_list); +static int template_setup_done; =20 static const struct ima_template_field supported_fields[] =3D { {.field_id =3D "d", .field_init =3D ima_eventdigest_init, @@ -101,10 +102,11 @@ static int __init ima_template_setup(cha struct ima_template_desc *template_desc; int template_len =3D strlen(str); =20 - if (ima_template) + if (template_setup_done) return 1; =20 - ima_init_template_list(); + if (!ima_template) + ima_init_template_list(); =20 /* * Verify that a template with the supplied name exists. @@ -128,6 +130,7 @@ static int __init ima_template_setup(cha } =20 ima_template =3D template_desc; + template_setup_done =3D 1; return 1; } __setup("ima_template=3D", ima_template_setup); @@ -136,7 +139,7 @@ static int __init ima_template_fmt_setup { int num_templates =3D ARRAY_SIZE(builtin_templates); =20 - if (ima_template) + if (template_setup_done) return 1; =20 if (template_desc_init_fields(str, NULL, NULL) < 0) { @@ -147,6 +150,7 @@ static int __init ima_template_fmt_setup =20 builtin_templates[num_templates - 1].fmt =3D str; ima_template =3D builtin_templates + num_templates - 1; + template_setup_done =3D 1; =20 return 1; } From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31C46C433EF for ; Mon, 14 Feb 2022 10:19:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346343AbiBNKTq (ORCPT ); Mon, 14 Feb 2022 05:19:46 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348077AbiBNKRG (ORCPT ); Mon, 14 Feb 2022 05:17:06 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EA978CDBC; Mon, 14 Feb 2022 01:54:30 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DF0F1B80DCF; Mon, 14 Feb 2022 09:54:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CE80C340E9; Mon, 14 Feb 2022 09:54:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832467; bh=06YH9P+l1jwR/vVqn2iC1iLA8A09ItHL0sdYonjrSlY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ATEGO2tYZEaABx3LOAT295k/OsDhLRZkqnDsw5rqeQ0u+4yMmvyUkOW39FBaljIX4 vVJaEwu0/H3CmBQV1jjmiGNgju614ufzZaqdsh/Ao+mbgJdSRul+H9sMz/c7zbOzIO Srowru+84pYwaSaJopf6DOxlTs+KCVyN5dCE4Hj0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Berger , Christian Brauner , Mimi Zohar Subject: [PATCH 5.16 006/203] ima: Do not print policy rule with inactive LSM labels Date: Mon, 14 Feb 2022 10:24:10 +0100 Message-Id: <20220214092510.435666537@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stefan Berger commit 89677197ae709eb1ab3646952c44f6a171c9e74c upstream. Before printing a policy rule scan for inactive LSM labels in the policy rule. Inactive LSM labels are identified by args_p !=3D NULL and rule =3D=3D NULL. Fixes: 483ec26eed42 ("ima: ima/lsm policy rule loading logic bug fixes") Signed-off-by: Stefan Berger Cc: # v5.6+ Acked-by: Christian Brauner [zohar@linux.ibm.com: Updated "Fixes" tag] Signed-off-by: Mimi Zohar Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- security/integrity/ima/ima_policy.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/security/integrity/ima/ima_policy.c +++ b/security/integrity/ima/ima_policy.c @@ -1967,6 +1967,14 @@ int ima_policy_show(struct seq_file *m, =20 rcu_read_lock(); =20 + /* Do not print rules with inactive LSM labels */ + for (i =3D 0; i < MAX_LSM_RULES; i++) { + if (entry->lsm[i].args_p && !entry->lsm[i].rule) { + rcu_read_unlock(); + return 0; + } + } + if (entry->action & MEASURE) seq_puts(m, pt(Opt_measure)); if (entry->action & DONT_MEASURE) From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C527DC433EF for ; Mon, 14 Feb 2022 10:23:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343877AbiBNKXN (ORCPT ); Mon, 14 Feb 2022 05:23:13 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:47952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346337AbiBNKTq (ORCPT ); Mon, 14 Feb 2022 05:19:46 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A172890253; Mon, 14 Feb 2022 01:55:04 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 11F18B80DCF; Mon, 14 Feb 2022 09:55:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 200A2C340E9; Mon, 14 Feb 2022 09:55:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832501; bh=GmHD2H6wXTPw4OsDfCiRyEE9zZtwRyeGAsCLUx/cKAA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SQhZw3Yh1WLh8z/aFdtjVlpUC+blT/xndlBeKkgbyeTijlagT0/yQAuQp34YfwXyO iJZtB5SFtnOSQvr2e07AWv5p9u9TMPqhrz59FhisQ5yMuxE/6pMmEUVZohVEmD++L8 IXmfHlHfJhnYPYM0Iiuv3L7F0yfuESLKxxqbjT+Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Adrian Hunter , Ulf Hansson Subject: [PATCH 5.16 007/203] mmc: sdhci-of-esdhc: Check for error num after setting mask Date: Mon, 14 Feb 2022 10:24:11 +0100 Message-Id: <20220214092510.471179552@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 commit 40c67c291a93f8846c4a972c9ef1b7ba4544c8d0 upstream. Because of the possible failure of the dma_supported(), the dma_set_mask_and_coherent() may return error num. Therefore, it should be better to check it and return the error if fails. And since the sdhci_setup_host() has already checked the return value of the enable_dma, we need not check it in sdhci_resume_host() again. Fixes: 5552d7ad596c ("mmc: sdhci-of-esdhc: set proper dma mask for ls104x c= hips") Signed-off-by: Jiasheng Jiang Acked-by: Adrian Hunter Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220112083156.1124782-1-jiasheng@iscas.ac.= cn Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/mmc/host/sdhci-of-esdhc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/mmc/host/sdhci-of-esdhc.c +++ b/drivers/mmc/host/sdhci-of-esdhc.c @@ -524,12 +524,16 @@ static void esdhc_of_adma_workaround(str =20 static int esdhc_of_enable_dma(struct sdhci_host *host) { + int ret; u32 value; struct device *dev =3D mmc_dev(host->mmc); =20 if (of_device_is_compatible(dev->of_node, "fsl,ls1043a-esdhc") || - of_device_is_compatible(dev->of_node, "fsl,ls1046a-esdhc")) - dma_set_mask_and_coherent(dev, DMA_BIT_MASK(40)); + of_device_is_compatible(dev->of_node, "fsl,ls1046a-esdhc")) { + ret =3D dma_set_mask_and_coherent(dev, DMA_BIT_MASK(40)); + if (ret) + return ret; + } =20 value =3D sdhci_readl(host, ESDHC_DMA_SYSCTL); =20 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 406E8C433EF for ; Mon, 14 Feb 2022 10:22:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346809AbiBNKWP (ORCPT ); Mon, 14 Feb 2022 05:22:15 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:47964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346815AbiBNKUm (ORCPT ); Mon, 14 Feb 2022 05:20:42 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94DA97D289; Mon, 14 Feb 2022 01:55:18 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3ADC7B80D6D; Mon, 14 Feb 2022 09:55:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EEA3C340E9; Mon, 14 Feb 2022 09:55:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832517; bh=TheAArXQS3fi+rNGW9hay+xSdAToryKlCV4+R0BzZZs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=go+7vJwb8ZnSAjZ+2Lb4urcLIl7rYbBTEXEUU3ca92tHapYxx5bLpXKumnBot5jv5 EPIVKDky3yRFu1aVkv9bK4RSKvdOnB0ReaLBU2ZBXVNR53IGQWUeJo+qlbb07rQg4k 7g09DxttlFCTy25GaUVwe0FduyKA1vY2wukbjFdQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrey Skvortsov , Ulf Hansson Subject: [PATCH 5.16 008/203] mmc: core: Wait for command setting Power Off Notification bit to complete Date: Mon, 14 Feb 2022 10:24:12 +0100 Message-Id: <20220214092510.501534324@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Skvortsov commit 379f56c24e698f14242f532b1d0a0f1747725e08 upstream. SD card is allowed to signal busy on DAT0 up to 1s after the CMD49. According to SD spec (version 6.0 section 5.8.1.3) first host waits until busy of CMD49 is released and only then polls Power Management Status register up to 1s until the card indicates ready to power off. Without waiting for busy before polling status register sometimes card becomes unresponsive and system fails to suspend: [ 205.907459] Freezing remaining freezable tasks ... (elapsed 0.001 seco= nds) done. [ 206.421274] sunxi-mmc 1c0f000.mmc: data error, sending stop command [ 206.421321] sunxi-mmc 1c0f000.mmc: send stop command failed [ 206.421347] mmc0: error -110 reading status reg of PM func [ 206.421366] PM: dpm_run_callback(): mmc_bus_suspend+0x0/0x74 returns -= 110 [ 206.421402] mmcblk mmc0:aaaa: PM: failed to suspend async: error -110 [ 206.437064] PM: Some devices failed to suspend, or early wake event de= tected Tested with Sandisk Extreme PRO A2 64GB on Allwinner A64 system. Signed-off-by: Andrey Skvortsov Fixes: 2c5d42769038 ("mmc: core: Add support for Power Off Notification for= SD cards") Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220115121447.641524-1-andrej.skvortzov@gm= ail.com Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/mmc/core/sd.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -67,7 +67,7 @@ static const unsigned int sd_au_size[] =3D __res & __mask; \ }) =20 -#define SD_POWEROFF_NOTIFY_TIMEOUT_MS 2000 +#define SD_POWEROFF_NOTIFY_TIMEOUT_MS 1000 #define SD_WRITE_EXTR_SINGLE_TIMEOUT_MS 1000 =20 struct sd_busy_data { @@ -1664,6 +1664,12 @@ static int sd_poweroff_notify(struct mmc goto out; } =20 + /* Find out when the command is completed. */ + err =3D mmc_poll_for_busy(card, SD_WRITE_EXTR_SINGLE_TIMEOUT_MS, false, + MMC_BUSY_EXTR_SINGLE); + if (err) + goto out; + cb_data.card =3D card; cb_data.reg_buf =3D reg_buf; err =3D __mmc_poll_for_busy(card, SD_POWEROFF_NOTIFY_TIMEOUT_MS, From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4235FC433F5 for ; Mon, 14 Feb 2022 10:22:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346354AbiBNKWv (ORCPT ); Mon, 14 Feb 2022 05:22:51 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:51604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347459AbiBNKVQ (ORCPT ); Mon, 14 Feb 2022 05:21:16 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1D8D6E2A3; Mon, 14 Feb 2022 01:55:41 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 42379B80DBE; Mon, 14 Feb 2022 09:55:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D333C340E9; Mon, 14 Feb 2022 09:55:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832520; bh=EKHOewFeeT6MRfjkdUWbNby2Elw2HxvVWZiR6+uY1sI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TAonglvq239ylkWH5v6U5yICx9YzFHXzQON9NL6enULe6VjBXq2Dhc4XzqB+H1zW6 2HWnpJBJdixpJ3IiK0lQcMB/+TVNmYS3apdnIG5JS9vRcl13fcgs7Ae3dk+2ZqV3Iq QWLyJMeKvNKMCdsQsLAoMeKL6jusoFVNIabvvjic= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Ulf Hansson Subject: [PATCH 5.16 009/203] mmc: sh_mmcif: Check for null res pointer Date: Mon, 14 Feb 2022 10:24:13 +0100 Message-Id: <20220214092510.532676701@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 commit 4d315357b3d6c315a7260420c6c6fc076e58d14b upstream. If there is no suitable resource, platform_get_resource() will return NULL. Therefore in order to avoid the dereference of the NULL pointer, it should be better to check the 'res'. Signed-off-by: Jiasheng Jiang Cc: stable@vger.kernel.org # v5.16+ Link: https://lore.kernel.org/r/20220119120006.1426964-1-jiasheng@iscas.ac.= cn Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/mmc/host/sh_mmcif.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/mmc/host/sh_mmcif.c +++ b/drivers/mmc/host/sh_mmcif.c @@ -405,6 +405,9 @@ static int sh_mmcif_dma_slave_config(str struct dma_slave_config cfg =3D { 0, }; =20 res =3D platform_get_resource(host->pd, IORESOURCE_MEM, 0); + if (!res) + return -EINVAL; + cfg.direction =3D direction; =20 if (direction =3D=3D DMA_DEV_TO_MEM) { From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E90FBC433EF for ; Mon, 14 Feb 2022 10:22:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346218AbiBNKXA (ORCPT ); Mon, 14 Feb 2022 05:23:00 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:47998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347455AbiBNKVQ (ORCPT ); Mon, 14 Feb 2022 05:21:16 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C44D36E2A1; Mon, 14 Feb 2022 01:55:41 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 03043612FF; Mon, 14 Feb 2022 09:55:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D890DC340E9; Mon, 14 Feb 2022 09:55:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832523; bh=M6IFrLskbsvGTic0lO/SuMgtOr0QHBC9KNhy30mcHwA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jXg6YQ/OizgLBAg8zLKfRKhNS9FWEwpEC0yUYn1hOOg7brjBP547yB0r0tIDLqs5f Eawzj59X0UdNWXKuy3xbzrj8t0Ph+5gUnLW1IszRTG1kwdd05yN6meXmodmmCx8r+1 OIuy53L2TPDIkVxezPj3GqJHqI29qIbhls75dg9k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+4c63f36709a642f801c5@syzkaller.appspotmail.com, Ziyang Xuan , Oliver Hartkopp , Marc Kleine-Budde Subject: [PATCH 5.16 010/203] can: isotp: fix potential CAN frame reception race in isotp_rcv() Date: Mon, 14 Feb 2022 10:24:14 +0100 Message-Id: <20220214092510.565366151@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Oliver Hartkopp commit 7c759040c1dd03954f650f147ae7175476d51314 upstream. When receiving a CAN frame the current code logic does not consider concurrently receiving processes which do not show up in real world usage. Ziyang Xuan writes: The following syz problem is one of the scenarios. so->rx.len is changed by isotp_rcv_ff() during isotp_rcv_cf(), so->rx.len equals 0 before alloc_skb() and equals 4096 after alloc_skb(). That will trigger skb_over_panic() in skb_put(). =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D CPU: 1 PID: 19 Comm: ksoftirqd/1 Not tainted 5.16.0-rc8-syzkaller #0 RIP: 0010:skb_panic+0x16c/0x16e net/core/skbuff.c:113 Call Trace: skb_over_panic net/core/skbuff.c:118 [inline] skb_put.cold+0x24/0x24 net/core/skbuff.c:1990 isotp_rcv_cf net/can/isotp.c:570 [inline] isotp_rcv+0xa38/0x1e30 net/can/isotp.c:668 deliver net/can/af_can.c:574 [inline] can_rcv_filter+0x445/0x8d0 net/can/af_can.c:635 can_receive+0x31d/0x580 net/can/af_can.c:665 can_rcv+0x120/0x1c0 net/can/af_can.c:696 __netif_receive_skb_one_core+0x114/0x180 net/core/dev.c:5465 __netif_receive_skb+0x24/0x1b0 net/core/dev.c:5579 Therefore we make sure the state changes and data structures stay consistent at CAN frame reception time by adding a spin_lock in isotp_rcv(). This fixes the issue reported by syzkaller but does not affect real world operation. Fixes: e057dd3fc20f ("can: add ISO 15765-2:2016 transport protocol") Link: https://lore.kernel.org/linux-can/d7e69278-d741-c706-65e1-e87623d9a8e= 8@huawei.com/T/ Link: https://lore.kernel.org/all/20220208200026.13783-1-socketcan@hartkopp= .net Cc: stable@vger.kernel.org Reported-by: syzbot+4c63f36709a642f801c5@syzkaller.appspotmail.com Reported-by: Ziyang Xuan Signed-off-by: Oliver Hartkopp Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- net/can/isotp.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) --- a/net/can/isotp.c +++ b/net/can/isotp.c @@ -56,6 +56,7 @@ #include #include #include +#include #include #include #include @@ -145,6 +146,7 @@ struct isotp_sock { struct tpcon rx, tx; struct list_head notifier; wait_queue_head_t wait; + spinlock_t rx_lock; /* protect single thread state machine */ }; =20 static LIST_HEAD(isotp_notifier_list); @@ -615,11 +617,17 @@ static void isotp_rcv(struct sk_buff *sk =20 n_pci_type =3D cf->data[ae] & 0xF0; =20 + /* Make sure the state changes and data structures stay consistent at + * CAN frame reception time. This locking is not needed in real world + * use cases but the inconsistency can be triggered with syzkaller. + */ + spin_lock(&so->rx_lock); + if (so->opt.flags & CAN_ISOTP_HALF_DUPLEX) { /* check rx/tx path half duplex expectations */ if ((so->tx.state !=3D ISOTP_IDLE && n_pci_type !=3D N_PCI_FC) || (so->rx.state !=3D ISOTP_IDLE && n_pci_type =3D=3D N_PCI_FC)) - return; + goto out_unlock; } =20 switch (n_pci_type) { @@ -668,6 +676,9 @@ static void isotp_rcv(struct sk_buff *sk isotp_rcv_cf(sk, cf, ae, skb); break; } + +out_unlock: + spin_unlock(&so->rx_lock); } =20 static void isotp_fill_dataframe(struct canfd_frame *cf, struct isotp_sock= *so, @@ -1444,6 +1455,7 @@ static int isotp_init(struct sock *sk) so->txtimer.function =3D isotp_tx_timer_handler; =20 init_waitqueue_head(&so->wait); + spin_lock_init(&so->rx_lock); =20 spin_lock(&isotp_notifier_lock); list_add_tail(&so->notifier, &isotp_notifier_list); From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41224C433EF for ; Mon, 14 Feb 2022 10:23:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347044AbiBNKXW (ORCPT ); Mon, 14 Feb 2022 05:23:22 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:50954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347081AbiBNKUr (ORCPT ); Mon, 14 Feb 2022 05:20:47 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2864E6E344; Mon, 14 Feb 2022 01:55:28 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C6209B80DC8; Mon, 14 Feb 2022 09:55:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DCB25C340E9; Mon, 14 Feb 2022 09:55:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832526; bh=pgZjIPO/xPpvA04zri388RaooRNpi1eK/Oi2BDZbWD4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=umV0aFXN1CO0x0+nPVtGr5fwjfWf2zaGmMf4smBmQYl52kQi6jKdw1qM3IwfIlgKU FrbxhTJIfUo1e8HuXRBw6K1E4PzDENeC3uJ0+OFYMJpGbDz4ynZRYAkhbZztgb/jTO QNsxV3SxNrZiPqFtUGidTpMCrN9SFrOIkwk//G0o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ziyang Xuan , Oliver Hartkopp , Marc Kleine-Budde Subject: [PATCH 5.16 011/203] can: isotp: fix error path in isotp_sendmsg() to unlock wait queue Date: Mon, 14 Feb 2022 10:24:15 +0100 Message-Id: <20220214092510.602078699@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Oliver Hartkopp commit 8375dfac4f683e1b2c5956d919d36aeedad46699 upstream. Commit 43a08c3bdac4 ("can: isotp: isotp_sendmsg(): fix TX buffer concurrent access in isotp_sendmsg()") introduced a new locking scheme that may render the userspace application in a locking state when an error is detected. This issue shows up under high load on simultaneously running isotp channels with identical configuration which is against the ISO specification and therefore breaks any reasonable PDU communication anyway. Fixes: 43a08c3bdac4 ("can: isotp: isotp_sendmsg(): fix TX buffer concurrent= access in isotp_sendmsg()") Link: https://lore.kernel.org/all/20220209073601.25728-1-socketcan@hartkopp= .net Cc: stable@vger.kernel.org Cc: Ziyang Xuan Signed-off-by: Oliver Hartkopp Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- net/can/isotp.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) --- a/net/can/isotp.c +++ b/net/can/isotp.c @@ -887,7 +887,7 @@ static int isotp_sendmsg(struct socket * =20 if (!size || size > MAX_MSG_LENGTH) { err =3D -EINVAL; - goto err_out; + goto err_out_drop; } =20 /* take care of a potential SF_DL ESC offset for TX_DL > 8 */ @@ -897,24 +897,24 @@ static int isotp_sendmsg(struct socket * if ((so->opt.flags & CAN_ISOTP_SF_BROADCAST) && (size > so->tx.ll_dl - SF_PCI_SZ4 - ae - off)) { err =3D -EINVAL; - goto err_out; + goto err_out_drop; } =20 err =3D memcpy_from_msg(so->tx.buf, msg, size); if (err < 0) - goto err_out; + goto err_out_drop; =20 dev =3D dev_get_by_index(sock_net(sk), so->ifindex); if (!dev) { err =3D -ENXIO; - goto err_out; + goto err_out_drop; } =20 skb =3D sock_alloc_send_skb(sk, so->ll.mtu + sizeof(struct can_skb_priv), msg->msg_flags & MSG_DONTWAIT, &err); if (!skb) { dev_put(dev); - goto err_out; + goto err_out_drop; } =20 can_skb_reserve(skb); @@ -976,7 +976,7 @@ static int isotp_sendmsg(struct socket * if (err) { pr_notice_once("can-isotp: %s: can_send_ret %pe\n", __func__, ERR_PTR(err)); - goto err_out; + goto err_out_drop; } =20 if (wait_tx_done) { @@ -989,6 +989,9 @@ static int isotp_sendmsg(struct socket * =20 return size; =20 +err_out_drop: + /* drop this PDU and unlock a potential wait queue */ + old_state =3D ISOTP_IDLE; err_out: so->tx.state =3D old_state; if (so->tx.state =3D=3D ISOTP_IDLE) From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C13D6C433FE for ; Mon, 14 Feb 2022 10:23:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346728AbiBNKX3 (ORCPT ); Mon, 14 Feb 2022 05:23:29 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:53390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347535AbiBNKVT (ORCPT ); Mon, 14 Feb 2022 05:21:19 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01D147D29B; Mon, 14 Feb 2022 01:55:45 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EF55FB80DCD; Mon, 14 Feb 2022 09:55:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10903C340E9; Mon, 14 Feb 2022 09:55:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832529; bh=l0PJjO+e5VJdWj/04DSb6gvQ/YyKbHI2YE4QxJza6hs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ug/G4alaMp76I/s5AYBXYzXvsx6P9C1COZp0zoKXfzHXTMc5/ZUCOD3nQUMpKwMVT LbesKQpE4dNsvmyaV54CMbBfw9ZVw1uCT1c69NtgY+qVOc0buq1iNIBAioNtOO+bP+ CK061/mGeRlUeyPgLQ3RRwV3U0BZ2F70nU9HAB18= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Parkhomenko , "Russell King (Oracle)" , Serge Semin , Jakub Kicinski Subject: [PATCH 5.16 012/203] net: phy: marvell: Fix RGMII Tx/Rx delays setting in 88e1121-compatible PHYs Date: Mon, 14 Feb 2022 10:24:16 +0100 Message-Id: <20220214092510.636380201@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Parkhomenko commit fe4f57bf7b585dca58f1496c4e2481ecbae18126 upstream. It is mandatory for a software to issue a reset upon modifying RGMII Receive Timing Control and RGMII Transmit Timing Control bit fields of MAC Specific Control register 2 (page 2, register 21) otherwise the changes won't be perceived by the PHY (the same is applicable for a lot of other registers). Not setting the RGMII delays on the platforms that imply it' being done on the PHY side will consequently cause the traffic loss. We discovered that the denoted soft-reset is missing in the m88e1121_config_aneg() method for the case if the RGMII delays are modified but the MDIx polarity isn't changed or the auto-negotiation is left enabled, thus causing the traffic loss on our platform with Marvell Alaska 88E1510 installed. Let's fix that by issuing the soft-reset if the delays have been actually set in the m88e1121_config_aneg_rgmii_delays() method. Cc: stable@vger.kernel.org Fixes: d6ab93364734 ("net: phy: marvell: Avoid unnecessary soft reset") Signed-off-by: Pavel Parkhomenko Reviewed-by: Russell King (Oracle) Reviewed-by: Serge Semin Link: https://lore.kernel.org/r/20220205203932.26899-1-Pavel.Parkhomenko@ba= ikalelectronics.ru Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/net/phy/marvell.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -553,9 +553,9 @@ static int m88e1121_config_aneg_rgmii_de else mscr =3D 0; =20 - return phy_modify_paged(phydev, MII_MARVELL_MSCR_PAGE, - MII_88E1121_PHY_MSCR_REG, - MII_88E1121_PHY_MSCR_DELAY_MASK, mscr); + return phy_modify_paged_changed(phydev, MII_MARVELL_MSCR_PAGE, + MII_88E1121_PHY_MSCR_REG, + MII_88E1121_PHY_MSCR_DELAY_MASK, mscr); } =20 static int m88e1121_config_aneg(struct phy_device *phydev) @@ -569,11 +569,13 @@ static int m88e1121_config_aneg(struct p return err; } =20 + changed =3D err; + err =3D marvell_set_polarity(phydev, phydev->mdix_ctrl); if (err < 0) return err; =20 - changed =3D err; + changed |=3D err; =20 err =3D genphy_config_aneg(phydev); if (err < 0) From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56F52C433F5 for ; Mon, 14 Feb 2022 10:22:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235978AbiBNKWj (ORCPT ); Mon, 14 Feb 2022 05:22:39 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:51938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347242AbiBNKVI (ORCPT ); Mon, 14 Feb 2022 05:21:08 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 034326E367; Mon, 14 Feb 2022 01:55:33 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 54D026128D; Mon, 14 Feb 2022 09:55:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A201C340E9; Mon, 14 Feb 2022 09:55:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832532; bh=0SfkfVxXg/rLEx5QSx9ET6CL2EpylA2wl8N0n1dSK6o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x7lVfKoYbE4kMeIMdghg0Oc3KByo5NgPTetijykYWvcPxiGv4UhmC504cyXFh9KHI evYj02bnYIvahZhNjGYqTK1fd9Dj/GQY5wYs2D7IQWPC0wt947hp4SHiMI/9f2SCPZ hl74bT1dlq6upkmkcZ9vwwYqv2pwbKfETACHKEW8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Parkhomenko , Serge Semin , Andrew Lunn , "David S. Miller" Subject: [PATCH 5.16 013/203] net: phy: marvell: Fix MDI-x polarity setting in 88e1118-compatible PHYs Date: Mon, 14 Feb 2022 10:24:17 +0100 Message-Id: <20220214092510.670030845@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Parkhomenko commit aec12836e7196e4d360b2cbf20cf7aa5139ad2ec upstream. When setting up autonegotiation for 88E1118R and compatible PHYs, a software reset of PHY is issued before setting up polarity. This is incorrect as changes of MDI Crossover Mode bits are disruptive to the normal operation and must be followed by a software reset to take effect. Let's patch m88e1118_config_aneg() to fix the issue mentioned before by invoking software reset of the PHY just after setting up MDI-x polarity. Fixes: 605f196efbf8 ("phy: Add support for Marvell 88E1118 PHY") Signed-off-by: Pavel Parkhomenko Reviewed-by: Serge Semin Suggested-by: Andrew Lunn Cc: stable@vger.kernel.org Reviewed-by: Andrew Lunn Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/net/phy/marvell.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -1215,16 +1215,15 @@ static int m88e1118_config_aneg(struct p { int err; =20 - err =3D genphy_soft_reset(phydev); + err =3D marvell_set_polarity(phydev, phydev->mdix_ctrl); if (err < 0) return err; =20 - err =3D marvell_set_polarity(phydev, phydev->mdix_ctrl); + err =3D genphy_config_aneg(phydev); if (err < 0) return err; =20 - err =3D genphy_config_aneg(phydev); - return 0; + return genphy_soft_reset(phydev); } =20 static int m88e1118_config_init(struct phy_device *phydev) From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 62129C433EF for ; Mon, 14 Feb 2022 10:19:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346603AbiBNKTd (ORCPT ); Mon, 14 Feb 2022 05:19:33 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347981AbiBNKRC (ORCPT ); Mon, 14 Feb 2022 05:17:02 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49A318CDA5; Mon, 14 Feb 2022 01:54:28 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9B999B80DC4; Mon, 14 Feb 2022 09:53:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92146C340E9; Mon, 14 Feb 2022 09:53:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832436; bh=HgDS/vqrYnhvkyXDkH5OZTa9pHSx5ejvwP0/rYor4Qc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z8wpV+UAAUWC2PGSlOcKfVvjqtV07hvmkXIe8dALe92A5EDdgPFsQ782dgdwF+My4 8NNOILzHJ4dIoAPgwCYjyrcJg0ylOeEGwcW86OcucT49nJNMod0/liisdflH9se0bn 2h60VTyOO3LpRZ1EGmqrygak5bg8efE2uVNw8SLQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust , Anna Schumaker Subject: [PATCH 5.16 014/203] NFS: Fix initialisation of nfs_client cl_flags field Date: Mon, 14 Feb 2022 10:24:18 +0100 Message-Id: <20220214092510.708862613@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 468d126dab45718feeb728319be20bd869a5eaa7 upstream. For some long forgotten reason, the nfs_client cl_flags field is initialised in nfs_get_client() instead of being initialised at allocation time. This quirk was harmless until we moved the call to nfs_create_rpc_client(). Fixes: dd99e9f98fbf ("NFSv4: Initialise connection to the server in nfs4_al= loc_client()") Cc: stable@vger.kernel.org # 4.8.x Signed-off-by: Trond Myklebust Signed-off-by: Anna Schumaker Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- fs/nfs/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -177,6 +177,7 @@ struct nfs_client *nfs_alloc_client(cons INIT_LIST_HEAD(&clp->cl_superblocks); clp->cl_rpcclient =3D ERR_PTR(-EINVAL); =20 + clp->cl_flags =3D cl_init->init_flags; clp->cl_proto =3D cl_init->proto; clp->cl_nconnect =3D cl_init->nconnect; clp->cl_max_connect =3D cl_init->max_connect ? cl_init->max_connect : 1; @@ -427,7 +428,6 @@ struct nfs_client *nfs_get_client(const list_add_tail(&new->cl_share_link, &nn->nfs_client_list); spin_unlock(&nn->nfs_client_lock); - new->cl_flags =3D cl_init->init_flags; return rpc_ops->init_client(new, cl_init); } =20 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5250FC433F5 for ; Mon, 14 Feb 2022 10:19:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346517AbiBNKTM (ORCPT ); Mon, 14 Feb 2022 05:19:12 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347504AbiBNKQe (ORCPT ); Mon, 14 Feb 2022 05:16:34 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20F067C148; Mon, 14 Feb 2022 01:54:05 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DF71661375; Mon, 14 Feb 2022 09:53:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5F91C340E9; Mon, 14 Feb 2022 09:53:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832439; bh=0c7FPgrkzkPBYHxqx3yzOUKo/b1ktRrCosiqLKiIf0s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w+9E3RELbQnpSaiarLN+pXeHBqDUNCQUxI+M++07hmRus2P29CkuccXEIX0ZPjqoL JuvS24Y1HiIUkbeNGvsMHFu5dglFgVYu+KNV9gQ2MoQI1SctmdlHTXqKKiZeVsYUKh wfj5uCietGiItLbDhxWo4tHEhZonSd99j82oc9/w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuck Lever Subject: [PATCH 5.16 015/203] NFSD: Fix NFSv3 SETATTR/CREATEs handling of large file sizes Date: Mon, 14 Feb 2022 10:24:19 +0100 Message-Id: <20220214092510.741563332@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 a648fdeb7c0e17177a2280344d015dba3fbe3314 upstream. iattr::ia_size is a loff_t, so these NFSv3 procedures must be careful to deal with incoming client size values that are larger than s64_max without corrupting the value. Silently capping the value results in storing a different value than the client passed in which is unexpected behavior, so remove the min_t() check in decode_sattr3(). Note that RFC 1813 permits only the WRITE procedure to return NFS3ERR_FBIG. We believe that NFSv3 reference implementations also return NFS3ERR_FBIG when ia_size is too large. Cc: stable@vger.kernel.org Signed-off-by: Chuck Lever Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- fs/nfsd/nfs3xdr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/nfsd/nfs3xdr.c +++ b/fs/nfsd/nfs3xdr.c @@ -254,7 +254,7 @@ svcxdr_decode_sattr3(struct svc_rqst *rq if (xdr_stream_decode_u64(xdr, &newsize) < 0) return false; iap->ia_valid |=3D ATTR_SIZE; - iap->ia_size =3D min_t(u64, newsize, NFS_OFFSET_MAX); + iap->ia_size =3D newsize; } if (xdr_stream_decode_u32(xdr, &set_it) < 0) return false; From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1059C433F5 for ; Mon, 14 Feb 2022 10:18:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346500AbiBNKTE (ORCPT ); Mon, 14 Feb 2022 05:19:04 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347491AbiBNKQd (ORCPT ); Mon, 14 Feb 2022 05:16:33 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3A7C07C146; Mon, 14 Feb 2022 01:54:04 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CEB6DB80D6D; Mon, 14 Feb 2022 09:54:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F37BEC340E9; Mon, 14 Feb 2022 09:54:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832442; bh=90L42e49gTnIttG60Vd1WAt35ktpCOrBMIYNDCAlMsA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FqnNQHDtl22qGgGxY9DDRAwkpYQDRpeBYoM9bFWSIwSrGiiTj1e21cywTarAwvb0m 2jaT1j1yMp7kIO8JCENZKrvF2DOOmYO87/jMgQxXzJcpBZMAzicXCDKva50cLgwHvT 1yVyeUQRsslgvhzm0k5wnnvhGSnSklGmBAowACpg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuck Lever Subject: [PATCH 5.16 016/203] NFSD: Fix ia_size underflow Date: Mon, 14 Feb 2022 10:24:20 +0100 Message-Id: <20220214092510.772279592@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 e6faac3f58c7c4176b66f63def17a34232a17b0e upstream. iattr::ia_size is a loff_t, which is a signed 64-bit type. NFSv3 and NFSv4 both define file size as an unsigned 64-bit type. Thus there is a range of valid file size values an NFS client can send that is already larger than Linux can handle. Currently decode_fattr4() dumps a full u64 value into ia_size. If that value happens to be larger than S64_MAX, then ia_size underflows. I'm about to fix up the NFSv3 behavior as well, so let's catch the underflow in the common code path: nfsd_setattr(). Cc: stable@vger.kernel.org Signed-off-by: Chuck Lever Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- fs/nfsd/vfs.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -434,6 +434,10 @@ nfsd_setattr(struct svc_rqst *rqstp, str .ia_size =3D iap->ia_size, }; =20 + host_err =3D -EFBIG; + if (iap->ia_size < 0) + goto out_unlock; + host_err =3D notify_change(&init_user_ns, dentry, &size_attr, NULL); if (host_err) goto out_unlock; From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5550C4167B for ; Mon, 14 Feb 2022 10:21:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347479AbiBNKVR (ORCPT ); Mon, 14 Feb 2022 05:21:17 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347973AbiBNKRB (ORCPT ); Mon, 14 Feb 2022 05:17:01 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B90318CD9E; Mon, 14 Feb 2022 01:54:27 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0CCE460F31; Mon, 14 Feb 2022 09:54:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2D80C340E9; Mon, 14 Feb 2022 09:54:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832445; bh=7wu8b6agGOA1q3qTSBxQDmnk8+fRPmC6y+mRFVQk5vw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kVgAlQcaHclp010hvq6QHy8Bpynd9e5A306Obx+Yh+cBD6T+sa/t3X43gbDlXI4+8 MYMN3hyeM2jRdl7dmonaHZ+8pJqzen83/Jqe8xnfwzPFXZXbQCxjnD23NEgYvlXaIg iE7xInLNbrTIwvEskTiePJeW9QMYNyOoMERR7/Nw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuck Lever Subject: [PATCH 5.16 017/203] NFSD: Clamp WRITE offsets Date: Mon, 14 Feb 2022 10:24:21 +0100 Message-Id: <20220214092510.806006366@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 6260d9a56ab352b54891ec66ab0eced57d55abc6 upstream. Ensure that a client cannot specify a WRITE range that falls in a byte range outside what the kernel's internal types (such as loff_t, which is signed) can represent. The kiocb iterators, invoked in nfsd_vfs_write(), should properly limit write operations to within the underlying file system's s_maxbytes. Cc: stable@vger.kernel.org Signed-off-by: Chuck Lever Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- fs/nfsd/nfs3proc.c | 5 +++++ fs/nfsd/nfs4proc.c | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) --- a/fs/nfsd/nfs3proc.c +++ b/fs/nfsd/nfs3proc.c @@ -199,6 +199,11 @@ nfsd3_proc_write(struct svc_rqst *rqstp) (unsigned long long) argp->offset, argp->stable? " stable" : ""); =20 + resp->status =3D nfserr_fbig; + if (argp->offset > (u64)OFFSET_MAX || + argp->offset + argp->len > (u64)OFFSET_MAX) + return rpc_success; + fh_copy(&resp->fh, &argp->fh); resp->committed =3D argp->stable; nvecs =3D svc_fill_write_vector(rqstp, &argp->payload); --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -1018,8 +1018,9 @@ nfsd4_write(struct svc_rqst *rqstp, stru unsigned long cnt; int nvecs; =20 - if (write->wr_offset >=3D OFFSET_MAX) - return nfserr_inval; + if (write->wr_offset > (u64)OFFSET_MAX || + write->wr_offset + write->wr_buflen > (u64)OFFSET_MAX) + return nfserr_fbig; =20 cnt =3D write->wr_buflen; trace_nfsd_write_start(rqstp, &cstate->current_fh, From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5E484C433EF for ; Mon, 14 Feb 2022 10:19:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346313AbiBNKTk (ORCPT ); Mon, 14 Feb 2022 05:19:40 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347999AbiBNKRD (ORCPT ); Mon, 14 Feb 2022 05:17:03 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 049E08CDAE; Mon, 14 Feb 2022 01:54:29 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0510661291; Mon, 14 Feb 2022 09:54:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA8E1C340E9; Mon, 14 Feb 2022 09:54:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832448; bh=1ntWSla+5nh9tEUa/mvCSg1/ISzaLNJ5FQu7JQZLhyo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u+tb+laQkad2/gOcVAvh0vDJ4lqRhwXnuV2HQnJhYjm71KfzfrgnETqsaoOmMRYKp jRIFa/fGXEAJkiQ9FUXtHnWzDY9+Otxn80T99c3oPAxOuC65Qsu4g4fSxjdFcpLasK UUS+ooBEYczvW0g/jaY1IH5uIVxeloRlbkr1lwfA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chuck Lever Subject: [PATCH 5.16 018/203] NFSD: Fix offset type in I/O trace points Date: Mon, 14 Feb 2022 10:24:22 +0100 Message-Id: <20220214092510.839136424@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 6a4d333d540041d244b2fca29b8417bfde20af81 upstream. NFSv3 and NFSv4 use u64 offset values on the wire. Record these values verbatim without the implicit type case to loff_t. Signed-off-by: Chuck Lever Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- fs/nfsd/trace.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) --- a/fs/nfsd/trace.h +++ b/fs/nfsd/trace.h @@ -320,14 +320,14 @@ TRACE_EVENT(nfsd_export_update, DECLARE_EVENT_CLASS(nfsd_io_class, TP_PROTO(struct svc_rqst *rqstp, struct svc_fh *fhp, - loff_t offset, - unsigned long len), + u64 offset, + u32 len), TP_ARGS(rqstp, fhp, offset, len), TP_STRUCT__entry( __field(u32, xid) __field(u32, fh_hash) - __field(loff_t, offset) - __field(unsigned long, len) + __field(u64, offset) + __field(u32, len) ), TP_fast_assign( __entry->xid =3D be32_to_cpu(rqstp->rq_xid); @@ -335,7 +335,7 @@ DECLARE_EVENT_CLASS(nfsd_io_class, __entry->offset =3D offset; __entry->len =3D len; ), - TP_printk("xid=3D0x%08x fh_hash=3D0x%08x offset=3D%lld len=3D%lu", + TP_printk("xid=3D0x%08x fh_hash=3D0x%08x offset=3D%llu len=3D%u", __entry->xid, __entry->fh_hash, __entry->offset, __entry->len) ) @@ -344,8 +344,8 @@ DECLARE_EVENT_CLASS(nfsd_io_class, DEFINE_EVENT(nfsd_io_class, nfsd_##name, \ TP_PROTO(struct svc_rqst *rqstp, \ struct svc_fh *fhp, \ - loff_t offset, \ - unsigned long len), \ + u64 offset, \ + u32 len), \ TP_ARGS(rqstp, fhp, offset, len)) =20 DEFINE_NFSD_IO_EVENT(read_start); From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2878C433F5 for ; Mon, 14 Feb 2022 10:19:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346569AbiBNKTU (ORCPT ); Mon, 14 Feb 2022 05:19:20 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:47964 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347676AbiBNKQp (ORCPT ); Mon, 14 Feb 2022 05:16:45 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C1898C7CA; Mon, 14 Feb 2022 01:54:14 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A3DF4B80DFE; Mon, 14 Feb 2022 09:54:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D327AC340E9; Mon, 14 Feb 2022 09:54:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832451; bh=JsS9Skp3vsyC7yBa+nz/KP8/8m1F36/h6fchRD4RKj4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EPeuNRTlI9oR0bvOl6j5X28YgKiqpNOcL6KpBoOL1TSEClbB+og134VSaze5CvVLa lLuqGk6wSoKvsbRGgCfEcTJ0gV/O7oJyaG86rcS4HyVZTzfS9bxnwgaoHGI1LSZ/ze 81fQwWmrkV3VHXkGPCHa3I0TBdGKZCR+TKUsILj8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Aloni , Chuck Lever Subject: [PATCH 5.16 019/203] NFSD: Fix the behavior of READ near OFFSET_MAX Date: Mon, 14 Feb 2022 10:24:23 +0100 Message-Id: <20220214092510.871536905@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 0cb4d23ae08c48f6bf3c29a8e5c4a74b8388b960 upstream. Dan Aloni reports: > Due to commit 8cfb9015280d ("NFS: Always provide aligned buffers to > the RPC read layers") on the client, a read of 0xfff is aligned up > to server rsize of 0x1000. > > As a result, in a test where the server has a file of size > 0x7fffffffffffffff, and the client tries to read from the offset > 0x7ffffffffffff000, the read causes loff_t overflow in the server > and it returns an NFS code of EINVAL to the client. The client as > a result indefinitely retries the request. The Linux NFS client does not handle NFS?ERR_INVAL, even though all NFS specifications permit servers to return that status code for a READ. Instead of NFS?ERR_INVAL, have out-of-range READ requests succeed and return a short result. Set the EOF flag in the result to prevent the client from retrying the READ request. This behavior appears to be consistent with Solaris NFS servers. Note that NFSv3 and NFSv4 use u64 offset values on the wire. These must be converted to loff_t internally before use -- an implicit type cast is not adequate for this purpose. Otherwise VFS checks against sb->s_maxbytes do not work properly. Reported-by: Dan Aloni Cc: stable@vger.kernel.org Signed-off-by: Chuck Lever Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- fs/nfsd/nfs3proc.c | 8 ++++++-- fs/nfsd/nfs4proc.c | 8 ++++++-- fs/nfsd/nfs4xdr.c | 8 ++------ 3 files changed, 14 insertions(+), 10 deletions(-) --- a/fs/nfsd/nfs3proc.c +++ b/fs/nfsd/nfs3proc.c @@ -150,13 +150,17 @@ nfsd3_proc_read(struct svc_rqst *rqstp) unsigned int len; int v; =20 - argp->count =3D min_t(u32, argp->count, max_blocksize); - dprintk("nfsd: READ(3) %s %lu bytes at %Lu\n", SVCFH_fmt(&argp->fh), (unsigned long) argp->count, (unsigned long long) argp->offset); =20 + argp->count =3D min_t(u32, argp->count, max_blocksize); + if (argp->offset > (u64)OFFSET_MAX) + argp->offset =3D (u64)OFFSET_MAX; + if (argp->offset + argp->count > (u64)OFFSET_MAX) + argp->count =3D (u64)OFFSET_MAX - argp->offset; + v =3D 0; len =3D argp->count; resp->pages =3D rqstp->rq_next_page; --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -782,12 +782,16 @@ nfsd4_read(struct svc_rqst *rqstp, struc __be32 status; =20 read->rd_nf =3D NULL; - if (read->rd_offset >=3D OFFSET_MAX) - return nfserr_inval; =20 trace_nfsd_read_start(rqstp, &cstate->current_fh, read->rd_offset, read->rd_length); =20 + read->rd_length =3D min_t(u32, read->rd_length, svc_max_payload(rqstp)); + if (read->rd_offset > (u64)OFFSET_MAX) + read->rd_offset =3D (u64)OFFSET_MAX; + if (read->rd_offset + read->rd_length > (u64)OFFSET_MAX) + read->rd_length =3D (u64)OFFSET_MAX - read->rd_offset; + /* * If we do a zero copy read, then a client will see read data * that reflects the state of the file *after* performing the --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c @@ -3997,10 +3997,8 @@ nfsd4_encode_read(struct nfsd4_compoundr } xdr_commit_encode(xdr); =20 - maxcount =3D svc_max_payload(resp->rqstp); - maxcount =3D min_t(unsigned long, maxcount, + maxcount =3D min_t(unsigned long, read->rd_length, (xdr->buf->buflen - xdr->buf->len)); - maxcount =3D min_t(unsigned long, maxcount, read->rd_length); =20 if (file->f_op->splice_read && test_bit(RQ_SPLICE_OK, &resp->rqstp->rq_flags)) @@ -4837,10 +4835,8 @@ nfsd4_encode_read_plus(struct nfsd4_comp return nfserr_resource; xdr_commit_encode(xdr); =20 - maxcount =3D svc_max_payload(resp->rqstp); - maxcount =3D min_t(unsigned long, maxcount, + maxcount =3D min_t(unsigned long, read->rd_length, (xdr->buf->buflen - xdr->buf->len)); - maxcount =3D min_t(unsigned long, maxcount, read->rd_length); count =3D maxcount; =20 eof =3D read->rd_offset >=3D i_size_read(file_inode(file)); From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CD08C4332F for ; Mon, 14 Feb 2022 10:21:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235125AbiBNKVX (ORCPT ); Mon, 14 Feb 2022 05:21:23 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348211AbiBNKRM (ORCPT ); Mon, 14 Feb 2022 05:17:12 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58D9E8E1A5; Mon, 14 Feb 2022 01:54:39 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 17CCF6128D; Mon, 14 Feb 2022 09:54:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E67E4C340F1; Mon, 14 Feb 2022 09:54:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832454; bh=3oCohB5C+DI7atP5lICgyf/Sq//X4dnueJT8FhtjFVA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Fx993mxdTWD94O9NuoINkUyYND2DCvjjMcGxFduK41JyFXqFBncSUYSD+TzW7QW2e t36uUJ0/5yB4o/HHtMvrhYEPjBhi0BPkAP6Ahan0xN/McREDktPX023jvfxKhBzgPS VloziEPaFTtZXHKlEuXbPbagoVm9KGGcUIe+KzR0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, NeilBrown , Anna Schumaker , Sasha Levin Subject: [PATCH 5.16 020/203] NFS: change nfs_access_get_cached to only report the mask Date: Mon, 14 Feb 2022 10:24:24 +0100 Message-Id: <20220214092510.902727612@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: NeilBrown [ Upstream commit b5e7b59c3480f355910f9d2c6ece5857922a5e54 ] Currently the nfs_access_get_cached family of functions report a 'struct nfs_access_entry' as the result, with both .mask and .cred set. However the .cred is never used. This is probably good and there is no guarantee that it won't be freed before use. Change to only report the 'mask' - as this is all that is used or needed. Signed-off-by: NeilBrown Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- fs/nfs/dir.c | 20 +++++++++----------- fs/nfs/nfs4proc.c | 18 +++++++++--------- include/linux/nfs_fs.h | 4 ++-- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 24ce5652d9be8..faf5168880223 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -2695,7 +2695,7 @@ static struct nfs_access_entry *nfs_access_search_rbt= ree(struct inode *inode, co return NULL; } =20 -static int nfs_access_get_cached_locked(struct inode *inode, const struct = cred *cred, struct nfs_access_entry *res, bool may_block) +static int nfs_access_get_cached_locked(struct inode *inode, const struct = cred *cred, u32 *mask, bool may_block) { struct nfs_inode *nfsi =3D NFS_I(inode); struct nfs_access_entry *cache; @@ -2725,8 +2725,7 @@ static int nfs_access_get_cached_locked(struct inode = *inode, const struct cred * spin_lock(&inode->i_lock); retry =3D false; } - res->cred =3D cache->cred; - res->mask =3D cache->mask; + *mask =3D cache->mask; list_move_tail(&cache->lru, &nfsi->access_cache_entry_lru); err =3D 0; out: @@ -2738,7 +2737,7 @@ static int nfs_access_get_cached_locked(struct inode = *inode, const struct cred * return -ENOENT; } =20 -static int nfs_access_get_cached_rcu(struct inode *inode, const struct cre= d *cred, struct nfs_access_entry *res) +static int nfs_access_get_cached_rcu(struct inode *inode, const struct cre= d *cred, u32 *mask) { /* Only check the most recently returned cache entry, * but do it without locking. @@ -2760,22 +2759,21 @@ static int nfs_access_get_cached_rcu(struct inode *= inode, const struct cred *cre goto out; if (nfs_check_cache_invalid(inode, NFS_INO_INVALID_ACCESS)) goto out; - res->cred =3D cache->cred; - res->mask =3D cache->mask; + *mask =3D cache->mask; err =3D 0; out: rcu_read_unlock(); return err; } =20 -int nfs_access_get_cached(struct inode *inode, const struct cred *cred, st= ruct -nfs_access_entry *res, bool may_block) +int nfs_access_get_cached(struct inode *inode, const struct cred *cred, + u32 *mask, bool may_block) { int status; =20 - status =3D nfs_access_get_cached_rcu(inode, cred, res); + status =3D nfs_access_get_cached_rcu(inode, cred, mask); if (status !=3D 0) - status =3D nfs_access_get_cached_locked(inode, cred, res, + status =3D nfs_access_get_cached_locked(inode, cred, mask, may_block); =20 return status; @@ -2896,7 +2894,7 @@ static int nfs_do_access(struct inode *inode, const s= truct cred *cred, int mask) =20 trace_nfs_access_enter(inode); =20 - status =3D nfs_access_get_cached(inode, cred, &cache, may_block); + status =3D nfs_access_get_cached(inode, cred, &cache.mask, may_block); if (status =3D=3D 0) goto out_cached; =20 diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index ee3bc79f6ca3a..322ff45ad15ca 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -7611,7 +7611,7 @@ static int nfs4_xattr_set_nfs4_user(const struct xatt= r_handler *handler, const char *key, const void *buf, size_t buflen, int flags) { - struct nfs_access_entry cache; + u32 mask; int ret; =20 if (!nfs_server_capable(inode, NFS_CAP_XATTR)) @@ -7626,8 +7626,8 @@ static int nfs4_xattr_set_nfs4_user(const struct xatt= r_handler *handler, * do a cached access check for the XA* flags to possibly avoid * doing an RPC and getting EACCES back. */ - if (!nfs_access_get_cached(inode, current_cred(), &cache, true)) { - if (!(cache.mask & NFS_ACCESS_XAWRITE)) + if (!nfs_access_get_cached(inode, current_cred(), &mask, true)) { + if (!(mask & NFS_ACCESS_XAWRITE)) return -EACCES; } =20 @@ -7648,14 +7648,14 @@ static int nfs4_xattr_get_nfs4_user(const struct xa= ttr_handler *handler, struct dentry *unused, struct inode *inode, const char *key, void *buf, size_t buflen) { - struct nfs_access_entry cache; + u32 mask; ssize_t ret; =20 if (!nfs_server_capable(inode, NFS_CAP_XATTR)) return -EOPNOTSUPP; =20 - if (!nfs_access_get_cached(inode, current_cred(), &cache, true)) { - if (!(cache.mask & NFS_ACCESS_XAREAD)) + if (!nfs_access_get_cached(inode, current_cred(), &mask, true)) { + if (!(mask & NFS_ACCESS_XAREAD)) return -EACCES; } =20 @@ -7680,13 +7680,13 @@ nfs4_listxattr_nfs4_user(struct inode *inode, char = *list, size_t list_len) ssize_t ret, size; char *buf; size_t buflen; - struct nfs_access_entry cache; + u32 mask; =20 if (!nfs_server_capable(inode, NFS_CAP_XATTR)) return 0; =20 - if (!nfs_access_get_cached(inode, current_cred(), &cache, true)) { - if (!(cache.mask & NFS_ACCESS_XALIST)) + if (!nfs_access_get_cached(inode, current_cred(), &mask, true)) { + if (!(mask & NFS_ACCESS_XALIST)) return 0; } =20 diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index 05f249f20f55d..f33559acbcc28 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -533,8 +533,8 @@ extern int nfs_instantiate(struct dentry *dentry, struc= t nfs_fh *fh, struct nfs_fattr *fattr); extern int nfs_may_open(struct inode *inode, const struct cred *cred, int = openflags); extern void nfs_access_zap_cache(struct inode *inode); -extern int nfs_access_get_cached(struct inode *inode, const struct cred *c= red, struct nfs_access_entry *res, - bool may_block); +extern int nfs_access_get_cached(struct inode *inode, const struct cred *c= red, + u32 *mask, bool may_block); =20 /* * linux/fs/nfs/symlink.c --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ACC39C433EF for ; Mon, 14 Feb 2022 10:19:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346573AbiBNKTY (ORCPT ); Mon, 14 Feb 2022 05:19:24 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347860AbiBNKQz (ORCPT ); Mon, 14 Feb 2022 05:16:55 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0347F7C780; Mon, 14 Feb 2022 01:54:22 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 02BFAB80D83; Mon, 14 Feb 2022 09:54:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE67DC340F0; Mon, 14 Feb 2022 09:54:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832457; bh=d+kEBIHewkuWC6lO+UBYJFu3t9iYpHMhNr5974kvkSo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FUH3ZDt03ksLWaekP7DrC0TZ8Y7paPOdqWIukq4jTb/4Jw/0nZe6d48HXxJK6x49+ UTs5PJkEXEPv963vq1w2APpllaEqyEhJ24FVlkHQKdmv4IaSwo1lCGeXI1iBwnTsx+ RUlD3sRtX+NwYIhze5CPhjW/oz5uq0DN1UNj9i2w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Olga Kornievskaia , Anna Schumaker , Sasha Levin Subject: [PATCH 5.16 021/203] NFSv4 only print the label when its queried Date: Mon, 14 Feb 2022 10:24:25 +0100 Message-Id: <20220214092510.934456217@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Kornievskaia [ Upstream commit 2c52c8376db7160a1dd8a681c61c9258405ef143 ] When the bitmask of the attributes doesn't include the security label, don't bother printing it. Since the label might not be null terminated, adjust the printing format accordingly. Signed-off-by: Olga Kornievskaia Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- fs/nfs/nfs4xdr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 69862bf6db001..801119b7a5964 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c @@ -4200,10 +4200,11 @@ static int decode_attr_security_label(struct xdr_st= ream *xdr, uint32_t *bitmap, } else printk(KERN_WARNING "%s: label too long (%u)!\n", __func__, len); + if (label && label->label) + dprintk("%s: label=3D%.*s, len=3D%d, PI=3D%d, LFS=3D%d\n", + __func__, label->len, (char *)label->label, + label->len, label->pi, label->lfs); } - if (label && label->label) - dprintk("%s: label=3D%s, len=3D%d, PI=3D%d, LFS=3D%d\n", __func__, - (char *)label->label, label->len, label->pi, label->lfs); return status; } =20 --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF6F0C433F5 for ; Mon, 14 Feb 2022 10:19:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346242AbiBNKT3 (ORCPT ); Mon, 14 Feb 2022 05:19:29 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347884AbiBNKQ5 (ORCPT ); Mon, 14 Feb 2022 05:16:57 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF50C7C785; Mon, 14 Feb 2022 01:54:22 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BCE9F612FF; Mon, 14 Feb 2022 09:54:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 140F1C340E9; Mon, 14 Feb 2022 09:54:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832461; bh=S6jq1AUIQOTMbtbZ3xBIuNqN0kpzsRgOxa7dhQpOpws=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YsBtBjgQ2nc1ZZk4IKfYwGp+x8GYdntKlD9IkW7KSWroX1qR3lbVn0JEy7UYTWHIc tiobhPg6bR07zXUV1BAmQGSNLamJvEKar8sv6k0AQRwDqnOiW39xlQb9nn/2iIroqv QJaDT51Z0jK6VZbym3rqJQrFvyR5HxUlGG5is+zM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiaoke Wang , Anna Schumaker , Sasha Levin Subject: [PATCH 5.16 022/203] nfs: nfs4clinet: check the return value of kstrdup() Date: Mon, 14 Feb 2022 10:24:26 +0100 Message-Id: <20220214092510.967470574@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xiaoke Wang [ Upstream commit fbd2057e5329d3502a27491190237b6be52a1cb6 ] kstrdup() returns NULL when some internal memory errors happen, it is better to check the return value of it so to catch the memory error in time. Signed-off-by: Xiaoke Wang Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- fs/nfs/nfs4client.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c index d8b5a250ca050..47a6cf892c95a 100644 --- a/fs/nfs/nfs4client.c +++ b/fs/nfs/nfs4client.c @@ -1343,8 +1343,11 @@ int nfs4_update_server(struct nfs_server *server, co= nst char *hostname, } nfs_put_client(clp); =20 - if (server->nfs_client->cl_hostname =3D=3D NULL) + if (server->nfs_client->cl_hostname =3D=3D NULL) { server->nfs_client->cl_hostname =3D kstrdup(hostname, GFP_KERNEL); + if (server->nfs_client->cl_hostname =3D=3D NULL) + return -ENOMEM; + } nfs_server_insert_lists(server); =20 return nfs_probe_server(server, NFS_FH(d_inode(server->super->s_root))); --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FF04C4167D for ; Mon, 14 Feb 2022 10:21:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347364AbiBNKVP (ORCPT ); Mon, 14 Feb 2022 05:21:15 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347983AbiBNKRC (ORCPT ); Mon, 14 Feb 2022 05:17:02 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 266ED8CDA2; Mon, 14 Feb 2022 01:54:28 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9FD4DB80DC6; Mon, 14 Feb 2022 09:54:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3D33C340E9; Mon, 14 Feb 2022 09:54:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832464; bh=A7U1HkB2a885FrWTHJAWjetyqmCy4MwdfkCVXx5gPTU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1PDtgjQQdQsqpEDRk2U5d2om3JaTv1Cn40Rbc/EZOaeMjfeF3Pm23iR3OKYQFA8xD 0WdGX4mQV4LeGm4i4HNV2lGtnL7Ay97wN28GsDNGvmkVz32/tdx5qDFWdWha4yfWKh BVwHWlitsbmhPRVvagiSae7j34m8FKNM7fs7epBw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, rtm@csail.mit.edu, Trond Myklebust , Anna Schumaker , Sasha Levin Subject: [PATCH 5.16 023/203] NFSv4.1: Fix uninitialised variable in devicenotify Date: Mon, 14 Feb 2022 10:24:27 +0100 Message-Id: <20220214092510.999203299@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit b05bf5c63b326ce1da84ef42498d8e0e292e694c ] When decode_devicenotify_args() exits with no entries, we need to ensure that the struct cb_devicenotifyargs is initialised to { 0, NULL } in order to avoid problems in nfs4_callback_devicenotify(). Reported-by: Signed-off-by: Trond Myklebust Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- fs/nfs/callback.h | 2 +- fs/nfs/callback_proc.c | 2 +- fs/nfs/callback_xdr.c | 18 +++++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/fs/nfs/callback.h b/fs/nfs/callback.h index 6a2033131c068..ccd4f245cae24 100644 --- a/fs/nfs/callback.h +++ b/fs/nfs/callback.h @@ -170,7 +170,7 @@ struct cb_devicenotifyitem { }; =20 struct cb_devicenotifyargs { - int ndevs; + uint32_t ndevs; struct cb_devicenotifyitem *devs; }; =20 diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c index 09c5b1cb3e075..c343666d9a428 100644 --- a/fs/nfs/callback_proc.c +++ b/fs/nfs/callback_proc.c @@ -358,7 +358,7 @@ __be32 nfs4_callback_devicenotify(void *argp, void *res= p, struct cb_process_state *cps) { struct cb_devicenotifyargs *args =3D argp; - int i; + uint32_t i; __be32 res =3D 0; struct nfs_client *clp =3D cps->clp; struct nfs_server *server =3D NULL; diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c index a67c41ec545fd..f90de8043b0f9 100644 --- a/fs/nfs/callback_xdr.c +++ b/fs/nfs/callback_xdr.c @@ -258,11 +258,9 @@ __be32 decode_devicenotify_args(struct svc_rqst *rqstp, void *argp) { struct cb_devicenotifyargs *args =3D argp; + uint32_t tmp, n, i; __be32 *p; __be32 status =3D 0; - u32 tmp; - int n, i; - args->ndevs =3D 0; =20 /* Num of device notifications */ p =3D xdr_inline_decode(xdr, sizeof(uint32_t)); @@ -271,7 +269,7 @@ __be32 decode_devicenotify_args(struct svc_rqst *rqstp, goto out; } n =3D ntohl(*p++); - if (n <=3D 0) + if (n =3D=3D 0) goto out; if (n > ULONG_MAX / sizeof(*args->devs)) { status =3D htonl(NFS4ERR_BADXDR); @@ -330,19 +328,21 @@ __be32 decode_devicenotify_args(struct svc_rqst *rqst= p, dev->cbd_immediate =3D 0; } =20 - args->ndevs++; - dprintk("%s: type %d layout 0x%x immediate %d\n", __func__, dev->cbd_notify_type, dev->cbd_layout_type, dev->cbd_immediate); } + args->ndevs =3D n; + dprintk("%s: ndevs %d\n", __func__, args->ndevs); + return 0; +err: + kfree(args->devs); out: + args->devs =3D NULL; + args->ndevs =3D 0; dprintk("%s: status %d ndevs %d\n", __func__, ntohl(status), args->ndevs); return status; -err: - kfree(args->devs); - goto out; } =20 static __be32 decode_sessionid(struct xdr_stream *xdr, --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84012C433EF for ; Mon, 14 Feb 2022 10:19:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346644AbiBNKTu (ORCPT ); Mon, 14 Feb 2022 05:19:50 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348114AbiBNKRI (ORCPT ); Mon, 14 Feb 2022 05:17:08 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAC038E18A; Mon, 14 Feb 2022 01:54:32 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4F99661236; Mon, 14 Feb 2022 09:54:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35E54C340E9; Mon, 14 Feb 2022 09:54:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832470; bh=TTBJeXbq5yAFOFz/yrsHu+gLD33xprQvk2fi8ibSHGQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I2WNbL1TYO2g6Qk/qExeF3GAfUSZL1IkluO56mTaMPduy3mhXanmvHwVnc3Awj7zG T69ypL43YGVRsVFQk8zwtjT6fBRn+6r3Nf8InxlA6aZ1P8Ly7FMp/nsxsFBOlKn27R ThPMkvkvDOJMew0UrVRPQNV7A8YMDLKDUMrzy9MM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Olga Kornievskaia , Anna Schumaker , Sasha Levin Subject: [PATCH 5.16 024/203] NFSv4 remove zero number of fs_locations entries error check Date: Mon, 14 Feb 2022 10:24:28 +0100 Message-Id: <20220214092511.032576775@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Kornievskaia [ Upstream commit 90e12a3191040bd3854d3e236c35921e4e92a044 ] Remove the check for the zero length fs_locations reply in the xdr decoding, and instead check for that in the migration code. Signed-off-by: Olga Kornievskaia Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- fs/nfs/nfs4state.c | 3 +++ fs/nfs/nfs4xdr.c | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index f63dfa01001c9..f3265575c28d2 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c @@ -2106,6 +2106,9 @@ static int nfs4_try_migration(struct nfs_server *serv= er, const struct cred *cred } =20 result =3D -NFS4ERR_NXIO; + if (!locations->nlocations) + goto out; + if (!(locations->fattr.valid & NFS_ATTR_FATTR_V4_LOCATIONS)) { dprintk("<-- %s: No fs_locations data, migration skipped\n", __func__); diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 801119b7a5964..71a00e48bd2dd 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c @@ -3696,8 +3696,6 @@ static int decode_attr_fs_locations(struct xdr_stream= *xdr, uint32_t *bitmap, st if (unlikely(!p)) goto out_eio; n =3D be32_to_cpup(p); - if (n <=3D 0) - goto out_eio; for (res->nlocations =3D 0; res->nlocations < n; res->nlocations++) { u32 m; struct nfs4_fs_location *loc; --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57C46C433F5 for ; Mon, 14 Feb 2022 10:19:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346645AbiBNKTy (ORCPT ); Mon, 14 Feb 2022 05:19:54 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348185AbiBNKRL (ORCPT ); Mon, 14 Feb 2022 05:17:11 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9714A8E19C; Mon, 14 Feb 2022 01:54:37 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 680686137C; Mon, 14 Feb 2022 09:54:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46C37C340E9; Mon, 14 Feb 2022 09:54:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832473; bh=YM/MiN94tclE5DakqWiee+fJMcKbPpmVpnWIdmn1l24=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iwCbOm8qPN7HFBpBM9HptoX3oL2N4LtubpNqCRvdbkgMMw9MnvxBAWHObeN6mVc9n Wv0PvrrLkm+ZsUtlmABJ04PdblsJ4Tz3zNX55XuXmxBMFJkNoBEQ0R2p+SXNJ+9LL4 nlKFz8M/A7yYsljGLuim8m3aTFTGxHIS1OnsHPvs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Olga Kornievskaia , Anna Schumaker , Sasha Levin Subject: [PATCH 5.16 025/203] NFSv4 store server support for fs_location attribute Date: Mon, 14 Feb 2022 10:24:29 +0100 Message-Id: <20220214092511.064640598@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Kornievskaia [ Upstream commit 8a59bb93b7e3cca389af44781a429ac12ac49be6 ] Define and store if server returns it supports fs_locations attribute as a capability. Signed-off-by: Olga Kornievskaia Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- fs/nfs/nfs4proc.c | 2 ++ include/linux/nfs_fs_sb.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 322ff45ad15ca..f924d3029d13b 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -3874,6 +3874,8 @@ static int _nfs4_server_capabilities(struct nfs_serve= r *server, struct nfs_fh *f if (res.attr_bitmask[2] & FATTR4_WORD2_SECURITY_LABEL) server->caps |=3D NFS_CAP_SECURITY_LABEL; #endif + if (res.attr_bitmask[0] & FATTR4_WORD0_FS_LOCATIONS) + server->caps |=3D NFS_CAP_FS_LOCATIONS; if (!(res.attr_bitmask[0] & FATTR4_WORD0_FILEID)) server->fattr_valid &=3D ~NFS_ATTR_FATTR_FILEID; if (!(res.attr_bitmask[1] & FATTR4_WORD1_MODE)) diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index 2a9acbfe00f0f..9a6e70ccde56e 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h @@ -287,5 +287,5 @@ struct nfs_server { #define NFS_CAP_COPY_NOTIFY (1U << 27) #define NFS_CAP_XATTR (1U << 28) #define NFS_CAP_READ_PLUS (1U << 29) - +#define NFS_CAP_FS_LOCATIONS (1U << 30) #endif --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 649F7C433EF for ; Mon, 14 Feb 2022 10:19:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346660AbiBNKT6 (ORCPT ); Mon, 14 Feb 2022 05:19:58 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348194AbiBNKRM (ORCPT ); Mon, 14 Feb 2022 05:17:12 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 698DE8E19A; Mon, 14 Feb 2022 01:54:37 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4B0166137B; Mon, 14 Feb 2022 09:54:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BD4BC36AF4; Mon, 14 Feb 2022 09:54:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832476; bh=5dbB2LNFJMIk7RAbmegCDhTW7Pzz6+gklbBKd6oRf90=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xvuhxS6+1bzavIlcmMaF6A8Ceou0lXfb2jSyvDzMbnrNckehLIw+Bs0MV5fPbTaOz G59iKu4QXVZryucu6liEHLEQ10URm1rh9NtNFvoLaCJH1Qa3Bl1k7x+qcvD3ErGwef k/M/458csn4v+z6ZGQiwiZN+TM+vyU9TqZN6yHQ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Olga Kornievskaia , Anna Schumaker , Sasha Levin Subject: [PATCH 5.16 026/203] NFSv4.1 query for fs_location attr on a new file system Date: Mon, 14 Feb 2022 10:24:30 +0100 Message-Id: <20220214092511.097572416@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Kornievskaia [ Upstream commit 1976b2b31462151403c9fc110204fcc2a77bdfd1 ] Query the server for other possible trunkable locations for a given file system on a 4.1+ mount. v2: -- added missing static to nfs4_discover_trunking, reported by the kernel test robot Signed-off-by: Olga Kornievskaia Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- fs/nfs/client.c | 7 ++++ fs/nfs/nfs4_fs.h | 9 ++--- fs/nfs/nfs4proc.c | 76 +++++++++++++++++++++++++++++++++++------ fs/nfs/nfs4state.c | 3 +- include/linux/nfs_xdr.h | 1 + 5 files changed, 81 insertions(+), 15 deletions(-) diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 2d2f2c091c65a..a1e87419f3a42 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -860,6 +860,13 @@ static int nfs_probe_fsinfo(struct nfs_server *server,= struct nfs_fh *mntfh, str server->namelen =3D pathinfo.max_namelen; } =20 + if (clp->rpc_ops->discover_trunking !=3D NULL && + (server->caps & NFS_CAP_FS_LOCATIONS)) { + error =3D clp->rpc_ops->discover_trunking(server, mntfh); + if (error < 0) + return error; + } + return 0; } =20 diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index ed5eaca6801ee..2402a3d8ba997 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h @@ -260,8 +260,8 @@ struct nfs4_state_maintenance_ops { }; =20 struct nfs4_mig_recovery_ops { - int (*get_locations)(struct inode *, struct nfs4_fs_locations *, - struct page *, const struct cred *); + int (*get_locations)(struct nfs_server *, struct nfs_fh *, + struct nfs4_fs_locations *, struct page *, const struct cred *); int (*fsid_present)(struct inode *, const struct cred *); }; =20 @@ -302,8 +302,9 @@ extern int nfs4_do_close(struct nfs4_state *state, gfp_= t gfp_mask, int wait); extern int nfs4_server_capabilities(struct nfs_server *server, struct nfs_= fh *fhandle); extern int nfs4_proc_fs_locations(struct rpc_clnt *, struct inode *, const= struct qstr *, struct nfs4_fs_locations *, struct page *); -extern int nfs4_proc_get_locations(struct inode *, struct nfs4_fs_location= s *, - struct page *page, const struct cred *); +extern int nfs4_proc_get_locations(struct nfs_server *, struct nfs_fh *, + struct nfs4_fs_locations *, + struct page *page, const struct cred *); extern int nfs4_proc_fsid_present(struct inode *, const struct cred *); extern struct rpc_clnt *nfs4_proc_lookup_mountpoint(struct inode *, struct dentry *, diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index f924d3029d13b..9a94e758212c8 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -3934,6 +3934,60 @@ int nfs4_server_capabilities(struct nfs_server *serv= er, struct nfs_fh *fhandle) return err; } =20 +static int _nfs4_discover_trunking(struct nfs_server *server, + struct nfs_fh *fhandle) +{ + struct nfs4_fs_locations *locations =3D NULL; + struct page *page; + const struct cred *cred; + struct nfs_client *clp =3D server->nfs_client; + const struct nfs4_state_maintenance_ops *ops =3D + clp->cl_mvops->state_renewal_ops; + int status =3D -ENOMEM; + + cred =3D ops->get_state_renewal_cred(clp); + if (cred =3D=3D NULL) { + cred =3D nfs4_get_clid_cred(clp); + if (cred =3D=3D NULL) + return -ENOKEY; + } + + page =3D alloc_page(GFP_KERNEL); + locations =3D kmalloc(sizeof(struct nfs4_fs_locations), GFP_KERNEL); + if (page =3D=3D NULL || locations =3D=3D NULL) + goto out; + + status =3D nfs4_proc_get_locations(server, fhandle, locations, page, + cred); + if (status) + goto out; +out: + if (page) + __free_page(page); + kfree(locations); + return status; +} + +static int nfs4_discover_trunking(struct nfs_server *server, + struct nfs_fh *fhandle) +{ + struct nfs4_exception exception =3D { + .interruptible =3D true, + }; + struct nfs_client *clp =3D server->nfs_client; + int err =3D 0; + + if (!nfs4_has_session(clp)) + goto out; + do { + err =3D nfs4_handle_exception(server, + _nfs4_discover_trunking(server, fhandle), + &exception); + } while (exception.retry); +out: + return err; +} + static int _nfs4_lookup_root(struct nfs_server *server, struct nfs_fh *fha= ndle, struct nfs_fsinfo *info) { @@ -7820,18 +7874,18 @@ int nfs4_proc_fs_locations(struct rpc_clnt *client,= struct inode *dir, * appended to this compound to identify the client ID which is * performing recovery. */ -static int _nfs40_proc_get_locations(struct inode *inode, +static int _nfs40_proc_get_locations(struct nfs_server *server, + struct nfs_fh *fhandle, struct nfs4_fs_locations *locations, struct page *page, const struct cred *cred) { - struct nfs_server *server =3D NFS_SERVER(inode); struct rpc_clnt *clnt =3D server->client; u32 bitmask[2] =3D { [0] =3D FATTR4_WORD0_FSID | FATTR4_WORD0_FS_LOCATIONS, }; struct nfs4_fs_locations_arg args =3D { .clientid =3D server->nfs_client->cl_clientid, - .fh =3D NFS_FH(inode), + .fh =3D fhandle, .page =3D page, .bitmask =3D bitmask, .migration =3D 1, /* skip LOOKUP */ @@ -7877,17 +7931,17 @@ static int _nfs40_proc_get_locations(struct inode *= inode, * When the client supports GETATTR(fs_locations_info), it can * be plumbed in here. */ -static int _nfs41_proc_get_locations(struct inode *inode, +static int _nfs41_proc_get_locations(struct nfs_server *server, + struct nfs_fh *fhandle, struct nfs4_fs_locations *locations, struct page *page, const struct cred *cred) { - struct nfs_server *server =3D NFS_SERVER(inode); struct rpc_clnt *clnt =3D server->client; u32 bitmask[2] =3D { [0] =3D FATTR4_WORD0_FSID | FATTR4_WORD0_FS_LOCATIONS, }; struct nfs4_fs_locations_arg args =3D { - .fh =3D NFS_FH(inode), + .fh =3D fhandle, .page =3D page, .bitmask =3D bitmask, .migration =3D 1, /* skip LOOKUP */ @@ -7936,11 +7990,11 @@ static int _nfs41_proc_get_locations(struct inode *= inode, * -NFS4ERR_LEASE_MOVED is returned if the server still has leases * from this client that require migration recovery. */ -int nfs4_proc_get_locations(struct inode *inode, +int nfs4_proc_get_locations(struct nfs_server *server, + struct nfs_fh *fhandle, struct nfs4_fs_locations *locations, struct page *page, const struct cred *cred) { - struct nfs_server *server =3D NFS_SERVER(inode); struct nfs_client *clp =3D server->nfs_client; const struct nfs4_mig_recovery_ops *ops =3D clp->cl_mvops->mig_recovery_ops; @@ -7953,10 +8007,11 @@ int nfs4_proc_get_locations(struct inode *inode, (unsigned long long)server->fsid.major, (unsigned long long)server->fsid.minor, clp->cl_hostname); - nfs_display_fhandle(NFS_FH(inode), __func__); + nfs_display_fhandle(fhandle, __func__); =20 do { - status =3D ops->get_locations(inode, locations, page, cred); + status =3D ops->get_locations(server, fhandle, locations, page, + cred); if (status !=3D -NFS4ERR_DELAY) break; nfs4_handle_exception(server, status, &exception); @@ -10425,6 +10480,7 @@ const struct nfs_rpc_ops nfs_v4_clientops =3D { .free_client =3D nfs4_free_client, .create_server =3D nfs4_create_server, .clone_server =3D nfs_clone_server, + .discover_trunking =3D nfs4_discover_trunking, }; =20 static const struct xattr_handler nfs4_xattr_nfs4_acl_handler =3D { diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index f3265575c28d2..499bef9fe1186 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c @@ -2098,7 +2098,8 @@ static int nfs4_try_migration(struct nfs_server *serv= er, const struct cred *cred } =20 inode =3D d_inode(server->super->s_root); - result =3D nfs4_proc_get_locations(inode, locations, page, cred); + result =3D nfs4_proc_get_locations(server, NFS_FH(inode), locations, + page, cred); if (result) { dprintk("<-- %s: failed to retrieve fs_locations: %d\n", __func__, result); diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h index 967a0098f0a97..695fa84611b66 100644 --- a/include/linux/nfs_xdr.h +++ b/include/linux/nfs_xdr.h @@ -1795,6 +1795,7 @@ struct nfs_rpc_ops { struct nfs_server *(*create_server)(struct fs_context *); struct nfs_server *(*clone_server)(struct nfs_server *, struct nfs_fh *, struct nfs_fattr *, rpc_authflavor_t); + int (*discover_trunking)(struct nfs_server *, struct nfs_fh *); }; =20 /* --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E04EBC433FE for ; Mon, 14 Feb 2022 10:21:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346324AbiBNKV2 (ORCPT ); Mon, 14 Feb 2022 05:21:28 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:45096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348248AbiBNKRP (ORCPT ); Mon, 14 Feb 2022 05:17:15 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8618A8E1B2; Mon, 14 Feb 2022 01:54:41 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 24CC1B80DC4; Mon, 14 Feb 2022 09:54:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 198A8C340E9; Mon, 14 Feb 2022 09:54:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832479; bh=01qhbpbzi9zTKTLBiqQl76Ns3a+R6Qym8QX6U2G65A0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WkLkz4znV3lbuo7IZGfqVJPf297WORPAjdCs5aTdlJog9jaL6Y7ee99aMFskrFzYo +hv2kaPphk5xtIirut08xwIliWoEgnf+/sTXWGPtij2Ys/E1xJqTJURxXmUvmOjsyM 5/r2QUTy6BOlrfMUY+mXqh1gOYfR+ArS8qgPhUU4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Olga Kornievskaia , Anna Schumaker , Sasha Levin Subject: [PATCH 5.16 027/203] NFSv4 expose nfs_parse_server_name function Date: Mon, 14 Feb 2022 10:24:31 +0100 Message-Id: <20220214092511.130555114@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Kornievskaia [ Upstream commit f5b27cc6761e27ee6387a24df1a99ca77b360fea ] Make nfs_parse_server_name available outside of nfs4namespace.c. Signed-off-by: Olga Kornievskaia Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- fs/nfs/nfs4_fs.h | 3 ++- fs/nfs/nfs4namespace.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index 2402a3d8ba997..734ac09becf73 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h @@ -280,7 +280,8 @@ struct rpc_clnt *nfs4_negotiate_security(struct rpc_cln= t *, struct inode *, int nfs4_submount(struct fs_context *, struct nfs_server *); int nfs4_replace_transport(struct nfs_server *server, const struct nfs4_fs_locations *locations); - +size_t nfs_parse_server_name(char *string, size_t len, struct sockaddr *sa, + size_t salen, struct net *net); /* nfs4proc.c */ extern int nfs4_handle_exception(struct nfs_server *, int, struct nfs4_exc= eption *); extern int nfs4_async_handle_error(struct rpc_task *task, diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c index 873342308dc0d..f1ed4f60a7f33 100644 --- a/fs/nfs/nfs4namespace.c +++ b/fs/nfs/nfs4namespace.c @@ -164,8 +164,8 @@ static int nfs4_validate_fspath(struct dentry *dentry, return 0; } =20 -static size_t nfs_parse_server_name(char *string, size_t len, - struct sockaddr *sa, size_t salen, struct net *net) +size_t nfs_parse_server_name(char *string, size_t len, struct sockaddr *sa, + size_t salen, struct net *net) { ssize_t ret; =20 --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3DCFC433F5 for ; Mon, 14 Feb 2022 10:21:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346777AbiBNKVw (ORCPT ); Mon, 14 Feb 2022 05:21:52 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:47948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236012AbiBNKTr (ORCPT ); Mon, 14 Feb 2022 05:19:47 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0C579024E; Mon, 14 Feb 2022 01:55:04 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 238D5B80D6D; Mon, 14 Feb 2022 09:54:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3144CC340EF; Mon, 14 Feb 2022 09:54:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832482; bh=HXnNm6mwzS+bCFc9d1VT6vJ6HYKUrgR+hVfGKlNwGIM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HAgvi1GGx/Ib0YZsI1l2QxQt1UHRa93tku8ckzprzzcXWG4+qm6Ucpjt1mE/eQlq0 cvCJQ0HiceHiXmJJL6x+DWD9FpecnTBSfa2tusY6S9xNVFdDVfMh0jnIKGCq1PB7+E 3MGDWoBmHo2L93gufaAONqbfoEDrJRYgUisRJtsY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Olga Kornievskaia , Anna Schumaker , Sasha Levin Subject: [PATCH 5.16 028/203] NFSv4 handle port presence in fs_location server string Date: Mon, 14 Feb 2022 10:24:32 +0100 Message-Id: <20220214092511.167872599@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Kornievskaia [ Upstream commit a8d54baba7c65db2d3278873def61f8d3753d766 ] An fs_location attribute returns a string that can be ipv4, ipv6, or DNS name. An ip location can have a port appended to it and if no port is present a default port needs to be set. If rpc_pton() fails to parse, try calling rpc_uaddr2socaddr() that can convert an universal address. Signed-off-by: Olga Kornievskaia Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- fs/nfs/nfs4_fs.h | 2 +- fs/nfs/nfs4namespace.c | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index 734ac09becf73..85c5d08dfa9cc 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h @@ -281,7 +281,7 @@ int nfs4_submount(struct fs_context *, struct nfs_serve= r *); int nfs4_replace_transport(struct nfs_server *server, const struct nfs4_fs_locations *locations); size_t nfs_parse_server_name(char *string, size_t len, struct sockaddr *sa, - size_t salen, struct net *net); + size_t salen, struct net *net, int port); /* nfs4proc.c */ extern int nfs4_handle_exception(struct nfs_server *, int, struct nfs4_exc= eption *); extern int nfs4_async_handle_error(struct rpc_task *task, diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c index f1ed4f60a7f33..3680c8da510c9 100644 --- a/fs/nfs/nfs4namespace.c +++ b/fs/nfs/nfs4namespace.c @@ -165,15 +165,20 @@ static int nfs4_validate_fspath(struct dentry *dentry, } =20 size_t nfs_parse_server_name(char *string, size_t len, struct sockaddr *sa, - size_t salen, struct net *net) + size_t salen, struct net *net, int port) { ssize_t ret; =20 ret =3D rpc_pton(net, string, len, sa, salen); if (ret =3D=3D 0) { - ret =3D nfs_dns_resolve_name(net, string, len, sa, salen); - if (ret < 0) - ret =3D 0; + ret =3D rpc_uaddr2sockaddr(net, string, len, sa, salen); + if (ret =3D=3D 0) { + ret =3D nfs_dns_resolve_name(net, string, len, sa, salen); + if (ret < 0) + ret =3D 0; + } + } else if (port) { + rpc_set_port(sa, port); } return ret; } @@ -328,7 +333,7 @@ static int try_location(struct fs_context *fc, nfs_parse_server_name(buf->data, buf->len, &ctx->nfs_server.address, sizeof(ctx->nfs_server._address), - fc->net_ns); + fc->net_ns, 0); if (ctx->nfs_server.addrlen =3D=3D 0) continue; =20 @@ -496,7 +501,7 @@ static int nfs4_try_replacing_one_location(struct nfs_s= erver *server, continue; =20 salen =3D nfs_parse_server_name(buf->data, buf->len, - sap, addr_bufsize, net); + sap, addr_bufsize, net, 0); if (salen =3D=3D 0) continue; rpc_set_port(sap, NFS_PORT); --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AB326C433EF for ; Mon, 14 Feb 2022 10:21:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346567AbiBNKVf (ORCPT ); Mon, 14 Feb 2022 05:21:35 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346218AbiBNKRs (ORCPT ); Mon, 14 Feb 2022 05:17:48 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F259A7CDF3; Mon, 14 Feb 2022 01:54:48 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8C21AB80DD4; Mon, 14 Feb 2022 09:54:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30EF1C340E9; Mon, 14 Feb 2022 09:54:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832486; bh=Zgwca39LIUpGLZ62CO/FtDwq+uINYpeQGJ1NAqdiEEI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W1ZqDFsipAa+jjTmpCKSKILXzVDH2FxRXmTSx9DNyqtLc+XyjKF80ApoX7xOLWkcb NVzdpBKYj2kziVdsRikEJSgYFbFFUPShDxiSNRbHkQ5M+YUWxuEfoAwJ6PMve3A9kE 0s34DRnMttCLi6C1zKMubhdOEvQ09ZInoxOX3yHU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Olga Kornievskaia , Anna Schumaker , Sasha Levin Subject: [PATCH 5.16 029/203] SUNRPC allow for unspecified transport time in rpc_clnt_add_xprt Date: Mon, 14 Feb 2022 10:24:33 +0100 Message-Id: <20220214092511.200096671@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Kornievskaia [ Upstream commit b8a09619a56334414cbd7f935a0796240d0cc07e ] If the supplied argument doesn't specify the transport type, use the type of the existing rpc clnt and its existing transport. Signed-off-by: Olga Kornievskaia Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- net/sunrpc/clnt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index a312ea2bc4405..c83fe618767c4 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -2900,7 +2900,7 @@ int rpc_clnt_add_xprt(struct rpc_clnt *clnt, unsigned long connect_timeout; unsigned long reconnect_timeout; unsigned char resvport, reuseport; - int ret =3D 0; + int ret =3D 0, ident; =20 rcu_read_lock(); xps =3D xprt_switch_get(rcu_dereference(clnt->cl_xpi.xpi_xpswitch)); @@ -2914,8 +2914,11 @@ int rpc_clnt_add_xprt(struct rpc_clnt *clnt, reuseport =3D xprt->reuseport; connect_timeout =3D xprt->connect_timeout; reconnect_timeout =3D xprt->max_reconnect_timeout; + ident =3D xprt->xprt_class->ident; rcu_read_unlock(); =20 + if (!xprtargs->ident) + xprtargs->ident =3D ident; xprt =3D xprt_create_transport(xprtargs); if (IS_ERR(xprt)) { ret =3D PTR_ERR(xprt); --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BD87C433EF for ; Mon, 14 Feb 2022 10:21:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236359AbiBNKWB (ORCPT ); Mon, 14 Feb 2022 05:22:01 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:51020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346188AbiBNKUI (ORCPT ); Mon, 14 Feb 2022 05:20:08 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C411C7C79E; Mon, 14 Feb 2022 01:55:08 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6F3F1B80DC6; Mon, 14 Feb 2022 09:54:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A11C8C340E9; Mon, 14 Feb 2022 09:54:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832489; bh=3lBPqZPBgZcKhOtMH3BcoKZunXu8BZh01IxJQ3TGeiI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qhagxIQ0A/dhZU8R9V4VhfIkp20dt8p98/FEMLdNdsm99syRbBrrZibEUlx55fiCl SPDus+6p/PRz4HBFzcAp4twmgPTqTU3HuNsukVRZY+xoJDLeKU5RWPJ98Pn9Pm0Y2m vrG5e3oO2soGgixqdiNq9Cp38UjdtpHJpeY97kSg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiyu Yang , Xin Xiong , Xin Tan , Anna Schumaker , Sasha Levin Subject: [PATCH 5.16 030/203] net/sunrpc: fix reference count leaks in rpc_sysfs_xprt_state_change Date: Mon, 14 Feb 2022 10:24:34 +0100 Message-Id: <20220214092511.233815805@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xiyu Yang [ Upstream commit 776d794f28c95051bc70405a7b1fa40115658a18 ] The refcount leak issues take place in an error handling path. When the 3rd argument buf doesn't match with "offline", "online" or "remove", the function simply returns -EINVAL and forgets to decrease the reference count of a rpc_xprt object and a rpc_xprt_switch object increased by rpc_sysfs_xprt_kobj_get_xprt() and rpc_sysfs_xprt_kobj_get_xprt_switch(), causing reference count leaks of both unused objects. Fix this issue by jumping to the error handling path labelled with out_put when buf matches none of "offline", "online" or "remove". Signed-off-by: Xiyu Yang Signed-off-by: Xin Xiong Signed-off-by: Xin Tan Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- net/sunrpc/sysfs.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/net/sunrpc/sysfs.c b/net/sunrpc/sysfs.c index 2766dd21935b8..77e7d011c1ab1 100644 --- a/net/sunrpc/sysfs.c +++ b/net/sunrpc/sysfs.c @@ -295,8 +295,10 @@ static ssize_t rpc_sysfs_xprt_state_change(struct kobj= ect *kobj, online =3D 1; else if (!strncmp(buf, "remove", 6)) remove =3D 1; - else - return -EINVAL; + else { + count =3D -EINVAL; + goto out_put; + } =20 if (wait_on_bit_lock(&xprt->state, XPRT_LOCKED, TASK_KILLABLE)) { count =3D -EINTR; --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 557AEC433FE for ; Mon, 14 Feb 2022 10:21:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346683AbiBNKVt (ORCPT ); Mon, 14 Feb 2022 05:21:49 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:50426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240417AbiBNKSa (ORCPT ); Mon, 14 Feb 2022 05:18:30 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 391FA8E1AC; Mon, 14 Feb 2022 01:54:54 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B3A39B80DC8; Mon, 14 Feb 2022 09:54:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9926C340E9; Mon, 14 Feb 2022 09:54:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832492; bh=IbpWskCq2JHkLWQanpF+VpG9Upo9c0eksO/WL2vpMrg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a5zglwcUHT2R8BLIXzwfp9PdnTCU+qyaxcdZTy7Kng/jKHKB9jyIrphTA/bMmXvES zYmV6p25k2HShKlTxlrWvKpSYZi3J2TU1nn4xE923ojvn2oP8OCsacRVRFweS9tXgd vaPY2oTHKsfzrTYvXPLWLMHM8g/9mGjCjhH3txhU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anna Schumaker , Sasha Levin Subject: [PATCH 5.16 031/203] sunrpc: Fix potential race conditions in rpc_sysfs_xprt_state_change() Date: Mon, 14 Feb 2022 10:24:35 +0100 Message-Id: <20220214092511.264983963@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Anna Schumaker [ Upstream commit 1a48db3fef499f615b56093947ec4b0d3d8e3021 ] We need to use test_and_set_bit() when changing xprt state flags to avoid potentially getting xps->xps_nactive out of sync. Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- net/sunrpc/sysfs.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/net/sunrpc/sysfs.c b/net/sunrpc/sysfs.c index 77e7d011c1ab1..8f309bcdf84fe 100644 --- a/net/sunrpc/sysfs.c +++ b/net/sunrpc/sysfs.c @@ -309,25 +309,28 @@ static ssize_t rpc_sysfs_xprt_state_change(struct kob= ject *kobj, goto release_tasks; } if (offline) { - set_bit(XPRT_OFFLINE, &xprt->state); - spin_lock(&xps->xps_lock); - xps->xps_nactive--; - spin_unlock(&xps->xps_lock); + if (!test_and_set_bit(XPRT_OFFLINE, &xprt->state)) { + spin_lock(&xps->xps_lock); + xps->xps_nactive--; + spin_unlock(&xps->xps_lock); + } } else if (online) { - clear_bit(XPRT_OFFLINE, &xprt->state); - spin_lock(&xps->xps_lock); - xps->xps_nactive++; - spin_unlock(&xps->xps_lock); + if (test_and_clear_bit(XPRT_OFFLINE, &xprt->state)) { + spin_lock(&xps->xps_lock); + xps->xps_nactive++; + spin_unlock(&xps->xps_lock); + } } else if (remove) { if (test_bit(XPRT_OFFLINE, &xprt->state)) { - set_bit(XPRT_REMOVE, &xprt->state); - xprt_force_disconnect(xprt); - if (test_bit(XPRT_CONNECTED, &xprt->state)) { - if (!xprt->sending.qlen && - !xprt->pending.qlen && - !xprt->backlog.qlen && - !atomic_long_read(&xprt->queuelen)) - rpc_xprt_switch_remove_xprt(xps, xprt); + if (!test_and_set_bit(XPRT_REMOVE, &xprt->state)) { + xprt_force_disconnect(xprt); + if (test_bit(XPRT_CONNECTED, &xprt->state)) { + if (!xprt->sending.qlen && + !xprt->pending.qlen && + !xprt->backlog.qlen && + !atomic_long_read(&xprt->queuelen)) + rpc_xprt_switch_remove_xprt(xps, xprt); + } } } else { count =3D -EINVAL; --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 86172C433EF for ; Mon, 14 Feb 2022 10:22:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346837AbiBNKWU (ORCPT ); Mon, 14 Feb 2022 05:22:20 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:47960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346785AbiBNKUm (ORCPT ); Mon, 14 Feb 2022 05:20:42 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 318D369CF5; Mon, 14 Feb 2022 01:55:17 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1E5666128D; Mon, 14 Feb 2022 09:54:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4C6EC340EF; Mon, 14 Feb 2022 09:54:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832495; bh=0SOO8xkYBZ52xNgcRbuIriuBZKJmD4xqKnRP+PGEuL4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YI0F6mAWO2h851rPabWz7X/Jt6FsOyWNdeejHPdOGbiWH+CJSryJV9lxb4tqGW17l 5r8eF9mfdFkWkrJmdbbDMAzmLwOjudbz4m9F8TkwXxCMancrAnlL3SJV3mlmPYM+T7 vSDMjI2lKNSw9hBNkzKS+cdOHGwyu2+mbJhfj6XM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sander Vanheule , Marc Zyngier , Sasha Levin Subject: [PATCH 5.16 032/203] irqchip/realtek-rtl: Service all pending interrupts Date: Mon, 14 Feb 2022 10:24:36 +0100 Message-Id: <20220214092511.297773901@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sander Vanheule [ Upstream commit 960dd884ddf5621ae6284cd3a42724500a97ae4c ] Instead of only servicing the lowest pending interrupt line, make sure all pending SoC interrupts are serviced before exiting the chained handler. This adds a small overhead if only one interrupt is pending, but should prevent rapid re-triggering of the handler. Signed-off-by: Sander Vanheule Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/5082ad3cb8b4eedf55075561b93eff6570299fe1.16= 41739718.git.sander@svanheule.net Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/irqchip/irq-realtek-rtl.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/irqchip/irq-realtek-rtl.c b/drivers/irqchip/irq-realte= k-rtl.c index 568614edd88f4..50a56820c99bc 100644 --- a/drivers/irqchip/irq-realtek-rtl.c +++ b/drivers/irqchip/irq-realtek-rtl.c @@ -76,16 +76,20 @@ static void realtek_irq_dispatch(struct irq_desc *desc) { struct irq_chip *chip =3D irq_desc_get_chip(desc); struct irq_domain *domain; - unsigned int pending; + unsigned long pending; + unsigned int soc_int; =20 chained_irq_enter(chip, desc); pending =3D readl(REG(RTL_ICTL_GIMR)) & readl(REG(RTL_ICTL_GISR)); + if (unlikely(!pending)) { spurious_interrupt(); goto out; } + domain =3D irq_desc_get_handler_data(desc); - generic_handle_domain_irq(domain, __ffs(pending)); + for_each_set_bit(soc_int, &pending, 32) + generic_handle_domain_irq(domain, soc_int); =20 out: chained_irq_exit(chip, desc); --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81E8DC433EF for ; Mon, 14 Feb 2022 10:22:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346797AbiBNKWK (ORCPT ); Mon, 14 Feb 2022 05:22:10 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346852AbiBNKUn (ORCPT ); Mon, 14 Feb 2022 05:20:43 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BCF991ACA; Mon, 14 Feb 2022 01:55:20 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1E67160F86; Mon, 14 Feb 2022 09:54:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC53AC340F0; Mon, 14 Feb 2022 09:54:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832498; bh=uTVbxloRA/oMSMkup+LNxAM+kjT2Mh6U5zYG9RnWECE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TciBFB0/E2XiqRN7hWbzTjOoYtZn6DH+54N3jk3kwAxwDnPCW4inb4jwoTulx/sog xFIxtxbdpXkvnL5fuNaEOYGceVSf0RqAOT7bebbT6ee14gWRZB3al0XhkiWnrisZDi WEr8ECjS/sjtA1VjsP+T5N8chon6fBFRpJoMcS2g= 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.16 033/203] perf/x86/rapl: fix AMD event handling Date: Mon, 14 Feb 2022 10:24:37 +0100 Message-Id: <20220214092511.330036544@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stephane Eranian [ Upstream commit 0036fb00a756a2f6e360d44e2e3d2200a8afbc9b ] The RAPL events exposed under /sys/devices/power/events should only reflect what the underlying hardware actually support. This is how it works on Intel RAPL and Intel core/uncore PMUs in general. But on AMD, this was not the case. All possible RAPL events were advertised. This is what it showed on an AMD Fam17h: $ ls /sys/devices/power/events/ energy-cores energy-gpu energy-pkg energy-psys energy-ram energy-cores.scale energy-gpu.scale energy-pkg.scale energy-psys.scale energy-ram.scale energy-cores.unit energy-gpu.unit energy-pkg.unit energy-psys.unit energy-ram.unit Yet, on AMD Fam17h, only energy-pkg is supported. This patch fixes the problem. Given the way perf_msr_probe() works, the amd_rapl_msrs[] table has to have all entries filled out and in particular the group field, otherwise perf_msr_probe() defaults to making the event visible. With the patch applied, the kernel now only shows was is actually supported: $ ls /sys/devices/power/events/ energy-pkg energy-pkg.scale energy-pkg.unit The patch also uses the RAPL_MSR_MASK because only the 32-bits LSB of the RAPL counters are relevant when reading power consumption. Signed-off-by: Stephane Eranian Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20220105185659.643355-1-eranian@google.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/x86/events/rapl.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/arch/x86/events/rapl.c b/arch/x86/events/rapl.c index 85feafacc445d..77e3a47af5ad5 100644 --- a/arch/x86/events/rapl.c +++ b/arch/x86/events/rapl.c @@ -536,11 +536,14 @@ static struct perf_msr intel_rapl_spr_msrs[] =3D { * - perf_msr_probe(PERF_RAPL_MAX) * - want to use same event codes across both architectures */ -static struct perf_msr amd_rapl_msrs[PERF_RAPL_MAX] =3D { - [PERF_RAPL_PKG] =3D { MSR_AMD_PKG_ENERGY_STATUS, &rapl_events_pkg_group= , test_msr }, +static struct perf_msr amd_rapl_msrs[] =3D { + [PERF_RAPL_PP0] =3D { 0, &rapl_events_cores_group, 0, false, 0 }, + [PERF_RAPL_PKG] =3D { MSR_AMD_PKG_ENERGY_STATUS, &rapl_events_pkg_group= , test_msr, false, RAPL_MSR_MASK }, + [PERF_RAPL_RAM] =3D { 0, &rapl_events_ram_group, 0, false, 0 }, + [PERF_RAPL_PP1] =3D { 0, &rapl_events_gpu_group, 0, false, 0 }, + [PERF_RAPL_PSYS] =3D { 0, &rapl_events_psys_group, 0, false, 0 }, }; =20 - static int rapl_cpu_offline(unsigned int cpu) { struct rapl_pmu *pmu =3D cpu_to_rapl_pmu(cpu); --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 770B2C433EF for ; Mon, 14 Feb 2022 10:23:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346993AbiBNKXR (ORCPT ); Mon, 14 Feb 2022 05:23:17 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:50562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346674AbiBNKUA (ORCPT ); Mon, 14 Feb 2022 05:20:00 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD45490260; Mon, 14 Feb 2022 01:55:06 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 31BC4B80DBF; Mon, 14 Feb 2022 09:55:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B5F3C340E9; Mon, 14 Feb 2022 09:55:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832504; bh=PKFm0sE3iMB94aMb4kUoSynBy19rolL5hhSmfs8lpww=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NDjqzjivdrZt/JYoklXM7mllmvVDUjbNsI4g3uJp+rTV9mtKfsY6NQo7A7VnH9kUn OBI9ChLr/dziXmCFNZwcEEJva/0JztBkvMFUyBl6MvQLYcutRoIsw+pH+ql5nSwMpI ZIJaTi/kD2eX66ZHhjWI1Lh+NM3wPUBP1FKRqgXE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andi Kleen , "Peter Zijlstra (Intel)" , Sasha Levin Subject: [PATCH 5.16 034/203] x86/perf: Avoid warning for Arch LBR without XSAVE Date: Mon, 14 Feb 2022 10:24:38 +0100 Message-Id: <20220214092511.361960856@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andi Kleen [ Upstream commit 8c16dc047b5dd8f7b3bf4584fa75733ea0dde7dc ] Some hypervisors support Arch LBR, but without the LBR XSAVE support. The current Arch LBR init code prints a warning when the xsave size (0) is unexpected. Avoid printing the warning for the "no LBR XSAVE" case. Signed-off-by: Andi Kleen Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20211215204029.150686-1-ak@linux.intel.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/x86/events/intel/lbr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/events/intel/lbr.c b/arch/x86/events/intel/lbr.c index 8043213b75a52..fa947c4fbd1f8 100644 --- a/arch/x86/events/intel/lbr.c +++ b/arch/x86/events/intel/lbr.c @@ -1726,6 +1726,9 @@ static bool is_arch_lbr_xsave_available(void) * Check the LBR state with the corresponding software structure. * Disable LBR XSAVES support if the size doesn't match. */ + if (xfeature_size(XFEATURE_LBR) =3D=3D 0) + return false; + if (WARN_ON(xfeature_size(XFEATURE_LBR) !=3D get_lbr_state_size())) return false; =20 --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69386C433F5 for ; Mon, 14 Feb 2022 10:23:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346967AbiBNKXL (ORCPT ); Mon, 14 Feb 2022 05:23:11 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:51396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347149AbiBNKUu (ORCPT ); Mon, 14 Feb 2022 05:20:50 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA1CB6E359; Mon, 14 Feb 2022 01:55:32 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3C39BB80D83; Mon, 14 Feb 2022 09:55:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 470F7C36AF6; Mon, 14 Feb 2022 09:55:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832508; bh=MwkTiZJoksLSxaggOf2WpxBsuCuWyZjip0DdOvCxCRY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PFoy/y/QFmgTKXsHi+x7Qepr3wFfFNAyI+PhUhMm7BwSrfAAYPTmiLOH+zSCVQhh5 Ex9Gy0vnfrR7MnrBmGahJr5L2vyFDIInFgF3R7h6BkiY6Ug+TbhujdVj97Ek9lFdjJ rb+E87+M6QlaLBgVOcqd3+JWdTqIi3V/rGE5XGVU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, xuhaifeng , "Peter Zijlstra (Intel)" , Sasha Levin Subject: [PATCH 5.16 035/203] sched: Avoid double preemption in __cond_resched_*lock*() Date: Mon, 14 Feb 2022 10:24:39 +0100 Message-Id: <20220214092511.400682464@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 7e406d1ff39b8ee574036418a5043c86723170cf ] For PREEMPT/DYNAMIC_PREEMPT the *_unlock() will already trigger a preemption, no point in then calling preempt_schedule_common() *again*. Use _cond_resched() instead, since this is a NOP for the preemptible configs while it provide a preemption point for the others. Reported-by: xuhaifeng Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/YcGnvDEYBwOiV0cR@hirez.programming.kicks-as= s.net Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- kernel/sched/core.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 77563109c0ea0..d24823b3c3f9f 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -8176,9 +8176,7 @@ int __cond_resched_lock(spinlock_t *lock) =20 if (spin_needbreak(lock) || resched) { spin_unlock(lock); - if (resched) - preempt_schedule_common(); - else + if (!_cond_resched()) cpu_relax(); ret =3D 1; spin_lock(lock); @@ -8196,9 +8194,7 @@ int __cond_resched_rwlock_read(rwlock_t *lock) =20 if (rwlock_needbreak(lock) || resched) { read_unlock(lock); - if (resched) - preempt_schedule_common(); - else + if (!_cond_resched()) cpu_relax(); ret =3D 1; read_lock(lock); @@ -8216,9 +8212,7 @@ int __cond_resched_rwlock_write(rwlock_t *lock) =20 if (rwlock_needbreak(lock) || resched) { write_unlock(lock); - if (resched) - preempt_schedule_common(); - else + if (!_cond_resched()) cpu_relax(); ret =3D 1; write_lock(lock); --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 165F1C433EF for ; Mon, 14 Feb 2022 10:22:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237161AbiBNKWc (ORCPT ); Mon, 14 Feb 2022 05:22:32 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:49688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346753AbiBNKUl (ORCPT ); Mon, 14 Feb 2022 05:20:41 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 057137C7B5; Mon, 14 Feb 2022 01:55:15 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 60DC0B80DC8; Mon, 14 Feb 2022 09:55:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A595C340E9; Mon, 14 Feb 2022 09:55:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832511; bh=QtDiWEcSmKNrDcBtsN8v0rSVjLkbZyrSSGtXPtH3eQQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=e/tJqyLrQstZ2+t9nh8v4B6QqmBW3YzvvVhP6WGX7inzyt5/6CJwY4eHn4CoYtWYH 1BxXsReS6VNgn+ES7TkuUC2+klRl0P5un8MC8umBRfxfmhNiHJkyB5woRpuSD2hsAR 7HqqVVA4qcuLj6oCJkWBc67S03+daPCGtShuEMnM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Padmanabha Srinivasaiah , Maxime Ripard , Sasha Levin Subject: [PATCH 5.16 036/203] drm/vc4: Fix deadlock on DSI device attach error Date: Mon, 14 Feb 2022 10:24:40 +0100 Message-Id: <20220214092511.434199460@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Padmanabha Srinivasaiah [ Upstream commit 0a3d12ab5097b1d045e693412e6b366b7e82031b ] DSI device attach to DSI host will be done with host device's lock held. Un-registering host in "device attach" error path (ex: probe retry) will result in deadlock with below call trace and non operational DSI display. Startup Call trace: [ 35.043036] rt_mutex_slowlock.constprop.21+0x184/0x1b8 [ 35.043048] mutex_lock_nested+0x7c/0xc8 [ 35.043060] device_del+0x4c/0x3e8 [ 35.043075] device_unregister+0x20/0x40 [ 35.043082] mipi_dsi_remove_device_fn+0x18/0x28 [ 35.043093] device_for_each_child+0x68/0xb0 [ 35.043105] mipi_dsi_host_unregister+0x40/0x90 [ 35.043115] vc4_dsi_host_attach+0xf0/0x120 [vc4] [ 35.043199] mipi_dsi_attach+0x30/0x48 [ 35.043209] tc358762_probe+0x128/0x164 [tc358762] [ 35.043225] mipi_dsi_drv_probe+0x28/0x38 [ 35.043234] really_probe+0xc0/0x318 [ 35.043244] __driver_probe_device+0x80/0xe8 [ 35.043254] driver_probe_device+0xb8/0x118 [ 35.043263] __device_attach_driver+0x98/0xe8 [ 35.043273] bus_for_each_drv+0x84/0xd8 [ 35.043281] __device_attach+0xf0/0x150 [ 35.043290] device_initial_probe+0x1c/0x28 [ 35.043300] bus_probe_device+0xa4/0xb0 [ 35.043308] deferred_probe_work_func+0xa0/0xe0 [ 35.043318] process_one_work+0x254/0x700 [ 35.043330] worker_thread+0x4c/0x448 [ 35.043339] kthread+0x19c/0x1a8 [ 35.043348] ret_from_fork+0x10/0x20 Shutdown Call trace: [ 365.565417] Call trace: [ 365.565423] __switch_to+0x148/0x200 [ 365.565452] __schedule+0x340/0x9c8 [ 365.565467] schedule+0x48/0x110 [ 365.565479] schedule_timeout+0x3b0/0x448 [ 365.565496] wait_for_completion+0xac/0x138 [ 365.565509] __flush_work+0x218/0x4e0 [ 365.565523] flush_work+0x1c/0x28 [ 365.565536] wait_for_device_probe+0x68/0x158 [ 365.565550] device_shutdown+0x24/0x348 [ 365.565561] kernel_restart_prepare+0x40/0x50 [ 365.565578] kernel_restart+0x20/0x70 [ 365.565591] __do_sys_reboot+0x10c/0x220 [ 365.565605] __arm64_sys_reboot+0x2c/0x38 [ 365.565619] invoke_syscall+0x4c/0x110 [ 365.565634] el0_svc_common.constprop.3+0xfc/0x120 [ 365.565648] do_el0_svc+0x2c/0x90 [ 365.565661] el0_svc+0x4c/0xf0 [ 365.565671] el0t_64_sync_handler+0x90/0xb8 [ 365.565682] el0t_64_sync+0x180/0x184 Signed-off-by: Padmanabha Srinivasaiah Signed-off-by: Maxime Ripard Link: https://patchwork.freedesktop.org/patch/msgid/20220118005127.29015-1-= treasure4paddy@gmail.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/gpu/drm/vc4/vc4_dsi.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c index a229da58962a2..9300d3354c512 100644 --- a/drivers/gpu/drm/vc4/vc4_dsi.c +++ b/drivers/gpu/drm/vc4/vc4_dsi.c @@ -1262,7 +1262,6 @@ static int vc4_dsi_host_attach(struct mipi_dsi_host *= host, struct mipi_dsi_device *device) { struct vc4_dsi *dsi =3D host_to_dsi(host); - int ret; =20 dsi->lanes =3D device->lanes; dsi->channel =3D device->channel; @@ -1297,18 +1296,15 @@ static int vc4_dsi_host_attach(struct mipi_dsi_host= *host, return 0; } =20 - ret =3D component_add(&dsi->pdev->dev, &vc4_dsi_ops); - if (ret) { - mipi_dsi_host_unregister(&dsi->dsi_host); - return ret; - } - - return 0; + return component_add(&dsi->pdev->dev, &vc4_dsi_ops); } =20 static int vc4_dsi_host_detach(struct mipi_dsi_host *host, struct mipi_dsi_device *device) { + struct vc4_dsi *dsi =3D host_to_dsi(host); + + component_del(&dsi->pdev->dev, &vc4_dsi_ops); return 0; } =20 @@ -1686,9 +1682,7 @@ static int vc4_dsi_dev_remove(struct platform_device = *pdev) struct device *dev =3D &pdev->dev; struct vc4_dsi *dsi =3D dev_get_drvdata(dev); =20 - component_del(&pdev->dev, &vc4_dsi_ops); mipi_dsi_host_unregister(&dsi->dsi_host); - return 0; } =20 --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9F96C433EF for ; Mon, 14 Feb 2022 10:22:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346677AbiBNKXE (ORCPT ); Mon, 14 Feb 2022 05:23:04 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:47948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347337AbiBNKVO (ORCPT ); Mon, 14 Feb 2022 05:21:14 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8ED76E37D; Mon, 14 Feb 2022 01:55:36 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A77FE612BF; Mon, 14 Feb 2022 09:55:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F3CCC340E9; Mon, 14 Feb 2022 09:55:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832514; bh=5aLdZcklCu3DFC/Gykz4dyVw4uYl4546Sw0ES2dxX6U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qvaLAa1mUv8dNoYg9TTk2m8TXvM6q07rbnbjgvpkfr3gtNUEhWs60pTW+dNsD55Sb uP+Y6MasyEmTCQMZf7m3pa2+76P81MXy3aSnI1GZZGjqi6yO0mXVWaxbJE4XV/6Ekf y+Da56+6v3RH4y/zbvbvitir6DAzjB3gY29MW3iQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Raymond Jay Golo , Daniel Vetter , Sasha Levin Subject: [PATCH 5.16 037/203] drm: panel-orientation-quirks: Add quirk for the 1Netbook OneXPlayer Date: Mon, 14 Feb 2022 10:24:41 +0100 Message-Id: <20220214092511.466160773@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Raymond Jay Golo [ Upstream commit d3cbc6e323c9299d10c8d2e4127c77c7d05d07b1 ] The 1Netbook OneXPlayer uses a panel which has been mounted 90 degrees rotated. Add a quirk for this. Signed-off-by: Raymond Jay Golo Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20220113000619.90988-1-= rjgolo@gmail.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/gpu/drm/drm_panel_orientation_quirks.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/drm/drm_panel_orientation_quirks.c b/drivers/gpu/d= rm/drm_panel_orientation_quirks.c index 042bb80383c93..b910978d3e480 100644 --- a/drivers/gpu/drm/drm_panel_orientation_quirks.c +++ b/drivers/gpu/drm/drm_panel_orientation_quirks.c @@ -115,6 +115,12 @@ static const struct drm_dmi_panel_orientation_data lcd= 1280x1920_rightside_up =3D { .orientation =3D DRM_MODE_PANEL_ORIENTATION_RIGHT_UP, }; =20 +static const struct drm_dmi_panel_orientation_data lcd1600x2560_leftside_u= p =3D { + .width =3D 1600, + .height =3D 2560, + .orientation =3D DRM_MODE_PANEL_ORIENTATION_LEFT_UP, +}; + static const struct dmi_system_id orientation_data[] =3D { { /* Acer One 10 (S1003) */ .matches =3D { @@ -275,6 +281,12 @@ static const struct dmi_system_id orientation_data[] = =3D { DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Default string"), }, .driver_data =3D (void *)&onegx1_pro, + }, { /* OneXPlayer */ + .matches =3D { + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ONE-NETBOOK TECHNOLOGY CO., LTD."), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "ONE XPLAYER"), + }, + .driver_data =3D (void *)&lcd1600x2560_leftside_up, }, { /* Samsung GalaxyBook 10.6 */ .matches =3D { DMI_EXACT_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."), --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76512C433FE for ; Mon, 14 Feb 2022 10:28:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347127AbiBNK2V (ORCPT ); Mon, 14 Feb 2022 05:28:21 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:37372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347860AbiBNK0d (ORCPT ); Mon, 14 Feb 2022 05:26:33 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4FAD80902; Mon, 14 Feb 2022 01:57:34 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7A789B80DCE; Mon, 14 Feb 2022 09:57:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DAC8C340E9; Mon, 14 Feb 2022 09:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832641; bh=sJ6+mzYe74c4klAocmWr1wXKcpylYLufUpLD0y2wM5s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aJX8Anm92ECgkLkTnt2UEsimEW93vQABrLbeN28tbwjwAN1qKuXvd/uYEuPKxXTc7 8i7LQAuF48BDFR9Xi1M+xt7zj71BoDFOm8GXKHknct0O9+Llse/K/CAvoHhFcXKMvq jxrw+W+F+kJIb3eH3V4BD1HGiLPzMfnySdZVe95g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Victor Nogueira , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 038/203] net: sched: Clarify error message when qdisc kind is unknown Date: Mon, 14 Feb 2022 10:24:42 +0100 Message-Id: <20220214092511.496573425@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Victor Nogueira [ Upstream commit 973bf8fdd12f0e70ea351c018e68edd377a836d1 ] When adding a tc rule with a qdisc kind that is not supported or not compiled into the kernel, the kernel emits the following error: "Error: Specified qdisc not found.". Found via tdc testing when ETS qdisc was not compiled in and it was not obvious right away what the message meant without looking at the kernel code. Change the error message to be more explicit and say the qdisc kind is unknown. Signed-off-by: Victor Nogueira Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- net/sched/sch_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 910a36ed56343..e4a7ce5c79f4f 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c @@ -1204,7 +1204,7 @@ static struct Qdisc *qdisc_create(struct net_device *= dev, =20 err =3D -ENOENT; if (!ops) { - NL_SET_ERR_MSG(extack, "Specified qdisc not found"); + NL_SET_ERR_MSG(extack, "Specified qdisc kind is unknown"); goto err_out; } =20 --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29CC3C433EF for ; Mon, 14 Feb 2022 10:23:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346744AbiBNKXm (ORCPT ); Mon, 14 Feb 2022 05:23:42 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:51696 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346440AbiBNKVX (ORCPT ); Mon, 14 Feb 2022 05:21:23 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 019737DE1B; Mon, 14 Feb 2022 01:55:50 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 199C4B80DC4; Mon, 14 Feb 2022 09:55:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47A19C340E9; Mon, 14 Feb 2022 09:55:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832538; bh=PgnNCRpAxiyodWJyZyyGogYzjGJ0Rm0cnQHlJk9t4W0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lBWe2a0hOXJh/2oPX0f4+9dwGmszlQFPQDX8ENEFKE9VwbHaGv4oRbuJyHPfTAQ4H gnMRWWFFG5E9bud0NjcxG0Ft37nUUdm0US+ypqAGyYnXV6iBtOskRNgmk4VRYEexSg LamdzwpJEBaROP6EXITqHeQ9AYq0G2EV0gDQyg6Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maxime Bizon , Christophe Leroy , Michael Ellerman , Sasha Levin Subject: [PATCH 5.16 039/203] powerpc/fixmap: Fix VM debug warning on unmap Date: Mon, 14 Feb 2022 10:24:43 +0100 Message-Id: <20220214092511.530055410@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 aec982603aa8cc0a21143681feb5f60ecc69d718 ] Unmapping a fixmap entry is done by calling __set_fixmap() with FIXMAP_PAGE_CLEAR as flags. Today, powerpc __set_fixmap() calls map_kernel_page(). map_kernel_page() is not happy when called a second time for the same page. WARNING: CPU: 0 PID: 1 at arch/powerpc/mm/pgtable.c:194 set_pte_at+0xc/0x1= e8 CPU: 0 PID: 1 Comm: swapper Not tainted 5.16.0-rc3-s3k-dev-01993-g350ff07f= eb7d-dirty #682 NIP: c0017cd4 LR: c00187f0 CTR: 00000010 REGS: e1011d50 TRAP: 0700 Not tainted (5.16.0-rc3-s3k-dev-01993-g350ff0= 7feb7d-dirty) MSR: 00029032 CR: 42000208 XER: 00000000 GPR00: c0165fec e1011e10 c14c0000 c0ee2550 ff800000 c0f3d000 00000000 c001= 686c GPR08: 00001000 b00045a9 00000001 c0f58460 c0f50000 00000000 c0007e10 0000= 0000 GPR16: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 0000= 0000 GPR24: 00000000 00000000 c0ee2550 00000000 c0f57000 00000ff8 00000000 ff80= 0000 NIP [c0017cd4] set_pte_at+0xc/0x1e8 LR [c00187f0] map_kernel_page+0x9c/0x100 Call Trace: [e1011e10] [c0736c68] vsnprintf+0x358/0x6c8 (unreliable) [e1011e30] [c0165fec] __set_fixmap+0x30/0x44 [e1011e40] [c0c13bdc] early_iounmap+0x11c/0x170 [e1011e70] [c0c06cb0] ioremap_legacy_serial_console+0x88/0xc0 [e1011e90] [c0c03634] do_one_initcall+0x80/0x178 [e1011ef0] [c0c0385c] kernel_init_freeable+0xb4/0x250 [e1011f20] [c0007e34] kernel_init+0x24/0x140 [e1011f30] [c0016268] ret_from_kernel_thread+0x5c/0x64 Instruction dump: 7fe3fb78 48019689 80010014 7c630034 83e1000c 5463d97e 7c0803a6 38210010 4e800020 81250000 712a0001 41820008 <0fe00000> 9421ffe0 93e1001c 48000030 Implement unmap_kernel_page() which clears an existing pte. Reported-by: Maxime Bizon Signed-off-by: Christophe Leroy Tested-by: Maxime Bizon Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/b0b752f6f6ecc60653e873f385c6f0dce4e9ab6a.16= 38789098.git.christophe.leroy@csgroup.eu Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/powerpc/include/asm/book3s/32/pgtable.h | 1 + arch/powerpc/include/asm/book3s/64/pgtable.h | 2 ++ arch/powerpc/include/asm/fixmap.h | 6 ++++-- arch/powerpc/include/asm/nohash/32/pgtable.h | 1 + arch/powerpc/include/asm/nohash/64/pgtable.h | 1 + arch/powerpc/mm/pgtable.c | 9 +++++++++ 6 files changed, 18 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/include/asm/book3s/32/pgtable.h b/arch/powerpc/in= clude/asm/book3s/32/pgtable.h index 609c80f671943..f8b94f78403f1 100644 --- a/arch/powerpc/include/asm/book3s/32/pgtable.h +++ b/arch/powerpc/include/asm/book3s/32/pgtable.h @@ -178,6 +178,7 @@ static inline bool pte_user(pte_t pte) #ifndef __ASSEMBLY__ =20 int map_kernel_page(unsigned long va, phys_addr_t pa, pgprot_t prot); +void unmap_kernel_page(unsigned long va); =20 #endif /* !__ASSEMBLY__ */ =20 diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/in= clude/asm/book3s/64/pgtable.h index 33e073d6b0c41..875730d5af408 100644 --- a/arch/powerpc/include/asm/book3s/64/pgtable.h +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h @@ -1082,6 +1082,8 @@ static inline int map_kernel_page(unsigned long ea, u= nsigned long pa, pgprot_t p return hash__map_kernel_page(ea, pa, prot); } =20 +void unmap_kernel_page(unsigned long va); + static inline int __meminit vmemmap_create_mapping(unsigned long start, unsigned long page_size, unsigned long phys) diff --git a/arch/powerpc/include/asm/fixmap.h b/arch/powerpc/include/asm/f= ixmap.h index 947b5b9c44241..a832aeafe5601 100644 --- a/arch/powerpc/include/asm/fixmap.h +++ b/arch/powerpc/include/asm/fixmap.h @@ -111,8 +111,10 @@ static inline void __set_fixmap(enum fixed_addresses i= dx, BUILD_BUG_ON(idx >=3D __end_of_fixed_addresses); else if (WARN_ON(idx >=3D __end_of_fixed_addresses)) return; - - map_kernel_page(__fix_to_virt(idx), phys, flags); + if (pgprot_val(flags)) + map_kernel_page(__fix_to_virt(idx), phys, flags); + else + unmap_kernel_page(__fix_to_virt(idx)); } =20 #define __early_set_fixmap __set_fixmap diff --git a/arch/powerpc/include/asm/nohash/32/pgtable.h b/arch/powerpc/in= clude/asm/nohash/32/pgtable.h index b67742e2a9b22..d959c2a73fbf4 100644 --- a/arch/powerpc/include/asm/nohash/32/pgtable.h +++ b/arch/powerpc/include/asm/nohash/32/pgtable.h @@ -64,6 +64,7 @@ extern int icache_44x_need_flush; #ifndef __ASSEMBLY__ =20 int map_kernel_page(unsigned long va, phys_addr_t pa, pgprot_t prot); +void unmap_kernel_page(unsigned long va); =20 #endif /* !__ASSEMBLY__ */ =20 diff --git a/arch/powerpc/include/asm/nohash/64/pgtable.h b/arch/powerpc/in= clude/asm/nohash/64/pgtable.h index 9d2905a474103..2225991c69b55 100644 --- a/arch/powerpc/include/asm/nohash/64/pgtable.h +++ b/arch/powerpc/include/asm/nohash/64/pgtable.h @@ -308,6 +308,7 @@ static inline void __ptep_set_access_flags(struct vm_ar= ea_struct *vma, #define __swp_entry_to_pte(x) __pte((x).val) =20 int map_kernel_page(unsigned long ea, unsigned long pa, pgprot_t prot); +void unmap_kernel_page(unsigned long va); extern int __meminit vmemmap_create_mapping(unsigned long start, unsigned long page_size, unsigned long phys); diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable.c index ce94823831442..b7385e637e3e3 100644 --- a/arch/powerpc/mm/pgtable.c +++ b/arch/powerpc/mm/pgtable.c @@ -203,6 +203,15 @@ void set_pte_at(struct mm_struct *mm, unsigned long ad= dr, pte_t *ptep, __set_pte_at(mm, addr, ptep, pte, 0); } =20 +void unmap_kernel_page(unsigned long va) +{ + pmd_t *pmdp =3D pmd_off_k(va); + pte_t *ptep =3D pte_offset_kernel(pmdp, va); + + pte_clear(&init_mm, va, ptep); + flush_tlb_kernel_range(va, va + PAGE_SIZE); +} + /* * This is called when relaxing access to a PTE. It's also called in the p= age * fault path when we don't hit any of the major fault cases, ie, a minor --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09120C433F5 for ; Mon, 14 Feb 2022 10:24:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346938AbiBNKYi (ORCPT ); Mon, 14 Feb 2022 05:24:38 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:50544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346642AbiBNKXC (ORCPT ); Mon, 14 Feb 2022 05:23:02 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A0F560A8F; Mon, 14 Feb 2022 01:56:16 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D86DCB80DBE; Mon, 14 Feb 2022 09:56:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21793C340E9; Mon, 14 Feb 2022 09:56:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832573; bh=5CgUbtEjWetjccIjMGSrNUZ2M+3dIRfWytZnM1eefAw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f+HyQrJsSxdsil6EuF+1Ng7oVG4dLVR76+FGGhSrn2m04/fNFRucvUyuB2nHVJHM4 6nfZZJRpArj5vIgY1oNlTgkmpKr7Zb9hfZMBD50twYvMd0WMJRT3L5T+JCBVX06v2d uZppZLklGXu01umeLZsGKIvKBYM6i3A1w3LlQ+j0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ilya Leoshkevich , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Sasha Levin Subject: [PATCH 5.16 040/203] s390/module: test loading modules with a lot of relocations Date: Mon, 14 Feb 2022 10:24:44 +0100 Message-Id: <20220214092511.569191366@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ilya Leoshkevich [ Upstream commit 90c5318795eefa09a9f9aef8d18a904e24962b5c ] Add a test in order to prevent regressions. Signed-off-by: Ilya Leoshkevich Reviewed-by: Heiko Carstens Cc: Vasily Gorbik Cc: Christian Borntraeger Signed-off-by: Heiko Carstens Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/s390/Kconfig | 15 +++++++++ arch/s390/lib/Makefile | 3 ++ arch/s390/lib/test_modules.c | 35 +++++++++++++++++++ arch/s390/lib/test_modules.h | 50 ++++++++++++++++++++++++++++ arch/s390/lib/test_modules_helpers.c | 13 ++++++++ 5 files changed, 116 insertions(+) create mode 100644 arch/s390/lib/test_modules.c create mode 100644 arch/s390/lib/test_modules.h create mode 100644 arch/s390/lib/test_modules_helpers.c diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 2a5bb4f29cfed..0344c68f3ffde 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -947,6 +947,9 @@ config S390_GUEST =20 endmenu =20 +config S390_MODULES_SANITY_TEST_HELPERS + def_bool n + menu "Selftests" =20 config S390_UNWIND_SELFTEST @@ -973,4 +976,16 @@ config S390_KPROBES_SANITY_TEST =20 Say N if you are unsure. =20 +config S390_MODULES_SANITY_TEST + def_tristate n + depends on KUNIT + default KUNIT_ALL_TESTS + prompt "Enable s390 specific modules tests" + select S390_MODULES_SANITY_TEST_HELPERS + help + This option enables an s390 specific modules test. This option is + not useful for distributions or general kernels, but only for + kernel developers working on architecture code. + + Say N if you are unsure. endmenu diff --git a/arch/s390/lib/Makefile b/arch/s390/lib/Makefile index 707cd4622c132..69feb8ed3312d 100644 --- a/arch/s390/lib/Makefile +++ b/arch/s390/lib/Makefile @@ -17,4 +17,7 @@ KASAN_SANITIZE_uaccess.o :=3D n obj-$(CONFIG_S390_UNWIND_SELFTEST) +=3D test_unwind.o CFLAGS_test_unwind.o +=3D -fno-optimize-sibling-calls =20 +obj-$(CONFIG_S390_MODULES_SANITY_TEST) +=3D test_modules.o +obj-$(CONFIG_S390_MODULES_SANITY_TEST_HELPERS) +=3D test_modules_helpers.o + lib-$(CONFIG_FUNCTION_ERROR_INJECTION) +=3D error-inject.o diff --git a/arch/s390/lib/test_modules.c b/arch/s390/lib/test_modules.c new file mode 100644 index 0000000000000..d056baa8fbb0c --- /dev/null +++ b/arch/s390/lib/test_modules.c @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#include +#include + +#include "test_modules.h" + +#define DECLARE_RETURN(i) int test_modules_return_ ## i(void) +REPEAT_10000(DECLARE_RETURN); + +/* + * Test that modules with many relocations are loaded properly. + */ +static void test_modules_many_vmlinux_relocs(struct kunit *test) +{ + int result =3D 0; + +#define CALL_RETURN(i) result +=3D test_modules_return_ ## i() + REPEAT_10000(CALL_RETURN); + KUNIT_ASSERT_EQ(test, result, 49995000); +} + +static struct kunit_case modules_testcases[] =3D { + KUNIT_CASE(test_modules_many_vmlinux_relocs), + {} +}; + +static struct kunit_suite modules_test_suite =3D { + .name =3D "modules_test_s390", + .test_cases =3D modules_testcases, +}; + +kunit_test_suites(&modules_test_suite); + +MODULE_LICENSE("GPL"); diff --git a/arch/s390/lib/test_modules.h b/arch/s390/lib/test_modules.h new file mode 100644 index 0000000000000..43b5e4b4af3e4 --- /dev/null +++ b/arch/s390/lib/test_modules.h @@ -0,0 +1,50 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +#ifndef TEST_MODULES_H +#define TEST_MODULES_H + +#define __REPEAT_10000_3(f, x) \ + f(x ## 0); \ + f(x ## 1); \ + f(x ## 2); \ + f(x ## 3); \ + f(x ## 4); \ + f(x ## 5); \ + f(x ## 6); \ + f(x ## 7); \ + f(x ## 8); \ + f(x ## 9) +#define __REPEAT_10000_2(f, x) \ + __REPEAT_10000_3(f, x ## 0); \ + __REPEAT_10000_3(f, x ## 1); \ + __REPEAT_10000_3(f, x ## 2); \ + __REPEAT_10000_3(f, x ## 3); \ + __REPEAT_10000_3(f, x ## 4); \ + __REPEAT_10000_3(f, x ## 5); \ + __REPEAT_10000_3(f, x ## 6); \ + __REPEAT_10000_3(f, x ## 7); \ + __REPEAT_10000_3(f, x ## 8); \ + __REPEAT_10000_3(f, x ## 9) +#define __REPEAT_10000_1(f, x) \ + __REPEAT_10000_2(f, x ## 0); \ + __REPEAT_10000_2(f, x ## 1); \ + __REPEAT_10000_2(f, x ## 2); \ + __REPEAT_10000_2(f, x ## 3); \ + __REPEAT_10000_2(f, x ## 4); \ + __REPEAT_10000_2(f, x ## 5); \ + __REPEAT_10000_2(f, x ## 6); \ + __REPEAT_10000_2(f, x ## 7); \ + __REPEAT_10000_2(f, x ## 8); \ + __REPEAT_10000_2(f, x ## 9) +#define REPEAT_10000(f) \ + __REPEAT_10000_1(f, 0); \ + __REPEAT_10000_1(f, 1); \ + __REPEAT_10000_1(f, 2); \ + __REPEAT_10000_1(f, 3); \ + __REPEAT_10000_1(f, 4); \ + __REPEAT_10000_1(f, 5); \ + __REPEAT_10000_1(f, 6); \ + __REPEAT_10000_1(f, 7); \ + __REPEAT_10000_1(f, 8); \ + __REPEAT_10000_1(f, 9) + +#endif diff --git a/arch/s390/lib/test_modules_helpers.c b/arch/s390/lib/test_modu= les_helpers.c new file mode 100644 index 0000000000000..1670349a03eba --- /dev/null +++ b/arch/s390/lib/test_modules_helpers.c @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#include + +#include "test_modules.h" + +#define DEFINE_RETURN(i) \ + int test_modules_return_ ## i(void) \ + { \ + return 1 ## i - 10000; \ + } \ + EXPORT_SYMBOL_GPL(test_modules_return_ ## i) +REPEAT_10000(DEFINE_RETURN); --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B137C4332F for ; Mon, 14 Feb 2022 10:27:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242034AbiBNK1f (ORCPT ); Mon, 14 Feb 2022 05:27:35 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:53424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346292AbiBNKYx (ORCPT ); Mon, 14 Feb 2022 05:24:53 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1672C6A06B; Mon, 14 Feb 2022 01:56:48 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A81E860F25; Mon, 14 Feb 2022 09:56:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E61EC340E9; Mon, 14 Feb 2022 09:56:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832607; bh=HOMtooBCaK9kcNtATkKsUp8A3gmKsRUzgJZgjI9BZw8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WNgfKswdmY23dkEU6lLATFJ4MaFQUQix+WvkapHoBRf7t8otvnE1oeSN0YB5PG6O+ HXb2FQfra/T8sfSBV6CBFgMBJSDSwxwttj8w0eGi6RV9EufU+q7BXsVQ+On/cXD1DI h/+RIvv3tkcCskZ3SmTHCL1edHGawZEDOZw8O5vA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Will Deacon , Suzuki Poulose , linux-arm-kernel@lists.infradead.org, Anshuman Khandual , Catalin Marinas , Sasha Levin Subject: [PATCH 5.16 041/203] arm64: Add Cortex-X2 CPU part definition Date: Mon, 14 Feb 2022 10:24:45 +0100 Message-Id: <20220214092511.602851180@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 72bb9dcb6c33cfac80282713c2b4f2b254cd24d1 ] Add the CPU Partnumbers for the new Arm designs. Cc: Will Deacon Cc: Suzuki Poulose Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual Reviewed-by: Suzuki K Poulose Link: https://lore.kernel.org/r/1642994138-25887-2-git-send-email-anshuman.= khandual@arm.com Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/arm64/include/asm/cputype.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm64/include/asm/cputype.h b/arch/arm64/include/asm/cput= ype.h index e8fdc10395b6a..999b9149f8568 100644 --- a/arch/arm64/include/asm/cputype.h +++ b/arch/arm64/include/asm/cputype.h @@ -75,6 +75,7 @@ #define ARM_CPU_PART_CORTEX_A77 0xD0D #define ARM_CPU_PART_CORTEX_A510 0xD46 #define ARM_CPU_PART_CORTEX_A710 0xD47 +#define ARM_CPU_PART_CORTEX_X2 0xD48 #define ARM_CPU_PART_NEOVERSE_N2 0xD49 =20 #define APM_CPU_PART_POTENZA 0x000 @@ -118,6 +119,7 @@ #define MIDR_CORTEX_A77 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTE= X_A77) #define MIDR_CORTEX_A510 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORT= EX_A510) #define MIDR_CORTEX_A710 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORT= EX_A710) +#define MIDR_CORTEX_X2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_CORTEX= _X2) #define MIDR_NEOVERSE_N2 MIDR_CPU_MODEL(ARM_CPU_IMP_ARM, ARM_CPU_PART_NEOV= ERSE_N2) #define MIDR_THUNDERX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_PART_T= HUNDERX) #define MIDR_THUNDERX_81XX MIDR_CPU_MODEL(ARM_CPU_IMP_CAVIUM, CAVIUM_CPU_P= ART_THUNDERX_81XX) --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27B72C4332F for ; Mon, 14 Feb 2022 10:27:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347152AbiBNK14 (ORCPT ); Mon, 14 Feb 2022 05:27:56 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:34788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347021AbiBNKZl (ORCPT ); Mon, 14 Feb 2022 05:25:41 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6664F6E558; Mon, 14 Feb 2022 01:57:03 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 005186146F; Mon, 14 Feb 2022 09:57:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C91E7C340E9; Mon, 14 Feb 2022 09:57:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832622; bh=j1g3Ine8G433kS6IRoLdXKc+ZFe8y8VI1aADr+jnjJo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P1AyOqL6gXKwID/xrGmVRaQ1kVOLNgaaeziq9ITI9fKilpmr0ZB6iUS3wtlwcPZJp louqKsPq032l/D3TroWmKWI2BIW8S/dvKUmrQ4GgfQ2RdZZ4U0as+GCPPc7AdHIEEk YQ3UsSSBjMh+BXDkk31RD4pxz700VhBYtPYK58us= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Will Deacon , Mathieu Poirier , Suzuki Poulose , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, Anshuman Khandual , Catalin Marinas , Sasha Levin Subject: [PATCH 5.16 042/203] arm64: errata: Update ARM64_ERRATUM_[2119858|2224489] with Cortex-X2 ranges Date: Mon, 14 Feb 2022 10:24:46 +0100 Message-Id: <20220214092511.634829233@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 eb30d838a44c9e59a2a106884f536119859c7257 ] Errata ARM64_ERRATUM_[2119858|2224489] also affect some Cortex-X2 ranges as well. Lets update these errata definition and detection to accommodate all new Cortex-X2 based cpu MIDR ranges. Cc: Will Deacon Cc: Mathieu Poirier Cc: Suzuki Poulose Cc: coresight@lists.linaro.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual Reviewed-by: Suzuki K Poulose Link: https://lore.kernel.org/r/1642994138-25887-3-git-send-email-anshuman.= khandual@arm.com Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- Documentation/arm64/silicon-errata.rst | 4 ++++ arch/arm64/Kconfig | 12 ++++++------ arch/arm64/kernel/cpu_errata.c | 2 ++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Documentation/arm64/silicon-errata.rst b/Documentation/arm64/s= ilicon-errata.rst index 5342e895fb604..8789c79310bbd 100644 --- a/Documentation/arm64/silicon-errata.rst +++ b/Documentation/arm64/silicon-errata.rst @@ -98,6 +98,10 @@ stable kernels. +----------------+-----------------+-----------------+--------------------= ---------+ | ARM | Cortex-A710 | #2224489 | ARM64_ERRATUM_22244= 89 | +----------------+-----------------+-----------------+--------------------= ---------+ +| ARM | Cortex-X2 | #2119858 | ARM64_ERRATUM_21198= 58 | ++----------------+-----------------+-----------------+--------------------= ---------+ +| ARM | Cortex-X2 | #2224489 | ARM64_ERRATUM_22244= 89 | ++----------------+-----------------+-----------------+--------------------= ---------+ | ARM | Neoverse-N1 | #1188873,1418040| ARM64_ERRATUM_14180= 40 | +----------------+-----------------+-----------------+--------------------= ---------+ | ARM | Neoverse-N1 | #1349291 | N/A = | diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index c4207cf9bb17f..d8046c832225c 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -671,14 +671,14 @@ config ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE bool =20 config ARM64_ERRATUM_2119858 - bool "Cortex-A710: 2119858: workaround TRBE overwriting trace data in FIL= L mode" + bool "Cortex-A710/X2: 2119858: workaround TRBE overwriting trace data in = FILL mode" default y depends on CORESIGHT_TRBE select ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE help - This option adds the workaround for ARM Cortex-A710 erratum 2119858. + This option adds the workaround for ARM Cortex-A710/X2 erratum 2119858. =20 - Affected Cortex-A710 cores could overwrite up to 3 cache lines of trace + Affected Cortex-A710/X2 cores could overwrite up to 3 cache lines of tr= ace data at the base of the buffer (pointed to by TRBASER_EL1) in FILL mode= in the event of a WRAP event. =20 @@ -761,14 +761,14 @@ config ARM64_ERRATUM_2253138 If unsure, say Y. =20 config ARM64_ERRATUM_2224489 - bool "Cortex-A710: 2224489: workaround TRBE writing to address out-of-ran= ge" + bool "Cortex-A710/X2: 2224489: workaround TRBE writing to address out-of-= range" depends on CORESIGHT_TRBE default y select ARM64_WORKAROUND_TRBE_WRITE_OUT_OF_RANGE help - This option adds the workaround for ARM Cortex-A710 erratum 2224489. + This option adds the workaround for ARM Cortex-A710/X2 erratum 2224489. =20 - Affected Cortex-A710 cores might write to an out-of-range address, not = reserved + Affected Cortex-A710/X2 cores might write to an out-of-range address, n= ot reserved for TRBE. Under some conditions, the TRBE might generate a write to the= next virtually addressed page following the last page of the TRBE address sp= ace (i.e., the TRBLIMITR_EL1.LIMIT), instead of wrapping around to the base. diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c index 9e1c1aef9ebd6..29cc062a4153c 100644 --- a/arch/arm64/kernel/cpu_errata.c +++ b/arch/arm64/kernel/cpu_errata.c @@ -347,6 +347,7 @@ static const struct midr_range trbe_overwrite_fill_mode= _cpus[] =3D { #endif #ifdef CONFIG_ARM64_ERRATUM_2119858 MIDR_ALL_VERSIONS(MIDR_CORTEX_A710), + MIDR_RANGE(MIDR_CORTEX_X2, 0, 0, 2, 0), #endif {}, }; @@ -371,6 +372,7 @@ static struct midr_range trbe_write_out_of_range_cpus[]= =3D { #endif #ifdef CONFIG_ARM64_ERRATUM_2224489 MIDR_ALL_VERSIONS(MIDR_CORTEX_A710), + MIDR_RANGE(MIDR_CORTEX_X2, 0, 0, 2, 0), #endif {}, }; --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D14CAC433F5 for ; Mon, 14 Feb 2022 10:27:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347326AbiBNK2A (ORCPT ); Mon, 14 Feb 2022 05:28:00 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:57568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347266AbiBNKZt (ORCPT ); Mon, 14 Feb 2022 05:25:49 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 830276A022; Mon, 14 Feb 2022 01:57:08 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2649EB80DCB; Mon, 14 Feb 2022 09:57:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F25DC340E9; Mon, 14 Feb 2022 09:57:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832625; bh=/T57QsHEXzWRyz9ngAgfSuXzq9rnlQ9xNPWF7J/q3zk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lJ2Q+K3L5iKQniRzE87F2HSfzMeHew1EGr/QcitKcRuQaj2Hut3OQo7IxKE1zv4Dg g+sCTcMRn0mrRpQuBHw8kaUifKkrtHfK8d0YpOZ81ViY3W/1OFfnIP2swtxmXZ83LV n/Fup5uR5B1nn9nSQsdqwzmFxWX9YkePV/wIphQw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, ZouMingzhe , Mike Christie , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.16 043/203] scsi: target: iscsi: Make sure the np under each tpg is unique Date: Mon, 14 Feb 2022 10:24:47 +0100 Message-Id: <20220214092511.681686688@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: ZouMingzhe [ Upstream commit a861790afaa8b6369eee8a88c5d5d73f5799c0c6 ] iscsit_tpg_check_network_portal() has nested for_each loops and is supposed to return true when a match is found. However, the tpg loop will still continue after existing the tpg_np loop. If this tpg_np is not the last the match value will be changed. Break the outer loop after finding a match and make sure the np under each tpg is unique. Link: https://lore.kernel.org/r/20220111054742.19582-1-mingzhe.zou@easystac= k.cn Signed-off-by: ZouMingzhe Reviewed-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: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/target/iscsi/iscsi_target_tpg.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/target/iscsi/iscsi_target_tpg.c b/drivers/target/iscsi= /iscsi_target_tpg.c index 8075f60fd02c3..2d5cf1714ae05 100644 --- a/drivers/target/iscsi/iscsi_target_tpg.c +++ b/drivers/target/iscsi/iscsi_target_tpg.c @@ -443,6 +443,9 @@ static bool iscsit_tpg_check_network_portal( break; } spin_unlock(&tpg->tpg_np_lock); + + if (match) + break; } spin_unlock(&tiqn->tiqn_tpg_lock); =20 --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75BEBC433EF for ; Mon, 14 Feb 2022 10:28:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347365AbiBNK2E (ORCPT ); Mon, 14 Feb 2022 05:28:04 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:34784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347325AbiBNKZu (ORCPT ); Mon, 14 Feb 2022 05:25:50 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E8996EF0D; Mon, 14 Feb 2022 01:57:11 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 220E3B80DD5; Mon, 14 Feb 2022 09:57:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F337C340E9; Mon, 14 Feb 2022 09:57:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832628; bh=Y4I1XbzZkketrSB1+LOJA9GxTunIlw/Msl9gsyKUgh8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LDcR5evzA+pMzv41ed4nV2ogNyfh2QF1zxYBSwrMhDLNDa3MSltzmnGiV49xC7ubJ +SqLgLFgTHJDH1lHHt32g7uYIReP43fpR7/lqlTwHJTTHg4qlKaKg/JXbHJdJrrxPk 8zwrjCVWRUklX7ZhXdbmEyDycTnERnwtKKon+ruE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bean Huo , Xiaoke Wang , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.16 044/203] scsi: ufs: ufshcd-pltfrm: Check the return value of devm_kstrdup() Date: Mon, 14 Feb 2022 10:24:48 +0100 Message-Id: <20220214092511.713387573@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xiaoke Wang [ Upstream commit a65b32748f4566f986ba2495a8236c141fa42a26 ] devm_kstrdup() returns pointer to allocated string on success, NULL on failure. So it is better to check the return value of it. Link: https://lore.kernel.org/r/tencent_4257E15D4A94FF9020DDCC4BB9B21C04140= 8@qq.com Reviewed-by: Bean Huo Signed-off-by: Xiaoke Wang Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/scsi/ufs/ufshcd-pltfrm.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-plt= frm.c index 8b16bbbcb806c..87975d1a21c8b 100644 --- a/drivers/scsi/ufs/ufshcd-pltfrm.c +++ b/drivers/scsi/ufs/ufshcd-pltfrm.c @@ -92,6 +92,11 @@ static int ufshcd_parse_clock_info(struct ufs_hba *hba) clki->min_freq =3D clkfreq[i]; clki->max_freq =3D clkfreq[i+1]; clki->name =3D devm_kstrdup(dev, name, GFP_KERNEL); + if (!clki->name) { + ret =3D -ENOMEM; + goto out; + } + if (!strcmp(name, "ref_clk")) clki->keep_link_active =3D true; dev_dbg(dev, "%s: min %u max %u name %s\n", "freq-table-hz", @@ -127,6 +132,8 @@ static int ufshcd_populate_vreg(struct device *dev, con= st char *name, return -ENOMEM; =20 vreg->name =3D devm_kstrdup(dev, name, GFP_KERNEL); + if (!vreg->name) + return -ENOMEM; =20 snprintf(prop_name, MAX_PROP_SIZE, "%s-max-microamp", name); if (of_property_read_u32(np, prop_name, &vreg->max_uA)) { --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9756C433EF for ; Mon, 14 Feb 2022 10:28:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236294AbiBNK2L (ORCPT ); Mon, 14 Feb 2022 05:28:11 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:56788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347374AbiBNKZx (ORCPT ); Mon, 14 Feb 2022 05:25:53 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7A7A6EF19; Mon, 14 Feb 2022 01:57:12 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6BC4C6126B; Mon, 14 Feb 2022 09:57:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FDE9C340E9; Mon, 14 Feb 2022 09:57:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832631; bh=x4XQYM5nJO+yQAGR11Fx9n3eVpNCCNywTwTDhK1as+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XzY9hTni94YoUJjCHktKrF2l68lMmJb/F/Ev4Nm62KJAO9T2iTRizBpTimqkRaAha CgENx3pv5150IuomAZ/u3tGpiKGAqQiPirgPfF4n5H+YZ5g0VcJMhTCwPr0md4VIAR 96z+bnOenHGZZnWceX7IcGsPqDS+G+Dxk385PsJo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Saurav Kashyap , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.16 045/203] scsi: qedf: Add stag_work to all the vports Date: Mon, 14 Feb 2022 10:24:49 +0100 Message-Id: <20220214092511.746786799@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Saurav Kashyap [ Upstream commit b70a99fd13282d7885f69bf1372e28b7506a1613 ] Call trace seen when creating NPIV ports, only 32 out of 64 show online. stag work was not initialized for vport, hence initialize the stag work. WARNING: CPU: 8 PID: 645 at kernel/workqueue.c:1635 __queue_delayed_work+0x= 68/0x80 CPU: 8 PID: 645 Comm: kworker/8:1 Kdump: loaded Tainted: G IOE ---------= -- 4.18.0-348.el8.x86_64 #1 Hardware name: Dell Inc. PowerEdge MX740c/0177V9, BIOS 2.12.2 07/09/2021 Workqueue: events fc_lport_timeout [libfc] RIP: 0010:__queue_delayed_work+0x68/0x80 Code: 89 b2 88 00 00 00 44 89 82 90 00 00 00 48 01 c8 48 89 42 50 41 81 f8 00 20 00 00 75 1d e9 60 24 07 00 44 89 c7 e9 98 f6 ff ff <0f> 0b eb c5 0f 0b eb a1 0f 0b eb a7 0f 0b eb ac 44 89 c6 e9 40 23 RSP: 0018:ffffae514bc3be40 EFLAGS: 00010006 RAX: ffff8d25d6143750 RBX: 0000000000000202 RCX: 0000000000000002 RDX: ffff8d2e31383748 RSI: ffff8d25c000d600 RDI: ffff8d2e31383788 RBP: ffff8d2e31380de0 R08: 0000000000002000 R09: ffff8d2e31383750 R10: ffffffffc0c957e0 R11: ffff8d2624800000 R12: ffff8d2e31380a58 R13: ffff8d2d915eb000 R14: ffff8d25c499b5c0 R15: ffff8d2e31380e18 FS: 0000000000000000(0000) GS:ffff8d2d1fb00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000055fd0484b8b8 CR3: 00000008ffc10006 CR4: 00000000007706e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: queue_delayed_work_on+0x36/0x40 qedf_elsct_send+0x57/0x60 [qedf] fc_lport_enter_flogi+0x90/0xc0 [libfc] fc_lport_timeout+0xb7/0x140 [libfc] process_one_work+0x1a7/0x360 ? create_worker+0x1a0/0x1a0 worker_thread+0x30/0x390 ? create_worker+0x1a0/0x1a0 kthread+0x116/0x130 ? kthread_flush_work_fn+0x10/0x10 ret_from_fork+0x35/0x40 ---[ end trace 008f00f722f2c2ff ]-- Initialize stag work for all the vports. Link: https://lore.kernel.org/r/20220117135311.6256-2-njavali@marvell.com Signed-off-by: Saurav Kashyap 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: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/scsi/qedf/qedf_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c index 1bf7a22d49480..6e367b40ecc96 100644 --- a/drivers/scsi/qedf/qedf_main.c +++ b/drivers/scsi/qedf/qedf_main.c @@ -1862,6 +1862,7 @@ static int qedf_vport_create(struct fc_vport *vport, = bool disabled) vport_qedf->cmd_mgr =3D base_qedf->cmd_mgr; init_completion(&vport_qedf->flogi_compl); INIT_LIST_HEAD(&vport_qedf->fcports); + INIT_DELAYED_WORK(&vport_qedf->stag_work, qedf_stag_change_work); =20 rc =3D qedf_vport_libfc_config(vport, vn_port); if (rc) { --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A795BC433EF for ; Mon, 14 Feb 2022 10:28:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347383AbiBNK2P (ORCPT ); Mon, 14 Feb 2022 05:28:15 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:34332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347483AbiBNK0D (ORCPT ); Mon, 14 Feb 2022 05:26:03 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD97E6EF3C; Mon, 14 Feb 2022 01:57:15 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6996B61465; Mon, 14 Feb 2022 09:57:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 53F65C340E9; Mon, 14 Feb 2022 09:57:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832634; bh=zzMJxbPBiRG2Y2ZlNqrD/+LQlA64/tzHiQCZyC7me9Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jL1Klm9ny+b+h5CSfE84MwfZyUjgiKkxujM4+GvMvg8GT8kzCUqeiLVPvjVRjPcjd odKAQ/z87gJsX/Df1ONhphQZ7Bq8iKa52Sm4EJg3/MfTzyl+AqaXn3HAOs188UQ0k5 rwzusAKDvlUvSwzw8zXf5Atd8gi/QMIUZTsd1+O4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Saurav Kashyap , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.16 046/203] scsi: qedf: Fix refcount issue when LOGO is received during TMF Date: Mon, 14 Feb 2022 10:24:50 +0100 Message-Id: <20220214092511.779806186@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Saurav Kashyap [ Upstream commit 5239ab63f17cee643bd4bf6addfedebaa7d4f41e ] Hung task call trace was seen during LOGO processing. [ 974.309060] [0000:00:00.0]:[qedf_eh_device_reset:868]: 1:0:2:0: LUN RESE= T Issued... [ 974.309065] [0000:00:00.0]:[qedf_initiate_tmf:2422]: tm_flags 0x10 sc_cm= d 00000000c16b930f op =3D 0x2a target_id =3D 0x2 lun=3D0 [ 974.309178] [0000:00:00.0]:[qedf_initiate_tmf:2431]: portid=3D016900 tm_= flags =3DLUN RESET [ 974.309222] [0000:00:00.0]:[qedf_initiate_tmf:2438]: orig io_req =3D 000= 00000ec78df8f xid =3D 0x180 ref_cnt =3D 1. [ 974.309625] host1: rport 016900: Received LOGO request while in state Re= ady [ 974.309627] host1: rport 016900: Delete port [ 974.309642] host1: rport 016900: work event 3 [ 974.309644] host1: rport 016900: lld callback ev 3 [ 974.313243] [0000:61:00.2]:[qedf_execute_tmf:2383]:1: fcport is uploadin= g, not executing flush. [ 974.313295] [0000:61:00.2]:[qedf_execute_tmf:2400]:1: task mgmt command = success... [ 984.031088] INFO: task jbd2/dm-15-8:7645 blocked for more than 120 secon= ds. [ 984.031136] Not tainted 4.18.0-305.el8.x86_64 #1 [ 984.031166] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables = this message. [ 984.031209] jbd2/dm-15-8 D 0 7645 2 0x80004080 [ 984.031212] Call Trace: [ 984.031222] __schedule+0x2c4/0x700 [ 984.031230] ? unfreeze_partials.isra.83+0x16e/0x1a0 [ 984.031233] ? bit_wait_timeout+0x90/0x90 [ 984.031235] schedule+0x38/0xa0 [ 984.031238] io_schedule+0x12/0x40 [ 984.031240] bit_wait_io+0xd/0x50 [ 984.031243] __wait_on_bit+0x6c/0x80 [ 984.031248] ? free_buffer_head+0x21/0x50 [ 984.031251] out_of_line_wait_on_bit+0x91/0xb0 [ 984.031257] ? init_wait_var_entry+0x50/0x50 [ 984.031268] jbd2_journal_commit_transaction+0x112e/0x19f0 [jbd2] [ 984.031280] kjournald2+0xbd/0x270 [jbd2] [ 984.031284] ? finish_wait+0x80/0x80 [ 984.031291] ? commit_timeout+0x10/0x10 [jbd2] [ 984.031294] kthread+0x116/0x130 [ 984.031300] ? kthread_flush_work_fn+0x10/0x10 [ 984.031305] ret_from_fork+0x1f/0x40 There was a ref count issue when LOGO is received during TMF. This leads to one of the I/Os hanging with the driver. Fix the ref count. Link: https://lore.kernel.org/r/20220117135311.6256-3-njavali@marvell.com Signed-off-by: Saurav Kashyap 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: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/scsi/qedf/qedf_io.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c index 99a56ca1fb163..fab43dabe5b31 100644 --- a/drivers/scsi/qedf/qedf_io.c +++ b/drivers/scsi/qedf/qedf_io.c @@ -2250,6 +2250,7 @@ int qedf_initiate_cleanup(struct qedf_ioreq *io_req, io_req->tm_flags =3D=3D FCP_TMF_TGT_RESET) { clear_bit(QEDF_CMD_OUTSTANDING, &io_req->flags); io_req->sc_cmd =3D NULL; + kref_put(&io_req->refcount, qedf_release_cmd); complete(&io_req->tm_done); } =20 --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4FD3C433EF for ; Mon, 14 Feb 2022 10:28:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347402AbiBNK2S (ORCPT ); Mon, 14 Feb 2022 05:28:18 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:33138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347728AbiBNK0T (ORCPT ); Mon, 14 Feb 2022 05:26:19 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EF3680217; Mon, 14 Feb 2022 01:57:28 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 50921B80DD0; Mon, 14 Feb 2022 09:57:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5BFAAC340E9; Mon, 14 Feb 2022 09:57:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832638; bh=nDySB6UXuT3u6CrlRf1gGUS+olwtOzGHIaEFmYJVFJc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O0b74A6d+TRteVhPqDy/sT998Fl5IkQ7F68pT8P1KUQcFenxn9He9kp7A81oMfdDB QWMOZ0etugR2T2yH7nuSmXHjOyfvi2idAcsH6XIISVXygMNaCHnyN19xR8ifKRAtvf Pi/IPvNRFYMeI45QY7/lbv52SP/AQZldBOw1+UdE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Saurav Kashyap , Nilesh Javali , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.16 047/203] scsi: qedf: Change context reset messages to ratelimited Date: Mon, 14 Feb 2022 10:24:51 +0100 Message-Id: <20220214092511.817031892@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Saurav Kashyap [ Upstream commit 64fd4af6274eb0f49d29772c228fffcf6bde1635 ] If FCoE is not configured, libfc/libfcoe keeps on retrying FLOGI and after 3 retries driver does a context reset and tries fipvlan again. This leads to context reset message flooding the logs. Hence ratelimit the message to prevent flooding the logs. Link: https://lore.kernel.org/r/20220117135311.6256-4-njavali@marvell.com Signed-off-by: Saurav Kashyap 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: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/scsi/qedf/qedf_main.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c index 6e367b40ecc96..e0e03443d7703 100644 --- a/drivers/scsi/qedf/qedf_main.c +++ b/drivers/scsi/qedf/qedf_main.c @@ -911,7 +911,7 @@ void qedf_ctx_soft_reset(struct fc_lport *lport) struct qed_link_output if_link; =20 if (lport->vport) { - QEDF_ERR(NULL, "Cannot issue host reset on NPIV port.\n"); + printk_ratelimited("Cannot issue host reset on NPIV port.\n"); return; } =20 @@ -3979,7 +3979,9 @@ void qedf_stag_change_work(struct work_struct *work) struct qedf_ctx *qedf =3D container_of(work, struct qedf_ctx, stag_work.work); =20 - QEDF_ERR(&qedf->dbg_ctx, "Performing software context reset.\n"); + printk_ratelimited("[%s]:[%s:%d]:%d: Performing software context reset.", + dev_name(&qedf->pdev->dev), __func__, __LINE__, + qedf->dbg_ctx.host_no); qedf_ctx_soft_reset(qedf->lport); } =20 --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4744AC433F5 for ; Mon, 14 Feb 2022 10:23:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347048AbiBNKXY (ORCPT ); Mon, 14 Feb 2022 05:23:24 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:49684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347501AbiBNKVS (ORCPT ); Mon, 14 Feb 2022 05:21:18 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 790DD6E2B4; Mon, 14 Feb 2022 01:55:43 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 11EA5B80DC8; Mon, 14 Feb 2022 09:55:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D147C340E9; Mon, 14 Feb 2022 09:55:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832541; bh=bjoUDtJjdYhBbXWDCNWeCPkAHE8XCLOofGzvfH6ksWQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J9/vclSDm6oFSWBllszTrBuU/vvY7u2WJyg4TzZpZ64H1AZl2DEh8i/MyAbpUIXg+ Nh0ovfkxrf/F+t3XT33+LNNt7X6Wcyp/jbwVEQOd784QvtiFrt+jU2VBd6ZiaMoIf2 S7QMWCt3mYh1V3oAENyAiBwohEA8lzJBsiTHFWJg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Damien Le Moal , John Garry , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.16 048/203] scsi: pm8001: Fix bogus FW crash for maxcpus=1 Date: Mon, 14 Feb 2022 10:24:52 +0100 Message-Id: <20220214092511.849135534@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Garry [ Upstream commit 62afb379a0fee7e9c2f9f68e1abeb85ceddf51b9 ] According to the comment in check_fw_ready() we should not check the IOP1_READY field in register SCRATCH_PAD_1 for 8008 or 8009 controllers. However we check this very field in process_oq() for processing the highest index interrupt vector. The highest interrupt vector is checked as the FW is programmed to signal fatal errors through this irq. Change that function to not check IOP1_READY for those mentioned controllers, but do check ILA_READY in both cases. The reason I assume that this was not hit earlier was because we always allocated 64 MSI(X), and just did not pass the vector index check in process_oq(), i.e. the handler never ran for vector index 63. Link: https://lore.kernel.org/r/1642508105-95432-1-git-send-email-john.garr= y@huawei.com Tested-by: Damien Le Moal Reviewed-by: Damien Le Moal 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: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/scsi/pm8001/pm80xx_hwi.c | 16 ++++++++++++++-- drivers/scsi/pm8001/pm80xx_hwi.h | 6 +++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/pm8001/pm80xx_hwi.c b/drivers/scsi/pm8001/pm80xx_= hwi.c index 2101fc5761c3c..4c5b945bf3187 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.c +++ b/drivers/scsi/pm8001/pm80xx_hwi.c @@ -4161,10 +4161,22 @@ static int process_oq(struct pm8001_hba_info *pm800= 1_ha, u8 vec) u32 ret =3D MPI_IO_STATUS_FAIL; u32 regval; =20 + /* + * Fatal errors are programmed to be signalled in irq vector + * pm8001_ha->max_q_num - 1 through pm8001_ha->main_cfg_tbl.pm80xx_tbl. + * fatal_err_interrupt + */ if (vec =3D=3D (pm8001_ha->max_q_num - 1)) { + u32 mipsall_ready; + + if (pm8001_ha->chip_id =3D=3D chip_8008 || + pm8001_ha->chip_id =3D=3D chip_8009) + mipsall_ready =3D SCRATCH_PAD_MIPSALL_READY_8PORT; + else + mipsall_ready =3D SCRATCH_PAD_MIPSALL_READY_16PORT; + regval =3D pm8001_cr32(pm8001_ha, 0, MSGU_SCRATCH_PAD_1); - if ((regval & SCRATCH_PAD_MIPSALL_READY) !=3D - SCRATCH_PAD_MIPSALL_READY) { + if ((regval & mipsall_ready) !=3D mipsall_ready) { pm8001_ha->controller_fatal_error =3D true; pm8001_dbg(pm8001_ha, FAIL, "Firmware Fatal error! Regval:0x%x\n", diff --git a/drivers/scsi/pm8001/pm80xx_hwi.h b/drivers/scsi/pm8001/pm80xx_= hwi.h index c7e5d93bea924..c41ed039c92ac 100644 --- a/drivers/scsi/pm8001/pm80xx_hwi.h +++ b/drivers/scsi/pm8001/pm80xx_hwi.h @@ -1405,8 +1405,12 @@ typedef struct SASProtocolTimerConfig SASProtocolTim= erConfig_t; #define SCRATCH_PAD_BOOT_LOAD_SUCCESS 0x0 #define SCRATCH_PAD_IOP0_READY 0xC00 #define SCRATCH_PAD_IOP1_READY 0x3000 -#define SCRATCH_PAD_MIPSALL_READY (SCRATCH_PAD_IOP1_READY | \ +#define SCRATCH_PAD_MIPSALL_READY_16PORT (SCRATCH_PAD_IOP1_READY | \ SCRATCH_PAD_IOP0_READY | \ + SCRATCH_PAD_ILA_READY | \ + SCRATCH_PAD_RAAE_READY) +#define SCRATCH_PAD_MIPSALL_READY_8PORT (SCRATCH_PAD_IOP0_READY | \ + SCRATCH_PAD_ILA_READY | \ SCRATCH_PAD_RAAE_READY) =20 /* boot loader state */ --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 339E9C433EF for ; Mon, 14 Feb 2022 10:23:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346761AbiBNKXs (ORCPT ); Mon, 14 Feb 2022 05:23:48 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346640AbiBNKVt (ORCPT ); Mon, 14 Feb 2022 05:21:49 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 527037DE2B; Mon, 14 Feb 2022 01:55:54 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 38773B80DCF; Mon, 14 Feb 2022 09:55:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E7B0C340E9; Mon, 14 Feb 2022 09:55:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832544; bh=WoggJfzxZcsMjHbc6cnyNwotPtNHvkZ1EEsQdBd98pI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bg5n2UFVAYIJXV3sdKSkm3b1tMeiQ85EcEWk+lC3mYAzJrv/nle7x0N+Gcgd/lLoR nPR4JZSpix6jJ9+Vcxx4ArTe6wtmlKact5tePyIPoNwg+rCbiHJxo1FDVF8IFhwr7e C69fXDHBaEo5hWCzgoUsFtczLrgnXM/lVVdT7K7M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bart Van Assche , Kiwoong Kim , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.16 049/203] scsi: ufs: Use generic error code in ufshcd_set_dev_pwr_mode() Date: Mon, 14 Feb 2022 10:24:53 +0100 Message-Id: <20220214092511.882844129@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kiwoong Kim [ Upstream commit ad6c8a426446873febc98140d81d5353f8c0825b ] The return value of ufshcd_set_dev_pwr_mode() is passed to device PM core. However, the function currently returns a SCSI result which the PM core doesn't understand. This might lead to unexpected behaviors in userland; a platform reset was observed in Android. Use a generic error code for SSU failures. Link: https://lore.kernel.org/r/1642743182-54098-1-git-send-email-kwmad.kim= @samsung.com Reviewed-by: Bart Van Assche Signed-off-by: Kiwoong Kim Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/scsi/ufs/ufshcd.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index c94377aa82739..ec7d7e01231d7 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -8587,7 +8587,7 @@ static void ufshcd_hba_exit(struct ufs_hba *hba) * @pwr_mode: device power mode to set * * Returns 0 if requested power mode is set successfully - * Returns non-zero if failed to set the requested power mode + * Returns < 0 if failed to set the requested power mode */ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *hba, enum ufs_dev_pwr_mode pwr_mode) @@ -8641,8 +8641,11 @@ static int ufshcd_set_dev_pwr_mode(struct ufs_hba *h= ba, sdev_printk(KERN_WARNING, sdp, "START_STOP failed for power mode: %d, result %x\n", pwr_mode, ret); - if (ret > 0 && scsi_sense_valid(&sshdr)) - scsi_print_sense_hdr(sdp, NULL, &sshdr); + if (ret > 0) { + if (scsi_sense_valid(&sshdr)) + scsi_print_sense_hdr(sdp, NULL, &sshdr); + ret =3D -EIO; + } } =20 if (!ret) --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD3EDC433EF for ; Mon, 14 Feb 2022 10:23:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232060AbiBNKXi (ORCPT ); Mon, 14 Feb 2022 05:23:38 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:51018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347635AbiBNKVV (ORCPT ); Mon, 14 Feb 2022 05:21:21 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C9627DE14; Mon, 14 Feb 2022 01:55:49 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D766160F25; Mon, 14 Feb 2022 09:55:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6C59C340E9; Mon, 14 Feb 2022 09:55:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832548; bh=cfXOxnZgcPdfoYQeHM0c0yyXmHPUq5UCgsWsGd9TXlo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zre4T3VLD53RdA8dVh1rOC6B9bolWTIyL/vwKp73MiXzaBblYwsFpprvuq3j0GapC IMR8AL7eZt2+i15Qd2FEesPsB8z3DxZoIIa0FBuyIOI/hLqLTF0RB8QIAjjzQ+lD/g tmAflhqK3ozt+SF+tSgY0Yu2t7Zy8cibxvwWvDBQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kiwoong Kim , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.16 050/203] scsi: ufs: Treat link loss as fatal error Date: Mon, 14 Feb 2022 10:24:54 +0100 Message-Id: <20220214092511.919563337@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kiwoong Kim [ Upstream commit c99b9b2301492b665b6e51ba6c06ec362eddcd10 ] This event is raised when link is lost as specified in UFSHCI spec and that means communication is not possible. Thus initializing UFS interface needs to be done. Make UFS driver considers Link Lost as fatal in the INT_FATAL_ERRORS mask. This will trigger a host reset whenever a link lost interrupt occurs. Link: https://lore.kernel.org/r/1642743475-54275-1-git-send-email-kwmad.kim= @samsung.com Signed-off-by: Kiwoong Kim Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/scsi/ufs/ufshci.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshci.h b/drivers/scsi/ufs/ufshci.h index 6a295c88d850f..a7ff0e5b54946 100644 --- a/drivers/scsi/ufs/ufshci.h +++ b/drivers/scsi/ufs/ufshci.h @@ -142,7 +142,8 @@ static inline u32 ufshci_version(u32 major, u32 minor) #define INT_FATAL_ERRORS (DEVICE_FATAL_ERROR |\ CONTROLLER_FATAL_ERROR |\ SYSTEM_BUS_FATAL_ERROR |\ - CRYPTO_ENGINE_FATAL_ERROR) + CRYPTO_ENGINE_FATAL_ERROR |\ + UIC_LINK_LOST) =20 /* HCS - Host Controller Status 30h */ #define DEVICE_PRESENT 0x1 --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 435DCC433EF for ; Mon, 14 Feb 2022 10:23:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346284AbiBNKXu (ORCPT ); Mon, 14 Feb 2022 05:23:50 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:50518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346707AbiBNKVu (ORCPT ); Mon, 14 Feb 2022 05:21:50 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF09D7DE2F; Mon, 14 Feb 2022 01:55:55 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0D45761291; Mon, 14 Feb 2022 09:55:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5C4CC340E9; Mon, 14 Feb 2022 09:55:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832551; bh=JVnRg65Qwa1/CD39njIMCAjJPJZ+EuC+Z6Vt+4qdiKQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FnJUi9zTIHw6N9o0wZ6rn0kEomd7RGwf6C63y5/vULq/B9c81BkJiJlny3gq8oBTf W7ukqvnFpXs/rpgyzyupnuae1sFsqQSHpziBxkPuJhCPN2awiYMS1vK8M8bKELyrZq hTy3CVD5LaRnjmZTobRikYkOaVBuawP/b3kWf//c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hannes Reinecke , Tong Zhang , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.16 051/203] scsi: myrs: Fix crash in error case Date: Mon, 14 Feb 2022 10:24:55 +0100 Message-Id: <20220214092511.958621924@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tong Zhang [ Upstream commit 4db09593af0b0b4d7d4805ebb3273df51d7cc30d ] In myrs_detect(), cs->disable_intr is NULL when privdata->hw_init() fails with non-zero. In this case, myrs_cleanup(cs) will call a NULL ptr and crash the kernel. [ 1.105606] myrs 0000:00:03.0: Unknown Initialization Error 5A [ 1.105872] myrs 0000:00:03.0: Failed to initialize Controller [ 1.106082] BUG: kernel NULL pointer dereference, address: 0000000000000= 000 [ 1.110774] Call Trace: [ 1.110950] myrs_cleanup+0xe4/0x150 [myrs] [ 1.111135] myrs_probe.cold+0x91/0x56a [myrs] [ 1.111302] ? DAC960_GEM_intr_handler+0x1f0/0x1f0 [myrs] [ 1.111500] local_pci_probe+0x48/0x90 Link: https://lore.kernel.org/r/20220123225717.1069538-1-ztong0001@gmail.com Reviewed-by: Hannes Reinecke Signed-off-by: Tong Zhang Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/scsi/myrs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/myrs.c b/drivers/scsi/myrs.c index 6ea323e9a2e34..f6dbc8f2f60a3 100644 --- a/drivers/scsi/myrs.c +++ b/drivers/scsi/myrs.c @@ -2269,7 +2269,8 @@ static void myrs_cleanup(struct myrs_hba *cs) myrs_unmap(cs); =20 if (cs->mmio_base) { - cs->disable_intr(cs); + if (cs->disable_intr) + cs->disable_intr(cs); iounmap(cs->mmio_base); cs->mmio_base =3D NULL; } --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1AC8CC433FE for ; Mon, 14 Feb 2022 10:23:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241968AbiBNKYB (ORCPT ); Mon, 14 Feb 2022 05:24:01 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:54654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346755AbiBNKVu (ORCPT ); Mon, 14 Feb 2022 05:21:50 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B5936E4C4; Mon, 14 Feb 2022 01:55:58 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1D36161423; Mon, 14 Feb 2022 09:55:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F07BDC340F0; Mon, 14 Feb 2022 09:55:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832554; bh=yZu/qJOBLMvlTiAEKHkZfz0IwZ2rwR8KBC/aeSLQwLU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jE9alNEVy6nKpPLA/b6G0j+2ZkQV/8kDP9vxAEtzHEMsLvEew0LQ+/IinrkGa07vJ I1EwwF05xa4gbDCaJKs8GwL48ge5Os+C4Df1pD+UD2NLMfwvGSapTkre5tv/GEIn86 o1Cda4fzLo5hJIq7HvHgecR7AFl9TPkocA88o/rU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jisheng Zhang , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 052/203] net: stmmac: reduce unnecessary wakeups from eee sw timer Date: Mon, 14 Feb 2022 10:24:56 +0100 Message-Id: <20220214092511.991887370@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jisheng Zhang [ Upstream commit c74ead223deb88bdf18af8c772d7ca5a9b6c3c2b ] Currently, on EEE capable platforms, if EEE SW timer is used, the SW timer cause 1 wakeup/s even if the TX has successfully entered EEE. Remove this unnecessary wakeup by only calling mod_timer() if we haven't successfully entered EEE. Signed-off-by: Jisheng Zhang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/ne= t/ethernet/stmicro/stmmac/stmmac_main.c index c5ad28e543e43..f4015579e8adc 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -400,7 +400,7 @@ static void stmmac_lpi_entry_timer_config(struct stmmac= _priv *priv, bool en) * Description: this function is to verify and enter in LPI mode in case of * EEE. */ -static void stmmac_enable_eee_mode(struct stmmac_priv *priv) +static int stmmac_enable_eee_mode(struct stmmac_priv *priv) { u32 tx_cnt =3D priv->plat->tx_queues_to_use; u32 queue; @@ -410,13 +410,14 @@ static void stmmac_enable_eee_mode(struct stmmac_priv= *priv) struct stmmac_tx_queue *tx_q =3D &priv->tx_queue[queue]; =20 if (tx_q->dirty_tx !=3D tx_q->cur_tx) - return; /* still unfinished work */ + return -EBUSY; /* still unfinished work */ } =20 /* Check and enter in LPI mode */ if (!priv->tx_path_in_lpi_mode) stmmac_set_eee_mode(priv, priv->hw, priv->plat->en_tx_lpi_clockgating); + return 0; } =20 /** @@ -448,8 +449,8 @@ static void stmmac_eee_ctrl_timer(struct timer_list *t) { struct stmmac_priv *priv =3D from_timer(priv, t, eee_ctrl_timer); =20 - stmmac_enable_eee_mode(priv); - mod_timer(&priv->eee_ctrl_timer, STMMAC_LPI_T(priv->tx_lpi_timer)); + if (stmmac_enable_eee_mode(priv)) + mod_timer(&priv->eee_ctrl_timer, STMMAC_LPI_T(priv->tx_lpi_timer)); } =20 /** @@ -2641,8 +2642,8 @@ static int stmmac_tx_clean(struct stmmac_priv *priv, = int budget, u32 queue) =20 if (priv->eee_enabled && !priv->tx_path_in_lpi_mode && priv->eee_sw_timer_en) { - stmmac_enable_eee_mode(priv); - mod_timer(&priv->eee_ctrl_timer, STMMAC_LPI_T(priv->tx_lpi_timer)); + if (stmmac_enable_eee_mode(priv)) + mod_timer(&priv->eee_ctrl_timer, STMMAC_LPI_T(priv->tx_lpi_timer)); } =20 /* We still have pending packets, let's call for a new scheduling */ --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6425CC433EF for ; Mon, 14 Feb 2022 10:24:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242201AbiBNKYH (ORCPT ); Mon, 14 Feb 2022 05:24:07 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:50948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346764AbiBNKVu (ORCPT ); Mon, 14 Feb 2022 05:21:50 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D88076E4C6; Mon, 14 Feb 2022 01:55:58 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 11E406126B; Mon, 14 Feb 2022 09:55:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8662C340E9; Mon, 14 Feb 2022 09:55:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832557; bh=L2abX2J6L4mBx7bs32Xn/5k1qnjftTG1FoPZV+6UUe4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D4xuFk1eg+9Zyij6pm5cTRa3kUF/K7KFSBeD9foPMrvqZddU2bcbHNV1lQ7Foz3pP P41r/PrGaO7hgKo/YOuGjOvrZcei5RHfW3fDwWIpBGwbOM+AePmSujqPkxfjBMOogo SmSORLpLDGZ9fww5WgS9MZcIO94A17Q4+MOHFTNQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Amadeusz=20S=C5=82awi=C5=84ski?= , Cezary Rojewski , "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.16 053/203] PM: hibernate: Remove register_nosave_region_late() Date: Mon, 14 Feb 2022 10:24:57 +0100 Message-Id: <20220214092512.030572388@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Amadeusz S=C5=82awi=C5=84ski [ Upstream commit 33569ef3c754a82010f266b7b938a66a3ccf90a4 ] It is an unused wrapper forcing kmalloc allocation for registering nosave regions. Also, rename __register_nosave_region() to register_nosave_region() now that there is no need for disambiguation. Signed-off-by: Amadeusz S=C5=82awi=C5=84ski Reviewed-by: Cezary Rojewski Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- include/linux/suspend.h | 11 +---------- kernel/power/snapshot.c | 21 +++++++-------------- 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/include/linux/suspend.h b/include/linux/suspend.h index 8af13ba60c7e4..c1310c571d805 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h @@ -430,15 +430,7 @@ struct platform_hibernation_ops { =20 #ifdef CONFIG_HIBERNATION /* kernel/power/snapshot.c */ -extern void __register_nosave_region(unsigned long b, unsigned long e, int= km); -static inline void __init register_nosave_region(unsigned long b, unsigned= long e) -{ - __register_nosave_region(b, e, 0); -} -static inline void __init register_nosave_region_late(unsigned long b, uns= igned long e) -{ - __register_nosave_region(b, e, 1); -} +extern void register_nosave_region(unsigned long b, unsigned long e); extern int swsusp_page_is_forbidden(struct page *); extern void swsusp_set_page_free(struct page *); extern void swsusp_unset_page_free(struct page *); @@ -457,7 +449,6 @@ int pfn_is_nosave(unsigned long pfn); int hibernate_quiet_exec(int (*func)(void *data), void *data); #else /* CONFIG_HIBERNATION */ static inline void register_nosave_region(unsigned long b, unsigned long e= ) {} -static inline void register_nosave_region_late(unsigned long b, unsigned l= ong e) {} static inline int swsusp_page_is_forbidden(struct page *p) { return 0; } static inline void swsusp_set_page_free(struct page *p) {} static inline void swsusp_unset_page_free(struct page *p) {} diff --git a/kernel/power/snapshot.c b/kernel/power/snapshot.c index f7a9860782135..330d499376924 100644 --- a/kernel/power/snapshot.c +++ b/kernel/power/snapshot.c @@ -978,8 +978,7 @@ static void memory_bm_recycle(struct memory_bitmap *bm) * Register a range of page frames the contents of which should not be sav= ed * during hibernation (to be used in the early initialization code). */ -void __init __register_nosave_region(unsigned long start_pfn, - unsigned long end_pfn, int use_kmalloc) +void __init register_nosave_region(unsigned long start_pfn, unsigned long = end_pfn) { struct nosave_region *region; =20 @@ -995,18 +994,12 @@ void __init __register_nosave_region(unsigned long st= art_pfn, goto Report; } } - if (use_kmalloc) { - /* During init, this shouldn't fail */ - region =3D kmalloc(sizeof(struct nosave_region), GFP_KERNEL); - BUG_ON(!region); - } else { - /* This allocation cannot fail */ - region =3D memblock_alloc(sizeof(struct nosave_region), - SMP_CACHE_BYTES); - if (!region) - panic("%s: Failed to allocate %zu bytes\n", __func__, - sizeof(struct nosave_region)); - } + /* This allocation cannot fail */ + region =3D memblock_alloc(sizeof(struct nosave_region), + SMP_CACHE_BYTES); + if (!region) + panic("%s: Failed to allocate %zu bytes\n", __func__, + sizeof(struct nosave_region)); region->start_pfn =3D start_pfn; region->end_pfn =3D end_pfn; list_add_tail(®ion->list, &nosave_regions); --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7375C433F5 for ; Mon, 14 Feb 2022 10:24:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346735AbiBNKYU (ORCPT ); Mon, 14 Feb 2022 05:24:20 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:51594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346886AbiBNKWh (ORCPT ); Mon, 14 Feb 2022 05:22:37 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA3B26E4D7; Mon, 14 Feb 2022 01:56:01 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CC3C661374; Mon, 14 Feb 2022 09:56:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1FEE9C340E9; Mon, 14 Feb 2022 09:55:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832561; bh=x+JzvzguncQCVOMX0Rg/FQ3pS1phGr2bvV9dF2BG57s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZBHvPtzXjKlU6dDUf/U++lEUrdX8wkcH6RQYNX/wixRndh+l80ZKOz1XXemzqLHN3 Hwc8bOevVHEJ4Ty2u0E6sXTeQpDEq40enmqp3eQMFCLHDHJ/knuFXpJChOY9ass2wJ IhCYUCmbYE15yHfG9n8avJY2LFkP5W5sCk+er7Kw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhan Liu , Charlene Liu , Alex Deucher , Sasha Levin Subject: [PATCH 5.16 054/203] drm/amd/display: Correct MPC split policy for DCN301 Date: Mon, 14 Feb 2022 10:24:58 +0100 Message-Id: <20220214092512.069959392@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhan Liu [ Upstream commit ac46d93235074a6c5d280d35771c23fd8620e7d9 ] [Why] DCN301 has seamless boot enabled. With MPC split enabled at the same time, system will hang. [How] Revert MPC split policy back to "MPC_SPLIT_AVOID". Since we have ODM combine enabled on DCN301, pipe split is not necessary here. Signed-off-by: Zhan Liu Reviewed-by: Charlene Liu Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/gpu/drm/amd/display/dc/dcn301/dcn301_resource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/dcn301/dcn301_resource.c b/driv= ers/gpu/drm/amd/display/dc/dcn301/dcn301_resource.c index 9254da120e615..36814d44b19cf 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn301/dcn301_resource.c +++ b/drivers/gpu/drm/amd/display/dc/dcn301/dcn301_resource.c @@ -686,7 +686,7 @@ static const struct dc_debug_options debug_defaults_drv= =3D { .disable_clock_gate =3D true, .disable_pplib_clock_request =3D true, .disable_pplib_wm_range =3D true, - .pipe_split_policy =3D MPC_SPLIT_DYNAMIC, + .pipe_split_policy =3D MPC_SPLIT_AVOID, .force_single_disp_pipe_split =3D false, .disable_dcc =3D DCC_ENABLE, .vsr_support =3D true, --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0924C433EF for ; Mon, 14 Feb 2022 10:24:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346216AbiBNKYt (ORCPT ); Mon, 14 Feb 2022 05:24:49 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:49424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346323AbiBNKWw (ORCPT ); Mon, 14 Feb 2022 05:22:52 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3944E6CA51; Mon, 14 Feb 2022 01:56:06 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CD60BB80D83; Mon, 14 Feb 2022 09:56:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8A34C340E9; Mon, 14 Feb 2022 09:56:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832564; bh=qTrfWGKcQwK9/K1vsVW9O6dZ74LUQqD2R9r8ZglHc68=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1RlayJZzaZqXjWyPvGZDw8ZTZGteDiUBa8NfN/PaPT8je9Xti273uqFWOmW1S14XA ys6PDXSYXxhTlmcvowu0HaiCKsSS5tKvghzulIBRluyOhI59mzfJhDqGE26+oeVpZa p780SQygq0mFlZ2ARv0BUTujFK6ZPp1acGejbYnM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Harry Wentland , Alex Deucher , Sasha Levin Subject: [PATCH 5.16 055/203] drm/amdgpu/display: adjust msleep limit in dp_wait_for_training_aux_rd_interval Date: Mon, 14 Feb 2022 10:24:59 +0100 Message-Id: <20220214092512.114435140@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alex Deucher [ Upstream commit dc919d670c6fd1ac81ebf31625cd19579f7b3d4c ] Some architectures (e.g., ARM) have relatively low udelay limits. On most architectures, anything longer than 2000us is not recommended. Change the check to align with other similar checks in DC. Reviewed-by: Harry Wentland Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c b/drivers/gpu= /drm/amd/display/dc/core/dc_link_dp.c index ccd6cdbe46f43..b97be2e9088ce 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c @@ -201,7 +201,7 @@ void dp_wait_for_training_aux_rd_interval( uint32_t wait_in_micro_secs) { #if defined(CONFIG_DRM_AMD_DC_DCN) - if (wait_in_micro_secs > 16000) + if (wait_in_micro_secs > 1000) msleep(wait_in_micro_secs/1000); else udelay(wait_in_micro_secs); --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48036C43217 for ; Mon, 14 Feb 2022 10:24:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346583AbiBNKY0 (ORCPT ); Mon, 14 Feb 2022 05:24:26 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:57158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346959AbiBNKWw (ORCPT ); Mon, 14 Feb 2022 05:22:52 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 839586CA52; Mon, 14 Feb 2022 01:56:08 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2150D61456; Mon, 14 Feb 2022 09:56:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DAD1EC340E9; Mon, 14 Feb 2022 09:56:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832567; bh=1A7IgsR91FTYPNF5tJ+NY0HRqWFFQHbPO3KHIvT7IJ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IrzNkclxCdP0Tm/eSEVtwRs9J43b7Oe3kgk2QvocAZ04Nuwqnxx8LFxFacGc/CpiX p2bBFJLWs6VG077I2TnuCJVQCP0eunFh26U8SEdATAU9moI1qhWvDqFo+wXe2XSA1T DVNpd2L98YSLRIJAqMgbSS9bzrrDIrzy0xh8R53g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Harry Wentland , Alex Deucher , Sasha Levin Subject: [PATCH 5.16 056/203] drm/amdgpu/display: use msleep rather than udelay for long delays Date: Mon, 14 Feb 2022 10:25:00 +0100 Message-Id: <20220214092512.153253157@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alex Deucher [ Upstream commit 98fdcacb45f7cd2092151d6af2e60152811eb79c ] Some architectures (e.g., ARM) throw an compilation error if the udelay is too long. In general udelays of longer than 2000us are not recommended on any architecture. Switch to msleep in these cases. Reviewed-by: Harry Wentland Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c b/drivers/gpu= /drm/amd/display/dc/core/dc_link_dp.c index b97be2e9088ce..94e75199d9428 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c @@ -6058,7 +6058,7 @@ bool dpcd_write_128b_132b_sst_payload_allocation_tabl= e( } } retries++; - udelay(5000); + msleep(5); } =20 if (!result && retries =3D=3D max_retries) { @@ -6110,7 +6110,7 @@ bool dpcd_poll_for_allocation_change_trigger(struct d= c_link *link) break; } =20 - udelay(5000); + msleep(5); } =20 if (result =3D=3D ACT_FAILED) { --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8525CC433F5 for ; Mon, 14 Feb 2022 10:24:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346636AbiBNKYa (ORCPT ); Mon, 14 Feb 2022 05:24:30 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:53386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346572AbiBNKXA (ORCPT ); Mon, 14 Feb 2022 05:23:00 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C0E76E4EE; Mon, 14 Feb 2022 01:56:13 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E4389B80DC8; Mon, 14 Feb 2022 09:56:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EA64CC340E9; Mon, 14 Feb 2022 09:56:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832570; bh=WFqTIFbcouaApt5mdXLi6vKpn1Gu/pyOz2IiuG4k3xc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pQYPWWiNzAr2TDgqw9CksOnOjhJ8K+PXXqgTZUDMKHlLSS3UkZMUSlndJJVKDz+Gl dxJwJ9terA1Jtsma+u27irnw5/A7f/ZW5DRGPEzwszF9kQAfxThBBEkjxUrfo13/BJ jDT0b9HSitlDIT4IN57bCghGzQz6t8EptTYyyq5g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Minas Harutyunyan , Amelie Delaunay , Sasha Levin Subject: [PATCH 5.16 057/203] usb: dwc2: gadget: dont try to disable ep0 in dwc2_hsotg_suspend Date: Mon, 14 Feb 2022 10:25:01 +0100 Message-Id: <20220214092512.186924841@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Amelie Delaunay [ Upstream commit ac55d163855924aa5af9f1560977da8f346963c8 ] Calling dwc2_hsotg_ep_disable on ep0 (in/out) will lead to the following logs before returning -EINVAL: dwc2 49000000.usb-otg: dwc2_hsotg_ep_disable: called for ep0 dwc2 49000000.usb-otg: dwc2_hsotg_ep_disable: called for ep0 To avoid these two logs while suspending, start disabling the endpoint from the index 1, as done in dwc2_hsotg_udc_stop: /* all endpoints should be shutdown */ for (ep =3D 1; ep < hsotg->num_of_eps; ep++) { if (hsotg->eps_in[ep]) dwc2_hsotg_ep_disable_lock(&hsotg->eps_in[ep]->ep); if (hsotg->eps_out[ep]) dwc2_hsotg_ep_disable_lock(&hsotg->eps_out[ep]->ep); } Acked-by: Minas Harutyunyan Signed-off-by: Amelie Delaunay Link: https://lore.kernel.org/r/20211207130101.270314-1-amelie.delaunay@fos= s.st.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/usb/dwc2/gadget.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c index 43cf49c4e5e59..da82e4140d545 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -5097,7 +5097,7 @@ int dwc2_hsotg_suspend(struct dwc2_hsotg *hsotg) hsotg->gadget.speed =3D USB_SPEED_UNKNOWN; spin_unlock_irqrestore(&hsotg->lock, flags); =20 - for (ep =3D 0; ep < hsotg->num_of_eps; ep++) { + for (ep =3D 1; ep < hsotg->num_of_eps; ep++) { if (hsotg->eps_in[ep]) dwc2_hsotg_ep_disable_lock(&hsotg->eps_in[ep]->ep); if (hsotg->eps_out[ep]) --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DB92C433F5 for ; Mon, 14 Feb 2022 10:24:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346947AbiBNKYo (ORCPT ); Mon, 14 Feb 2022 05:24:44 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:50542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346966AbiBNKXJ (ORCPT ); Mon, 14 Feb 2022 05:23:09 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03F8860ABD; Mon, 14 Feb 2022 01:56:17 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 69CE060FA2; Mon, 14 Feb 2022 09:56:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30708C340E9; Mon, 14 Feb 2022 09:56:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832576; bh=rLhsafBCTYJ0kb1t3aQgksvKXgmCdBjj0TYBC5ydbvs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qr5X/Ib7TtF7pxsQwsLicwDuC4/Pd8XHsynGdYDOi2hWz9T62BbD6rhCXDd7MOCRE QC9vHv5zSTKOCuMleeof4JtobGf92jpAs4l3png3rvjozHG07J3fIqPaVXp7HfTfIh RvKPAnXU6MmvyLPN1UCgqxh0ZsfFhfu5dMru69Zg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ruben Ayrapetyan , James Clark , "Peter Zijlstra (Intel)" , Sasha Levin Subject: [PATCH 5.16 058/203] perf: Always wake the parent event Date: Mon, 14 Feb 2022 10:25:02 +0100 Message-Id: <20220214092512.228339005@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Clark [ Upstream commit 961c39121759ad09a89598ec4ccdd34ae0468a19 ] When using per-process mode and event inheritance is set to true, forked processes will create a new perf events via inherit_event() -> perf_event_alloc(). But these events will not have ring buffers assigned to them. Any call to wakeup will be dropped if it's called on an event with no ring buffer assigned because that's the object that holds the wakeup list. If the child event is disabled due to a call to perf_aux_output_begin() or perf_aux_output_end(), the wakeup is dropped leaving userspace hanging forever on the poll. Normally the event is explicitly re-enabled by userspace after it wakes up to read the aux data, but in this case it does not get woken up so the event remains disabled. This can be reproduced when using Arm SPE and 'stress' which forks once before running the workload. By looking at the list of aux buffers read, it's apparent that they stop after the fork: perf record -e arm_spe// -vvv -- stress -c 1 With this patch applied they continue to be printed. This behaviour doesn't happen when using systemwide or per-cpu mode. Reported-by: Ruben Ayrapetyan Signed-off-by: James Clark Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20211206113840.130802-2-james.clark@arm.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- kernel/events/core.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index 04e6e2dae60e4..a0e21d0f36d7a 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -6004,6 +6004,8 @@ static void ring_buffer_attach(struct perf_event *eve= nt, struct perf_buffer *old_rb =3D NULL; unsigned long flags; =20 + WARN_ON_ONCE(event->parent); + if (event->rb) { /* * Should be impossible, we set this when removing @@ -6061,6 +6063,9 @@ static void ring_buffer_wakeup(struct perf_event *eve= nt) { struct perf_buffer *rb; =20 + if (event->parent) + event =3D event->parent; + rcu_read_lock(); rb =3D rcu_dereference(event->rb); if (rb) { @@ -6074,6 +6079,9 @@ struct perf_buffer *ring_buffer_get(struct perf_event= *event) { struct perf_buffer *rb; =20 + if (event->parent) + event =3D event->parent; + rcu_read_lock(); rb =3D rcu_dereference(event->rb); if (rb) { @@ -6772,7 +6780,7 @@ static unsigned long perf_prepare_sample_aux(struct p= erf_event *event, if (WARN_ON_ONCE(READ_ONCE(sampler->oncpu) !=3D smp_processor_id())) goto out; =20 - rb =3D ring_buffer_get(sampler->parent ? sampler->parent : sampler); + rb =3D ring_buffer_get(sampler); if (!rb) goto out; =20 @@ -6838,7 +6846,7 @@ static void perf_aux_sample_output(struct perf_event = *event, if (WARN_ON_ONCE(!sampler || !data->aux_size)) return; =20 - rb =3D ring_buffer_get(sampler->parent ? sampler->parent : sampler); + rb =3D ring_buffer_get(sampler); if (!rb) return; =20 --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BBC5C433EF for ; Mon, 14 Feb 2022 10:24:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347023AbiBNKYw (ORCPT ); Mon, 14 Feb 2022 05:24:52 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:50546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347041AbiBNKXU (ORCPT ); Mon, 14 Feb 2022 05:23:20 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E56EC6CA5D; Mon, 14 Feb 2022 01:56:20 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 82A2960F25; Mon, 14 Feb 2022 09:56:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 644EDC340E9; Mon, 14 Feb 2022 09:56:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832580; bh=E/9jBRbIyyEtc+13I+rJm5xa1JZLQM7ZW8OBG5cbk8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AIXF5GDAM2R/BtpeqtotWNV6bpwqu0zRUNrz3RYmzNToPnSUGGU5Ps4Vg5NxuLbni GaoD8XY/Z92F5rc169M5yET94RsYFtCrH4EMCDvirUsXYgOKFWMm9IiVkHcWfqYIdz XGYt2vbxxG05J8nVwhsjL7q5a4IGJdDi300DVaZ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheng Wu , Ye Jinhe , Keith Busch , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.16 059/203] nvme-pci: add the IGNORE_DEV_SUBNQN quirk for Intel P4500/P4600 SSDs Date: Mon, 14 Feb 2022 10:25:03 +0100 Message-Id: <20220214092512.259122874@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wu Zheng [ Upstream commit 25e58af4be412d59e056da65cc1cefbd89185bd2 ] The Intel P4500/P4600 SSDs do not report a subsystem NQN despite claiming compliance to a standards version where reporting one is required. Add the IGNORE_DEV_SUBNQN quirk to not fail the initialization of a second such SSDs in a system. Signed-off-by: Zheng Wu Signed-off-by: Ye Jinhe Reviewed-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: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/nvme/host/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index ca2ee806d74b6..953ea3d5d4bfb 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -3326,7 +3326,8 @@ static const struct pci_device_id nvme_id_table[] =3D= { NVME_QUIRK_DEALLOCATE_ZEROES, }, { PCI_VDEVICE(INTEL, 0x0a54), /* Intel P4500/P4600 */ .driver_data =3D NVME_QUIRK_STRIPE_SIZE | - NVME_QUIRK_DEALLOCATE_ZEROES, }, + NVME_QUIRK_DEALLOCATE_ZEROES | + NVME_QUIRK_IGNORE_DEV_SUBNQN, }, { PCI_VDEVICE(INTEL, 0x0a55), /* Dell Express Flash P4600 */ .driver_data =3D NVME_QUIRK_STRIPE_SIZE | NVME_QUIRK_DEALLOCATE_ZEROES, }, --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFA80C433EF for ; Mon, 14 Feb 2022 10:24:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346857AbiBNKY4 (ORCPT ); Mon, 14 Feb 2022 05:24:56 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:53410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347100AbiBNKXm (ORCPT ); Mon, 14 Feb 2022 05:23:42 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 346D46CA66; Mon, 14 Feb 2022 01:56:24 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B7A1E61183; Mon, 14 Feb 2022 09:56:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6EDC1C340E9; Mon, 14 Feb 2022 09:56:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832583; bh=znVR6a2LcZIz3IM5xQh8puk/jSKkRJbrkCAjfY5E4qU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NhntM9sPAdcKqqOC90OUpCH6YUJSKShqg1X29egfIk9AiQEnGXJbE8h/3hJZqZURF o+IlShxrrZtiRwMg+gU9njRLoYHCw277GB6Jc0kM2ES7I55tdTKJm+mgwD0Zx+FXCO Kw1ymZERFjFCI1HDTs41zIbIK+7QEXFM12bp73mQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.16 060/203] MIPS: Fix build error due to PTR used in more places Date: Mon, 14 Feb 2022 10:25:04 +0100 Message-Id: <20220214092512.295180615@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Bogendoerfer [ Upstream commit fa62f39dc7e25fc16371b958ac59b9a6fd260bea ] Use PTR_WD instead of PTR to avoid clashes with other parts. Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/mips/include/asm/asm.h | 4 +- arch/mips/include/asm/ftrace.h | 4 +- arch/mips/include/asm/r4kcache.h | 4 +- arch/mips/include/asm/unaligned-emul.h | 176 ++++++++++++------------- arch/mips/kernel/mips-r2-to-r6-emul.c | 104 +++++++-------- arch/mips/kernel/r2300_fpu.S | 6 +- arch/mips/kernel/r4k_fpu.S | 2 +- arch/mips/kernel/relocate_kernel.S | 22 ++-- arch/mips/kernel/scall32-o32.S | 10 +- arch/mips/kernel/scall64-n32.S | 2 +- arch/mips/kernel/scall64-n64.S | 2 +- arch/mips/kernel/scall64-o32.S | 10 +- arch/mips/kernel/syscall.c | 8 +- arch/mips/lib/csum_partial.S | 4 +- arch/mips/lib/memcpy.S | 4 +- arch/mips/lib/memset.S | 2 +- arch/mips/lib/strncpy_user.S | 4 +- arch/mips/lib/strnlen_user.S | 2 +- 18 files changed, 185 insertions(+), 185 deletions(-) diff --git a/arch/mips/include/asm/asm.h b/arch/mips/include/asm/asm.h index 2f8ce94ebaafe..cc69f1deb1ca8 100644 --- a/arch/mips/include/asm/asm.h +++ b/arch/mips/include/asm/asm.h @@ -276,7 +276,7 @@ symbol =3D value =20 #define PTR_SCALESHIFT 2 =20 -#define PTR .word +#define PTR_WD .word #define PTRSIZE 4 #define PTRLOG 2 #endif @@ -301,7 +301,7 @@ symbol =3D value =20 #define PTR_SCALESHIFT 3 =20 -#define PTR .dword +#define PTR_WD .dword #define PTRSIZE 8 #define PTRLOG 3 #endif diff --git a/arch/mips/include/asm/ftrace.h b/arch/mips/include/asm/ftrace.h index b463f2aa5a613..db497a8167da2 100644 --- a/arch/mips/include/asm/ftrace.h +++ b/arch/mips/include/asm/ftrace.h @@ -32,7 +32,7 @@ do { \ ".previous\n" \ \ ".section\t__ex_table,\"a\"\n\t" \ - STR(PTR) "\t1b, 3b\n\t" \ + STR(PTR_WD) "\t1b, 3b\n\t" \ ".previous\n" \ \ : [tmp_dst] "=3D&r" (dst), [tmp_err] "=3Dr" (error)\ @@ -54,7 +54,7 @@ do { \ ".previous\n" \ \ ".section\t__ex_table,\"a\"\n\t"\ - STR(PTR) "\t1b, 3b\n\t" \ + STR(PTR_WD) "\t1b, 3b\n\t" \ ".previous\n" \ \ : [tmp_err] "=3Dr" (error) \ diff --git a/arch/mips/include/asm/r4kcache.h b/arch/mips/include/asm/r4kca= che.h index af3788589ee6d..431a1c9d53fc7 100644 --- a/arch/mips/include/asm/r4kcache.h +++ b/arch/mips/include/asm/r4kcache.h @@ -119,7 +119,7 @@ static inline void flush_scache_line(unsigned long addr) " j 2b \n" \ " .previous \n" \ " .section __ex_table,\"a\" \n" \ - " "STR(PTR)" 1b, 3b \n" \ + " "STR(PTR_WD)" 1b, 3b \n" \ " .previous" \ : "+r" (__err) \ : "i" (op), "r" (addr), "i" (-EFAULT)); \ @@ -142,7 +142,7 @@ static inline void flush_scache_line(unsigned long addr) " j 2b \n" \ " .previous \n" \ " .section __ex_table,\"a\" \n" \ - " "STR(PTR)" 1b, 3b \n" \ + " "STR(PTR_WD)" 1b, 3b \n" \ " .previous" \ : "+r" (__err) \ : "i" (op), "r" (addr), "i" (-EFAULT)); \ diff --git a/arch/mips/include/asm/unaligned-emul.h b/arch/mips/include/asm= /unaligned-emul.h index 2022b18944b97..9af0f4d3d288c 100644 --- a/arch/mips/include/asm/unaligned-emul.h +++ b/arch/mips/include/asm/unaligned-emul.h @@ -20,8 +20,8 @@ do { \ "j\t3b\n\t" \ ".previous\n\t" \ ".section\t__ex_table,\"a\"\n\t" \ - STR(PTR)"\t1b, 4b\n\t" \ - STR(PTR)"\t2b, 4b\n\t" \ + STR(PTR_WD)"\t1b, 4b\n\t" \ + STR(PTR_WD)"\t2b, 4b\n\t" \ ".previous" \ : "=3D&r" (value), "=3Dr" (res) \ : "r" (addr), "i" (-EFAULT)); \ @@ -41,8 +41,8 @@ do { \ "j\t3b\n\t" \ ".previous\n\t" \ ".section\t__ex_table,\"a\"\n\t" \ - STR(PTR)"\t1b, 4b\n\t" \ - STR(PTR)"\t2b, 4b\n\t" \ + STR(PTR_WD)"\t1b, 4b\n\t" \ + STR(PTR_WD)"\t2b, 4b\n\t" \ ".previous" \ : "=3D&r" (value), "=3Dr" (res) \ : "r" (addr), "i" (-EFAULT)); \ @@ -74,10 +74,10 @@ do { \ "j\t10b\n\t" \ ".previous\n\t" \ ".section\t__ex_table,\"a\"\n\t" \ - STR(PTR)"\t1b, 11b\n\t" \ - STR(PTR)"\t2b, 11b\n\t" \ - STR(PTR)"\t3b, 11b\n\t" \ - STR(PTR)"\t4b, 11b\n\t" \ + STR(PTR_WD)"\t1b, 11b\n\t" \ + STR(PTR_WD)"\t2b, 11b\n\t" \ + STR(PTR_WD)"\t3b, 11b\n\t" \ + STR(PTR_WD)"\t4b, 11b\n\t" \ ".previous" \ : "=3D&r" (value), "=3Dr" (res) \ : "r" (addr), "i" (-EFAULT)); \ @@ -102,8 +102,8 @@ do { \ "j\t3b\n\t" \ ".previous\n\t" \ ".section\t__ex_table,\"a\"\n\t" \ - STR(PTR)"\t1b, 4b\n\t" \ - STR(PTR)"\t2b, 4b\n\t" \ + STR(PTR_WD)"\t1b, 4b\n\t" \ + STR(PTR_WD)"\t2b, 4b\n\t" \ ".previous" \ : "=3D&r" (value), "=3Dr" (res) \ : "r" (addr), "i" (-EFAULT)); \ @@ -125,8 +125,8 @@ do { \ "j\t3b\n\t" \ ".previous\n\t" \ ".section\t__ex_table,\"a\"\n\t" \ - STR(PTR)"\t1b, 4b\n\t" \ - STR(PTR)"\t2b, 4b\n\t" \ + STR(PTR_WD)"\t1b, 4b\n\t" \ + STR(PTR_WD)"\t2b, 4b\n\t" \ ".previous" \ : "=3D&r" (value), "=3Dr" (res) \ : "r" (addr), "i" (-EFAULT)); \ @@ -145,8 +145,8 @@ do { \ "j\t3b\n\t" \ ".previous\n\t" \ ".section\t__ex_table,\"a\"\n\t" \ - STR(PTR)"\t1b, 4b\n\t" \ - STR(PTR)"\t2b, 4b\n\t" \ + STR(PTR_WD)"\t1b, 4b\n\t" \ + STR(PTR_WD)"\t2b, 4b\n\t" \ ".previous" \ : "=3D&r" (value), "=3Dr" (res) \ : "r" (addr), "i" (-EFAULT)); \ @@ -178,10 +178,10 @@ do { \ "j\t10b\n\t" \ ".previous\n\t" \ ".section\t__ex_table,\"a\"\n\t" \ - STR(PTR)"\t1b, 11b\n\t" \ - STR(PTR)"\t2b, 11b\n\t" \ - STR(PTR)"\t3b, 11b\n\t" \ - STR(PTR)"\t4b, 11b\n\t" \ + STR(PTR_WD)"\t1b, 11b\n\t" \ + STR(PTR_WD)"\t2b, 11b\n\t" \ + STR(PTR_WD)"\t3b, 11b\n\t" \ + STR(PTR_WD)"\t4b, 11b\n\t" \ ".previous" \ : "=3D&r" (value), "=3Dr" (res) \ : "r" (addr), "i" (-EFAULT)); \ @@ -223,14 +223,14 @@ do { \ "j\t10b\n\t" \ ".previous\n\t" \ ".section\t__ex_table,\"a\"\n\t" \ - STR(PTR)"\t1b, 11b\n\t" \ - STR(PTR)"\t2b, 11b\n\t" \ - STR(PTR)"\t3b, 11b\n\t" \ - STR(PTR)"\t4b, 11b\n\t" \ - STR(PTR)"\t5b, 11b\n\t" \ - STR(PTR)"\t6b, 11b\n\t" \ - STR(PTR)"\t7b, 11b\n\t" \ - STR(PTR)"\t8b, 11b\n\t" \ + STR(PTR_WD)"\t1b, 11b\n\t" \ + STR(PTR_WD)"\t2b, 11b\n\t" \ + STR(PTR_WD)"\t3b, 11b\n\t" \ + STR(PTR_WD)"\t4b, 11b\n\t" \ + STR(PTR_WD)"\t5b, 11b\n\t" \ + STR(PTR_WD)"\t6b, 11b\n\t" \ + STR(PTR_WD)"\t7b, 11b\n\t" \ + STR(PTR_WD)"\t8b, 11b\n\t" \ ".previous" \ : "=3D&r" (value), "=3Dr" (res) \ : "r" (addr), "i" (-EFAULT)); \ @@ -255,8 +255,8 @@ do { \ "j\t3b\n\t" \ ".previous\n\t" \ ".section\t__ex_table,\"a\"\n\t" \ - STR(PTR)"\t1b, 4b\n\t" \ - STR(PTR)"\t2b, 4b\n\t" \ + STR(PTR_WD)"\t1b, 4b\n\t" \ + STR(PTR_WD)"\t2b, 4b\n\t" \ ".previous" \ : "=3Dr" (res) \ : "r" (value), "r" (addr), "i" (-EFAULT));\ @@ -276,8 +276,8 @@ do { \ "j\t3b\n\t" \ ".previous\n\t" \ ".section\t__ex_table,\"a\"\n\t" \ - STR(PTR)"\t1b, 4b\n\t" \ - STR(PTR)"\t2b, 4b\n\t" \ + STR(PTR_WD)"\t1b, 4b\n\t" \ + STR(PTR_WD)"\t2b, 4b\n\t" \ ".previous" \ : "=3Dr" (res) \ : "r" (value), "r" (addr), "i" (-EFAULT)); \ @@ -296,8 +296,8 @@ do { \ "j\t3b\n\t" \ ".previous\n\t" \ ".section\t__ex_table,\"a\"\n\t" \ - STR(PTR)"\t1b, 4b\n\t" \ - STR(PTR)"\t2b, 4b\n\t" \ + STR(PTR_WD)"\t1b, 4b\n\t" \ + STR(PTR_WD)"\t2b, 4b\n\t" \ ".previous" \ : "=3Dr" (res) \ : "r" (value), "r" (addr), "i" (-EFAULT)); \ @@ -325,10 +325,10 @@ do { \ "j\t10b\n\t" \ ".previous\n\t" \ ".section\t__ex_table,\"a\"\n\t" \ - STR(PTR)"\t1b, 11b\n\t" \ - STR(PTR)"\t2b, 11b\n\t" \ - STR(PTR)"\t3b, 11b\n\t" \ - STR(PTR)"\t4b, 11b\n\t" \ + STR(PTR_WD)"\t1b, 11b\n\t" \ + STR(PTR_WD)"\t2b, 11b\n\t" \ + STR(PTR_WD)"\t3b, 11b\n\t" \ + STR(PTR_WD)"\t4b, 11b\n\t" \ ".previous" \ : "=3D&r" (res) \ : "r" (value), "r" (addr), "i" (-EFAULT) \ @@ -365,14 +365,14 @@ do { \ "j\t10b\n\t" \ ".previous\n\t" \ ".section\t__ex_table,\"a\"\n\t" \ - STR(PTR)"\t1b, 11b\n\t" \ - STR(PTR)"\t2b, 11b\n\t" \ - STR(PTR)"\t3b, 11b\n\t" \ - STR(PTR)"\t4b, 11b\n\t" \ - STR(PTR)"\t5b, 11b\n\t" \ - STR(PTR)"\t6b, 11b\n\t" \ - STR(PTR)"\t7b, 11b\n\t" \ - STR(PTR)"\t8b, 11b\n\t" \ + STR(PTR_WD)"\t1b, 11b\n\t" \ + STR(PTR_WD)"\t2b, 11b\n\t" \ + STR(PTR_WD)"\t3b, 11b\n\t" \ + STR(PTR_WD)"\t4b, 11b\n\t" \ + STR(PTR_WD)"\t5b, 11b\n\t" \ + STR(PTR_WD)"\t6b, 11b\n\t" \ + STR(PTR_WD)"\t7b, 11b\n\t" \ + STR(PTR_WD)"\t8b, 11b\n\t" \ ".previous" \ : "=3D&r" (res) \ : "r" (value), "r" (addr), "i" (-EFAULT) \ @@ -398,8 +398,8 @@ do { \ "j\t3b\n\t" \ ".previous\n\t" \ ".section\t__ex_table,\"a\"\n\t" \ - STR(PTR)"\t1b, 4b\n\t" \ - STR(PTR)"\t2b, 4b\n\t" \ + STR(PTR_WD)"\t1b, 4b\n\t" \ + STR(PTR_WD)"\t2b, 4b\n\t" \ ".previous" \ : "=3D&r" (value), "=3Dr" (res) \ : "r" (addr), "i" (-EFAULT)); \ @@ -419,8 +419,8 @@ do { \ "j\t3b\n\t" \ ".previous\n\t" \ ".section\t__ex_table,\"a\"\n\t" \ - STR(PTR)"\t1b, 4b\n\t" \ - STR(PTR)"\t2b, 4b\n\t" \ + STR(PTR_WD)"\t1b, 4b\n\t" \ + STR(PTR_WD)"\t2b, 4b\n\t" \ ".previous" \ : "=3D&r" (value), "=3Dr" (res) \ : "r" (addr), "i" (-EFAULT)); \ @@ -452,10 +452,10 @@ do { \ "j\t10b\n\t" \ ".previous\n\t" \ ".section\t__ex_table,\"a\"\n\t" \ - STR(PTR)"\t1b, 11b\n\t" \ - STR(PTR)"\t2b, 11b\n\t" \ - STR(PTR)"\t3b, 11b\n\t" \ - STR(PTR)"\t4b, 11b\n\t" \ + STR(PTR_WD)"\t1b, 11b\n\t" \ + STR(PTR_WD)"\t2b, 11b\n\t" \ + STR(PTR_WD)"\t3b, 11b\n\t" \ + STR(PTR_WD)"\t4b, 11b\n\t" \ ".previous" \ : "=3D&r" (value), "=3Dr" (res) \ : "r" (addr), "i" (-EFAULT)); \ @@ -481,8 +481,8 @@ do { \ "j\t3b\n\t" \ ".previous\n\t" \ ".section\t__ex_table,\"a\"\n\t" \ - STR(PTR)"\t1b, 4b\n\t" \ - STR(PTR)"\t2b, 4b\n\t" \ + STR(PTR_WD)"\t1b, 4b\n\t" \ + STR(PTR_WD)"\t2b, 4b\n\t" \ ".previous" \ : "=3D&r" (value), "=3Dr" (res) \ : "r" (addr), "i" (-EFAULT)); \ @@ -504,8 +504,8 @@ do { \ "j\t3b\n\t" \ ".previous\n\t" \ ".section\t__ex_table,\"a\"\n\t" \ - STR(PTR)"\t1b, 4b\n\t" \ - STR(PTR)"\t2b, 4b\n\t" \ + STR(PTR_WD)"\t1b, 4b\n\t" \ + STR(PTR_WD)"\t2b, 4b\n\t" \ ".previous" \ : "=3D&r" (value), "=3Dr" (res) \ : "r" (addr), "i" (-EFAULT)); \ @@ -524,8 +524,8 @@ do { \ "j\t3b\n\t" \ ".previous\n\t" \ ".section\t__ex_table,\"a\"\n\t" \ - STR(PTR)"\t1b, 4b\n\t" \ - STR(PTR)"\t2b, 4b\n\t" \ + STR(PTR_WD)"\t1b, 4b\n\t" \ + STR(PTR_WD)"\t2b, 4b\n\t" \ ".previous" \ : "=3D&r" (value), "=3Dr" (res) \ : "r" (addr), "i" (-EFAULT)); \ @@ -557,10 +557,10 @@ do { \ "j\t10b\n\t" \ ".previous\n\t" \ ".section\t__ex_table,\"a\"\n\t" \ - STR(PTR)"\t1b, 11b\n\t" \ - STR(PTR)"\t2b, 11b\n\t" \ - STR(PTR)"\t3b, 11b\n\t" \ - STR(PTR)"\t4b, 11b\n\t" \ + STR(PTR_WD)"\t1b, 11b\n\t" \ + STR(PTR_WD)"\t2b, 11b\n\t" \ + STR(PTR_WD)"\t3b, 11b\n\t" \ + STR(PTR_WD)"\t4b, 11b\n\t" \ ".previous" \ : "=3D&r" (value), "=3Dr" (res) \ : "r" (addr), "i" (-EFAULT)); \ @@ -602,14 +602,14 @@ do { \ "j\t10b\n\t" \ ".previous\n\t" \ ".section\t__ex_table,\"a\"\n\t" \ - STR(PTR)"\t1b, 11b\n\t" \ - STR(PTR)"\t2b, 11b\n\t" \ - STR(PTR)"\t3b, 11b\n\t" \ - STR(PTR)"\t4b, 11b\n\t" \ - STR(PTR)"\t5b, 11b\n\t" \ - STR(PTR)"\t6b, 11b\n\t" \ - STR(PTR)"\t7b, 11b\n\t" \ - STR(PTR)"\t8b, 11b\n\t" \ + STR(PTR_WD)"\t1b, 11b\n\t" \ + STR(PTR_WD)"\t2b, 11b\n\t" \ + STR(PTR_WD)"\t3b, 11b\n\t" \ + STR(PTR_WD)"\t4b, 11b\n\t" \ + STR(PTR_WD)"\t5b, 11b\n\t" \ + STR(PTR_WD)"\t6b, 11b\n\t" \ + STR(PTR_WD)"\t7b, 11b\n\t" \ + STR(PTR_WD)"\t8b, 11b\n\t" \ ".previous" \ : "=3D&r" (value), "=3Dr" (res) \ : "r" (addr), "i" (-EFAULT)); \ @@ -632,8 +632,8 @@ do { \ "j\t3b\n\t" \ ".previous\n\t" \ ".section\t__ex_table,\"a\"\n\t" \ - STR(PTR)"\t1b, 4b\n\t" \ - STR(PTR)"\t2b, 4b\n\t" \ + STR(PTR_WD)"\t1b, 4b\n\t" \ + STR(PTR_WD)"\t2b, 4b\n\t" \ ".previous" \ : "=3Dr" (res) \ : "r" (value), "r" (addr), "i" (-EFAULT));\ @@ -653,8 +653,8 @@ do { \ "j\t3b\n\t" \ ".previous\n\t" \ ".section\t__ex_table,\"a\"\n\t" \ - STR(PTR)"\t1b, 4b\n\t" \ - STR(PTR)"\t2b, 4b\n\t" \ + STR(PTR_WD)"\t1b, 4b\n\t" \ + STR(PTR_WD)"\t2b, 4b\n\t" \ ".previous" \ : "=3Dr" (res) \ : "r" (value), "r" (addr), "i" (-EFAULT)); \ @@ -673,8 +673,8 @@ do { \ "j\t3b\n\t" \ ".previous\n\t" \ ".section\t__ex_table,\"a\"\n\t" \ - STR(PTR)"\t1b, 4b\n\t" \ - STR(PTR)"\t2b, 4b\n\t" \ + STR(PTR_WD)"\t1b, 4b\n\t" \ + STR(PTR_WD)"\t2b, 4b\n\t" \ ".previous" \ : "=3Dr" (res) \ : "r" (value), "r" (addr), "i" (-EFAULT)); \ @@ -703,10 +703,10 @@ do { \ "j\t10b\n\t" \ ".previous\n\t" \ ".section\t__ex_table,\"a\"\n\t" \ - STR(PTR)"\t1b, 11b\n\t" \ - STR(PTR)"\t2b, 11b\n\t" \ - STR(PTR)"\t3b, 11b\n\t" \ - STR(PTR)"\t4b, 11b\n\t" \ + STR(PTR_WD)"\t1b, 11b\n\t" \ + STR(PTR_WD)"\t2b, 11b\n\t" \ + STR(PTR_WD)"\t3b, 11b\n\t" \ + STR(PTR_WD)"\t4b, 11b\n\t" \ ".previous" \ : "=3D&r" (res) \ : "r" (value), "r" (addr), "i" (-EFAULT) \ @@ -743,14 +743,14 @@ do { \ "j\t10b\n\t" \ ".previous\n\t" \ ".section\t__ex_table,\"a\"\n\t" \ - STR(PTR)"\t1b, 11b\n\t" \ - STR(PTR)"\t2b, 11b\n\t" \ - STR(PTR)"\t3b, 11b\n\t" \ - STR(PTR)"\t4b, 11b\n\t" \ - STR(PTR)"\t5b, 11b\n\t" \ - STR(PTR)"\t6b, 11b\n\t" \ - STR(PTR)"\t7b, 11b\n\t" \ - STR(PTR)"\t8b, 11b\n\t" \ + STR(PTR_WD)"\t1b, 11b\n\t" \ + STR(PTR_WD)"\t2b, 11b\n\t" \ + STR(PTR_WD)"\t3b, 11b\n\t" \ + STR(PTR_WD)"\t4b, 11b\n\t" \ + STR(PTR_WD)"\t5b, 11b\n\t" \ + STR(PTR_WD)"\t6b, 11b\n\t" \ + STR(PTR_WD)"\t7b, 11b\n\t" \ + STR(PTR_WD)"\t8b, 11b\n\t" \ ".previous" \ : "=3D&r" (res) \ : "r" (value), "r" (addr), "i" (-EFAULT) \ diff --git a/arch/mips/kernel/mips-r2-to-r6-emul.c b/arch/mips/kernel/mips-= r2-to-r6-emul.c index a39ec755e4c24..750fe569862b6 100644 --- a/arch/mips/kernel/mips-r2-to-r6-emul.c +++ b/arch/mips/kernel/mips-r2-to-r6-emul.c @@ -1258,10 +1258,10 @@ int mipsr2_decoder(struct pt_regs *regs, u32 inst, = unsigned long *fcr31) " j 10b\n" " .previous\n" " .section __ex_table,\"a\"\n" - STR(PTR) " 1b,8b\n" - STR(PTR) " 2b,8b\n" - STR(PTR) " 3b,8b\n" - STR(PTR) " 4b,8b\n" + STR(PTR_WD) " 1b,8b\n" + STR(PTR_WD) " 2b,8b\n" + STR(PTR_WD) " 3b,8b\n" + STR(PTR_WD) " 4b,8b\n" " .previous\n" " .set pop\n" : "+&r"(rt), "=3D&r"(rs), @@ -1333,10 +1333,10 @@ int mipsr2_decoder(struct pt_regs *regs, u32 inst, = unsigned long *fcr31) " j 10b\n" " .previous\n" " .section __ex_table,\"a\"\n" - STR(PTR) " 1b,8b\n" - STR(PTR) " 2b,8b\n" - STR(PTR) " 3b,8b\n" - STR(PTR) " 4b,8b\n" + STR(PTR_WD) " 1b,8b\n" + STR(PTR_WD) " 2b,8b\n" + STR(PTR_WD) " 3b,8b\n" + STR(PTR_WD) " 4b,8b\n" " .previous\n" " .set pop\n" : "+&r"(rt), "=3D&r"(rs), @@ -1404,10 +1404,10 @@ int mipsr2_decoder(struct pt_regs *regs, u32 inst, = unsigned long *fcr31) " j 9b\n" " .previous\n" " .section __ex_table,\"a\"\n" - STR(PTR) " 1b,8b\n" - STR(PTR) " 2b,8b\n" - STR(PTR) " 3b,8b\n" - STR(PTR) " 4b,8b\n" + STR(PTR_WD) " 1b,8b\n" + STR(PTR_WD) " 2b,8b\n" + STR(PTR_WD) " 3b,8b\n" + STR(PTR_WD) " 4b,8b\n" " .previous\n" " .set pop\n" : "+&r"(rt), "=3D&r"(rs), @@ -1474,10 +1474,10 @@ int mipsr2_decoder(struct pt_regs *regs, u32 inst, = unsigned long *fcr31) " j 9b\n" " .previous\n" " .section __ex_table,\"a\"\n" - STR(PTR) " 1b,8b\n" - STR(PTR) " 2b,8b\n" - STR(PTR) " 3b,8b\n" - STR(PTR) " 4b,8b\n" + STR(PTR_WD) " 1b,8b\n" + STR(PTR_WD) " 2b,8b\n" + STR(PTR_WD) " 3b,8b\n" + STR(PTR_WD) " 4b,8b\n" " .previous\n" " .set pop\n" : "+&r"(rt), "=3D&r"(rs), @@ -1589,14 +1589,14 @@ int mipsr2_decoder(struct pt_regs *regs, u32 inst, = unsigned long *fcr31) " j 9b\n" " .previous\n" " .section __ex_table,\"a\"\n" - STR(PTR) " 1b,8b\n" - STR(PTR) " 2b,8b\n" - STR(PTR) " 3b,8b\n" - STR(PTR) " 4b,8b\n" - STR(PTR) " 5b,8b\n" - STR(PTR) " 6b,8b\n" - STR(PTR) " 7b,8b\n" - STR(PTR) " 0b,8b\n" + STR(PTR_WD) " 1b,8b\n" + STR(PTR_WD) " 2b,8b\n" + STR(PTR_WD) " 3b,8b\n" + STR(PTR_WD) " 4b,8b\n" + STR(PTR_WD) " 5b,8b\n" + STR(PTR_WD) " 6b,8b\n" + STR(PTR_WD) " 7b,8b\n" + STR(PTR_WD) " 0b,8b\n" " .previous\n" " .set pop\n" : "+&r"(rt), "=3D&r"(rs), @@ -1708,14 +1708,14 @@ int mipsr2_decoder(struct pt_regs *regs, u32 inst, = unsigned long *fcr31) " j 9b\n" " .previous\n" " .section __ex_table,\"a\"\n" - STR(PTR) " 1b,8b\n" - STR(PTR) " 2b,8b\n" - STR(PTR) " 3b,8b\n" - STR(PTR) " 4b,8b\n" - STR(PTR) " 5b,8b\n" - STR(PTR) " 6b,8b\n" - STR(PTR) " 7b,8b\n" - STR(PTR) " 0b,8b\n" + STR(PTR_WD) " 1b,8b\n" + STR(PTR_WD) " 2b,8b\n" + STR(PTR_WD) " 3b,8b\n" + STR(PTR_WD) " 4b,8b\n" + STR(PTR_WD) " 5b,8b\n" + STR(PTR_WD) " 6b,8b\n" + STR(PTR_WD) " 7b,8b\n" + STR(PTR_WD) " 0b,8b\n" " .previous\n" " .set pop\n" : "+&r"(rt), "=3D&r"(rs), @@ -1827,14 +1827,14 @@ int mipsr2_decoder(struct pt_regs *regs, u32 inst, = unsigned long *fcr31) " j 9b\n" " .previous\n" " .section __ex_table,\"a\"\n" - STR(PTR) " 1b,8b\n" - STR(PTR) " 2b,8b\n" - STR(PTR) " 3b,8b\n" - STR(PTR) " 4b,8b\n" - STR(PTR) " 5b,8b\n" - STR(PTR) " 6b,8b\n" - STR(PTR) " 7b,8b\n" - STR(PTR) " 0b,8b\n" + STR(PTR_WD) " 1b,8b\n" + STR(PTR_WD) " 2b,8b\n" + STR(PTR_WD) " 3b,8b\n" + STR(PTR_WD) " 4b,8b\n" + STR(PTR_WD) " 5b,8b\n" + STR(PTR_WD) " 6b,8b\n" + STR(PTR_WD) " 7b,8b\n" + STR(PTR_WD) " 0b,8b\n" " .previous\n" " .set pop\n" : "+&r"(rt), "=3D&r"(rs), @@ -1945,14 +1945,14 @@ int mipsr2_decoder(struct pt_regs *regs, u32 inst, = unsigned long *fcr31) " j 9b\n" " .previous\n" " .section __ex_table,\"a\"\n" - STR(PTR) " 1b,8b\n" - STR(PTR) " 2b,8b\n" - STR(PTR) " 3b,8b\n" - STR(PTR) " 4b,8b\n" - STR(PTR) " 5b,8b\n" - STR(PTR) " 6b,8b\n" - STR(PTR) " 7b,8b\n" - STR(PTR) " 0b,8b\n" + STR(PTR_WD) " 1b,8b\n" + STR(PTR_WD) " 2b,8b\n" + STR(PTR_WD) " 3b,8b\n" + STR(PTR_WD) " 4b,8b\n" + STR(PTR_WD) " 5b,8b\n" + STR(PTR_WD) " 6b,8b\n" + STR(PTR_WD) " 7b,8b\n" + STR(PTR_WD) " 0b,8b\n" " .previous\n" " .set pop\n" : "+&r"(rt), "=3D&r"(rs), @@ -2007,7 +2007,7 @@ int mipsr2_decoder(struct pt_regs *regs, u32 inst, un= signed long *fcr31) "j 2b\n" ".previous\n" ".section __ex_table,\"a\"\n" - STR(PTR) " 1b,3b\n" + STR(PTR_WD) " 1b,3b\n" ".previous\n" : "=3D&r"(res), "+&r"(err) : "r"(vaddr), "i"(SIGSEGV) @@ -2065,7 +2065,7 @@ int mipsr2_decoder(struct pt_regs *regs, u32 inst, un= signed long *fcr31) "j 2b\n" ".previous\n" ".section __ex_table,\"a\"\n" - STR(PTR) " 1b,3b\n" + STR(PTR_WD) " 1b,3b\n" ".previous\n" : "+&r"(res), "+&r"(err) : "r"(vaddr), "i"(SIGSEGV)); @@ -2126,7 +2126,7 @@ int mipsr2_decoder(struct pt_regs *regs, u32 inst, un= signed long *fcr31) "j 2b\n" ".previous\n" ".section __ex_table,\"a\"\n" - STR(PTR) " 1b,3b\n" + STR(PTR_WD) " 1b,3b\n" ".previous\n" : "=3D&r"(res), "+&r"(err) : "r"(vaddr), "i"(SIGSEGV) @@ -2189,7 +2189,7 @@ int mipsr2_decoder(struct pt_regs *regs, u32 inst, un= signed long *fcr31) "j 2b\n" ".previous\n" ".section __ex_table,\"a\"\n" - STR(PTR) " 1b,3b\n" + STR(PTR_WD) " 1b,3b\n" ".previous\n" : "+&r"(res), "+&r"(err) : "r"(vaddr), "i"(SIGSEGV)); diff --git a/arch/mips/kernel/r2300_fpu.S b/arch/mips/kernel/r2300_fpu.S index cbf6db98cfb38..2748c55820c24 100644 --- a/arch/mips/kernel/r2300_fpu.S +++ b/arch/mips/kernel/r2300_fpu.S @@ -23,14 +23,14 @@ #define EX(a,b) \ 9: a,##b; \ .section __ex_table,"a"; \ - PTR 9b,fault; \ + PTR_WD 9b,fault; \ .previous =20 #define EX2(a,b) \ 9: a,##b; \ .section __ex_table,"a"; \ - PTR 9b,fault; \ - PTR 9b+4,fault; \ + PTR_WD 9b,fault; \ + PTR_WD 9b+4,fault; \ .previous =20 .set mips1 diff --git a/arch/mips/kernel/r4k_fpu.S b/arch/mips/kernel/r4k_fpu.S index b91e911064756..2e687c60bc4f1 100644 --- a/arch/mips/kernel/r4k_fpu.S +++ b/arch/mips/kernel/r4k_fpu.S @@ -31,7 +31,7 @@ .ex\@: \insn \reg, \src .set pop .section __ex_table,"a" - PTR .ex\@, fault + PTR_WD .ex\@, fault .previous .endm =20 diff --git a/arch/mips/kernel/relocate_kernel.S b/arch/mips/kernel/relocate= _kernel.S index f3c908abdbb80..cfde14b48fd8d 100644 --- a/arch/mips/kernel/relocate_kernel.S +++ b/arch/mips/kernel/relocate_kernel.S @@ -147,10 +147,10 @@ LEAF(kexec_smp_wait) =20 kexec_args: EXPORT(kexec_args) -arg0: PTR 0x0 -arg1: PTR 0x0 -arg2: PTR 0x0 -arg3: PTR 0x0 +arg0: PTR_WD 0x0 +arg1: PTR_WD 0x0 +arg2: PTR_WD 0x0 +arg3: PTR_WD 0x0 .size kexec_args,PTRSIZE*4 =20 #ifdef CONFIG_SMP @@ -161,10 +161,10 @@ arg3: PTR 0x0 */ secondary_kexec_args: EXPORT(secondary_kexec_args) -s_arg0: PTR 0x0 -s_arg1: PTR 0x0 -s_arg2: PTR 0x0 -s_arg3: PTR 0x0 +s_arg0: PTR_WD 0x0 +s_arg1: PTR_WD 0x0 +s_arg2: PTR_WD 0x0 +s_arg3: PTR_WD 0x0 .size secondary_kexec_args,PTRSIZE*4 kexec_flag: LONG 0x1 @@ -173,17 +173,17 @@ kexec_flag: =20 kexec_start_address: EXPORT(kexec_start_address) - PTR 0x0 + PTR_WD 0x0 .size kexec_start_address, PTRSIZE =20 kexec_indirection_page: EXPORT(kexec_indirection_page) - PTR 0 + PTR_WD 0 .size kexec_indirection_page, PTRSIZE =20 relocate_new_kernel_end: =20 relocate_new_kernel_size: EXPORT(relocate_new_kernel_size) - PTR relocate_new_kernel_end - relocate_new_kernel + PTR_WD relocate_new_kernel_end - relocate_new_kernel .size relocate_new_kernel_size, PTRSIZE diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S index b1b2e106f7118..9bfce5f75f601 100644 --- a/arch/mips/kernel/scall32-o32.S +++ b/arch/mips/kernel/scall32-o32.S @@ -72,10 +72,10 @@ loads_done: .set pop =20 .section __ex_table,"a" - PTR load_a4, bad_stack_a4 - PTR load_a5, bad_stack_a5 - PTR load_a6, bad_stack_a6 - PTR load_a7, bad_stack_a7 + PTR_WD load_a4, bad_stack_a4 + PTR_WD load_a5, bad_stack_a5 + PTR_WD load_a6, bad_stack_a6 + PTR_WD load_a7, bad_stack_a7 .previous =20 lw t0, TI_FLAGS($28) # syscall tracing enabled? @@ -216,7 +216,7 @@ einval: li v0, -ENOSYS #endif /* CONFIG_MIPS_MT_FPAFF */ =20 #define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, native) -#define __SYSCALL(nr, entry) PTR entry +#define __SYSCALL(nr, entry) PTR_WD entry .align 2 .type sys_call_table, @object EXPORT(sys_call_table) diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S index f650c55a17dc5..97456b2ca7dc3 100644 --- a/arch/mips/kernel/scall64-n32.S +++ b/arch/mips/kernel/scall64-n32.S @@ -101,7 +101,7 @@ not_n32_scall: =20 END(handle_sysn32) =20 -#define __SYSCALL(nr, entry) PTR entry +#define __SYSCALL(nr, entry) PTR_WD entry .type sysn32_call_table, @object EXPORT(sysn32_call_table) #include diff --git a/arch/mips/kernel/scall64-n64.S b/arch/mips/kernel/scall64-n64.S index 5d7bfc65e4d0b..5f6ed4b4c3993 100644 --- a/arch/mips/kernel/scall64-n64.S +++ b/arch/mips/kernel/scall64-n64.S @@ -109,7 +109,7 @@ illegal_syscall: j n64_syscall_exit END(handle_sys64) =20 -#define __SYSCALL(nr, entry) PTR entry +#define __SYSCALL(nr, entry) PTR_WD entry .align 3 .type sys_call_table, @object EXPORT(sys_call_table) diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S index cedc8bd888046..d3c2616cba226 100644 --- a/arch/mips/kernel/scall64-o32.S +++ b/arch/mips/kernel/scall64-o32.S @@ -73,10 +73,10 @@ load_a7: lw a7, 28(t0) # argument #8 from usp loads_done: =20 .section __ex_table,"a" - PTR load_a4, bad_stack_a4 - PTR load_a5, bad_stack_a5 - PTR load_a6, bad_stack_a6 - PTR load_a7, bad_stack_a7 + PTR_WD load_a4, bad_stack_a4 + PTR_WD load_a5, bad_stack_a5 + PTR_WD load_a6, bad_stack_a6 + PTR_WD load_a7, bad_stack_a7 .previous =20 li t1, _TIF_WORK_SYSCALL_ENTRY @@ -214,7 +214,7 @@ einval: li v0, -ENOSYS END(sys32_syscall) =20 #define __SYSCALL_WITH_COMPAT(nr, native, compat) __SYSCALL(nr, compat) -#define __SYSCALL(nr, entry) PTR entry +#define __SYSCALL(nr, entry) PTR_WD entry .align 3 .type sys32_call_table,@object EXPORT(sys32_call_table) diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c index 5512cd586e6e8..ae93a607ddf7e 100644 --- a/arch/mips/kernel/syscall.c +++ b/arch/mips/kernel/syscall.c @@ -122,8 +122,8 @@ static inline int mips_atomic_set(unsigned long addr, u= nsigned long new) " j 3b \n" " .previous \n" " .section __ex_table,\"a\" \n" - " "STR(PTR)" 1b, 4b \n" - " "STR(PTR)" 2b, 4b \n" + " "STR(PTR_WD)" 1b, 4b \n" + " "STR(PTR_WD)" 2b, 4b \n" " .previous \n" " .set pop \n" : [old] "=3D&r" (old), @@ -152,8 +152,8 @@ static inline int mips_atomic_set(unsigned long addr, u= nsigned long new) " j 3b \n" " .previous \n" " .section __ex_table,\"a\" \n" - " "STR(PTR)" 1b, 5b \n" - " "STR(PTR)" 2b, 5b \n" + " "STR(PTR_WD)" 1b, 5b \n" + " "STR(PTR_WD)" 2b, 5b \n" " .previous \n" " .set pop \n" : [old] "=3D&r" (old), diff --git a/arch/mips/lib/csum_partial.S b/arch/mips/lib/csum_partial.S index a46db08071953..7767137c3e49a 100644 --- a/arch/mips/lib/csum_partial.S +++ b/arch/mips/lib/csum_partial.S @@ -347,7 +347,7 @@ EXPORT_SYMBOL(csum_partial) .if \mode =3D=3D LEGACY_MODE; \ 9: insn reg, addr; \ .section __ex_table,"a"; \ - PTR 9b, .L_exc; \ + PTR_WD 9b, .L_exc; \ .previous; \ /* This is enabled in EVA mode */ \ .else; \ @@ -356,7 +356,7 @@ EXPORT_SYMBOL(csum_partial) ((\to =3D=3D USEROP) && (type =3D=3D ST_INSN)); \ 9: __BUILD_EVA_INSN(insn##e, reg, addr); \ .section __ex_table,"a"; \ - PTR 9b, .L_exc; \ + PTR_WD 9b, .L_exc; \ .previous; \ .else; \ /* EVA without exception */ \ diff --git a/arch/mips/lib/memcpy.S b/arch/mips/lib/memcpy.S index 277c32296636d..18a43f2e29c81 100644 --- a/arch/mips/lib/memcpy.S +++ b/arch/mips/lib/memcpy.S @@ -116,7 +116,7 @@ .if \mode =3D=3D LEGACY_MODE; \ 9: insn reg, addr; \ .section __ex_table,"a"; \ - PTR 9b, handler; \ + PTR_WD 9b, handler; \ .previous; \ /* This is assembled in EVA mode */ \ .else; \ @@ -125,7 +125,7 @@ ((\to =3D=3D USEROP) && (type =3D=3D ST_INSN)); \ 9: __BUILD_EVA_INSN(insn##e, reg, addr); \ .section __ex_table,"a"; \ - PTR 9b, handler; \ + PTR_WD 9b, handler; \ .previous; \ .else; \ /* \ diff --git a/arch/mips/lib/memset.S b/arch/mips/lib/memset.S index b0baa3c79fad0..0b342bae9a98c 100644 --- a/arch/mips/lib/memset.S +++ b/arch/mips/lib/memset.S @@ -52,7 +52,7 @@ 9: ___BUILD_EVA_INSN(insn, reg, addr); \ .endif; \ .section __ex_table,"a"; \ - PTR 9b, handler; \ + PTR_WD 9b, handler; \ .previous =20 .macro f_fill64 dst, offset, val, fixup, mode diff --git a/arch/mips/lib/strncpy_user.S b/arch/mips/lib/strncpy_user.S index 556acf684d7be..13aaa9927ad12 100644 --- a/arch/mips/lib/strncpy_user.S +++ b/arch/mips/lib/strncpy_user.S @@ -15,7 +15,7 @@ #define EX(insn,reg,addr,handler) \ 9: insn reg, addr; \ .section __ex_table,"a"; \ - PTR 9b, handler; \ + PTR_WD 9b, handler; \ .previous =20 /* @@ -59,7 +59,7 @@ LEAF(__strncpy_from_user_asm) jr ra =20 .section __ex_table,"a" - PTR 1b, .Lfault + PTR_WD 1b, .Lfault .previous =20 EXPORT_SYMBOL(__strncpy_from_user_asm) diff --git a/arch/mips/lib/strnlen_user.S b/arch/mips/lib/strnlen_user.S index 92b63f20ec05f..6de31b616f9c1 100644 --- a/arch/mips/lib/strnlen_user.S +++ b/arch/mips/lib/strnlen_user.S @@ -14,7 +14,7 @@ #define EX(insn,reg,addr,handler) \ 9: insn reg, addr; \ .section __ex_table,"a"; \ - PTR 9b, handler; \ + PTR_WD 9b, handler; \ .previous =20 /* --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C96FEC433EF for ; Mon, 14 Feb 2022 10:25:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346913AbiBNKZM (ORCPT ); Mon, 14 Feb 2022 05:25:12 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:33266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234368AbiBNKYS (ORCPT ); Mon, 14 Feb 2022 05:24:18 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B8806D182; Mon, 14 Feb 2022 01:56:29 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AC40FB80DBE; Mon, 14 Feb 2022 09:56:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADD1DC340E9; Mon, 14 Feb 2022 09:56:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832586; bh=cJz+WCKCtmXCo1AQ+BSDjP3riPuNHgmDjCEGV5+z4VY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y7epjIE6LzQxOtdJArTMotKv2/s8Onq1DHhgj8Wyq2OUptUr78kR9YmO0VwlzgRYJ IQOP/WNLbBku56iRQ55XekF4wA7NWtTc1M1d0k5wxFr7b92ojX5x/j4TFEi+WN/lcw OqFTmgNFQnmIvkmYYY+A3ehYxXNy5bDrP1tiJpQs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jisheng Zhang , Jernej Skrabec , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 061/203] net: stmmac: dwmac-sun8i: use return val of readl_poll_timeout() Date: Mon, 14 Feb 2022 10:25:05 +0100 Message-Id: <20220214092512.327799966@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jisheng Zhang [ Upstream commit 9e0db41e7a0b6f1271cbcfb16dbf5b8641b4e440 ] When readl_poll_timeout() timeout, we'd better directly use its return value. Before this patch: [ 2.145528] dwmac-sun8i: probe of 4500000.ethernet failed with error -14 After this patch: [ 2.138520] dwmac-sun8i: probe of 4500000.ethernet failed with error -110 Signed-off-by: Jisheng Zhang Acked-by: Jernej Skrabec Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/ne= t/ethernet/stmicro/stmmac/dwmac-sun8i.c index 617d0e4c64958..09644ab0d87a7 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c @@ -756,7 +756,7 @@ static int sun8i_dwmac_reset(struct stmmac_priv *priv) =20 if (err) { dev_err(priv->device, "EMAC reset timeout\n"); - return -EFAULT; + return err; } return 0; } --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0545EC433EF for ; Mon, 14 Feb 2022 10:25:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235642AbiBNKZT (ORCPT ); Mon, 14 Feb 2022 05:25:19 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:53424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346845AbiBNKYT (ORCPT ); Mon, 14 Feb 2022 05:24:19 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 171106D187; Mon, 14 Feb 2022 01:56:30 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A7D4161183; Mon, 14 Feb 2022 09:56:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92192C340E9; Mon, 14 Feb 2022 09:56:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832589; bh=CvrnKzfGiFqdvtJF/lFdhAZT7jrKvco/zQIMZOZYKAM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EZVINwmIZeyCohM2Sq6M4yaKdrgmjeHhqZ2vSNertfKkz0Zn5Gal/AxJpbMTWueV+ 8QxxN0bvlrqGL9phJzAbC0Z69FstZgUAQDsmk6My3qHJhkuMySBb3sSoUmZxrDcXjt uk2uybGHECvq6vImrgi5QkNL9ha1VTqAdQObiZrs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Catalin Marinas , Will Deacon , Mathieu Poirier , Suzuki Poulose , coresight@lists.linaro.org, linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Anshuman Khandual , Sasha Levin Subject: [PATCH 5.16 062/203] arm64: errata: Add detection for TRBE ignored system register writes Date: Mon, 14 Feb 2022 10:25:06 +0100 Message-Id: <20220214092512.363178801@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 607a9afaae09cde21ece458a8f10cb99d3f94f14 ] TRBE implementations affected by Arm erratum #2064142 might fail to write into certain system registers after the TRBE has been disabled. Under some conditions after TRBE has been disabled, writes into certain TRBE registers TRBLIMITR_EL1, TRBPTR_EL1, TRBBASER_EL1, TRBSR_EL1 and TRBTRG_EL1 will be ignored and not be effected. This adds a new errata ARM64_ERRATUM_2064142 in arm64 errata framework. Cc: Catalin Marinas Cc: Will Deacon Cc: Mathieu Poirier Cc: Suzuki Poulose Cc: coresight@lists.linaro.org Cc: linux-doc@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Reviewed-by: Suzuki K Poulose Acked-by: Catalin Marinas Signed-off-by: Anshuman Khandual Link: https://lore.kernel.org/r/1643120437-14352-3-git-send-email-anshuman.= khandual@arm.com Signed-off-by: Mathieu Poirier Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- Documentation/arm64/silicon-errata.rst | 2 ++ arch/arm64/Kconfig | 18 ++++++++++++++++++ arch/arm64/kernel/cpu_errata.c | 9 +++++++++ arch/arm64/tools/cpucaps | 1 + 4 files changed, 30 insertions(+) diff --git a/Documentation/arm64/silicon-errata.rst b/Documentation/arm64/s= ilicon-errata.rst index 8789c79310bbd..401a6e86c5084 100644 --- a/Documentation/arm64/silicon-errata.rst +++ b/Documentation/arm64/silicon-errata.rst @@ -52,6 +52,8 @@ stable kernels. | Allwinner | A64/R18 | UNKNOWN1 | SUN50I_ERRATUM_UNKN= OWN1 | +----------------+-----------------+-----------------+--------------------= ---------+ +----------------+-----------------+-----------------+--------------------= ---------+ +| ARM | Cortex-A510 | #2064142 | ARM64_ERRATUM_20641= 42 | ++----------------+-----------------+-----------------+--------------------= ---------+ | ARM | Cortex-A53 | #826319 | ARM64_ERRATUM_82631= 9 | +----------------+-----------------+-----------------+--------------------= ---------+ | ARM | Cortex-A53 | #827319 | ARM64_ERRATUM_82731= 9 | diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index d8046c832225c..30c07b0d6b5c9 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -778,6 +778,24 @@ config ARM64_ERRATUM_2224489 =20 If unsure, say Y. =20 +config ARM64_ERRATUM_2064142 + bool "Cortex-A510: 2064142: workaround TRBE register writes while disable= d" + depends on COMPILE_TEST # Until the CoreSight TRBE driver changes are in + default y + help + This option adds the workaround for ARM Cortex-A510 erratum 2064142. + + Affected Cortex-A510 core might fail to write into system registers aft= er the + TRBE has been disabled. Under some conditions after the TRBE has been d= isabled + writes into TRBE registers TRBLIMITR_EL1, TRBPTR_EL1, TRBBASER_EL1, TRB= SR_EL1, + and TRBTRG_EL1 will be ignored and will not be effected. + + Work around this in the driver by executing TSB CSYNC and DSB after col= lection + is stopped and before performing a system register write to one of the = affected + registers. + + If unsure, say Y. + config CAVIUM_ERRATUM_22375 bool "Cavium erratum 22375, 24313" default y diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c index 29cc062a4153c..a5456dd9a33f5 100644 --- a/arch/arm64/kernel/cpu_errata.c +++ b/arch/arm64/kernel/cpu_errata.c @@ -599,6 +599,15 @@ const struct arm64_cpu_capabilities arm64_errata[] =3D= { .type =3D ARM64_CPUCAP_WEAK_LOCAL_CPU_FEATURE, CAP_MIDR_RANGE_LIST(trbe_write_out_of_range_cpus), }, +#endif +#ifdef CONFIG_ARM64_ERRATUM_2064142 + { + .desc =3D "ARM erratum 2064142", + .capability =3D ARM64_WORKAROUND_2064142, + + /* Cortex-A510 r0p0 - r0p2 */ + ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A510, 0, 0, 2) + }, #endif { } diff --git a/arch/arm64/tools/cpucaps b/arch/arm64/tools/cpucaps index 870c39537dd09..fca3cb329e1db 100644 --- a/arch/arm64/tools/cpucaps +++ b/arch/arm64/tools/cpucaps @@ -55,6 +55,7 @@ WORKAROUND_1418040 WORKAROUND_1463225 WORKAROUND_1508412 WORKAROUND_1542419 +WORKAROUND_2064142 WORKAROUND_TRBE_OVERWRITE_FILL_MODE WORKAROUND_TSB_FLUSH_FAILURE WORKAROUND_TRBE_WRITE_OUT_OF_RANGE --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6FF3C4332F for ; Mon, 14 Feb 2022 10:25:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346661AbiBNKZX (ORCPT ); Mon, 14 Feb 2022 05:25:23 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:57146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346914AbiBNKYT (ORCPT ); Mon, 14 Feb 2022 05:24:19 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FA0D6D191; Mon, 14 Feb 2022 01:56:32 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8EFC460F25; Mon, 14 Feb 2022 09:56:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75BBDC340E9; Mon, 14 Feb 2022 09:56:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832592; bh=zV5mVSHrLBiLshJorIhm2PR948GoEoOLENCUyAPJ+Ng=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jfI2pTkBdzHEta66o+nkK9rJDEznhWDV1hHqqUBoEDFyfXi3zkFMjXA2QJMACOy4J T3d+G1jYf4OwTsILR6HljiBS84mOZY332o3k/C0Ldr2bGBxBAf4L2xwdKm24AGXPfe B39ZYuO6L/j0yq5yx6lBO4R1ANMnbKtSmUdWLUPs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Catalin Marinas , Will Deacon , Mathieu Poirier , Suzuki Poulose , coresight@lists.linaro.org, linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Anshuman Khandual , Sasha Levin Subject: [PATCH 5.16 063/203] arm64: errata: Add detection for TRBE invalid prohibited states Date: Mon, 14 Feb 2022 10:25:07 +0100 Message-Id: <20220214092512.395465562@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 3bd94a8759de9b724b83a80942b0354acd7701eb ] TRBE implementations affected by Arm erratum #2038923 might get TRBE into an inconsistent view on whether trace is prohibited within the CPU. As a result, the trace buffer or trace buffer state might be corrupted. This happens after TRBE buffer has been enabled by setting TRBLIMITR_EL1.E, followed by just a single context synchronization event before execution changes from a context, in which trace is prohibited to one where it isn't, or vice versa. In these mentioned conditions, the view of whether trace is prohibited is inconsistent between parts of the CPU, and the trace buffer or the trace buffer state might be corrupted. This adds a new errata ARM64_ERRATUM_2038923 in arm64 errata framework. Cc: Catalin Marinas Cc: Will Deacon Cc: Mathieu Poirier Cc: Suzuki Poulose Cc: coresight@lists.linaro.org Cc: linux-doc@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Reviewed-by: Suzuki K Poulose Acked-by: Catalin Marinas Signed-off-by: Anshuman Khandual Link: https://lore.kernel.org/r/1643120437-14352-4-git-send-email-anshuman.= khandual@arm.com Signed-off-by: Mathieu Poirier Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- Documentation/arm64/silicon-errata.rst | 2 ++ arch/arm64/Kconfig | 23 +++++++++++++++++++++++ arch/arm64/kernel/cpu_errata.c | 9 +++++++++ arch/arm64/tools/cpucaps | 1 + 4 files changed, 35 insertions(+) diff --git a/Documentation/arm64/silicon-errata.rst b/Documentation/arm64/s= ilicon-errata.rst index 401a6e86c5084..d5c6befc44eb8 100644 --- a/Documentation/arm64/silicon-errata.rst +++ b/Documentation/arm64/silicon-errata.rst @@ -54,6 +54,8 @@ stable kernels. +----------------+-----------------+-----------------+--------------------= ---------+ | ARM | Cortex-A510 | #2064142 | ARM64_ERRATUM_20641= 42 | +----------------+-----------------+-----------------+--------------------= ---------+ +| ARM | Cortex-A510 | #2038923 | ARM64_ERRATUM_20389= 23 | ++----------------+-----------------+-----------------+--------------------= ---------+ | ARM | Cortex-A53 | #826319 | ARM64_ERRATUM_82631= 9 | +----------------+-----------------+-----------------+--------------------= ---------+ | ARM | Cortex-A53 | #827319 | ARM64_ERRATUM_82731= 9 | diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 30c07b0d6b5c9..2b75e8a9bf88c 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -796,6 +796,29 @@ config ARM64_ERRATUM_2064142 =20 If unsure, say Y. =20 +config ARM64_ERRATUM_2038923 + bool "Cortex-A510: 2038923: workaround TRBE corruption with enable" + depends on COMPILE_TEST # Until the CoreSight TRBE driver changes are in + default y + help + This option adds the workaround for ARM Cortex-A510 erratum 2038923. + + Affected Cortex-A510 core might cause an inconsistent view on whether t= race is + prohibited within the CPU. As a result, the trace buffer or trace buffe= r state + might be corrupted. This happens after TRBE buffer has been enabled by = setting + TRBLIMITR_EL1.E, followed by just a single context synchronization even= t before + execution changes from a context, in which trace is prohibited to one w= here it + isn't, or vice versa. In these mentioned conditions, the view of whethe= r trace + is prohibited is inconsistent between parts of the CPU, and the trace b= uffer or + the trace buffer state might be corrupted. + + Work around this in the driver by preventing an inconsistent view of wh= ether the + trace is prohibited or not based on TRBLIMITR_EL1.E by immediately foll= owing a + change to TRBLIMITR_EL1.E with at least one ISB instruction before an E= RET, or + two ISB instructions if no ERET is to take place. + + If unsure, say Y. + config CAVIUM_ERRATUM_22375 bool "Cavium erratum 22375, 24313" default y diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c index a5456dd9a33f5..a64bf132c6336 100644 --- a/arch/arm64/kernel/cpu_errata.c +++ b/arch/arm64/kernel/cpu_errata.c @@ -609,6 +609,15 @@ const struct arm64_cpu_capabilities arm64_errata[] =3D= { ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A510, 0, 0, 2) }, #endif +#ifdef CONFIG_ARM64_ERRATUM_2038923 + { + .desc =3D "ARM erratum 2038923", + .capability =3D ARM64_WORKAROUND_2038923, + + /* Cortex-A510 r0p0 - r0p2 */ + ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A510, 0, 0, 2) + }, +#endif { } }; diff --git a/arch/arm64/tools/cpucaps b/arch/arm64/tools/cpucaps index fca3cb329e1db..45a06d36d0807 100644 --- a/arch/arm64/tools/cpucaps +++ b/arch/arm64/tools/cpucaps @@ -56,6 +56,7 @@ WORKAROUND_1463225 WORKAROUND_1508412 WORKAROUND_1542419 WORKAROUND_2064142 +WORKAROUND_2038923 WORKAROUND_TRBE_OVERWRITE_FILL_MODE WORKAROUND_TSB_FLUSH_FAILURE WORKAROUND_TRBE_WRITE_OUT_OF_RANGE --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05E86C433EF for ; Mon, 14 Feb 2022 10:25:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347138AbiBNKZ1 (ORCPT ); Mon, 14 Feb 2022 05:25:27 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:57532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237530AbiBNKYU (ORCPT ); Mon, 14 Feb 2022 05:24:20 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB25D6A005; Mon, 14 Feb 2022 01:56:36 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 970EC61183; Mon, 14 Feb 2022 09:56:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49CC3C340E9; Mon, 14 Feb 2022 09:56:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832595; bh=kWOgTfx40X8rEWQMQ0Dg3JPmDTKX9nTV5Sw50vDlTxE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FOSZrAGwm8SyB91Wqkg4uGElwsiUh0Gr2FL9+FKeVobepuo5x68+sCZ8uwn6HdUxY zztKw9Vlfue/4QUDO6QqB+SpLOTymKIlC5KyzB7z0HaEONewqXViE52gcVGSZ2guyi uSM0KLwF+ELYMZNa7uUmrNJrr742MHMOwE62u32g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Catalin Marinas , Will Deacon , Mathieu Poirier , Suzuki Poulose , coresight@lists.linaro.org, linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Anshuman Khandual , Sasha Levin Subject: [PATCH 5.16 064/203] arm64: errata: Add detection for TRBE trace data corruption Date: Mon, 14 Feb 2022 10:25:08 +0100 Message-Id: <20220214092512.428067962@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 708e8af4924ec2fdd5b81fe09192c6bac2f86935 ] TRBE implementations affected by Arm erratum #1902691 might corrupt trace data or deadlock, when it's being written into the memory. So effectively TRBE is broken and hence cannot be used to capture trace data. This adds a new errata ARM64_ERRATUM_1902691 in arm64 errata framework. Cc: Catalin Marinas Cc: Will Deacon Cc: Mathieu Poirier Cc: Suzuki Poulose Cc: coresight@lists.linaro.org Cc: linux-doc@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Reviewed-by: Suzuki K Poulose Acked-by: Catalin Marinas Signed-off-by: Anshuman Khandual Link: https://lore.kernel.org/r/1643120437-14352-5-git-send-email-anshuman.= khandual@arm.com Signed-off-by: Mathieu Poirier Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- Documentation/arm64/silicon-errata.rst | 2 ++ arch/arm64/Kconfig | 18 ++++++++++++++++++ arch/arm64/kernel/cpu_errata.c | 9 +++++++++ arch/arm64/tools/cpucaps | 1 + 4 files changed, 30 insertions(+) diff --git a/Documentation/arm64/silicon-errata.rst b/Documentation/arm64/s= ilicon-errata.rst index d5c6befc44eb8..1b0e53ececda9 100644 --- a/Documentation/arm64/silicon-errata.rst +++ b/Documentation/arm64/silicon-errata.rst @@ -56,6 +56,8 @@ stable kernels. +----------------+-----------------+-----------------+--------------------= ---------+ | ARM | Cortex-A510 | #2038923 | ARM64_ERRATUM_20389= 23 | +----------------+-----------------+-----------------+--------------------= ---------+ +| ARM | Cortex-A510 | #1902691 | ARM64_ERRATUM_19026= 91 | ++----------------+-----------------+-----------------+--------------------= ---------+ | ARM | Cortex-A53 | #826319 | ARM64_ERRATUM_82631= 9 | +----------------+-----------------+-----------------+--------------------= ---------+ | ARM | Cortex-A53 | #827319 | ARM64_ERRATUM_82731= 9 | diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 2b75e8a9bf88c..7d710589e1818 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -819,6 +819,24 @@ config ARM64_ERRATUM_2038923 =20 If unsure, say Y. =20 +config ARM64_ERRATUM_1902691 + bool "Cortex-A510: 1902691: workaround TRBE trace corruption" + depends on COMPILE_TEST # Until the CoreSight TRBE driver changes are in + default y + help + This option adds the workaround for ARM Cortex-A510 erratum 1902691. + + Affected Cortex-A510 core might cause trace data corruption, when being= written + into the memory. Effectively TRBE is broken and hence cannot be used to= capture + trace data. + + Work around this problem in the driver by just preventing TRBE initiali= zation on + affected cpus. The firmware must have disabled the access to TRBE for t= he kernel + on such implementations. This will cover the kernel for any firmware th= at doesn't + do this already. + + If unsure, say Y. + config CAVIUM_ERRATUM_22375 bool "Cavium erratum 22375, 24313" default y diff --git a/arch/arm64/kernel/cpu_errata.c b/arch/arm64/kernel/cpu_errata.c index a64bf132c6336..066098198c248 100644 --- a/arch/arm64/kernel/cpu_errata.c +++ b/arch/arm64/kernel/cpu_errata.c @@ -617,6 +617,15 @@ const struct arm64_cpu_capabilities arm64_errata[] =3D= { /* Cortex-A510 r0p0 - r0p2 */ ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A510, 0, 0, 2) }, +#endif +#ifdef CONFIG_ARM64_ERRATUM_1902691 + { + .desc =3D "ARM erratum 1902691", + .capability =3D ARM64_WORKAROUND_1902691, + + /* Cortex-A510 r0p0 - r0p1 */ + ERRATA_MIDR_REV_RANGE(MIDR_CORTEX_A510, 0, 0, 1) + }, #endif { } diff --git a/arch/arm64/tools/cpucaps b/arch/arm64/tools/cpucaps index 45a06d36d0807..e7719e8f18def 100644 --- a/arch/arm64/tools/cpucaps +++ b/arch/arm64/tools/cpucaps @@ -57,6 +57,7 @@ WORKAROUND_1508412 WORKAROUND_1542419 WORKAROUND_2064142 WORKAROUND_2038923 +WORKAROUND_1902691 WORKAROUND_TRBE_OVERWRITE_FILL_MODE WORKAROUND_TSB_FLUSH_FAILURE WORKAROUND_TRBE_WRITE_OUT_OF_RANGE --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 24EE1C4332F for ; Mon, 14 Feb 2022 10:25:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347157AbiBNKZa (ORCPT ); Mon, 14 Feb 2022 05:25:30 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:53396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346765AbiBNKYb (ORCPT ); Mon, 14 Feb 2022 05:24:31 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A08986A047; Mon, 14 Feb 2022 01:56:40 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4FF47B80D6D; Mon, 14 Feb 2022 09:56:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71A26C340E9; Mon, 14 Feb 2022 09:56:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832598; bh=St+wTmNgQ1QtlSDwVf5nx7/fOXNFZrqz9ag6wMv9RjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qJzCT2kmuXiETf8BBd6u53BU2H3ZFzFiN74Bckjfxi833AkyDMNE5NEghPLwEQ49q xG+ulW3vCO8gx+vk+XOpsrXGhQAKtEDE8HS+441ytDpu9+PwVBbMdXv7Cst7katIUj PU/y3xx20n5l5T/wv7MCapqkjs7BReBRNvlqHdnE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, James Morse , Catalin Marinas , Sasha Levin Subject: [PATCH 5.16 065/203] arm64: cpufeature: List early Cortex-A510 parts as having broken dbm Date: Mon, 14 Feb 2022 10:25:09 +0100 Message-Id: <20220214092512.465638916@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Morse [ Upstream commit 297ae1eb23b04c5a46111ab53c8d0f69af43f402 ] Versions of Cortex-A510 before r0p3 are affected by a hardware erratum where the hardware update of the dirty bit is not correctly ordered. Add these cpus to the cpu_has_broken_dbm list. Signed-off-by: James Morse Link: https://lore.kernel.org/r/20220125154040.549272-3-james.morse@arm.com Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- Documentation/arm64/silicon-errata.rst | 2 ++ arch/arm64/Kconfig | 10 ++++++++++ arch/arm64/kernel/cpufeature.c | 3 +++ 3 files changed, 15 insertions(+) diff --git a/Documentation/arm64/silicon-errata.rst b/Documentation/arm64/s= ilicon-errata.rst index 1b0e53ececda9..0ec7b7f1524b1 100644 --- a/Documentation/arm64/silicon-errata.rst +++ b/Documentation/arm64/silicon-errata.rst @@ -98,6 +98,8 @@ stable kernels. +----------------+-----------------+-----------------+--------------------= ---------+ | ARM | Cortex-A77 | #1508412 | ARM64_ERRATUM_15084= 12 | +----------------+-----------------+-----------------+--------------------= ---------+ +| ARM | Cortex-A510 | #2051678 | ARM64_ERRATUM_20516= 78 | ++----------------+-----------------+-----------------+--------------------= ---------+ | ARM | Cortex-A710 | #2119858 | ARM64_ERRATUM_21198= 58 | +----------------+-----------------+-----------------+--------------------= ---------+ | ARM | Cortex-A710 | #2054223 | ARM64_ERRATUM_20542= 23 | diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 7d710589e1818..38e7f19df14d4 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -670,6 +670,16 @@ config ARM64_ERRATUM_1508412 config ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE bool =20 +config ARM64_ERRATUM_2051678 + bool "Cortex-A510: 2051678: disable Hardware Update of the page table dir= ty bit" + help + This options adds the workaround for ARM Cortex-A510 erratum ARM64_ERRA= TUM_2051678. + Affected Coretex-A510 might not respect the ordering rules for + hardware update of the page table's dirty bit. The workaround + is to not enable the feature on affected CPUs. + + If unsure, say Y. + config ARM64_ERRATUM_2119858 bool "Cortex-A710/X2: 2119858: workaround TRBE overwriting trace data in = FILL mode" default y diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 6f3e677d88f15..d18b953c078db 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -1634,6 +1634,9 @@ static bool cpu_has_broken_dbm(void) MIDR_ALL_VERSIONS(MIDR_CORTEX_A55), /* Kryo4xx Silver (rdpe =3D> r1p0) */ MIDR_REV(MIDR_QCOM_KRYO_4XX_SILVER, 0xd, 0xe), +#endif +#ifdef CONFIG_ARM64_ERRATUM_2051678 + MIDR_REV_RANGE(MIDR_CORTEX_A510, 0, 0, 2), #endif {}, }; --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76078C433EF for ; Mon, 14 Feb 2022 10:25:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347167AbiBNKZe (ORCPT ); Mon, 14 Feb 2022 05:25:34 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:34374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346941AbiBNKYl (ORCPT ); Mon, 14 Feb 2022 05:24:41 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02C146A04E; Mon, 14 Feb 2022 01:56:42 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9649560FA2; Mon, 14 Feb 2022 09:56:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41299C340E9; Mon, 14 Feb 2022 09:56:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832601; bh=eZzWSHHPhuyrfHRIaehmCfV5KOXZOFvWuve5S+I0rBA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dl+GQtVFq96OynaV7b9Pw6YUx1Wv2XGrhjhaH869vmzG4Y6bi6H+VStpKyn6mYs0j XF1WPvXXMEinRbnZZRtPU4TvKM7VoX28bl18vNmH4uERiXmMKgbQgUBU0uoor8TXvo t4Sb3zAzUAH3Po/nxqfA5NakWNn5LkDC5kLc17Xg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marco Elver , Nico Pache , Andrey Konovalov , Kees Cook , Andrey Ryabinin , Alexander Potapenko , Dmitry Vyukov , Brendan Higgins , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 5.16 066/203] kasan: test: fix compatibility with FORTIFY_SOURCE Date: Mon, 14 Feb 2022 10:25:10 +0100 Message-Id: <20220214092512.500026966@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Elver [ Upstream commit 09c6304e38e440b93a9ebf3f3cf75cd6cb529f91 ] With CONFIG_FORTIFY_SOURCE enabled, string functions will also perform dynamic checks using __builtin_object_size(ptr), which when failed will panic the kernel. Because the KASAN test deliberately performs out-of-bounds operations, the kernel panics with FORTIFY_SOURCE, for example: | kernel BUG at lib/string_helpers.c:910! | invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI | CPU: 1 PID: 137 Comm: kunit_try_catch Tainted: G B 5.16.0= -rc3+ #3 | Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/= 01/2014 | RIP: 0010:fortify_panic+0x19/0x1b | ... | Call Trace: | kmalloc_oob_in_memset.cold+0x16/0x16 | ... Fix it by also hiding `ptr` from the optimizer, which will ensure that __builtin_object_size() does not return a valid size, preventing fortified string functions from panicking. Link: https://lkml.kernel.org/r/20220124160744.1244685-1-elver@google.com Signed-off-by: Marco Elver Reported-by: Nico Pache Reviewed-by: Nico Pache Reviewed-by: Andrey Konovalov Reviewed-by: Kees Cook Cc: Andrey Ryabinin Cc: Alexander Potapenko Cc: Dmitry Vyukov Cc: Brendan Higgins Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- lib/test_kasan.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/test_kasan.c b/lib/test_kasan.c index 0643573f86862..2ef2948261bf8 100644 --- a/lib/test_kasan.c +++ b/lib/test_kasan.c @@ -492,6 +492,7 @@ static void kmalloc_oob_in_memset(struct kunit *test) ptr =3D kmalloc(size, GFP_KERNEL); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); =20 + OPTIMIZER_HIDE_VAR(ptr); OPTIMIZER_HIDE_VAR(size); KUNIT_EXPECT_KASAN_FAIL(test, memset(ptr, 0, size + KASAN_GRANULE_SIZE)); @@ -515,6 +516,7 @@ static void kmalloc_memmove_negative_size(struct kunit = *test) KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); =20 memset((char *)ptr, 0, 64); + OPTIMIZER_HIDE_VAR(ptr); OPTIMIZER_HIDE_VAR(invalid_size); KUNIT_EXPECT_KASAN_FAIL(test, memmove((char *)ptr, (char *)ptr + 4, invalid_size)); @@ -531,6 +533,7 @@ static void kmalloc_memmove_invalid_size(struct kunit *= test) KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); =20 memset((char *)ptr, 0, 64); + OPTIMIZER_HIDE_VAR(ptr); KUNIT_EXPECT_KASAN_FAIL(test, memmove((char *)ptr, (char *)ptr + 4, invalid_size)); kfree(ptr); @@ -869,6 +872,7 @@ static void kasan_memchr(struct kunit *test) ptr =3D kmalloc(size, GFP_KERNEL | __GFP_ZERO); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); =20 + OPTIMIZER_HIDE_VAR(ptr); OPTIMIZER_HIDE_VAR(size); KUNIT_EXPECT_KASAN_FAIL(test, kasan_ptr_result =3D memchr(ptr, '1', size + 1)); @@ -895,6 +899,7 @@ static void kasan_memcmp(struct kunit *test) KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ptr); memset(arr, 0, sizeof(arr)); =20 + OPTIMIZER_HIDE_VAR(ptr); OPTIMIZER_HIDE_VAR(size); KUNIT_EXPECT_KASAN_FAIL(test, kasan_int_result =3D memcmp(ptr, arr, size+1)); --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA52DC433F5 for ; Mon, 14 Feb 2022 10:27:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347080AbiBNKZq (ORCPT ); Mon, 14 Feb 2022 05:25:46 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:56122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346449AbiBNKYw (ORCPT ); Mon, 14 Feb 2022 05:24:52 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B2966A05E; Mon, 14 Feb 2022 01:56:44 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8FD7C61237; Mon, 14 Feb 2022 09:56:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6CBB8C340E9; Mon, 14 Feb 2022 09:56:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832604; bh=VxO4XPl+QmBhcVfF5MuAsalw3aGiwdnmI8+KlQ1LE3o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dnV716ATuIP3AOkVooc5nBmPfbanx1uX3GMKuivvnwTK7OP3SmcdlKBkyW9S27j3n JldKYpnbFBqFl7ceb16dzHy++RFnX6nD2EQbir2xHJcxGln0Cmrho7zowkXDPDeJaY lperPaEKKKt/vFlyfJJiuerFsZ5sTx5RMdtRRj7Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Hou Wenlong , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.16 067/203] KVM: eventfd: Fix false positive RCU usage warning Date: Mon, 14 Feb 2022 10:25:11 +0100 Message-Id: <20220214092512.541700198@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hou Wenlong [ Upstream commit 6a0c61703e3a5d67845a4b275e1d9d7bc1b5aad7 ] Fix the following false positive warning: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D WARNING: suspicious RCU usage 5.16.0-rc4+ #57 Not tainted ----------------------------- arch/x86/kvm/../../../virt/kvm/eventfd.c:484 RCU-list traversed in non-rea= der section!! other info that might help us debug this: rcu_scheduler_active =3D 2, debug_locks =3D 1 3 locks held by fc_vcpu 0/330: #0: ffff8884835fc0b0 (&vcpu->mutex){+.+.}-{3:3}, at: kvm_vcpu_ioctl+0x88/= 0x6f0 [kvm] #1: ffffc90004c0bb68 (&kvm->srcu){....}-{0:0}, at: vcpu_enter_guest+0x600= /0x1860 [kvm] #2: ffffc90004c0c1d0 (&kvm->irq_srcu){....}-{0:0}, at: kvm_notify_acked_i= rq+0x36/0x180 [kvm] stack backtrace: CPU: 26 PID: 330 Comm: fc_vcpu 0 Not tainted 5.16.0-rc4+ Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.14.0-0-g155= 821a1990b-prebuilt.qemu.org 04/01/2014 Call Trace: dump_stack_lvl+0x44/0x57 kvm_notify_acked_gsi+0x6b/0x70 [kvm] kvm_notify_acked_irq+0x8d/0x180 [kvm] kvm_ioapic_update_eoi+0x92/0x240 [kvm] kvm_apic_set_eoi_accelerated+0x2a/0xe0 [kvm] handle_apic_eoi_induced+0x3d/0x60 [kvm_intel] vmx_handle_exit+0x19c/0x6a0 [kvm_intel] vcpu_enter_guest+0x66e/0x1860 [kvm] kvm_arch_vcpu_ioctl_run+0x438/0x7f0 [kvm] kvm_vcpu_ioctl+0x38a/0x6f0 [kvm] __x64_sys_ioctl+0x89/0xc0 do_syscall_64+0x3a/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae Since kvm_unregister_irq_ack_notifier() does synchronize_srcu(&kvm->irq_src= u), kvm->irq_ack_notifier_list is protected by kvm->irq_srcu. In fact, kvm->irq_srcu SRCU read lock is held in kvm_notify_acked_irq(), making it a false positive warning. So use hlist_for_each_entry_srcu() instead of hlist_for_each_entry_rcu(). Reviewed-by: Sean Christopherson Signed-off-by: Hou Wenlong Message-Id: Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- virt/kvm/eventfd.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c index 2ad013b8bde96..59b1dd4a549ee 100644 --- a/virt/kvm/eventfd.c +++ b/virt/kvm/eventfd.c @@ -463,8 +463,8 @@ bool kvm_irq_has_notifier(struct kvm *kvm, unsigned irq= chip, unsigned pin) idx =3D srcu_read_lock(&kvm->irq_srcu); gsi =3D kvm_irq_map_chip_pin(kvm, irqchip, pin); if (gsi !=3D -1) - hlist_for_each_entry_rcu(kian, &kvm->irq_ack_notifier_list, - link) + hlist_for_each_entry_srcu(kian, &kvm->irq_ack_notifier_list, + link, srcu_read_lock_held(&kvm->irq_srcu)) if (kian->gsi =3D=3D gsi) { srcu_read_unlock(&kvm->irq_srcu, idx); return true; @@ -480,8 +480,8 @@ void kvm_notify_acked_gsi(struct kvm *kvm, int gsi) { struct kvm_irq_ack_notifier *kian; =20 - hlist_for_each_entry_rcu(kian, &kvm->irq_ack_notifier_list, - link) + hlist_for_each_entry_srcu(kian, &kvm->irq_ack_notifier_list, + link, srcu_read_lock_held(&kvm->irq_srcu)) if (kian->gsi =3D=3D gsi) kian->irq_acked(kian); } --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30CEFC433FE for ; Mon, 14 Feb 2022 10:29:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347337AbiBNK1o (ORCPT ); Mon, 14 Feb 2022 05:27:44 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:53378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229904AbiBNKY6 (ORCPT ); Mon, 14 Feb 2022 05:24:58 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EDD886A077; Mon, 14 Feb 2022 01:56:52 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A9E1AB80DBE; Mon, 14 Feb 2022 09:56:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78F05C340E9; Mon, 14 Feb 2022 09:56:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832610; bh=paGR/fTnLUhrSaJbD5c1gmkz5uWTtOGJJZJk4wXLwB8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rYWqOpoQazwA6JQEFIMqmAkQn8pPjWSGFBtFtmoyC37mmYmq/xm821H/81gXSbDbP 6bc8U/AD1SuY6PUtuyWYBBeqRPFqgca3BVtKbCUMd/87YaZbPdUrFD5ob/AUn2etGd /ehCrzMfu29gPFpEkQvUCeOZPfCqgDsBrYnGeUkA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vitaly Kuznetsov , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.16 068/203] KVM: nVMX: eVMCS: Filter out VM_EXIT_SAVE_VMX_PREEMPTION_TIMER Date: Mon, 14 Feb 2022 10:25:12 +0100 Message-Id: <20220214092512.575994619@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vitaly Kuznetsov [ Upstream commit 7a601e2cf61558dfd534a9ecaad09f5853ad8204 ] Enlightened VMCS v1 doesn't have VMX_PREEMPTION_TIMER_VALUE field, PIN_BASED_VMX_PREEMPTION_TIMER is also filtered out already so it makes sense to filter out VM_EXIT_SAVE_VMX_PREEMPTION_TIMER too. Note, none of the currently existing Windows/Hyper-V versions are known to enable 'save VMX-preemption timer value' when eVMCS is in use, the change is aimed at making the filtering future proof. Signed-off-by: Vitaly Kuznetsov Message-Id: <20220112170134.1904308-3-vkuznets@redhat.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/x86/kvm/vmx/evmcs.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/vmx/evmcs.h b/arch/x86/kvm/vmx/evmcs.h index 6255fa7167720..8d70f9aea94bc 100644 --- a/arch/x86/kvm/vmx/evmcs.h +++ b/arch/x86/kvm/vmx/evmcs.h @@ -59,7 +59,9 @@ DECLARE_STATIC_KEY_FALSE(enable_evmcs); SECONDARY_EXEC_SHADOW_VMCS | \ SECONDARY_EXEC_TSC_SCALING | \ SECONDARY_EXEC_PAUSE_LOOP_EXITING) -#define EVMCS1_UNSUPPORTED_VMEXIT_CTRL (VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL) +#define EVMCS1_UNSUPPORTED_VMEXIT_CTRL \ + (VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL | \ + VM_EXIT_SAVE_VMX_PREEMPTION_TIMER) #define EVMCS1_UNSUPPORTED_VMENTRY_CTRL (VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CT= RL) #define EVMCS1_UNSUPPORTED_VMFUNC (VMX_VMFUNC_EPTP_SWITCHING) =20 --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A28A1C43217 for ; Mon, 14 Feb 2022 10:27:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347271AbiBNK1l (ORCPT ); Mon, 14 Feb 2022 05:27:41 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:33358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346512AbiBNKZE (ORCPT ); Mon, 14 Feb 2022 05:25:04 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7ED596D1A3; Mon, 14 Feb 2022 01:56:54 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1A6FD61460; Mon, 14 Feb 2022 09:56:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4937C340E9; Mon, 14 Feb 2022 09:56:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832613; bh=nFogxA/LDVBd0MRKb6HyR9kxQCK/ufUVnj0yDYGaXbo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q9T86zntJaKgn8caN61DUEyMdkjCmXJAlCH5nSRPQgpy1sUgH3TMYfr7kFBOUCSSI ZolYuK/olD+nEj8NVxWcLQXsVcq2HnvZf2WwYDEuaem213KFugHKuh/NEH0PGKWRyj dgTtETxFF4RBPdJTl3apxrHzMzN34X5U8Rc6TvAc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vitaly Kuznetsov , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.16 069/203] KVM: nVMX: Also filter MSR_IA32_VMX_TRUE_PINBASED_CTLS when eVMCS Date: Mon, 14 Feb 2022 10:25:13 +0100 Message-Id: <20220214092512.613921612@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vitaly Kuznetsov [ Upstream commit f80ae0ef089a09e8c18da43a382c3caac9a424a7 ] Similar to MSR_IA32_VMX_EXIT_CTLS/MSR_IA32_VMX_TRUE_EXIT_CTLS, MSR_IA32_VMX_ENTRY_CTLS/MSR_IA32_VMX_TRUE_ENTRY_CTLS pair, MSR_IA32_VMX_TRUE_PINBASED_CTLS needs to be filtered the same way MSR_IA32_VMX_PINBASED_CTLS is currently filtered as guests may solely rely on 'true' MSR data. Note, none of the currently existing Windows/Hyper-V versions are known to stumble upon the unfiltered MSR_IA32_VMX_TRUE_PINBASED_CTLS, the change is aimed at making the filtering future proof. Signed-off-by: Vitaly Kuznetsov Message-Id: <20220112170134.1904308-2-vkuznets@redhat.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/x86/kvm/vmx/evmcs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/kvm/vmx/evmcs.c b/arch/x86/kvm/vmx/evmcs.c index 09fac0ddac8bd..87e3dc10edf40 100644 --- a/arch/x86/kvm/vmx/evmcs.c +++ b/arch/x86/kvm/vmx/evmcs.c @@ -361,6 +361,7 @@ void nested_evmcs_filter_control_msr(u32 msr_index, u64= *pdata) case MSR_IA32_VMX_PROCBASED_CTLS2: ctl_high &=3D ~EVMCS1_UNSUPPORTED_2NDEXEC; break; + case MSR_IA32_VMX_TRUE_PINBASED_CTLS: case MSR_IA32_VMX_PINBASED_CTLS: ctl_high &=3D ~EVMCS1_UNSUPPORTED_PINCTRL; break; --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 26D1AC43217 for ; Mon, 14 Feb 2022 10:27:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346637AbiBNK1r (ORCPT ); Mon, 14 Feb 2022 05:27:47 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:33428 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344320AbiBNKZU (ORCPT ); Mon, 14 Feb 2022 05:25:20 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D8186E4F9; Mon, 14 Feb 2022 01:56:59 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B8C03B80DC4; Mon, 14 Feb 2022 09:56:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E3959C340E9; Mon, 14 Feb 2022 09:56:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832616; bh=x2jfxv6PFGtgRCW1G1/ZajYjEIi5Ja02neps3iJgefE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a4ivL9/UlfuArpmYodNUw9T32SbX0MeE+Ks1AFtP+oBGwOaqbwJutavaPyue0nQxB GZfXMhGd93QG4fqyGiC2CWxEVTHmmfEOxhmthmRC61MeW2+5Xb9isToGY5GuBsDDEG ixAVjbAqnU68PE/83Ls5nZkk9r6NB3iG/0m6mDQ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Christopherson , Liam Merwick , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.16 070/203] KVM: SVM: Dont kill SEV guest if SMAP erratum triggers in usermode Date: Mon, 14 Feb 2022 10:25:14 +0100 Message-Id: <20220214092512.653838993@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 cdf85e0c5dc766fc7fc779466280e454a6d04f87 ] Inject a #GP instead of synthesizing triple fault to try to avoid killing the guest if emulation of an SEV guest fails due to encountering the SMAP erratum. The injected #GP may still be fatal to the guest, e.g. if the userspace process is providing critical functionality, but KVM should make every attempt to keep the guest alive. Signed-off-by: Sean Christopherson Reviewed-by: Liam Merwick Message-Id: <20220120010719.711476-10-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: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/x86/kvm/svm/svm.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c index 3efada37272c0..d6a4acaa65742 100644 --- a/arch/x86/kvm/svm/svm.c +++ b/arch/x86/kvm/svm/svm.c @@ -4530,7 +4530,21 @@ static bool svm_can_emulate_instruction(struct kvm_v= cpu *vcpu, void *insn, int i is_user =3D svm_get_cpl(vcpu) =3D=3D 3; if (smap && (!smep || is_user)) { pr_err_ratelimited("KVM: SEV Guest triggered AMD Erratum 1096\n"); - kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu); + + /* + * If the fault occurred in userspace, arbitrarily inject #GP + * to avoid killing the guest and to hopefully avoid confusing + * the guest kernel too much, e.g. injecting #PF would not be + * coherent with respect to the guest's page tables. Request + * triple fault if the fault occurred in the kernel as there's + * no fault that KVM can inject without confusing the guest. + * In practice, the triple fault is moot as no sane SEV kernel + * will execute from user memory while also running with SMAP=3D1. + */ + if (is_user) + kvm_inject_gp(vcpu, 0); + else + kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu); } =20 return false; --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A621EC4332F for ; Mon, 14 Feb 2022 10:27:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346994AbiBNK1u (ORCPT ); Mon, 14 Feb 2022 05:27:50 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:54654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346954AbiBNKZb (ORCPT ); Mon, 14 Feb 2022 05:25:31 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B8566E549; Mon, 14 Feb 2022 01:57:02 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C15B9B80DFE; Mon, 14 Feb 2022 09:57:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01FFCC340E9; Mon, 14 Feb 2022 09:56:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832619; bh=CVQhcvGz3gaWyOeNO8xbOV8873Pig3FfX9SC9zBkiNY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZTe16K0/LVRFtUM0P2j/AAG9VIUxciAgzx/GxkhqJgH3rqekcVG+Bh0Y+Z7FohKLA Ijp/wBPSsP9+QLslSLMx/qZqDim7AwB6LWHsQVzMXyzUNRMe9diAjWRNQmaflD6b1k fIX5R7tJb3JR9B4Oiw6FZEsbpsdPcFnNYHsZO2QQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Woodhouse , Alexander Graf , Sean Christopherson , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.16 071/203] KVM: VMX: Set vmcs.PENDING_DBG.BS on #DB in STI/MOVSS blocking shadow Date: Mon, 14 Feb 2022 10:25:15 +0100 Message-Id: <20220214092512.687019550@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 b9bed78e2fa9571b7c983b20666efa0009030c71 ] Set vmcs.GUEST_PENDING_DBG_EXCEPTIONS.BS, a.k.a. the pending single-step breakpoint flag, when re-injecting a #DB with RFLAGS.TF=3D1, and STI or MOVSS blocking is active. Setting the flag is necessary to make VM-Entry consistency checks happy, as VMX has an invariant that if RFLAGS.TF is set and STI/MOVSS blocking is true, then the previous instruction must have been STI or MOV/POP, and therefore a single-step #DB must be pending since the RFLAGS.TF cannot have been set by the previous instruction, i.e. the one instruction delay after setting RFLAGS.TF must have already expired. Normally, the CPU sets vmcs.GUEST_PENDING_DBG_EXCEPTIONS.BS appropriately when recording guest state as part of a VM-Exit, but #DB VM-Exits intentionally do not treat the #DB as "guest state" as interception of the #DB effectively makes the #DB host-owned, thus KVM needs to manually set PENDING_DBG.BS when forwarding/re-injecting the #DB to the guest. Note, although this bug can be triggered by guest userspace, doing so requires IOPL=3D3, and guest userspace running with IOPL=3D3 has full access to all I/O ports (from the guest's perspective) and can crash/reboot the guest any number of ways. IOPL=3D3 is required because STI blocking kicks in if and only if RFLAGS.IF is toggled 0=3D>1, and if CPL>IOPL, STI either takes a #GP or modifies RFLAGS.VIF, not RFLAGS.IF. MOVSS blocking can be initiated by userspace, but can be coincident with a #DB if and only if DR7.GD=3D1 (General Detect enabled) and a MOV DR is executed in the MOVSS shadow. MOV DR #GPs at CPL>0, thus MOVSS blocking is problematic only for CPL0 (and only if the guest is crazy enough to access a DR in a MOVSS shadow). All other sources of #DBs are either suppressed by MOVSS blocking (single-step, code fetch, data, and I/O), are mutually exclusive with MOVSS blocking (T-bit task switch), or are already handled by KVM (ICEBP, a.k.a. INT1). This bug was originally found by running tests[1] created for XSA-308[2]. Note that Xen's userspace test emits ICEBP in the MOVSS shadow, which is presumably why the Xen bug was deemed to be an exploitable DOS from guest userspace. KVM already handles ICEBP by skipping the ICEBP instruction and thus clears MOVSS blocking as a side effect of its "emulation". [1] http://xenbits.xenproject.org/docs/xtf/xsa-308_2main_8c_source.html [2] https://xenbits.xen.org/xsa/advisory-308.html Reported-by: David Woodhouse Reported-by: Alexander Graf Signed-off-by: Sean Christopherson Message-Id: <20220120000624.655815-1-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: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/x86/kvm/vmx/vmx.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c index 7f4e6f625abcf..fe4a36c984460 100644 --- a/arch/x86/kvm/vmx/vmx.c +++ b/arch/x86/kvm/vmx/vmx.c @@ -4811,8 +4811,33 @@ static int handle_exception_nmi(struct kvm_vcpu *vcp= u) dr6 =3D vmx_get_exit_qual(vcpu); if (!(vcpu->guest_debug & (KVM_GUESTDBG_SINGLESTEP | KVM_GUESTDBG_USE_HW_BP))) { + /* + * If the #DB was due to ICEBP, a.k.a. INT1, skip the + * instruction. ICEBP generates a trap-like #DB, but + * despite its interception control being tied to #DB, + * is an instruction intercept, i.e. the VM-Exit occurs + * on the ICEBP itself. Note, skipping ICEBP also + * clears STI and MOVSS blocking. + * + * For all other #DBs, set vmcs.PENDING_DBG_EXCEPTIONS.BS + * if single-step is enabled in RFLAGS and STI or MOVSS + * blocking is active, as the CPU doesn't set the bit + * on VM-Exit due to #DB interception. VM-Entry has a + * consistency check that a single-step #DB is pending + * in this scenario as the previous instruction cannot + * have toggled RFLAGS.TF 0=3D>1 (because STI and POP/MOV + * don't modify RFLAGS), therefore the one instruction + * delay when activating single-step breakpoints must + * have already expired. Note, the CPU sets/clears BS + * as appropriate for all other VM-Exits types. + */ if (is_icebp(intr_info)) WARN_ON(!skip_emulated_instruction(vcpu)); + else if ((vmx_get_rflags(vcpu) & X86_EFLAGS_TF) && + (vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) & + (GUEST_INTR_STATE_STI | GUEST_INTR_STATE_MOV_SS))) + vmcs_writel(GUEST_PENDING_DBG_EXCEPTIONS, + vmcs_readl(GUEST_PENDING_DBG_EXCEPTIONS) | DR6_BS); =20 kvm_queue_exception_p(vcpu, DB_VECTOR, dr6); return 1; --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5B4D6C433F5 for ; Mon, 14 Feb 2022 10:31:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233034AbiBNKbZ (ORCPT ); Mon, 14 Feb 2022 05:31:25 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:37470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348051AbiBNKap (ORCPT ); Mon, 14 Feb 2022 05:30:45 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E397C9BF44; Mon, 14 Feb 2022 01:59:14 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BE1336077B; Mon, 14 Feb 2022 09:59:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8339EC340EF; Mon, 14 Feb 2022 09:59:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832754; bh=ZUacl007zA4k+q0kyD4PfVFmSEOT8YIduCKetp5Er64=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xzO2GJlTUg3rekneT8kWb2am/aB3WjJDPNlyXp1ZB7yl+uKb7ndr4+ErY2igyb/YT YNWoc9Vd+FuTSgwS7RYiWSJOh4gln1xFW879juxSkETxa6fXmVhN0fyvUNsIuKiAzj y7UF5O+lRhP7VTuM3BqZr4RCDxKqXw7MYuVr2eK8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aaron Lewis , Jim Mattson , Paolo Bonzini , Sasha Levin Subject: [PATCH 5.16 072/203] KVM: x86: Report deprecated x87 features in supported CPUID Date: Mon, 14 Feb 2022 10:25:16 +0100 Message-Id: <20220214092512.726548643@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jim Mattson [ Upstream commit e3bcfda012edd3564e12551b212afbd2521a1f68 ] CPUID.(EAX=3D7,ECX=3D0):EBX.FDP_EXCPTN_ONLY[bit 6] and CPUID.(EAX=3D7,ECX=3D0):EBX.ZERO_FCS_FDS[bit 13] are "defeature" bits. Unlike most of the other CPUID feature bits, these bits are clear if the features are present and set if the features are not present. These bits should be reported in KVM_GET_SUPPORTED_CPUID, because if these bits are set on hardware, they cannot be cleared in the guest CPUID. Doing so would claim guest support for a feature that the hardware doesn't support and that can't be efficiently emulated. Of course, any software (e.g WIN87EM.DLL) expecting these features to be present likely predates these CPUID feature bits and therefore doesn't know to check for them anyway. Aaron Lewis added the corresponding X86_FEATURE macros in commit cbb99c0f5887 ("x86/cpufeatures: Add FDP_EXCPTN_ONLY and ZERO_FCS_FDS"), with the intention of reporting these bits in KVM_GET_SUPPORTED_CPUID, but I was unable to find a proposed patch on the kvm list. Opportunistically reordered the CPUID_7_0_EBX capability bits from least to most significant. Cc: Aaron Lewis Signed-off-by: Jim Mattson Message-Id: <20220204001348.2844660-1-jmattson@google.com> Signed-off-by: Paolo Bonzini Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/x86/kvm/cpuid.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index add8f58d686e3..bf18679757c70 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -532,12 +532,13 @@ void kvm_set_cpu_caps(void) ); =20 kvm_cpu_cap_mask(CPUID_7_0_EBX, - F(FSGSBASE) | F(SGX) | F(BMI1) | F(HLE) | F(AVX2) | F(SMEP) | - F(BMI2) | F(ERMS) | F(INVPCID) | F(RTM) | 0 /*MPX*/ | F(RDSEED) | - F(ADX) | F(SMAP) | F(AVX512IFMA) | F(AVX512F) | F(AVX512PF) | - F(AVX512ER) | F(AVX512CD) | F(CLFLUSHOPT) | F(CLWB) | F(AVX512DQ) | - F(SHA_NI) | F(AVX512BW) | F(AVX512VL) | 0 /*INTEL_PT*/ - ); + F(FSGSBASE) | F(SGX) | F(BMI1) | F(HLE) | F(AVX2) | + F(FDP_EXCPTN_ONLY) | F(SMEP) | F(BMI2) | F(ERMS) | F(INVPCID) | + F(RTM) | F(ZERO_FCS_FDS) | 0 /*MPX*/ | F(AVX512F) | + F(AVX512DQ) | F(RDSEED) | F(ADX) | F(SMAP) | F(AVX512IFMA) | + F(CLFLUSHOPT) | F(CLWB) | 0 /*INTEL_PT*/ | F(AVX512PF) | + F(AVX512ER) | F(AVX512CD) | F(SHA_NI) | F(AVX512BW) | + F(AVX512VL)); =20 kvm_cpu_cap_mask(CPUID_7_ECX, F(AVX512VBMI) | F(LA57) | F(PKU) | 0 /*OSPKE*/ | F(RDPID) | --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84DB1C433EF for ; Mon, 14 Feb 2022 10:28:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347185AbiBNK23 (ORCPT ); Mon, 14 Feb 2022 05:28:29 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:33136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347936AbiBNK0g (ORCPT ); Mon, 14 Feb 2022 05:26:36 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC25480919; Mon, 14 Feb 2022 01:57:37 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 22EEB6126B; Mon, 14 Feb 2022 09:57:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EED58C340E9; Mon, 14 Feb 2022 09:57:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832644; bh=UhSIihMSSu2vmuCQjZPE4NANjKqrX8Al7bFfWHKoSt8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S3Nosd+jS/PHJMhM06tPyjswsgXCSDm7SEzljr1p/w0X1s8Rym7o4//Qm2yLRfqWt apGDm3OJ4NQfIUqMxWB0BkkizKBxHlX1iVYZDUi74xLBmsYvQQnD3aw4MA72OuaRvn MVseu/E8nzqczIZQwgBI7ctJLwtBdQs/JZAJldgw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Aurelien Jarno , Alexandre Ghiti , Palmer Dabbelt Subject: [PATCH 5.16 073/203] riscv: fix build with binutils 2.38 Date: Mon, 14 Feb 2022 10:25:17 +0100 Message-Id: <20220214092512.757891200@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Aurelien Jarno commit 6df2a016c0c8a3d0933ef33dd192ea6606b115e3 upstream. >From version 2.38, binutils default to ISA spec version 20191213. This means that the csr read/write (csrr*/csrw*) instructions and fence.i instruction has separated from the `I` extension, become two standalone extensions: Zicsr and Zifencei. As the kernel uses those instruction, this causes the following build failure: CC arch/riscv/kernel/vdso/vgettimeofday.o <>/arch/riscv/include/asm/vdso/gettimeofday.h: Assembler messag= es: <>/arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unreco= gnized opcode `csrr a5,0xc01' <>/arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unreco= gnized opcode `csrr a5,0xc01' <>/arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unreco= gnized opcode `csrr a5,0xc01' <>/arch/riscv/include/asm/vdso/gettimeofday.h:71: Error: unreco= gnized opcode `csrr a5,0xc01' The fix is to specify those extensions explicitely in -march. However as older binutils version do not support this, we first need to detect that. Signed-off-by: Aurelien Jarno Tested-by: Alexandre Ghiti 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: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/riscv/Makefile | 6 ++++++ 1 file changed, 6 insertions(+) --- a/arch/riscv/Makefile +++ b/arch/riscv/Makefile @@ -50,6 +50,12 @@ riscv-march-$(CONFIG_ARCH_RV32I) :=3D rv32 riscv-march-$(CONFIG_ARCH_RV64I) :=3D rv64ima riscv-march-$(CONFIG_FPU) :=3D $(riscv-march-y)fd riscv-march-$(CONFIG_RISCV_ISA_C) :=3D $(riscv-march-y)c + +# Newer binutils versions default to ISA spec version 20191213 which moves= some +# instructions from the I extension to the Zicsr and Zifencei extensions. +toolchain-need-zicsr-zifencei :=3D $(call cc-option-yn, -march=3D$(riscv-m= arch-y)_zicsr_zifencei) +riscv-march-$(toolchain-need-zicsr-zifencei) :=3D $(riscv-march-y)_zicsr_z= ifencei + KBUILD_CFLAGS +=3D -march=3D$(subst fd,,$(riscv-march-y)) KBUILD_AFLAGS +=3D -march=3D$(riscv-march-y) =20 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3565C433EF for ; Mon, 14 Feb 2022 10:28:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233864AbiBNK3C (ORCPT ); Mon, 14 Feb 2022 05:29:02 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:33376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348488AbiBNK1M (ORCPT ); Mon, 14 Feb 2022 05:27:12 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24EEB70305; Mon, 14 Feb 2022 01:58:03 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3710760909; Mon, 14 Feb 2022 09:58:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07BBFC340E9; Mon, 14 Feb 2022 09:58:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832681; bh=Mx1SGZUBK1BtI9k1C8LaoJvamGvMNJDsqdlUYTo9V3k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bUKgJ755KdXqvatwPSPuq0nViyLgyOuaIWtdIeRzy2shh2M/+sipoUNDMS1H6DlNR Be3zfWwBVPr2zle79aZZ4is7atmrJvtzoXEEgC5QZ9qe9gZ4lsV35jGVsNXf0L7aRy IAfhDA7NssO5KJ4H22/gqgfwjydf/buSiGVPr9hA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Myrtle Shah , Palmer Dabbelt Subject: [PATCH 5.16 074/203] riscv: Fix XIP_FIXUP_FLASH_OFFSET Date: Mon, 14 Feb 2022 10:25:18 +0100 Message-Id: <20220214092512.792653468@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Myrtle Shah commit 3c04d84508b54fcf524093b0d4a718680ed67f0f upstream. There were several problems with the calculation. Not only was an 'and' being computed into t1 but thrown away; but the 'and' itself would cause problems if the granularity of the XIP physical address was less than XIP_OFFSET - in my case I had the kernel image at 2MB in SPI flash. Fixes: f9ace4ede49b ("riscv: remove .text section size limitation for XIP") Cc: stable@vger.kernel.org Signed-off-by: Myrtle Shah Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/riscv/kernel/head.S | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) --- a/arch/riscv/kernel/head.S +++ b/arch/riscv/kernel/head.S @@ -21,14 +21,13 @@ add \reg, \reg, t0 .endm .macro XIP_FIXUP_FLASH_OFFSET reg - la t1, __data_loc - li t0, XIP_OFFSET_MASK - and t1, t1, t0 - li t1, XIP_OFFSET - sub t0, t0, t1 - sub \reg, \reg, t0 + la t0, __data_loc + REG_L t1, _xip_phys_offset + sub \reg, \reg, t1 + add \reg, \reg, t0 .endm _xip_fixup: .dword CONFIG_PHYS_RAM_BASE - CONFIG_XIP_PHYS_ADDR - XIP_OFFSET +_xip_phys_offset: .dword CONFIG_XIP_PHYS_ADDR + XIP_OFFSET #else .macro XIP_FIXUP_OFFSET reg .endm From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 563DCC433F5 for ; Mon, 14 Feb 2022 10:30:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347470AbiBNKa2 (ORCPT ); Mon, 14 Feb 2022 05:30:28 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:34814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347423AbiBNK3r (ORCPT ); Mon, 14 Feb 2022 05:29:47 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 909D570903; Mon, 14 Feb 2022 01:58:41 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 02EC860909; Mon, 14 Feb 2022 09:58:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C8EA7C340EF; Mon, 14 Feb 2022 09:58:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832718; bh=KQ+9AInoANFoWzhgLj+DNeCDUD5Jcu/QtFa5pulHFos=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nXWyvypzeXpQzLG05XYxYqR8UmagGjHjd9eDOKNb6D/IDxCOA+8YtsWprl5MXkpmg jo66EjVnBi9aRdzmixtGh0DO2IaPWb5kFjmRiTmLcZGDpT+Mrd0+7VoRNQbCdwgarD H2HT8/7cdwCsoTb2eUsejhDvcWGoXozLeHYhQg3o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pingfan Liu , Palmer Dabbelt Subject: [PATCH 5.16 075/203] riscv: cpu-hotplug: clear cpu from numa map when teardown Date: Mon, 14 Feb 2022 10:25:19 +0100 Message-Id: <20220214092512.830651630@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pingfan Liu commit f40fe31c01445f31253b15bef2412b33ae31093b upstream. There is numa_add_cpu() when cpus online, accordingly, there should be numa_remove_cpu() when cpus offline. Signed-off-by: Pingfan Liu Fixes: 4f0e8eef772e ("riscv: Add numa support for riscv64 platform") Cc: stable@vger.kernel.org [Palmer: Add missing NUMA include] Signed-off-by: Palmer Dabbelt Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/riscv/kernel/cpu-hotplug.c | 2 ++ 1 file changed, 2 insertions(+) --- a/arch/riscv/kernel/cpu-hotplug.c +++ b/arch/riscv/kernel/cpu-hotplug.c @@ -12,6 +12,7 @@ #include #include #include +#include #include =20 void cpu_stop(void); @@ -46,6 +47,7 @@ int __cpu_disable(void) return ret; =20 remove_cpu_topology(cpu); + numa_remove_cpu(cpu); set_cpu_online(cpu, false); irq_migrate_all_off_this_cpu(); =20 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4AAA5C43219 for ; Mon, 14 Feb 2022 10:31:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347710AbiBNKbS (ORCPT ); Mon, 14 Feb 2022 05:31:18 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:38158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347476AbiBNKaI (ORCPT ); Mon, 14 Feb 2022 05:30:08 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 681669969B; Mon, 14 Feb 2022 01:58:57 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D5C10B80E02; Mon, 14 Feb 2022 09:58:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A60DC340E9; Mon, 14 Feb 2022 09:58:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832734; bh=PAJM3UNn5kgTW1Q50Bd3CjH0r2slOOk1wceAUWcc4+I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eAG5aNmB7Cy4shBmWvcwarKIqspJyeLMuXsf0Wh1UOQmvvFtsU3yPyK9lPDQwpPp4 uEiDkAuIKEOZ+N1Zn1cUL3Kvog8SZOIISN5+mBQMEj/8kT+pkBEY+fDcMxIMqS4N/A fXGwFIu65Gdq4/XfM1JaZ42qMdR9VQJgTIQXfS+s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Myrtle Shah , Palmer Dabbelt Subject: [PATCH 5.16 076/203] riscv/mm: Add XIP_FIXUP for phys_ram_base Date: Mon, 14 Feb 2022 10:25:20 +0100 Message-Id: <20220214092512.862740072@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Palmer Dabbelt commit 4b1c70aa8ed8249608bb991380cb8ff423edf49e upstream. This manifests as a crash early in boot on VexRiscv. Signed-off-by: Myrtle Shah [Palmer: split commit] Fixes: 6d7f91d914bc ("riscv: Get rid of CONFIG_PHYS_RAM_BASE in kernel phys= ical address conversion") 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: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/riscv/mm/init.c | 1 + 1 file changed, 1 insertion(+) --- a/arch/riscv/mm/init.c +++ b/arch/riscv/mm/init.c @@ -41,6 +41,7 @@ phys_addr_t phys_ram_base __ro_after_ini EXPORT_SYMBOL(phys_ram_base); =20 #ifdef CONFIG_XIP_KERNEL +#define phys_ram_base (*(phys_addr_t *)XIP_FIXUP(&phys_ram_base)) extern char _xiprom[], _exiprom[], __data_loc; #endif =20 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE12EC433F5 for ; Mon, 14 Feb 2022 10:32:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347778AbiBNKcz (ORCPT ); Mon, 14 Feb 2022 05:32:55 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347973AbiBNKan (ORCPT ); Mon, 14 Feb 2022 05:30:43 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAB7D6A39F; Mon, 14 Feb 2022 01:59:12 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DCB10B80D6D; Mon, 14 Feb 2022 09:58:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2417FC340EF; Mon, 14 Feb 2022 09:58:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832737; bh=3epFaGK+vhe/wOw2uqSsd6GvhL9Cvq9qJdaq6ifWC2k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1OGefQ8XS1oCibLf7M7V5pgH1ML5prBtTJaY640+5N5OhLoPjy/Ly4cE/uH59sKbm 4HWMsTj/H1BQb8Ri3XA8LwWNv5bmdwXOU+2GpAKrC3N4aSJysFEPhsSq/Nf822bOL0 f5JIWQmgrFRYSv3Cyrfn3rD2MJ/8VMMHRWh+kmiI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Changbin Du , Palmer Dabbelt Subject: [PATCH 5.16 077/203] riscv: eliminate unreliable __builtin_frame_address(1) Date: Mon, 14 Feb 2022 10:25:21 +0100 Message-Id: <20220214092512.896653495@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Changbin Du commit 6a00ef4493706a23120057fafbc62379bcde11ec upstream. I tried different pieces of code which uses __builtin_frame_address(1) (with both gcc version 7.5.0 and 10.3.0) to verify whether it works as expected on riscv64. The result is negative. What the compiler had generated is as below: 31 fp =3D (unsigned long)__builtin_frame_address(1); 0xffffffff80006024 <+200>: ld s1,0(s0) It takes '0(s0)' as the address of frame 1 (caller), but the actual address should be '-16(s0)'. | ... | <-+ +-----------------+ | | return address | | | previous fp | | | saved registers | | | local variables | | $fp --> | ... | | +-----------------+ | | return address | | | previous fp --------+ | saved registers | $sp --> | local variables | +-----------------+ This leads the kernel can not dump the full stack trace on riscv. [ 7.222126][ T1] Call Trace: [ 7.222804][ T1] [] dump_backtrace+0x2c/0x3a This problem is not exposed on most riscv builds just because the '0(s0)' occasionally is the address frame 2 (caller's caller), if only ra and fp are stored in frame 1 (caller). | ... | <-+ +-----------------+ | | return address | | $fp --> | previous fp | | +-----------------+ | | return address | | | previous fp --------+ | saved registers | $sp --> | local variables | +-----------------+ This could be a *bug* of gcc that should be fixed. But as noted in gcc manual "Calling this function with a nonzero argument can have unpredictable effects, including crashing the calling program.", let's remove the '__builtin_frame_address(1)' in backtrace code. With this fix now it can show full stack trace: [ 10.444838][ T1] Call Trace: [ 10.446199][ T1] [] dump_backtrace+0x2c/0x3a [ 10.447711][ T1] [] show_stack+0x32/0x3e [ 10.448710][ T1] [] dump_stack_lvl+0x58/0x7a [ 10.449941][ T1] [] dump_stack+0x14/0x1c [ 10.450929][ T1] [] ubsan_epilogue+0x10/0x5a [ 10.451869][ T1] [] __ubsan_handle_load_invalid_val= ue+0x6c/0x78 [ 10.453049][ T1] [] __pagevec_release+0x62/0x64 [ 10.455476][ T1] [] truncate_inode_pages_range+0x13= 2/0x5be [ 10.456798][ T1] [] truncate_inode_pages+0x24/0x30 [ 10.457853][ T1] [] kill_bdev+0x32/0x3c ... Signed-off-by: Changbin Du Fixes: eac2f3059e02 ("riscv: stacktrace: fix the riscv stacktrace when CONF= IG_FRAME_POINTER enabled") 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: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/riscv/kernel/stacktrace.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) --- a/arch/riscv/kernel/stacktrace.c +++ b/arch/riscv/kernel/stacktrace.c @@ -22,15 +22,16 @@ void notrace walk_stackframe(struct task bool (*fn)(void *, unsigned long), void *arg) { unsigned long fp, sp, pc; + int level =3D 0; =20 if (regs) { fp =3D frame_pointer(regs); sp =3D user_stack_pointer(regs); pc =3D instruction_pointer(regs); } else if (task =3D=3D NULL || task =3D=3D current) { - fp =3D (unsigned long)__builtin_frame_address(1); - sp =3D (unsigned long)__builtin_frame_address(0); - pc =3D (unsigned long)__builtin_return_address(0); + fp =3D (unsigned long)__builtin_frame_address(0); + sp =3D sp_in_global; + pc =3D (unsigned long)walk_stackframe; } else { /* task blocked in __switch_to */ fp =3D task->thread.s[0]; @@ -42,7 +43,7 @@ void notrace walk_stackframe(struct task unsigned long low, high; struct stackframe *frame; =20 - if (unlikely(!__kernel_text_address(pc) || !fn(arg, pc))) + if (unlikely(!__kernel_text_address(pc) || (level++ >=3D 1 && !fn(arg, p= c)))) break; =20 /* Validate frame pointer */ From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 516CEC433EF for ; Mon, 14 Feb 2022 10:31:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347413AbiBNKb3 (ORCPT ); Mon, 14 Feb 2022 05:31:29 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:37374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348057AbiBNKap (ORCPT ); Mon, 14 Feb 2022 05:30:45 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 334C39BF51; Mon, 14 Feb 2022 01:59:18 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E122260A6B; Mon, 14 Feb 2022 09:59:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1183C340EF; Mon, 14 Feb 2022 09:59:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832741; bh=OEDJNIYHkJ6QNba+OjECjhNgSeZq5mr0y+XWi/DAICA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CdQO1uR8O2vYV9zRw5PrP59xIgrOHYS8V5zbSv7uBiXSzY5+PVhvmp9VAnSrtHofd BHT++CtC/Llydbm9vngq62QoRVo/QudTpbLJg2HNpvasbbsKcGHmBe5UgibMW4D2Bv Owfo3NAS0vavLiHL/bP7hRYtnggfOKlrPI9T+LzI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bob Peterson , Andreas Gruenbacher Subject: [PATCH 5.16 078/203] gfs2: Fix gfs2_release for non-writers regression Date: Mon, 14 Feb 2022 10:25:22 +0100 Message-Id: <20220214092512.927908552@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bob Peterson commit d3add1a9519dcacd6e644ecac741c56cf18b67f5 upstream. When a file is opened for writing, the vfs code (do_dentry_open) calls get_write_access for the inode, thus incrementing the inode's write count. That writer normally then creates a multi-block reservation for the inode (i_res) that can be re-used by other writers, which speeds up writes for applications that stupidly loop on open/write/close. When the writes are all done, the multi-block reservation should be deleted when the file is closed by the last "writer." Commit 0ec9b9ea4f83 broke that concept when it moved the call to gfs2_rs_delete before the check for FMODE_WRITE. Non-writers have no business removing the multi-block reservations of writers. In fact, if someone opens and closes the file for RO while a writer has a multi-block reservation, the RO closer will delete the reservation midway through the write, and this results in: kernel BUG at fs/gfs2/rgrp.c:677! (or thereabouts) which is: BUG_ON(rs->rs_requested); from function gfs2_rs_deltree. This patch moves the check back inside the check for FMODE_WRITE. Fixes: 0ec9b9ea4f83 ("gfs2: Check for active reservation in gfs2_release") Cc: stable@vger.kernel.org # v5.12+ Signed-off-by: Bob Peterson Signed-off-by: Andreas Gruenbacher Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- fs/gfs2/file.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c @@ -704,10 +704,11 @@ static int gfs2_release(struct inode *in kfree(file->private_data); file->private_data =3D NULL; =20 - if (gfs2_rs_active(&ip->i_res)) - gfs2_rs_delete(ip, &inode->i_writecount); - if (file->f_mode & FMODE_WRITE) + if (file->f_mode & FMODE_WRITE) { + if (gfs2_rs_active(&ip->i_res)) + gfs2_rs_delete(ip, &inode->i_writecount); gfs2_qa_put(ip); + } return 0; } =20 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EEA62C433F5 for ; Mon, 14 Feb 2022 10:32:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347701AbiBNKcs (ORCPT ); Mon, 14 Feb 2022 05:32:48 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:38158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347858AbiBNKaj (ORCPT ); Mon, 14 Feb 2022 05:30:39 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86D0270CE0; Mon, 14 Feb 2022 01:59:08 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E8024B80DC8; Mon, 14 Feb 2022 09:59:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E483EC340EF; Mon, 14 Feb 2022 09:59:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832744; bh=9gahyeLnbkRBgOkWxxyP2q3atLHrR6v1XwsdkB7+PGE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i20lY47uCKLP/CaazcpUsMneyzTy+zPuJ6OeUdMd8EGa2xRtQZSODRJ0xSMCIT6Vo hwm2SDYi+GP74CRte8c+sTMv2NWmp8wxVHcsGGkai0yqn7LsNjb7OLNAaOk1vjXUdL B4J+0drK72KCYrPNwcvr/ZH+Q9yf+wNR0qzgVqr4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andreas Gruenbacher Subject: [PATCH 5.16 079/203] Revert "gfs2: check context in gfs2_glock_put" Date: Mon, 14 Feb 2022 10:25:23 +0100 Message-Id: <20220214092512.963476086@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Andreas Gruenbacher commit 356b8103d4c495d5440e3e687db9026ec2b76043 upstream. It turns out that the might_sleep() call that commit 660a6126f8c3 adds is triggering occasional data corruption in testing. We're not sure about the root cause yet, but since this commit was added as a debugging aid only, revert it for now. This reverts commit 660a6126f8c3208f6df8d552039cda078a8426d1. Fixes: 660a6126f8c3 ("gfs2: check context in gfs2_glock_put") Cc: stable@vger.kernel.org # v5.16+ Signed-off-by: Andreas Gruenbacher Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- fs/gfs2/glock.c | 3 --- 1 file changed, 3 deletions(-) --- a/fs/gfs2/glock.c +++ b/fs/gfs2/glock.c @@ -301,9 +301,6 @@ void gfs2_glock_queue_put(struct gfs2_gl =20 void gfs2_glock_put(struct gfs2_glock *gl) { - /* last put could call sleepable dlm api */ - might_sleep(); - if (lockref_put_or_lock(&gl->gl_lockref)) return; =20 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4696AC433F5 for ; Mon, 14 Feb 2022 10:31:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347495AbiBNKbx (ORCPT ); Mon, 14 Feb 2022 05:31:53 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:37350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348260AbiBNKau (ORCPT ); Mon, 14 Feb 2022 05:30:50 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 265909BF7C; Mon, 14 Feb 2022 01:59:26 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 14237B80DCF; Mon, 14 Feb 2022 09:59:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BAE7C340F1; Mon, 14 Feb 2022 09:59:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832747; bh=yh+Oo2C0NdYplnno+CZkh/DZsN/Zg/W1MtgKkWir/Qw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ndK5yA4MkOTdInS3Q49wpbr+lDOIN9ivUnbXzjx+vpvzwD+IrHvB0VMpFuTfhdUuy EM5Y/48qENX6YUynIs5rK2eQLnzjVGj1/FtmRF+ww7aP6L2WLvSHS3Jx6cvWwLrIdk qjJqjxOxWn0aoCX5lZSKZduqiSO7WsYozSu8j27g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joey Corleone , Sergiu Deitsch , David Spencer , Bjorn Helgaas , Jan Kiszka Subject: [PATCH 5.16 080/203] Revert "PCI/portdrv: Do not setup up IRQs if there are no users" Date: Mon, 14 Feb 2022 10:25:24 +0100 Message-Id: <20220214092512.997663857@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Helgaas commit 075b7d363c675ef7fa03918881caeca3458e2a96 upstream. This reverts commit 0e8ae5a6ff5952253cd7cc0260df838ab4c21009. 0e8ae5a6ff59 ("PCI/portdrv: Do not setup up IRQs if there are no users") reduced usage of IRQs when we don't think we need them. But Joey, Sergiu, and David reported choppy GUI rendering, systems that became unresponsive every few seconds, incorrect values reported by cpufreq, and high IRQ 16 CPU usage. Joey bisected the issues to 0e8ae5a6ff59, so revert it until we figure out a better solution. Link: https://lore.kernel.org/r/20220210222717.GA658201@bhelgaas Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D215533 Link: https://bugzilla.kernel.org/show_bug.cgi?id=3D215546 Reported-by: Joey Corleone Reported-by: Sergiu Deitsch Reported-by: David Spencer Signed-off-by: Bjorn Helgaas Cc: stable@vger.kernel.org # v5.16+ Cc: Jan Kiszka Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/pci/pcie/portdrv_core.c | 47 ++++++++++++++---------------------= ----- 1 file changed, 17 insertions(+), 30 deletions(-) --- a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c @@ -166,6 +166,9 @@ static int pcie_init_service_irqs(struct { int ret, i; =20 + for (i =3D 0; i < PCIE_PORT_DEVICE_MAXSERVICES; i++) + irqs[i] =3D -1; + /* * If we support PME but can't use MSI/MSI-X for it, we have to * fall back to INTx or other interrupts, e.g., a system shared @@ -314,10 +317,8 @@ static int pcie_device_init(struct pci_d */ int pcie_port_device_register(struct pci_dev *dev) { - int status, capabilities, irq_services, i, nr_service; - int irqs[PCIE_PORT_DEVICE_MAXSERVICES] =3D { - [0 ... PCIE_PORT_DEVICE_MAXSERVICES-1] =3D -1 - }; + int status, capabilities, i, nr_service; + int irqs[PCIE_PORT_DEVICE_MAXSERVICES]; =20 /* Enable PCI Express port device */ status =3D pci_enable_device(dev); @@ -330,32 +331,18 @@ int pcie_port_device_register(struct pci return 0; =20 pci_set_master(dev); - - irq_services =3D 0; - if (IS_ENABLED(CONFIG_PCIE_PME)) - irq_services |=3D PCIE_PORT_SERVICE_PME; - if (IS_ENABLED(CONFIG_PCIEAER)) - irq_services |=3D PCIE_PORT_SERVICE_AER; - if (IS_ENABLED(CONFIG_HOTPLUG_PCI_PCIE)) - irq_services |=3D PCIE_PORT_SERVICE_HP; - if (IS_ENABLED(CONFIG_PCIE_DPC)) - irq_services |=3D PCIE_PORT_SERVICE_DPC; - irq_services &=3D capabilities; - - if (irq_services) { - /* - * Initialize service IRQs. Don't use service devices that - * require interrupts if there is no way to generate them. - * However, some drivers may have a polling mode (e.g. - * pciehp_poll_mode) that can be used in the absence of IRQs. - * Allow them to determine if that is to be used. - */ - status =3D pcie_init_service_irqs(dev, irqs, irq_services); - if (status) { - irq_services &=3D PCIE_PORT_SERVICE_HP; - if (!irq_services) - goto error_disable; - } + /* + * Initialize service irqs. Don't use service devices that + * require interrupts if there is no way to generate them. + * However, some drivers may have a polling mode (e.g. pciehp_poll_mode) + * that can be used in the absence of irqs. Allow them to determine + * if that is to be used. + */ + status =3D pcie_init_service_irqs(dev, irqs, capabilities); + if (status) { + capabilities &=3D PCIE_PORT_SERVICE_HP; + if (!capabilities) + goto error_disable; } =20 /* Allocate child services if any */ From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9E15C433EF for ; Mon, 14 Feb 2022 10:31:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347491AbiBNKcD (ORCPT ); Mon, 14 Feb 2022 05:32:03 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348356AbiBNKav (ORCPT ); Mon, 14 Feb 2022 05:30:51 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18E1D6582E; Mon, 14 Feb 2022 01:59:30 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 44CD9B80DCD; Mon, 14 Feb 2022 09:59:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E9BDC340E9; Mon, 14 Feb 2022 09:59:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832750; bh=hG9jkos58WAdkn3Ip/Te7FXuqEYEgOqyyoE7Oxk6cmw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MUzYQ0amPezkMpXWFJ+mysSCadET0+DFUACCI8BkH83cmV75PDy052pnog0Mq9KSG GyhXVUR4P9MzIe6/lsytCDWt8u/INRs4I9d9/1LWUZ9YjlnWuheB56Pb53/e8O+Jgz xeBrfP/moHJTRh7gMJ3yN80OoirNkBbioDJ1qH+I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fabio Estevam , Shawn Guo Subject: [PATCH 5.16 081/203] ARM: dts: imx23-evk: Remove MX23_PAD_SSP1_DETECT from hog group Date: Mon, 14 Feb 2022 10:25:25 +0100 Message-Id: <20220214092513.030990533@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Fabio Estevam commit 42c9b28e6862d16db82a56f5667cf4d1f6658cf6 upstream. Currently, SD card fails to mount due to the following pinctrl error: [ 11.170000] imx23-pinctrl 80018000.pinctrl: pin SSP1_DETECT already requ= ested by 80018000.pinctrl; cannot claim for 80010000.spi [ 11.180000] imx23-pinctrl 80018000.pinctrl: pin-65 (80010000.spi) status= -22 [ 11.190000] imx23-pinctrl 80018000.pinctrl: could not request pin 65 (SS= P1_DETECT) from group mmc0-pins-fixup.0 on device 80018000.pinctrl [ 11.200000] mxs-mmc 80010000.spi: Error applying setting, reverse things= back Fix it by removing the MX23_PAD_SSP1_DETECT pin from the hog group as it is already been used by the mmc0-pins-fixup pinctrl group. With this change the rootfs can be mounted and the imx23-evk board can boot successfully. Cc: Fixes: bc3875f1a61e ("ARM: dts: mxs: modify mx23/mx28 dts files to use pinc= trl headers") Signed-off-by: Fabio Estevam Signed-off-by: Shawn Guo Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/arm/boot/dts/imx23-evk.dts | 1 - 1 file changed, 1 deletion(-) --- a/arch/arm/boot/dts/imx23-evk.dts +++ b/arch/arm/boot/dts/imx23-evk.dts @@ -79,7 +79,6 @@ MX23_PAD_LCD_RESET__GPIO_1_18 MX23_PAD_PWM3__GPIO_1_29 MX23_PAD_PWM4__GPIO_1_30 - MX23_PAD_SSP1_DETECT__SSP1_DETECT >; fsl,drive-strength =3D ; fsl,voltage =3D ; From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A110FC433EF for ; Mon, 14 Feb 2022 10:28:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347457AbiBNK2b (ORCPT ); Mon, 14 Feb 2022 05:28:31 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:37284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348046AbiBNK0m (ORCPT ); Mon, 14 Feb 2022 05:26:42 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9F8880939; Mon, 14 Feb 2022 01:57:43 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5DB96B80DC8; Mon, 14 Feb 2022 09:57:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9936CC340E9; Mon, 14 Feb 2022 09:57:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832648; bh=cK9ecw/EFhSoO7tLE759EsN5OX8WHGKfTJe7PYjYBbs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IoNV7niv9mBeBo5UxmhMZYtzqU4JvfYIVYUHaYwcqsQ2N2NJLdFSYGtx7d62dRZl0 pjFvRAYl8f0cSXW0N7MJWe32+9zjpIz0Cef7K0gUx1dWx86l9vX5tEgYq8zasnLdsg oFOTWYTxB8MPDRFFItYKQ0T5ocoscv7kJLUHHTZI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Walleij , Stefan Hansson , Arnd Bergmann Subject: [PATCH 5.16 082/203] ARM: dts: Fix boot regression on Skomer Date: Mon, 14 Feb 2022 10:25:26 +0100 Message-Id: <20220214092513.064687097@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Linus Walleij commit d9058d6a0e92d8e4a00855f8fe204792f42794db upstream. The signal routing on the Skomer board was incorrect making it impossible to mount root from the SD card. Fix this up. Signed-off-by: Linus Walleij Cc: stable@vger.kernel.org Cc: Stefan Hansson Link: https://lore.kernel.org/r/20220205235312.446730-1-linus.walleij@linar= o.org' Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/arm/boot/dts/ste-ux500-samsung-skomer.dts | 4 ---- 1 file changed, 4 deletions(-) --- a/arch/arm/boot/dts/ste-ux500-samsung-skomer.dts +++ b/arch/arm/boot/dts/ste-ux500-samsung-skomer.dts @@ -185,10 +185,6 @@ cap-sd-highspeed; cap-mmc-highspeed; /* All direction control is used */ - st,sig-dir-cmd; - st,sig-dir-dat0; - st,sig-dir-dat2; - st,sig-dir-dat31; st,sig-pin-fbclk; full-pwr-cycle; vmmc-supply =3D <&ab8500_ldo_aux3_reg>; From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A34AC433EF for ; Mon, 14 Feb 2022 10:28:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347213AbiBNK2j (ORCPT ); Mon, 14 Feb 2022 05:28:39 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:37398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348125AbiBNK0p (ORCPT ); Mon, 14 Feb 2022 05:26:45 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EE55181189; Mon, 14 Feb 2022 01:57:44 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 83839B80D6D; Mon, 14 Feb 2022 09:57:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E75DC340E9; Mon, 14 Feb 2022 09:57:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832651; bh=I4fTghh8t62Mct8NDcrob1gP89ZwL1gZIENffU7Umzs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zul1fOqJzMsr+cn2S50wqE6I0ONMIzD8TH/YNk+gokThkG7SVTXkukRUcn4ViHmLx zlAwwa7Wn2eAeH8eA4/+bNhSP7/r848VL/UpnIZRWOGWRzJLnDZeio5Aujhz53C4S+ LFJok8j41WoKfEL1nvPzQVzTADfPks89I8agaTgI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Krzysztof Kozlowski , Dinh Nguyen Subject: [PATCH 5.16 083/203] ARM: socfpga: fix missing RESET_CONTROLLER Date: Mon, 14 Feb 2022 10:25:27 +0100 Message-Id: <20220214092513.096849340@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Krzysztof Kozlowski commit 3037b174b1876aae6b2d1a27a878c681c78ccadc upstream. The SocFPGA machine since commit b3ca9888f35f ("reset: socfpga: add an early reset driver for SoCFPGA") uses reset controller, so it should select RESET_CONTROLLER explicitly. Selecting ARCH_HAS_RESET_CONTROLLER is not enough because it affects only default choice still allowing a non-buildable configuration: /usr/bin/arm-linux-gnueabi-ld: arch/arm/mach-socfpga/socfpga.o: in functi= on `socfpga_init_irq': arch/arm/mach-socfpga/socfpga.c:56: undefined reference to `socfpga_reset= _init' Reported-by: kernel test robot Cc: Fixes: b3ca9888f35f ("reset: socfpga: add an early reset driver for SoCFPGA= ") Signed-off-by: Krzysztof Kozlowski Signed-off-by: Dinh Nguyen Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/arm/mach-socfpga/Kconfig | 2 ++ 1 file changed, 2 insertions(+) --- a/arch/arm/mach-socfpga/Kconfig +++ b/arch/arm/mach-socfpga/Kconfig @@ -2,6 +2,7 @@ menuconfig ARCH_INTEL_SOCFPGA bool "Altera SOCFPGA family" depends on ARCH_MULTI_V7 + select ARCH_HAS_RESET_CONTROLLER select ARCH_SUPPORTS_BIG_ENDIAN select ARM_AMBA select ARM_GIC @@ -18,6 +19,7 @@ menuconfig ARCH_INTEL_SOCFPGA select PL310_ERRATA_727915 select PL310_ERRATA_753970 if PL310 select PL310_ERRATA_769419 + select RESET_CONTROLLER =20 if ARCH_INTEL_SOCFPGA config SOCFPGA_SUSPEND From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E407C433EF for ; Mon, 14 Feb 2022 10:28:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347435AbiBNK2Y (ORCPT ); Mon, 14 Feb 2022 05:28:24 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:34776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347938AbiBNK0h (ORCPT ); Mon, 14 Feb 2022 05:26:37 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D51AC8091B; Mon, 14 Feb 2022 01:57:37 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EBF4360FA2; Mon, 14 Feb 2022 09:57:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2E05C340E9; Mon, 14 Feb 2022 09:57:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832654; bh=saiZqjZcHJGpeZpPA0bHrcwnllIhia1FLnu2M+Iq5Lw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mzo1APez4K60Qqh3xCmjD5cpfmd9StcEo08AmuoQbbdyzH4WY7kqi0bA2l2/pbiGX Opk/Cl9Zo32lk4ByX0MyC7RcDpPDMBjFnmkUQbphKfinOMZqHxvZHnlYF26cv9+Hg4 IxzxbLoJrWypNGM7x5H5XpBfRYaTf12SsAb1nMFM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sagi Grimberg , Hannes Reinecke , Christoph Hellwig Subject: [PATCH 5.16 084/203] nvme-tcp: fix bogus request completion when failing to send AER Date: Mon, 14 Feb 2022 10:25:28 +0100 Message-Id: <20220214092513.128502574@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sagi Grimberg commit 63573807b27e0faf8065a28b1bbe1cbfb23c0130 upstream. AER is not backed by a real request, hence we should not incorrectly assume that when failing to send a nvme command, it is a normal request but rather check if this is an aer and if so complete the aer (similar to the normal completion path). Cc: stable@vger.kernel.org Signed-off-by: Sagi Grimberg Reviewed-by: Hannes Reinecke Signed-off-by: Christoph Hellwig Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/nvme/host/tcp.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) --- a/drivers/nvme/host/tcp.c +++ b/drivers/nvme/host/tcp.c @@ -913,7 +913,15 @@ static inline void nvme_tcp_done_send_re =20 static void nvme_tcp_fail_request(struct nvme_tcp_request *req) { - nvme_tcp_end_request(blk_mq_rq_from_pdu(req), NVME_SC_HOST_PATH_ERROR); + if (nvme_tcp_async_req(req)) { + union nvme_result res =3D {}; + + nvme_complete_async_event(&req->queue->ctrl->ctrl, + cpu_to_le16(NVME_SC_HOST_PATH_ERROR), &res); + } else { + nvme_tcp_end_request(blk_mq_rq_from_pdu(req), + NVME_SC_HOST_PATH_ERROR); + } } =20 static int nvme_tcp_try_send_data(struct nvme_tcp_request *req) From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB6D6C433EF for ; Mon, 14 Feb 2022 10:28:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235993AbiBNK2r (ORCPT ); Mon, 14 Feb 2022 05:28:47 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:36846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348231AbiBNK0u (ORCPT ); Mon, 14 Feb 2022 05:26:50 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72402811B0; Mon, 14 Feb 2022 01:57:50 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 58C2161236; Mon, 14 Feb 2022 09:57:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31626C340E9; Mon, 14 Feb 2022 09:57:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832657; bh=N3T3q2dVigTnrrBC916Z3kDWsICXJCmLkqSPQOiA/64=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qavJnFN0vUF37mNaJubSXz1pOnweYl1y5ostZ8+EFgQ7AwLZ20s+gmwipqkMJi07c AIdvvWNapxIVvMkdEhoxMjY/EOmXEmygXeyKob2m461YUkM4jkuHV0ZnkcbRm+Iyku Gazt2CcYfpsOSJ5nIrM1JikAGeLYHb15lc73WVxc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Petlan , Robin Murphy , Lorenzo Pieralisi , Catalin Marinas Subject: [PATCH 5.16 085/203] ACPI/IORT: Check node revision for PMCG resources Date: Mon, 14 Feb 2022 10:25:29 +0100 Message-Id: <20220214092513.159286943@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 commit da5fb9e1ad3fbf632dce735f1bdad257ca528499 upstream. The original version of the IORT PMCG definition had an oversight wherein there was no way to describe the second register page for an implementation using the recommended RELOC_CTRS feature. Although the spec was fixed, and the final patches merged to ACPICA and Linux written against the new version, it seems that some old firmware based on the original revision has survived and turned up in the wild. Add a check for the original PMCG definition, and avoid filling in the second memory resource with nonsense if so. Otherwise it is likely that something horrible will happen when the PMCG driver attempts to probe. Reported-by: Michael Petlan Fixes: 24e516049360 ("ACPI/IORT: Add support for PMCG") Cc: # 5.2.x Signed-off-by: Robin Murphy Acked-by: Lorenzo Pieralisi Link: https://lore.kernel.org/r/75628ae41c257fb73588f7bf1c4459160e04be2b.16= 43916258.git.robin.murphy@arm.com Signed-off-by: Catalin Marinas Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/acpi/arm64/iort.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) --- a/drivers/acpi/arm64/iort.c +++ b/drivers/acpi/arm64/iort.c @@ -1361,9 +1361,17 @@ static void __init arm_smmu_v3_pmcg_init res[0].start =3D pmcg->page0_base_address; res[0].end =3D pmcg->page0_base_address + SZ_4K - 1; res[0].flags =3D IORESOURCE_MEM; - res[1].start =3D pmcg->page1_base_address; - res[1].end =3D pmcg->page1_base_address + SZ_4K - 1; - res[1].flags =3D IORESOURCE_MEM; + /* + * The initial version in DEN0049C lacked a way to describe register + * page 1, which makes it broken for most PMCG implementations; in + * that case, just let the driver fail gracefully if it expects to + * find a second memory resource. + */ + if (node->revision > 0) { + res[1].start =3D pmcg->page1_base_address; + res[1].end =3D pmcg->page1_base_address + SZ_4K - 1; + res[1].flags =3D IORESOURCE_MEM; + } =20 if (pmcg->overflow_gsiv) acpi_iort_register_irq(pmcg->overflow_gsiv, "overflow", From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD8DFC433EF for ; Mon, 14 Feb 2022 10:28:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347467AbiBNK2g (ORCPT ); Mon, 14 Feb 2022 05:28:36 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:33890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348096AbiBNK0o (ORCPT ); Mon, 14 Feb 2022 05:26:44 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EF1F81184; Mon, 14 Feb 2022 01:57:44 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 20637B80DCD; Mon, 14 Feb 2022 09:57:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 42D14C340EF; Mon, 14 Feb 2022 09:57:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832660; bh=PoVeYvvR1go9JL6IkY/gQPfhMt+FjXOTzqrvcNd3n9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WJqlSTScp1gD8m9VetTfzot4+N8Fqv3OV3UyIuoIrjbTtioAyJZHD+sFH+EC9Kqrt BBfOgPIGc10Kn0cY986ZlWgU+Dw/3R4li0o1gAVhdvCQSpylU5cx5+iqpR31a7ATUp 3SncfLMpIXh6BHOCJq/7qGydSm0e0Od4gK+ubkrc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Rafael J. Wysocki" Subject: [PATCH 5.16 086/203] PM: s2idle: ACPI: Fix wakeup interrupts handling Date: Mon, 14 Feb 2022 10:25:30 +0100 Message-Id: <20220214092513.193388975@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 cb1f65c1e1424a4b5e4a86da8aa3b8fd8459c8ec upstream. After commit e3728b50cd9b ("ACPI: PM: s2idle: Avoid possible race related to the EC GPE") wakeup interrupts occurring immediately after the one discarded by acpi_s2idle_wake() may be missed. Moreover, if the SCI triggers again immediately after the rearming in acpi_s2idle_wake(), that wakeup may be missed too. The problem is that pm_system_irq_wakeup() only calls pm_system_wakeup() when pm_wakeup_irq is 0, but that's not the case any more after the interrupt causing acpi_s2idle_wake() to run until pm_wakeup_irq is cleared by the pm_wakeup_clear() call in s2idle_loop(). However, there may be wakeup interrupts occurring in that time frame and if that happens, they will be missed. To address that issue first move the clearing of pm_wakeup_irq to the point at which it is known that the interrupt causing acpi_s2idle_wake() to tun will be discarded, before rearming the SCI for wakeup. Moreover, because that only reduces the size of the time window in which the issue may manifest itself, allow pm_system_irq_wakeup() to register two second wakeup interrupts in a row and, when discarding the first one, replace it with the second one. [Of course, this assumes that only one wakeup interrupt can be discarded in one go, but currently that is the case and I am not aware of any plans to change that.] Fixes: e3728b50cd9b ("ACPI: PM: s2idle: Avoid possible race related to the = EC GPE") Cc: 5.4+ # 5.4+ Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/acpi/sleep.c | 1 + drivers/base/power/wakeup.c | 41 ++++++++++++++++++++++++++++++++++-----= -- include/linux/suspend.h | 4 ++-- kernel/power/main.c | 5 ++++- kernel/power/process.c | 2 +- kernel/power/suspend.c | 2 -- 6 files changed, 42 insertions(+), 13 deletions(-) --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -767,6 +767,7 @@ bool acpi_s2idle_wake(void) return true; } =20 + pm_wakeup_clear(acpi_sci_irq); rearm_wake_irq(acpi_sci_irq); } =20 --- a/drivers/base/power/wakeup.c +++ b/drivers/base/power/wakeup.c @@ -34,7 +34,8 @@ suspend_state_t pm_suspend_target_state; bool events_check_enabled __read_mostly; =20 /* First wakeup IRQ seen by the kernel in the last cycle. */ -unsigned int pm_wakeup_irq __read_mostly; +static unsigned int wakeup_irq[2] __read_mostly; +static DEFINE_RAW_SPINLOCK(wakeup_irq_lock); =20 /* If greater than 0 and the system is suspending, terminate the suspend. = */ static atomic_t pm_abort_suspend __read_mostly; @@ -942,19 +943,45 @@ void pm_system_cancel_wakeup(void) atomic_dec_if_positive(&pm_abort_suspend); } =20 -void pm_wakeup_clear(bool reset) +void pm_wakeup_clear(unsigned int irq_number) { - pm_wakeup_irq =3D 0; - if (reset) + raw_spin_lock_irq(&wakeup_irq_lock); + + if (irq_number && wakeup_irq[0] =3D=3D irq_number) + wakeup_irq[0] =3D wakeup_irq[1]; + else + wakeup_irq[0] =3D 0; + + wakeup_irq[1] =3D 0; + + raw_spin_unlock_irq(&wakeup_irq_lock); + + if (!irq_number) atomic_set(&pm_abort_suspend, 0); } =20 void pm_system_irq_wakeup(unsigned int irq_number) { - if (pm_wakeup_irq =3D=3D 0) { - pm_wakeup_irq =3D irq_number; + unsigned long flags; + + raw_spin_lock_irqsave(&wakeup_irq_lock, flags); + + if (wakeup_irq[0] =3D=3D 0) + wakeup_irq[0] =3D irq_number; + else if (wakeup_irq[1] =3D=3D 0) + wakeup_irq[1] =3D irq_number; + else + irq_number =3D 0; + + raw_spin_unlock_irqrestore(&wakeup_irq_lock, flags); + + if (irq_number) pm_system_wakeup(); - } +} + +unsigned int pm_wakeup_irq(void) +{ + return wakeup_irq[0]; } =20 /** --- a/include/linux/suspend.h +++ b/include/linux/suspend.h @@ -496,14 +496,14 @@ extern void ksys_sync_helper(void); =20 /* drivers/base/power/wakeup.c */ extern bool events_check_enabled; -extern unsigned int pm_wakeup_irq; extern suspend_state_t pm_suspend_target_state; =20 extern bool pm_wakeup_pending(void); extern void pm_system_wakeup(void); extern void pm_system_cancel_wakeup(void); -extern void pm_wakeup_clear(bool reset); +extern void pm_wakeup_clear(unsigned int irq_number); extern void pm_system_irq_wakeup(unsigned int irq_number); +extern unsigned int pm_wakeup_irq(void); extern bool pm_get_wakeup_count(unsigned int *count, bool block); extern bool pm_save_wakeup_count(unsigned int count); extern void pm_wakep_autosleep_enabled(bool set); --- a/kernel/power/main.c +++ b/kernel/power/main.c @@ -504,7 +504,10 @@ static ssize_t pm_wakeup_irq_show(struct struct kobj_attribute *attr, char *buf) { - return pm_wakeup_irq ? sprintf(buf, "%u\n", pm_wakeup_irq) : -ENODATA; + if (!pm_wakeup_irq()) + return -ENODATA; + + return sprintf(buf, "%u\n", pm_wakeup_irq()); } =20 power_attr_ro(pm_wakeup_irq); --- a/kernel/power/process.c +++ b/kernel/power/process.c @@ -134,7 +134,7 @@ int freeze_processes(void) if (!pm_freezing) atomic_inc(&system_freezing_cnt); =20 - pm_wakeup_clear(true); + pm_wakeup_clear(0); pr_info("Freezing user space processes ... "); pm_freezing =3D true; error =3D try_to_freeze_tasks(true); --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c @@ -136,8 +136,6 @@ static void s2idle_loop(void) break; } =20 - pm_wakeup_clear(false); - s2idle_enter(); } =20 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44B8CC433EF for ; Mon, 14 Feb 2022 10:29:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346197AbiBNK3V (ORCPT ); Mon, 14 Feb 2022 05:29:21 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:33136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348418AbiBNK05 (ORCPT ); Mon, 14 Feb 2022 05:26:57 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A6028302D; Mon, 14 Feb 2022 01:57:57 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5065861291; Mon, 14 Feb 2022 09:57:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30429C340E9; Mon, 14 Feb 2022 09:57:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832663; bh=vLP6QBEs6yQfhcdW3YJt9BxzrxtuLathGQXDlJJ08WY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R0WJRpZBDorJwDxvicIffaVyOMnBtaT0rrrRVVHFHSRDOAdMowzuaI6q5pRC6Q8dQ EtzmFFJ8s8WRzjDpGnE3Zhqdb6EgKwUT8x4DFP2Ye9l5hZSp9PwEM9LVNHK5jy9jsQ JvfzvGbgdy/n4Km1ojYfyUxDaOOYNO4sfLwuFptw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Harry Wentland , Alex Deucher Subject: [PATCH 5.16 087/203] drm/amdgpu/display: change pipe policy for DCN 2.0 Date: Mon, 14 Feb 2022 10:25:31 +0100 Message-Id: <20220214092513.227448126@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alex Deucher commit 6e7545ddb13416fd200e0b91c0acfd0404e2e27b upstream. Fixes hangs on driver load with multiple displays on DCN 2.0 parts. Bug: https://bugzilla.kernel.org/show_bug.cgi?id=3D215511 Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1877 Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1886 Fixes: ee2698cf79cc ("drm/amd/display: Changed pipe split policy to allow f= or multi-display pipe split") Reviewed-by: Harry Wentland 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: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c +++ b/drivers/gpu/drm/amd/display/dc/dcn20/dcn20_resource.c @@ -1069,7 +1069,7 @@ static const struct dc_debug_options deb .timing_trace =3D false, .clock_trace =3D true, .disable_pplib_clock_request =3D true, - .pipe_split_policy =3D MPC_SPLIT_DYNAMIC, + .pipe_split_policy =3D MPC_SPLIT_AVOID_MULT_DISP, .force_single_disp_pipe_split =3D false, .disable_dcc =3D DCC_ENABLE, .vsr_support =3D true, From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3648C433EF for ; Mon, 14 Feb 2022 10:29:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347100AbiBNK3I (ORCPT ); Mon, 14 Feb 2022 05:29:08 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:33274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348232AbiBNK0u (ORCPT ); Mon, 14 Feb 2022 05:26:50 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C707811AD; Mon, 14 Feb 2022 01:57:50 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AF038B80DBE; Mon, 14 Feb 2022 09:57:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD9E0C340EF; Mon, 14 Feb 2022 09:57:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832667; bh=UImdhe0lzIBcuJU5o3NtutfAaJZJjpWz8OLIQz63P+c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WmSmtdoe5153onrnpzBPS4kgF5E54kPSg7Scd9cTtw3LXSfdteem0u7fdSJo0KeqA R0oBHEbNeAYepBzLWQjpq4vZZ9fdl1cbCfL3Ah3jV6ibFa/vx5C47k/MkP1/ERkWe0 4YAaoaDawSfsh+c1Z4stOCg/+Hou2VupFn8mIoB8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrzej Pietrasiewicz , Brian Norris , Heiko Stuebner Subject: [PATCH 5.16 088/203] drm/rockchip: vop: Correct RK3399 VOP register fields Date: Mon, 14 Feb 2022 10:25:32 +0100 Message-Id: <20220214092513.258735233@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Brian Norris commit 9da1e9ab82c92d0e89fe44cad2cd7c2d18d64070 upstream. Commit 7707f7227f09 ("drm/rockchip: Add support for afbc") switched up the rk3399_vop_big[] register windows, but it did so incorrectly. The biggest problem is in rk3288_win23_data[] vs. rk3368_win23_data[] .format field: RK3288's format: VOP_REG(RK3288_WIN2_CTRL0, 0x7, 1) RK3368's format: VOP_REG(RK3368_WIN2_CTRL0, 0x3, 5) Bits 5:6 (i.e., shift 5, mask 0x3) are correct for RK3399, according to the TRM. There are a few other small differences between the 3288 and 3368 definitions that were swapped in commit 7707f7227f09. I reviewed them to the best of my ability according to the RK3399 TRM and fixed them up. This fixes IOMMU issues (and display errors) when testing with BG24 color formats. Fixes: 7707f7227f09 ("drm/rockchip: Add support for afbc") Cc: Andrzej Pietrasiewicz Cc: Signed-off-by: Brian Norris Tested-by: Andrzej Pietrasiewicz Signed-off-by: Heiko Stuebner Link: https://patchwork.freedesktop.org/patch/msgid/20220119161104.1.I1d014= 36bef35165a8cdfe9308789c0badb5ff46a@changeid Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/gpu/drm/rockchip/rockchip_vop_reg.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c +++ b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c @@ -902,6 +902,7 @@ static const struct vop_win_phy rk3399_w .enable =3D VOP_REG(RK3288_WIN0_CTRL0, 0x1, 0), .format =3D VOP_REG(RK3288_WIN0_CTRL0, 0x7, 1), .rb_swap =3D VOP_REG(RK3288_WIN0_CTRL0, 0x1, 12), + .x_mir_en =3D VOP_REG(RK3288_WIN0_CTRL0, 0x1, 21), .y_mir_en =3D VOP_REG(RK3288_WIN0_CTRL0, 0x1, 22), .act_info =3D VOP_REG(RK3288_WIN0_ACT_INFO, 0x1fff1fff, 0), .dsp_info =3D VOP_REG(RK3288_WIN0_DSP_INFO, 0x0fff0fff, 0), @@ -912,6 +913,7 @@ static const struct vop_win_phy rk3399_w .uv_vir =3D VOP_REG(RK3288_WIN0_VIR, 0x3fff, 16), .src_alpha_ctl =3D VOP_REG(RK3288_WIN0_SRC_ALPHA_CTRL, 0xff, 0), .dst_alpha_ctl =3D VOP_REG(RK3288_WIN0_DST_ALPHA_CTRL, 0xff, 0), + .channel =3D VOP_REG(RK3288_WIN0_CTRL2, 0xff, 0), }; =20 /* @@ -922,11 +924,11 @@ static const struct vop_win_phy rk3399_w static const struct vop_win_data rk3399_vop_win_data[] =3D { { .base =3D 0x00, .phy =3D &rk3399_win01_data, .type =3D DRM_PLANE_TYPE_PRIMARY }, - { .base =3D 0x40, .phy =3D &rk3288_win01_data, + { .base =3D 0x40, .phy =3D &rk3368_win01_data, .type =3D DRM_PLANE_TYPE_OVERLAY }, - { .base =3D 0x00, .phy =3D &rk3288_win23_data, + { .base =3D 0x00, .phy =3D &rk3368_win23_data, .type =3D DRM_PLANE_TYPE_OVERLAY }, - { .base =3D 0x50, .phy =3D &rk3288_win23_data, + { .base =3D 0x50, .phy =3D &rk3368_win23_data, .type =3D DRM_PLANE_TYPE_CURSOR }, }; =20 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1AD4C433EF for ; Mon, 14 Feb 2022 10:29:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347546AbiBNK3R (ORCPT ); Mon, 14 Feb 2022 05:29:17 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:33906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348375AbiBNK0z (ORCPT ); Mon, 14 Feb 2022 05:26:55 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73C038301E; Mon, 14 Feb 2022 01:57:54 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D8F26B80DCE; Mon, 14 Feb 2022 09:57:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F15C4C340E9; Mon, 14 Feb 2022 09:57:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832670; bh=Jxz/D8ATym+ryfklp5SjcQN48vMeOigzH2dvKKlKqWQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iEUrECsVoilixxT6UI9ryS+ldTy4jOH2FXtXkl4wtP3SWUjOtpQB1NqeL4o5mJzc5 v+fjbvZGNbSHQpjiPkEWjqne2G5KDSFH2t5ZAyWnLSg+/cdxDDY6PFCfSjtdnSfnXL YJpkiuvqKvgPnafbmq762apa6aIJ4V9XiH7aPYAo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Jani Nikula , Tvrtko Ursulin Subject: [PATCH 5.16 089/203] drm/i915: Disable DRRS on IVB/HSW port != A Date: Mon, 14 Feb 2022 10:25:33 +0100 Message-Id: <20220214092513.289637602@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ville Syrj=C3=A4l=C3=A4 commit ee59792c97176f12c1da31f29fc4c2aab187f06e upstream. Currently we allow DRRS on IVB PCH ports, but we're missing a few programming steps meaning it is guaranteed to not work. And on HSW DRRS is not supported on anything but port A ever as only transcoder EDP has the M2/N2 registers (though I'm not sure if HSW ever has eDP on any other port). Starting from BDW all transcoders have the dynamically reprogrammable M/N registers so DRRS could work on any port. Stop initializing DRRS on ports where it cannot possibly work. Cc: stable@vger.kernel.org Signed-off-by: Ville Syrj=C3=A4l=C3=A4 Link: https://patchwork.freedesktop.org/patch/msgid/20220128103757.22461-11= -ville.syrjala@linux.intel.com Reviewed-by: Jani Nikula (cherry picked from commit f0d4ce59f4d48622044933054a0e0cefa91ba15e) Signed-off-by: Tvrtko Ursulin Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/gpu/drm/i915/display/intel_drrs.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/drivers/gpu/drm/i915/display/intel_drrs.c +++ b/drivers/gpu/drm/i915/display/intel_drrs.c @@ -405,6 +405,7 @@ intel_drrs_init(struct intel_connector * struct drm_display_mode *fixed_mode) { struct drm_i915_private *dev_priv =3D to_i915(connector->base.dev); + struct intel_encoder *encoder =3D connector->encoder; struct drm_display_mode *downclock_mode =3D NULL; =20 INIT_DELAYED_WORK(&dev_priv->drrs.work, intel_drrs_downclock_work); @@ -416,6 +417,13 @@ intel_drrs_init(struct intel_connector * return NULL; } =20 + if ((DISPLAY_VER(dev_priv) < 8 && !HAS_GMCH(dev_priv)) && + encoder->port !=3D PORT_A) { + drm_dbg_kms(&dev_priv->drm, + "DRRS only supported on eDP port A\n"); + return NULL; + } + if (dev_priv->vbt.drrs_type !=3D SEAMLESS_DRRS_SUPPORT) { drm_dbg_kms(&dev_priv->drm, "VBT doesn't support DRRS\n"); return NULL; From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF889C433F5 for ; Mon, 14 Feb 2022 10:28:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347249AbiBNK2y (ORCPT ); Mon, 14 Feb 2022 05:28:54 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:33926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348389AbiBNK0z (ORCPT ); Mon, 14 Feb 2022 05:26:55 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEC6583022; Mon, 14 Feb 2022 01:57:54 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1FA4561491; Mon, 14 Feb 2022 09:57:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AA28C340E9; Mon, 14 Feb 2022 09:57:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832673; bh=MFrH3r1yKX+iFtfx80aWccnWMDRwj7DDM7f0gq4zrw8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zb7v+7wb1NlRnRs+TTW2sCyQMom0PDPBksb5DlFvGl2DUtMGSdPyNfujcr99F4vww wt+MaDLHIAcxQqb+e7+ZlXmf3hk/vkuqCogdpeBHQnC91z5+OafCZZ2Yc1Az2hGs8x +S9qp4gKk3VS6cqbSDd0tFGay02BrCD74H0+NOrg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Stanislav Lisovskiy , Tvrtko Ursulin Subject: [PATCH 5.16 090/203] drm/i915: Allow !join_mbus cases for adlp+ dbuf configuration Date: Mon, 14 Feb 2022 10:25:34 +0100 Message-Id: <20220214092513.321831043@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ville Syrj=C3=A4l=C3=A4 commit 8fd5a26e43859547790a7995494c952b708ab3b5 upstream. Reintroduce the !join_mbus single pipe cases for adlp+. Due to the mbus relative dbuf offsets in PLANE_BUF_CFG we need to know the actual slices used by the pipe when doing readout, even when mbus joining isn't enabled. Accurate readout will be needed to properly sanitize invalid BIOS dbuf configurations. This will also make it much easier to play around with the !join_mbus configs for testin/workaround purposes. Cc: # v5.14+ Signed-off-by: Ville Syrj=C3=A4l=C3=A4 Link: https://patchwork.freedesktop.org/patch/msgid/20220204141818.1900-1-v= ille.syrjala@linux.intel.com Reviewed-by: Stanislav Lisovskiy (cherry picked from commit eef173954432fe0612acb63421a95deb41155cdc) Signed-off-by: Tvrtko Ursulin Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/gpu/drm/i915/intel_pm.c | 66 +++++++++++++++++++++++++++--------= ----- 1 file changed, 46 insertions(+), 20 deletions(-) --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -4707,6 +4707,10 @@ static const struct dbuf_slice_conf_entr }; =20 static const struct dbuf_slice_conf_entry adlp_allowed_dbufs[] =3D { + /* + * Keep the join_mbus cases first so check_mbus_joined() + * will prefer them over the !join_mbus cases. + */ { .active_pipes =3D BIT(PIPE_A), .dbuf_mask =3D { @@ -4722,6 +4726,20 @@ static const struct dbuf_slice_conf_entr .join_mbus =3D true, }, { + .active_pipes =3D BIT(PIPE_A), + .dbuf_mask =3D { + [PIPE_A] =3D BIT(DBUF_S1) | BIT(DBUF_S2), + }, + .join_mbus =3D false, + }, + { + .active_pipes =3D BIT(PIPE_B), + .dbuf_mask =3D { + [PIPE_B] =3D BIT(DBUF_S3) | BIT(DBUF_S4), + }, + .join_mbus =3D false, + }, + { .active_pipes =3D BIT(PIPE_A) | BIT(PIPE_B), .dbuf_mask =3D { [PIPE_A] =3D BIT(DBUF_S1) | BIT(DBUF_S2), @@ -4837,13 +4855,14 @@ static bool adlp_check_mbus_joined(u8 ac return check_mbus_joined(active_pipes, adlp_allowed_dbufs); } =20 -static u8 compute_dbuf_slices(enum pipe pipe, u8 active_pipes, +static u8 compute_dbuf_slices(enum pipe pipe, u8 active_pipes, bool join_m= bus, const struct dbuf_slice_conf_entry *dbuf_slices) { int i; =20 for (i =3D 0; i < dbuf_slices[i].active_pipes; i++) { - if (dbuf_slices[i].active_pipes =3D=3D active_pipes) + if (dbuf_slices[i].active_pipes =3D=3D active_pipes && + dbuf_slices[i].join_mbus =3D=3D join_mbus) return dbuf_slices[i].dbuf_mask[pipe]; } return 0; @@ -4854,7 +4873,7 @@ static u8 compute_dbuf_slices(enum pipe * returns correspondent DBuf slice mask as stated in BSpec for particular * platform. */ -static u8 icl_compute_dbuf_slices(enum pipe pipe, u8 active_pipes) +static u8 icl_compute_dbuf_slices(enum pipe pipe, u8 active_pipes, bool jo= in_mbus) { /* * FIXME: For ICL this is still a bit unclear as prev BSpec revision @@ -4868,37 +4887,41 @@ static u8 icl_compute_dbuf_slices(enum p * still here - we will need it once those additional constraints * pop up. */ - return compute_dbuf_slices(pipe, active_pipes, icl_allowed_dbufs); + return compute_dbuf_slices(pipe, active_pipes, join_mbus, + icl_allowed_dbufs); } =20 -static u8 tgl_compute_dbuf_slices(enum pipe pipe, u8 active_pipes) +static u8 tgl_compute_dbuf_slices(enum pipe pipe, u8 active_pipes, bool jo= in_mbus) { - return compute_dbuf_slices(pipe, active_pipes, tgl_allowed_dbufs); + return compute_dbuf_slices(pipe, active_pipes, join_mbus, + tgl_allowed_dbufs); } =20 -static u32 adlp_compute_dbuf_slices(enum pipe pipe, u32 active_pipes) +static u8 adlp_compute_dbuf_slices(enum pipe pipe, u8 active_pipes, bool j= oin_mbus) { - return compute_dbuf_slices(pipe, active_pipes, adlp_allowed_dbufs); + return compute_dbuf_slices(pipe, active_pipes, join_mbus, + adlp_allowed_dbufs); } =20 -static u32 dg2_compute_dbuf_slices(enum pipe pipe, u32 active_pipes) +static u8 dg2_compute_dbuf_slices(enum pipe pipe, u8 active_pipes, bool jo= in_mbus) { - return compute_dbuf_slices(pipe, active_pipes, dg2_allowed_dbufs); + return compute_dbuf_slices(pipe, active_pipes, join_mbus, + dg2_allowed_dbufs); } =20 -static u8 skl_compute_dbuf_slices(struct intel_crtc *crtc, u8 active_pipes) +static u8 skl_compute_dbuf_slices(struct intel_crtc *crtc, u8 active_pipes= , bool join_mbus) { struct drm_i915_private *dev_priv =3D to_i915(crtc->base.dev); enum pipe pipe =3D crtc->pipe; =20 if (IS_DG2(dev_priv)) - return dg2_compute_dbuf_slices(pipe, active_pipes); + return dg2_compute_dbuf_slices(pipe, active_pipes, join_mbus); else if (IS_ALDERLAKE_P(dev_priv)) - return adlp_compute_dbuf_slices(pipe, active_pipes); + return adlp_compute_dbuf_slices(pipe, active_pipes, join_mbus); else if (DISPLAY_VER(dev_priv) =3D=3D 12) - return tgl_compute_dbuf_slices(pipe, active_pipes); + return tgl_compute_dbuf_slices(pipe, active_pipes, join_mbus); else if (DISPLAY_VER(dev_priv) =3D=3D 11) - return icl_compute_dbuf_slices(pipe, active_pipes); + return icl_compute_dbuf_slices(pipe, active_pipes, join_mbus); /* * For anything else just return one slice yet. * Should be extended for other platforms. @@ -6109,11 +6132,16 @@ skl_compute_ddb(struct intel_atomic_stat return ret; } =20 + if (IS_ALDERLAKE_P(dev_priv)) + new_dbuf_state->joined_mbus =3D + adlp_check_mbus_joined(new_dbuf_state->active_pipes); + for_each_intel_crtc(&dev_priv->drm, crtc) { enum pipe pipe =3D crtc->pipe; =20 new_dbuf_state->slices[pipe] =3D - skl_compute_dbuf_slices(crtc, new_dbuf_state->active_pipes); + skl_compute_dbuf_slices(crtc, new_dbuf_state->active_pipes, + new_dbuf_state->joined_mbus); =20 if (old_dbuf_state->slices[pipe] =3D=3D new_dbuf_state->slices[pipe]) continue; @@ -6125,9 +6153,6 @@ skl_compute_ddb(struct intel_atomic_stat =20 new_dbuf_state->enabled_slices =3D intel_dbuf_enabled_slices(new_dbuf_sta= te); =20 - if (IS_ALDERLAKE_P(dev_priv)) - new_dbuf_state->joined_mbus =3D adlp_check_mbus_joined(new_dbuf_state->a= ctive_pipes); - if (old_dbuf_state->enabled_slices !=3D new_dbuf_state->enabled_slices || old_dbuf_state->joined_mbus !=3D new_dbuf_state->joined_mbus) { ret =3D intel_atomic_serialize_global_state(&new_dbuf_state->base); @@ -6628,7 +6653,8 @@ void skl_wm_get_hw_state(struct drm_i915 } =20 dbuf_state->slices[pipe] =3D - skl_compute_dbuf_slices(crtc, dbuf_state->active_pipes); + skl_compute_dbuf_slices(crtc, dbuf_state->active_pipes, + dbuf_state->joined_mbus); =20 dbuf_state->weight[pipe] =3D intel_crtc_ddb_weight(crtc_state); =20 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38AAFC4332F for ; Mon, 14 Feb 2022 10:29:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347002AbiBNK3F (ORCPT ); Mon, 14 Feb 2022 05:29:05 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:37260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348474AbiBNK1G (ORCPT ); Mon, 14 Feb 2022 05:27:06 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87C1C70301; Mon, 14 Feb 2022 01:58:02 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AEC72B80DC4; Mon, 14 Feb 2022 09:57:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C2527C340E9; Mon, 14 Feb 2022 09:57:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832678; bh=d1WcnwbYcvx7Jr2kzW+21IfSV6rX6uum7WSctazv07o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JKgl2EcGLBRA/ptVvzyKLR3s76yVFPUzTj3FeS1hoVZyhYG7hNR6ImervO8X469bh AOWRiJT/ISVOAeFQ/PWDwgme+3c/dvGi47uKW3ix+RqtWZSiYbdqWRFO83VseXu8Kl biBKplek+B2b20GiEOEOxsRMGj7Pp/Ngi/j9KQP8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Stanislav Lisovskiy , Tvrtko Ursulin Subject: [PATCH 5.16 091/203] drm/i915: Populate pipe dbuf slices more accurately during readout Date: Mon, 14 Feb 2022 10:25:35 +0100 Message-Id: <20220214092513.353139500@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ville Syrj=C3=A4l=C3=A4 commit 85bb289215cf37e05e9581b39b114db1293f9ecd upstream. During readout we cannot assume the planes are actually using the slices they are supposed to use. The BIOS may have misprogrammed things and put the planes onto the wrong dbuf slices. So let's do the readout more carefully to make sure we really know which dbuf slices are actually in use by the pipe at the time. Cc: # v5.14+ Signed-off-by: Ville Syrj=C3=A4l=C3=A4 Link: https://patchwork.freedesktop.org/patch/msgid/20220204141818.1900-2-v= ille.syrjala@linux.intel.com Reviewed-by: Stanislav Lisovskiy (cherry picked from commit b3dcc6dc0f32612d04839c2fb32e94d0ebf92c98) Signed-off-by: Tvrtko Ursulin Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/gpu/drm/i915/intel_pm.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -6633,6 +6633,7 @@ void skl_wm_get_hw_state(struct drm_i915 enum pipe pipe =3D crtc->pipe; unsigned int mbus_offset; enum plane_id plane_id; + u8 slices; =20 skl_pipe_wm_get_hw_state(crtc, &crtc_state->wm.skl.optimal); crtc_state->wm.skl.raw =3D crtc_state->wm.skl.optimal; @@ -6652,20 +6653,22 @@ void skl_wm_get_hw_state(struct drm_i915 skl_ddb_entry_union(&dbuf_state->ddb[pipe], ddb_uv); } =20 - dbuf_state->slices[pipe] =3D - skl_compute_dbuf_slices(crtc, dbuf_state->active_pipes, - dbuf_state->joined_mbus); - dbuf_state->weight[pipe] =3D intel_crtc_ddb_weight(crtc_state); =20 /* * Used for checking overlaps, so we need absolute * offsets instead of MBUS relative offsets. */ - mbus_offset =3D mbus_ddb_offset(dev_priv, dbuf_state->slices[pipe]); + slices =3D skl_compute_dbuf_slices(crtc, dbuf_state->active_pipes, + dbuf_state->joined_mbus); + mbus_offset =3D mbus_ddb_offset(dev_priv, slices); crtc_state->wm.skl.ddb.start =3D mbus_offset + dbuf_state->ddb[pipe].sta= rt; crtc_state->wm.skl.ddb.end =3D mbus_offset + dbuf_state->ddb[pipe].end; =20 + /* The slices actually used by the planes on the pipe */ + dbuf_state->slices[pipe] =3D + skl_ddb_dbuf_slice_mask(dev_priv, &crtc_state->wm.skl.ddb); + drm_dbg_kms(&dev_priv->drm, "[CRTC:%d:%s] dbuf slices 0x%x, ddb (%d - %d), active pipes 0x%x, m= bus joined: %s\n", crtc->base.base.id, crtc->base.name, From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 573F8C433EF for ; Mon, 14 Feb 2022 10:29:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240248AbiBNK3d (ORCPT ); Mon, 14 Feb 2022 05:29:33 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:33906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348612AbiBNK11 (ORCPT ); Mon, 14 Feb 2022 05:27:27 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 470C67031F; Mon, 14 Feb 2022 01:58:06 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A49516093C; Mon, 14 Feb 2022 09:58:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67876C340E9; Mon, 14 Feb 2022 09:58:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832685; bh=MayHQjSfWLZaqXukmAbCa1/cQUa477T1OvbOOUYPdEE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lJ3yu9JB5yzbxN7b6zXbzaE38kRXMBxP4q/0P0ZgYLRMZFHvSg8h5ObwlHWvkoNyz RBkzL7urA8dLOoVBYvsJIfjfunzo9Th0tL4oDOAgY+cupbxstL9BlN8TVJ4/smH9tz OuPEUAK4OUsFE6mGBscWOqYmE82KWfTMa9gGNHOQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Stanislav Lisovskiy , Tvrtko Ursulin Subject: [PATCH 5.16 092/203] drm/i915: Workaround broken BIOS DBUF configuration on TGL/RKL Date: Mon, 14 Feb 2022 10:25:36 +0100 Message-Id: <20220214092513.386748914@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ville Syrj=C3=A4l=C3=A4 commit 4e6f55120c7eccf6f9323bb681632e23cbcb3f3c upstream. On TGL/RKL the BIOS likes to use some kind of bogus DBUF layout that doesn't match what the spec recommends. With a single active pipe that is not going to be a problem, but with multiple pipes active skl_commit_modeset_enables() goes into an infinite loop since it can't figure out any order in which it can commit the pipes without causing DBUF overlaps between the planes. We'd need some kind of extra DBUF defrag stage in between to make the transition possible. But that is clearly way too complex a solution, so in the name of simplicity let's just sanitize the DBUF state by simply turning off all planes when we detect a pipe encroaching on its neighbours' DBUF slices. We only have to disable the primary planes as all other planes should have already been disabled (if they somehow were enabled) by earlier sanitization steps. And for good measure let's also sanitize in case the DBUF allocations of the pipes already seem to overlap each other. Cc: # v5.14+ Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/4762 Signed-off-by: Ville Syrj=C3=A4l=C3=A4 Link: https://patchwork.freedesktop.org/patch/msgid/20220204141818.1900-3-v= ille.syrjala@linux.intel.com Reviewed-by: Stanislav Lisovskiy (cherry picked from commit 15512021eb3975a8c2366e3883337e252bb0eee5) Signed-off-by: Tvrtko Ursulin Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/gpu/drm/i915/display/intel_display.c | 1=20 drivers/gpu/drm/i915/intel_pm.c | 68 ++++++++++++++++++++++= +++++ drivers/gpu/drm/i915/intel_pm.h | 1=20 3 files changed, 70 insertions(+) --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -11901,6 +11901,7 @@ intel_modeset_setup_hw_state(struct drm_ vlv_wm_sanitize(dev_priv); } else if (DISPLAY_VER(dev_priv) >=3D 9) { skl_wm_get_hw_state(dev_priv); + skl_wm_sanitize(dev_priv); } else if (HAS_PCH_SPLIT(dev_priv)) { ilk_wm_get_hw_state(dev_priv); } --- a/drivers/gpu/drm/i915/intel_pm.c +++ b/drivers/gpu/drm/i915/intel_pm.c @@ -6680,6 +6680,74 @@ void skl_wm_get_hw_state(struct drm_i915 dbuf_state->enabled_slices =3D dev_priv->dbuf.enabled_slices; } =20 +static bool skl_dbuf_is_misconfigured(struct drm_i915_private *i915) +{ + const struct intel_dbuf_state *dbuf_state =3D + to_intel_dbuf_state(i915->dbuf.obj.state); + struct skl_ddb_entry entries[I915_MAX_PIPES] =3D {}; + struct intel_crtc *crtc; + + for_each_intel_crtc(&i915->drm, crtc) { + const struct intel_crtc_state *crtc_state =3D + to_intel_crtc_state(crtc->base.state); + + entries[crtc->pipe] =3D crtc_state->wm.skl.ddb; + } + + for_each_intel_crtc(&i915->drm, crtc) { + const struct intel_crtc_state *crtc_state =3D + to_intel_crtc_state(crtc->base.state); + u8 slices; + + slices =3D skl_compute_dbuf_slices(crtc, dbuf_state->active_pipes, + dbuf_state->joined_mbus); + if (dbuf_state->slices[crtc->pipe] & ~slices) + return true; + + if (skl_ddb_allocation_overlaps(&crtc_state->wm.skl.ddb, entries, + I915_MAX_PIPES, crtc->pipe)) + return true; + } + + return false; +} + +void skl_wm_sanitize(struct drm_i915_private *i915) +{ + struct intel_crtc *crtc; + + /* + * On TGL/RKL (at least) the BIOS likes to assign the planes + * to the wrong DBUF slices. This will cause an infinite loop + * in skl_commit_modeset_enables() as it can't find a way to + * transition between the old bogus DBUF layout to the new + * proper DBUF layout without DBUF allocation overlaps between + * the planes (which cannot be allowed or else the hardware + * may hang). If we detect a bogus DBUF layout just turn off + * all the planes so that skl_commit_modeset_enables() can + * simply ignore them. + */ + if (!skl_dbuf_is_misconfigured(i915)) + return; + + drm_dbg_kms(&i915->drm, "BIOS has misprogrammed the DBUF, disabling all p= lanes\n"); + + for_each_intel_crtc(&i915->drm, crtc) { + struct intel_plane *plane =3D to_intel_plane(crtc->base.primary); + const struct intel_plane_state *plane_state =3D + to_intel_plane_state(plane->base.state); + struct intel_crtc_state *crtc_state =3D + to_intel_crtc_state(crtc->base.state); + + if (plane_state->uapi.visible) + intel_plane_disable_noatomic(crtc, plane); + + drm_WARN_ON(&i915->drm, crtc_state->active_planes !=3D 0); + + memset(&crtc_state->wm.skl.ddb, 0, sizeof(crtc_state->wm.skl.ddb)); + } +} + static void ilk_pipe_wm_get_hw_state(struct intel_crtc *crtc) { struct drm_device *dev =3D crtc->base.dev; --- a/drivers/gpu/drm/i915/intel_pm.h +++ b/drivers/gpu/drm/i915/intel_pm.h @@ -47,6 +47,7 @@ void skl_pipe_wm_get_hw_state(struct int struct skl_pipe_wm *out); void g4x_wm_sanitize(struct drm_i915_private *dev_priv); void vlv_wm_sanitize(struct drm_i915_private *dev_priv); +void skl_wm_sanitize(struct drm_i915_private *dev_priv); bool intel_can_enable_sagv(struct drm_i915_private *dev_priv, const struct intel_bw_state *bw_state); void intel_sagv_pre_plane_update(struct intel_atomic_state *state); From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D2AEC433EF for ; Mon, 14 Feb 2022 10:29:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347582AbiBNK31 (ORCPT ); Mon, 14 Feb 2022 05:29:27 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:33138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348684AbiBNK13 (ORCPT ); Mon, 14 Feb 2022 05:27:29 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2C6670338; Mon, 14 Feb 2022 01:58:09 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 280F960917; Mon, 14 Feb 2022 09:58:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1E21C340F0; Mon, 14 Feb 2022 09:58:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832688; bh=XXznSEZvIIe+Gt+j1A06PKbteTGPY2//2Pwu74RfzTw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wn1V+sGeVMcSK1z/k1VwklNnLu8eCyrtp9PLvBgVJwHMT4TU0UeuzO4FUL+jKOS46 zJ96rsrLsE4OEkKFDWMwcBVgFqHFyDLpreK/iMSxNKtDPIPGOIvwRMKp2dkjrbcFMS YF4CbgPeTYCi98dOSrtXlygaClBJyQL83Ht9sJhg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Lezcano , Thomas Gleixner , Rob Herring , Jarkko Nikula , Tony Lindgren , Sasha Levin Subject: [PATCH 5.16 093/203] ARM: dts: Fix timer regression for beagleboard revision c Date: Mon, 14 Feb 2022 10:25:37 +0100 Message-Id: <20220214092513.419785641@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Lindgren [ Upstream commit 23885389dbbbbc698986e77a45c1fc44a6e3632e ] Commit e428e250fde6 ("ARM: dts: Configure system timers for omap3") caused a timer regression for beagleboard revision c where the system clockevent stops working if omap3isp module is unloaded. Turns out we still have beagleboard revisions a-b4 capacitor c70 quirks applied that limit the usable timers for no good reason. This also affects the power management as we use the system clock instead of the 32k clock source. Let's fix the issue by adding a new omap3-beagle-ab4.dts for the old timer quirks. This allows us to remove the timer quirks for later beagleboard revisions. We also need to update the related timer quirk check for the correct compatible property. Fixes: e428e250fde6 ("ARM: dts: Configure system timers for omap3") Cc: linux-kernel@vger.kernel.org Cc: Daniel Lezcano Cc: Thomas Gleixner Cc: Rob Herring Reported-by: Jarkko Nikula Tested-by: Jarkko Nikula Signed-off-by: Tony Lindgren Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- .../devicetree/bindings/arm/omap/omap.txt | 3 ++ arch/arm/boot/dts/Makefile | 1 + arch/arm/boot/dts/omap3-beagle-ab4.dts | 47 +++++++++++++++++++ arch/arm/boot/dts/omap3-beagle.dts | 33 ------------- drivers/clocksource/timer-ti-dm-systimer.c | 2 +- 5 files changed, 52 insertions(+), 34 deletions(-) create mode 100644 arch/arm/boot/dts/omap3-beagle-ab4.dts diff --git a/Documentation/devicetree/bindings/arm/omap/omap.txt b/Document= ation/devicetree/bindings/arm/omap/omap.txt index e77635c5422c6..fa8b31660cadd 100644 --- a/Documentation/devicetree/bindings/arm/omap/omap.txt +++ b/Documentation/devicetree/bindings/arm/omap/omap.txt @@ -119,6 +119,9 @@ Boards (incomplete list of examples): - OMAP3 BeagleBoard : Low cost community board compatible =3D "ti,omap3-beagle", "ti,omap3430", "ti,omap3" =20 +- OMAP3 BeagleBoard A to B4 : Early BeagleBoard revisions A to B4 with a t= imer quirk + compatible =3D "ti,omap3-beagle-ab4", "ti,omap3-beagle", "ti,omap3430", = "ti,omap3" + - OMAP3 Tobi with Overo : Commercial expansion board with daughter board compatible =3D "gumstix,omap3-overo-tobi", "gumstix,omap3-overo", "ti,om= ap3430", "ti,omap3" =20 diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 0de64f237cd87..a387ebe8919b1 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -794,6 +794,7 @@ dtb-$(CONFIG_ARCH_OMAP3) +=3D \ logicpd-som-lv-37xx-devkit.dtb \ omap3430-sdp.dtb \ omap3-beagle.dtb \ + omap3-beagle-ab4.dtb \ omap3-beagle-xm.dtb \ omap3-beagle-xm-ab.dtb \ omap3-cm-t3517.dtb \ diff --git a/arch/arm/boot/dts/omap3-beagle-ab4.dts b/arch/arm/boot/dts/oma= p3-beagle-ab4.dts new file mode 100644 index 0000000000000..990ff2d846868 --- /dev/null +++ b/arch/arm/boot/dts/omap3-beagle-ab4.dts @@ -0,0 +1,47 @@ +// SPDX-License-Identifier: GPL-2.0-only +/dts-v1/; + +#include "omap3-beagle.dts" + +/ { + model =3D "TI OMAP3 BeagleBoard A to B4"; + compatible =3D "ti,omap3-beagle-ab4", "ti,omap3-beagle", "ti,omap3430", "= ti,omap3"; +}; + +/* + * Workaround for capacitor C70 issue, see "Boards revision A and < B5" + * section at https://elinux.org/BeagleBoard_Community + */ + +/* Unusable as clocksource because of unreliable oscillator */ +&counter32k { + status =3D "disabled"; +}; + +/* Unusable as clockevent because of unreliable oscillator, allow to idle = */ +&timer1_target { + /delete-property/ti,no-reset-on-init; + /delete-property/ti,no-idle; + timer@0 { + /delete-property/ti,timer-alwon; + }; +}; + +/* Preferred always-on timer for clocksource */ +&timer12_target { + ti,no-reset-on-init; + ti,no-idle; + timer@0 { + /* Always clocked by secure_32k_fck */ + }; +}; + +/* Preferred timer for clockevent */ +&timer2_target { + ti,no-reset-on-init; + ti,no-idle; + timer@0 { + assigned-clocks =3D <&gpt2_fck>; + assigned-clock-parents =3D <&sys_ck>; + }; +}; diff --git a/arch/arm/boot/dts/omap3-beagle.dts b/arch/arm/boot/dts/omap3-b= eagle.dts index f9f34b8458e91..0548b391334fd 100644 --- a/arch/arm/boot/dts/omap3-beagle.dts +++ b/arch/arm/boot/dts/omap3-beagle.dts @@ -304,39 +304,6 @@ &usbhsehci { phys =3D <0 &hsusb2_phy>; }; =20 -/* Unusable as clocksource because of unreliable oscillator */ -&counter32k { - status =3D "disabled"; -}; - -/* Unusable as clockevent because if unreliable oscillator, allow to idle = */ -&timer1_target { - /delete-property/ti,no-reset-on-init; - /delete-property/ti,no-idle; - timer@0 { - /delete-property/ti,timer-alwon; - }; -}; - -/* Preferred always-on timer for clocksource */ -&timer12_target { - ti,no-reset-on-init; - ti,no-idle; - timer@0 { - /* Always clocked by secure_32k_fck */ - }; -}; - -/* Preferred timer for clockevent */ -&timer2_target { - ti,no-reset-on-init; - ti,no-idle; - timer@0 { - assigned-clocks =3D <&gpt2_fck>; - assigned-clock-parents =3D <&sys_ck>; - }; -}; - &twl_gpio { ti,use-leds; /* pullups: BIT(1) */ diff --git a/drivers/clocksource/timer-ti-dm-systimer.c b/drivers/clocksour= ce/timer-ti-dm-systimer.c index b6f97960d8ee0..5c40ca1d4740e 100644 --- a/drivers/clocksource/timer-ti-dm-systimer.c +++ b/drivers/clocksource/timer-ti-dm-systimer.c @@ -241,7 +241,7 @@ static void __init dmtimer_systimer_assign_alwon(void) bool quirk_unreliable_oscillator =3D false; =20 /* Quirk unreliable 32 KiHz oscillator with incomplete dts */ - if (of_machine_is_compatible("ti,omap3-beagle") || + if (of_machine_is_compatible("ti,omap3-beagle-ab4") || of_machine_is_compatible("timll,omap3-devkit8000")) { quirk_unreliable_oscillator =3D true; counter_32k =3D -ENODEV; --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 653ABC4332F for ; Mon, 14 Feb 2022 10:29:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347607AbiBNK3g (ORCPT ); Mon, 14 Feb 2022 05:29:36 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:57146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232904AbiBNK1h (ORCPT ); Mon, 14 Feb 2022 05:27:37 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EE6195A0E; Mon, 14 Feb 2022 01:58:13 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3572F60921; Mon, 14 Feb 2022 09:58:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1745EC340E9; Mon, 14 Feb 2022 09:58:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832691; bh=cDrmzps+EwVMIVwa4E3JRtZVdxrZkoacSvcnAIzOuQo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AZirjobC00MKz59tBbmcee+q0T/qoHZRj5xLsOGppIeTm5GAR0GImyLl9vLBFxIJD U1NXly1UB9yAx4ZUYJM4i1XxL682A130cRMfvmT95bWubjRi0Zn7CeRCkRmPtiREWN Isif5Idd3TLQMliGcODJE5NtyItgZJCo9iU+ZTBU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Blumenstingl , Neil Armstrong , Sasha Levin Subject: [PATCH 5.16 094/203] ARM: dts: meson: Fix the UART compatible strings Date: Mon, 14 Feb 2022 10:25:38 +0100 Message-Id: <20220214092513.460176580@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Martin Blumenstingl [ Upstream commit 5225e1b87432dcf0d0fc3440824b91d04c1d6cc1 ] The dt-bindings for the UART controller only allow the following values for Meson6 SoCs: - "amlogic,meson6-uart", "amlogic,meson-ao-uart" - "amlogic,meson6-uart" Use the correct fallback compatible string "amlogic,meson-ao-uart" for AO UART. Drop the "amlogic,meson-uart" compatible string from the EE domain UART controllers. Fixes: ec9b59162fd831 ("ARM: dts: meson6: use stable UART bindings") Signed-off-by: Martin Blumenstingl Signed-off-by: Neil Armstrong Link: https://lore.kernel.org/r/20211227180026.4068352-2-martin.blumensting= l@googlemail.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/arm/boot/dts/meson.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/boot/dts/meson.dtsi b/arch/arm/boot/dts/meson.dtsi index 3be7cba603d5a..26eaba3fa96f3 100644 --- a/arch/arm/boot/dts/meson.dtsi +++ b/arch/arm/boot/dts/meson.dtsi @@ -59,7 +59,7 @@ hwrng: rng@8100 { }; =20 uart_A: serial@84c0 { - compatible =3D "amlogic,meson6-uart", "amlogic,meson-uart"; + compatible =3D "amlogic,meson6-uart"; reg =3D <0x84c0 0x18>; interrupts =3D ; fifo-size =3D <128>; @@ -67,7 +67,7 @@ uart_A: serial@84c0 { }; =20 uart_B: serial@84dc { - compatible =3D "amlogic,meson6-uart", "amlogic,meson-uart"; + compatible =3D "amlogic,meson6-uart"; reg =3D <0x84dc 0x18>; interrupts =3D ; status =3D "disabled"; @@ -105,7 +105,7 @@ saradc: adc@8680 { }; =20 uart_C: serial@8700 { - compatible =3D "amlogic,meson6-uart", "amlogic,meson-uart"; + compatible =3D "amlogic,meson6-uart"; reg =3D <0x8700 0x18>; interrupts =3D ; status =3D "disabled"; @@ -228,7 +228,7 @@ ir_receiver: ir-receiver@480 { }; =20 uart_AO: serial@4c0 { - compatible =3D "amlogic,meson6-uart", "amlogic,meson-ao-uart", "amlogi= c,meson-uart"; + compatible =3D "amlogic,meson6-uart", "amlogic,meson-ao-uart"; reg =3D <0x4c0 0x18>; interrupts =3D ; status =3D "disabled"; --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5DA3C433FE for ; Mon, 14 Feb 2022 10:29:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347108AbiBNK3k (ORCPT ); Mon, 14 Feb 2022 05:29:40 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:57568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347089AbiBNK1h (ORCPT ); Mon, 14 Feb 2022 05:27:37 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AEBC95A1F; Mon, 14 Feb 2022 01:58:17 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 84B7860A14; Mon, 14 Feb 2022 09:58:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4422AC340E9; Mon, 14 Feb 2022 09:58:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832694; bh=SixfaTtzdyMqwe0H6Yan4n+a7bywP5NajjS/j0fBXjc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vUszrsg4CegqfzRrmzeatSIGfJU9qIqWJmpCm9cCQ8rkkS1oeYGcLE8WqTDg8UpIk SNZ17HUeJqdKea19h3ABmtRno7vQPBSIePqKivMQNO2Z1iMNlAawj4/mQ5WSfO0LfK NiJHkDkmFrgkyPkEjcRIvI23J/Kq3bUcuim8LAl8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Blumenstingl , Neil Armstrong , Sasha Levin Subject: [PATCH 5.16 095/203] ARM: dts: meson8: Fix the UART device-tree schema validation Date: Mon, 14 Feb 2022 10:25:39 +0100 Message-Id: <20220214092513.492972629@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Martin Blumenstingl [ Upstream commit 57007bfb5469ba31cacf69d52195e8b75f43e32d ] The dt-bindings for the UART controller only allow the following values for Meson8 SoCs: - "amlogic,meson8-uart", "amlogic,meson-ao-uart" - "amlogic,meson8-uart" Use the correct fallback compatible string "amlogic,meson-ao-uart" for AO UART. Drop the "amlogic,meson-uart" compatible string from the EE domain UART controllers. Also update the order of the clocks to match the order defined in the yaml schema. Fixes: 6ca77502050eff ("ARM: dts: meson8: use stable UART bindings with cor= rect gate clock") Signed-off-by: Martin Blumenstingl Signed-off-by: Neil Armstrong Link: https://lore.kernel.org/r/20211227180026.4068352-3-martin.blumensting= l@googlemail.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/arm/boot/dts/meson8.dtsi | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/arch/arm/boot/dts/meson8.dtsi b/arch/arm/boot/dts/meson8.dtsi index f80ddc98d3a2b..9997a5d0333a3 100644 --- a/arch/arm/boot/dts/meson8.dtsi +++ b/arch/arm/boot/dts/meson8.dtsi @@ -736,27 +736,27 @@ &timer_abcde { }; =20 &uart_AO { - compatible =3D "amlogic,meson8-uart", "amlogic,meson-uart"; - clocks =3D <&clkc CLKID_CLK81>, <&xtal>, <&clkc CLKID_CLK81>; - clock-names =3D "baud", "xtal", "pclk"; + compatible =3D "amlogic,meson8-uart", "amlogic,meson-ao-uart"; + clocks =3D <&xtal>, <&clkc CLKID_CLK81>, <&clkc CLKID_CLK81>; + clock-names =3D "xtal", "pclk", "baud"; }; =20 &uart_A { - compatible =3D "amlogic,meson8-uart", "amlogic,meson-uart"; - clocks =3D <&clkc CLKID_CLK81>, <&xtal>, <&clkc CLKID_UART0>; - clock-names =3D "baud", "xtal", "pclk"; + compatible =3D "amlogic,meson8-uart"; + clocks =3D <&xtal>, <&clkc CLKID_UART0>, <&clkc CLKID_CLK81>; + clock-names =3D "xtal", "pclk", "baud"; }; =20 &uart_B { - compatible =3D "amlogic,meson8-uart", "amlogic,meson-uart"; - clocks =3D <&clkc CLKID_CLK81>, <&xtal>, <&clkc CLKID_UART1>; - clock-names =3D "baud", "xtal", "pclk"; + compatible =3D "amlogic,meson8-uart"; + clocks =3D <&xtal>, <&clkc CLKID_UART0>, <&clkc CLKID_CLK81>; + clock-names =3D "xtal", "pclk", "baud"; }; =20 &uart_C { - compatible =3D "amlogic,meson8-uart", "amlogic,meson-uart"; - clocks =3D <&clkc CLKID_CLK81>, <&xtal>, <&clkc CLKID_UART2>; - clock-names =3D "baud", "xtal", "pclk"; + compatible =3D "amlogic,meson8-uart"; + clocks =3D <&xtal>, <&clkc CLKID_UART0>, <&clkc CLKID_CLK81>; + clock-names =3D "xtal", "pclk", "baud"; }; =20 &usb0 { --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BAB8C433F5 for ; Mon, 14 Feb 2022 10:30:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241151AbiBNKaH (ORCPT ); Mon, 14 Feb 2022 05:30:07 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:40230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347527AbiBNK3F (ORCPT ); Mon, 14 Feb 2022 05:29:05 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAA2B98F62; Mon, 14 Feb 2022 01:58:37 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C02E360918; Mon, 14 Feb 2022 09:58:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 85F1EC340E9; Mon, 14 Feb 2022 09:58:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832698; bh=OGK0+msb1kIhUGC5n/iUnSiYpQt27a+vnzsr7j/gXos=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V45YuwhS8KCcx7PoswUTVXWZqJ2/iLVOFnALn0Jbur51CQ/Ru60R/v6D+7oiYgVqF UBszRzPA1NwQFhtriGFSaXns5CoMLdlMpoU3x6CvVi52d875qAFA40cG2xo3AvsHxH VzhZ/KXUkPrz+Jv8JtexBalWwtahlTEhP1sFX0ag= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Blumenstingl , Neil Armstrong , Sasha Levin Subject: [PATCH 5.16 096/203] ARM: dts: meson8b: Fix the UART device-tree schema validation Date: Mon, 14 Feb 2022 10:25:40 +0100 Message-Id: <20220214092513.523717618@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Martin Blumenstingl [ Upstream commit 3375aa77135f6aeb1107ed839a2050a4118444bc ] The dt-bindings for the UART controller only allow the following values for Meson8 SoCs: - "amlogic,meson8b-uart", "amlogic,meson-ao-uart" - "amlogic,meson8b-uart" Use the correct fallback compatible string "amlogic,meson-ao-uart" for AO UART. Drop the "amlogic,meson-uart" compatible string from the EE domain UART controllers. Also update the order of the clocks to match the order defined in the yaml bindings. Fixes: b02d6e73f5fc96 ("ARM: dts: meson8b: use stable UART bindings with co= rrect gate clock") Signed-off-by: Martin Blumenstingl Signed-off-by: Neil Armstrong Link: https://lore.kernel.org/r/20211227180026.4068352-4-martin.blumensting= l@googlemail.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/arm/boot/dts/meson8b.dtsi | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/arch/arm/boot/dts/meson8b.dtsi b/arch/arm/boot/dts/meson8b.dtsi index b49b7cbaed4ee..94f1c03deccef 100644 --- a/arch/arm/boot/dts/meson8b.dtsi +++ b/arch/arm/boot/dts/meson8b.dtsi @@ -724,27 +724,27 @@ &timer_abcde { }; =20 &uart_AO { - compatible =3D "amlogic,meson8b-uart", "amlogic,meson-uart"; - clocks =3D <&clkc CLKID_CLK81>, <&xtal>, <&clkc CLKID_CLK81>; - clock-names =3D "baud", "xtal", "pclk"; + compatible =3D "amlogic,meson8b-uart", "amlogic,meson-ao-uart"; + clocks =3D <&xtal>, <&clkc CLKID_CLK81>, <&clkc CLKID_CLK81>; + clock-names =3D "xtal", "pclk", "baud"; }; =20 &uart_A { - compatible =3D "amlogic,meson8b-uart", "amlogic,meson-uart"; - clocks =3D <&clkc CLKID_CLK81>, <&xtal>, <&clkc CLKID_UART0>; - clock-names =3D "baud", "xtal", "pclk"; + compatible =3D "amlogic,meson8b-uart"; + clocks =3D <&xtal>, <&clkc CLKID_UART0>, <&clkc CLKID_CLK81>; + clock-names =3D "xtal", "pclk", "baud"; }; =20 &uart_B { - compatible =3D "amlogic,meson8b-uart", "amlogic,meson-uart"; - clocks =3D <&clkc CLKID_CLK81>, <&xtal>, <&clkc CLKID_UART1>; - clock-names =3D "baud", "xtal", "pclk"; + compatible =3D "amlogic,meson8b-uart"; + clocks =3D <&xtal>, <&clkc CLKID_UART0>, <&clkc CLKID_CLK81>; + clock-names =3D "xtal", "pclk", "baud"; }; =20 &uart_C { - compatible =3D "amlogic,meson8b-uart", "amlogic,meson-uart"; - clocks =3D <&clkc CLKID_CLK81>, <&xtal>, <&clkc CLKID_UART2>; - clock-names =3D "baud", "xtal", "pclk"; + compatible =3D "amlogic,meson8b-uart"; + clocks =3D <&xtal>, <&clkc CLKID_UART0>, <&clkc CLKID_CLK81>; + clock-names =3D "xtal", "pclk", "baud"; }; =20 &usb0 { --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E97DBC433F5 for ; Mon, 14 Feb 2022 10:29:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239482AbiBNK3v (ORCPT ); Mon, 14 Feb 2022 05:29:51 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:34840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347305AbiBNK1m (ORCPT ); Mon, 14 Feb 2022 05:27:42 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E80419680D; Mon, 14 Feb 2022 01:58:25 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 54962B80DD0; Mon, 14 Feb 2022 09:58:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 601E1C340E9; Mon, 14 Feb 2022 09:58:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832702; bh=/apOOMgqf/OTkUOcSRp5I3Rhi45H/kugQwMz+9Cmq98=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EqlAhVIj/ktsNCBUDNhhSLq/CsHsf9VUtCuLvRUb30bkUdwcPWYTgXA6+8zA80gaJ BgH2fYZjFkphKrmanyNKX6wamXADf/0k5fM2sO84BTbzDjInjHBgSCWk4WtI3MHKXe sHO2hG2fslM5TQGBomkDarlNrVPJniAWLlbs2kK8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Al Cooper , =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= , Florian Fainelli , Vinod Koul , Sasha Levin Subject: [PATCH 5.16 097/203] phy: broadcom: Kconfig: Fix PHY_BRCM_USB config option Date: Mon, 14 Feb 2022 10:25:41 +0100 Message-Id: <20220214092513.554851385@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Al Cooper [ Upstream commit 5070ce86246a8a4ebacd0c15b121e6b6325bc167 ] The previous commit 4b402fa8e0b7 ("phy: phy-brcm-usb: support PHY on the BCM4908") added a second "default" line for ARCH_BCM_4908 above the original "default" line for ARCH_BRCMSTB. When two "default" lines are used, only the first is used and this change stopped the PHY_BRCM_USB option for being enabled for ARCH_BRCMSTB. The fix is to use one "default line with "||". Fixes: 4b402fa8e0b7 ("phy: phy-brcm-usb: support PHY on the BCM4908") Signed-off-by: Al Cooper Acked-by: Rafa=C5=82 Mi=C5=82ecki Acked-by: Florian Fainelli Link: https://lore.kernel.org/r/20211201180653.35097-4-alcooperx@gmail.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/phy/broadcom/Kconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/phy/broadcom/Kconfig b/drivers/phy/broadcom/Kconfig index f81e237420799..849c4204f5506 100644 --- a/drivers/phy/broadcom/Kconfig +++ b/drivers/phy/broadcom/Kconfig @@ -97,8 +97,7 @@ config PHY_BRCM_USB depends on OF select GENERIC_PHY select SOC_BRCMSTB if ARCH_BRCMSTB - default ARCH_BCM4908 - default ARCH_BRCMSTB + default ARCH_BCM4908 || ARCH_BRCMSTB help Enable this to support the Broadcom STB USB PHY. This driver is required by the USB XHCI, EHCI and OHCI --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C1ACC433EF for ; Mon, 14 Feb 2022 10:29:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347420AbiBNK3r (ORCPT ); Mon, 14 Feb 2022 05:29:47 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:34826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347288AbiBNK1m (ORCPT ); Mon, 14 Feb 2022 05:27:42 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E82FA9680F; Mon, 14 Feb 2022 01:58:25 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B969B60909; Mon, 14 Feb 2022 09:58:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95FE1C340E9; Mon, 14 Feb 2022 09:58:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832705; bh=EUxFAa0UKKcWMvF6DQFzzmdf+4g4HZ2M/fu4aqrh+Nk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AaAnS09L4FNCAcVAzK8WujCouUHr7465fgiN6thBMQsjl2IIIUaG86pfBGQszWjYc uN5YC3WKEIZmtMO7MH+R3ZA+s9OnjuXX9glq810aCOFPLbWbYpgUDF8twd5ixvBnSf 2rTmUrd6Gm1eLW/Y365r0JPLF8AmOeQde/qonUXs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jerome Forissier , Sumit Garg , Jens Wiklander , Sasha Levin Subject: [PATCH 5.16 098/203] tee: optee: do not check memref size on return from Secure World Date: Mon, 14 Feb 2022 10:25:42 +0100 Message-Id: <20220214092513.587308135@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jerome Forissier [ Upstream commit abc8dc34d1f6e34ed346c6e3fc554127e421b769 ] Commit c650b8dc7a79 ("tee: optee: do not check memref size on return from Secure World") was mistakenly lost in commit 4602c5842f64 ("optee: refactor driver with internal callbacks"). Remove the unwanted code again. Fixes: 4602c5842f64 ("optee: refactor driver with internal callbacks") Signed-off-by: Jerome Forissier Reviewed-by: Sumit Garg Signed-off-by: Jens Wiklander Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/tee/optee/smc_abi.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/drivers/tee/optee/smc_abi.c b/drivers/tee/optee/smc_abi.c index cf2e3293567d9..09e7ec673bb6b 100644 --- a/drivers/tee/optee/smc_abi.c +++ b/drivers/tee/optee/smc_abi.c @@ -71,16 +71,6 @@ static int from_msg_param_tmp_mem(struct tee_param *p, u= 32 attr, p->u.memref.shm_offs =3D mp->u.tmem.buf_ptr - pa; p->u.memref.shm =3D shm; =20 - /* Check that the memref is covered by the shm object */ - if (p->u.memref.size) { - size_t o =3D p->u.memref.shm_offs + - p->u.memref.size - 1; - - rc =3D tee_shm_get_pa(shm, o, NULL); - if (rc) - return rc; - } - return 0; } =20 --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C96BC433F5 for ; Mon, 14 Feb 2022 10:30:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234823AbiBNKae (ORCPT ); Mon, 14 Feb 2022 05:30:34 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:39056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347119AbiBNKaF (ORCPT ); Mon, 14 Feb 2022 05:30:05 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CCD36A387; Mon, 14 Feb 2022 01:58:50 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 485A6B80DC4; Mon, 14 Feb 2022 09:58:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6F2F3C340F1; Mon, 14 Feb 2022 09:58:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832709; bh=etpHd9/WD9Ys2NjYn1EXaPPAzL/S6ZAhPd+Me0wtatU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ToFwx3Yd3VELAgJfrIi4XR+x9QUPhY/7Yu+3TeOYcoVcyMaKSnqRddWGe4uOSMpIb N3GgRPuwxaFXnAtXUgiFfNLj63dpVs4a6RbXhw7C18xqJvE8uVojXMMHtLDLU9V69q PrWiVTP4tTOnkwVq/YzZHMuFrn8yt5c6o2wqVMHE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sumit Garg , Jens Wiklander , Sasha Levin Subject: [PATCH 5.16 099/203] optee: add error checks in optee_ffa_do_call_with_arg() Date: Mon, 14 Feb 2022 10:25:43 +0100 Message-Id: <20220214092513.620430662@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jens Wiklander [ Upstream commit 4064c461148ab129dfe5eaeea129b4af6cf4b9b7 ] Adds error checking in optee_ffa_do_call_with_arg() for correctness. Fixes: 4615e5a34b95 ("optee: add FF-A support") Reviewed-by: Sumit Garg Signed-off-by: Jens Wiklander Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/tee/optee/ffa_abi.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/tee/optee/ffa_abi.c b/drivers/tee/optee/ffa_abi.c index d8c8683863aa0..28d7c0eafc025 100644 --- a/drivers/tee/optee/ffa_abi.c +++ b/drivers/tee/optee/ffa_abi.c @@ -619,9 +619,18 @@ static int optee_ffa_do_call_with_arg(struct tee_conte= xt *ctx, .data2 =3D (u32)(shm->sec_world_id >> 32), .data3 =3D shm->offset, }; - struct optee_msg_arg *arg =3D tee_shm_get_va(shm, 0); - unsigned int rpc_arg_offs =3D OPTEE_MSG_GET_ARG_SIZE(arg->num_params); - struct optee_msg_arg *rpc_arg =3D tee_shm_get_va(shm, rpc_arg_offs); + struct optee_msg_arg *arg; + unsigned int rpc_arg_offs; + struct optee_msg_arg *rpc_arg; + + arg =3D tee_shm_get_va(shm, 0); + if (IS_ERR(arg)) + return PTR_ERR(arg); + + rpc_arg_offs =3D OPTEE_MSG_GET_ARG_SIZE(arg->num_params); + rpc_arg =3D tee_shm_get_va(shm, rpc_arg_offs); + if (IS_ERR(rpc_arg)) + return PTR_ERR(rpc_arg); =20 return optee_ffa_yielding_call(ctx, &data, rpc_arg); } --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D86D9C433F5 for ; Mon, 14 Feb 2022 10:31:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347747AbiBNKai (ORCPT ); Mon, 14 Feb 2022 05:30:38 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347710AbiBNKaG (ORCPT ); Mon, 14 Feb 2022 05:30:06 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADC337093D; Mon, 14 Feb 2022 01:58:51 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4D63BB80DC8; Mon, 14 Feb 2022 09:58:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 740A4C340E9; Mon, 14 Feb 2022 09:58:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832712; bh=JfL+GhWxwE5F5v6NmdagFTHsk5XA1TJAJFpQryMWtWs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XILD0+U/KaiC2gYfkrFyBkD417RQrH+0ZnAwFHz1iuidu1JDdYnPi+BupgansWVyd MjjEhpbg3Iw1+unJQbpOoQVuRvv58hQuzvcjigk/dBRIE4XcodlkIkFTDyL99Y3uEr UejIO3zvA/6n+J6DOyp0KEAUM6WZNocrUNifAxmM= 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?= , Sasha Levin Subject: [PATCH 5.16 100/203] staging: fbtft: Fix error path in fbtft_driver_module_init() Date: Mon, 14 Feb 2022 10:25:44 +0100 Message-Id: <20220214092513.650977713@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Uwe Kleine-K=C3=B6nig [ Upstream commit 426aca16e903b387a0b0001d62207a745c67cfd3 ] If registering the platform driver fails, the function must not return without undoing the spi driver registration first. Fixes: c296d5f9957c ("staging: fbtft: core support") Signed-off-by: Uwe Kleine-K=C3=B6nig Link: https://lore.kernel.org/r/20220118181338.207943-1-u.kleine-koenig@pen= gutronix.de Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/staging/fbtft/fbtft.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/staging/fbtft/fbtft.h b/drivers/staging/fbtft/fbtft.h index 6869f3603b0e6..9a6c906820f22 100644 --- a/drivers/staging/fbtft/fbtft.h +++ b/drivers/staging/fbtft/fbtft.h @@ -334,7 +334,10 @@ static int __init fbtft_driver_module_init(void) = \ ret =3D spi_register_driver(&fbtft_driver_spi_driver); \ if (ret < 0) \ return ret; \ - return platform_driver_register(&fbtft_driver_platform_driver); \ + ret =3D platform_driver_register(&fbtft_driver_platform_driver); \ + if (ret < 0) \ + spi_unregister_driver(&fbtft_driver_spi_driver); \ + return ret; \ } = \ \ static void __exit fbtft_driver_module_exit(void) = \ --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F4129C433F5 for ; Mon, 14 Feb 2022 10:30:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237274AbiBNKaL (ORCPT ); Mon, 14 Feb 2022 05:30:11 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:33380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347543AbiBNK3F (ORCPT ); Mon, 14 Feb 2022 05:29:05 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17F7298F6B; Mon, 14 Feb 2022 01:58:38 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 860D4B80D6D; Mon, 14 Feb 2022 09:58:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9492FC340E9; Mon, 14 Feb 2022 09:58:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832715; bh=/kvuUnbi5mWqDPHzY3HwB9slTUfUSoIsVvCWl1dVzJI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ew9DtpPdTxT1szperVCGxY/jV6Be8L4O/uqaH0TV/eZCBBcNhX//cjL9J8VeteNtQ +MxHRwRuDKoh98nVYfQbk96KWB36O5tl1qQC+kRaFx7AnKfxcPD/IW5tY5bwtG2AYR m8/70MomEt2ehqMfVvbWTQQq83ONcQ5Q4u18ykUk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fabio Estevam , Shawn Guo , Sasha Levin Subject: [PATCH 5.16 101/203] ARM: dts: imx6qdl-udoo: Properly describe the SD card detect Date: Mon, 14 Feb 2022 10:25:45 +0100 Message-Id: <20220214092513.682996086@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 993d66140f8d1c1853a3b58b77b43b681eb64dee ] GPIO7_IO00 is used as SD card detect. Properly describe this in the devicetree. Fixes: 40cdaa542cf0 ("ARM: dts: imx6q-udoo: Add initial board support") Signed-off-by: Fabio Estevam Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/arm/boot/dts/imx6qdl-udoo.dtsi | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/imx6qdl-udoo.dtsi b/arch/arm/boot/dts/imx6qd= l-udoo.dtsi index d07d8f83456d2..ccfa8e320be62 100644 --- a/arch/arm/boot/dts/imx6qdl-udoo.dtsi +++ b/arch/arm/boot/dts/imx6qdl-udoo.dtsi @@ -5,6 +5,8 @@ * Author: Fabio Estevam */ =20 +#include + / { aliases { backlight =3D &backlight; @@ -226,6 +228,7 @@ MX6QDL_PAD_SD3_DAT0__SD3_DATA0 0x17059 MX6QDL_PAD_SD3_DAT1__SD3_DATA1 0x17059 MX6QDL_PAD_SD3_DAT2__SD3_DATA2 0x17059 MX6QDL_PAD_SD3_DAT3__SD3_DATA3 0x17059 + MX6QDL_PAD_SD3_DAT5__GPIO7_IO00 0x1b0b0 >; }; =20 @@ -304,7 +307,7 @@ &usbotg { &usdhc3 { pinctrl-names =3D "default"; pinctrl-0 =3D <&pinctrl_usdhc3>; - non-removable; + cd-gpios =3D <&gpio7 0 GPIO_ACTIVE_LOW>; status =3D "okay"; }; =20 --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D94DC433EF for ; Mon, 14 Feb 2022 10:30:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347480AbiBNKaP (ORCPT ); Mon, 14 Feb 2022 05:30:15 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:34812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347688AbiBNK3t (ORCPT ); Mon, 14 Feb 2022 05:29:49 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 870847091C; Mon, 14 Feb 2022 01:58:44 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C33B6B80DCF; Mon, 14 Feb 2022 09:58:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0237DC340E9; Mon, 14 Feb 2022 09:58:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832721; bh=Ps3oBb9b+xFWRMsLAGzbqJCxUR2gJJ6YgKqya6yTpKA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RWHwhEOpv+T0IJcDx85mulKfXnFVrimojxrsu/WbQx5TQj6C1R/5xyLUrSMWIhH2b +AvZ01EIC3oHUBWDpnnjMGERUEBr41nEcrGXL7AAvNkWzD2ktbM4mrEaxymjbmoNJm DP59TWC3Vh3Rt6vtF4B2QU77tH03RY3WYMXrBb74= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Hancock , Michal Simek , Laurent Pinchart , Vinod Koul , Sasha Levin Subject: [PATCH 5.16 102/203] phy: xilinx: zynqmp: Fix bus width setting for SGMII Date: Mon, 14 Feb 2022 10:25:46 +0100 Message-Id: <20220214092513.716954518@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Robert Hancock [ Upstream commit 37291f60d0822f191748c2a54ce63b0bc669020f ] TX_PROT_BUS_WIDTH and RX_PROT_BUS_WIDTH are single registers with separate bit fields for each lane. The code in xpsgtr_phy_init_sgmii was not preserving the existing register value for other lanes, so enabling the PHY in SGMII mode on one lane zeroed out the settings for all other lanes, causing other PS-GTR peripherals such as USB3 to malfunction. Use xpsgtr_clr_set to only manipulate the desired bits in the register. Fixes: 4a33bea00314 ("phy: zynqmp: Add PHY driver for the Xilinx ZynqMP Gig= abit Transceiver") Signed-off-by: Robert Hancock Acked-by: Michal Simek Reviewed-by: Laurent Pinchart Link: https://lore.kernel.org/r/20220126001600.1592218-1-robert.hancock@cal= ian.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/phy/xilinx/phy-zynqmp.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/phy/xilinx/phy-zynqmp.c b/drivers/phy/xilinx/phy-zynqm= p.c index f478d8a17115b..9be9535ad7ab7 100644 --- a/drivers/phy/xilinx/phy-zynqmp.c +++ b/drivers/phy/xilinx/phy-zynqmp.c @@ -134,7 +134,8 @@ #define PROT_BUS_WIDTH_10 0x0 #define PROT_BUS_WIDTH_20 0x1 #define PROT_BUS_WIDTH_40 0x2 -#define PROT_BUS_WIDTH_SHIFT 2 +#define PROT_BUS_WIDTH_SHIFT(n) ((n) * 2) +#define PROT_BUS_WIDTH_MASK(n) GENMASK((n) * 2 + 1, (n) * 2) =20 /* Number of GT lanes */ #define NUM_LANES 4 @@ -445,12 +446,12 @@ static void xpsgtr_phy_init_sata(struct xpsgtr_phy *g= tr_phy) static void xpsgtr_phy_init_sgmii(struct xpsgtr_phy *gtr_phy) { struct xpsgtr_dev *gtr_dev =3D gtr_phy->dev; + u32 mask =3D PROT_BUS_WIDTH_MASK(gtr_phy->lane); + u32 val =3D PROT_BUS_WIDTH_10 << PROT_BUS_WIDTH_SHIFT(gtr_phy->lane); =20 /* Set SGMII protocol TX and RX bus width to 10 bits. */ - xpsgtr_write(gtr_dev, TX_PROT_BUS_WIDTH, - PROT_BUS_WIDTH_10 << (gtr_phy->lane * PROT_BUS_WIDTH_SHIFT)); - xpsgtr_write(gtr_dev, RX_PROT_BUS_WIDTH, - PROT_BUS_WIDTH_10 << (gtr_phy->lane * PROT_BUS_WIDTH_SHIFT)); + xpsgtr_clr_set(gtr_dev, TX_PROT_BUS_WIDTH, mask, val); + xpsgtr_clr_set(gtr_dev, RX_PROT_BUS_WIDTH, mask, val); =20 xpsgtr_bypass_scrambler_8b10b(gtr_phy); } --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4EAEC433F5 for ; Mon, 14 Feb 2022 10:30:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347618AbiBNKaW (ORCPT ); Mon, 14 Feb 2022 05:30:22 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347269AbiBNKaE (ORCPT ); Mon, 14 Feb 2022 05:30:04 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30B8E60DAC; Mon, 14 Feb 2022 01:58:48 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E91A6B80DCD; Mon, 14 Feb 2022 09:58:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B2DDC340E9; Mon, 14 Feb 2022 09:58:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832724; bh=AyZf0eQelAtzwuOhkkU/LFwNm/bYKXJ0mqWK38zXre4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i9bZ/CVI+gApC9YfV4cTGlXSP51K5vt6mOcRyBBeRyszwIVOiN8WRHfIlrsqBZLxh qPZwwwV1RVgdjQmcTN/PZ6M6+JES287tbYFLTaw4sGcSSoVg3oWrD76IHLBGyABrVT DbgvoOHM/lR+l0Kz/qJS/VdHkrLZyWn5JyrcQ1Zk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Vinod Koul , Sasha Levin Subject: [PATCH 5.16 103/203] phy: stm32: fix a refcount leak in stm32_usbphyc_pll_enable() Date: Mon, 14 Feb 2022 10:25:47 +0100 Message-Id: <20220214092513.750298164@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 cfc826c88a79e22ba5d8001556eb2c7efd8a01b6 ] This error path needs to decrement "usbphyc->n_pll_cons.counter" before returning. Fixes: 5b1af71280ab ("phy: stm32: rework PLL Lock detection") Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/20220112111724.GB3019@kili Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/phy/st/phy-stm32-usbphyc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/phy/st/phy-stm32-usbphyc.c b/drivers/phy/st/phy-stm32-= usbphyc.c index e4f4a9be51320..1ecdc26689ce8 100644 --- a/drivers/phy/st/phy-stm32-usbphyc.c +++ b/drivers/phy/st/phy-stm32-usbphyc.c @@ -304,7 +304,7 @@ static int stm32_usbphyc_pll_enable(struct stm32_usbphy= c *usbphyc) =20 ret =3D __stm32_usbphyc_pll_disable(usbphyc); if (ret) - return ret; + goto dec_n_pll_cons; } =20 ret =3D stm32_usbphyc_regulators_enable(usbphyc); --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 265BAC43217 for ; Mon, 14 Feb 2022 10:31:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347757AbiBNKbW (ORCPT ); Mon, 14 Feb 2022 05:31:22 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:37350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347199AbiBNKaJ (ORCPT ); Mon, 14 Feb 2022 05:30:09 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0C78996B2; Mon, 14 Feb 2022 01:59:00 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6223360B33; Mon, 14 Feb 2022 09:58:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D530C340E9; Mon, 14 Feb 2022 09:58:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832727; bh=On09NtlxisAFDWKGqSyeGfJb1Y/OGiixVGVkNghruI0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JIcDj53V3AOpUzy9vwSDWs6dIXb0H8gD6Jx0OjJzMjBhrrFxBXXWARp/nl+zLBwnl WbiFaySZ9FpvK4NCgtkma/6p70JsPiJjlnX2+RGQGg+hcoCPt++Qn3BZZGc7/Ue8GB rz95v/+wcqfJrDRT1KsJ0j1eS2IT07ScAlOQsyzQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rob Herring , Shawn Guo , Sasha Levin Subject: [PATCH 5.16 104/203] ARM: dts: imx7ulp: Fix assigned-clocks-parents typo Date: Mon, 14 Feb 2022 10:25:48 +0100 Message-Id: <20220214092513.781966778@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Herring [ Upstream commit 6d58c5e21a3fe355ce6d1808e96d02a610265218 ] The correct property name is 'assigned-clock-parents', not 'assigned-clocks-parents'. Though if the platform works with the typo, one has to wonder if the property is even needed. Signed-off-by: Rob Herring Fixes: 8b8c7d97e2c7 ("ARM: dts: imx7ulp: Add wdog1 node") Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/arm/boot/dts/imx7ulp.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/imx7ulp.dtsi b/arch/arm/boot/dts/imx7ulp.dtsi index b7ea37ad4e55c..bcec98b964114 100644 --- a/arch/arm/boot/dts/imx7ulp.dtsi +++ b/arch/arm/boot/dts/imx7ulp.dtsi @@ -259,7 +259,7 @@ wdog1: watchdog@403d0000 { interrupts =3D ; clocks =3D <&pcc2 IMX7ULP_CLK_WDG1>; assigned-clocks =3D <&pcc2 IMX7ULP_CLK_WDG1>; - assigned-clocks-parents =3D <&scg1 IMX7ULP_CLK_FIRC_BUS_CLK>; + assigned-clock-parents =3D <&scg1 IMX7ULP_CLK_FIRC_BUS_CLK>; timeout-sec =3D <40>; }; =20 --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1581DC433EF for ; Mon, 14 Feb 2022 10:31:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347847AbiBNKaj (ORCPT ); Mon, 14 Feb 2022 05:30:39 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347569AbiBNKaG (ORCPT ); Mon, 14 Feb 2022 05:30:06 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A9E799680; Mon, 14 Feb 2022 01:58:52 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 89FEB60A69; Mon, 14 Feb 2022 09:58:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 655E1C340E9; Mon, 14 Feb 2022 09:58:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832731; bh=o4neHMx2mJG77mYsmSI3U36Vmc1lgTCbnYGLWeoZyoU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NVrq17cDB35tvNaZxtQoNg2KRkalr7akVYBSjDo4N1F7EzNwyAsOIBKCz6+HWvUtr ADMLTpjOqjJs57KYkVu9h2Pn6Ts7uZDr9Uj8e/M4GkwHHEndaTOXbgutg/h71vfSrn fIulcQgXpL1WZTjOMGR1t158U1cr6MdeWAhc6Oa4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Kepplinger , Shawn Guo , Sasha Levin Subject: [PATCH 5.16 105/203] arm64: dts: imx8mq: fix mipi_csi bidirectional port numbers Date: Mon, 14 Feb 2022 10:25:49 +0100 Message-Id: <20220214092513.811692543@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Martin Kepplinger [ Upstream commit 283d45145fbf460dbaf0229cacd7ed60ec52f364 ] The port numbers for the imx8mq mipi csi controller are wrong and the mipi driver can't find any media devices as port@1 is connected to the CSI bridge, not port@0. And port@0 is connected to the source - the sensor. Fix this. Fixes: bcadd5f66c2a ("arm64: dts: imx8mq: add mipi csi phy and csi bridge d= escriptions") Signed-off-by: Martin Kepplinger Signed-off-by: Shawn Guo Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/arm64/boot/dts/freescale/imx8mq.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm64/boot/dts/freescale/imx8mq.dtsi b/arch/arm64/boot/dt= s/freescale/imx8mq.dtsi index 71bf497f99c25..c222d93f5e649 100644 --- a/arch/arm64/boot/dts/freescale/imx8mq.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mq.dtsi @@ -1123,8 +1123,8 @@ ports { #address-cells =3D <1>; #size-cells =3D <0>; =20 - port@0 { - reg =3D <0>; + port@1 { + reg =3D <1>; =20 csi1_mipi_ep: endpoint { remote-endpoint =3D <&csi1_ep>; @@ -1175,8 +1175,8 @@ ports { #address-cells =3D <1>; #size-cells =3D <0>; =20 - port@0 { - reg =3D <0>; + port@1 { + reg =3D <1>; =20 csi2_mipi_ep: endpoint { remote-endpoint =3D <&csi2_ep>; --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75DF3C43219 for ; Mon, 14 Feb 2022 10:35:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348356AbiBNKfU (ORCPT ); Mon, 14 Feb 2022 05:35:20 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348233AbiBNKeZ (ORCPT ); Mon, 14 Feb 2022 05:34:25 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6339EC65; Mon, 14 Feb 2022 02:01:01 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1598FB80DC8; Mon, 14 Feb 2022 10:01:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 307EDC340E9; Mon, 14 Feb 2022 10:00:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832858; bh=n6NpMcYsG45RSNI8r3dy+S9RAfEl+dyHQ7UTkb/V51w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b7Ru8fYv4XyMeisV8BYzhfLbKFp+cAJTZKiX2h8oDSnjdX6MbN0sUFkl3kZLqCTXH jSQnW86aAXfBEOeejV5pzn7/a75baXfFSt7QY/pxmA5O/VrCZn+ytlNjhG7BHo6eh+ Qs2LSVIb2nhpHMtF6mhdyl5VBmLRjFbzEb9+Gejs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Keeping , Pratham Pratap , Udipto Goswami , Sasha Levin Subject: [PATCH 5.16 106/203] usb: f_fs: Fix use-after-free for epfile Date: Mon, 14 Feb 2022 10:25:50 +0100 Message-Id: <20220214092513.843903425@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Udipto Goswami [ Upstream commit ebe2b1add1055b903e2acd86b290a85297edc0b3 ] Consider a case where ffs_func_eps_disable is called from ffs_func_disable as part of composition switch and at the same time ffs_epfile_release get called from userspace. ffs_epfile_release will free up the read buffer and call ffs_data_closed which in turn destroys ffs->epfiles and mark it as NULL. While this was happening the driver has already initialized the local epfile in ffs_func_eps_disable which is now freed and waiting to acquire the spinlock. Once spinlock is acquired the driver proceeds with the stale value of epfile and tries to free the already freed read buffer causing use-after-free. Following is the illustration of the race: CPU1 CPU2 ffs_func_eps_disable epfiles (local copy) ffs_epfile_release ffs_data_closed if (last file closed) ffs_data_reset ffs_data_clear ffs_epfiles_destroy spin_lock dereference epfiles Fix this races by taking epfiles local copy & assigning it under spinlock and if epfiles(local) is null then update it in ffs->epfiles then finally destroy it. Extending the scope further from the race, protecting the ep related structures, and concurrent accesses. Fixes: a9e6f83c2df1 ("usb: gadget: f_fs: stop sleeping in ffs_func_eps_disa= ble") Co-developed-by: Udipto Goswami Reviewed-by: John Keeping Signed-off-by: Pratham Pratap Signed-off-by: Udipto Goswami Link: https://lore.kernel.org/r/1643256595-10797-1-git-send-email-quic_ugos= wami@quicinc.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/usb/gadget/function/f_fs.c | 56 ++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 14 deletions(-) diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/functi= on/f_fs.c index 25ad1e97a4585..1922fd02043c5 100644 --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c @@ -1711,16 +1711,24 @@ static void ffs_data_put(struct ffs_data *ffs) =20 static void ffs_data_closed(struct ffs_data *ffs) { + struct ffs_epfile *epfiles; + unsigned long flags; + ENTER(); =20 if (atomic_dec_and_test(&ffs->opened)) { if (ffs->no_disconnect) { ffs->state =3D FFS_DEACTIVATED; - if (ffs->epfiles) { - ffs_epfiles_destroy(ffs->epfiles, - ffs->eps_count); - ffs->epfiles =3D NULL; - } + spin_lock_irqsave(&ffs->eps_lock, flags); + epfiles =3D ffs->epfiles; + ffs->epfiles =3D NULL; + spin_unlock_irqrestore(&ffs->eps_lock, + flags); + + if (epfiles) + ffs_epfiles_destroy(epfiles, + ffs->eps_count); + if (ffs->setup_state =3D=3D FFS_SETUP_PENDING) __ffs_ep0_stall(ffs); } else { @@ -1767,14 +1775,27 @@ static struct ffs_data *ffs_data_new(const char *de= v_name) =20 static void ffs_data_clear(struct ffs_data *ffs) { + struct ffs_epfile *epfiles; + unsigned long flags; + ENTER(); =20 ffs_closed(ffs); =20 BUG_ON(ffs->gadget); =20 - if (ffs->epfiles) { - ffs_epfiles_destroy(ffs->epfiles, ffs->eps_count); + spin_lock_irqsave(&ffs->eps_lock, flags); + epfiles =3D ffs->epfiles; + ffs->epfiles =3D NULL; + spin_unlock_irqrestore(&ffs->eps_lock, flags); + + /* + * potential race possible between ffs_func_eps_disable + * & ffs_epfile_release therefore maintaining a local + * copy of epfile will save us from use-after-free. + */ + if (epfiles) { + ffs_epfiles_destroy(epfiles, ffs->eps_count); ffs->epfiles =3D NULL; } =20 @@ -1922,12 +1943,15 @@ static void ffs_epfiles_destroy(struct ffs_epfile *= epfiles, unsigned count) =20 static void ffs_func_eps_disable(struct ffs_function *func) { - struct ffs_ep *ep =3D func->eps; - struct ffs_epfile *epfile =3D func->ffs->epfiles; - unsigned count =3D func->ffs->eps_count; + struct ffs_ep *ep; + struct ffs_epfile *epfile; + unsigned short count; unsigned long flags; =20 spin_lock_irqsave(&func->ffs->eps_lock, flags); + count =3D func->ffs->eps_count; + epfile =3D func->ffs->epfiles; + ep =3D func->eps; while (count--) { /* pending requests get nuked */ if (ep->ep) @@ -1945,14 +1969,18 @@ static void ffs_func_eps_disable(struct ffs_functio= n *func) =20 static int ffs_func_eps_enable(struct ffs_function *func) { - struct ffs_data *ffs =3D func->ffs; - struct ffs_ep *ep =3D func->eps; - struct ffs_epfile *epfile =3D ffs->epfiles; - unsigned count =3D ffs->eps_count; + struct ffs_data *ffs; + struct ffs_ep *ep; + struct ffs_epfile *epfile; + unsigned short count; unsigned long flags; int ret =3D 0; =20 spin_lock_irqsave(&func->ffs->eps_lock, flags); + ffs =3D func->ffs; + ep =3D func->eps; + epfile =3D ffs->epfiles; + count =3D ffs->eps_count; while(count--) { ep->ep->driver_data =3D ep; =20 --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C046C433F5 for ; Mon, 14 Feb 2022 10:31:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347948AbiBNKbk (ORCPT ); Mon, 14 Feb 2022 05:31:40 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348114AbiBNKaq (ORCPT ); Mon, 14 Feb 2022 05:30:46 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 511169BF59; Mon, 14 Feb 2022 01:59:20 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D347760921; Mon, 14 Feb 2022 09:59:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0ADEC340E9; Mon, 14 Feb 2022 09:59:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832757; bh=QUTNVwz+yVHcljh6bmE8p4c9DR9JYaIcZoW8VimMowk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nbbT5LjaKP8tVo2f5y5eDjga3J39Sb1+HhpgVR/Oxp99qM9PR/hju42F1SXEnodl+ G4RsRGndicu2DwOED+dK7rUz/zo8gOnezpO805ssTi28fL3RO8NgMJYwObylsMi2Og C3IndlSZH/zNJI9TtdFDTgWwiTpqos6kDw865I14= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Brown , Catalin Marinas , Sasha Levin Subject: [PATCH 5.16 107/203] arm64: Enable Cortex-A510 erratum 2051678 by default Date: Mon, 14 Feb 2022 10:25:51 +0100 Message-Id: <20220214092513.882562722@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 a4b92cebc31d49b7e6ef0ce584c7f2a2e112877d ] The recently added configuration option for Cortex A510 erratum 2051678 does not have a "default y" unlike other errata fixes. This appears to simply be an oversight since the help text suggests enabling the option if unsure and there's nothing in the commit log to suggest it is intentional. Fixes: 297ae1eb23b0 ("arm64: cpufeature: List early Cortex-A510 parts as ha= ving broken dbm") Signed-off-by: Mark Brown Link: https://lore.kernel.org/r/20220201144838.20037-1-broonie@kernel.org Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/arm64/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig index 38e7f19df14d4..ae0e93871ee5f 100644 --- a/arch/arm64/Kconfig +++ b/arch/arm64/Kconfig @@ -672,6 +672,7 @@ config ARM64_WORKAROUND_TRBE_OVERWRITE_FILL_MODE =20 config ARM64_ERRATUM_2051678 bool "Cortex-A510: 2051678: disable Hardware Update of the page table dir= ty bit" + default y help This options adds the workaround for ARM Cortex-A510 erratum ARM64_ERRA= TUM_2051678. Affected Coretex-A510 might not respect the ordering rules for --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34232C433EF for ; Mon, 14 Feb 2022 10:33:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233182AbiBNKdc (ORCPT ); Mon, 14 Feb 2022 05:33:32 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347634AbiBNKbR (ORCPT ); Mon, 14 Feb 2022 05:31:17 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 049BE9FACE; Mon, 14 Feb 2022 02:00:02 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3ABBC60B33; Mon, 14 Feb 2022 09:59:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22B75C340E9; Mon, 14 Feb 2022 09:59:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832791; bh=tPEjF7F9Mz+qnlVTN+3+8I9Hs7K5Y+z4WT9v7HTWFkM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kDcV5DdPntsEXiuM8FBTTjqL31K+IxK/d+PUxAvHnvlLC2ixAfS7/21S7WYRDcIlz VjLmwwJ0DBhR0CBEawClGV8E//QhRBQRGe+Gz9xsotRGQ8FQl2E2hsp/CBd7jywz4d R2NtOV4kfPpD+aBafwJ9+8eYtxLeipFwimdSo6QI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrzej Hajda , Laurent Pinchart , Liu Ying , Vinod Koul , Sasha Levin , Neil Armstrong , =?UTF-8?q?Guido=20G=C3=BCnther?= Subject: [PATCH 5.16 108/203] phy: dphy: Correct clk_pre parameter Date: Mon, 14 Feb 2022 10:25:52 +0100 Message-Id: <20220214092513.916358236@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Liu Ying [ Upstream commit 9a8406ba1a9a2965c27e0db1d7753471d12ee9ff ] The D-PHY specification (v1.2) explicitly mentions that the T-CLK-PRE parameter's unit is Unit Interval(UI) and the minimum value is 8. Also, kernel doc of the 'clk_pre' member of struct phy_configure_opts_mipi_dphy mentions that it should be in UI. However, the dphy core driver wrongly sets 'clk_pre' to 8000, which seems to hint that it's in picoseconds. So, let's fix the dphy core driver to correctly reflect the T-CLK-PRE parameter's minimum value according to the D-PHY specification. I'm assuming that all impacted custom drivers shall program values in TxByteClkHS cycles into hardware for the T-CLK-PRE parameter. The D-PHY specification mentions that the frequency of TxByteClkHS is exactly 1/8 the High-Speed(HS) bit rate(each HS bit consumes one UI). So, relevant custom driver code is changed to program those values as DIV_ROUND_UP(cfg->clk_pre, BITS_PER_BYTE), then. Note that I've only tested the patch with RM67191 DSI panel on i.MX8mq EVK. Help is needed to test with other i.MX8mq, Meson and Rockchip platforms, as I don't have the hardwares. Fixes: 2ed869990e14 ("phy: Add MIPI D-PHY configuration options") Tested-by: Liu Ying # RM67191 DSI panel on i.MX8mq EVK Reviewed-by: Andrzej Hajda Reviewed-by: Neil Armstrong # for phy-meson-axg-m= ipi-dphy.c Tested-by: Neil Armstrong # for phy-meson-axg-mip= i-dphy.c Tested-by: Guido G=C3=BCnther # Librem 5 (imx8mq) with it= 's rather picky panel Reviewed-by: Laurent Pinchart Signed-off-by: Liu Ying Link: https://lore.kernel.org/r/20220124024007.1465018-1-victor.liu@nxp.com Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/gpu/drm/bridge/nwl-dsi.c | 12 +++++------- drivers/phy/amlogic/phy-meson-axg-mipi-dphy.c | 3 ++- drivers/phy/phy-core-mipi-dphy.c | 4 ++-- drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c | 3 ++- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/bridge/nwl-dsi.c b/drivers/gpu/drm/bridge/nwl-= dsi.c index a7389a0facfb4..af07eeb47ca02 100644 --- a/drivers/gpu/drm/bridge/nwl-dsi.c +++ b/drivers/gpu/drm/bridge/nwl-dsi.c @@ -7,6 +7,7 @@ */ =20 #include +#include #include #include #include @@ -196,12 +197,9 @@ static u32 ps2bc(struct nwl_dsi *dsi, unsigned long lo= ng ps) /* * ui2bc - UI time periods to byte clock cycles */ -static u32 ui2bc(struct nwl_dsi *dsi, unsigned long long ui) +static u32 ui2bc(unsigned int ui) { - u32 bpp =3D mipi_dsi_pixel_format_to_bpp(dsi->format); - - return DIV64_U64_ROUND_UP(ui * dsi->lanes, - dsi->mode.clock * 1000 * bpp); + return DIV_ROUND_UP(ui, BITS_PER_BYTE); } =20 /* @@ -232,12 +230,12 @@ static int nwl_dsi_config_host(struct nwl_dsi *dsi) } =20 /* values in byte clock cycles */ - cycles =3D ui2bc(dsi, cfg->clk_pre); + cycles =3D ui2bc(cfg->clk_pre); DRM_DEV_DEBUG_DRIVER(dsi->dev, "cfg_t_pre: 0x%x\n", cycles); nwl_dsi_write(dsi, NWL_DSI_CFG_T_PRE, cycles); cycles =3D ps2bc(dsi, cfg->lpx + cfg->clk_prepare + cfg->clk_zero); DRM_DEV_DEBUG_DRIVER(dsi->dev, "cfg_tx_gap (pre): 0x%x\n", cycles); - cycles +=3D ui2bc(dsi, cfg->clk_pre); + cycles +=3D ui2bc(cfg->clk_pre); DRM_DEV_DEBUG_DRIVER(dsi->dev, "cfg_t_post: 0x%x\n", cycles); nwl_dsi_write(dsi, NWL_DSI_CFG_T_POST, cycles); cycles =3D ps2bc(dsi, cfg->hs_exit); diff --git a/drivers/phy/amlogic/phy-meson-axg-mipi-dphy.c b/drivers/phy/am= logic/phy-meson-axg-mipi-dphy.c index cd2332bf0e31a..fdbd64c03e12b 100644 --- a/drivers/phy/amlogic/phy-meson-axg-mipi-dphy.c +++ b/drivers/phy/amlogic/phy-meson-axg-mipi-dphy.c @@ -9,6 +9,7 @@ =20 #include #include +#include #include #include #include @@ -250,7 +251,7 @@ static int phy_meson_axg_mipi_dphy_power_on(struct phy = *phy) (DIV_ROUND_UP(priv->config.clk_zero, temp) << 16) | (DIV_ROUND_UP(priv->config.clk_prepare, temp) << 24)); regmap_write(priv->regmap, MIPI_DSI_CLK_TIM1, - DIV_ROUND_UP(priv->config.clk_pre, temp)); + DIV_ROUND_UP(priv->config.clk_pre, BITS_PER_BYTE)); =20 regmap_write(priv->regmap, MIPI_DSI_HS_TIM, DIV_ROUND_UP(priv->config.hs_exit, temp) | diff --git a/drivers/phy/phy-core-mipi-dphy.c b/drivers/phy/phy-core-mipi-d= phy.c index 288c9c67aa748..ccb4045685cdd 100644 --- a/drivers/phy/phy-core-mipi-dphy.c +++ b/drivers/phy/phy-core-mipi-dphy.c @@ -36,7 +36,7 @@ int phy_mipi_dphy_get_default_config(unsigned long pixel_= clock, =20 cfg->clk_miss =3D 0; cfg->clk_post =3D 60000 + 52 * ui; - cfg->clk_pre =3D 8000; + cfg->clk_pre =3D 8; cfg->clk_prepare =3D 38000; cfg->clk_settle =3D 95000; cfg->clk_term_en =3D 0; @@ -97,7 +97,7 @@ int phy_mipi_dphy_config_validate(struct phy_configure_op= ts_mipi_dphy *cfg) if (cfg->clk_post < (60000 + 52 * ui)) return -EINVAL; =20 - if (cfg->clk_pre < 8000) + if (cfg->clk_pre < 8) return -EINVAL; =20 if (cfg->clk_prepare < 38000 || cfg->clk_prepare > 95000) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c b/drivers/phy= /rockchip/phy-rockchip-inno-dsidphy.c index 347dc79a18c18..630e01b5c19b9 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-dsidphy.c @@ -5,6 +5,7 @@ * Author: Wyon Bi */ =20 +#include #include #include #include @@ -364,7 +365,7 @@ static void inno_dsidphy_mipi_mode_enable(struct inno_d= sidphy *inno) * The value of counter for HS Tclk-pre * Tclk-pre =3D Tpin_txbyteclkhs * value */ - clk_pre =3D DIV_ROUND_UP(cfg->clk_pre, t_txbyteclkhs); + clk_pre =3D DIV_ROUND_UP(cfg->clk_pre, BITS_PER_BYTE); =20 /* * The value of counter for HS Tlpx Time --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75C8EC433EF for ; Mon, 14 Feb 2022 10:34:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242276AbiBNKeF (ORCPT ); Mon, 14 Feb 2022 05:34:05 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347805AbiBNKcu (ORCPT ); Mon, 14 Feb 2022 05:32:50 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F2432BCD; Mon, 14 Feb 2022 02:00:27 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8BEAC60B3A; Mon, 14 Feb 2022 10:00:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 679EFC340EF; Mon, 14 Feb 2022 10:00:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832825; bh=Km2YhEkEz2xOCSXKSI50CX7nkOUZDmi2vmFH2ra+6Pw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QCKChNz5PL9AKqy9LmJ1I7sBZCrk9WmnOpRl7Rptm4b2Yrkki0T0t+2lG9REGcMdj SYGlVDBKEBXE++I5/HjPNC4VrBq4ig9aN0KteFIgfYJtUHamDE+ih0eylKLHiuUqcO EInpSyGxzwoWhJ8vHKwu4qMyZCJJFWdQF7MOLT7E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Mikko=20Salom=C3=A4ki?= , Geert Uytterhoeven , Andy Shevchenko , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 5.16 109/203] gpio: aggregator: Fix calling into sleeping GPIO controllers Date: Mon, 14 Feb 2022 10:25:53 +0100 Message-Id: <20220214092513.947410133@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Geert Uytterhoeven [ Upstream commit 2cba05451a6d0c703bb74f1a250691404f27c4f1 ] If the parent GPIO controller is a sleeping controller (e.g. a GPIO controller connected to I2C), getting or setting a GPIO triggers a might_sleep() warning. This happens because the GPIO Aggregator takes the can_sleep flag into account only for its internal locking, not for calling into the parent GPIO controller. Fix this by using the gpiod_[gs]et*_cansleep() APIs when calling into a sleeping GPIO controller. Reported-by: Mikko Salom=C3=A4ki Fixes: 828546e24280f721 ("gpio: Add GPIO Aggregator") Signed-off-by: Geert Uytterhoeven Reviewed-by: Andy Shevchenko Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/gpio/gpio-aggregator.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpio-aggregator.c b/drivers/gpio/gpio-aggregator.c index e9671d1660ef4..ac20f9bd1be61 100644 --- a/drivers/gpio/gpio-aggregator.c +++ b/drivers/gpio/gpio-aggregator.c @@ -278,7 +278,8 @@ static int gpio_fwd_get(struct gpio_chip *chip, unsigne= d int offset) { struct gpiochip_fwd *fwd =3D gpiochip_get_data(chip); =20 - return gpiod_get_value(fwd->descs[offset]); + return chip->can_sleep ? gpiod_get_value_cansleep(fwd->descs[offset]) + : gpiod_get_value(fwd->descs[offset]); } =20 static int gpio_fwd_get_multiple(struct gpiochip_fwd *fwd, unsigned long *= mask, @@ -293,7 +294,10 @@ static int gpio_fwd_get_multiple(struct gpiochip_fwd *= fwd, unsigned long *mask, for_each_set_bit(i, mask, fwd->chip.ngpio) descs[j++] =3D fwd->descs[i]; =20 - error =3D gpiod_get_array_value(j, descs, NULL, values); + if (fwd->chip.can_sleep) + error =3D gpiod_get_array_value_cansleep(j, descs, NULL, values); + else + error =3D gpiod_get_array_value(j, descs, NULL, values); if (error) return error; =20 @@ -328,7 +332,10 @@ static void gpio_fwd_set(struct gpio_chip *chip, unsig= ned int offset, int value) { struct gpiochip_fwd *fwd =3D gpiochip_get_data(chip); =20 - gpiod_set_value(fwd->descs[offset], value); + if (chip->can_sleep) + gpiod_set_value_cansleep(fwd->descs[offset], value); + else + gpiod_set_value(fwd->descs[offset], value); } =20 static void gpio_fwd_set_multiple(struct gpiochip_fwd *fwd, unsigned long = *mask, @@ -343,7 +350,10 @@ static void gpio_fwd_set_multiple(struct gpiochip_fwd = *fwd, unsigned long *mask, descs[j++] =3D fwd->descs[i]; } =20 - gpiod_set_array_value(j, descs, NULL, values); + if (fwd->chip.can_sleep) + gpiod_set_array_value_cansleep(j, descs, NULL, values); + else + gpiod_set_array_value(j, descs, NULL, values); } =20 static void gpio_fwd_set_multiple_locked(struct gpio_chip *chip, --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A736C433FE for ; Mon, 14 Feb 2022 10:36:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348202AbiBNKep (ORCPT ); Mon, 14 Feb 2022 05:34:45 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348172AbiBNKeA (ORCPT ); Mon, 14 Feb 2022 05:34:00 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57C9EA2F01; Mon, 14 Feb 2022 02:00:41 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CFAFF60A53; Mon, 14 Feb 2022 10:00:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2E41C340E9; Mon, 14 Feb 2022 10:00:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832840; bh=xXZmEyAX8sqclo30hcbh/KtpPKJbBa4Qr/6DXqtVy0c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dZHIi65BDR7ry8kLA27YeYcqEB2NVHb8T/HLEBQbDiL2kaML3Mcolpvgv4kgApe4Y V1ww/czNx7Szu4q2iF/38OsW/gjfCGHYjOEuuNMieHyNkeis1EeKRseXIRh90H4gNp wt3zxaq2vD4bwRjUVf07Nqsni8XpeIt6szy8y3HU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust , Anna Schumaker , Sasha Levin Subject: [PATCH 5.16 110/203] NFS: Dont overfill uncached readdir pages Date: Mon, 14 Feb 2022 10:25:54 +0100 Message-Id: <20220214092513.986287740@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: trondmy@kernel.org [ Upstream commit d9c4e39c1f8f8a8ebaccf00b8f22c14364b2d27e ] If we're doing an uncached read of the directory, then we ideally want to read only the exact set of entries that will fit in the buffer supplied by the getdents() system call. So unlike the case where we're reading into the page cache, let's send only one READDIR call, before trying to fill up the buffer. Fixes: 35df59d3ef69 ("NFS: Reduce number of RPC calls when doing uncached r= eaddir") Signed-off-by: Trond Myklebust Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- fs/nfs/dir.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index faf5168880223..13740f1e3972e 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -866,7 +866,8 @@ static int nfs_readdir_xdr_to_array(struct nfs_readdir_= descriptor *desc, =20 status =3D nfs_readdir_page_filler(desc, entry, pages, pglen, arrays, narrays); - } while (!status && nfs_readdir_page_needs_filling(page)); + } while (!status && nfs_readdir_page_needs_filling(page) && + page_mapping(page)); =20 nfs_readdir_free_pages(pages, array_size); out: --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13403C433EF for ; Mon, 14 Feb 2022 10:34:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348210AbiBNKe5 (ORCPT ); Mon, 14 Feb 2022 05:34:57 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244106AbiBNKeM (ORCPT ); Mon, 14 Feb 2022 05:34:12 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50B52A2F09; Mon, 14 Feb 2022 02:00:46 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E54A9B80DCF; Mon, 14 Feb 2022 10:00:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4AD3C340EF; Mon, 14 Feb 2022 10:00:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832843; bh=LUObdx/tC5/QG984k54QexGkrfBeyynXLCwdcNtP95k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YB3zImC4yHFtxtmaVShU/9uFhpg2q2V6qmtg7pDpT81zKZyfX0hG/x3LaHSFaqLF4 q4Orwx4HWDH8akYtjaFMGhlv9bV49I0LTurlR0wlGPtpGvSXs1ryVCUCrP1Pj6uV28 1YWuvJCROnbma3CQ3bEp9lWjXMRoMrdn5HXOSXL8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust , Anna Schumaker , Sasha Levin Subject: [PATCH 5.16 111/203] NFS: Dont skip directory entries when doing uncached readdir Date: Mon, 14 Feb 2022 10:25:55 +0100 Message-Id: <20220214092514.020217823@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: trondmy@kernel.org [ Upstream commit ce292d8faf41f62e0fb0c78476c6fce5d629235a ] Ensure that we initialise desc->cache_entry_index correctly in uncached_readdir(). Fixes: d1bacf9eb2fd ("NFS: add readdir cache array") Signed-off-by: Trond Myklebust Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- fs/nfs/dir.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 13740f1e3972e..63d7da0b7e32c 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -1041,6 +1041,7 @@ static int uncached_readdir(struct nfs_readdir_descri= ptor *desc) goto out; =20 desc->page_index =3D 0; + desc->cache_entry_index =3D 0; desc->last_cookie =3D desc->dir_cookie; desc->duped =3D 0; =20 --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C68CC433F5 for ; Mon, 14 Feb 2022 10:34:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347791AbiBNKey (ORCPT ); Mon, 14 Feb 2022 05:34:54 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348210AbiBNKeM (ORCPT ); Mon, 14 Feb 2022 05:34:12 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 851F1A2F0F; Mon, 14 Feb 2022 02:00:47 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1F65C6077B; Mon, 14 Feb 2022 10:00:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 05BD2C340E9; Mon, 14 Feb 2022 10:00:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832846; bh=V75dH+7dwU6ylnk88scfhrqdjFa2FeD4q0zh7cMdTnM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TqtgDlxl0qC1pxPwT43kRemQnlNCOQGYpk9Przfxc59dMUlDeZOON+tRvmCGh+kd7 XwgOyj5rQ2evEHEkGA/IkYgLjh4f9F0e0TpD5TJ1c6vfGgfOPiO3e7jfa9XdjYnu1j kCzvTeCpwH1f3iAu5zpY/z6VUybD1GH54eBvjeYo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust , Anna Schumaker , Sasha Levin Subject: [PATCH 5.16 112/203] NFS: Avoid duplicate uncached readdir calls on eof Date: Mon, 14 Feb 2022 10:25:56 +0100 Message-Id: <20220214092514.051680388@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit e1d2699b96793d19388e302fa095e0da2c145701 ] If we've reached the end of the directory, then cache that information in the context so that we don't need to do an uncached readdir in order to rediscover that fact. Fixes: 794092c57f89 ("NFS: Do uncached readdir when we're seeking a cookie = in an empty page cache") Signed-off-by: Trond Myklebust Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- fs/nfs/dir.c | 20 +++++++++++++++----- include/linux/nfs_fs.h | 1 + 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 63d7da0b7e32c..b2460a0504411 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -79,6 +79,7 @@ static struct nfs_open_dir_context *alloc_nfs_open_dir_co= ntext(struct inode *dir ctx->dir_cookie =3D 0; ctx->dup_cookie =3D 0; ctx->page_index =3D 0; + ctx->eof =3D false; spin_lock(&dir->i_lock); if (list_empty(&nfsi->open_files) && (nfsi->cache_validity & NFS_INO_DATA_INVAL_DEFER)) @@ -167,6 +168,7 @@ struct nfs_readdir_descriptor { unsigned int cache_entry_index; signed char duped; bool plus; + bool eob; bool eof; }; =20 @@ -988,7 +990,7 @@ static void nfs_do_filldir(struct nfs_readdir_descripto= r *desc, ent =3D &array->array[i]; if (!dir_emit(desc->ctx, ent->name, ent->name_len, nfs_compat_user_ino64(ent->ino), ent->d_type)) { - desc->eof =3D true; + desc->eob =3D true; break; } memcpy(desc->verf, verf, sizeof(desc->verf)); @@ -1004,7 +1006,7 @@ static void nfs_do_filldir(struct nfs_readdir_descrip= tor *desc, desc->duped =3D 1; } if (array->page_is_eof) - desc->eof =3D true; + desc->eof =3D !desc->eob; =20 kunmap(desc->page); dfprintk(DIRCACHE, "NFS: nfs_do_filldir() filling ended @ cookie %llu\n", @@ -1047,7 +1049,7 @@ static int uncached_readdir(struct nfs_readdir_descri= ptor *desc) =20 status =3D nfs_readdir_xdr_to_array(desc, desc->verf, verf, arrays, sz); =20 - for (i =3D 0; !desc->eof && i < sz && arrays[i]; i++) { + for (i =3D 0; !desc->eob && i < sz && arrays[i]; i++) { desc->page =3D arrays[i]; nfs_do_filldir(desc, verf); } @@ -1106,9 +1108,15 @@ static int nfs_readdir(struct file *file, struct dir= _context *ctx) desc->duped =3D dir_ctx->duped; page_index =3D dir_ctx->page_index; desc->attr_gencount =3D dir_ctx->attr_gencount; + desc->eof =3D dir_ctx->eof; memcpy(desc->verf, dir_ctx->verf, sizeof(desc->verf)); spin_unlock(&file->f_lock); =20 + if (desc->eof) { + res =3D 0; + goto out_free; + } + if (test_and_clear_bit(NFS_INO_FORCE_READDIR, &nfsi->flags) && list_is_singular(&nfsi->open_files)) invalidate_mapping_pages(inode->i_mapping, page_index + 1, -1); @@ -1142,7 +1150,7 @@ static int nfs_readdir(struct file *file, struct dir_= context *ctx) =20 nfs_do_filldir(desc, nfsi->cookieverf); nfs_readdir_page_unlock_and_put_cached(desc); - } while (!desc->eof); + } while (!desc->eob && !desc->eof); =20 spin_lock(&file->f_lock); dir_ctx->dir_cookie =3D desc->dir_cookie; @@ -1150,9 +1158,10 @@ static int nfs_readdir(struct file *file, struct dir= _context *ctx) dir_ctx->duped =3D desc->duped; dir_ctx->attr_gencount =3D desc->attr_gencount; dir_ctx->page_index =3D desc->page_index; + dir_ctx->eof =3D desc->eof; memcpy(dir_ctx->verf, desc->verf, sizeof(dir_ctx->verf)); spin_unlock(&file->f_lock); - +out_free: kfree(desc); =20 out: @@ -1194,6 +1203,7 @@ static loff_t nfs_llseek_dir(struct file *filp, loff_= t offset, int whence) if (offset =3D=3D 0) memset(dir_ctx->verf, 0, sizeof(dir_ctx->verf)); dir_ctx->duped =3D 0; + dir_ctx->eof =3D false; } spin_unlock(&filp->f_lock); return offset; diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h index f33559acbcc28..29a2ab5de1daa 100644 --- a/include/linux/nfs_fs.h +++ b/include/linux/nfs_fs.h @@ -105,6 +105,7 @@ struct nfs_open_dir_context { __u64 dup_cookie; pgoff_t page_index; signed char duped; + bool eof; }; =20 /* --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9ABFEC433EF for ; Mon, 14 Feb 2022 10:38:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348381AbiBNKiW (ORCPT ); Mon, 14 Feb 2022 05:38:22 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347716AbiBNKeY (ORCPT ); Mon, 14 Feb 2022 05:34:24 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 867A0A2F18; Mon, 14 Feb 2022 02:00:50 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 22FCD60C62; Mon, 14 Feb 2022 10:00:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE731C340E9; Mon, 14 Feb 2022 10:00:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832849; bh=qG8TxJIEufoTrtV8bFIDKUVwWO6LpLeVz8gYbFL9Sw4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JuhLnPxGi3lAvS2Q8MzXhPNea7moHse8J1nCGB5wOnhcTkWbXpXFOmUDLPb6QMzVV ALxNuke9Hl8uH3YdFfHBi0H92w/yk+GUTZd90tuvb6z1B8IZ/ynehA+qHcTkzddoy3 lj7A43tOW2dV+awi1FqC4vZOVTnczs+3xWMwzYUQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Stevenson , Maxime Ripard , Sasha Levin Subject: [PATCH 5.16 113/203] drm/vc4: hdmi: Allow DBLCLK modes even if horz timing is odd. Date: Mon, 14 Feb 2022 10:25:57 +0100 Message-Id: <20220214092514.092096297@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 1d118965965f89948236ebe23072bb1fca5e7832 ] The 2711 pixel valve can't produce odd horizontal timings, and checks were added to vc4_hdmi_encoder_atomic_check and vc4_hdmi_encoder_mode_valid to filter out/block selection of such modes. Modes with DRM_MODE_FLAG_DBLCLK double all the horizontal timing values before programming them into the PV. The PV values, therefore, can not be odd, and so the modes can be supported. Amend the filtering appropriately. Fixes: 57fb32e632be ("drm/vc4: hdmi: Block odd horizontal timings") Signed-off-by: Dave Stevenson Signed-off-by: Maxime Ripard Link: https://patchwork.freedesktop.org/patch/msgid/20220127135116.298278-1= -maxime@cerno.tech Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/gpu/drm/vc4/vc4_hdmi.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index c000946996edb..24f11c07bc3c7 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -1090,6 +1090,7 @@ static int vc4_hdmi_encoder_atomic_check(struct drm_e= ncoder *encoder, unsigned long long tmds_rate; =20 if (vc4_hdmi->variant->unsupported_odd_h_timings && + !(mode->flags & DRM_MODE_FLAG_DBLCLK) && ((mode->hdisplay % 2) || (mode->hsync_start % 2) || (mode->hsync_end % 2) || (mode->htotal % 2))) return -EINVAL; @@ -1137,6 +1138,7 @@ vc4_hdmi_encoder_mode_valid(struct drm_encoder *encod= er, struct vc4_hdmi *vc4_hdmi =3D encoder_to_vc4_hdmi(encoder); =20 if (vc4_hdmi->variant->unsupported_odd_h_timings && + !(mode->flags & DRM_MODE_FLAG_DBLCLK) && ((mode->hdisplay % 2) || (mode->hsync_start % 2) || (mode->hsync_end % 2) || (mode->htotal % 2))) return MODE_H_ILLEGAL; --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BD48C433EF for ; Mon, 14 Feb 2022 10:34:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348244AbiBNKfA (ORCPT ); Mon, 14 Feb 2022 05:35:00 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348221AbiBNKeY (ORCPT ); Mon, 14 Feb 2022 05:34:24 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2898C35; Mon, 14 Feb 2022 02:00:53 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 526CE60B31; Mon, 14 Feb 2022 10:00:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B9E4C340E9; Mon, 14 Feb 2022 10:00:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832852; bh=jfzU5AWgx9K/8cbFWPb2BdzFgFXH/WxAhtisdz6hsjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qUob6VHXs1PgOwrDOG9sNh2Jr7Ad7gwpUgtOK2ftA9+cjVjfoAvRJ7QCp+YvyiFF7 OQL554AJ5JhXxa9dHlQDG0N43QFGyCbrUsxPK3RqQ5FYPwbVEWWnVb2vWdnNtlLAfj 9I6mvW12mq/07YcdybLUOmKhtz9eWrxHtq0NgW3E= 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?= , Mathias Krause , Sasha Levin Subject: [PATCH 5.16 114/203] misc: fastrpc: avoid double fput() on failed usercopy Date: Mon, 14 Feb 2022 10:25:58 +0100 Message-Id: <20220214092514.126632526@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mathias Krause [ Upstream commit 46963e2e0629cb31c96b1d47ddd89dc3d8990b34 ] If the copy back to userland fails for the FASTRPC_IOCTL_ALLOC_DMA_BUFF ioctl(), we shouldn't assume that 'buf->dmabuf' is still valid. In fact, dma_buf_fd() called fd_install() before, i.e. "consumed" one reference, leaving us with none. Calling dma_buf_put() will therefore put a reference we no longer own, leading to a valid file descritor table entry for an already released 'file' object which is a straight use-after-free. Simply avoid calling dma_buf_put() and rely on the process exit code to do the necessary cleanup, if needed, i.e. if the file descriptor is still valid. Fixes: 6cffd79504ce ("misc: fastrpc: Add support for dmabuf exporter") Acked-by: Christian K=C3=B6nig Signed-off-by: Mathias Krause Link: https://lore.kernel.org/r/20220127130218.809261-1-minipli@grsecurity.= net Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/misc/fastrpc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 4ccbf43e6bfa9..aa1682b94a23b 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -1288,7 +1288,14 @@ static int fastrpc_dmabuf_alloc(struct fastrpc_user = *fl, char __user *argp) } =20 if (copy_to_user(argp, &bp, sizeof(bp))) { - dma_buf_put(buf->dmabuf); + /* + * The usercopy failed, but we can't do much about it, as + * dma_buf_fd() already called fd_install() and made the + * file descriptor accessible for the current process. It + * might already be closed and dmabuf no longer valid when + * we reach this point. Therefore "leak" the fd and rely on + * the process exit path to do any required cleanup. + */ return -EFAULT; } =20 --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FAE8C433FE for ; Mon, 14 Feb 2022 10:35:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237979AbiBNKf0 (ORCPT ); Mon, 14 Feb 2022 05:35:26 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347820AbiBNKeY (ORCPT ); Mon, 14 Feb 2022 05:34:24 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEEBAC58; Mon, 14 Feb 2022 02:00:56 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 588E460A53; Mon, 14 Feb 2022 10:00:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 344FBC340E9; Mon, 14 Feb 2022 10:00:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832855; bh=nyQhR6VxYrmQChXEtTWPCthKdRv7SdJZk83vIwv/vAc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZTcImUQ5JMbCuFePv+UhoAvQrLAfe92qh0lHFZ8Klzxf/nW2yurDVXTBMu2T0y3ts oIrmzd5DV533hFXHyuVSyfhaZPir3e/IfEVXjkfjgfwvdxTYoj+xz4L0SNUklW4LcV OYijzfnQ+MrUbyb4vrFIU/tPXpY31w0oN491aY9M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Steen Hegelund , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 115/203] net: sparx5: Fix get_stat64 crash in tcpdump Date: Mon, 14 Feb 2022 10:25:59 +0100 Message-Id: <20220214092514.165032345@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Steen Hegelund [ Upstream commit ed14fc7a79ab43e9f2cb1fa9c1733fdc133bba30 ] This problem was found with Sparx5 when the tcpdump tool requests the do_get_stats64 (sparx5_get_stats64) statistic. The portstats pointer was incorrectly incremented when fetching priority based statistics. Fixes: af4b11022e2d (net: sparx5: add ethtool configuration and statistics = support) Signed-off-by: Steen Hegelund Link: https://lore.kernel.org/r/20220203102900.528987-1-steen.hegelund@micr= ochip.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c b/drive= rs/net/ethernet/microchip/sparx5/sparx5_ethtool.c index 59783fc46a7b9..10b866e9f7266 100644 --- a/drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c +++ b/drivers/net/ethernet/microchip/sparx5/sparx5_ethtool.c @@ -1103,7 +1103,7 @@ void sparx5_get_stats64(struct net_device *ndev, stats->tx_carrier_errors =3D portstats[spx5_stats_tx_csense_cnt]; stats->tx_window_errors =3D portstats[spx5_stats_tx_late_coll_cnt]; stats->rx_dropped =3D portstats[spx5_stats_ana_ac_port_stat_lsb_cnt]; - for (idx =3D 0; idx < 2 * SPX5_PRIOS; ++idx, ++stats) + for (idx =3D 0; idx < 2 * SPX5_PRIOS; ++idx) stats->rx_dropped +=3D portstats[spx5_stats_green_p0_rx_port_drop + idx]; stats->tx_dropped =3D portstats[spx5_stats_tx_local_drop]; --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6799C433F5 for ; Mon, 14 Feb 2022 10:32:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347859AbiBNKc7 (ORCPT ); Mon, 14 Feb 2022 05:32:59 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:37492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348119AbiBNKar (ORCPT ); Mon, 14 Feb 2022 05:30:47 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9DE706A3A7; Mon, 14 Feb 2022 01:59:21 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CCB9860B33; Mon, 14 Feb 2022 09:59:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1914C340E9; Mon, 14 Feb 2022 09:59:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832760; bh=zxZs4NkyjrI2gPfX4TXx/y5il8D5vI+faSq/lO+mImo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XaxbBQzfDvb9b6Fdc3+3hj9lnTUdF1PD5DspaLeXVdHPNfEJyhELACeW6oZRQ3xn3 sOQWbirwhVkYy2N1dKeTIp9S4e30psL9DIZIsRHvBVSlvWvbMCMbYuAFJpAPM9rffZ ESa9buv2ABFjkagrv++yccpZU7VWl1fS6USuadnI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.16 116/203] netfilter: nft_payload: dont allow th access for fragments Date: Mon, 14 Feb 2022 10:26:00 +0100 Message-Id: <20220214092514.195957183@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 a9e8503def0fd4ed89ade1f61c315f904581d439 ] Loads relative to ->thoff naturally expect that this points to the transport header, but this is only true if pkt->fragoff =3D=3D 0. This has little effect for rulesets with connection tracking/nat because these enable ip defra. For other rulesets this prevents false matches. Fixes: 96518518cc41 ("netfilter: add nftables") Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- net/netfilter/nft_exthdr.c | 2 +- net/netfilter/nft_payload.c | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/net/netfilter/nft_exthdr.c b/net/netfilter/nft_exthdr.c index dbe1f2e7dd9ed..9e927ab4df151 100644 --- a/net/netfilter/nft_exthdr.c +++ b/net/netfilter/nft_exthdr.c @@ -167,7 +167,7 @@ nft_tcp_header_pointer(const struct nft_pktinfo *pkt, { struct tcphdr *tcph; =20 - if (pkt->tprot !=3D IPPROTO_TCP) + if (pkt->tprot !=3D IPPROTO_TCP || pkt->fragoff) return NULL; =20 tcph =3D skb_header_pointer(pkt->skb, nft_thoff(pkt), sizeof(*tcph), buff= er); diff --git a/net/netfilter/nft_payload.c b/net/netfilter/nft_payload.c index 58e96a0fe0b4c..a4fbce560bddb 100644 --- a/net/netfilter/nft_payload.c +++ b/net/netfilter/nft_payload.c @@ -83,7 +83,7 @@ static int __nft_payload_inner_offset(struct nft_pktinfo = *pkt) { unsigned int thoff =3D nft_thoff(pkt); =20 - if (!(pkt->flags & NFT_PKTINFO_L4PROTO)) + if (!(pkt->flags & NFT_PKTINFO_L4PROTO) || pkt->fragoff) return -1; =20 switch (pkt->tprot) { @@ -147,7 +147,7 @@ void nft_payload_eval(const struct nft_expr *expr, offset =3D skb_network_offset(skb); break; case NFT_PAYLOAD_TRANSPORT_HEADER: - if (!(pkt->flags & NFT_PKTINFO_L4PROTO)) + if (!(pkt->flags & NFT_PKTINFO_L4PROTO) || pkt->fragoff) goto err; offset =3D nft_thoff(pkt); break; @@ -657,7 +657,7 @@ static void nft_payload_set_eval(const struct nft_expr = *expr, offset =3D skb_network_offset(skb); break; case NFT_PAYLOAD_TRANSPORT_HEADER: - if (!(pkt->flags & NFT_PKTINFO_L4PROTO)) + if (!(pkt->flags & NFT_PKTINFO_L4PROTO) || pkt->fragoff) goto err; offset =3D nft_thoff(pkt); break; @@ -696,7 +696,8 @@ static void nft_payload_set_eval(const struct nft_expr = *expr, if (priv->csum_type =3D=3D NFT_PAYLOAD_CSUM_SCTP && pkt->tprot =3D=3D IPPROTO_SCTP && skb->ip_summed !=3D CHECKSUM_PARTIAL) { - if (nft_payload_csum_sctp(skb, nft_thoff(pkt))) + if (pkt->fragoff =3D=3D 0 && + nft_payload_csum_sctp(skb, nft_thoff(pkt))) goto err; } =20 --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0B4D4C433EF for ; Mon, 14 Feb 2022 10:31:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347855AbiBNKbt (ORCPT ); Mon, 14 Feb 2022 05:31:49 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348307AbiBNKav (ORCPT ); Mon, 14 Feb 2022 05:30:51 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95CDC6A3AD; Mon, 14 Feb 2022 01:59:27 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 85162B80DC4; Mon, 14 Feb 2022 09:59:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4916C340E9; Mon, 14 Feb 2022 09:59:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832763; bh=8qqjLMYSvueRz7AGEphev8UfHG+Nq3FEAtl2P0/Vr4g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uSkfMK0LYLskW+DOkyn8TKLQUkhTMv1vZbMvuW6VIhlQ8mVflg1HgZWIHmdtBkh13 oGzCoTF/dMxp06I+IYPtIE6sFnjmLRVl35PU8qE885ezXMwr2U/CbPbG+XkcB0PNdl ytSpr0qhc/fs7jcbfGFyGuwt3zao3J7LTGq9oMSc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pham Thanh Tuyen , Florian Westphal , Pablo Neira Ayuso , Sasha Levin Subject: [PATCH 5.16 117/203] netfilter: ctnetlink: disable helper autoassign Date: Mon, 14 Feb 2022 10:26:01 +0100 Message-Id: <20220214092514.230071345@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 d1ca60efc53d665cf89ed847a14a510a81770b81 ] When userspace, e.g. conntrackd, inserts an entry with a specified helper, its possible that the helper is lost immediately after its added: ctnetlink_create_conntrack -> nf_ct_helper_ext_add + assign helper -> ctnetlink_setup_nat -> ctnetlink_parse_nat_setup -> parse_nat_setup -> nfnetlink_parse_nat_setup -> nf_nat_setup_info -> nf_conntrack_alter_reply -> __nf_ct_try_assign_helper ... and __nf_ct_try_assign_helper will zero the helper again. Set IPS_HELPER bit to bypass auto-assign logic, its unwanted, just like when helper is assigned via ruleset. Dropped old 'not strictly necessary' comment, it referred to use of rcu_assign_pointer() before it got replaced by RCU_INIT_POINTER(). NB: Fixes tag intentionally incorrect, this extends the referenced commit, but this change won't build without IPS_HELPER introduced there. Fixes: 6714cf5465d280 ("netfilter: nf_conntrack: fix explicit helper attach= ment and NAT") Reported-by: Pham Thanh Tuyen Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- include/uapi/linux/netfilter/nf_conntrack_common.h | 2 +- net/netfilter/nf_conntrack_netlink.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/uapi/linux/netfilter/nf_conntrack_common.h b/include/u= api/linux/netfilter/nf_conntrack_common.h index 4b3395082d15c..26071021e986f 100644 --- a/include/uapi/linux/netfilter/nf_conntrack_common.h +++ b/include/uapi/linux/netfilter/nf_conntrack_common.h @@ -106,7 +106,7 @@ enum ip_conntrack_status { IPS_NAT_CLASH =3D IPS_UNTRACKED, #endif =20 - /* Conntrack got a helper explicitly attached via CT target. */ + /* Conntrack got a helper explicitly attached (ruleset, ctnetlink). */ IPS_HELPER_BIT =3D 13, IPS_HELPER =3D (1 << IPS_HELPER_BIT), =20 diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntr= ack_netlink.c index ec4164c32d270..2d7f63ad33604 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c @@ -2311,7 +2311,8 @@ ctnetlink_create_conntrack(struct net *net, if (helper->from_nlattr) helper->from_nlattr(helpinfo, ct); =20 - /* not in hash table yet so not strictly necessary */ + /* disable helper auto-assignment for this entry */ + ct->status |=3D IPS_HELPER; RCU_INIT_POINTER(help->helper, helper); } } else { --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08EF0C433EF for ; Mon, 14 Feb 2022 10:31:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347787AbiBNKcA (ORCPT ); Mon, 14 Feb 2022 05:32:00 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:37452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348306AbiBNKav (ORCPT ); Mon, 14 Feb 2022 05:30:51 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95FD39BF7E; Mon, 14 Feb 2022 01:59:27 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D6B8760B34; Mon, 14 Feb 2022 09:59:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6881C340E9; Mon, 14 Feb 2022 09:59:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832766; bh=VPRDR3PYXiPBeYJvCUZ/lY1OC90TasViMFD935EnErY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rYjLFcPbtY8pi16o5b9mYwii4lED/Lis1f3N7oGszGvVfOUy7zB5mZ1Fx2z1td5uG 1Qwhz2E/WM+cRTzXdYQeAw+RupetgFmWljavi2r7wT/uROQHb36UWvHd6esyhc3mE2 zrrrz9gV9MPzoZaAhL1I6dJ/8CzoLQkEu7vKm96k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dongjin Kim , Neil Armstrong , Sasha Levin Subject: [PATCH 5.16 118/203] arm64: dts: meson-g12b-odroid-n2: fix typo dio2133 Date: Mon, 14 Feb 2022 10:26:02 +0100 Message-Id: <20220214092514.263808238@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dongjin Kim [ Upstream commit bc41099f060ea74ac8d02c51bd0f5f46d969bedf ] Typo in audio amplifier node, dioo2133 -> dio2133 Signed-off-by: Dongjin Kim Fixes: ef599f5f3e10 ("arm64: dts: meson: convert ODROID-N2 to dtsi") Fixes: 67d141c1f8e6 ("arm64: dts: meson: odroid-n2: add jack audio output s= upport") Reviewed-by: Neil Armstrong Signed-off-by: Neil Armstrong Link: https://lore.kernel.org/r/YfKQJejh0bfGYvof@anyang Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi b/arch/a= rm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi index 3e968b2441918..fd3fa82e4c330 100644 --- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi @@ -17,7 +17,7 @@ aliases { rtc1 =3D &vrtc; }; =20 - dioo2133: audio-amplifier-0 { + dio2133: audio-amplifier-0 { compatible =3D "simple-audio-amplifier"; enable-gpios =3D <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>; VCC-supply =3D <&vcc_5v>; @@ -219,7 +219,7 @@ sound { audio-widgets =3D "Line", "Lineout"; audio-aux-devs =3D <&tdmout_b>, <&tdmout_c>, <&tdmin_a>, <&tdmin_b>, <&tdmin_c>, <&tdmin_lb>, - <&dioo2133>; + <&dio2133>; audio-routing =3D "TDMOUT_B IN 0", "FRDDR_A OUT 1", "TDMOUT_B IN 1", "FRDDR_B OUT 1", "TDMOUT_B IN 2", "FRDDR_C OUT 1", --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BC2AC43217 for ; Mon, 14 Feb 2022 10:32:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347501AbiBNKcY (ORCPT ); Mon, 14 Feb 2022 05:32:24 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:37286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348745AbiBNKbE (ORCPT ); Mon, 14 Feb 2022 05:31:04 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A831710DF; Mon, 14 Feb 2022 01:59:47 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E6BBA60B3F; Mon, 14 Feb 2022 09:59:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C7D4EC340E9; Mon, 14 Feb 2022 09:59:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832769; bh=T7YDZ7jqaN12u6DNHfqzCT1Ns3t7VXGIw+QDvT0i+QA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x/SJH/UtaVLLnijp7GgzifHWH4qzML9qYH9TZqKg9m8p6aS9mRzOP6S2eBkZP/WoM oIOqkM8FzEvKxIvuyt6gL7hKjiW4pZxK44ghVMNN///hcfFKhc/7BeyBMKgVEg1vyk 7CHw1tq4kQJ4x5+yT8T57fyhkNf5E8y2TYE6q6i8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lutz Koschorreck , Neil Armstrong , Sasha Levin Subject: [PATCH 5.16 119/203] arm64: dts: meson-sm1-odroid: use correct enable-gpio pin for tf-io regulator Date: Mon, 14 Feb 2022 10:26:03 +0100 Message-Id: <20220214092514.295382934@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lutz Koschorreck [ Upstream commit 323ca765bfe9d637fa774373baec0bc41e51fcfa ] The interrupt pin of the external ethernet phy is used, instead of the enable-gpio pin of the tf-io regulator. The GPIOE_2 pin is located in the gpio_ao bank. This causes phy interrupt problems at system startup. [ 76.645190] irq 36: nobody cared (try booting with the "irqpoll" option) [ 76.649617] CPU: 0 PID: 1416 Comm: irq/36-0.0:00 Not tainted 5.16.0 #2 [ 76.649629] Hardware name: Hardkernel ODROID-HC4 (DT) [ 76.649635] Call trace: [ 76.649638] dump_backtrace+0x0/0x1c8 [ 76.649658] show_stack+0x14/0x60 [ 76.649667] dump_stack_lvl+0x64/0x7c [ 76.649676] dump_stack+0x14/0x2c [ 76.649683] __report_bad_irq+0x38/0xe8 [ 76.649695] note_interrupt+0x220/0x3a0 [ 76.649704] handle_irq_event_percpu+0x58/0x88 [ 76.649713] handle_irq_event+0x44/0xd8 [ 76.649721] handle_fasteoi_irq+0xa8/0x130 [ 76.649730] generic_handle_domain_irq+0x38/0x58 [ 76.649738] gic_handle_irq+0x9c/0xb8 [ 76.649747] call_on_irq_stack+0x28/0x38 [ 76.649755] do_interrupt_handler+0x7c/0x80 [ 76.649763] el1_interrupt+0x34/0x80 [ 76.649772] el1h_64_irq_handler+0x14/0x20 [ 76.649781] el1h_64_irq+0x74/0x78 [ 76.649788] irq_finalize_oneshot.part.56+0x68/0xf8 [ 76.649796] irq_thread_fn+0x5c/0x98 [ 76.649804] irq_thread+0x13c/0x260 [ 76.649812] kthread+0x144/0x178 [ 76.649822] ret_from_fork+0x10/0x20 [ 76.649830] handlers: [ 76.653170] [<0000000025a6cd31>] irq_default_primary_handler threaded [<= 0000000093580eb7>] phy_interrupt [ 76.661256] Disabling IRQ #36 Fixes: 1f80a5cf74a6 ("arm64: dts: meson-sm1-odroid: add missing enable gpio= and supply for tf_io regulator") Signed-off-by: Lutz Koschorreck Reviewed-by: Neil Armstrong Signed-off-by: Neil Armstrong [narmstrong: removed spurious invalid & blank lines from commit message] Link: https://lore.kernel.org/r/20220127130537.GA187347@odroid-VirtualBox Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/arm64/boot/dts/amlogic/meson-sm1-odroid.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid.dtsi b/arch/arm64= /boot/dts/amlogic/meson-sm1-odroid.dtsi index 5779e70caccd3..328f4adfaaa9d 100644 --- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid.dtsi @@ -48,7 +48,7 @@ tf_io: gpio-regulator-tf_io { regulator-max-microvolt =3D <3300000>; vin-supply =3D <&vcc_5v>; =20 - enable-gpio =3D <&gpio GPIOE_2 GPIO_ACTIVE_HIGH>; + enable-gpio =3D <&gpio_ao GPIOE_2 GPIO_ACTIVE_HIGH>; enable-active-high; regulator-always-on; =20 --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90B72C433F5 for ; Mon, 14 Feb 2022 10:32:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236816AbiBNKcI (ORCPT ); Mon, 14 Feb 2022 05:32:08 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:40220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348522AbiBNKay (ORCPT ); Mon, 14 Feb 2022 05:30:54 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 445D570F52; Mon, 14 Feb 2022 01:59:35 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 11AB0B80DC8; Mon, 14 Feb 2022 09:59:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30B28C36AE2; Mon, 14 Feb 2022 09:59:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832772; bh=DQmVaWFWH8iNG0jAB/LpA73J9Sxm1UdRB+c0DUjvBTU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jzJLDPNQT/yjMX4cNwnJFwSP54w/0XSOehGF173nwiKgXa2ZPMt1GaCfYL6zxN/K6 iiVomLLqEdgBtnUOTAji0cNRpDDKOksDiG3uuQnNxaRSm0JJgwMu0zAIIwOJKRqAN3 shKMkieGylZVI3bOUhJQgxI7QlrQsslMvgXsE49Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dongjin Kim , Neil Armstrong , Sasha Levin Subject: [PATCH 5.16 120/203] arm64: dts: meson-sm1-bananapi-m5: fix wrong GPIO domain for GPIOE_2 Date: Mon, 14 Feb 2022 10:26:04 +0100 Message-Id: <20220214092514.326510970@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dongjin Kim [ Upstream commit a5be3e5d46f373fe1d2ee835c7ede31769c241cd ] GPIOE_2 is in AO domain and "<&gpio GPIOE_2 ...>" changes the state of TF_PWR_EN of 'FC8731' on BPI-M5 Fixes: 976e920183e4 ("arm64: dts: meson-sm1: add Banana PI BPI-M5 board dts= ") Signed-off-by: Dongjin Kim Reviewed-by: Neil Armstrong Signed-off-by: Neil Armstrong Link: https://lore.kernel.org/r/20220127151656.GA2419733@paju Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/arm64/boot/dts/amlogic/meson-sm1-bananapi-m5.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-bananapi-m5.dts b/arch/a= rm64/boot/dts/amlogic/meson-sm1-bananapi-m5.dts index 212c6aa5a3b86..5751c48620edf 100644 --- a/arch/arm64/boot/dts/amlogic/meson-sm1-bananapi-m5.dts +++ b/arch/arm64/boot/dts/amlogic/meson-sm1-bananapi-m5.dts @@ -123,7 +123,7 @@ vddio_c: regulator-vddio_c { regulator-min-microvolt =3D <1800000>; regulator-max-microvolt =3D <3300000>; =20 - enable-gpio =3D <&gpio GPIOE_2 GPIO_ACTIVE_HIGH>; + enable-gpio =3D <&gpio_ao GPIOE_2 GPIO_ACTIVE_HIGH>; enable-active-high; regulator-always-on; =20 --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5F84FC433F5 for ; Mon, 14 Feb 2022 10:32:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347419AbiBNKc3 (ORCPT ); Mon, 14 Feb 2022 05:32:29 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:37398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348803AbiBNKbJ (ORCPT ); Mon, 14 Feb 2022 05:31:09 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E475710F9; Mon, 14 Feb 2022 01:59:51 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6614460909; Mon, 14 Feb 2022 09:59:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 428A0C340EF; Mon, 14 Feb 2022 09:59:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832775; bh=7NkI57KdUooHsPfFBLSmpYBzUAiODq7o7Qw/s+3mQ6Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JYIIkCy8Yx4AlXEu2nlT/IOzRHIqHMf0X+GxdA2pX0dVywrCQ3npIUxyOuLkwwoy0 isYFLrijA7Pas3fkZmD40MOdow4Et/ntCI8t7xs8JXJP6+igw2Y0xtw9WXRc7fqFsa NdGxCqbOynBH6H1fEpkwyscpf5rm3jPQhFcw6Zz4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lutz Koschorreck , Neil Armstrong , Sasha Levin Subject: [PATCH 5.16 121/203] arm64: dts: meson-sm1-odroid: fix boot loop after reboot Date: Mon, 14 Feb 2022 10:26:05 +0100 Message-Id: <20220214092514.357514828@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Lutz Koschorreck [ Upstream commit e6b03375132fefddc55cf700418cf794b3884e0c ] Since the correct gpio pin is used for enabling tf-io regulator the system did not boot correctly after calling reboot. [ 36.862443] reboot: Restarting system bl31 reboot reason: 0xd bl31 reboot reason: 0x0 system cmd 1. SM1:BL:511f6b:81ca2f;FEAT:A0F83180:20282000;POC:B;RCY:0;SPINOR:0;CHK:1F;EMM= C:800;NAND:81;SD?:0;SD:0;READ:0;0.0;CHK:0; bl2_stage_init 0x01 bl2_stage_init 0x81 hw id: SM1:BL:511f6b:81ca2f;FEAT:A0F83180:20282000;POC:B;RCY:0;SPINOR:0;CHK:1F;EMM= C:800;NAND:81;SD?:0;SD:400;USB:8;LOOP:1;... Setting the gpio to open drain solves the issue. Fixes: 1f80a5cf74a6 ("arm64: dts: meson-sm1-odroid: add missing enable gpio= and supply for tf_io regulator") Signed-off-by: Lutz Koschorreck Reviewed-by: Neil Armstrong [narmstrong: reduced serial log & removed invalid character in commit messa= ge] Signed-off-by: Neil Armstrong Link: https://lore.kernel.org/r/20220128193150.GA1304381@odroid-VirtualBox Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/arm64/boot/dts/amlogic/meson-sm1-odroid.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid.dtsi b/arch/arm64= /boot/dts/amlogic/meson-sm1-odroid.dtsi index 328f4adfaaa9d..76ad052fbf0c9 100644 --- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid.dtsi +++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid.dtsi @@ -48,7 +48,7 @@ tf_io: gpio-regulator-tf_io { regulator-max-microvolt =3D <3300000>; vin-supply =3D <&vcc_5v>; =20 - enable-gpio =3D <&gpio_ao GPIOE_2 GPIO_ACTIVE_HIGH>; + enable-gpio =3D <&gpio_ao GPIOE_2 GPIO_OPEN_DRAIN>; enable-active-high; regulator-always-on; =20 --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80A1BC433EF for ; Mon, 14 Feb 2022 10:32:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347327AbiBNKcU (ORCPT ); Mon, 14 Feb 2022 05:32:20 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348669AbiBNKbC (ORCPT ); Mon, 14 Feb 2022 05:31:02 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F8EB70F76; Mon, 14 Feb 2022 01:59:41 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 444BAB80DD4; Mon, 14 Feb 2022 09:59:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5334BC340E9; Mon, 14 Feb 2022 09:59:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832778; bh=I4QXmqh+Mf6c4C7XzH8zPRLFvteBSrDCrhY0hIQnFjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IsEX/9xxYso7lw/fjbuWV6TKXnSUB2AKDGg9E5MMIFr7uNOLhl56t9O1f+Dro/ITm 6MedhQwMBp31tNXMyBdHCJ1dJfjsc4OT0GjdOsYi/HLxvRhsY5mJp4VW3Zjvh0zkQJ 6nNo6DDuDzW6gpA76qxQd0UOiHqhmeq6yuJrjumY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Samuel Mendoza-Jonas , Konrad Jankowski , Tony Nguyen , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 122/203] ixgbevf: Require large buffers for build_skb on 82599VF Date: Mon, 14 Feb 2022 10:26:06 +0100 Message-Id: <20220214092514.388675655@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Mendoza-Jonas [ Upstream commit fe68195daf34d5dddacd3f93dd3eafc4beca3a0e ] >From 4.17 onwards the ixgbevf driver uses build_skb() to build an skb around new data in the page buffer shared with the ixgbe PF. This uses either a 2K or 3K buffer, and offsets the DMA mapping by NET_SKB_PAD + NET_IP_ALIGN. When using a smaller buffer RXDCTL is set to ensure the PF does not write a full 2K bytes into the buffer, which is actually 2K minus the offset. However on the 82599 virtual function, the RXDCTL mechanism is not available. The driver attempts to work around this by using the SET_LPE mailbox method to lower the maximm frame size, but the ixgbe PF driver ignores this in order to keep the PF and all VFs in sync[0]. This means the PF will write up to the full 2K set in SRRCTL, causing it to write NET_SKB_PAD + NET_IP_ALIGN bytes past the end of the buffer. With 4K pages split into two buffers, this means it either writes NET_SKB_PAD + NET_IP_ALIGN bytes past the first buffer (and into the second), or NET_SKB_PAD + NET_IP_ALIGN bytes past the end of the DMA mapping. Avoid this by only enabling build_skb when using "large" buffers (3K). These are placed in each half of an order-1 page, preventing the PF from writing past the end of the mapping. [0]: Technically it only ever raises the max frame size, see ixgbe_set_vf_lpe() in ixgbe_sriov.c Fixes: f15c5ba5b6cd ("ixgbevf: add support for using order 1 pages to recei= ve large frames") Signed-off-by: Samuel Mendoza-Jonas Tested-by: Konrad Jankowski Signed-off-by: Tony Nguyen Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/ne= t/ethernet/intel/ixgbevf/ixgbevf_main.c index d81811ab4ec48..c2f87a2d0ef46 100644 --- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c +++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c @@ -1984,14 +1984,15 @@ static void ixgbevf_set_rx_buffer_len(struct ixgbev= f_adapter *adapter, if (adapter->flags & IXGBEVF_FLAGS_LEGACY_RX) return; =20 - set_ring_build_skb_enabled(rx_ring); + if (PAGE_SIZE < 8192) + if (max_frame > IXGBEVF_MAX_FRAME_BUILD_SKB) + set_ring_uses_large_buffer(rx_ring); =20 - if (PAGE_SIZE < 8192) { - if (max_frame <=3D IXGBEVF_MAX_FRAME_BUILD_SKB) - return; + /* 82599 can't rely on RXDCTL.RLPML to restrict the size of the frame */ + if (adapter->hw.mac.type =3D=3D ixgbe_mac_82599_vf && !ring_uses_large_bu= ffer(rx_ring)) + return; =20 - set_ring_uses_large_buffer(rx_ring); - } + set_ring_build_skb_enabled(rx_ring); } =20 /** --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 096ACC433EF for ; Mon, 14 Feb 2022 10:32:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241939AbiBNKcd (ORCPT ); Mon, 14 Feb 2022 05:32:33 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348906AbiBNKbL (ORCPT ); Mon, 14 Feb 2022 05:31:11 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3B1D9DD54; Mon, 14 Feb 2022 01:59:53 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 32FC4B80DCE; Mon, 14 Feb 2022 09:59:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6714AC340E9; Mon, 14 Feb 2022 09:59:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832782; bh=kBKRvywjjqjNpuL5Kwxupm6Ld+fvT0fycBmoWsPxpms=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f1NeO0WwjnmdrcLIglKw4oP43gB1tUvkNyVXHvyJqiD+ct+nMOw5avyocmLrL8fZC L60jcwd+3pu35cjICBqLPikFjo4mQAz0L5p7T3yz3+XHvYtxXg32EGbUuFiXLmkvDh +ewEPdyjzBtt3GJGctTJA6TpsQQgaXdiZKIgEk+M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , syzbot , Talal Ahmad , Arjun Roy , Willem de Bruijn , Soheil Hassas Yeganeh , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 123/203] tcp: take care of mixed splice()/sendmsg(MSG_ZEROCOPY) case Date: Mon, 14 Feb 2022 10:26:07 +0100 Message-Id: <20220214092514.420537078@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 f8d9d938514f46c4892aff6bfe32f425e84d81cc ] syzbot found that mixing sendpage() and sendmsg(MSG_ZEROCOPY) calls over the same TCP socket would again trigger the infamous warning in inet_sock_destruct() WARN_ON(sk_forward_alloc_get(sk)); While Talal took into account a mix of regular copied data and MSG_ZEROCOPY one in the same skb, the sendpage() path has been forgotten. We want the charging to happen for sendpage(), because pages could be coming from a pipe. What is missing is the downgrading of pure zerocopy status to make sure sk_forward_alloc will stay synced. Add tcp_downgrade_zcopy_pure() helper so that we can use it from the two callers. Fixes: 9b65b17db723 ("net: avoid double accounting for pure zerocopy skbs") Signed-off-by: Eric Dumazet Reported-by: syzbot Cc: Talal Ahmad Cc: Arjun Roy Cc: Willem de Bruijn Acked-by: Soheil Hassas Yeganeh Link: https://lore.kernel.org/r/20220203225547.665114-1-eric.dumazet@gmail.= com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- net/ipv4/tcp.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 94cbba9fb12b1..28abb0bb1c515 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c @@ -936,6 +936,22 @@ void tcp_remove_empty_skb(struct sock *sk) } } =20 +/* skb changing from pure zc to mixed, must charge zc */ +static int tcp_downgrade_zcopy_pure(struct sock *sk, struct sk_buff *skb) +{ + if (unlikely(skb_zcopy_pure(skb))) { + u32 extra =3D skb->truesize - + SKB_TRUESIZE(skb_end_offset(skb)); + + if (!sk_wmem_schedule(sk, extra)) + return -ENOMEM; + + sk_mem_charge(sk, extra); + skb_shinfo(skb)->flags &=3D ~SKBFL_PURE_ZEROCOPY; + } + return 0; +} + static struct sk_buff *tcp_build_frag(struct sock *sk, int size_goal, int = flags, struct page *page, int offset, size_t *size) { @@ -971,7 +987,7 @@ static struct sk_buff *tcp_build_frag(struct sock *sk, = int size_goal, int flags, tcp_mark_push(tp, skb); goto new_segment; } - if (!sk_wmem_schedule(sk, copy)) + if (tcp_downgrade_zcopy_pure(sk, skb) || !sk_wmem_schedule(sk, copy)) return NULL; =20 if (can_coalesce) { @@ -1319,19 +1335,8 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghd= r *msg, size_t size) =20 copy =3D min_t(int, copy, pfrag->size - pfrag->offset); =20 - /* skb changing from pure zc to mixed, must charge zc */ - if (unlikely(skb_zcopy_pure(skb))) { - u32 extra =3D skb->truesize - - SKB_TRUESIZE(skb_end_offset(skb)); - - if (!sk_wmem_schedule(sk, extra)) - goto wait_for_space; - - sk_mem_charge(sk, extra); - skb_shinfo(skb)->flags &=3D ~SKBFL_PURE_ZEROCOPY; - } - - if (!sk_wmem_schedule(sk, copy)) + if (tcp_downgrade_zcopy_pure(sk, skb) || + !sk_wmem_schedule(sk, copy)) goto wait_for_space; =20 err =3D skb_copy_to_page_nocache(sk, &msg->msg_iter, skb, --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5D9CC433EF for ; Mon, 14 Feb 2022 10:32:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347315AbiBNKck (ORCPT ); Mon, 14 Feb 2022 05:32:40 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348928AbiBNKbM (ORCPT ); Mon, 14 Feb 2022 05:31:12 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDFF5216; Mon, 14 Feb 2022 01:59:54 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 24A4A60921; Mon, 14 Feb 2022 09:59:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A553C340E9; Mon, 14 Feb 2022 09:59:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832785; bh=aJUAwIrosiZGWRzf6yXVGdTcM6ZHiOGnt5DM2fqHz2U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ViRjUuN76qrmULet0l4daaRHMQwdGzppKLxJ8rGOxt6hJLs3HM6hKZN2BusPCxO6t lcdHb1NCcwiLl5nm/2VJx8R7ecfywjtGv+kzIBDs4jZyDuWaW3Xq4RBIXx/Zq/0+fu uk7nfWXBV1MzU32NGsZ2q4CccECv8hVZU/euvDD0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 124/203] net: mscc: ocelot: fix all IP traffic getting trapped to CPU with PTP over IP Date: Mon, 14 Feb 2022 10:26:08 +0100 Message-Id: <20220214092514.451740366@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean [ Upstream commit 59085208e4a2183998964844f8684fea0378128d ] The filters for the PTP trap keys are incorrectly configured, in the sense that is2_entry_set() only looks at trap->key.ipv4.dport or trap->key.ipv6.dport if trap->key.ipv4.proto or trap->key.ipv6.proto is set to IPPROTO_TCP or IPPROTO_UDP. But we don't do that, so is2_entry_set() goes through the "else" branch of the IP protocol check, and ends up installing a rule for "Any IP protocol match" (because msk is also 0). The UDP port is ignored. This means that when we run "ptp4l -i swp0 -4", all IP traffic is trapped to the CPU, which hinders bridging. Fix this by specifying the IP protocol in the VCAP IS2 filters for PTP over UDP. Fixes: 96ca08c05838 ("net: mscc: ocelot: set up traps for PTP packets") Signed-off-by: Vladimir Oltean Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/net/ethernet/mscc/ocelot.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc= /ocelot.c index 294bb4eb3833f..ac5849436d021 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -1292,6 +1292,8 @@ static void ocelot_populate_ipv4_ptp_event_trap_key(struct ocelot_vcap_filter *trap) { trap->key_type =3D OCELOT_VCAP_KEY_IPV4; + trap->key.ipv4.proto.value[0] =3D IPPROTO_UDP; + trap->key.ipv4.proto.mask[0] =3D 0xff; trap->key.ipv4.dport.value =3D PTP_EV_PORT; trap->key.ipv4.dport.mask =3D 0xffff; } @@ -1300,6 +1302,8 @@ static void ocelot_populate_ipv6_ptp_event_trap_key(struct ocelot_vcap_filter *trap) { trap->key_type =3D OCELOT_VCAP_KEY_IPV6; + trap->key.ipv4.proto.value[0] =3D IPPROTO_UDP; + trap->key.ipv4.proto.mask[0] =3D 0xff; trap->key.ipv6.dport.value =3D PTP_EV_PORT; trap->key.ipv6.dport.mask =3D 0xffff; } @@ -1308,6 +1312,8 @@ static void ocelot_populate_ipv4_ptp_general_trap_key(struct ocelot_vcap_filter *trap) { trap->key_type =3D OCELOT_VCAP_KEY_IPV4; + trap->key.ipv4.proto.value[0] =3D IPPROTO_UDP; + trap->key.ipv4.proto.mask[0] =3D 0xff; trap->key.ipv4.dport.value =3D PTP_GEN_PORT; trap->key.ipv4.dport.mask =3D 0xffff; } @@ -1316,6 +1322,8 @@ static void ocelot_populate_ipv6_ptp_general_trap_key(struct ocelot_vcap_filter *trap) { trap->key_type =3D OCELOT_VCAP_KEY_IPV6; + trap->key.ipv4.proto.value[0] =3D IPPROTO_UDP; + trap->key.ipv4.proto.mask[0] =3D 0xff; trap->key.ipv6.dport.value =3D PTP_GEN_PORT; trap->key.ipv6.dport.mask =3D 0xffff; } --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E920C433F5 for ; Mon, 14 Feb 2022 10:33:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347972AbiBNKds (ORCPT ); Mon, 14 Feb 2022 05:33:48 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348968AbiBNKbN (ORCPT ); Mon, 14 Feb 2022 05:31:13 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AB309DD75; Mon, 14 Feb 2022 01:59:59 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4C77960B31; Mon, 14 Feb 2022 09:59:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24A1CC340E9; Mon, 14 Feb 2022 09:59:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832788; bh=+3V7kLPNkHtBcTLCEvk6zqPxgRYdatEipC65smgMYe0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nOxpilClTw/DyWOTn4Tcyohvwy61m0+unemrcM3byACA2WNpANn0Ubul80HemS/De QQHJJMANKsN1S9rWsZQ1XDvKzY9UG7ksy+WvnnNXqErJglNVYHAQj3ICFtH+DQcduy Xn7Cbp3n2gCV+xJLx3vnw4ClGrbUdPRKjLaH7GiQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Niedermaier , Marek Vasut , Thierry Reding , Sam Ravnborg , David Airlie , Daniel Vetter , Sasha Levin Subject: [PATCH 5.16 125/203] drm/panel: simple: Assign data from panel_dpi_probe() correctly Date: Mon, 14 Feb 2022 10:26:09 +0100 Message-Id: <20220214092514.490834060@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Niedermaier [ Upstream commit 6df4432a5eca101b5fd80fbee41d309f3d67928d ] In the function panel_simple_probe() the pointer panel->desc is assigned to the passed pointer desc. If function panel_dpi_probe() is called panel->desc will be updated, but further on only desc will be evaluated. So update the desc pointer to be able to use the data from the function panel_dpi_probe(). Fixes: 4a1d0dbc8332 ("drm/panel: simple: add panel-dpi support") Signed-off-by: Christoph Niedermaier Cc: Marek Vasut Cc: Thierry Reding Cc: Sam Ravnborg Cc: David Airlie Cc: Daniel Vetter To: dri-devel@lists.freedesktop.org Reviewed-by: Sam Ravnborg Signed-off-by: Marek Vasut Link: https://patchwork.freedesktop.org/patch/msgid/20220201110153.3479-1-c= niedermaier@dh-electronics.com Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/gpu/drm/panel/panel-simple.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/p= anel-simple.c index eb475a3a774b7..87f30bced7b7e 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -588,6 +588,7 @@ static int panel_simple_probe(struct device *dev, const= struct panel_desc *desc) err =3D panel_dpi_probe(dev, panel); if (err) goto free_ddc; + desc =3D panel->desc; } else { if (!of_get_display_timing(dev->of_node, "panel-timing", &dt)) panel_simple_parse_panel_timing_node(dev, panel, &dt); --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2FC16C433F5 for ; Mon, 14 Feb 2022 10:33:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347981AbiBNKdJ (ORCPT ); Mon, 14 Feb 2022 05:33:09 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347455AbiBNKb2 (ORCPT ); Mon, 14 Feb 2022 05:31:28 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84FF19FAEF; Mon, 14 Feb 2022 02:00:05 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3F07A60A69; Mon, 14 Feb 2022 09:59:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19A2FC340EF; Mon, 14 Feb 2022 09:59:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832794; bh=LTboYfmH/a68TcCCBAK+TJjoXyW6Y/B18xEZL5Dz6d8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GKNkSu8q6Vc4cZOlgVGmMh2iI99XLrdeVQkP1s2fVTwyVQzb+5LgJ8Wzt9Alx6d1o Ug++DRAyLuaj0NVHe58xkB6AtzpzHowqTEcpCyCkl3DAqAYamUcJznWX98I5zQg6Io UMmmeOaG58WkPVhCoZ2DezmqNTHBSTrOuWcldCYk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Heiko Carstens , Ilya Leoshkevich , Vasily Gorbik , Sasha Levin Subject: [PATCH 5.16 126/203] s390/module: fix building test_modules_helpers.o with clang Date: Mon, 14 Feb 2022 10:26:10 +0100 Message-Id: <20220214092514.524819302@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ilya Leoshkevich [ Upstream commit e286f231eab410793f3e91c924e6dbd23edee05a ] Move test_modules_return_* prototypes into a header file in order to placate -Wmissing-prototypes. Fixes: 90c5318795ee ("s390/module: test loading modules with a lot of reloc= ations") Reported-by: kernel test robot Reviewed-by: Heiko Carstens Signed-off-by: Ilya Leoshkevich Signed-off-by: Vasily Gorbik Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/s390/lib/test_modules.c | 3 --- arch/s390/lib/test_modules.h | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/s390/lib/test_modules.c b/arch/s390/lib/test_modules.c index d056baa8fbb0c..9894009fc1f25 100644 --- a/arch/s390/lib/test_modules.c +++ b/arch/s390/lib/test_modules.c @@ -5,9 +5,6 @@ =20 #include "test_modules.h" =20 -#define DECLARE_RETURN(i) int test_modules_return_ ## i(void) -REPEAT_10000(DECLARE_RETURN); - /* * Test that modules with many relocations are loaded properly. */ diff --git a/arch/s390/lib/test_modules.h b/arch/s390/lib/test_modules.h index 43b5e4b4af3e4..6371fcf176845 100644 --- a/arch/s390/lib/test_modules.h +++ b/arch/s390/lib/test_modules.h @@ -47,4 +47,7 @@ __REPEAT_10000_1(f, 8); \ __REPEAT_10000_1(f, 9) =20 +#define DECLARE_RETURN(i) int test_modules_return_ ## i(void) +REPEAT_10000(DECLARE_RETURN); + #endif --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B85AAC433FE for ; Mon, 14 Feb 2022 10:32:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347917AbiBNKdB (ORCPT ); Mon, 14 Feb 2022 05:33:01 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348959AbiBNKbN (ORCPT ); Mon, 14 Feb 2022 05:31:13 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C9819DD6D; Mon, 14 Feb 2022 01:59:58 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1D7D560C38; Mon, 14 Feb 2022 09:59:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B5CCC340F0; Mon, 14 Feb 2022 09:59:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832797; bh=fgTxHlgAuSLN0JbaPkeomaLEwcnrryB9lPiCvLTAvSo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y/TR2+VXMUgFS9mYyP34RC9ClyoCYqQSSap7gzDSyIsSmfFjjN8qxkXYybexhFlyS 2XTt0qdx+ywQoCU6zAAFtkNpOgX/uyGz9m4iv92viXKAWDhzNLPwXM3DFnxBWsUPLa AqEx9z4XQFLi2N1N7iPokHhz6abeC0kTRJ9ViCpw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Rafael J. Wysocki" , Sasha Levin Subject: [PATCH 5.16 127/203] ACPI: PM: s2idle: Cancel wakeup before dispatching EC GPE Date: Mon, 14 Feb 2022 10:26:11 +0100 Message-Id: <20220214092514.556008650@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 dc0075ba7f387fe4c48a8c674b11ab6f374a6acc ] Commit 4a9af6cac050 ("ACPI: EC: Rework flushing of EC work while suspended to idle") made acpi_ec_dispatch_gpe() check pm_wakeup_pending(), but that is before canceling the SCI wakeup, so pm_wakeup_pending() is always true. This causes the loop in acpi_ec_dispatch_gpe() to always terminate after one iteration which may not be correct. Address this issue by canceling the SCI wakeup earlier, from acpi_ec_dispatch_gpe() itself. Fixes: 4a9af6cac050 ("ACPI: EC: Rework flushing of EC work while suspended = to idle") Signed-off-by: Rafael J. Wysocki Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/acpi/ec.c | 10 ++++++++++ drivers/acpi/sleep.c | 14 ++++---------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index b9c44e6c5e400..1712990bf2ad8 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -2051,6 +2051,16 @@ bool acpi_ec_dispatch_gpe(void) if (acpi_any_gpe_status_set(first_ec->gpe)) return true; =20 + /* + * Cancel the SCI wakeup and process all pending events in case there + * are any wakeup ones in there. + * + * Note that if any non-EC GPEs are active at this point, the SCI will + * retrigger after the rearming in acpi_s2idle_wake(), so no events + * should be missed by canceling the wakeup here. + */ + pm_system_cancel_wakeup(); + /* * Dispatch the EC GPE in-band, but do not report wakeup in any case * to allow the caller to process events properly after that. diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c index 9f237dc9d45fc..8513410ca2fc2 100644 --- a/drivers/acpi/sleep.c +++ b/drivers/acpi/sleep.c @@ -739,21 +739,15 @@ bool acpi_s2idle_wake(void) return true; } =20 - /* Check non-EC GPE wakeups and dispatch the EC GPE. */ + /* + * Check non-EC GPE wakeups and if there are none, cancel the + * SCI-related wakeup and dispatch the EC GPE. + */ if (acpi_ec_dispatch_gpe()) { pm_pr_dbg("ACPI non-EC GPE wakeup\n"); return true; } =20 - /* - * Cancel the SCI wakeup and process all pending events in case - * there are any wakeup ones in there. - * - * Note that if any non-EC GPEs are active at this point, the - * SCI will retrigger after the rearming below, so no events - * should be missed by canceling the wakeup here. - */ - pm_system_cancel_wakeup(); acpi_os_wait_events_complete(); =20 /* --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 21008C433F5 for ; Mon, 14 Feb 2022 10:33:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348020AbiBNKdP (ORCPT ); Mon, 14 Feb 2022 05:33:15 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348035AbiBNKbu (ORCPT ); Mon, 14 Feb 2022 05:31:50 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 255FE2AD9; Mon, 14 Feb 2022 02:00:14 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B1395B80DCF; Mon, 14 Feb 2022 10:00:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D71F4C340EF; Mon, 14 Feb 2022 09:59:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832800; bh=ConjnUoJ0g0xGyfJNWwrU/GygfPMqHV4ZaFCx5Ndfkk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=diankk27kKWxDRHQoAUdjLueM4xloH9aq13BiG9JLxP30et8iA8k+KqrJYqNEjMYr I/uQ+Wow6depkctk34qJoPheW6WmZgNUCPO9sj5a6Zrad6Wu2YcItqMh+Jl+WVt12A 17SWOSmATS58ijW4Aj0sJzM18ElOgY4iFeSsnKew= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Suresh Balakrishnan , Andy Shevchenko , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 5.16 128/203] gpiolib: Never return internal error codes to user space Date: Mon, 14 Feb 2022 10:26:12 +0100 Message-Id: <20220214092514.588804058@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 95a4eed7dd5b7c1c3664a626174290686ddbee9f ] Currently it's possible that character device interface may return the error codes which are not supposed to be seen by user space. In this case it's EPROBE_DEFER. Wrap it to return -ENODEV instead as sysfs does. Fixes: d7c51b47ac11 ("gpio: userspace ABI for reading/writing GPIO lines") Fixes: 61f922db7221 ("gpio: userspace ABI for reading GPIO line events") Fixes: 3c0d9c635ae2 ("gpiolib: cdev: support GPIO_V2_GET_LINE_IOCTL and GPI= O_V2_LINE_GET_VALUES_IOCTL") Reported-by: Suresh Balakrishnan Signed-off-by: Andy Shevchenko Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/gpio/gpiolib-cdev.c | 6 +++--- drivers/gpio/gpiolib-sysfs.c | 7 ++----- drivers/gpio/gpiolib.h | 12 ++++++++++++ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c index c7b5446d01fd2..ffa0256cad5a0 100644 --- a/drivers/gpio/gpiolib-cdev.c +++ b/drivers/gpio/gpiolib-cdev.c @@ -330,7 +330,7 @@ static int linehandle_create(struct gpio_device *gdev, = void __user *ip) goto out_free_lh; } =20 - ret =3D gpiod_request(desc, lh->label); + ret =3D gpiod_request_user(desc, lh->label); if (ret) goto out_free_lh; lh->descs[i] =3D desc; @@ -1378,7 +1378,7 @@ static int linereq_create(struct gpio_device *gdev, v= oid __user *ip) goto out_free_linereq; } =20 - ret =3D gpiod_request(desc, lr->label); + ret =3D gpiod_request_user(desc, lr->label); if (ret) goto out_free_linereq; =20 @@ -1764,7 +1764,7 @@ static int lineevent_create(struct gpio_device *gdev,= void __user *ip) } } =20 - ret =3D gpiod_request(desc, le->label); + ret =3D gpiod_request_user(desc, le->label); if (ret) goto out_free_le; le->desc =3D desc; diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c index 4098bc7f88b7e..44c1ad51b3fe9 100644 --- a/drivers/gpio/gpiolib-sysfs.c +++ b/drivers/gpio/gpiolib-sysfs.c @@ -475,12 +475,9 @@ static ssize_t export_store(struct class *class, * they may be undone on its behalf too. */ =20 - status =3D gpiod_request(desc, "sysfs"); - if (status) { - if (status =3D=3D -EPROBE_DEFER) - status =3D -ENODEV; + status =3D gpiod_request_user(desc, "sysfs"); + if (status) goto done; - } =20 status =3D gpiod_set_transitory(desc, false); if (!status) { diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h index 30bc3f80f83e6..c31f4626915de 100644 --- a/drivers/gpio/gpiolib.h +++ b/drivers/gpio/gpiolib.h @@ -135,6 +135,18 @@ struct gpio_desc { =20 int gpiod_request(struct gpio_desc *desc, const char *label); void gpiod_free(struct gpio_desc *desc); + +static inline int gpiod_request_user(struct gpio_desc *desc, const char *l= abel) +{ + int ret; + + ret =3D gpiod_request(desc, label); + if (ret =3D=3D -EPROBE_DEFER) + ret =3D -ENODEV; + + return ret; +} + int gpiod_configure_flags(struct gpio_desc *desc, const char *con_id, unsigned long lflags, enum gpiod_flags dflags); int gpio_set_debounce_timeout(struct gpio_desc *desc, unsigned int debounc= e); --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFB02C433F5 for ; Mon, 14 Feb 2022 10:33:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347952AbiBNKdG (ORCPT ); Mon, 14 Feb 2022 05:33:06 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:40220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347902AbiBNKb2 (ORCPT ); Mon, 14 Feb 2022 05:31:28 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF18C9FAE8; Mon, 14 Feb 2022 02:00:04 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4B55C60B34; Mon, 14 Feb 2022 10:00:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F57CC340E9; Mon, 14 Feb 2022 10:00:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832803; bh=p0GSrWSRYFcwVAlTWHkexOEppvNxSNDFbwq10rI/KzQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZxexTiaH6PadwzLe2+gcbrqQKardm3Ft7kUfO0UbSyouOWo5YhPo97k6ietqNfksf xiGkulkWDqjbifUqxsBlDwvtrq2En/33cAoQJZpMc7bm1W2uQj+03/81P/mFRQs4kX i9f0vKFvUM4T619jEFgUEnw4G7wIM+W2khmaoHU0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Niklas Cassel , Linus Walleij , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 5.16 129/203] gpio: sifive: use the correct register to read output values Date: Mon, 14 Feb 2022 10:26:13 +0100 Message-Id: <20220214092514.619622657@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Niklas Cassel [ Upstream commit cc38ef936840ac29204d806deb4d1836ec509594 ] Setting the output of a GPIO to 1 using gpiod_set_value(), followed by reading the same GPIO using gpiod_get_value(), will currently yield an incorrect result. This is because the SiFive GPIO device stores the output values in reg_set, not reg_dat. Supply the flag BGPIOF_READ_OUTPUT_REG_SET to bgpio_init() so that the generic driver reads the correct register. Fixes: 96868dce644d ("gpio/sifive: Add GPIO driver for SiFive SoCs") Signed-off-by: Niklas Cassel Reviewed-by: Linus Walleij [Bartosz: added the Fixes tag] Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/gpio/gpio-sifive.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-sifive.c b/drivers/gpio/gpio-sifive.c index 403f9e833d6a3..7d82388b4ab7c 100644 --- a/drivers/gpio/gpio-sifive.c +++ b/drivers/gpio/gpio-sifive.c @@ -223,7 +223,7 @@ static int sifive_gpio_probe(struct platform_device *pd= ev) NULL, chip->base + SIFIVE_GPIO_OUTPUT_EN, chip->base + SIFIVE_GPIO_INPUT_EN, - 0); + BGPIOF_READ_OUTPUT_REG_SET); if (ret) { dev_err(dev, "unable to init generic GPIO\n"); return ret; --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D93C0C433F5 for ; Mon, 14 Feb 2022 10:33:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242325AbiBNKdZ (ORCPT ); Mon, 14 Feb 2022 05:33:25 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347648AbiBNKbs (ORCPT ); Mon, 14 Feb 2022 05:31:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1592389; Mon, 14 Feb 2022 02:00:07 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A272F60921; Mon, 14 Feb 2022 10:00:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06C70C340EF; Mon, 14 Feb 2022 10:00:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832807; bh=TpPBO9LX7Ed0/HpASURHSpURkqAJAx0uV/TvLyhfA2g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L8HZd6dBIu7+3PZzUmvKa/DHxp+7AmskcBJY3Rv1GVvFwLXdQCd17WFZZqPSFFssZ sncjGmyXYcvny0TU+4WBC89NkQMgoS8DQWVB8RTBL5O385De/u2k3vIX49RYKO3428 ykbMevEiqFrQwkhBXrI9v1Ft5lVSC5ZYMOgbrXAE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Helge Deller , Daniel Vetter , Sasha Levin Subject: [PATCH 5.16 130/203] fbcon: Avoid cap set but not used warning Date: Mon, 14 Feb 2022 10:26:14 +0100 Message-Id: <20220214092514.651071842@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 [ Upstream commit 50b10528aad568c95f772039d4b3093b4aea7439 ] Fix this kernel test robot warning: drivers/video/fbdev/core/fbcon.c: In function 'fbcon_init': drivers/video/fbdev/core/fbcon.c:1028:6: warning: variable 'cap' set but = not used [-Wunused-but-set-variable] The cap variable is only used when CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELE= RATION is enabled. Drop the temporary variable and use info->flags instead. Fixes: 87ab9f6b7417 ("Revert "fbcon: Disable accelerated scrolling") Reported-by: kernel test robot Signed-off-by: Helge Deller Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/YgFB4xqI+As196FR@p100 Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/video/fbdev/core/fbcon.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fb= con.c index f36829eeb5a93..2fc1b80a26ad9 100644 --- a/drivers/video/fbdev/core/fbcon.c +++ b/drivers/video/fbdev/core/fbcon.c @@ -1025,7 +1025,7 @@ static void fbcon_init(struct vc_data *vc, int init) struct vc_data *svc =3D *default_mode; struct fbcon_display *t, *p =3D &fb_display[vc->vc_num]; int logo =3D 1, new_rows, new_cols, rows, cols; - int cap, ret; + int ret; =20 if (WARN_ON(info_idx =3D=3D -1)) return; @@ -1034,7 +1034,6 @@ static void fbcon_init(struct vc_data *vc, int init) con2fb_map[vc->vc_num] =3D info_idx; =20 info =3D registered_fb[con2fb_map[vc->vc_num]]; - cap =3D info->flags; =20 if (logo_shown < 0 && console_loglevel <=3D CONSOLE_LOGLEVEL_QUIET) logo_shown =3D FBCON_LOGO_DONTSHOW; @@ -1137,8 +1136,8 @@ static void fbcon_init(struct vc_data *vc, int init) ops->graphics =3D 0; =20 #ifdef CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION - if ((cap & FBINFO_HWACCEL_COPYAREA) && - !(cap & FBINFO_HWACCEL_DISABLED)) + if ((info->flags & FBINFO_HWACCEL_COPYAREA) && + !(info->flags & FBINFO_HWACCEL_DISABLED)) p->scrollmode =3D SCROLL_MOVE; else /* default to something safe */ p->scrollmode =3D SCROLL_REDRAW; --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97D37C433F5 for ; Mon, 14 Feb 2022 10:33:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347992AbiBNKdN (ORCPT ); Mon, 14 Feb 2022 05:33:13 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348031AbiBNKbu (ORCPT ); Mon, 14 Feb 2022 05:31:50 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11FFB2AD7; Mon, 14 Feb 2022 02:00:14 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 53C35B80DCE; Mon, 14 Feb 2022 10:00:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 76B90C340E9; Mon, 14 Feb 2022 10:00:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832810; bh=0cCVy52/8FGsLChq8XKfbof1AzX4yIpQTcxqagmp5gg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FUyzuvQ+0eW+mJk48ytz6oURLkMUe46SQ5Nht+LFGOv/jDPkauu0tHnzT/PkGMvcx vUf3xq1u2V6iB/OhXBS4ZACDR/gyWF4od2sHX+V6kSQmM1R9JBo3SJfI7TfAE9d31o 4+LFDEkexx5FQw9Q79T6HuxbbENOzjtj0ukiFAHU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, NeilBrown , Anna Schumaker , Sasha Levin Subject: [PATCH 5.16 131/203] SUNRPC: lock against ->sock changing during sysfs read Date: Mon, 14 Feb 2022 10:26:15 +0100 Message-Id: <20220214092514.683072285@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: NeilBrown [ Upstream commit b49ea673e119f59c71645e2f65b3ccad857c90ee ] ->sock can be set to NULL asynchronously unless ->recv_mutex is held. So it is important to hold that mutex. Otherwise a sysfs read can trigger an oops. Commit 17f09d3f619a ("SUNRPC: Check if the xprt is connected before handling sysfs reads") appears to attempt to fix this problem, but it only narrows the race window. Fixes: 17f09d3f619a ("SUNRPC: Check if the xprt is connected before handlin= g sysfs reads") Fixes: a8482488a7d6 ("SUNRPC query transport's source port") Signed-off-by: NeilBrown Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- net/sunrpc/sysfs.c | 5 ++++- net/sunrpc/xprtsock.c | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/net/sunrpc/sysfs.c b/net/sunrpc/sysfs.c index 8f309bcdf84fe..0c28280dd3bcb 100644 --- a/net/sunrpc/sysfs.c +++ b/net/sunrpc/sysfs.c @@ -115,11 +115,14 @@ static ssize_t rpc_sysfs_xprt_srcaddr_show(struct kob= ject *kobj, } =20 sock =3D container_of(xprt, struct sock_xprt, xprt); - if (kernel_getsockname(sock->sock, (struct sockaddr *)&saddr) < 0) + mutex_lock(&sock->recv_mutex); + if (sock->sock =3D=3D NULL || + kernel_getsockname(sock->sock, (struct sockaddr *)&saddr) < 0) goto out; =20 ret =3D sprintf(buf, "%pISc\n", &saddr); out: + mutex_unlock(&sock->recv_mutex); xprt_put(xprt); return ret + 1; } diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c index d8ee06a9650a1..03770e56df361 100644 --- a/net/sunrpc/xprtsock.c +++ b/net/sunrpc/xprtsock.c @@ -1641,7 +1641,12 @@ static int xs_get_srcport(struct sock_xprt *transpor= t) unsigned short get_srcport(struct rpc_xprt *xprt) { struct sock_xprt *sock =3D container_of(xprt, struct sock_xprt, xprt); - return xs_sock_getport(sock->sock); + unsigned short ret =3D 0; + mutex_lock(&sock->recv_mutex); + if (sock->sock) + ret =3D xs_sock_getport(sock->sock); + mutex_unlock(&sock->recv_mutex); + return ret; } EXPORT_SYMBOL(get_srcport); =20 --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42423C433F5 for ; Mon, 14 Feb 2022 10:33:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348123AbiBNKdy (ORCPT ); Mon, 14 Feb 2022 05:33:54 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347864AbiBNKcC (ORCPT ); Mon, 14 Feb 2022 05:32:02 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 758656BDD8; Mon, 14 Feb 2022 02:00:20 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9022260B31; Mon, 14 Feb 2022 10:00:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D04BC340E9; Mon, 14 Feb 2022 10:00:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832813; bh=vtvCnSQpdw7qOucHM0NWvM5R9bVPjaYmC2aS75+Gk+8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mmx2GM8v+25s0s2nCtPFXRyoCOvjTEwb9mcLeZYtwtDysw/DuXGOgWFTVtAishP2D ypn45Ab2/DrhFAGk/9H6Qnznt2plO9phLB7nPfKINBLCYMA2ElQdDAyGNF6qFW0pX8 VA5kvfmqIYAV4h69TBKmDFHe9K2T6gwuR0f0QJZk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Tao Liu , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 132/203] gve: Recording rx queue before sending to napi Date: Mon, 14 Feb 2022 10:26:16 +0100 Message-Id: <20220214092514.721288575@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tao Liu [ Upstream commit 084cbb2ec3af2d23be9de65fcc9493e21e265859 ] This caused a significant performance degredation when using generic XDP with multiple queues. Fixes: f5cedc84a30d2 ("gve: Add transmit and receive support") Signed-off-by: Tao Liu Link: https://lore.kernel.org/r/20220207175901.2486596-1-jeroendb@google.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/net/ethernet/google/gve/gve_rx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/google/gve/gve_rx.c b/drivers/net/etherne= t/google/gve/gve_rx.c index 04a08904305a9..3453e565472c1 100644 --- a/drivers/net/ethernet/google/gve/gve_rx.c +++ b/drivers/net/ethernet/google/gve/gve_rx.c @@ -609,6 +609,7 @@ static bool gve_rx(struct gve_rx_ring *rx, netdev_featu= res_t feat, =20 *packet_size_bytes =3D skb->len + (skb->protocol ? ETH_HLEN : 0); *work_done =3D work_cnt; + skb_record_rx_queue(skb, rx->q_num); if (skb_is_nonlinear(skb)) napi_gro_frags(napi); else --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1D53C433EF for ; Mon, 14 Feb 2022 10:33:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348150AbiBNKd7 (ORCPT ); Mon, 14 Feb 2022 05:33:59 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347657AbiBNKcq (ORCPT ); Mon, 14 Feb 2022 05:32:46 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14FBDC4A; Mon, 14 Feb 2022 02:00:26 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4A54FB80DD5; Mon, 14 Feb 2022 10:00:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B2ECC340F0; Mon, 14 Feb 2022 10:00:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832816; bh=hVT9vcrsMu3iXmmfL1aKgU0xyFqeb/Z1AIQblrY07wo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hcDsfk6JNfRBZolavw+S3iDGAAw8rKlJFJL1CFN2W5K2WIPMp1fEKFd22Axi3k1cO 8K9EZ+n9F5ZuXQl2UBy3JHT8IFCeWSh+ny+x1wcm5T3IcT9PAv0nMewfFwL2ahbHe6 hjDELXEQ9Pl6N248+xXQH0NnSqIeJtYpfd6PIBzg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mahesh Bandewar , Jay Vosburgh , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 133/203] bonding: pair enable_port with slave_arr_updates Date: Mon, 14 Feb 2022 10:26:17 +0100 Message-Id: <20220214092514.752120884@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Bandewar [ Upstream commit 23de0d7b6f0e3f9a6283a882594c479949da1120 ] When 803.2ad mode enables a participating port, it should update the slave-array. I have observed that the member links are participating and are part of the active aggregator while the traffic is egressing via only one member link (in a case where two links are participating). Via kprobes I discovered that slave-arr has only one link added while the other participating link wasn't part of the slave-arr. I couldn't see what caused that situation but the simple code-walk through provided me hints that the enable_port wasn't always associated with the slave-array update. Fixes: ee6377147409 ("bonding: Simplify the xmit function for modes that us= e xmit_hash") Signed-off-by: Mahesh Bandewar Acked-by: Jay Vosburgh Link: https://lore.kernel.org/r/20220207222901.1795287-1-maheshb@google.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/net/bonding/bond_3ad.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index 6006c2e8fa2bc..9fd1d6cba3cda 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c @@ -1021,8 +1021,8 @@ static void ad_mux_machine(struct port *port, bool *u= pdate_slave_arr) if (port->aggregator && port->aggregator->is_active && !__port_is_enabled(port)) { - __enable_port(port); + *update_slave_arr =3D true; } } break; @@ -1779,6 +1779,7 @@ static void ad_agg_selection_logic(struct aggregator = *agg, port =3D port->next_port_in_aggregator) { __enable_port(port); } + *update_slave_arr =3D true; } } =20 --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFBD6C433F5 for ; Mon, 14 Feb 2022 10:33:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347956AbiBNKeB (ORCPT ); Mon, 14 Feb 2022 05:34:01 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347752AbiBNKct (ORCPT ); Mon, 14 Feb 2022 05:32:49 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D446C4F; Mon, 14 Feb 2022 02:00:26 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9649C6077B; Mon, 14 Feb 2022 10:00:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 64F4AC340E9; Mon, 14 Feb 2022 10:00:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832819; bh=foWXnFOf9ZPLRGsRL/WHDIoeJtrQr8lElaKtUhB1ngY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Opr7wuF2/ROp6skzi9pUxXQWtfLDv/Ho9K051bPXwItAklunLBwliRBYir/oJe9yd S+VcCJ1njQ8WowBMjofSAxYV8gZOQDMDlwzORnpr9tczvB6KFLJ8+5h5CyNhIt0RGf ojdLcoPZ+WO3Sk+Rq590jT30ob60EOuyxyyUI1JU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rafael Richter , Vladimir Oltean , Daniel Klauer , Andrew Lunn , Florian Fainelli , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 134/203] net: dsa: mv88e6xxx: dont use devres for mdiobus Date: Mon, 14 Feb 2022 10:26:18 +0100 Message-Id: <20220214092514.785303891@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean [ Upstream commit f53a2ce893b2c7884ef94471f170839170a4eba0 ] As explained in commits: 74b6d7d13307 ("net: dsa: realtek: register the MDIO bus under devres") 5135e96a3dd2 ("net: dsa: don't allocate the slave_mii_bus using devres") mdiobus_free() will panic when called from devm_mdiobus_free() <- devres_release_all() <- __device_release_driver(), and that mdiobus was not previously unregistered. The mv88e6xxx is an MDIO device, so the initial set of constraints that I thought would cause this (I2C or SPI buses which call ->remove on ->shutdown) do not apply. But there is one more which applies here. If the DSA master itself is on a bus that calls ->remove from ->shutdown (like dpaa2-eth, which is on the fsl-mc bus), there is a device link between the switch and the DSA master, and device_links_unbind_consumers() will unbind the Marvell switch driver on shutdown. systemd-shutdown[1]: Powering off. mv88e6085 0x0000000008b96000:00 sw_gl0: Link is Down fsl-mc dpbp.9: Removing from iommu group 7 fsl-mc dpbp.8: Removing from iommu group 7 Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz ------------[ cut here ]------------ kernel BUG at drivers/net/phy/mdio_bus.c:677! Internal error: Oops - BUG: 0 [#1] PREEMPT SMP Modules linked in: CPU: 0 PID: 1 Comm: systemd-shutdow Not tainted 5.16.5-00040-gdc05f73788e5 = #15 pc : mdiobus_free+0x44/0x50 lr : devm_mdiobus_free+0x10/0x20 Call trace: mdiobus_free+0x44/0x50 devm_mdiobus_free+0x10/0x20 devres_release_all+0xa0/0x100 __device_release_driver+0x190/0x220 device_release_driver_internal+0xac/0xb0 device_links_unbind_consumers+0xd4/0x100 __device_release_driver+0x4c/0x220 device_release_driver_internal+0xac/0xb0 device_links_unbind_consumers+0xd4/0x100 __device_release_driver+0x94/0x220 device_release_driver+0x28/0x40 bus_remove_device+0x118/0x124 device_del+0x174/0x420 fsl_mc_device_remove+0x24/0x40 __fsl_mc_device_remove+0xc/0x20 device_for_each_child+0x58/0xa0 dprc_remove+0x90/0xb0 fsl_mc_driver_remove+0x20/0x5c __device_release_driver+0x21c/0x220 device_release_driver+0x28/0x40 bus_remove_device+0x118/0x124 device_del+0x174/0x420 fsl_mc_bus_remove+0x80/0x100 fsl_mc_bus_shutdown+0xc/0x1c platform_shutdown+0x20/0x30 device_shutdown+0x154/0x330 kernel_power_off+0x34/0x6c __do_sys_reboot+0x15c/0x250 __arm64_sys_reboot+0x20/0x30 invoke_syscall.constprop.0+0x4c/0xe0 do_el0_svc+0x4c/0x150 el0_svc+0x24/0xb0 el0t_64_sync_handler+0xa8/0xb0 el0t_64_sync+0x178/0x17c So the same treatment must be applied to all DSA switch drivers, which is: either use devres for both the mdiobus allocation and registration, or don't use devres at all. The Marvell driver already has a good structure for mdiobus removal, so just plug in mdiobus_free and get rid of devres. Fixes: ac3a68d56651 ("net: phy: don't abuse devres in devm_mdiobus_register= ()") Reported-by: Rafael Richter Signed-off-by: Vladimir Oltean Tested-by: Daniel Klauer Reviewed-by: Andrew Lunn Reviewed-by: Florian Fainelli Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- drivers/net/dsa/mv88e6xxx/chip.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/c= hip.c index cd8462d1e27c0..fcd648d0f6372 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -3415,7 +3415,7 @@ static int mv88e6xxx_mdio_register(struct mv88e6xxx_c= hip *chip, return err; } =20 - bus =3D devm_mdiobus_alloc_size(chip->dev, sizeof(*mdio_bus)); + bus =3D mdiobus_alloc_size(sizeof(*mdio_bus)); if (!bus) return -ENOMEM; =20 @@ -3440,14 +3440,14 @@ static int mv88e6xxx_mdio_register(struct mv88e6xxx= _chip *chip, if (!external) { err =3D mv88e6xxx_g2_irq_mdio_setup(chip, bus); if (err) - return err; + goto out; } =20 err =3D of_mdiobus_register(bus, np); if (err) { dev_err(chip->dev, "Cannot register MDIO bus (%d)\n", err); mv88e6xxx_g2_irq_mdio_free(chip, bus); - return err; + goto out; } =20 if (external) @@ -3456,6 +3456,10 @@ static int mv88e6xxx_mdio_register(struct mv88e6xxx_= chip *chip, list_add(&mdio_bus->list, &chip->mdios); =20 return 0; + +out: + mdiobus_free(bus); + return err; } =20 static void mv88e6xxx_mdios_unregister(struct mv88e6xxx_chip *chip) @@ -3471,6 +3475,7 @@ static void mv88e6xxx_mdios_unregister(struct mv88e6x= xx_chip *chip) mv88e6xxx_g2_irq_mdio_free(chip, bus); =20 mdiobus_unregister(bus); + mdiobus_free(bus); } } =20 --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA115C433EF for ; Mon, 14 Feb 2022 10:34:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347626AbiBNKeW (ORCPT ); Mon, 14 Feb 2022 05:34:22 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:40200 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348054AbiBNKdR (ORCPT ); Mon, 14 Feb 2022 05:33:17 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 009452BDD; Mon, 14 Feb 2022 02:00:29 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 775FA60B41; Mon, 14 Feb 2022 10:00:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5AA9DC340E9; Mon, 14 Feb 2022 10:00:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832821; bh=PjMzg6Nai8X8nEKfgj8NMwdE/kkdQFF7Mfy196AhEVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TYgvXWy//CdIuFAfuMVyni3OiIoLBU4HTDMKuq24SgDPb5Smb/iYubimNWFpuk35i Idp3V4yv91CXQg9EuC2j8vNPLnDn17puPWmcRChgxmwQKbvzPWhYZo0A0TDcc4jdEu BzBQvZZ5fw8JADwgCG/mGqGX7K/NYPEqVBxm2fIc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , Florian Fainelli , Oleksij Rempel , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 135/203] net: dsa: ar9331: register the mdiobus under devres Date: Mon, 14 Feb 2022 10:26:19 +0100 Message-Id: <20220214092514.818511117@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean [ Upstream commit 50facd86e9fbc4b93fe02e5fe05776047f45dbfb ] As explained in commits: 74b6d7d13307 ("net: dsa: realtek: register the MDIO bus under devres") 5135e96a3dd2 ("net: dsa: don't allocate the slave_mii_bus using devres") mdiobus_free() will panic when called from devm_mdiobus_free() <- devres_release_all() <- __device_release_driver(), and that mdiobus was not previously unregistered. The ar9331 is an MDIO device, so the initial set of constraints that I thought would cause this (I2C or SPI buses which call ->remove on ->shutdown) do not apply. But there is one more which applies here. If the DSA master itself is on a bus that calls ->remove from ->shutdown (like dpaa2-eth, which is on the fsl-mc bus), there is a device link between the switch and the DSA master, and device_links_unbind_consumers() will unbind the ar9331 switch driver on shutdown. So the same treatment must be applied to all DSA switch drivers, which is: either use devres for both the mdiobus allocation and registration, or don't use devres at all. The ar9331 driver doesn't have a complex code structure for mdiobus removal, so just replace of_mdiobus_register with the devres variant in order to be all-devres and ensure that we don't free a still-registered bus. Fixes: ac3a68d56651 ("net: phy: don't abuse devres in devm_mdiobus_register= ()") Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli Tested-by: Oleksij Rempel Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/net/dsa/qca/ar9331.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/dsa/qca/ar9331.c b/drivers/net/dsa/qca/ar9331.c index da0d7e68643a9..c39de2a4c1fe0 100644 --- a/drivers/net/dsa/qca/ar9331.c +++ b/drivers/net/dsa/qca/ar9331.c @@ -378,7 +378,7 @@ static int ar9331_sw_mbus_init(struct ar9331_sw_priv *p= riv) if (!mnp) return -ENODEV; =20 - ret =3D of_mdiobus_register(mbus, mnp); + ret =3D devm_of_mdiobus_register(dev, mbus, mnp); of_node_put(mnp); if (ret) return ret; @@ -1091,7 +1091,6 @@ static void ar9331_sw_remove(struct mdio_device *mdio= dev) } =20 irq_domain_remove(priv->irqdomain); - mdiobus_unregister(priv->mbus); dsa_unregister_switch(&priv->ds); =20 reset_control_assert(priv->sw_reset); --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C773C433EF for ; Mon, 14 Feb 2022 10:34:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347203AbiBNKeQ (ORCPT ); Mon, 14 Feb 2022 05:34:16 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347920AbiBNKdQ (ORCPT ); Mon, 14 Feb 2022 05:33:16 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A174B2BD9; Mon, 14 Feb 2022 02:00:29 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9E3F060C32; Mon, 14 Feb 2022 10:00:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 72EA0C340F0; Mon, 14 Feb 2022 10:00:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832828; bh=TBnyqoTQPosQtBqxYCNdVgHbcUIa0+jxn7HOS9c/KvI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zOpCWNoyowSb3Ji3fjFbd6GQxu28xQ8S5ah7huglGhF0gbdqcOybk9sXwTF8pC0Ad kGuneG199TOqG129RR3zIBN4SEe5AwxLlaZBUr6bW1wWUCeJL98vB56znfZVSg7DWO YhbvJmoyNa70EueGNpZAMdM0sqNepwaZdd+hCR1Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , Florian Fainelli , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 136/203] net: dsa: bcm_sf2: dont use devres for mdiobus Date: Mon, 14 Feb 2022 10:26:20 +0100 Message-Id: <20220214092514.857178364@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean [ Upstream commit 08f1a20822349004bb9cc1b153ecb516e9f2889d ] As explained in commits: 74b6d7d13307 ("net: dsa: realtek: register the MDIO bus under devres") 5135e96a3dd2 ("net: dsa: don't allocate the slave_mii_bus using devres") mdiobus_free() will panic when called from devm_mdiobus_free() <- devres_release_all() <- __device_release_driver(), and that mdiobus was not previously unregistered. The Starfighter 2 is a platform device, so the initial set of constraints that I thought would cause this (I2C or SPI buses which call ->remove on ->shutdown) do not apply. But there is one more which applies here. If the DSA master itself is on a bus that calls ->remove from ->shutdown (like dpaa2-eth, which is on the fsl-mc bus), there is a device link between the switch and the DSA master, and device_links_unbind_consumers() will unbind the bcm_sf2 switch driver on shutdown. So the same treatment must be applied to all DSA switch drivers, which is: either use devres for both the mdiobus allocation and registration, or don't use devres at all. The bcm_sf2 driver has the code structure in place for orderly mdiobus removal, so just replace devm_mdiobus_alloc() with the non-devres variant, and add manual free where necessary, to ensure that we don't let devres free a still-registered bus. Fixes: ac3a68d56651 ("net: phy: don't abuse devres in devm_mdiobus_register= ()") Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/net/dsa/bcm_sf2.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c index 13aa43b5cffd9..1502d200682f8 100644 --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c @@ -584,7 +584,7 @@ static int bcm_sf2_mdio_register(struct dsa_switch *ds) get_device(&priv->master_mii_bus->dev); priv->master_mii_dn =3D dn; =20 - priv->slave_mii_bus =3D devm_mdiobus_alloc(ds->dev); + priv->slave_mii_bus =3D mdiobus_alloc(); if (!priv->slave_mii_bus) { of_node_put(dn); return -ENOMEM; @@ -644,8 +644,10 @@ static int bcm_sf2_mdio_register(struct dsa_switch *ds) } =20 err =3D mdiobus_register(priv->slave_mii_bus); - if (err && dn) + if (err && dn) { + mdiobus_free(priv->slave_mii_bus); of_node_put(dn); + } =20 return err; } @@ -653,6 +655,7 @@ static int bcm_sf2_mdio_register(struct dsa_switch *ds) static void bcm_sf2_mdio_unregister(struct bcm_sf2_priv *priv) { mdiobus_unregister(priv->slave_mii_bus); + mdiobus_free(priv->slave_mii_bus); of_node_put(priv->master_mii_dn); } =20 --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE42BC433F5 for ; Mon, 14 Feb 2022 10:34:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348251AbiBNKe0 (ORCPT ); Mon, 14 Feb 2022 05:34:26 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347736AbiBNKdW (ORCPT ); Mon, 14 Feb 2022 05:33:22 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EC4DA1BCB; Mon, 14 Feb 2022 02:00:34 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7BF56B80DBE; Mon, 14 Feb 2022 10:00:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 668E0C340E9; Mon, 14 Feb 2022 10:00:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832831; bh=RqmcDVCintIL4s3Ge1wQ9SsymjEA67HDOlmb4mXgUhY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GAl4lis0TIfKQnk2UZEccmV1c31JO0GIMEf7iPEt7AQcV/GBzmbIgD8SN4bOEuHJk sMzjTYO+Z9eIKFOqu2/RLruRYT5W5pYRYY3l8HSxgUuRdvW4O+tCKisa1hQCTeqKY4 C1XROpI3p//vmbOzMxoKDDZZTkjpIcAI31X2rHD4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , Florian Fainelli , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 137/203] net: dsa: felix: dont use devres for mdiobus Date: Mon, 14 Feb 2022 10:26:21 +0100 Message-Id: <20220214092514.888425741@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean [ Upstream commit 209bdb7ec6a28c7cdf580a0a98afbc9fc3b98932 ] As explained in commits: 74b6d7d13307 ("net: dsa: realtek: register the MDIO bus under devres") 5135e96a3dd2 ("net: dsa: don't allocate the slave_mii_bus using devres") mdiobus_free() will panic when called from devm_mdiobus_free() <- devres_release_all() <- __device_release_driver(), and that mdiobus was not previously unregistered. The Felix VSC9959 switch is a PCI device, so the initial set of constraints that I thought would cause this (I2C or SPI buses which call ->remove on ->shutdown) do not apply. But there is one more which applies here. If the DSA master itself is on a bus that calls ->remove from ->shutdown (like dpaa2-eth, which is on the fsl-mc bus), there is a device link between the switch and the DSA master, and device_links_unbind_consumers() will unbind the felix switch driver on shutdown. So the same treatment must be applied to all DSA switch drivers, which is: either use devres for both the mdiobus allocation and registration, or don't use devres at all. The felix driver has the code structure in place for orderly mdiobus removal, so just replace devm_mdiobus_alloc_size() with the non-devres variant, and add manual free where necessary, to ensure that we don't let devres free a still-registered bus. Fixes: ac3a68d56651 ("net: phy: don't abuse devres in devm_mdiobus_register= ()") Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/net/dsa/ocelot/felix_vsc9959.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelo= t/felix_vsc9959.c index 45c5ec7a83eaf..12c2acbc2427b 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -1064,7 +1064,7 @@ static int vsc9959_mdio_bus_alloc(struct ocelot *ocel= ot) return PTR_ERR(hw); } =20 - bus =3D devm_mdiobus_alloc_size(dev, sizeof(*mdio_priv)); + bus =3D mdiobus_alloc_size(sizeof(*mdio_priv)); if (!bus) return -ENOMEM; =20 @@ -1084,6 +1084,7 @@ static int vsc9959_mdio_bus_alloc(struct ocelot *ocel= ot) rc =3D mdiobus_register(bus); if (rc < 0) { dev_err(dev, "failed to register MDIO bus\n"); + mdiobus_free(bus); return rc; } =20 @@ -1133,6 +1134,7 @@ static void vsc9959_mdio_bus_free(struct ocelot *ocel= ot) lynx_pcs_destroy(pcs); } mdiobus_unregister(felix->imdio); + mdiobus_free(felix->imdio); } =20 static void vsc9959_sched_speed_set(struct ocelot *ocelot, int port, --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45199C433F5 for ; Mon, 14 Feb 2022 10:34:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347795AbiBNKea (ORCPT ); Mon, 14 Feb 2022 05:34:30 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348111AbiBNKdt (ORCPT ); Mon, 14 Feb 2022 05:33:49 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD3ABA1BD5; Mon, 14 Feb 2022 02:00:35 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5D368B80DC4; Mon, 14 Feb 2022 10:00:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84965C340E9; Mon, 14 Feb 2022 10:00:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832834; bh=CHZHqr+4jaCX9wsFiBgJt3sv1daprCf2QRNI2IXcQ68=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wR602CftBb0gObMeK2OO6KebMRHgsVdrEeymZpCkyvUAwnb9T6EDjwl9eR+PQTDHF jLw0QWB6+MIzj94BQPVs3qp0n20JlmcRLclg3xJ5uxEIR/iGuQjgTveIxq3nJicTkd pNPGWomZ9EiThXM3qeIdjpOCxo0jUF/PkGRcNqh8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Foster , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 138/203] net: dsa: ocelot: seville: utilize of_mdiobus_register Date: Mon, 14 Feb 2022 10:26:22 +0100 Message-Id: <20220214092514.920070785@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Colin Foster [ Upstream commit 5186c4a05b9713138b762a49467a8ab9753cdb36 ] Switch seville to use of_mdiobus_register(bus, NULL) instead of just mdiobus_register. This code is about to be pulled into a separate module that can optionally define ports by the device_node. Signed-off-by: Colin Foster Reviewed-by: Florian Fainelli Reviewed-by: Vladimir Oltean Tested-by: Vladimir Oltean Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/net/dsa/ocelot/seville_vsc9953.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/oce= lot/seville_vsc9953.c index 92eae63150eae..5ee7d1592a721 100644 --- a/drivers/net/dsa/ocelot/seville_vsc9953.c +++ b/drivers/net/dsa/ocelot/seville_vsc9953.c @@ -10,6 +10,7 @@ #include #include #include +#include #include "felix.h" =20 #define MSCC_MIIM_CMD_OPR_WRITE BIT(1) @@ -1108,7 +1109,7 @@ static int vsc9953_mdio_bus_alloc(struct ocelot *ocel= ot) snprintf(bus->id, MII_BUS_ID_SIZE, "%s-imdio", dev_name(dev)); =20 /* Needed in order to initialize the bus mutex lock */ - rc =3D mdiobus_register(bus); + rc =3D of_mdiobus_register(bus, NULL); if (rc < 0) { dev_err(dev, "failed to register MDIO bus\n"); return rc; --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B0B3C433EF for ; Mon, 14 Feb 2022 10:34:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348146AbiBNKek (ORCPT ); Mon, 14 Feb 2022 05:34:40 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348057AbiBNKeA (ORCPT ); Mon, 14 Feb 2022 05:34:00 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D564DA1BFB; Mon, 14 Feb 2022 02:00:39 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 79A9EB80DD0; Mon, 14 Feb 2022 10:00:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81122C340E9; Mon, 14 Feb 2022 10:00:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832837; bh=xJ39vTC6tFKpPvYTl4kRN3eaMy5FWogE2TcMQmksQmA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1q1d8jR9vNk/vGr33d6Pv4LnfDBgK9et5ViLtzl/TxD3+G4pgRYTGMaq0s/nRStoH UM8nyxNt8630h563nOgakeYv6JHQ8/G2Q/kcp+EEWxNmynbiFkyIAjkP3jzKnmyLx8 4N9oCTRAkAr/AFhvrZgUCHfbJgYiGOanjliLM86M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , Florian Fainelli , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 139/203] net: dsa: seville: register the mdiobus under devres Date: Mon, 14 Feb 2022 10:26:23 +0100 Message-Id: <20220214092514.958868552@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean [ Upstream commit bd488afc3b39e045ba71aab472233f2a78726e7b ] As explained in commits: 74b6d7d13307 ("net: dsa: realtek: register the MDIO bus under devres") 5135e96a3dd2 ("net: dsa: don't allocate the slave_mii_bus using devres") mdiobus_free() will panic when called from devm_mdiobus_free() <- devres_release_all() <- __device_release_driver(), and that mdiobus was not previously unregistered. The Seville VSC9959 switch is a platform device, so the initial set of constraints that I thought would cause this (I2C or SPI buses which call ->remove on ->shutdown) do not apply. But there is one more which applies here. If the DSA master itself is on a bus that calls ->remove from ->shutdown (like dpaa2-eth, which is on the fsl-mc bus), there is a device link between the switch and the DSA master, and device_links_unbind_consumers() will unbind the seville switch driver on shutdown. So the same treatment must be applied to all DSA switch drivers, which is: either use devres for both the mdiobus allocation and registration, or don't use devres at all. The seville driver has a code structure that could accommodate both the mdiobus_unregister and mdiobus_free calls, but it has an external dependency upon mscc_miim_setup() from mdio-mscc-miim.c, which calls devm_mdiobus_alloc_size() on its behalf. So rather than restructuring that, and exporting yet one more symbol mscc_miim_teardown(), let's work with devres and replace of_mdiobus_register with the devres variant. When we use all-devres, we can ensure that devres doesn't free a still-registered bus (it either runs both callbacks, or none). Fixes: ac3a68d56651 ("net: phy: don't abuse devres in devm_mdiobus_register= ()") Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/net/dsa/ocelot/seville_vsc9953.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/oce= lot/seville_vsc9953.c index 5ee7d1592a721..40d6d1f2c724f 100644 --- a/drivers/net/dsa/ocelot/seville_vsc9953.c +++ b/drivers/net/dsa/ocelot/seville_vsc9953.c @@ -1109,7 +1109,7 @@ static int vsc9953_mdio_bus_alloc(struct ocelot *ocel= ot) snprintf(bus->id, MII_BUS_ID_SIZE, "%s-imdio", dev_name(dev)); =20 /* Needed in order to initialize the bus mutex lock */ - rc =3D of_mdiobus_register(bus, NULL); + rc =3D devm_of_mdiobus_register(dev, bus, NULL); if (rc < 0) { dev_err(dev, "failed to register MDIO bus\n"); return rc; @@ -1161,7 +1161,8 @@ static void vsc9953_mdio_bus_free(struct ocelot *ocel= ot) mdio_device_free(pcs->mdio); lynx_pcs_destroy(pcs); } - mdiobus_unregister(felix->imdio); + + /* mdiobus_unregister and mdiobus_free handled by devres */ } =20 static const struct felix_info seville_info_vsc9953 =3D { --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79F36C433EF for ; Mon, 14 Feb 2022 10:40:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240320AbiBNKkN (ORCPT ); Mon, 14 Feb 2022 05:40:13 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:49120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350165AbiBNKg6 (ORCPT ); Mon, 14 Feb 2022 05:36:58 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E720A66DA; Mon, 14 Feb 2022 02:03:29 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BCA0360C76; Mon, 14 Feb 2022 10:02:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7EE6EC340E9; Mon, 14 Feb 2022 10:02:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832970; bh=yBRwaPPBX7oiofAb7QQqNGhdMzKYQcdZ2HG2mnhRb+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ThEUqpE+tzIoo6r7JOBUdZcGFiPDssedEjsE9sKDIyz2lgf1ZlhK+aHm051l2JjCJ DSn6Zf1oOSnRDPSczOqViW4ovtNT3vVc6R4spuX76p79Q8TU89c+ITWOBttAXrVCjL A9tVpyIuLm8WecD2gBhcvZINrLz1BbRCPZ+6eXD4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , Florian Fainelli , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 140/203] net: dsa: mt7530: fix kernel bug in mdiobus_free() when unbinding Date: Mon, 14 Feb 2022 10:26:24 +0100 Message-Id: <20220214092514.990174009@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean [ Upstream commit 9ffe3d09e32da45bb5a29cf2e80ec8d7534010c5 ] Nobody in this driver calls mdiobus_unregister(), which is necessary if mdiobus_register() completes successfully. So if the devres callbacks that free the mdiobus get invoked (this is the case when unbinding the driver), mdiobus_free() will BUG if the mdiobus is still registered, which it is. My speculation is that this is due to the fact that prior to commit ac3a68d56651 ("net: phy: don't abuse devres in devm_mdiobus_register()") from June 2020, _devm_mdiobus_free() used to call mdiobus_unregister(). But at the time that the mt7530 support was introduced in May 2021, the API was already changed. It's therefore likely that the blamed patch was developed on an older tree, and incorrectly adapted to net-next. This makes the Fixes: tag correct. Fix the problem by using the devres variant of mdiobus_register. Fixes: ba751e28d442 ("net: dsa: mt7530: add interrupt support") Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/net/dsa/mt7530.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 9890672a206d0..fb59efc7f9266 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -2066,7 +2066,7 @@ mt7530_setup_mdio(struct mt7530_priv *priv) if (priv->irq) mt7530_setup_mdio_irq(priv); =20 - ret =3D mdiobus_register(bus); + ret =3D devm_mdiobus_register(dev, bus); if (ret) { dev_err(dev, "failed to register MDIO bus: %d\n", ret); if (priv->irq) --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D0D9C433FE for ; Mon, 14 Feb 2022 10:35:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348147AbiBNKfF (ORCPT ); Mon, 14 Feb 2022 05:35:05 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348033AbiBNKeZ (ORCPT ); Mon, 14 Feb 2022 05:34:25 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FF69C70; Mon, 14 Feb 2022 02:01:04 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2E01FB80DC8; Mon, 14 Feb 2022 10:01:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46CE0C340E9; Mon, 14 Feb 2022 10:01:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832861; bh=epHAIHSC308vQjf9ucV1BKLAMyF0ypOMeVSfxBdQHjM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Al/19jMDMcK87XpCu1sw312BsG5/t2fLqa5XsdvKSE0mxhPnDmiAgkCaW80nLNk5I XziDkJ/x4TqMEg5l05b8M2OiRFy5JbraH5++BCylS5yPpo1UwTSF0nWaP0xibn2ucE KKVg1/2MbaAm3mstAUzfV1rIPgSajw/2wBdO/R/0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , Florian Fainelli , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 141/203] net: dsa: lantiq_gswip: dont use devres for mdiobus Date: Mon, 14 Feb 2022 10:26:25 +0100 Message-Id: <20220214092515.028009280@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean [ Upstream commit 0d120dfb5d67edc5bcd1804e167dba2b30809afd ] As explained in commits: 74b6d7d13307 ("net: dsa: realtek: register the MDIO bus under devres") 5135e96a3dd2 ("net: dsa: don't allocate the slave_mii_bus using devres") mdiobus_free() will panic when called from devm_mdiobus_free() <- devres_release_all() <- __device_release_driver(), and that mdiobus was not previously unregistered. The GSWIP switch is a platform device, so the initial set of constraints that I thought would cause this (I2C or SPI buses which call ->remove on ->shutdown) do not apply. But there is one more which applies here. If the DSA master itself is on a bus that calls ->remove from ->shutdown (like dpaa2-eth, which is on the fsl-mc bus), there is a device link between the switch and the DSA master, and device_links_unbind_consumers() will unbind the GSWIP switch driver on shutdown. So the same treatment must be applied to all DSA switch drivers, which is: either use devres for both the mdiobus allocation and registration, or don't use devres at all. The gswip driver has the code structure in place for orderly mdiobus removal, so just replace devm_mdiobus_alloc() with the non-devres variant, and add manual free where necessary, to ensure that we don't let devres free a still-registered bus. Fixes: ac3a68d56651 ("net: phy: don't abuse devres in devm_mdiobus_register= ()") Signed-off-by: Vladimir Oltean Reviewed-by: Florian Fainelli Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/net/dsa/lantiq_gswip.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c index 7056d98d8177b..0909b05d02133 100644 --- a/drivers/net/dsa/lantiq_gswip.c +++ b/drivers/net/dsa/lantiq_gswip.c @@ -498,8 +498,9 @@ static int gswip_mdio_rd(struct mii_bus *bus, int addr,= int reg) static int gswip_mdio(struct gswip_priv *priv, struct device_node *mdio_np) { struct dsa_switch *ds =3D priv->ds; + int err; =20 - ds->slave_mii_bus =3D devm_mdiobus_alloc(priv->dev); + ds->slave_mii_bus =3D mdiobus_alloc(); if (!ds->slave_mii_bus) return -ENOMEM; =20 @@ -512,7 +513,11 @@ static int gswip_mdio(struct gswip_priv *priv, struct = device_node *mdio_np) ds->slave_mii_bus->parent =3D priv->dev; ds->slave_mii_bus->phy_mask =3D ~ds->phys_mii_mask; =20 - return of_mdiobus_register(ds->slave_mii_bus, mdio_np); + err =3D of_mdiobus_register(ds->slave_mii_bus, mdio_np); + if (err) + mdiobus_free(ds->slave_mii_bus); + + return err; } =20 static int gswip_pce_table_entry_read(struct gswip_priv *priv, @@ -2186,8 +2191,10 @@ static int gswip_probe(struct platform_device *pdev) gswip_mdio_mask(priv, GSWIP_MDIO_GLOB_ENABLE, 0, GSWIP_MDIO_GLOB); dsa_unregister_switch(priv->ds); mdio_bus: - if (mdio_np) + if (mdio_np) { mdiobus_unregister(priv->ds->slave_mii_bus); + mdiobus_free(priv->ds->slave_mii_bus); + } put_mdio_node: of_node_put(mdio_np); for (i =3D 0; i < priv->num_gphy_fw; i++) @@ -2210,6 +2217,7 @@ static int gswip_remove(struct platform_device *pdev) =20 if (priv->ds->slave_mii_bus) { mdiobus_unregister(priv->ds->slave_mii_bus); + mdiobus_free(priv->ds->slave_mii_bus); of_node_put(priv->ds->slave_mii_bus->dev.of_node); } =20 --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0141DC433F5 for ; Mon, 14 Feb 2022 10:37:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348654AbiBNKhg (ORCPT ); Mon, 14 Feb 2022 05:37:36 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348323AbiBNKes (ORCPT ); Mon, 14 Feb 2022 05:34:48 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 869E310F5; Mon, 14 Feb 2022 02:01:38 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 31BF1B80DD5; Mon, 14 Feb 2022 10:01:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 463BCC340EF; Mon, 14 Feb 2022 10:01:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832896; bh=899ymr/v+41hyibqIyWULRGLI9lxt7B1PXrOqe4nSM4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XatSoukcFIpingZZKkQ+VmWtXU9ztcABwmmADdcW1D4WfigM6v2v3u4fTCzb93waX l8njBvuDCG2TB6xEtdIb0VlNzM2LgJjaVrycrMLFBJgoUU3eOv49kRsko4qjl64Tbm U03BRKSjUmD4fsmRpNBZef7GfJ0iiG9XRwZ3Uj/8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Abdul Haleem , Sukadev Bhattiprolu , Dany Madden , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 142/203] ibmvnic: dont release napi in __ibmvnic_open() Date: Mon, 14 Feb 2022 10:26:26 +0100 Message-Id: <20220214092515.064979187@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sukadev Bhattiprolu [ Upstream commit 61772b0908c640d0309c40f7d41d062ca4e979fa ] If __ibmvnic_open() encounters an error such as when setting link state, it calls release_resources() which frees the napi structures needlessly. Instead, have __ibmvnic_open() only clean up the work it did so far (i.e. disable napi and irqs) and leave the rest to the callers. If caller of __ibmvnic_open() is ibmvnic_open(), it should release the resources immediately. If the caller is do_reset() or do_hard_reset(), they will release the resources on the next reset. This fixes following crash that occurred when running the drmgr command several times to add/remove a vnic interface: [102056] ibmvnic 30000003 env3: Disabling rx_scrq[6] irq [102056] ibmvnic 30000003 env3: Disabling rx_scrq[7] irq [102056] ibmvnic 30000003 env3: Replenished 8 pools Kernel attempted to read user page (10) - exploit attempt? (uid: 0) BUG: Kernel NULL pointer dereference on read at 0x00000010 Faulting instruction address: 0xc000000000a3c840 Oops: Kernel access of bad area, sig: 11 [#1] LE PAGE_SIZE=3D64K MMU=3DRadix SMP NR_CPUS=3D2048 NUMA pSeries ... CPU: 9 PID: 102056 Comm: kworker/9:2 Kdump: loaded Not tainted 5.16.0-rc5-= autotest-g6441998e2e37 #1 Workqueue: events_long __ibmvnic_reset [ibmvnic] NIP: c000000000a3c840 LR: c0080000029b5378 CTR: c000000000a3c820 REGS: c0000000548e37e0 TRAP: 0300 Not tainted (5.16.0-rc5-autotest-g644= 1998e2e37) MSR: 8000000000009033 CR: 28248484 XER: 00000004 CFAR: c0080000029bdd24 DAR: 0000000000000010 DSISR: 40000000 IRQMASK: 0 GPR00: c0080000029b55d0 c0000000548e3a80 c0000000028f0200 0000000000000000 ... NIP [c000000000a3c840] napi_enable+0x20/0xc0 LR [c0080000029b5378] __ibmvnic_open+0xf0/0x430 [ibmvnic] Call Trace: [c0000000548e3a80] [0000000000000006] 0x6 (unreliable) [c0000000548e3ab0] [c0080000029b55d0] __ibmvnic_open+0x348/0x430 [ibmvnic] [c0000000548e3b40] [c0080000029bcc28] __ibmvnic_reset+0x500/0xdf0 [ibmvnic] [c0000000548e3c60] [c000000000176228] process_one_work+0x288/0x570 [c0000000548e3d00] [c000000000176588] worker_thread+0x78/0x660 [c0000000548e3da0] [c0000000001822f0] kthread+0x1c0/0x1d0 [c0000000548e3e10] [c00000000000cf64] ret_from_kernel_thread+0x5c/0x64 Instruction dump: 7d2948f8 792307e0 4e800020 60000000 3c4c01eb 384239e0 f821ffd1 39430010 38a0fff6 e92d1100 f9210028 39200000 f9010020 60420000 e9210020 ---[ end trace 5f8033b08fd27706 ]--- Fixes: ed651a10875f ("ibmvnic: Updated reset handling") Reported-by: Abdul Haleem Signed-off-by: Sukadev Bhattiprolu Reviewed-by: Dany Madden Link: https://lore.kernel.org/r/20220208001918.900602-1-sukadev@linux.ibm.c= om Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/net/ethernet/ibm/ibmvnic.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/= ibmvnic.c index 682a440151a87..d5d33325a413e 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -110,6 +110,7 @@ static void ibmvnic_tx_scrq_clean_buffer(struct ibmvnic= _adapter *adapter, struct ibmvnic_sub_crq_queue *tx_scrq); static void free_long_term_buff(struct ibmvnic_adapter *adapter, struct ibmvnic_long_term_buff *ltb); +static void ibmvnic_disable_irqs(struct ibmvnic_adapter *adapter); =20 struct ibmvnic_stat { char name[ETH_GSTRING_LEN]; @@ -1418,7 +1419,7 @@ static int __ibmvnic_open(struct net_device *netdev) rc =3D set_link_state(adapter, IBMVNIC_LOGICAL_LNK_UP); if (rc) { ibmvnic_napi_disable(adapter); - release_resources(adapter); + ibmvnic_disable_irqs(adapter); return rc; } =20 @@ -1468,9 +1469,6 @@ static int ibmvnic_open(struct net_device *netdev) rc =3D init_resources(adapter); if (rc) { netdev_err(netdev, "failed to initialize resources\n"); - release_resources(adapter); - release_rx_pools(adapter); - release_tx_pools(adapter); goto out; } } @@ -1487,6 +1485,13 @@ static int ibmvnic_open(struct net_device *netdev) adapter->state =3D VNIC_OPEN; rc =3D 0; } + + if (rc) { + release_resources(adapter); + release_rx_pools(adapter); + release_tx_pools(adapter); + } + return rc; } =20 --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F547C433F5 for ; Mon, 14 Feb 2022 10:38:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243700AbiBNKi5 (ORCPT ); Mon, 14 Feb 2022 05:38:57 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:49184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348688AbiBNKfy (ORCPT ); Mon, 14 Feb 2022 05:35:54 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81DCE193FB; Mon, 14 Feb 2022 02:02:13 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 170B160DB7; Mon, 14 Feb 2022 10:02:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CFC5DC340E9; Mon, 14 Feb 2022 10:02:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832932; bh=LEOfSxMZuEod8sNoK5GbKy9hMr9peXP/MVpD+L3jJ7g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h8ORmY+7ln70D5TrbjVWMqpQGeb1Upo0VhfnMxsS712GB/x/e5v1gdo3MeE1XIhOb BiEkmClBm6cnxKNrdxS9UATALnG4+xJJxqBE+4nRbV3RlRjq6apb2SD0rx1BMsqdRO J6nvQNXzJ5jc7D1ilkSS2JZ2w04Ojz+uxQPL+kEg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cai Huoqing , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 143/203] net: ethernet: litex: Add the dependency on HAS_IOMEM Date: Mon, 14 Feb 2022 10:26:27 +0100 Message-Id: <20220214092515.095578047@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Cai Huoqing [ Upstream commit 2427f03fb42f9dc14c53108f2c9b5563eb37e770 ] The LiteX driver uses devm io function API which needs HAS_IOMEM enabled, so add the dependency on HAS_IOMEM. Fixes: ee7da21ac4c3 ("net: Add driver for LiteX's LiteETH network interface= ") Signed-off-by: Cai Huoqing Link: https://lore.kernel.org/r/20220208013308.6563-1-cai.huoqing@linux.dev Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/net/ethernet/litex/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/litex/Kconfig b/drivers/net/ethernet/lite= x/Kconfig index f99adbf26ab4e..04345b929d8e5 100644 --- a/drivers/net/ethernet/litex/Kconfig +++ b/drivers/net/ethernet/litex/Kconfig @@ -17,7 +17,7 @@ if NET_VENDOR_LITEX =20 config LITEX_LITEETH tristate "LiteX Ethernet support" - depends on OF + depends on OF && HAS_IOMEM help If you wish to compile a kernel for hardware with a LiteX LiteEth device then you should answer Y to this. --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5FBE2C433EF for ; Mon, 14 Feb 2022 10:39:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348870AbiBNKjQ (ORCPT ); Mon, 14 Feb 2022 05:39:16 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:49848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349066AbiBNKgJ (ORCPT ); Mon, 14 Feb 2022 05:36:09 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DF93716C0; Mon, 14 Feb 2022 02:02:32 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AFCB560C7D; Mon, 14 Feb 2022 10:02:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FA79C340E9; Mon, 14 Feb 2022 10:02:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832951; bh=KMZanydpN5ZzMP4ZMc7kFo32JxkD+fkWnbCNlOEFnWM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v3GgYcLX6phNQKm/MBqlB+rcHic4XmJH7E5ID2vTL8lpaf5WPDwTWvILG5bcwXYRV aOFnD7A3gCZfrQjsyV6S2cAmjSIIi1TCzjzyMrN7sSoXZKrcGDSyFhwTL9Rfw3IP8g WU9lVYmt1ZzWQexzxPOzk8eeP4jRcFYfo1270WcQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , Cong Wang , syzbot , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 144/203] ipmr,ip6mr: acquire RTNL before calling ip[6]mr_free_table() on failure path Date: Mon, 14 Feb 2022 10:26:28 +0100 Message-Id: <20220214092515.132398554@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 5611a00697c8ecc5aad04392bea629e9d6a20463 ] ip[6]mr_free_table() can only be called under RTNL lock. RTNL: assertion failed at net/core/dev.c (10367) WARNING: CPU: 1 PID: 5890 at net/core/dev.c:10367 unregister_netdevice_many= +0x1246/0x1850 net/core/dev.c:10367 Modules linked in: CPU: 1 PID: 5890 Comm: syz-executor.2 Not tainted 5.16.0-syzkaller-11627-g4= 22ee58dc0ef #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Goo= gle 01/01/2011 RIP: 0010:unregister_netdevice_many+0x1246/0x1850 net/core/dev.c:10367 Code: 0f 85 9b ee ff ff e8 69 07 4b fa ba 7f 28 00 00 48 c7 c6 00 90 ae 8a = 48 c7 c7 40 90 ae 8a c6 05 6d b1 51 06 01 e8 8c 90 d8 01 <0f> 0b e9 70 ee f= f ff e8 3e 07 4b fa 4c 89 e7 e8 86 2a 59 fa e9 ee RSP: 0018:ffffc900046ff6e0 EFLAGS: 00010286 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000 RDX: ffff888050f51d00 RSI: ffffffff815fa008 RDI: fffff520008dfece RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: ffffffff815f3d6e R11: 0000000000000000 R12: 00000000fffffff4 R13: dffffc0000000000 R14: ffffc900046ff750 R15: ffff88807b7dc000 FS: 00007f4ab736e700(0000) GS:ffff8880b9d00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fee0b4f8990 CR3: 000000001e7d2000 CR4: 00000000003506e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: mroute_clean_tables+0x244/0xb40 net/ipv6/ip6mr.c:1509 ip6mr_free_table net/ipv6/ip6mr.c:389 [inline] ip6mr_rules_init net/ipv6/ip6mr.c:246 [inline] ip6mr_net_init net/ipv6/ip6mr.c:1306 [inline] ip6mr_net_init+0x3f0/0x4e0 net/ipv6/ip6mr.c:1298 ops_init+0xaf/0x470 net/core/net_namespace.c:140 setup_net+0x54f/0xbb0 net/core/net_namespace.c:331 copy_net_ns+0x318/0x760 net/core/net_namespace.c:475 create_new_namespaces+0x3f6/0xb20 kernel/nsproxy.c:110 copy_namespaces+0x391/0x450 kernel/nsproxy.c:178 copy_process+0x2e0c/0x7300 kernel/fork.c:2167 kernel_clone+0xe7/0xab0 kernel/fork.c:2555 __do_sys_clone+0xc8/0x110 kernel/fork.c:2672 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f4ab89f9059 Code: Unable to access opcode bytes at RIP 0x7f4ab89f902f. RSP: 002b:00007f4ab736e118 EFLAGS: 00000206 ORIG_RAX: 0000000000000038 RAX: ffffffffffffffda RBX: 00007f4ab8b0bf60 RCX: 00007f4ab89f9059 RDX: 0000000020000280 RSI: 0000000020000270 RDI: 0000000040200000 RBP: 00007f4ab8a5308d R08: 0000000020000300 R09: 0000000020000300 R10: 00000000200002c0 R11: 0000000000000206 R12: 0000000000000000 R13: 00007ffc3977cc1f R14: 00007f4ab736e300 R15: 0000000000022000 Fixes: f243e5a7859a ("ipmr,ip6mr: call ip6mr_free_table() on failure path") Signed-off-by: Eric Dumazet Cc: Cong Wang Reported-by: syzbot Link: https://lore.kernel.org/r/20220208053451.2885398-1-eric.dumazet@gmail= .com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- net/ipv4/ipmr.c | 2 ++ net/ipv6/ip6mr.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c index 2dda856ca2602..aea29d97f8dfa 100644 --- a/net/ipv4/ipmr.c +++ b/net/ipv4/ipmr.c @@ -261,7 +261,9 @@ static int __net_init ipmr_rules_init(struct net *net) return 0; =20 err2: + rtnl_lock(); ipmr_free_table(mrt); + rtnl_unlock(); err1: fib_rules_unregister(ops); return err; diff --git a/net/ipv6/ip6mr.c b/net/ipv6/ip6mr.c index 36ed9efb88254..6a4065d81aa91 100644 --- a/net/ipv6/ip6mr.c +++ b/net/ipv6/ip6mr.c @@ -248,7 +248,9 @@ static int __net_init ip6mr_rules_init(struct net *net) return 0; =20 err2: + rtnl_lock(); ip6mr_free_table(mrt); + rtnl_unlock(); err1: fib_rules_unregister(ops); return err; --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 657D6C433EF for ; Mon, 14 Feb 2022 10:39:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348877AbiBNKjT (ORCPT ); Mon, 14 Feb 2022 05:39:19 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:44096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349420AbiBNKgb (ORCPT ); Mon, 14 Feb 2022 05:36:31 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AC73715A5; Mon, 14 Feb 2022 02:02:45 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CA9B7B80CE0; Mon, 14 Feb 2022 10:02:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1AC02C340EF; Mon, 14 Feb 2022 10:02:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832954; bh=7LDs95ymi7OV85+xbBS8SAoB5UAExAJyb74/cAjDU14=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GqkafSEHdbwWoTbJr5MbAyR+p2TOiA11Z+mNVUgLFnax/KQV8mkKj8mI4vFZMYpuS UztVVBqB9zPbU16NHlQm89+/7IO9dlkjoRoYQvacB1njIHiv3PdOZESZGoJHp/UZhA p7LunvBB95ssRal8sp4RlLoZscp3ooekhuU5ml/o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Louis Peens , Simon Horman , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 145/203] nfp: flower: fix ida_idx not being released Date: Mon, 14 Feb 2022 10:26:29 +0100 Message-Id: <20220214092515.168524215@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Louis Peens [ Upstream commit 7db788ad627aabff2b74d4f1a3b68516d0fee0d7 ] When looking for a global mac index the extra NFP_TUN_PRE_TUN_IDX_BIT that gets set if nfp_flower_is_supported_bridge is true is not taken into account. Consequently the path that should release the ida_index in cleanup is never triggered, causing messages like: nfp 0000:02:00.0: nfp: Failed to offload MAC on br-ex. nfp 0000:02:00.0: nfp: Failed to offload MAC on br-ex. nfp 0000:02:00.0: nfp: Failed to offload MAC on br-ex. after NFP_MAX_MAC_INDEX number of reconfigs. Ultimately this lead to new tunnel flows not being offloaded. Fix this by unsetting the NFP_TUN_PRE_TUN_IDX_BIT before checking if the port is of type OTHER. Fixes: 2e0bc7f3cb55 ("nfp: flower: encode mac indexes with pre-tunnel rule = check") Signed-off-by: Louis Peens Signed-off-by: Simon Horman Link: https://lore.kernel.org/r/20220208101453.321949-1-simon.horman@corigi= ne.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- .../net/ethernet/netronome/nfp/flower/tunnel_conf.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c b/driv= ers/net/ethernet/netronome/nfp/flower/tunnel_conf.c index dfb4468fe287a..0a326e04e6923 100644 --- a/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c +++ b/drivers/net/ethernet/netronome/nfp/flower/tunnel_conf.c @@ -1011,6 +1011,7 @@ nfp_tunnel_del_shared_mac(struct nfp_app *app, struct= net_device *netdev, struct nfp_flower_repr_priv *repr_priv; struct nfp_tun_offloaded_mac *entry; struct nfp_repr *repr; + u16 nfp_mac_idx; int ida_idx; =20 entry =3D nfp_tunnel_lookup_offloaded_macs(app, mac); @@ -1029,8 +1030,6 @@ nfp_tunnel_del_shared_mac(struct nfp_app *app, struct= net_device *netdev, entry->bridge_count--; =20 if (!entry->bridge_count && entry->ref_count) { - u16 nfp_mac_idx; - nfp_mac_idx =3D entry->index & ~NFP_TUN_PRE_TUN_IDX_BIT; if (__nfp_tunnel_offload_mac(app, mac, nfp_mac_idx, false)) { @@ -1046,7 +1045,6 @@ nfp_tunnel_del_shared_mac(struct nfp_app *app, struct= net_device *netdev, =20 /* If MAC is now used by 1 repr set the offloaded MAC index to port. */ if (entry->ref_count =3D=3D 1 && list_is_singular(&entry->repr_list)) { - u16 nfp_mac_idx; int port, err; =20 repr_priv =3D list_first_entry(&entry->repr_list, @@ -1074,8 +1072,14 @@ nfp_tunnel_del_shared_mac(struct nfp_app *app, struc= t net_device *netdev, WARN_ON_ONCE(rhashtable_remove_fast(&priv->tun.offloaded_macs, &entry->ht_node, offloaded_macs_params)); + + if (nfp_flower_is_supported_bridge(netdev)) + nfp_mac_idx =3D entry->index & ~NFP_TUN_PRE_TUN_IDX_BIT; + else + nfp_mac_idx =3D entry->index; + /* If MAC has global ID then extract and free the ida entry. */ - if (nfp_tunnel_is_mac_idx_global(entry->index)) { + if (nfp_tunnel_is_mac_idx_global(nfp_mac_idx)) { ida_idx =3D nfp_tunnel_get_ida_from_global_mac_idx(entry->index); ida_simple_remove(&priv->tun.mac_off_ids, ida_idx); } --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65617C433F5 for ; Mon, 14 Feb 2022 10:39:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241696AbiBNKja (ORCPT ); Mon, 14 Feb 2022 05:39:30 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:49120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349609AbiBNKgi (ORCPT ); Mon, 14 Feb 2022 05:36:38 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A94F0AE57; Mon, 14 Feb 2022 02:02:55 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0B2CCB80DC8; Mon, 14 Feb 2022 10:02:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33762C36AF5; Mon, 14 Feb 2022 10:02:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832957; bh=h/90sFQJ4ADpeoVXdbJhADLAI2IKpcQnwVbtczvVWjg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aXGqKuXQosK0x0xRhQ9pnJ2nzhfSE+ZRcmu/3WbV6SRS0kaXLuUhCWKNtfbsGUy1Y 6QParT2nwoth8HPPNlINgyrj/VQPj5NdqCUC1KIJ91B/Fi7r+LfFe0vr66/WmcELr1 6PPNpmuUnnHfVdS1SurHDVGiGWUYOz5w6V+WsD6g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paolo Abeni , Vlad Buslov , Antoine Tenart , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 146/203] net: do not keep the dst cache when uncloning an skb dst and its metadata Date: Mon, 14 Feb 2022 10:26:30 +0100 Message-Id: <20220214092515.200574756@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Antoine Tenart [ Upstream commit cfc56f85e72f5b9c5c5be26dc2b16518d36a7868 ] When uncloning an skb dst and its associated metadata a new dst+metadata is allocated and the tunnel information from the old metadata is copied over there. The issue is the tunnel metadata has references to cached dst, which are copied along the way. When a dst+metadata refcount drops to 0 the metadata is freed including the cached dst entries. As they are also referenced in the initial dst+metadata, this ends up in UaFs. In practice the above did not happen because of another issue, the dst+metadata was never freed because its refcount never dropped to 0 (this will be fixed in a subsequent patch). Fix this by initializing the dst cache after copying the tunnel information from the old metadata to also unshare the dst cache. Fixes: d71785ffc7e7 ("net: add dst_cache to ovs vxlan lwtunnel") Cc: Paolo Abeni Reported-by: Vlad Buslov Tested-by: Vlad Buslov Signed-off-by: Antoine Tenart Acked-by: Paolo Abeni Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- include/net/dst_metadata.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/net/dst_metadata.h b/include/net/dst_metadata.h index 14efa0ded75dd..b997e0c1e3627 100644 --- a/include/net/dst_metadata.h +++ b/include/net/dst_metadata.h @@ -123,6 +123,19 @@ static inline struct metadata_dst *tun_dst_unclone(str= uct sk_buff *skb) =20 memcpy(&new_md->u.tun_info, &md_dst->u.tun_info, sizeof(struct ip_tunnel_info) + md_size); +#ifdef CONFIG_DST_CACHE + /* Unclone the dst cache if there is one */ + if (new_md->u.tun_info.dst_cache.cache) { + int ret; + + ret =3D dst_cache_init(&new_md->u.tun_info.dst_cache, GFP_ATOMIC); + if (ret) { + metadata_dst_free(new_md); + return ERR_PTR(ret); + } + } +#endif + skb_dst_drop(skb); dst_hold(&new_md->dst); skb_dst_set(skb, &new_md->dst); --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1E1D8C433EF for ; Mon, 14 Feb 2022 10:42:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349156AbiBNKk6 (ORCPT ); Mon, 14 Feb 2022 05:40:58 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349698AbiBNKgm (ORCPT ); Mon, 14 Feb 2022 05:36:42 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B94BE71C89; Mon, 14 Feb 2022 02:03:00 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 64ACB6077B; Mon, 14 Feb 2022 10:02:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44438C340E9; Mon, 14 Feb 2022 10:02:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832960; bh=hVUHZ5WyxrV1PseGE0Vyr2SlFfdW6bD0RR9iZNJtdkA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pg0bpoylg04zxxLgNz/7WbsufEb3eX/BEAsP+ovga0LxFGCWyNE2CBnpbPY0eG3VK vUPkBAWTaSAeGzABt3LPX/FrBvShl7jNQrs+/IxpKEjFagnGzu9JhjcSwSA4qD3F9c l5unk8s5qSmqXugWTRU+evfnzzNe6rIniPVJMlXg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pravin B Shelar , Vlad Buslov , Antoine Tenart , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 147/203] net: fix a memleak when uncloning an skb dst and its metadata Date: Mon, 14 Feb 2022 10:26:31 +0100 Message-Id: <20220214092515.230123382@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Antoine Tenart [ Upstream commit 9eeabdf17fa0ab75381045c867c370f4cc75a613 ] When uncloning an skb dst and its associated metadata, a new dst+metadata is allocated and later replaces the old one in the skb. This is helpful to have a non-shared dst+metadata attached to a specific skb. The issue is the uncloned dst+metadata is initialized with a refcount of 1, which is increased to 2 before attaching it to the skb. When tun_dst_unclone returns, the dst+metadata is only referenced from a single place (the skb) while its refcount is 2. Its refcount will never drop to 0 (when the skb is consumed), leading to a memory leak. Fix this by removing the call to dst_hold in tun_dst_unclone, as the dst+metadata refcount is already 1. Fixes: fc4099f17240 ("openvswitch: Fix egress tunnel info.") Cc: Pravin B Shelar Reported-by: Vlad Buslov Tested-by: Vlad Buslov Signed-off-by: Antoine Tenart Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- include/net/dst_metadata.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/net/dst_metadata.h b/include/net/dst_metadata.h index b997e0c1e3627..adab27ba1ecbf 100644 --- a/include/net/dst_metadata.h +++ b/include/net/dst_metadata.h @@ -137,7 +137,6 @@ static inline struct metadata_dst *tun_dst_unclone(stru= ct sk_buff *skb) #endif =20 skb_dst_drop(skb); - dst_hold(&new_md->dst); skb_dst_set(skb, &new_md->dst); return new_md; } --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 01EA0C433F5 for ; Mon, 14 Feb 2022 10:39:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348627AbiBNKjg (ORCPT ); Mon, 14 Feb 2022 05:39:36 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349561AbiBNKgg (ORCPT ); Mon, 14 Feb 2022 05:36:36 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7654A4190; Mon, 14 Feb 2022 02:02:53 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5302160C71; Mon, 14 Feb 2022 10:02:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21FC0C340E9; Mon, 14 Feb 2022 10:02:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832963; bh=ba2athLM4NQjC44TtaESWWuhwR9s3OHzSaYXfdB2oBI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tFy4df6FY4LrYjufTasTsFQMe6Xhm7+EGMdisairWElOCFQOlFc1tGRbBsFAyMvDR 5p/3byfO8PaBcGWMVaOpexKbWp88qLKi7hFaPNBChvpn+Hcry+P3tBUo6YCP6YTEZy hKa2ylwcbLBbHQUkt0cYAJR+rlAPT1ijaoppA3ms= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , Toshiaki Makita , syzbot , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 148/203] veth: fix races around rq->rx_notify_masked Date: Mon, 14 Feb 2022 10:26:32 +0100 Message-Id: <20220214092515.268180563@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 68468d8c4cd4222a4ca1f185ab5a1c14480d078c ] veth being NETIF_F_LLTX enabled, we need to be more careful whenever we read/write rq->rx_notify_masked. BUG: KCSAN: data-race in veth_xmit / veth_xmit write to 0xffff888133d9a9f8 of 1 bytes by task 23552 on cpu 0: __veth_xdp_flush drivers/net/veth.c:269 [inline] veth_xmit+0x307/0x470 drivers/net/veth.c:350 __netdev_start_xmit include/linux/netdevice.h:4683 [inline] netdev_start_xmit include/linux/netdevice.h:4697 [inline] xmit_one+0x105/0x2f0 net/core/dev.c:3473 dev_hard_start_xmit net/core/dev.c:3489 [inline] __dev_queue_xmit+0x86d/0xf90 net/core/dev.c:4116 dev_queue_xmit+0x13/0x20 net/core/dev.c:4149 br_dev_queue_push_xmit+0x3ce/0x430 net/bridge/br_forward.c:53 NF_HOOK include/linux/netfilter.h:307 [inline] br_forward_finish net/bridge/br_forward.c:66 [inline] NF_HOOK include/linux/netfilter.h:307 [inline] __br_forward+0x2e4/0x400 net/bridge/br_forward.c:115 br_flood+0x521/0x5c0 net/bridge/br_forward.c:242 br_dev_xmit+0x8b6/0x960 __netdev_start_xmit include/linux/netdevice.h:4683 [inline] netdev_start_xmit include/linux/netdevice.h:4697 [inline] xmit_one+0x105/0x2f0 net/core/dev.c:3473 dev_hard_start_xmit net/core/dev.c:3489 [inline] __dev_queue_xmit+0x86d/0xf90 net/core/dev.c:4116 dev_queue_xmit+0x13/0x20 net/core/dev.c:4149 neigh_hh_output include/net/neighbour.h:525 [inline] neigh_output include/net/neighbour.h:539 [inline] ip_finish_output2+0x6f8/0xb70 net/ipv4/ip_output.c:228 ip_finish_output+0xfb/0x240 net/ipv4/ip_output.c:316 NF_HOOK_COND include/linux/netfilter.h:296 [inline] ip_output+0xf3/0x1a0 net/ipv4/ip_output.c:430 dst_output include/net/dst.h:451 [inline] ip_local_out net/ipv4/ip_output.c:126 [inline] ip_send_skb+0x6e/0xe0 net/ipv4/ip_output.c:1570 udp_send_skb+0x641/0x880 net/ipv4/udp.c:967 udp_sendmsg+0x12ea/0x14c0 net/ipv4/udp.c:1254 inet_sendmsg+0x5f/0x80 net/ipv4/af_inet.c:819 sock_sendmsg_nosec net/socket.c:705 [inline] sock_sendmsg net/socket.c:725 [inline] ____sys_sendmsg+0x39a/0x510 net/socket.c:2413 ___sys_sendmsg net/socket.c:2467 [inline] __sys_sendmmsg+0x267/0x4c0 net/socket.c:2553 __do_sys_sendmmsg net/socket.c:2582 [inline] __se_sys_sendmmsg net/socket.c:2579 [inline] __x64_sys_sendmmsg+0x53/0x60 net/socket.c:2579 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae read to 0xffff888133d9a9f8 of 1 bytes by task 23563 on cpu 1: __veth_xdp_flush drivers/net/veth.c:268 [inline] veth_xmit+0x2d6/0x470 drivers/net/veth.c:350 __netdev_start_xmit include/linux/netdevice.h:4683 [inline] netdev_start_xmit include/linux/netdevice.h:4697 [inline] xmit_one+0x105/0x2f0 net/core/dev.c:3473 dev_hard_start_xmit net/core/dev.c:3489 [inline] __dev_queue_xmit+0x86d/0xf90 net/core/dev.c:4116 dev_queue_xmit+0x13/0x20 net/core/dev.c:4149 br_dev_queue_push_xmit+0x3ce/0x430 net/bridge/br_forward.c:53 NF_HOOK include/linux/netfilter.h:307 [inline] br_forward_finish net/bridge/br_forward.c:66 [inline] NF_HOOK include/linux/netfilter.h:307 [inline] __br_forward+0x2e4/0x400 net/bridge/br_forward.c:115 br_flood+0x521/0x5c0 net/bridge/br_forward.c:242 br_dev_xmit+0x8b6/0x960 __netdev_start_xmit include/linux/netdevice.h:4683 [inline] netdev_start_xmit include/linux/netdevice.h:4697 [inline] xmit_one+0x105/0x2f0 net/core/dev.c:3473 dev_hard_start_xmit net/core/dev.c:3489 [inline] __dev_queue_xmit+0x86d/0xf90 net/core/dev.c:4116 dev_queue_xmit+0x13/0x20 net/core/dev.c:4149 neigh_hh_output include/net/neighbour.h:525 [inline] neigh_output include/net/neighbour.h:539 [inline] ip_finish_output2+0x6f8/0xb70 net/ipv4/ip_output.c:228 ip_finish_output+0xfb/0x240 net/ipv4/ip_output.c:316 NF_HOOK_COND include/linux/netfilter.h:296 [inline] ip_output+0xf3/0x1a0 net/ipv4/ip_output.c:430 dst_output include/net/dst.h:451 [inline] ip_local_out net/ipv4/ip_output.c:126 [inline] ip_send_skb+0x6e/0xe0 net/ipv4/ip_output.c:1570 udp_send_skb+0x641/0x880 net/ipv4/udp.c:967 udp_sendmsg+0x12ea/0x14c0 net/ipv4/udp.c:1254 inet_sendmsg+0x5f/0x80 net/ipv4/af_inet.c:819 sock_sendmsg_nosec net/socket.c:705 [inline] sock_sendmsg net/socket.c:725 [inline] ____sys_sendmsg+0x39a/0x510 net/socket.c:2413 ___sys_sendmsg net/socket.c:2467 [inline] __sys_sendmmsg+0x267/0x4c0 net/socket.c:2553 __do_sys_sendmmsg net/socket.c:2582 [inline] __se_sys_sendmmsg net/socket.c:2579 [inline] __x64_sys_sendmmsg+0x53/0x60 net/socket.c:2579 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x44/0xd0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae value changed: 0x00 -> 0x01 Reported by Kernel Concurrency Sanitizer on: CPU: 1 PID: 23563 Comm: syz-executor.5 Not tainted 5.17.0-rc2-syzkaller-000= 64-gc36c04c2e132 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Goo= gle 01/01/2011 Fixes: 948d4f214fde ("veth: Add driver XDP") Signed-off-by: Eric Dumazet Cc: Toshiaki Makita Reported-by: syzbot Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/net/veth.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/net/veth.c b/drivers/net/veth.c index ecbc09cbe2590..f478fe7e2b820 100644 --- a/drivers/net/veth.c +++ b/drivers/net/veth.c @@ -272,9 +272,10 @@ static void __veth_xdp_flush(struct veth_rq *rq) { /* Write ptr_ring before reading rx_notify_masked */ smp_mb(); - if (!rq->rx_notify_masked) { - rq->rx_notify_masked =3D true; - napi_schedule(&rq->xdp_napi); + if (!READ_ONCE(rq->rx_notify_masked) && + napi_schedule_prep(&rq->xdp_napi)) { + WRITE_ONCE(rq->rx_notify_masked, true); + __napi_schedule(&rq->xdp_napi); } } =20 @@ -919,8 +920,10 @@ static int veth_poll(struct napi_struct *napi, int bud= get) /* Write rx_notify_masked before reading ptr_ring */ smp_store_mb(rq->rx_notify_masked, false); if (unlikely(!__ptr_ring_empty(&rq->xdp_ring))) { - rq->rx_notify_masked =3D true; - napi_schedule(&rq->xdp_napi); + if (napi_schedule_prep(&rq->xdp_napi)) { + WRITE_ONCE(rq->rx_notify_masked, true); + __napi_schedule(&rq->xdp_napi); + } } } =20 --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C137C433EF for ; Mon, 14 Feb 2022 10:41:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349257AbiBNKlB (ORCPT ); Mon, 14 Feb 2022 05:41:01 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:49110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349615AbiBNKgi (ORCPT ); Mon, 14 Feb 2022 05:36:38 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97C38A41A2; Mon, 14 Feb 2022 02:02:56 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5DB3760B31; Mon, 14 Feb 2022 10:02:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 367D5C340E9; Mon, 14 Feb 2022 10:02:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832966; bh=lUg6UgIUo1yE4iHE1a1K4H9EBvuK+VqmJ7QfNaWBFas=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0TxgY2Jyl5ZVkEyBKyRJH9ti72TThmy965Y5VKM9JC+ZtHsZ99mcN9JLyMx60S6Mc Xj2ZqAhJ4YZhmsFctpN/xmbMGeGzaTb1sAPz9n0Ct6Ts0QV7CdaqvFT06C9qIoac93 WjUFinVYAy0am6vqKGRW66E6Z7+N0EFUHWB1wrGo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joel Stanley , Andrew Lunn , Andrew Jeffery , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 149/203] net: mdio: aspeed: Add missing MODULE_DEVICE_TABLE Date: Mon, 14 Feb 2022 10:26:33 +0100 Message-Id: <20220214092515.309426817@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Joel Stanley [ Upstream commit bc1c3c3b10db4f37c41e6107751a8d450d9c431c ] Fix loading of the driver when built as a module. Fixes: f160e99462c6 ("net: phy: Add mdio-aspeed") Signed-off-by: Joel Stanley Reviewed-by: Andrew Lunn Acked-by: Andrew Jeffery Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/net/mdio/mdio-aspeed.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/mdio/mdio-aspeed.c b/drivers/net/mdio/mdio-aspeed.c index 966c3b4ad59d1..e2273588c75b6 100644 --- a/drivers/net/mdio/mdio-aspeed.c +++ b/drivers/net/mdio/mdio-aspeed.c @@ -148,6 +148,7 @@ static const struct of_device_id aspeed_mdio_of_match[]= =3D { { .compatible =3D "aspeed,ast2600-mdio", }, { }, }; +MODULE_DEVICE_TABLE(of, aspeed_mdio_of_match); =20 static struct platform_driver aspeed_mdio_driver =3D { .driver =3D { --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 155FEC433FE for ; Mon, 14 Feb 2022 10:35:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348291AbiBNKfM (ORCPT ); Mon, 14 Feb 2022 05:35:12 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348264AbiBNKe0 (ORCPT ); Mon, 14 Feb 2022 05:34:26 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82120CC0; Mon, 14 Feb 2022 02:01:07 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 32A09B80DBF; Mon, 14 Feb 2022 10:01:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 524F9C340E9; Mon, 14 Feb 2022 10:01:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832864; bh=htPT7ZJRwec3btt28+wtKwzLxrimdxWXFf2+yFhzDzo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SQnrOGNB8L8B56WFPD3ixpPJRiEvVvWL1bKPgLKhp8dlSlQmwrFrP51cMD0vSQmx/ QAnrEljTGHkuy5irPocRLwCrq/BddzQHC6ftO3DV4Y5Qu5t+hlrq7l6y67TU4TQGZc x68mkbmZX5O5XwH3X0DEzOCQoVmVYCIdAHmUcawM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jon Maloy , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 150/203] tipc: rate limit warning for received illegal binding update Date: Mon, 14 Feb 2022 10:26:34 +0100 Message-Id: <20220214092515.347997816@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jon Maloy [ Upstream commit c7223d687758462826a20e9735305d55bb874c70 ] It would be easy to craft a message containing an illegal binding table update operation. This is handled correctly by the code, but the corresponding warning printout is not rate limited as is should be. We fix this now. Fixes: b97bf3fd8f6a ("[TIPC] Initial merge") Signed-off-by: Jon Maloy Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- net/tipc/name_distr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c index bda902caa8147..8267b751a526a 100644 --- a/net/tipc/name_distr.c +++ b/net/tipc/name_distr.c @@ -313,7 +313,7 @@ static bool tipc_update_nametbl(struct net *net, struct= distr_item *i, pr_warn_ratelimited("Failed to remove binding %u,%u from %u\n", ua.sr.type, ua.sr.lower, node); } else { - pr_warn("Unrecognized name table message received\n"); + pr_warn_ratelimited("Unknown name table message received\n"); } return false; } --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83AD8C433F5 for ; Mon, 14 Feb 2022 10:35:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348389AbiBNKfR (ORCPT ); Mon, 14 Feb 2022 05:35:17 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347953AbiBNKea (ORCPT ); Mon, 14 Feb 2022 05:34:30 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BE24CC9; Mon, 14 Feb 2022 02:01:10 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4E854B80DC4; Mon, 14 Feb 2022 10:01:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 66017C340E9; Mon, 14 Feb 2022 10:01:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832868; bh=/DjVnQ7jgYXBQt/wqucYtc26jeqXAAs5ubdP37etpC8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O09v8fiNrg28DC/0PVBnfQLUOSCocFCltqxtikvZDMaJ/ZuF1dnrsezzGFZktLSzA YGstCq0lOQEMxY8xbxJkkwuOBDIpDERx8MiqccQbm836V07R1k6FvJw/TlcMe+rBx6 dyyFWtI+ppuCC1h5cOjrq67i3B/uy6iR/C/tjSnw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Selwin Sebastian , Raju Rangoju , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 151/203] net: amd-xgbe: disable interrupts during pci removal Date: Mon, 14 Feb 2022 10:26:35 +0100 Message-Id: <20220214092515.385356389@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Raju Rangoju [ Upstream commit 68c2d6af1f1e469544d6cbe9a601d96fb9c00e7f ] Hardware interrupts are enabled during the pci probe, however, they are not disabled during pci removal. Disable all hardware interrupts during pci removal to avoid any issues. Fixes: e75377404726 ("amd-xgbe: Update PCI support to use new IRQ functions= ") Suggested-by: Selwin Sebastian Signed-off-by: Raju Rangoju Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/net/ethernet/amd/xgbe/xgbe-pci.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-pci.c b/drivers/net/etherne= t/amd/xgbe/xgbe-pci.c index 90cb55eb54665..014513ce00a14 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-pci.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-pci.c @@ -418,6 +418,9 @@ static void xgbe_pci_remove(struct pci_dev *pdev) =20 pci_free_irq_vectors(pdata->pcidev); =20 + /* Disable all interrupts in the hardware */ + XP_IOWRITE(pdata, XP_INT_EN, 0x0); + xgbe_free_pdata(pdata); } =20 --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E1A8C433FE for ; Mon, 14 Feb 2022 10:35:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348461AbiBNKfa (ORCPT ); Mon, 14 Feb 2022 05:35:30 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347878AbiBNKec (ORCPT ); Mon, 14 Feb 2022 05:34:32 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F513CCB; Mon, 14 Feb 2022 02:01:12 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CBE4260B33; Mon, 14 Feb 2022 10:01:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93E09C340E9; Mon, 14 Feb 2022 10:01:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832871; bh=b/rW6f0Dsg0WzuWtDuW0qjocZXcNKX3ee7GrgJuuhY8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2ZnJnbFun8oMHiSzRQTlGKMohS2JnkyebzUuZ+IcYdlxLDxp3A1q97P7MND+nid4z D8t/OPwCzHRyXMQvZ9ntnTuLLMiWZEe2W0ZFjfK3DgKKhDqHhBskujP+oQVcCo/Tgx 7lzlOLXtyITSr79AEMqcUAT6ZSkGtTEz6Kx7pstI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rafael Richter , Vladimir Oltean , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 152/203] net: dsa: fix panic when DSA master device unbinds on shutdown Date: Mon, 14 Feb 2022 10:26:36 +0100 Message-Id: <20220214092515.419944498@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean [ Upstream commit ee534378f00561207656663d93907583958339ae ] Rafael reports that on a system with LX2160A and Marvell DSA switches, if a reboot occurs while the DSA master (dpaa2-eth) is up, the following panic can be seen: systemd-shutdown[1]: Rebooting. Unable to handle kernel paging request at virtual address 00a0000800000041 [00a0000800000041] address between user and kernel address ranges Internal error: Oops: 96000004 [#1] PREEMPT SMP CPU: 6 PID: 1 Comm: systemd-shutdow Not tainted 5.16.5-00042-g8f5585009b24 = #32 pc : dsa_slave_netdevice_event+0x130/0x3e4 lr : raw_notifier_call_chain+0x50/0x6c Call trace: dsa_slave_netdevice_event+0x130/0x3e4 raw_notifier_call_chain+0x50/0x6c call_netdevice_notifiers_info+0x54/0xa0 __dev_close_many+0x50/0x130 dev_close_many+0x84/0x120 unregister_netdevice_many+0x130/0x710 unregister_netdevice_queue+0x8c/0xd0 unregister_netdev+0x20/0x30 dpaa2_eth_remove+0x68/0x190 fsl_mc_driver_remove+0x20/0x5c __device_release_driver+0x21c/0x220 device_release_driver_internal+0xac/0xb0 device_links_unbind_consumers+0xd4/0x100 __device_release_driver+0x94/0x220 device_release_driver+0x28/0x40 bus_remove_device+0x118/0x124 device_del+0x174/0x420 fsl_mc_device_remove+0x24/0x40 __fsl_mc_device_remove+0xc/0x20 device_for_each_child+0x58/0xa0 dprc_remove+0x90/0xb0 fsl_mc_driver_remove+0x20/0x5c __device_release_driver+0x21c/0x220 device_release_driver+0x28/0x40 bus_remove_device+0x118/0x124 device_del+0x174/0x420 fsl_mc_bus_remove+0x80/0x100 fsl_mc_bus_shutdown+0xc/0x1c platform_shutdown+0x20/0x30 device_shutdown+0x154/0x330 __do_sys_reboot+0x1cc/0x250 __arm64_sys_reboot+0x20/0x30 invoke_syscall.constprop.0+0x4c/0xe0 do_el0_svc+0x4c/0x150 el0_svc+0x24/0xb0 el0t_64_sync_handler+0xa8/0xb0 el0t_64_sync+0x178/0x17c It can be seen from the stack trace that the problem is that the deregistration of the master causes a dev_close(), which gets notified as NETDEV_GOING_DOWN to dsa_slave_netdevice_event(). But dsa_switch_shutdown() has already run, and this has unregistered the DSA slave interfaces, and yet, the NETDEV_GOING_DOWN handler attempts to call dev_close_many() on those slave interfaces, leading to the problem. The previous attempt to avoid the NETDEV_GOING_DOWN on the master after dsa_switch_shutdown() was called seems improper. Unregistering the slave interfaces is unnecessary and unhelpful. Instead, after the slaves have stopped being uppers of the DSA master, we can now reset to NULL the master->dsa_ptr pointer, which will make DSA start ignoring all future notifier events on the master. Fixes: 0650bf52b31f ("net: dsa: be compatible with masters which unregister= on shutdown") Reported-by: Rafael Richter Signed-off-by: Vladimir Oltean Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- net/dsa/dsa2.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index 826957b6442b0..7578b1350f182 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -1609,7 +1609,6 @@ EXPORT_SYMBOL_GPL(dsa_unregister_switch); void dsa_switch_shutdown(struct dsa_switch *ds) { struct net_device *master, *slave_dev; - LIST_HEAD(unregister_list); struct dsa_port *dp; =20 mutex_lock(&dsa2_mutex); @@ -1620,25 +1619,13 @@ void dsa_switch_shutdown(struct dsa_switch *ds) slave_dev =3D dp->slave; =20 netdev_upper_dev_unlink(master, slave_dev); - /* Just unlinking ourselves as uppers of the master is not - * sufficient. When the master net device unregisters, that will - * also call dev_close, which we will catch as NETDEV_GOING_DOWN - * and trigger a dev_close on our own devices (dsa_slave_close). - * In turn, that will call dev_mc_unsync on the master's net - * device. If the master is also a DSA switch port, this will - * trigger dsa_slave_set_rx_mode which will call dev_mc_sync on - * its own master. Lockdep will complain about the fact that - * all cascaded masters have the same dsa_master_addr_list_lock_key, - * which it normally would not do if the cascaded masters would - * be in a proper upper/lower relationship, which we've just - * destroyed. - * To suppress the lockdep warnings, let's actually unregister - * the DSA slave interfaces too, to avoid the nonsensical - * multicast address list synchronization on shutdown. - */ - unregister_netdevice_queue(slave_dev, &unregister_list); } - unregister_netdevice_many(&unregister_list); + + /* Disconnect from further netdevice notifiers on the master, + * since netdev_uses_dsa() will now return false. + */ + dsa_switch_for_each_cpu_port(dp, ds) + dp->master->dsa_ptr =3D NULL; =20 rtnl_unlock(); mutex_unlock(&dsa2_mutex); --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90AA1C433EF for ; Mon, 14 Feb 2022 10:35:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348472AbiBNKfj (ORCPT ); Mon, 14 Feb 2022 05:35:39 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348046AbiBNKec (ORCPT ); Mon, 14 Feb 2022 05:34:32 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 384A3CD1; Mon, 14 Feb 2022 02:01:17 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C6B2860B33; Mon, 14 Feb 2022 10:01:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5CB2C340EF; Mon, 14 Feb 2022 10:01:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832874; bh=jDo5x2v7N8+8V51OVZjkSFtEpo9lxkpc0iqzSltGxko=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MbgCaF2DmdvepFKkE601kb2LVhmnu5T5lXjKACAWHTFIvPcjwgObm7zl6nTD6/qOf DH1I8j5ZEjXz2uASAgPEMyDeZPNojSpyL0IBwdeYW2kAw2wII5pMmYAq120up1FCXC l81D5GYgYesseQM4AWjwQqBvX6+vx40KNHIPaXQc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yang Wang , Kenneth Feng , Alex Deucher , Sasha Levin Subject: [PATCH 5.16 153/203] drm/amd/pm: fix hwmon node of power1_label create issue Date: Mon, 14 Feb 2022 10:26:37 +0100 Message-Id: <20220214092515.452156089@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Wang [ Upstream commit a8b1e8636a3252daa729762b2e3cc9015cc91a5c ] it will cause hwmon node of power1_label is not created. v2: the hwmon node of "power1_label" is always needed for all ASICs. and the patch will remove ASIC type check for "power1_label". Fixes: ae07970a0621d6 ("drm/amd/pm: add support for hwmon control of slow a= nd fast PPT limit on vangogh") Signed-off-by: Yang Wang Reviewed-by: Kenneth Feng Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/am= dgpu_pm.c index f8370d54100e8..d31719b3418fa 100644 --- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c +++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c @@ -3451,8 +3451,7 @@ static umode_t hwmon_attributes_visible(struct kobjec= t *kobj, attr =3D=3D &sensor_dev_attr_power2_cap_min.dev_attr.attr || attr =3D=3D &sensor_dev_attr_power2_cap.dev_attr.attr || attr =3D=3D &sensor_dev_attr_power2_cap_default.dev_attr.attr || - attr =3D=3D &sensor_dev_attr_power2_label.dev_attr.attr || - attr =3D=3D &sensor_dev_attr_power1_label.dev_attr.attr)) + attr =3D=3D &sensor_dev_attr_power2_label.dev_attr.attr)) return 0; =20 return effective_mode; --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F9BFC433F5 for ; Mon, 14 Feb 2022 10:37:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348525AbiBNKfn (ORCPT ); Mon, 14 Feb 2022 05:35:43 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348171AbiBNKel (ORCPT ); Mon, 14 Feb 2022 05:34:41 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C7E51CE5; Mon, 14 Feb 2022 02:01:19 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 84161B80DCD; Mon, 14 Feb 2022 10:01:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B693BC340F0; Mon, 14 Feb 2022 10:01:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832877; bh=GNEWetQrwebJFihNGopC2dg0VX/rGux39dWCMrIO/Hw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vTcFPptOUNwvWQHVhJSc70hl2zOpuJlW0aUz3EKVj+OxxagDC6vnLAKY18q5ksoGV QEwzMOW8uzQVso60xfsVp5jSzg+QGmtDAFrFEJ1CXNT+tZvJiKDNW2lxszVCWNZQTA 3mSETLB1kmaalOL+zxHR1LPP1drNzmpxhJc1v6tQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geliang Tang , Kishen Maloor , Mat Martineau , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 154/203] mptcp: netlink: process IPv6 addrs in creating listening sockets Date: Mon, 14 Feb 2022 10:26:38 +0100 Message-Id: <20220214092515.484395190@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kishen Maloor [ Upstream commit 029744cd4bc6e9eb3bd833b4a033348296d34645 ] This change updates mptcp_pm_nl_create_listen_socket() to create listening sockets bound to IPv6 addresses (where IPv6 is supported). Fixes: 1729cf186d8a ("mptcp: create the listening socket for new port") Acked-by: Geliang Tang Signed-off-by: Kishen Maloor Signed-off-by: Mat Martineau Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- net/mptcp/pm_netlink.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/net/mptcp/pm_netlink.c b/net/mptcp/pm_netlink.c index 5d305fafd0e99..5eada95dd76b3 100644 --- a/net/mptcp/pm_netlink.c +++ b/net/mptcp/pm_netlink.c @@ -878,6 +878,7 @@ static int mptcp_pm_nl_append_new_local_addr(struct pm_= nl_pernet *pernet, static int mptcp_pm_nl_create_listen_socket(struct sock *sk, struct mptcp_pm_addr_entry *entry) { + int addrlen =3D sizeof(struct sockaddr_in); struct sockaddr_storage addr; struct mptcp_sock *msk; struct socket *ssock; @@ -902,8 +903,11 @@ static int mptcp_pm_nl_create_listen_socket(struct soc= k *sk, } =20 mptcp_info2sockaddr(&entry->addr, &addr, entry->addr.family); - err =3D kernel_bind(ssock, (struct sockaddr *)&addr, - sizeof(struct sockaddr_in)); +#if IS_ENABLED(CONFIG_MPTCP_IPV6) + if (entry->addr.family =3D=3D AF_INET6) + addrlen =3D sizeof(struct sockaddr_in6); +#endif + err =3D kernel_bind(ssock, (struct sockaddr *)&addr, addrlen); if (err) { pr_warn("kernel_bind error, err=3D%d", err); goto out; --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 178BEC433EF for ; Mon, 14 Feb 2022 10:37:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348045AbiBNKhH (ORCPT ); Mon, 14 Feb 2022 05:37:07 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348267AbiBNKel (ORCPT ); Mon, 14 Feb 2022 05:34:41 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CABDAD61; Mon, 14 Feb 2022 02:01:22 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 808E0B80DCD; Mon, 14 Feb 2022 10:01:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F21EC340E9; Mon, 14 Feb 2022 10:01:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832880; bh=5oRXJ9iYbP6bvP3H+2211ccCJikkhXoMnaErPQRQCtw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rNm7BAxBDKJVrF68571OKyZTsCFusJBn+XmZhrzTOlLcEaU1EAcQbXzjC/lNlkakN 7NbxcgF/Pr0WpYzSwiPMqdOMpwax12I7iYtUwPZdDl6k5SnfySQqeWhtF2dsdfcD+z i/6y71vybYvYltWzp9MI/4GZMK9uT57fgpN+K67A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert-Ionut Alexa , Ioana Ciornei , "David S. Miller" , Sasha Levin Subject: [PATCH 5.16 155/203] dpaa2-eth: unregister the netdev before disconnecting from the PHY Date: Mon, 14 Feb 2022 10:26:39 +0100 Message-Id: <20220214092515.514862032@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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-Ionut Alexa [ Upstream commit 9ccc6e0c8959a019bb40f6b18704b142c04b19a8 ] The netdev should be unregistered before we are disconnecting from the MAC/PHY so that the dev_close callback is called and the PHY and the phylink workqueues are actually stopped before we are disconnecting and destroying the phylink instance. Fixes: 719479230893 ("dpaa2-eth: add MAC/PHY support through phylink") Signed-off-by: Robert-Ionut Alexa Signed-off-by: Ioana Ciornei Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c b/drivers/net= /ethernet/freescale/dpaa2/dpaa2-eth.c index 8e643567abce2..70c8dd6cf3508 100644 --- a/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c +++ b/drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c @@ -4523,12 +4523,12 @@ static int dpaa2_eth_remove(struct fsl_mc_device *l= s_dev) #ifdef CONFIG_DEBUG_FS dpaa2_dbg_remove(priv); #endif + + unregister_netdev(net_dev); rtnl_lock(); dpaa2_eth_disconnect_mac(priv); rtnl_unlock(); =20 - unregister_netdev(net_dev); - dpaa2_eth_dl_port_del(priv); dpaa2_eth_dl_traps_unregister(priv); dpaa2_eth_dl_free(priv); --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69816C43219 for ; Mon, 14 Feb 2022 10:37:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347370AbiBNKhN (ORCPT ); Mon, 14 Feb 2022 05:37:13 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348284AbiBNKem (ORCPT ); Mon, 14 Feb 2022 05:34:42 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A29DD63; Mon, 14 Feb 2022 02:01:24 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0A8B860C24; Mon, 14 Feb 2022 10:01:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC959C340EF; Mon, 14 Feb 2022 10:01:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832883; bh=KhUiQzWhj0GxiVPcv6HPZho3XJSPH5zYWYny4xePs4U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KE36TMzHgJi2rwqpAKHVfAW0dgz4dy0UxzuXUp+/EegeH4HApCgR1qcwhDJNamSCp BKyDrJ4A7+aXxGJTgmDMqPAb67bPr2FI8O767KbNG1bwCNI39TNK/OxfwD4aqxgd2o p962z9i22EAYv+5VIPxNTd74fIOb8rtAtYxehntY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Gurucharan G , Tony Nguyen , Sasha Levin Subject: [PATCH 5.16 156/203] ice: fix an error code in ice_cfg_phy_fec() Date: Mon, 14 Feb 2022 10:26:40 +0100 Message-Id: <20220214092515.546172227@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 21338d58736ef70eaae5fd75d567a358ff7902f9 ] Propagate the error code from ice_get_link_default_override() instead of returning success. Fixes: ea78ce4dab05 ("ice: add link lenient and default override support") Signed-off-by: Dan Carpenter Tested-by: Gurucharan G Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/net/ethernet/intel/ice/ice_common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ice/ice_common.c b/drivers/net/ethe= rnet/intel/ice/ice_common.c index b3066d0fea8ba..e9a0159cb8b92 100644 --- a/drivers/net/ethernet/intel/ice/ice_common.c +++ b/drivers/net/ethernet/intel/ice/ice_common.c @@ -3321,7 +3321,8 @@ ice_cfg_phy_fec(struct ice_port_info *pi, struct ice_= aqc_set_phy_cfg_data *cfg, !ice_fw_supports_report_dflt_cfg(hw)) { struct ice_link_default_override_tlv tlv; =20 - if (ice_get_link_default_override(&tlv, pi)) + status =3D ice_get_link_default_override(&tlv, pi); + if (status) goto out; =20 if (!(tlv.options & ICE_LINK_OVERRIDE_STRICT_MODE) && --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3770C4321E for ; Mon, 14 Feb 2022 10:37:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348517AbiBNKhT (ORCPT ); Mon, 14 Feb 2022 05:37:19 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348285AbiBNKem (ORCPT ); Mon, 14 Feb 2022 05:34:42 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78AEFD65; Mon, 14 Feb 2022 02:01:29 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2B303B80DC8; Mon, 14 Feb 2022 10:01:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29594C340EF; Mon, 14 Feb 2022 10:01:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832886; bh=FD7hxa2jEtY6i1xVR5DzXc/fIJ+b4smOrkuJF1LIwOY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iCpXDv2+ntAYNjpILrH4tHWmqMGGMkjcI4/HIBEoDvHD9Hw9qBlJtulUQMgfv049a +W7vmQ4z8gwCKUXC5zkkJsF0HPE1XKN73TcgLrEHToiYWdqz/iH4CQ57tqG0yI1a0n 0T47YgIB24p7VZ6knk5mFJuA5Xfh4Dlr4rDWLlxg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jesse Brandeburg , Paul Menzel , Gurucharan G , Tony Nguyen , Sasha Levin Subject: [PATCH 5.16 157/203] ice: fix IPIP and SIT TSO offload Date: Mon, 14 Feb 2022 10:26:41 +0100 Message-Id: <20220214092515.579789231@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jesse Brandeburg [ Upstream commit 46b699c50c0304cdbd725d7740073a7f9d5edb10 ] The driver was avoiding offload for IPIP (at least) frames due to parsing the inner header offsets incorrectly when trying to check lengths. This length check works for VXLAN frames but fails on IPIP frames because skb_transport_offset points to the inner header in IPIP frames, which meant the subtraction of transport_header from inner_network_header returns a negative value (-20). With the code before this patch, everything continued to work, but GSO was being used to segment, causing throughputs of 1.5Gb/s per thread. After this patch, throughput is more like 10Gb/s per thread for IPIP traffic. Fixes: e94d44786693 ("ice: Implement filter sync, NDO operations and bump v= ersion") Signed-off-by: Jesse Brandeburg Reviewed-by: Paul Menzel Tested-by: Gurucharan G Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- .../net/ethernet/intel/ice/ice_lan_tx_rx.h | 1 + drivers/net/ethernet/intel/ice/ice_main.c | 25 +++++++++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h b/drivers/net/e= thernet/intel/ice/ice_lan_tx_rx.h index d981dc6f23235..85a612838a898 100644 --- a/drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h +++ b/drivers/net/ethernet/intel/ice/ice_lan_tx_rx.h @@ -568,6 +568,7 @@ struct ice_tx_ctx_desc { (0x3FFFFULL << ICE_TXD_CTX_QW1_TSO_LEN_S) =20 #define ICE_TXD_CTX_QW1_MSS_S 50 +#define ICE_TXD_CTX_MIN_MSS 64 =20 #define ICE_TXD_CTX_QW1_VSI_S 50 #define ICE_TXD_CTX_QW1_VSI_M (0x3FFULL << ICE_TXD_CTX_QW1_VSI_S) diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethern= et/intel/ice/ice_main.c index 73c61cdb036f9..68d3de6d42218 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -8540,6 +8540,7 @@ ice_features_check(struct sk_buff *skb, struct net_device __always_unused *netdev, netdev_features_t features) { + bool gso =3D skb_is_gso(skb); size_t len; =20 /* No point in doing any of this if neither checksum nor GSO are @@ -8552,24 +8553,32 @@ ice_features_check(struct sk_buff *skb, /* We cannot support GSO if the MSS is going to be less than * 64 bytes. If it is then we need to drop support for GSO. */ - if (skb_is_gso(skb) && (skb_shinfo(skb)->gso_size < 64)) + if (gso && (skb_shinfo(skb)->gso_size < ICE_TXD_CTX_MIN_MSS)) features &=3D ~NETIF_F_GSO_MASK; =20 - len =3D skb_network_header(skb) - skb->data; + len =3D skb_network_offset(skb); if (len > ICE_TXD_MACLEN_MAX || len & 0x1) goto out_rm_features; =20 - len =3D skb_transport_header(skb) - skb_network_header(skb); + len =3D skb_network_header_len(skb); if (len > ICE_TXD_IPLEN_MAX || len & 0x1) goto out_rm_features; =20 if (skb->encapsulation) { - len =3D skb_inner_network_header(skb) - skb_transport_header(skb); - if (len > ICE_TXD_L4LEN_MAX || len & 0x1) - goto out_rm_features; + /* this must work for VXLAN frames AND IPIP/SIT frames, and in + * the case of IPIP frames, the transport header pointer is + * after the inner header! So check to make sure that this + * is a GRE or UDP_TUNNEL frame before doing that math. + */ + if (gso && (skb_shinfo(skb)->gso_type & + (SKB_GSO_GRE | SKB_GSO_UDP_TUNNEL))) { + len =3D skb_inner_network_header(skb) - + skb_transport_header(skb); + if (len > ICE_TXD_L4LEN_MAX || len & 0x1) + goto out_rm_features; + } =20 - len =3D skb_inner_transport_header(skb) - - skb_inner_network_header(skb); + len =3D skb_inner_network_header_len(skb); if (len > ICE_TXD_IPLEN_MAX || len & 0x1) goto out_rm_features; } --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D6B0C433EF for ; Mon, 14 Feb 2022 10:37:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348564AbiBNKhY (ORCPT ); Mon, 14 Feb 2022 05:37:24 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348292AbiBNKem (ORCPT ); Mon, 14 Feb 2022 05:34:42 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEAD9D6A; Mon, 14 Feb 2022 02:01:32 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 68C6BB80DD5; Mon, 14 Feb 2022 10:01:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50D1CC340EF; Mon, 14 Feb 2022 10:01:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832890; bh=XqiW59tqA5tURicwKmtRFK/00GoJ67mH+dt7Y8YvL9I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PtZ5KbU9Yf2fkzDIwn6KvbQwRS1P72oF7RTwAEiR4yw9PZymqvMQIo3lPphR8KZWR 4du/cDqrY8MQxbTDrMJWw8gG/L7qm65K3HLt3rOM9k9hPq8cBfkyeoy2ktcDdp0WXx 2leHdPlUDSSmKQDnlglyJKA7ltIzFa5J/Emp2/7I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Ertman , Jonathan Toppins , Sunitha Mekala , Tony Nguyen , Sasha Levin Subject: [PATCH 5.16 158/203] ice: Fix KASAN error in LAG NETDEV_UNREGISTER handler Date: Mon, 14 Feb 2022 10:26:42 +0100 Message-Id: <20220214092515.612374050@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Ertman [ Upstream commit bea1898f65b9b7096cb4e73e97c83b94718f1fa1 ] Currently, the same handler is called for both a NETDEV_BONDING_INFO LAG unlink notification as for a NETDEV_UNREGISTER call. This is causing a problem though, since the netdev_notifier_info passed has a different structure depending on which event is passed. The problem manifests as a call trace from a BUG: KASAN stack-out-of-bounds error. Fix this by creating a handler specific to NETDEV_UNREGISTER that only is passed valid elements in the netdev_notifier_info struct for the NETDEV_UNREGISTER event. Also included is the removal of an unbalanced dev_put on the peer_netdev and related braces. Fixes: 6a8b357278f5 ("ice: Respond to a NETDEV_UNREGISTER event for LAG") Signed-off-by: Dave Ertman Acked-by: Jonathan Toppins Tested-by: Sunitha Mekala Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/net/ethernet/intel/ice/ice_lag.c | 34 +++++++++++++++++++----- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_lag.c b/drivers/net/etherne= t/intel/ice/ice_lag.c index e375ac849aecd..4f954db01b929 100644 --- a/drivers/net/ethernet/intel/ice/ice_lag.c +++ b/drivers/net/ethernet/intel/ice/ice_lag.c @@ -204,17 +204,39 @@ ice_lag_unlink(struct ice_lag *lag, lag->upper_netdev =3D NULL; } =20 - if (lag->peer_netdev) { - dev_put(lag->peer_netdev); - lag->peer_netdev =3D NULL; - } - + lag->peer_netdev =3D NULL; ice_set_sriov_cap(pf); ice_set_rdma_cap(pf); lag->bonded =3D false; lag->role =3D ICE_LAG_NONE; } =20 +/** + * ice_lag_unregister - handle netdev unregister events + * @lag: LAG info struct + * @netdev: netdev reporting the event + */ +static void ice_lag_unregister(struct ice_lag *lag, struct net_device *net= dev) +{ + struct ice_pf *pf =3D lag->pf; + + /* check to see if this event is for this netdev + * check that we are in an aggregate + */ + if (netdev !=3D lag->netdev || !lag->bonded) + return; + + if (lag->upper_netdev) { + dev_put(lag->upper_netdev); + lag->upper_netdev =3D NULL; + ice_set_sriov_cap(pf); + ice_set_rdma_cap(pf); + } + /* perform some cleanup in case we come back */ + lag->bonded =3D false; + lag->role =3D ICE_LAG_NONE; +} + /** * ice_lag_changeupper_event - handle LAG changeupper event * @lag: LAG info struct @@ -307,7 +329,7 @@ ice_lag_event_handler(struct notifier_block *notif_blk,= unsigned long event, ice_lag_info_event(lag, ptr); break; case NETDEV_UNREGISTER: - ice_lag_unlink(lag, ptr); + ice_lag_unregister(lag, netdev); break; default: break; --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83AF0C433FE for ; Mon, 14 Feb 2022 10:37:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348592AbiBNKhc (ORCPT ); Mon, 14 Feb 2022 05:37:32 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348320AbiBNKes (ORCPT ); Mon, 14 Feb 2022 05:34:48 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2DAEE22; Mon, 14 Feb 2022 02:01:35 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5999EB80D6D; Mon, 14 Feb 2022 10:01:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E90CC340F0; Mon, 14 Feb 2022 10:01:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832893; bh=CZc73YvIudVlmaabKNEr9mCZRnN0qITgpADm3Omyavk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qssJumIX6xDNef2AuteVgpHq9OVcDm+N9aUqwocGXE7guWoJvKtwqfFuwiApT/6dO fFjlaJx/mhf+lZ5xZh4jLuPVdsh1ZOCoe2T4adgplORzrZ67/SnkjxHGkHT/KgvpHO 4Q7iAiOQFf14eHITWl/uj9vcA+AfDX44vCHn+6nY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Ertman , Jonathan Toppins , Gurucharan G , Tony Nguyen , Sasha Levin Subject: [PATCH 5.16 159/203] ice: Avoid RTNL lock when re-creating auxiliary device Date: Mon, 14 Feb 2022 10:26:43 +0100 Message-Id: <20220214092515.644027305@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Ertman [ Upstream commit 5dbbbd01cbba831233c6ea9a3e6bfa133606d3c0 ] If a call to re-create the auxiliary device happens in a context that has already taken the RTNL lock, then the call flow that recreates auxiliary device can hang if there is another attempt to claim the RTNL lock by the auxiliary driver. To avoid this, any call to re-create auxiliary devices that comes from an source that is holding the RTNL lock (e.g. netdev notifier when interface exits a bond) should execute in a separate thread. To accomplish this, add a flag to the PF that will be evaluated in the service task and dealt with there. Fixes: f9f5301e7e2d ("ice: Register auxiliary device to provide RDMA") Signed-off-by: Dave Ertman Reviewed-by: Jonathan Toppins Tested-by: Gurucharan G Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/net/ethernet/intel/ice/ice.h | 3 ++- drivers/net/ethernet/intel/ice/ice_main.c | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/in= tel/ice/ice.h index b2db39ee5f85c..b3e1fc6a0a8eb 100644 --- a/drivers/net/ethernet/intel/ice/ice.h +++ b/drivers/net/ethernet/intel/ice/ice.h @@ -483,6 +483,7 @@ enum ice_pf_flags { ICE_FLAG_VF_TRUE_PROMISC_ENA, ICE_FLAG_MDD_AUTO_RESET_VF, ICE_FLAG_LINK_LENIENT_MODE_ENA, + ICE_FLAG_PLUG_AUX_DEV, ICE_PF_FLAGS_NBITS /* must be last */ }; =20 @@ -880,7 +881,7 @@ static inline void ice_set_rdma_cap(struct ice_pf *pf) if (pf->hw.func_caps.common_cap.rdma && pf->num_rdma_msix) { set_bit(ICE_FLAG_RDMA_ENA, pf->flags); set_bit(ICE_FLAG_AUX_ENA, pf->flags); - ice_plug_aux_dev(pf); + set_bit(ICE_FLAG_PLUG_AUX_DEV, pf->flags); } } =20 diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethern= et/intel/ice/ice_main.c index 68d3de6d42218..5b4be432b60ce 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -2235,6 +2235,9 @@ static void ice_service_task(struct work_struct *work) return; } =20 + if (test_and_clear_bit(ICE_FLAG_PLUG_AUX_DEV, pf->flags)) + ice_plug_aux_dev(pf); + ice_clean_adminq_subtask(pf); ice_check_media_subtask(pf); ice_check_for_hang_subtask(pf); --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 78704C433EF for ; Mon, 14 Feb 2022 10:37:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348373AbiBNKhw (ORCPT ); Mon, 14 Feb 2022 05:37:52 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348339AbiBNKes (ORCPT ); Mon, 14 Feb 2022 05:34:48 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0C551115F; Mon, 14 Feb 2022 02:01:42 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AFADEB80DFE; Mon, 14 Feb 2022 10:01:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6140C340F0; Mon, 14 Feb 2022 10:01:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832899; bh=73+Jfh2LwBaG5LGIUyw6QX/yEA7vXUv691IUNXbaKZQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V5haO/ByeFs6Jl1biw1UKZrLiFjvb4twcYZ59dxp1KxFP9tRPMvXYMkWg5/ypZAx0 JNg1bRyhlVe5MICJU+NFnPHIlfwlJkONJqK1U7LpRgaa6R1jl2jcp2aMLh+jkjPduo wr6SXy20pNX7Zq2HH2CYBdPXqF+xFXHNxwtS5soA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Foster , Vladimir Oltean , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 160/203] net: mscc: ocelot: fix mutex lock error during ethtool stats read Date: Mon, 14 Feb 2022 10:26:44 +0100 Message-Id: <20220214092515.675063913@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Colin Foster [ Upstream commit 7fbf6795d127a3b1bb39b0e42579904cf6db1624 ] An ongoing workqueue populates the stats buffer. At the same time, a user might query the statistics. While writing to the buffer is mutex-locked, reading from the buffer wasn't. This could lead to buggy reads by ethtool. This patch fixes the former blamed commit, but the bug was introduced in the latter. Signed-off-by: Colin Foster Fixes: 1e1caa9735f90 ("ocelot: Clean up stats update deferred work") Fixes: a556c76adc052 ("net: mscc: Add initial Ocelot switch support") Reported-by: Vladimir Oltean Reviewed-by: Vladimir Oltean Link: https://lore.kernel.org/all/20220210150451.416845-2-colin.foster@in-a= dvantage.com/ Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/net/ethernet/mscc/ocelot.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc= /ocelot.c index ac5849436d021..02edd383dea22 100644 --- a/drivers/net/ethernet/mscc/ocelot.c +++ b/drivers/net/ethernet/mscc/ocelot.c @@ -1609,12 +1609,11 @@ void ocelot_get_strings(struct ocelot *ocelot, int = port, u32 sset, u8 *data) } EXPORT_SYMBOL(ocelot_get_strings); =20 +/* Caller must hold &ocelot->stats_lock */ static void ocelot_update_stats(struct ocelot *ocelot) { int i, j; =20 - mutex_lock(&ocelot->stats_lock); - for (i =3D 0; i < ocelot->num_phys_ports; i++) { /* Configure the port to read the stats from */ ocelot_write(ocelot, SYS_STAT_CFG_STAT_VIEW(i), SYS_STAT_CFG); @@ -1633,8 +1632,6 @@ static void ocelot_update_stats(struct ocelot *ocelot) ~(u64)U32_MAX) + val; } } - - mutex_unlock(&ocelot->stats_lock); } =20 static void ocelot_check_stats_work(struct work_struct *work) @@ -1643,7 +1640,9 @@ static void ocelot_check_stats_work(struct work_struc= t *work) struct ocelot *ocelot =3D container_of(del_work, struct ocelot, stats_work); =20 + mutex_lock(&ocelot->stats_lock); ocelot_update_stats(ocelot); + mutex_unlock(&ocelot->stats_lock); =20 queue_delayed_work(ocelot->stats_queue, &ocelot->stats_work, OCELOT_STATS_CHECK_DELAY); @@ -1653,12 +1652,16 @@ void ocelot_get_ethtool_stats(struct ocelot *ocelot= , int port, u64 *data) { int i; =20 + mutex_lock(&ocelot->stats_lock); + /* check and update now */ ocelot_update_stats(ocelot); =20 /* Copy all counters */ for (i =3D 0; i < ocelot->num_stats; i++) *data++ =3D ocelot->stats[port * ocelot->num_stats + i]; + + mutex_unlock(&ocelot->stats_lock); } EXPORT_SYMBOL(ocelot_get_ethtool_stats); =20 --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C67EC433F5 for ; Mon, 14 Feb 2022 10:37:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348580AbiBNKiC (ORCPT ); Mon, 14 Feb 2022 05:38:02 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348343AbiBNKes (ORCPT ); Mon, 14 Feb 2022 05:34:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3ADF6116A; Mon, 14 Feb 2022 02:01:44 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CCC3860909; Mon, 14 Feb 2022 10:01:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48C09C340EF; Mon, 14 Feb 2022 10:01:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832903; bh=hrcrTy0cRXNwgEcLdpsqXuhhWEcEWyiPMkeNf8MiMww=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eC1jJAzUd+pVOOspYzsyvv+L16D4x3rI3dfQ5nl+nAW/oak3Jok0WegHAGzE7EWZY UQZINjzRcISXxlnUaksu72Cihur/2+9BfbMrrZnxIGXeI7eh++wLSeb3kp3VrCRxRn +uSttIFg1vylxmEk/Cz6+VQFjZBHrWpQ89+v0yNg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rafael Richter , Vladimir Oltean , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.16 161/203] net: dsa: mv88e6xxx: fix use-after-free in mv88e6xxx_mdios_unregister Date: Mon, 14 Feb 2022 10:26:45 +0100 Message-Id: <20220214092515.706740856@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vladimir Oltean [ Upstream commit 51a04ebf21122d5c76a716ecd9bfc33ea44b2b39 ] Since struct mv88e6xxx_mdio_bus *mdio_bus is the bus->priv of something allocated with mdiobus_alloc_size(), this means that mdiobus_free(bus) will free the memory backing the mdio_bus as well. Therefore, the mdio_bus->list element is freed memory, but we continue to iterate through the list of MDIO buses using that list element. To fix this, use the proper list iterator that handles element deletion by keeping a copy of the list element next pointer. Fixes: f53a2ce893b2 ("net: dsa: mv88e6xxx: don't use devres for mdiobus") Reported-by: Rafael Richter Signed-off-by: Vladimir Oltean Link: https://lore.kernel.org/r/20220210174017.3271099-1-vladimir.oltean@nx= p.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/net/dsa/mv88e6xxx/chip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/c= hip.c index fcd648d0f6372..70cea1b95298a 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -3465,10 +3465,10 @@ static int mv88e6xxx_mdio_register(struct mv88e6xxx= _chip *chip, static void mv88e6xxx_mdios_unregister(struct mv88e6xxx_chip *chip) =20 { - struct mv88e6xxx_mdio_bus *mdio_bus; + struct mv88e6xxx_mdio_bus *mdio_bus, *p; struct mii_bus *bus; =20 - list_for_each_entry(mdio_bus, &chip->mdios, list) { + list_for_each_entry_safe(mdio_bus, p, &chip->mdios, list) { bus =3D mdio_bus->bus; =20 if (!mdio_bus->external) --=20 2.34.1 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 61827C433F5 for ; Mon, 14 Feb 2022 10:37:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348686AbiBNKho (ORCPT ); Mon, 14 Feb 2022 05:37:44 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348346AbiBNKes (ORCPT ); Mon, 14 Feb 2022 05:34:48 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1EF3117B; Mon, 14 Feb 2022 02:01:48 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9A4E4B80D6D; Mon, 14 Feb 2022 10:01:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A39BBC340E9; Mon, 14 Feb 2022 10:01:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832906; bh=CLfqbK5DAgyx3E+ykodxSz0Gwtxu7xIMZXMF5qlQwTE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JIw1bkAa+bJf2ejkLa/3FVSk9L0MAqNY4OlGfCljsKRL3ZyZ7WWi5Y18hH3Cjoxjy 5XR5zsV4oHjedP96wHf8MMUDvPpkbWnS0Ua/XApGfLtHjdsRKq8+Nr9PNAbupL3DBZ yLeD3rtK87HA2Cbw7IQHrim1rv16+JEEc4Krzv+o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Johannesmeyer , Jakob Koschel Subject: [PATCH 5.16 162/203] vt_ioctl: fix array_index_nospec in vt_setactivate Date: Mon, 14 Feb 2022 10:26:46 +0100 Message-Id: <20220214092515.745236545@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jakob Koschel commit 61cc70d9e8ef5b042d4ed87994d20100ec8896d9 upstream. array_index_nospec ensures that an out-of-bounds value is set to zero on the transient path. Decreasing the value by one afterwards causes a transient integer underflow. vsa.console should be decreased first and then sanitized with array_index_nospec. Kasper Acknowledgements: Jakob Koschel, Brian Johannesmeyer, Kaveh Razavi, Herbert Bos, Cristiano Giuffrida from the VUSec group at VU Amsterdam. Co-developed-by: Brian Johannesmeyer Signed-off-by: Brian Johannesmeyer Signed-off-by: Jakob Koschel Link: https://lore.kernel.org/r/20220127144406.3589293-1-jakobkoschel@gmail= .com Cc: stable Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/tty/vt/vt_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/tty/vt/vt_ioctl.c +++ b/drivers/tty/vt/vt_ioctl.c @@ -599,8 +599,8 @@ static int vt_setactivate(struct vt_seta if (vsa.console =3D=3D 0 || vsa.console > MAX_NR_CONSOLES) return -ENXIO; =20 - vsa.console =3D array_index_nospec(vsa.console, MAX_NR_CONSOLES + 1); vsa.console--; + vsa.console =3D array_index_nospec(vsa.console, MAX_NR_CONSOLES); console_lock(); ret =3D vc_allocate(vsa.console); if (ret) { From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4270AC433EF for ; Mon, 14 Feb 2022 10:38:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239824AbiBNKiN (ORCPT ); Mon, 14 Feb 2022 05:38:13 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348351AbiBNKes (ORCPT ); Mon, 14 Feb 2022 05:34:48 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC29D25E1; Mon, 14 Feb 2022 02:01:51 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A3573B80DC8; Mon, 14 Feb 2022 10:01:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B8422C340E9; Mon, 14 Feb 2022 10:01:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832909; bh=8ub30ShdTLXwZFcoIMXYvvWBHyjJegmarl+2ns4BQYI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u2EEQpDfHgnvG80SrZmtfxyEJKCPn/C28o+gFBZ9g3rLV2Dx1OKhpUYvJy9fOlxg3 lKbViwXlDslSAg4gq/8ltVJg2wYfuEeFGQnVxoGdlWi8/7U+8VEhvfym7b4gCnUL8z koE5oxg8axHX4l7mUuAEh1qIUJDEFNW04gjZA1F4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Johannesmeyer , Jakob Koschel Subject: [PATCH 5.16 163/203] vt_ioctl: add array_index_nospec to VT_ACTIVATE Date: Mon, 14 Feb 2022 10:26:47 +0100 Message-Id: <20220214092515.778178192@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jakob Koschel commit 28cb138f559f8c1a1395f5564f86b8bbee83631b upstream. in vt_setactivate an almost identical code path has been patched with array_index_nospec. In the VT_ACTIVATE path the user input is from a system call argument instead of a usercopy. For consistency both code paths should have the same mitigations applied. Kasper Acknowledgements: Jakob Koschel, Brian Johannesmeyer, Kaveh Razavi, Herbert Bos, Cristiano Giuffrida from the VUSec group at VU Amsterdam. Co-developed-by: Brian Johannesmeyer Signed-off-by: Brian Johannesmeyer Signed-off-by: Jakob Koschel Link: https://lore.kernel.org/r/20220127144406.3589293-2-jakobkoschel@gmail= .com Cc: stable Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/tty/vt/vt_ioctl.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/tty/vt/vt_ioctl.c +++ b/drivers/tty/vt/vt_ioctl.c @@ -845,6 +845,7 @@ int vt_ioctl(struct tty_struct *tty, return -ENXIO; =20 arg--; + arg =3D array_index_nospec(arg, MAX_NR_CONSOLES); console_lock(); ret =3D vc_allocate(arg); console_unlock(); From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 150B1C433EF for ; Mon, 14 Feb 2022 10:38:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343616AbiBNKiT (ORCPT ); Mon, 14 Feb 2022 05:38:19 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348358AbiBNKet (ORCPT ); Mon, 14 Feb 2022 05:34:49 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C3936178; Mon, 14 Feb 2022 02:01:55 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D754FB80E0D; Mon, 14 Feb 2022 10:01:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5F86C340F2; Mon, 14 Feb 2022 10:01:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832912; bh=CZLhnC2bJWNiM3wvuHY9Uh4DOezRKY5x4zwTTBr13EM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EeFf9k9GrUeEg7NlNCMvkr/XPpFPJnbpQlgK67GLzrALXvmce2zsj54fkAv6eDpYl sNwrbCJfO+FHJY7lkrQJICA4oI375EzfjVF4Tctk/Tq6OYDEt9O+qxAGTmmABRXcST rBmNrhqMmQ2HYPd94B9rhrmuzBVFvnxWvqPFCX5s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kosuke Tatsukawa Subject: [PATCH 5.16 164/203] n_tty: wake up poll(POLLRDNORM) on receiving data Date: Mon, 14 Feb 2022 10:26:48 +0100 Message-Id: <20220214092515.810641912@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: TATSUKAWA KOSUKE (=E7=AB=8B=E5=B7=9D =E6=B1=9F=E4=BB=8B) commit c816b2e65b0e86b95011418cad334f0524fc33b8 upstream. The poll man page says POLLRDNORM is equivalent to POLLIN when used as an event. $ man poll POLLRDNORM Equivalent to POLLIN. However, in n_tty driver, POLLRDNORM does not return until timeout even if there is terminal input, whereas POLLIN returns. The following test program works until kernel-3.17, but the test stops in poll() after commit 57087d515441 ("tty: Fix spurious poll() wakeups"). [Steps to run test program] $ cc -o test-pollrdnorm test-pollrdnorm.c $ ./test-pollrdnorm foo <-- Type in something from the terminal followed by [RET]. The string should be echoed back. ------------------------< test-pollrdnorm.c >------------------------ #include #include #include #include void main(void) { int n; unsigned char buf[8]; struct pollfd fds[1] =3D {{ 0, POLLRDNORM, 0 }}; n =3D poll(fds, 1, -1); if (n < 0) perror("poll"); n =3D read(0, buf, 8); if (n < 0) perror("read"); if (n > 0) write(1, buf, n); } ------------------------------------------------------------------------ The attached patch fixes this problem. Many calls to wake_up_interruptible_poll() in the kernel source code already specify "POLLIN | POLLRDNORM". Fixes: 57087d515441 ("tty: Fix spurious poll() wakeups") Cc: stable@vger.kernel.org Signed-off-by: Kosuke Tatsukawa Link: https://lore.kernel.org/r/TYCPR01MB81901C0F932203D30E452B3EA5209@TYCP= R01MB8190.jpnprd01.prod.outlook.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/tty/n_tty.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c @@ -1369,7 +1369,7 @@ handle_newline: put_tty_queue(c, ldata); smp_store_release(&ldata->canon_head, ldata->read_head); kill_fasync(&tty->fasync, SIGIO, POLL_IN); - wake_up_interruptible_poll(&tty->read_wait, EPOLLIN); + wake_up_interruptible_poll(&tty->read_wait, EPOLLIN | EPOLLRDNORM); return; } } @@ -1589,7 +1589,7 @@ static void __receive_buf(struct tty_str =20 if (read_cnt(ldata)) { kill_fasync(&tty->fasync, SIGIO, POLL_IN); - wake_up_interruptible_poll(&tty->read_wait, EPOLLIN); + wake_up_interruptible_poll(&tty->read_wait, EPOLLIN | EPOLLRDNORM); } } =20 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A703FC433F5 for ; Mon, 14 Feb 2022 10:38:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242689AbiBNKi1 (ORCPT ); Mon, 14 Feb 2022 05:38:27 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242944AbiBNKet (ORCPT ); Mon, 14 Feb 2022 05:34:49 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A816B6463; Mon, 14 Feb 2022 02:01:58 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 631E8B80E0D; Mon, 14 Feb 2022 10:01:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF6A8C340EF; Mon, 14 Feb 2022 10:01:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832916; bh=Gj3Z9M/ZYEBo4oID8ujH6W/lVH/mp2oAgAzRkJJzenA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qvRHiilpnFwRC8LbEQiSTZBDZSLJg3a0HHWYXubVjQA8gkt0a5VlkKgZeGa1vAjZo kDBDe4m1Xg4UK9FmZW9YVlEqZ0VmlxYPsnUmLvkLhSIRlw2vcHbIYV/zZ6ysNYiJ2M Or9DqDgDcMBKxoEKvTIU0fiLrUMel6Q2/1xf7xiY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiner Kallweit , Jonas Malaco Subject: [PATCH 5.16 165/203] eeprom: ee1004: limit i2c reads to I2C_SMBUS_BLOCK_MAX Date: Mon, 14 Feb 2022 10:26:49 +0100 Message-Id: <20220214092515.850069036@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jonas Malaco commit c0689e46be23160d925dca95dfc411f1a0462708 upstream. Commit effa453168a7 ("i2c: i801: Don't silently correct invalid transfer size") revealed that ee1004_eeprom_read() did not properly limit how many bytes to read at once. In particular, i2c_smbus_read_i2c_block_data_or_emulated() takes the length to read as an u8. If count =3D=3D 256 after taking into account the offset and page boundary, the cast to u8 overflows. And this is common when user space tries to read the entire EEPROM at once. To fix it, limit each read to I2C_SMBUS_BLOCK_MAX (32) bytes, already the maximum length i2c_smbus_read_i2c_block_data_or_emulated() allows. Fixes: effa453168a7 ("i2c: i801: Don't silently correct invalid transfer si= ze") Cc: stable@vger.kernel.org Reviewed-by: Heiner Kallweit Signed-off-by: Jonas Malaco Link: https://lore.kernel.org/r/20220203165024.47767-1-jonas@protocubo.io Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/misc/eeprom/ee1004.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/misc/eeprom/ee1004.c +++ b/drivers/misc/eeprom/ee1004.c @@ -114,6 +114,9 @@ static ssize_t ee1004_eeprom_read(struct if (offset + count > EE1004_PAGE_SIZE) count =3D EE1004_PAGE_SIZE - offset; =20 + if (count > I2C_SMBUS_BLOCK_MAX) + count =3D I2C_SMBUS_BLOCK_MAX; + return i2c_smbus_read_i2c_block_data_or_emulated(client, offset, count, b= uf); } =20 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 40BEEC433EF for ; Mon, 14 Feb 2022 10:38:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348393AbiBNKid (ORCPT ); Mon, 14 Feb 2022 05:38:33 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348220AbiBNKeu (ORCPT ); Mon, 14 Feb 2022 05:34:50 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31CA3BC82; Mon, 14 Feb 2022 02:02:00 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C269B60DD3; Mon, 14 Feb 2022 10:01:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8ABB4C340E9; Mon, 14 Feb 2022 10:01:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832919; bh=kBk9rwrQ8IjaiqnLRz8c7PBbVQhRD4GH1Rd2rgHKem8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RvjieYAH13no9Zkm1DEE0tgyaEKYFNulGd8B1HMn1wDMLMRdEoKVUVVqJgw2DSOM0 bJ2NDungeGT9tJwSPWNPu0zopWgkgdnhNSOcHt/2n9ac/nxoQuKknVEdNY+/AU+ngI Fy7vKgD4a5N6FlURejBbXmsIDg6Ta1JU41lnWcjQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Amelie Delaunay , Minas Harutyunyan , Fabrice Gasnier Subject: [PATCH 5.16 166/203] usb: dwc2: drd: fix soft connect when gadget is unconfigured Date: Mon, 14 Feb 2022 10:26:50 +0100 Message-Id: <20220214092515.890891533@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 commit 269cbcf7b72de6f0016806d4a0cec1d689b55a87 upstream. When the gadget driver hasn't been (yet) configured, and the cable is connected to a HOST, the SFTDISCON gets cleared unconditionally, so the HOST tries to enumerate it. At the host side, this can result in a stuck USB port or worse. When getting lucky, some dmesg can be observed at the host side: new high-speed USB device number ... device descriptor read/64, error -110 Fix it in drd, by checking the enabled flag before calling dwc2_hsotg_core_connect(). It will be called later, once configured, by the normal flow: - udc_bind_to_driver - usb_gadget_connect - dwc2_hsotg_pullup - dwc2_hsotg_core_connect Fixes: 17f934024e84 ("usb: dwc2: override PHY input signals with usb role s= witch support") Cc: stable@kernel.org Reviewed-by: Amelie Delaunay Acked-by: Minas Harutyunyan Signed-off-by: Fabrice Gasnier Link: https://lore.kernel.org/r/1644423353-17859-1-git-send-email-fabrice.g= asnier@foss.st.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/usb/dwc2/drd.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/drivers/usb/dwc2/drd.c +++ b/drivers/usb/dwc2/drd.c @@ -109,8 +109,10 @@ static int dwc2_drd_role_sw_set(struct u already =3D dwc2_ovr_avalid(hsotg, true); } else if (role =3D=3D USB_ROLE_DEVICE) { already =3D dwc2_ovr_bvalid(hsotg, true); - /* This clear DCTL.SFTDISCON bit */ - dwc2_hsotg_core_connect(hsotg); + if (hsotg->enabled) { + /* This clear DCTL.SFTDISCON bit */ + dwc2_hsotg_core_connect(hsotg); + } } else { if (dwc2_is_device_mode(hsotg)) { if (!dwc2_ovr_bvalid(hsotg, false)) From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 994A1C4332F for ; Mon, 14 Feb 2022 10:40:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348241AbiBNKkm (ORCPT ); Mon, 14 Feb 2022 05:40:42 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348374AbiBNKfH (ORCPT ); Mon, 14 Feb 2022 05:35:07 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21CF0E0DA; Mon, 14 Feb 2022 02:02:03 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B333060DD9; Mon, 14 Feb 2022 10:02:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 832F0C340EF; Mon, 14 Feb 2022 10:02:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832922; bh=2bxlapIbZ7DOSdflx2EZloe76yIzRk8iWg3zk2A8E8w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CiLXei9GrM3w2SrHjf/ruxX4KE6zm/7WCFvLIy91mXNkkoseSK8Q9bsF9ndOC1bxk Yen7mIpmunNUx+x8xOsLT9tC+I/xxP3IObtslAhJXU92gynJ5bCjsYt+kUvkiUDVFy QvpiLc1or0c5eCtmZ9ra2qvFI2RbD8+oebPIGafM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , stable@kernel.org, Amelie Delaunay , Minas Harutyunyan , Fabrice Gasnier Subject: [PATCH 5.16 167/203] Revert "usb: dwc2: drd: fix soft connect when gadget is unconfigured" Date: Mon, 14 Feb 2022 10:26:51 +0100 Message-Id: <20220214092515.921302103@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 736e8d89044c1c330967fb938fa766cd9e0d8af0 upstream. This reverts commit 269cbcf7b72de6f0016806d4a0cec1d689b55a87. It causes build errors as reported by the kernel test robot. Link: https://lore.kernel.org/r/202202112236.AwoOTtHO-lkp@intel.com Reported-by: kernel test robot Fixes: 269cbcf7b72d ("usb: dwc2: drd: fix soft connect when gadget is uncon= figured") Cc: stable@kernel.org Cc: Amelie Delaunay Cc: Minas Harutyunyan Cc: Fabrice Gasnier Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/usb/dwc2/drd.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) --- a/drivers/usb/dwc2/drd.c +++ b/drivers/usb/dwc2/drd.c @@ -109,10 +109,8 @@ static int dwc2_drd_role_sw_set(struct u already =3D dwc2_ovr_avalid(hsotg, true); } else if (role =3D=3D USB_ROLE_DEVICE) { already =3D dwc2_ovr_bvalid(hsotg, true); - if (hsotg->enabled) { - /* This clear DCTL.SFTDISCON bit */ - dwc2_hsotg_core_connect(hsotg); - } + /* This clear DCTL.SFTDISCON bit */ + dwc2_hsotg_core_connect(hsotg); } else { if (dwc2_is_device_mode(hsotg)) { if (!dwc2_ovr_bvalid(hsotg, false)) From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B06E7C43217 for ; Mon, 14 Feb 2022 10:38:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348769AbiBNKim (ORCPT ); Mon, 14 Feb 2022 05:38:42 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348516AbiBNKfn (ORCPT ); Mon, 14 Feb 2022 05:35:43 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D51E13EBD; Mon, 14 Feb 2022 02:02:08 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id ECBBDB80E18; Mon, 14 Feb 2022 10:02:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02243C36AE2; Mon, 14 Feb 2022 10:02:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832925; bh=fv+WkH1spk8VErTFjZqgX1hkHlHoiWogpK/zEzaVGAA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BG6ppVaEajTZv0RvsbrIEyhf/CFgzhdhKJzmC2+9EqoiM4vtPpZeF2wIkbEXYFB5Z HYHcBHbwmn9hOY8BdzYVP9j+VEnISqEkwzjDhBSB/J00nsLTKMZZQm1dqi5hh0g2u/ Tsm/p2viZhBl1cSbvr57+3G6sUTB6KJjeEgcQ22Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Jann Horn Subject: [PATCH 5.16 168/203] net: usb: ax88179_178a: Fix out-of-bounds accesses in RX fixup Date: Mon, 14 Feb 2022 10:26:52 +0100 Message-Id: <20220214092515.953021947@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jann Horn commit 57bc3d3ae8c14df3ceb4e17d26ddf9eeab304581 upstream. ax88179_rx_fixup() contains several out-of-bounds accesses that can be triggered by a malicious (or defective) USB device, in particular: - The metadata array (hdr_off..hdr_off+2*pkt_cnt) can be out of bounds, causing OOB reads and (on big-endian systems) OOB endianness flips. - A packet can overlap the metadata array, causing a later OOB endianness flip to corrupt data used by a cloned SKB that has already been handed off into the network stack. - A packet SKB can be constructed whose tail is far beyond its end, causing out-of-bounds heap data to be considered part of the SKB's data. I have tested that this can be used by a malicious USB device to send a bogus ICMPv6 Echo Request and receive an ICMPv6 Echo Reply in response that contains random kernel heap data. It's probably also possible to get OOB writes from this on a little-endian system somehow - maybe by triggering skb_cow() via IP options processing -, but I haven't tested that. Fixes: e2ca90c276e1 ("ax88179_178a: ASIX AX88179_178A USB 3.0/2.0 to gigabi= t ethernet adapter driver") Cc: stable@kernel.org Signed-off-by: Jann Horn Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/net/usb/ax88179_178a.c | 68 +++++++++++++++++++++++-------------= ----- 1 file changed, 39 insertions(+), 29 deletions(-) --- a/drivers/net/usb/ax88179_178a.c +++ b/drivers/net/usb/ax88179_178a.c @@ -1467,58 +1467,68 @@ static int ax88179_rx_fixup(struct usbne u16 hdr_off; u32 *pkt_hdr; =20 - /* This check is no longer done by usbnet */ - if (skb->len < dev->net->hard_header_len) + /* At the end of the SKB, there's a header telling us how many packets + * are bundled into this buffer and where we can find an array of + * per-packet metadata (which contains elements encoded into u16). + */ + if (skb->len < 4) return 0; - skb_trim(skb, skb->len - 4); rx_hdr =3D get_unaligned_le32(skb_tail_pointer(skb)); - pkt_cnt =3D (u16)rx_hdr; hdr_off =3D (u16)(rx_hdr >> 16); + + if (pkt_cnt =3D=3D 0) + return 0; + + /* Make sure that the bounds of the metadata array are inside the SKB + * (and in front of the counter at the end). + */ + if (pkt_cnt * 2 + hdr_off > skb->len) + return 0; pkt_hdr =3D (u32 *)(skb->data + hdr_off); =20 - while (pkt_cnt--) { + /* Packets must not overlap the metadata array */ + skb_trim(skb, hdr_off); + + for (; ; pkt_cnt--, pkt_hdr++) { u16 pkt_len; =20 le32_to_cpus(pkt_hdr); pkt_len =3D (*pkt_hdr >> 16) & 0x1fff; =20 - /* Check CRC or runt packet */ - if ((*pkt_hdr & AX_RXHDR_CRC_ERR) || - (*pkt_hdr & AX_RXHDR_DROP_ERR)) { - skb_pull(skb, (pkt_len + 7) & 0xFFF8); - pkt_hdr++; - continue; - } - - if (pkt_cnt =3D=3D 0) { - skb->len =3D pkt_len; - /* Skip IP alignment pseudo header */ - skb_pull(skb, 2); - skb_set_tail_pointer(skb, skb->len); - skb->truesize =3D pkt_len + sizeof(struct sk_buff); - ax88179_rx_checksum(skb, pkt_hdr); - return 1; - } + if (pkt_len > skb->len) + return 0; =20 - ax_skb =3D skb_clone(skb, GFP_ATOMIC); - if (ax_skb) { + /* Check CRC or runt packet */ + if (((*pkt_hdr & (AX_RXHDR_CRC_ERR | AX_RXHDR_DROP_ERR)) =3D=3D 0) && + pkt_len >=3D 2 + ETH_HLEN) { + bool last =3D (pkt_cnt =3D=3D 0); + + if (last) { + ax_skb =3D skb; + } else { + ax_skb =3D skb_clone(skb, GFP_ATOMIC); + if (!ax_skb) + return 0; + } ax_skb->len =3D pkt_len; /* Skip IP alignment pseudo header */ skb_pull(ax_skb, 2); skb_set_tail_pointer(ax_skb, ax_skb->len); ax_skb->truesize =3D pkt_len + sizeof(struct sk_buff); ax88179_rx_checksum(ax_skb, pkt_hdr); + + if (last) + return 1; + usbnet_skb_return(dev, ax_skb); - } else { - return 0; } =20 - skb_pull(skb, (pkt_len + 7) & 0xFFF8); - pkt_hdr++; + /* Trim this packet away from the SKB */ + if (!skb_pull(skb, (pkt_len + 7) & 0xFFF8)) + return 0; } - return 1; } =20 static struct sk_buff * From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D92D6C433EF for ; Mon, 14 Feb 2022 10:38:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237267AbiBNKiq (ORCPT ); Mon, 14 Feb 2022 05:38:46 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348578AbiBNKfo (ORCPT ); Mon, 14 Feb 2022 05:35:44 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7503A1403D; Mon, 14 Feb 2022 02:02:10 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C55AA60DB6; Mon, 14 Feb 2022 10:02:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AB5FAC340E9; Mon, 14 Feb 2022 10:02:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832929; bh=QUbM7KdwbE8IIg6s+KSNgkwa6QdsfZam6rBpBp172II=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kBGvHjI5JppNAbR2scJpM2MgTyFlytrD0SZFvLxEpOR3AQBmMnauSbgXgGGM/BhyI Ee4NdFpiQ3AeQ+abuHv7IW7jzjfn14yggO7GJRyDOio3LAVgIwOYEsEb1vQtgSFxRB DeVU/S95b4Q64nmDBrFG9SHyhZ6O8AdvbpwEJFxA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heikki Krogerus , Sean Anderson Subject: [PATCH 5.16 169/203] usb: ulpi: Move of_node_put to ulpi_dev_release Date: Mon, 14 Feb 2022 10:26:53 +0100 Message-Id: <20220214092515.992255592@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Anderson commit 092f45b13e51666fe8ecbf2d6cd247aa7e6c1f74 upstream. Drivers are not unbound from the device when ulpi_unregister_interface is called. Move of_node-freeing code to ulpi_dev_release which is called only after all users are gone. Fixes: ef6a7bcfb01c ("usb: ulpi: Support device discovery via DT") Cc: stable Reviewed-by: Heikki Krogerus Signed-off-by: Sean Anderson Link: https://lore.kernel.org/r/20220127190004.1446909-2-sean.anderson@seco= .com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/usb/common/ulpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/usb/common/ulpi.c +++ b/drivers/usb/common/ulpi.c @@ -130,6 +130,7 @@ static const struct attribute_group *ulp =20 static void ulpi_dev_release(struct device *dev) { + of_node_put(dev->of_node); kfree(to_ulpi_dev(dev)); } =20 @@ -299,7 +300,6 @@ EXPORT_SYMBOL_GPL(ulpi_register_interfac */ void ulpi_unregister_interface(struct ulpi *ulpi) { - of_node_put(ulpi->dev.of_node); device_unregister(&ulpi->dev); } EXPORT_SYMBOL_GPL(ulpi_unregister_interface); From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38BD5C433F5 for ; Mon, 14 Feb 2022 10:38:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348790AbiBNKiu (ORCPT ); Mon, 14 Feb 2022 05:38:50 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348772AbiBNKf5 (ORCPT ); Mon, 14 Feb 2022 05:35:57 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B3D81EC5E; Mon, 14 Feb 2022 02:02:18 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DE52CB80D6D; Mon, 14 Feb 2022 10:02:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00C63C340E9; Mon, 14 Feb 2022 10:02:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832935; bh=Fp5vAxXHRBbOwHfsRp8stdkbEaQvx5accB522RMWaN0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PTkippBzqEyup8LQmn1VNLxBzzSRYNMCitbpGCyDJrRxcyLO6K2RBUN4G0SCAP+M5 mlNEMD/cXqtYDhSgexpTVf+BKg77tbi/Y63WSEDMRXjXf8R+NpFCP8poEEGuLxN80g cFq0OsmEEMnqcyranXAkgEwYKgwMBdJvN3fu8EsQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heikki Krogerus , Sean Anderson Subject: [PATCH 5.16 170/203] usb: ulpi: Call of_node_put correctly Date: Mon, 14 Feb 2022 10:26:54 +0100 Message-Id: <20220214092516.024667542@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Anderson commit 0a907ee9d95e3ac35eb023d71f29eae0aaa52d1b upstream. of_node_put should always be called on device nodes gotten from of_get_*. Additionally, it should only be called after there are no remaining users. To address the first issue, call of_node_put if later steps in ulpi_register fail. To address the latter, call put_device if device_register fails, which will call ulpi_dev_release if necessary. Fixes: ef6a7bcfb01c ("usb: ulpi: Support device discovery via DT") Cc: stable Reviewed-by: Heikki Krogerus Signed-off-by: Sean Anderson Link: https://lore.kernel.org/r/20220127190004.1446909-3-sean.anderson@seco= .com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/usb/common/ulpi.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/usb/common/ulpi.c +++ b/drivers/usb/common/ulpi.c @@ -248,12 +248,16 @@ static int ulpi_register(struct device * return ret; =20 ret =3D ulpi_read_id(ulpi); - if (ret) + if (ret) { + of_node_put(ulpi->dev.of_node); return ret; + } =20 ret =3D device_register(&ulpi->dev); - if (ret) + if (ret) { + put_device(&ulpi->dev); return ret; + } =20 dev_dbg(&ulpi->dev, "registered ULPI PHY: vendor %04x, product %04x\n", ulpi->id.vendor, ulpi->id.product); From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 892B3C433EF for ; Mon, 14 Feb 2022 10:38:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348812AbiBNKjB (ORCPT ); Mon, 14 Feb 2022 05:39:01 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:49182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348855AbiBNKgB (ORCPT ); Mon, 14 Feb 2022 05:36:01 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 482B8205CD; Mon, 14 Feb 2022 02:02:21 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id ECD66B80DCA; Mon, 14 Feb 2022 10:02:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15E71C340EF; Mon, 14 Feb 2022 10:02:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832938; bh=t432ehytwEm0n0pKMk01J/w73y/O1PlVDyrqrXrTCqU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pc11JNtkspuEy0MX5HYNwHaubWt6migG3PqWCmVFwZ0x8FUkS+Rz4fM9YeiXGti/I iLoq7IZIPoYCWg2IgrzpH4EV5pIf9h5zBoPOBewnmTmVWDEWtqXuTZ6YoLANjzezqg c5faa4QKKC0TsBYA9in+WZzpbARrWg5Wv7l0UyMM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavankumar Kondeti , Udipto Goswami Subject: [PATCH 5.16 171/203] usb: dwc3: gadget: Prevent core from processing stale TRBs Date: Mon, 14 Feb 2022 10:26:55 +0100 Message-Id: <20220214092516.057852698@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Udipto Goswami commit 117b4e96c7f362eb6459543883fc07f77662472c upstream. With CPU re-ordering on write instructions, there might be a chance that the HWO is set before the TRB is updated with the new mapped buffer address. And in the case where core is processing a list of TRBs it is possible that it fetched the TRBs when the HWO is set but before the buffer address is updated. Prevent this by adding a memory barrier before the HWO is updated to ensure that the core always process the updated TRBs. Fixes: f6bafc6a1c9d ("usb: dwc3: convert TRBs into bitshifts") Cc: stable Reviewed-by: Pavankumar Kondeti Signed-off-by: Udipto Goswami Link: https://lore.kernel.org/r/1644207958-18287-1-git-send-email-quic_ugos= wami@quicinc.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/usb/dwc3/gadget.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1271,6 +1271,19 @@ static void __dwc3_prepare_one_trb(struc if (usb_endpoint_xfer_bulk(dep->endpoint.desc) && dep->stream_capable) trb->ctrl |=3D DWC3_TRB_CTRL_SID_SOFN(stream_id); =20 + /* + * As per data book 4.2.3.2TRB Control Bit Rules section + * + * The controller autonomously checks the HWO field of a TRB to determine= if the + * entire TRB is valid. Therefore, software must ensure that the rest of = the TRB + * is valid before setting the HWO field to '1'. In most systems, this me= ans that + * software must update the fourth DWORD of a TRB last. + * + * However there is a possibility of CPU re-ordering here which can cause + * controller to observe the HWO bit set prematurely. + * Add a write memory barrier to prevent CPU re-ordering. + */ + wmb(); trb->ctrl |=3D DWC3_TRB_CTRL_HWO; =20 dwc3_ep_inc_enq(dep); From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06553C433F5 for ; Mon, 14 Feb 2022 10:41:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349087AbiBNKkw (ORCPT ); Mon, 14 Feb 2022 05:40:52 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348907AbiBNKgC (ORCPT ); Mon, 14 Feb 2022 05:36:02 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00FAC6578C; Mon, 14 Feb 2022 02:02:23 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B0CF5B80DA6; Mon, 14 Feb 2022 10:02:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9DB5C340E9; Mon, 14 Feb 2022 10:02:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832941; bh=lrgQINDT48P+sKYwHswUTTKmWWrF21F0fKyR27zr+30=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qg5nthrBUd8CvzGRDNhb+DVlMhNK45mdTDs4seiE+PiOOFDG/xvSU+DcIUexx2VmD Q5XbEzVZ/1RYBReDerUV2V6yqpCKfBx6Kl9taMO9AG8iunCA9lQJORSbqxhMFtFLbR UrSggCHkRM2oN5OxPaBjd0/FCa3pXHCaGnqDfBZ0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yoshihiro Shimoda , Adam Ford Subject: [PATCH 5.16 172/203] usb: gadget: udc: renesas_usb3: Fix host to USB_ROLE_NONE transition Date: Mon, 14 Feb 2022 10:26:56 +0100 Message-Id: <20220214092516.090095409@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Adam Ford commit 459702eea6132888b5c5b64c0e9c626da4ec2493 upstream. The support the external role switch a variety of situations were addressed, but the transition from USB_ROLE_HOST to USB_ROLE_NONE leaves the host up which can cause some error messages when switching from host to none, to gadget, to none, and then back to host again. xhci-hcd ee000000.usb: Abort failed to stop command ring: -110 xhci-hcd ee000000.usb: xHCI host controller not responding, assume dead xhci-hcd ee000000.usb: HC died; cleaning up usb 4-1: device not accepting address 6, error -108 usb usb4-port1: couldn't allocate usb_device After this happens it will not act as a host again. Fix this by releasing the host mode when transitioning to USB_ROLE_NONE. Fixes: 0604160d8c0b ("usb: gadget: udc: renesas_usb3: Enhance role switch s= upport") Cc: stable Reviewed-by: Yoshihiro Shimoda Signed-off-by: Adam Ford Link: https://lore.kernel.org/r/20220128223603.2362621-1-aford173@gmail.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/usb/gadget/udc/renesas_usb3.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/usb/gadget/udc/renesas_usb3.c +++ b/drivers/usb/gadget/udc/renesas_usb3.c @@ -2378,6 +2378,8 @@ static void handle_ext_role_switch_state switch (role) { case USB_ROLE_NONE: usb3->connection_state =3D USB_ROLE_NONE; + if (cur_role =3D=3D USB_ROLE_HOST) + device_release_driver(host); if (usb3->driver) usb3_disconnect(usb3); usb3_vbus_out(usb3, false); From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F0B2C433EF for ; Mon, 14 Feb 2022 10:39:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348856AbiBNKjL (ORCPT ); Mon, 14 Feb 2022 05:39:11 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348918AbiBNKgD (ORCPT ); Mon, 14 Feb 2022 05:36:03 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E15EB65793; Mon, 14 Feb 2022 02:02:25 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7E1986077B; Mon, 14 Feb 2022 10:02:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65C96C340E9; Mon, 14 Feb 2022 10:02:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832944; bh=NMjWGwPSU2DDunwZRA4fzUKy64zLoxOq04HsvxNVkF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=03qq2bwQl3GbyS2JY8YLwnNI8FAdsnRvsgZXRvSuU+1f9L3CMrdz1nnlqaUUzT6NZ yyxZE8NpE0iaFBz7Lety0Uj4qB+zz0l7LcFo/p+98iZvRTOfLv5am6YUL7zy47TVhz aKNykEyNQUf7iUO5/UZP+ITdZ86rEPoWHiMw0lMI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Szymon Heidrich , stable@kernel.org Subject: [PATCH 5.16 173/203] USB: gadget: validate interface OS descriptor requests Date: Mon, 14 Feb 2022 10:26:57 +0100 Message-Id: <20220214092516.122068022@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Szymon Heidrich commit 75e5b4849b81e19e9efe1654b30d7f3151c33c2c upstream. Stall the control endpoint in case provided index exceeds array size of MAX_CONFIG_INTERFACES or when the retrieved function pointer is null. Signed-off-by: Szymon Heidrich Cc: stable@kernel.org Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/usb/gadget/composite.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -1975,6 +1975,9 @@ unknown: if (w_index !=3D 0x5 || (w_value >> 8)) break; interface =3D w_value & 0xFF; + if (interface >=3D MAX_CONFIG_INTERFACES || + !os_desc_cfg->interface[interface]) + break; buf[6] =3D w_index; count =3D count_ext_prop(os_desc_cfg, interface); From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC05DC433F5 for ; Mon, 14 Feb 2022 10:41:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348450AbiBNKkq (ORCPT ); Mon, 14 Feb 2022 05:40:46 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348950AbiBNKgE (ORCPT ); Mon, 14 Feb 2022 05:36:04 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB32988B20; Mon, 14 Feb 2022 02:02:28 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8AEDF60C71; Mon, 14 Feb 2022 10:02:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60ED2C340E9; Mon, 14 Feb 2022 10:02:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832948; bh=iVVprejHhTHrKXydZFMArGB8nKpVGa/J/tekSOuOWgU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dNIreoc6mYSj22Kpag/ieTqREbHaTwIoWFhRfGwb6J7N5tQyHeTG2Xdj1HXma6cgi gq0KEAnNi/EY0X9CQUgeaoNwzSdF2zHf1+iUZW3+5ozIvrO6JbiQPHMSBa5cxLsOt7 MDNK8wnULmAWfgmb24gFKOUnDcf/ofrj87iG5hiQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Szymon Heidrich , stable@kernel.org Subject: [PATCH 5.16 174/203] usb: gadget: rndis: check size of RNDIS_MSG_SET command Date: Mon, 14 Feb 2022 10:26:58 +0100 Message-Id: <20220214092516.158278972@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 38ea1eac7d88072bbffb630e2b3db83ca649b826 upstream. Check the size of the RNDIS_MSG_SET command given to us before attempting to respond to an invalid message size. Reported-by: Szymon Heidrich Cc: stable@kernel.org Tested-by: Szymon Heidrich Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/usb/gadget/function/rndis.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- a/drivers/usb/gadget/function/rndis.c +++ b/drivers/usb/gadget/function/rndis.c @@ -637,14 +637,17 @@ static int rndis_set_response(struct rnd rndis_set_cmplt_type *resp; rndis_resp_t *r; =20 + BufLength =3D le32_to_cpu(buf->InformationBufferLength); + BufOffset =3D le32_to_cpu(buf->InformationBufferOffset); + if ((BufLength > RNDIS_MAX_TOTAL_SIZE) || + (BufOffset + 8 >=3D RNDIS_MAX_TOTAL_SIZE)) + return -EINVAL; + r =3D rndis_add_response(params, sizeof(rndis_set_cmplt_type)); if (!r) return -ENOMEM; resp =3D (rndis_set_cmplt_type *)r->buf; =20 - BufLength =3D le32_to_cpu(buf->InformationBufferLength); - BufOffset =3D le32_to_cpu(buf->InformationBufferOffset); - #ifdef VERBOSE_DEBUG pr_debug("%s: Length: %d\n", __func__, BufLength); pr_debug("%s: Offset: %d\n", __func__, BufOffset); From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A921EC433F5 for ; Mon, 14 Feb 2022 10:42:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232057AbiBNKnC (ORCPT ); Mon, 14 Feb 2022 05:43:02 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:60234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348970AbiBNKko (ORCPT ); Mon, 14 Feb 2022 05:40:44 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1572666CB3; Mon, 14 Feb 2022 02:04:24 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A8860B80DC8; Mon, 14 Feb 2022 10:04:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF2ECC340E9; Mon, 14 Feb 2022 10:04:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644833062; bh=mBqp5tWS/GEDaL2hMDTrZkhFXFJUE9ZWagq9X9n9vjE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HSf+mZLXsJTAWD8tbfSHKO1Uu1W2t8CV6e+OMrlkcv+OEh2XDM+MDB8x5mAUJOXZb qWNHE2ObMvdvPOwQ8mcAs1GApFnSydeRQaP6VKpqZ1nYCkOXrjdmr+dkBZuSc7EL4X GSdGCG/U0PdkOXnl2zi0i2VUw1ks9Yk5QL/PpOtw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Hofman Subject: [PATCH 5.16 175/203] usb: gadget: f_uac2: Define specific wTerminalType Date: Mon, 14 Feb 2022 10:26:59 +0100 Message-Id: <20220214092516.189804956@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pavel Hofman commit 5432184107cd0013761bdfa6cb6079527ef87b95 upstream. Several users have reported that their Win10 does not enumerate UAC2 gadget with the existing wTerminalType set to UAC_INPUT_TERMINAL_UNDEFINED/UAC_INPUT_TERMINAL_UNDEFINED, e.g. https://github.com/raspberrypi/linux/issues/4587#issuecomment-926567213. While the constant is officially defined by the USB terminal types document, e.g. XMOS firmware for UAC2 (commonly used for Win10) defines no undefined output terminal type in its usbaudio20.h header. Therefore wTerminalType of EP-IN is set to UAC_INPUT_TERMINAL_MICROPHONE and wTerminalType of EP-OUT to UAC_OUTPUT_TERMINAL_SPEAKER for the UAC2 gadget. Signed-off-by: Pavel Hofman Cc: stable Link: https://lore.kernel.org/r/20220131071813.7433-1-pavel.hofman@ivitera.= com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/usb/gadget/function/f_uac2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/usb/gadget/function/f_uac2.c +++ b/drivers/usb/gadget/function/f_uac2.c @@ -203,7 +203,7 @@ static struct uac2_input_terminal_descri =20 .bDescriptorSubtype =3D UAC_INPUT_TERMINAL, /* .bTerminalID =3D DYNAMIC */ - .wTerminalType =3D cpu_to_le16(UAC_INPUT_TERMINAL_UNDEFINED), + .wTerminalType =3D cpu_to_le16(UAC_INPUT_TERMINAL_MICROPHONE), .bAssocTerminal =3D 0, /* .bCSourceID =3D DYNAMIC */ .iChannelNames =3D 0, @@ -231,7 +231,7 @@ static struct uac2_output_terminal_descr =20 .bDescriptorSubtype =3D UAC_OUTPUT_TERMINAL, /* .bTerminalID =3D DYNAMIC */ - .wTerminalType =3D cpu_to_le16(UAC_OUTPUT_TERMINAL_UNDEFINED), + .wTerminalType =3D cpu_to_le16(UAC_OUTPUT_TERMINAL_SPEAKER), .bAssocTerminal =3D 0, /* .bSourceID =3D DYNAMIC */ /* .bCSourceID =3D DYNAMIC */ From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A93CCC433F5 for ; Mon, 14 Feb 2022 10:39:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348665AbiBNKjm (ORCPT ); Mon, 14 Feb 2022 05:39:42 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350003AbiBNKgt (ORCPT ); Mon, 14 Feb 2022 05:36:49 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 263EC9FFC; Mon, 14 Feb 2022 02:03:18 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C802B60DDD; Mon, 14 Feb 2022 10:02:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AAF06C340E9; Mon, 14 Feb 2022 10:02:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832973; bh=7dywxaiY+M967eUBC6Mz+LePl1QSR7NFa4x8qm8PoNw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fipJ4b1c+A6Ls1RP1F5vKTF0g1YsvMZphClVOoEFuCkKTBhWSg88zKBsvDivCzoSa TysQJNayLNdhpKrWFRwBwUtIXCK4oxObmJjvubVIrT1Gy/l6hclr4wLOH2gmCFI0iF ZAzlB6xF1OUP+/yYAzvmQghWn5981Cehi6wZG1sM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrey Konovalov , Jann Horn Subject: [PATCH 5.16 176/203] usb: raw-gadget: fix handling of dual-direction-capable endpoints Date: Mon, 14 Feb 2022 10:27:00 +0100 Message-Id: <20220214092516.223030292@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jann Horn commit 292d2c82b105d92082c2120a44a58de9767e44f1 upstream. Under dummy_hcd, every available endpoint is *either* IN or OUT capable. But with some real hardware, there are endpoints that support both IN and OUT. In particular, the PLX 2380 has four available endpoints that each support both IN and OUT. raw-gadget currently gets confused and thinks that any endpoint that is usable as an IN endpoint can never be used as an OUT endpoint. Fix it by looking at the direction in the configured endpoint descriptor instead of looking at the hardware capabilities. With this change, I can use the PLX 2380 with raw-gadget. Fixes: f2c2e717642c ("usb: gadget: add raw-gadget interface") Cc: stable Tested-by: Andrey Konovalov Reviewed-by: Andrey Konovalov Signed-off-by: Jann Horn Link: https://lore.kernel.org/r/20220126205214.2149936-1-jannh@google.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/usb/gadget/legacy/raw_gadget.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/usb/gadget/legacy/raw_gadget.c +++ b/drivers/usb/gadget/legacy/raw_gadget.c @@ -1004,7 +1004,7 @@ static int raw_process_ep_io(struct raw_ ret =3D -EBUSY; goto out_unlock; } - if ((in && !ep->ep->caps.dir_in) || (!in && ep->ep->caps.dir_in)) { + if (in !=3D usb_endpoint_dir_in(ep->ep->desc)) { dev_dbg(&dev->gadget->dev, "fail, wrong direction\n"); ret =3D -EINVAL; goto out_unlock; From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7FC0AC433F5 for ; Mon, 14 Feb 2022 10:40:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348672AbiBNKkV (ORCPT ); Mon, 14 Feb 2022 05:40:21 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350261AbiBNKhB (ORCPT ); Mon, 14 Feb 2022 05:37:01 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C249DA66F7; Mon, 14 Feb 2022 02:03:34 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 33265B80DC8; Mon, 14 Feb 2022 10:03:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D0DFC340F0; Mon, 14 Feb 2022 10:03:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644833008; bh=6e54lmGimgKn631egJa57mEvUiKAcn1kkE1kiEEqHbE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zQJTsUj9reYBILzgcvAEagdOSvmCgc28cSXAkrqPRvmAoNakKmkMD5N9bvIrWPo6p VxZUEuNG90yCzUC5A5VhPKF8keBIGC6UjekAsx3dhQULKJEydT/v1wN21f92ZjwLn8 OsLEXea5/NzcCLaEQ6D40ocgo8Q03v5xzwmi+47Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Cameron Williams , Johan Hovold Subject: [PATCH 5.16 177/203] USB: serial: ftdi_sio: add support for Brainboxes US-159/235/320 Date: Mon, 14 Feb 2022 10:27:01 +0100 Message-Id: <20220214092516.262397216@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 commit fbb9b194e15a63c56c5664e76ccd0e85c6100cea upstream. This patch adds support for the Brainboxes US-159, US-235 and US-320 USB-to-Serial devices. Signed-off-by: Cameron Williams Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/usb/serial/ftdi_sio.c | 3 +++ drivers/usb/serial/ftdi_sio_ids.h | 3 +++ 2 files changed, 6 insertions(+) --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -969,6 +969,7 @@ static const struct usb_device_id id_tab { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_VX_023_PID) }, { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_VX_034_PID) }, { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_101_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_159_PID) }, { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_1_PID) }, { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_2_PID) }, { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_3_PID) }, @@ -977,12 +978,14 @@ static const struct usb_device_id id_tab { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_6_PID) }, { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_7_PID) }, { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_160_8_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_235_PID) }, { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_257_PID) }, { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_279_1_PID) }, { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_279_2_PID) }, { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_279_3_PID) }, { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_279_4_PID) }, { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_313_PID) }, + { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_320_PID) }, { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_324_PID) }, { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_346_1_PID) }, { USB_DEVICE(BRAINBOXES_VID, BRAINBOXES_US_346_2_PID) }, --- a/drivers/usb/serial/ftdi_sio_ids.h +++ b/drivers/usb/serial/ftdi_sio_ids.h @@ -1506,6 +1506,9 @@ #define BRAINBOXES_VX_023_PID 0x1003 /* VX-023 ExpressCard 1 Port RS422/4= 85 */ #define BRAINBOXES_VX_034_PID 0x1004 /* VX-034 ExpressCard 2 Port RS422/4= 85 */ #define BRAINBOXES_US_101_PID 0x1011 /* US-101 1xRS232 */ +#define BRAINBOXES_US_159_PID 0x1021 /* US-159 1xRS232 */ +#define BRAINBOXES_US_235_PID 0x1017 /* US-235 1xRS232 */ +#define BRAINBOXES_US_320_PID 0x1019 /* US-320 1xRS422/485 */ #define BRAINBOXES_US_324_PID 0x1013 /* US-324 1xRS422/485 1Mbaud */ #define BRAINBOXES_US_606_1_PID 0x2001 /* US-606 6 Port RS232 Serial Port= 1 and 2 */ #define BRAINBOXES_US_606_2_PID 0x2002 /* US-606 6 Port RS232 Serial Port= 3 and 4 */ From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 033AAC433F5 for ; Mon, 14 Feb 2022 10:42:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350284AbiBNKmD (ORCPT ); Mon, 14 Feb 2022 05:42:03 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:49108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241787AbiBNKjv (ORCPT ); Mon, 14 Feb 2022 05:39:51 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BA34403F6; Mon, 14 Feb 2022 02:04:04 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3370DB80CE1; Mon, 14 Feb 2022 10:04:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 45886C340EF; Mon, 14 Feb 2022 10:04:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644833040; bh=dnqBjILIyPFJ4zWz2ADF95n2WkBQyD/RD3t0VOM3EjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dy1lcOl4QacOrDwMnp5K0LG7G4ksqT/tlLHk0+oHQgqlfCXB5t/4Rs96QC6u867GU qHLeHxTrWer4lLG9EIvWjsBct5lHaGZaVPnAJTUo3NBSAMQ8/ibHoXlvOBOXU+miND JVDtwakjsAAKynfZeCcub3PCNWU+2nrVqF2vyu2M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pawel Dembicki , Johan Hovold Subject: [PATCH 5.16 178/203] USB: serial: option: add ZTE MF286D modem Date: Mon, 14 Feb 2022 10:27:02 +0100 Message-Id: <20220214092516.295938960@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pawel Dembicki commit d48384c7ed6c8fe4727eaa0f3048f62afd1cd715 upstream. Modem from ZTE MF286D is an Qualcomm MDM9250 based 3G/4G modem. T: Bus=3D02 Lev=3D01 Prnt=3D01 Port=3D00 Cnt=3D01 Dev#=3D 3 Spd=3D5000 Mx= Ch=3D 0 D: Ver=3D 3.00 Cls=3D00(>ifc ) Sub=3D00 Prot=3D00 MxPS=3D 9 #Cfgs=3D 1 P: Vendor=3D19d2 ProdID=3D1485 Rev=3D52.87 S: Manufacturer=3DZTE,Incorporated S: Product=3DZTE Technologies MSM S: SerialNumber=3DMF286DZTED000000 C:* #Ifs=3D 7 Cfg#=3D 1 Atr=3D80 MxPwr=3D896mA A: FirstIf#=3D 0 IfCount=3D 2 Cls=3D02(comm.) Sub=3D06 Prot=3D00 I:* If#=3D 0 Alt=3D 0 #EPs=3D 1 Cls=3D02(comm.) Sub=3D02 Prot=3Dff Driver= =3Drndis_host E: Ad=3D82(I) Atr=3D03(Int.) MxPS=3D 8 Ivl=3D32ms I:* If#=3D 1 Alt=3D 0 #EPs=3D 2 Cls=3D0a(data ) Sub=3D00 Prot=3D00 Driver= =3Drndis_host E: Ad=3D81(I) Atr=3D02(Bulk) MxPS=3D1024 Ivl=3D0ms E: Ad=3D01(O) Atr=3D02(Bulk) MxPS=3D1024 Ivl=3D0ms I:* If#=3D 2 Alt=3D 0 #EPs=3D 2 Cls=3Dff(vend.) Sub=3Dff Prot=3Dff Driver= =3Doption E: Ad=3D83(I) Atr=3D02(Bulk) MxPS=3D1024 Ivl=3D0ms E: Ad=3D02(O) Atr=3D02(Bulk) MxPS=3D1024 Ivl=3D0ms I:* If#=3D 3 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3Dff Prot=3Dff Driver= =3Doption E: Ad=3D85(I) Atr=3D03(Int.) MxPS=3D 10 Ivl=3D32ms E: Ad=3D84(I) Atr=3D02(Bulk) MxPS=3D1024 Ivl=3D0ms E: Ad=3D03(O) Atr=3D02(Bulk) MxPS=3D1024 Ivl=3D0ms I:* If#=3D 4 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3Dff Prot=3Dff Driver= =3Doption E: Ad=3D87(I) Atr=3D03(Int.) MxPS=3D 10 Ivl=3D32ms E: Ad=3D86(I) Atr=3D02(Bulk) MxPS=3D1024 Ivl=3D0ms E: Ad=3D04(O) Atr=3D02(Bulk) MxPS=3D1024 Ivl=3D0ms I:* If#=3D 5 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3Dff Prot=3Dff Driver= =3Dqmi_wwan E: Ad=3D88(I) Atr=3D03(Int.) MxPS=3D 8 Ivl=3D32ms E: Ad=3D8e(I) Atr=3D02(Bulk) MxPS=3D1024 Ivl=3D0ms E: Ad=3D0f(O) Atr=3D02(Bulk) MxPS=3D1024 Ivl=3D0ms I:* If#=3D 6 Alt=3D 0 #EPs=3D 2 Cls=3Dff(vend.) Sub=3D42 Prot=3D01 Driver= =3Dusbfs E: Ad=3D05(O) Atr=3D02(Bulk) MxPS=3D1024 Ivl=3D0ms E: Ad=3D89(I) Atr=3D02(Bulk) MxPS=3D1024 Ivl=3D0ms Signed-off-by: Pawel Dembicki Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/usb/serial/option.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -1649,6 +1649,8 @@ static const struct usb_device_id option .driver_info =3D RSVD(2) }, { USB_DEVICE_INTERFACE_CLASS(ZTE_VENDOR_ID, 0x1476, 0xff) }, /* GosunCn Z= TE WeLink ME3630 (ECM/NCM mode) */ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1481, 0xff, 0x00, 0x00) = }, /* ZTE MF871A */ + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1485, 0xff, 0xff, 0xff),= /* ZTE MF286D */ + .driver_info =3D RSVD(5) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1533, 0xff, 0xff, 0xff) = }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1534, 0xff, 0xff, 0xff) = }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1535, 0xff, 0xff, 0xff) = }, From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0D62C433EF for ; Mon, 14 Feb 2022 10:43:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348822AbiBNKnb (ORCPT ); Mon, 14 Feb 2022 05:43:31 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:52128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348937AbiBNKkP (ORCPT ); Mon, 14 Feb 2022 05:40:15 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 376C966C98; Mon, 14 Feb 2022 02:04:13 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EBC5AB80DFE; Mon, 14 Feb 2022 10:04:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25ADDC36AE2; Mon, 14 Feb 2022 10:04:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644833043; bh=9vxZ2UxSC/BPL5u/hZd6/MrObK1934bk0SauZ5RvZs8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AbSTH3s3CCGol+m9UX/VTIig93WbVLbwbDxZSjVy1sJ+Q50PwB1l6WkQRHEARbgzm nvWEVc+CYGOPkPjXE1dVe3bbcBAuewRqX72awv2XOXFL3liuG8OG81jK9t+NC8JdYm hKfPWrWM3sJlueUotlCEEUsSVc5M24q28e4rmgiY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephan Brunner , Johan Hovold Subject: [PATCH 5.16 179/203] USB: serial: ch341: add support for GW Instek USB2.0-Serial devices Date: Mon, 14 Feb 2022 10:27:03 +0100 Message-Id: <20220214092516.333904772@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Brunner commit fa77ce201f7f2d823b07753575122d1ae5597fbe upstream. Programmable lab power supplies made by GW Instek, such as the GPP-2323, have a USB port exposing a serial port to control the device. Stringing the supplied Windows driver, references to the ch341 chip are found. Binding the existing ch341 driver to the VID/PID of the GPP-2323 ("GW Instek USB2.0-Serial" as per the USB product name) works out of the box, communication and control is now possible. This patch should work with any GPP series power supply due to similarities in the product line. Signed-off-by: Stephan Brunner Link: https://lore.kernel.org/r/4a47b864-0816-6f6a-efee-aa20e74bcdc6@stepha= n-brunner.net Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/usb/serial/ch341.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/usb/serial/ch341.c +++ b/drivers/usb/serial/ch341.c @@ -85,6 +85,7 @@ static const struct usb_device_id id_tab { USB_DEVICE(0x1a86, 0x5523) }, { USB_DEVICE(0x1a86, 0x7522) }, { USB_DEVICE(0x1a86, 0x7523) }, + { USB_DEVICE(0x2184, 0x0057) }, { USB_DEVICE(0x4348, 0x5523) }, { USB_DEVICE(0x9986, 0x7523) }, { }, From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09155C433EF for ; Mon, 14 Feb 2022 10:43:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242182AbiBNKnL (ORCPT ); Mon, 14 Feb 2022 05:43:11 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:49108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348850AbiBNKkP (ORCPT ); Mon, 14 Feb 2022 05:40:15 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D548A66C93; Mon, 14 Feb 2022 02:04:12 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 564F56077B; Mon, 14 Feb 2022 10:04:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3657BC340EF; Mon, 14 Feb 2022 10:04:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644833046; bh=a7P2thYiD9cfIDo2UxbVIbQA1HeMvi1eNgujTwqPKHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GIfQRvFN7ataaw99qbffAQpG7GPlMnCoNRJFn86USHhXWt5M8Fhli9HYLZZmUZUtv DOlqMi6lx6EQc8mA5dcYV84Jg665RNmRemDgz7aN0mcwU9x0bqxnxVFXVT+b7mXiZy xGfsc/k9SH3UnOny8i1xphcSRtZ6VdP66Ep4D4Hw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Scott Russell , Johan Hovold Subject: [PATCH 5.16 180/203] USB: serial: cp210x: add NCR Retail IO box id Date: Mon, 14 Feb 2022 10:27:04 +0100 Message-Id: <20220214092516.365516145@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johan Hovold commit b50f8f09c622297d3cf46e332e17ba8adedec9af upstream. Add the device id for NCR's Retail IO box (CP2105) used in NCR FastLane SelfServ Checkout - R6C: https://www.ncr.com/product-catalog/ncr-fastlane-selfserv-checkout-r6c Reported-by: Scott Russell Cc: stable@vger.kernel.org Reviewed-by: Greg Kroah-Hartman Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/usb/serial/cp210x.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c @@ -51,6 +51,7 @@ static void cp210x_enable_event_mode(str static void cp210x_disable_event_mode(struct usb_serial_port *port); =20 static const struct usb_device_id id_table[] =3D { + { USB_DEVICE(0x0404, 0x034C) }, /* NCR Retail IO Box */ { USB_DEVICE(0x045B, 0x0053) }, /* Renesas RX610 RX-Stick */ { USB_DEVICE(0x0471, 0x066A) }, /* AKTAKOM ACE-1001 cable */ { USB_DEVICE(0x0489, 0xE000) }, /* Pirelli Broadband S.p.A, DP-L10 SIP/GS= M Mobile */ From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5722CC433F5 for ; Mon, 14 Feb 2022 10:43:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241390AbiBNKn0 (ORCPT ); Mon, 14 Feb 2022 05:43:26 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:59920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236320AbiBNKkX (ORCPT ); Mon, 14 Feb 2022 05:40:23 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8CF766C9E; Mon, 14 Feb 2022 02:04:13 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2CEABB80DB7; Mon, 14 Feb 2022 10:04:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44F61C340E9; Mon, 14 Feb 2022 10:04:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644833049; bh=c2wwsVOne6O+20ubHYJ2YGXK3XI7T9P/J4u3/gJpya0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DfbgRrfyf127ENuhfi8McpJCMxQwtvvujZjZVjHjUwVzsmct/UDILCWlNR/kLHSfK zOONK5eopFnIDcXUEcGna4vaN35+2KRgL7XAw+CxvRGGpG09IK0GaRkG+1cITOz0/O SYrbgScxN3lXz7jtXD54MG17HiA8wZDjFnps4Y1A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Scott Russell , Johan Hovold Subject: [PATCH 5.16 181/203] USB: serial: cp210x: add CPI Bulk Coin Recycler id Date: Mon, 14 Feb 2022 10:27:05 +0100 Message-Id: <20220214092516.404824620@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johan Hovold commit 6ca0c6283340d819bf9c7d8e76be33c9fbd903ab upstream. Add the device id for the Crane Payment Innovation / Money Controls Bulk Coin Recycler: https://www.cranepi.com/en/system/files/Support/OM_BCR_EN_V1-04_0.pdf Reported-by: Scott Russell Cc: stable@vger.kernel.org Reviewed-by: Greg Kroah-Hartman Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/usb/serial/cp210x.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c @@ -69,6 +69,7 @@ static const struct usb_device_id id_tab { USB_DEVICE(0x0FCF, 0x1004) }, /* Dynastream ANT2USB */ { USB_DEVICE(0x0FCF, 0x1006) }, /* Dynastream ANT development board */ { USB_DEVICE(0x0FDE, 0xCA05) }, /* OWL Wireless Electricity Monitor CM-16= 0 */ + { USB_DEVICE(0x106F, 0x0003) }, /* CPI / Money Controls Bulk Coin Recycle= r */ { USB_DEVICE(0x10A6, 0xAA26) }, /* Knock-off DCU-11 cable */ { USB_DEVICE(0x10AB, 0x10C5) }, /* Siemens MC60 Cable */ { USB_DEVICE(0x10B5, 0xAC70) }, /* Nokia CA-42 USB */ From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A17BC433EF for ; Mon, 14 Feb 2022 10:42:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348906AbiBNKmu (ORCPT ); Mon, 14 Feb 2022 05:42:50 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:60632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348843AbiBNKkY (ORCPT ); Mon, 14 Feb 2022 05:40:24 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 025AD66CA8; Mon, 14 Feb 2022 02:04:16 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8252760909; Mon, 14 Feb 2022 10:04:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B76CC340E9; Mon, 14 Feb 2022 10:04:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644833052; bh=VurFU58a1cNgjY+xlro4xnBrTwWyCaOg886ucNWiblY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qzq8HYns/aw9mppqvioj3ooDOKWb7mv5ymM1KnLQRW3kOkoGwiqsI644eCIcClhIz hTXYE1U30wxrw65EafIF9c0/nx14me3E3ZMJUO6oWGJGMQEcJXbxDi5W7JZtu5u3G9 5EtxfiSgEYHrwYHCe4Z5gyv8kuo1spBHItHxvrko= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Samuel Thibault Subject: [PATCH 5.16 182/203] speakup-dectlk: Restore pitch setting Date: Mon, 14 Feb 2022 10:27:06 +0100 Message-Id: <20220214092516.435165441@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Thibault commit bca828ccdd6548d24613d0cede04ada4dfb2f89c upstream. d97a9d7aea04 ("staging/speakup: Add inflection synth parameter") introduced the inflection parameter, but happened to drop the pitch parameter from the dectlk driver. This restores it. Cc: stable@vger.kernel.org Fixes: d97a9d7aea04 ("staging/speakup: Add inflection synth parameter") Signed-off-by: Samuel Thibault Link: https://lore.kernel.org/r/20220206015626.aesbhvvdkmqsrbaw@begin Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/accessibility/speakup/speakup_dectlk.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/accessibility/speakup/speakup_dectlk.c +++ b/drivers/accessibility/speakup/speakup_dectlk.c @@ -44,6 +44,7 @@ static struct var_t vars[] =3D { { CAPS_START, .u.s =3D {"[:dv ap 160] " } }, { CAPS_STOP, .u.s =3D {"[:dv ap 100 ] " } }, { RATE, .u.n =3D {"[:ra %d] ", 180, 75, 650, 0, 0, NULL } }, + { PITCH, .u.n =3D {"[:dv ap %d] ", 122, 50, 350, 0, 0, NULL } }, { INFLECTION, .u.n =3D {"[:dv pr %d] ", 100, 0, 10000, 0, 0, NULL } }, { VOL, .u.n =3D {"[:dv g5 %d] ", 86, 60, 86, 0, 0, NULL } }, { PUNCT, .u.n =3D {"[:pu %c] ", 0, 0, 2, 0, 0, "nsa" } }, From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8665FC433F5 for ; Mon, 14 Feb 2022 10:42:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348920AbiBNKm5 (ORCPT ); Mon, 14 Feb 2022 05:42:57 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:32950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348955AbiBNKkm (ORCPT ); Mon, 14 Feb 2022 05:40:42 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D715B851; Mon, 14 Feb 2022 02:04:18 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 33EB2B80CE1; Mon, 14 Feb 2022 10:04:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5300FC340E9; Mon, 14 Feb 2022 10:04:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644833056; bh=4Ww7YY60vIbpvXUj1vAzBR+a7Waun+OVFOKjDCpCtdk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TGM2ANGUtZ+UBiqNkEh7Ic94Ui8pF66LPrANqUvFy19A2W+GPVqla0KefTe/TUqdh cK85j3wQ1M1gqRhwILWiA6v2y3H+WhywFm7vUm7gOKV/6HLZ+DJhGU5Uoyd8aeGqGd RksYexNZDtl0cxC6dj5tMxXdYoKDO5GMzOxi+b9c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kishon Vijay Abraham I , Vinod Koul Subject: [PATCH 5.16 183/203] phy: ti: Fix missing sentinel for clk_div_table Date: Mon, 14 Feb 2022 10:27:07 +0100 Message-Id: <20220214092516.466703675@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kishon Vijay Abraham I commit 6d1e6bcb31663ee83aaea1f171f3dbfe95dd4a69 upstream. _get_table_maxdiv() tries to access "clk_div_table" array out of bound defined in phy-j721e-wiz.c. Add a sentinel entry to prevent the following global-out-of-bounds error reported by enabling KASAN. [ 9.552392] BUG: KASAN: global-out-of-bounds in _get_maxdiv+0xc0/0x148 [ 9.558948] Read of size 4 at addr ffff8000095b25a4 by task kworker/u4:1= /38 [ 9.565926] [ 9.567441] CPU: 1 PID: 38 Comm: kworker/u4:1 Not tainted 5.16.0-116492-= gdaadb3bd0e8d-dirty #360 [ 9.576242] Hardware name: Texas Instruments J721e EVM (DT) [ 9.581832] Workqueue: events_unbound deferred_probe_work_func [ 9.587708] Call trace: [ 9.590174] dump_backtrace+0x20c/0x218 [ 9.594038] show_stack+0x18/0x68 [ 9.597375] dump_stack_lvl+0x9c/0xd8 [ 9.601062] print_address_description.constprop.0+0x78/0x334 [ 9.606830] kasan_report+0x1f0/0x260 [ 9.610517] __asan_load4+0x9c/0xd8 [ 9.614030] _get_maxdiv+0xc0/0x148 [ 9.617540] divider_determine_rate+0x88/0x488 [ 9.622005] divider_round_rate_parent+0xc8/0x124 [ 9.626729] wiz_clk_div_round_rate+0x54/0x68 [ 9.631113] clk_core_determine_round_nolock+0x124/0x158 [ 9.636448] clk_core_round_rate_nolock+0x68/0x138 [ 9.641260] clk_core_set_rate_nolock+0x268/0x3a8 [ 9.645987] clk_set_rate+0x50/0xa8 [ 9.649499] cdns_sierra_phy_init+0x88/0x248 [ 9.653794] phy_init+0x98/0x108 [ 9.657046] cdns_pcie_enable_phy+0xa0/0x170 [ 9.661340] cdns_pcie_init_phy+0x250/0x2b0 [ 9.665546] j721e_pcie_probe+0x4b8/0x798 [ 9.669579] platform_probe+0x8c/0x108 [ 9.673350] really_probe+0x114/0x630 [ 9.677037] __driver_probe_device+0x18c/0x220 [ 9.681505] driver_probe_device+0xac/0x150 [ 9.685712] __device_attach_driver+0xec/0x170 [ 9.690178] bus_for_each_drv+0xf0/0x158 [ 9.694124] __device_attach+0x184/0x210 [ 9.698070] device_initial_probe+0x14/0x20 [ 9.702277] bus_probe_device+0xec/0x100 [ 9.706223] deferred_probe_work_func+0x124/0x180 [ 9.710951] process_one_work+0x4b0/0xbc0 [ 9.714983] worker_thread+0x74/0x5d0 [ 9.718668] kthread+0x214/0x230 [ 9.721919] ret_from_fork+0x10/0x20 [ 9.725520] [ 9.727032] The buggy address belongs to the variable: [ 9.732183] clk_div_table+0x24/0x440 Fixes: 091876cc355d ("phy: ti: j721e-wiz: Add support for WIZ module presen= t in TI J721E SoC") Cc: stable@vger.kernel.org # v5.10+ Signed-off-by: Kishon Vijay Abraham I Link: https://lore.kernel.org/r/20220117110108.4117-1-kishon@ti.com Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/phy/ti/phy-j721e-wiz.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/phy/ti/phy-j721e-wiz.c +++ b/drivers/phy/ti/phy-j721e-wiz.c @@ -233,6 +233,7 @@ static const struct clk_div_table clk_di { .val =3D 1, .div =3D 2, }, { .val =3D 2, .div =3D 4, }, { .val =3D 3, .div =3D 8, }, + { /* sentinel */ }, }; =20 static const struct wiz_clk_div_sel clk_div_sel[] =3D { From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B4E6C433F5 for ; Mon, 14 Feb 2022 10:43:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348978AbiBNKnG (ORCPT ); Mon, 14 Feb 2022 05:43:06 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:60232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348972AbiBNKko (ORCPT ); Mon, 14 Feb 2022 05:40:44 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 503F666CB2; Mon, 14 Feb 2022 02:04:21 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 98374B80DA6; Mon, 14 Feb 2022 10:04:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 93976C340E9; Mon, 14 Feb 2022 10:04:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644833059; bh=cfRNTzRBRWZmlfr+OlmF4r/V5ZSQ1qauyvLgImIoMlw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mtuKCft/j+X+XPr1NgyhkJmfOq9BvYR5qBvLtPK4PLaYGvRIZPX/8/kIHlKHeD4D1 0s9kL1uC8eNgwLKldc41d3mOs54U1vpWbkMMfqCmlakexV/L7M5HxjJdn31Dj/mA9w lyhhhIKTj1lu8JT+caSZUhj2esLnYa9p7T4E2h4g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Jonathan Cameron , Alexandru Ardelean , Lars-Peter Clausen , Nuno Sa , Dan Carpenter , Mathias Krause , Jonathan Cameron Subject: [PATCH 5.16 184/203] iio: buffer: Fix file related error handling in IIO_BUFFER_GET_FD_IOCTL Date: Mon, 14 Feb 2022 10:27:08 +0100 Message-Id: <20220214092516.498129131@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mathias Krause commit c72ea20503610a4a7ba26c769357d31602769c01 upstream. If we fail to copy the just created file descriptor to userland, we try to clean up by putting back 'fd' and freeing 'ib'. The code uses put_unused_fd() for the former which is wrong, as the file descriptor was already published by fd_install() which gets called internally by anon_inode_getfd(). This makes the error handling code leaving a half cleaned up file descriptor table around and a partially destructed 'file' object, allowing userland to play use-after-free tricks on us, by abusing the still usable fd and making the code operate on a dangling 'file->private_data' pointer. Instead of leaving the kernel in a partially corrupted state, don't attempt to explicitly clean up and leave this to the process exit path that'll release any still valid fds, including the one created by the previous call to anon_inode_getfd(). Simply return -EFAULT to indicate the error. Fixes: f73f7f4da581 ("iio: buffer: add ioctl() to support opening extra buf= fers for IIO device") Cc: stable@kernel.org Cc: Jonathan Cameron Cc: Alexandru Ardelean Cc: Lars-Peter Clausen Cc: Nuno Sa Reported-by: Dan Carpenter Signed-off-by: Mathias Krause Reviewed-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/iio/industrialio-buffer.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) --- a/drivers/iio/industrialio-buffer.c +++ b/drivers/iio/industrialio-buffer.c @@ -1569,9 +1569,17 @@ static long iio_device_buffer_getfd(stru } =20 if (copy_to_user(ival, &fd, sizeof(fd))) { - put_unused_fd(fd); - ret =3D -EFAULT; - goto error_free_ib; + /* + * "Leak" the fd, as there's not much we can do about this + * anyway. 'fd' might have been closed already, as + * anon_inode_getfd() called fd_install() on it, which made + * it reachable by userland. + * + * Instead of allowing a malicious user to play tricks with + * us, rely on the process exit path to do any necessary + * cleanup, as in releasing the file, if still needed. + */ + return -EFAULT; } =20 return 0; From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B3DCC4332F for ; Mon, 14 Feb 2022 10:41:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349531AbiBNKlP (ORCPT ); Mon, 14 Feb 2022 05:41:15 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:43740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349765AbiBNKgn (ORCPT ); Mon, 14 Feb 2022 05:36:43 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64AE471CA0; Mon, 14 Feb 2022 02:03:03 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A921460DD7; Mon, 14 Feb 2022 10:02:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88C50C340E9; Mon, 14 Feb 2022 10:02:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832976; bh=2BjWgn3nXw2WsIQuyliEVgZmuK8awUSbnJBmsSLADt4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=trIEZ4LqE8GnIGcBlLKjeuQcCctS1pjMd4jknQKFsodw8fxmarOeGcgtBmEgm4Qbx I46DYqvUFoMELPzFC40MSq8qdhR79LXhAZVQQfAtXk/rv2m22+5YLMqVYbk/oS2vYA 0KFJZAlj6LeRX23ZtuAqyVAvJyaQ7exthzyCSuao= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yang Shi , Nathan Chancellor , syzbot+1f52b3a18d5633fa7f82@syzkaller.appspotmail.com, David Hildenbrand , "Kirill A. Shutemov" , Jann Horn , Matthew Wilcox , Alexey Dobriyan , Andrew Morton , Linus Torvalds Subject: [PATCH 5.16 185/203] fs/proc: task_mmu.c: dont read mapcount for migration entry Date: Mon, 14 Feb 2022 10:27:09 +0100 Message-Id: <20220214092516.532124712@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Shi commit 24d7275ce2791829953ed4e72f68277ceb2571c6 upstream. The syzbot reported the below BUG: kernel BUG at include/linux/page-flags.h:785! invalid opcode: 0000 [#1] PREEMPT SMP KASAN CPU: 1 PID: 4392 Comm: syz-executor560 Not tainted 5.16.0-rc6-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS G= oogle 01/01/2011 RIP: 0010:PageDoubleMap include/linux/page-flags.h:785 [inline] RIP: 0010:__page_mapcount+0x2d2/0x350 mm/util.c:744 Call Trace: page_mapcount include/linux/mm.h:837 [inline] smaps_account+0x470/0xb10 fs/proc/task_mmu.c:466 smaps_pte_entry fs/proc/task_mmu.c:538 [inline] smaps_pte_range+0x611/0x1250 fs/proc/task_mmu.c:601 walk_pmd_range mm/pagewalk.c:128 [inline] walk_pud_range mm/pagewalk.c:205 [inline] walk_p4d_range mm/pagewalk.c:240 [inline] walk_pgd_range mm/pagewalk.c:277 [inline] __walk_page_range+0xe23/0x1ea0 mm/pagewalk.c:379 walk_page_vma+0x277/0x350 mm/pagewalk.c:530 smap_gather_stats.part.0+0x148/0x260 fs/proc/task_mmu.c:768 smap_gather_stats fs/proc/task_mmu.c:741 [inline] show_smap+0xc6/0x440 fs/proc/task_mmu.c:822 seq_read_iter+0xbb0/0x1240 fs/seq_file.c:272 seq_read+0x3e0/0x5b0 fs/seq_file.c:162 vfs_read+0x1b5/0x600 fs/read_write.c:479 ksys_read+0x12d/0x250 fs/read_write.c:619 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x44/0xae The reproducer was trying to read /proc/$PID/smaps when calling MADV_FREE at the mean time. MADV_FREE may split THPs if it is called for partial THP. It may trigger the below race: CPU A CPU B ----- ----- smaps walk: MADV_FREE: page_mapcount() PageCompound() split_huge_page() page =3D compound_head(page) PageDoubleMap(page) When calling PageDoubleMap() this page is not a tail page of THP anymore so the BUG is triggered. This could be fixed by elevated refcount of the page before calling mapcount, but that would prevent it from counting migration entries, and it seems overkilling because the race just could happen when PMD is split so all PTE entries of tail pages are actually migration entries, and smaps_account() does treat migration entries as mapcount =3D=3D 1 as Kirill pointed out. Add a new parameter for smaps_account() to tell this entry is migration entry then skip calling page_mapcount(). Don't skip getting mapcount for device private entries since they do track references with mapcount. Pagemap also has the similar issue although it was not reported. Fixed it as well. [shy828301@gmail.com: v4] Link: https://lkml.kernel.org/r/20220203182641.824731-1-shy828301@gmail.c= om [nathan@kernel.org: avoid unused variable warning in pagemap_pmd_range()] Link: https://lkml.kernel.org/r/20220207171049.1102239-1-nathan@kernel.org Link: https://lkml.kernel.org/r/20220120202805.3369-1-shy828301@gmail.com Fixes: e9b61f19858a ("thp: reintroduce split_huge_page()") Signed-off-by: Yang Shi Signed-off-by: Nathan Chancellor Reported-by: syzbot+1f52b3a18d5633fa7f82@syzkaller.appspotmail.com Acked-by: David Hildenbrand Cc: "Kirill A. Shutemov" Cc: Jann Horn Cc: Matthew Wilcox Cc: Alexey Dobriyan Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- fs/proc/task_mmu.c | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -429,7 +429,8 @@ static void smaps_page_accumulate(struct } =20 static void smaps_account(struct mem_size_stats *mss, struct page *page, - bool compound, bool young, bool dirty, bool locked) + bool compound, bool young, bool dirty, bool locked, + bool migration) { int i, nr =3D compound ? compound_nr(page) : 1; unsigned long size =3D nr * PAGE_SIZE; @@ -456,8 +457,15 @@ static void smaps_account(struct mem_siz * page_count(page) =3D=3D 1 guarantees the page is mapped exactly once. * If any subpage of the compound page mapped with PTE it would elevate * page_count(). + * + * The page_mapcount() is called to get a snapshot of the mapcount. + * Without holding the page lock this snapshot can be slightly wrong as + * we cannot always read the mapcount atomically. It is not safe to + * call page_mapcount() even with PTL held if the page is not mapped, + * especially for migration entries. Treat regular migration entries + * as mapcount =3D=3D 1. */ - if (page_count(page) =3D=3D 1) { + if ((page_count(page) =3D=3D 1) || migration) { smaps_page_accumulate(mss, page, size, size << PSS_SHIFT, dirty, locked, true); return; @@ -506,6 +514,7 @@ static void smaps_pte_entry(pte_t *pte, struct vm_area_struct *vma =3D walk->vma; bool locked =3D !!(vma->vm_flags & VM_LOCKED); struct page *page =3D NULL; + bool migration =3D false; =20 if (pte_present(*pte)) { page =3D vm_normal_page(vma, addr, *pte); @@ -525,8 +534,11 @@ static void smaps_pte_entry(pte_t *pte, } else { mss->swap_pss +=3D (u64)PAGE_SIZE << PSS_SHIFT; } - } else if (is_pfn_swap_entry(swpent)) + } else if (is_pfn_swap_entry(swpent)) { + if (is_migration_entry(swpent)) + migration =3D true; page =3D pfn_swap_entry_to_page(swpent); + } } else { smaps_pte_hole_lookup(addr, walk); return; @@ -535,7 +547,8 @@ static void smaps_pte_entry(pte_t *pte, if (!page) return; =20 - smaps_account(mss, page, false, pte_young(*pte), pte_dirty(*pte), locked); + smaps_account(mss, page, false, pte_young(*pte), pte_dirty(*pte), + locked, migration); } =20 #ifdef CONFIG_TRANSPARENT_HUGEPAGE @@ -546,6 +559,7 @@ static void smaps_pmd_entry(pmd_t *pmd, struct vm_area_struct *vma =3D walk->vma; bool locked =3D !!(vma->vm_flags & VM_LOCKED); struct page *page =3D NULL; + bool migration =3D false; =20 if (pmd_present(*pmd)) { /* FOLL_DUMP will return -EFAULT on huge zero page */ @@ -553,8 +567,10 @@ static void smaps_pmd_entry(pmd_t *pmd, } else if (unlikely(thp_migration_supported() && is_swap_pmd(*pmd))) { swp_entry_t entry =3D pmd_to_swp_entry(*pmd); =20 - if (is_migration_entry(entry)) + if (is_migration_entry(entry)) { + migration =3D true; page =3D pfn_swap_entry_to_page(entry); + } } if (IS_ERR_OR_NULL(page)) return; @@ -566,7 +582,9 @@ static void smaps_pmd_entry(pmd_t *pmd, /* pass */; else mss->file_thp +=3D HPAGE_PMD_SIZE; - smaps_account(mss, page, true, pmd_young(*pmd), pmd_dirty(*pmd), locked); + + smaps_account(mss, page, true, pmd_young(*pmd), pmd_dirty(*pmd), + locked, migration); } #else static void smaps_pmd_entry(pmd_t *pmd, unsigned long addr, @@ -1367,6 +1385,7 @@ static pagemap_entry_t pte_to_pagemap_en { u64 frame =3D 0, flags =3D 0; struct page *page =3D NULL; + bool migration =3D false; =20 if (pte_present(pte)) { if (pm->show_pfn) @@ -1388,13 +1407,14 @@ static pagemap_entry_t pte_to_pagemap_en frame =3D swp_type(entry) | (swp_offset(entry) << MAX_SWAPFILES_SHIFT); flags |=3D PM_SWAP; + migration =3D is_migration_entry(entry); if (is_pfn_swap_entry(entry)) page =3D pfn_swap_entry_to_page(entry); } =20 if (page && !PageAnon(page)) flags |=3D PM_FILE; - if (page && page_mapcount(page) =3D=3D 1) + if (page && !migration && page_mapcount(page) =3D=3D 1) flags |=3D PM_MMAP_EXCLUSIVE; if (vma->vm_flags & VM_SOFTDIRTY) flags |=3D PM_SOFT_DIRTY; @@ -1410,8 +1430,9 @@ static int pagemap_pmd_range(pmd_t *pmdp spinlock_t *ptl; pte_t *pte, *orig_pte; int err =3D 0; - #ifdef CONFIG_TRANSPARENT_HUGEPAGE + bool migration =3D false; + ptl =3D pmd_trans_huge_lock(pmdp, vma); if (ptl) { u64 flags =3D 0, frame =3D 0; @@ -1450,11 +1471,12 @@ static int pagemap_pmd_range(pmd_t *pmdp if (pmd_swp_uffd_wp(pmd)) flags |=3D PM_UFFD_WP; VM_BUG_ON(!is_pmd_migration_entry(pmd)); + migration =3D is_migration_entry(entry); page =3D pfn_swap_entry_to_page(entry); } #endif =20 - if (page && page_mapcount(page) =3D=3D 1) + if (page && !migration && page_mapcount(page) =3D=3D 1) flags |=3D PM_MMAP_EXCLUSIVE; =20 for (; addr !=3D end; addr +=3D PAGE_SIZE) { From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98C49C433F5 for ; Mon, 14 Feb 2022 10:41:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349598AbiBNKlT (ORCPT ); Mon, 14 Feb 2022 05:41:19 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:49886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350109AbiBNKgv (ORCPT ); Mon, 14 Feb 2022 05:36:51 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADD2FA66C5; Mon, 14 Feb 2022 02:03:25 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C0BB560C78; Mon, 14 Feb 2022 10:02:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B63FC340E9; Mon, 14 Feb 2022 10:02:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832979; bh=YzWY9DyK/NtUaJJtUxtgpppL0Zx34Zk2t0AZEQEWWjc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TdOFCHeYQaf10RHHHNEYxqS47Fq/vyLrNkccTlfBC/jtdDqgX4eak3iWfjlfj52oC sIaBKvL0uGCnG/QHDPQjk51fahidjbs5oYJ4jkytikqga+DMMomBLUMHQBZn+/nRfk aN4t475WxPlzlfcAVs/E/SiScBL1KYeCTY6txeBs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mel Gorman , Vlastimil Babka , Michal Hocko , David Rientjes , Hugh Dickins , Rik van Riel , Andrew Morton , Linus Torvalds Subject: [PATCH 5.16 186/203] mm: vmscan: remove deadlock due to throttling failing to make progress Date: Mon, 14 Feb 2022 10:27:10 +0100 Message-Id: <20220214092516.564535162@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 commit b485c6f1f9f54b81443efda5f3d8a5036ba2cd91 upstream. A soft lockup bug in kcompactd was reported in a private bugzilla with the following visible in dmesg; watchdog: BUG: soft lockup - CPU#33 stuck for 26s! [kcompactd0:479] watchdog: BUG: soft lockup - CPU#33 stuck for 52s! [kcompactd0:479] watchdog: BUG: soft lockup - CPU#33 stuck for 78s! [kcompactd0:479] watchdog: BUG: soft lockup - CPU#33 stuck for 104s! [kcompactd0:479] The machine had 256G of RAM with no swap and an earlier failed allocation indicated that node 0 where kcompactd was run was potentially unreclaimable; Node 0 active_anon:29355112kB inactive_anon:2913528kB active_file:0kB inactive_file:0kB unevictable:64kB isolated(anon):0kB isolated(file):0kB mapped:8kB dirty:0kB writeback:0kB shmem:26780kB shmem_thp: 0kB shmem_pmdmapped: 0kB anon_thp: 23480320kB writeback_tmp:0kB kernel_stack:2272kB pagetables:24500kB all_unreclaimable? yes Vlastimil Babka investigated a crash dump and found that a task migrating pages was trying to drain PCP lists; PID: 52922 TASK: ffff969f820e5000 CPU: 19 COMMAND: "kworker/u128:3" Call Trace: __schedule schedule schedule_timeout wait_for_completion __flush_work __drain_all_pages __alloc_pages_slowpath.constprop.114 __alloc_pages alloc_migration_target migrate_pages migrate_to_node do_migrate_pages cpuset_migrate_mm_workfn process_one_work worker_thread kthread ret_from_fork This failure is specific to CONFIG_PREEMPT=3Dn builds. The root of the problem is that kcompact0 is not rescheduling on a CPU while a task that has isolated a large number of the pages from the LRU is waiting on kcompact0 to reschedule so the pages can be released. While shrink_inactive_list() only loops once around too_many_isolated, reclaim can continue without rescheduling if sc->skipped_deactivate =3D=3D 1 which could happen if there was no file LRU and the inactive anon list was not low. Link: https://lkml.kernel.org/r/20220203100326.GD3301@suse.de Fixes: d818fca1cac3 ("mm/vmscan: throttle reclaim and compaction when too m= ay pages are isolated") Signed-off-by: Mel Gorman Debugged-by: Vlastimil Babka Reviewed-by: Vlastimil Babka Acked-by: Michal Hocko Acked-by: David Rientjes Cc: Hugh Dickins Cc: Michal Hocko Cc: Rik van Riel Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- mm/vmscan.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -1066,8 +1066,10 @@ void reclaim_throttle(pg_data_t *pgdat, * forward progress (e.g. journalling workqueues or kthreads). */ if (!current_is_kswapd() && - current->flags & (PF_IO_WORKER|PF_KTHREAD)) + current->flags & (PF_IO_WORKER|PF_KTHREAD)) { + cond_resched(); return; + } =20 /* * These figures are pulled out of thin air. From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1938C43217 for ; Mon, 14 Feb 2022 10:41:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349366AbiBNKlI (ORCPT ); Mon, 14 Feb 2022 05:41:08 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:49110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349810AbiBNKgn (ORCPT ); Mon, 14 Feb 2022 05:36:43 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D76D71CA8; Mon, 14 Feb 2022 02:03:06 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 54AC2B80DBF; Mon, 14 Feb 2022 10:03:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61B5CC340E9; Mon, 14 Feb 2022 10:03:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832982; bh=eo7epGseaw9I0c7bR4AlDDXxfuUZN+PIXhnLHwo6GsY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lEna5SQCqylrilGBK1SaGd0JOxej1WXv89blc8jc/V4L2nbX/xMf5wuR0/hpOltz/ JCh4ICTlyYo4MKIAcFZzV9OnVDdQy22VW7BiOuJ6JuCYzgH4eZxQafUONLI8O4c2fT Wf518YWIYksUbxk2YPbzCo2FvhdDrJFNZzxwO2ig= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Roman Gushchin , Alexander Egorenkov , Waiman Long , Tejun Heo , Shakeel Butt , Jeremy Linton , Johannes Weiner , Andrew Morton , Linus Torvalds Subject: [PATCH 5.16 187/203] mm: memcg: synchronize objcg lists with a dedicated spinlock Date: Mon, 14 Feb 2022 10:27:11 +0100 Message-Id: <20220214092516.597353091@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Roman Gushchin commit 0764db9b49c932b89ee4d9e3236dff4bb07b4a66 upstream. Alexander reported a circular lock dependency revealed by the mmap1 ltp test: LOCKDEP_CIRCULAR (suite: ltp, case: mtest06 (mmap1)) WARNING: possible circular locking dependency detected 5.17.0-20220113.rc0.git0.f2211f194038.300.fc35.s390x+debug #1 Not= tainted ------------------------------------------------------ mmap1/202299 is trying to acquire lock: 00000001892c0188 (css_set_lock){..-.}-{2:2}, at: obj_cgroup_relea= se+0x4a/0xe0 but task is already holding lock: 00000000ca3b3818 (&sighand->siglock){-.-.}-{2:2}, at: force_sig_i= nfo_to_task+0x38/0x180 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&sighand->siglock){-.-.}-{2:2}: __lock_acquire+0x604/0xbd8 lock_acquire.part.0+0xe2/0x238 lock_acquire+0xb0/0x200 _raw_spin_lock_irqsave+0x6a/0xd8 __lock_task_sighand+0x90/0x190 cgroup_freeze_task+0x2e/0x90 cgroup_migrate_execute+0x11c/0x608 cgroup_update_dfl_csses+0x246/0x270 cgroup_subtree_control_write+0x238/0x518 kernfs_fop_write_iter+0x13e/0x1e0 new_sync_write+0x100/0x190 vfs_write+0x22c/0x2d8 ksys_write+0x6c/0xf8 __do_syscall+0x1da/0x208 system_call+0x82/0xb0 -> #0 (css_set_lock){..-.}-{2:2}: check_prev_add+0xe0/0xed8 validate_chain+0x736/0xb20 __lock_acquire+0x604/0xbd8 lock_acquire.part.0+0xe2/0x238 lock_acquire+0xb0/0x200 _raw_spin_lock_irqsave+0x6a/0xd8 obj_cgroup_release+0x4a/0xe0 percpu_ref_put_many.constprop.0+0x150/0x168 drain_obj_stock+0x94/0xe8 refill_obj_stock+0x94/0x278 obj_cgroup_charge+0x164/0x1d8 kmem_cache_alloc+0xac/0x528 __sigqueue_alloc+0x150/0x308 __send_signal+0x260/0x550 send_signal+0x7e/0x348 force_sig_info_to_task+0x104/0x180 force_sig_fault+0x48/0x58 __do_pgm_check+0x120/0x1f0 pgm_check_handler+0x11e/0x180 other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&sighand->siglock); lock(css_set_lock); lock(&sighand->siglock); lock(css_set_lock); *** DEADLOCK *** 2 locks held by mmap1/202299: #0: 00000000ca3b3818 (&sighand->siglock){-.-.}-{2:2}, at: force_= sig_info_to_task+0x38/0x180 #1: 00000001892ad560 (rcu_read_lock){....}-{1:2}, at: percpu_ref= _put_many.constprop.0+0x0/0x168 stack backtrace: CPU: 15 PID: 202299 Comm: mmap1 Not tainted 5.17.0-20220113.rc0.g= it0.f2211f194038.300.fc35.s390x+debug #1 Hardware name: IBM 3906 M04 704 (LPAR) Call Trace: dump_stack_lvl+0x76/0x98 check_noncircular+0x136/0x158 check_prev_add+0xe0/0xed8 validate_chain+0x736/0xb20 __lock_acquire+0x604/0xbd8 lock_acquire.part.0+0xe2/0x238 lock_acquire+0xb0/0x200 _raw_spin_lock_irqsave+0x6a/0xd8 obj_cgroup_release+0x4a/0xe0 percpu_ref_put_many.constprop.0+0x150/0x168 drain_obj_stock+0x94/0xe8 refill_obj_stock+0x94/0x278 obj_cgroup_charge+0x164/0x1d8 kmem_cache_alloc+0xac/0x528 __sigqueue_alloc+0x150/0x308 __send_signal+0x260/0x550 send_signal+0x7e/0x348 force_sig_info_to_task+0x104/0x180 force_sig_fault+0x48/0x58 __do_pgm_check+0x120/0x1f0 pgm_check_handler+0x11e/0x180 INFO: lockdep is turned off. In this example a slab allocation from __send_signal() caused a refilling and draining of a percpu objcg stock, resulted in a releasing of another non-related objcg. Objcg release path requires taking the css_set_lock, which is used to synchronize objcg lists. This can create a circular dependency with the sighandler lock, which is taken with the locked css_set_lock by the freezer code (to freeze a task). In general it seems that using css_set_lock to synchronize objcg lists makes any slab allocations and deallocation with the locked css_set_lock and any intervened locks risky. To fix the problem and make the code more robust let's stop using css_set_lock to synchronize objcg lists and use a new dedicated spinlock instead. Link: https://lkml.kernel.org/r/Yfm1IHmoGdyUR81T@carbon.dhcp.thefacebook.com Fixes: bf4f059954dc ("mm: memcg/slab: obj_cgroup API") Signed-off-by: Roman Gushchin Reported-by: Alexander Egorenkov Tested-by: Alexander Egorenkov Reviewed-by: Waiman Long Acked-by: Tejun Heo Reviewed-by: Shakeel Butt Reviewed-by: Jeremy Linton Tested-by: Jeremy Linton Cc: Johannes Weiner Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- include/linux/memcontrol.h | 5 +++-- mm/memcontrol.c | 10 +++++----- 2 files changed, 8 insertions(+), 7 deletions(-) --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -217,7 +217,7 @@ struct obj_cgroup { struct mem_cgroup *memcg; atomic_t nr_charged_bytes; union { - struct list_head list; + struct list_head list; /* protected by objcg_lock */ struct rcu_head rcu; }; }; @@ -313,7 +313,8 @@ struct mem_cgroup { #ifdef CONFIG_MEMCG_KMEM int kmemcg_id; struct obj_cgroup __rcu *objcg; - struct list_head objcg_list; /* list of inherited objcgs */ + /* list of inherited objcgs, protected by objcg_lock */ + struct list_head objcg_list; #endif =20 MEMCG_PADDING(_pad2_); --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -254,7 +254,7 @@ struct mem_cgroup *vmpressure_to_memcg(s } =20 #ifdef CONFIG_MEMCG_KMEM -extern spinlock_t css_set_lock; +static DEFINE_SPINLOCK(objcg_lock); =20 bool mem_cgroup_kmem_disabled(void) { @@ -298,9 +298,9 @@ static void obj_cgroup_release(struct pe if (nr_pages) obj_cgroup_uncharge_pages(objcg, nr_pages); =20 - spin_lock_irqsave(&css_set_lock, flags); + spin_lock_irqsave(&objcg_lock, flags); list_del(&objcg->list); - spin_unlock_irqrestore(&css_set_lock, flags); + spin_unlock_irqrestore(&objcg_lock, flags); =20 percpu_ref_exit(ref); kfree_rcu(objcg, rcu); @@ -332,7 +332,7 @@ static void memcg_reparent_objcgs(struct =20 objcg =3D rcu_replace_pointer(memcg->objcg, NULL, true); =20 - spin_lock_irq(&css_set_lock); + spin_lock_irq(&objcg_lock); =20 /* 1) Ready to reparent active objcg. */ list_add(&objcg->list, &memcg->objcg_list); @@ -342,7 +342,7 @@ static void memcg_reparent_objcgs(struct /* 3) Move already reparented objcgs to the parent's list */ list_splice(&memcg->objcg_list, &parent->objcg_list); =20 - spin_unlock_irq(&css_set_lock); + spin_unlock_irq(&objcg_lock); =20 percpu_ref_kill(&objcg->refcnt); } From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D682C433FE for ; Mon, 14 Feb 2022 10:41:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349311AbiBNKlG (ORCPT ); Mon, 14 Feb 2022 05:41:06 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349832AbiBNKgo (ORCPT ); Mon, 14 Feb 2022 05:36:44 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E38713700B; Mon, 14 Feb 2022 02:03:07 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 85878B80D6D; Mon, 14 Feb 2022 10:03:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C7DBC340E9; Mon, 14 Feb 2022 10:03:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832985; bh=OjPeCyA/ofgU7GFCY7rViE5BCiYYQglG21UC4UdiCZA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ruk590Jw7rtS3Fw8vK056fgSn+lLCut6wxzaHgBAvupUuCEbuW8bW7gbH+yxbkeJY d3wMyVL5hE/QIJAKKFPCcJe5hrbeRBWs+NX9/omCU45Kl8l3MpIxz8R8Y4aR9KXgKg ylR/QGY8Y8Z6kWNTc6xVeaNdPClD7mbf1+PkzfiI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Lutomirski , Will Drewry , Kees Cook Subject: [PATCH 5.16 188/203] seccomp: Invalidate seccomp mode to catch death failures Date: Mon, 14 Feb 2022 10:27:12 +0100 Message-Id: <20220214092516.637946967@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 495ac3069a6235bfdf516812a2a9b256671bbdf9 upstream. If seccomp tries to kill a process, it should never see that process again. To enforce this proactively, switch the mode to something impossible. If encountered: WARN, reject all syscalls, and attempt to kill the process again even harder. Cc: Andy Lutomirski Cc: Will Drewry Fixes: 8112c4f140fa ("seccomp: remove 2-phase API") Cc: stable@vger.kernel.org Signed-off-by: Kees Cook Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- kernel/seccomp.c | 10 ++++++++++ 1 file changed, 10 insertions(+) --- a/kernel/seccomp.c +++ b/kernel/seccomp.c @@ -29,6 +29,9 @@ #include #include =20 +/* Not exposed in headers: strictly internal use only. */ +#define SECCOMP_MODE_DEAD (SECCOMP_MODE_FILTER + 1) + #ifdef CONFIG_HAVE_ARCH_SECCOMP_FILTER #include #endif @@ -1010,6 +1013,7 @@ static void __secure_computing_strict(in #ifdef SECCOMP_DEBUG dump_stack(); #endif + current->seccomp.mode =3D SECCOMP_MODE_DEAD; seccomp_log(this_syscall, SIGKILL, SECCOMP_RET_KILL_THREAD, true); do_exit(SIGKILL); } @@ -1261,6 +1265,7 @@ static int __seccomp_filter(int this_sys case SECCOMP_RET_KILL_THREAD: case SECCOMP_RET_KILL_PROCESS: default: + current->seccomp.mode =3D SECCOMP_MODE_DEAD; seccomp_log(this_syscall, SIGSYS, action, true); /* Dump core only if this is the last remaining thread. */ if (action !=3D SECCOMP_RET_KILL_THREAD || @@ -1309,6 +1314,11 @@ int __secure_computing(const struct secc return 0; case SECCOMP_MODE_FILTER: return __seccomp_filter(this_syscall, sd, false); + /* Surviving SECCOMP_RET_KILL_* must be proactively impossible. */ + case SECCOMP_MODE_DEAD: + WARN_ON_ONCE(1); + do_exit(SIGKILL); + return -1; default: BUG(); } From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5908C433F5 for ; Mon, 14 Feb 2022 10:40:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348880AbiBNKkf (ORCPT ); Mon, 14 Feb 2022 05:40:35 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:52212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350286AbiBNKhB (ORCPT ); Mon, 14 Feb 2022 05:37:01 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43F3CA74C8; Mon, 14 Feb 2022 02:03:36 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3072260909; Mon, 14 Feb 2022 10:03:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E8E29C36AE7; Mon, 14 Feb 2022 10:03:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832988; bh=2BBZbbHHx50oBUEy83Jzex7N90VUJ1hapnj9wSM9Ri4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y3FCBCQo8GOyAUE8T2z9g0B+FmxKQUCNFzf0FW9c4/vTrqvvjt1dmPq8IVBZ+SfNw eT5MWc9sppkHj/OBNKV9DYUjNCkOyEVCezEH9LMlbe3QPHyjoqCUlF44zcvIdtnsuc rpwbltlSxt5KWvGl6cu7GUA83wo86dY9qvgYEsM8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Robert=20=C5=9Awi=C4=99cki?= , "Eric W. Biederman" , Kees Cook Subject: [PATCH 5.16 189/203] signal: HANDLER_EXIT should clear SIGNAL_UNKILLABLE Date: Mon, 14 Feb 2022 10:27:13 +0100 Message-Id: <20220214092516.670049720@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kees Cook commit 5c72263ef2fbe99596848f03758ae2dc593adf2c upstream. Fatal SIGSYS signals (i.e. seccomp RET_KILL_* syscall filter actions) were not being delivered to ptraced pid namespace init processes. Make sure the SIGNAL_UNKILLABLE doesn't get set for these cases. Reported-by: Robert =C5=9Awi=C4=99cki Suggested-by: "Eric W. Biederman" Fixes: 00b06da29cf9 ("signal: Add SA_IMMUTABLE to ensure forced siganls do = not get changed") Cc: stable@vger.kernel.org Signed-off-by: Kees Cook Reviewed-by: "Eric W. Biederman" Link: https://lore.kernel.org/lkml/878rui8u4a.fsf@email.froward.int.ebieder= m.org Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- kernel/signal.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/kernel/signal.c +++ b/kernel/signal.c @@ -1339,9 +1339,10 @@ force_sig_info_to_task(struct kernel_sig } /* * Don't clear SIGNAL_UNKILLABLE for traced tasks, users won't expect - * debugging to leave init killable. + * debugging to leave init killable. But HANDLER_EXIT is always fatal. */ - if (action->sa.sa_handler =3D=3D SIG_DFL && !t->ptrace) + if (action->sa.sa_handler =3D=3D SIG_DFL && + (!t->ptrace || (handler =3D=3D HANDLER_EXIT))) t->signal->flags &=3D ~SIGNAL_UNKILLABLE; ret =3D send_signal(sig, info, t, PIDTYPE_PID); spin_unlock_irqrestore(&t->sighand->siglock, flags); From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 700FDC433EF for ; Mon, 14 Feb 2022 10:39:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348646AbiBNKjr (ORCPT ); Mon, 14 Feb 2022 05:39:47 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48416 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349991AbiBNKgs (ORCPT ); Mon, 14 Feb 2022 05:36:48 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC3569FE8; Mon, 14 Feb 2022 02:03:14 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 18CEFB80CE1; Mon, 14 Feb 2022 10:03:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2AADEC340E9; Mon, 14 Feb 2022 10:03:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832991; bh=PJHeGXva5+VseX84sjTYD+TkWsdaeyJBakqXYhk9zg0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IscxmPCbbTq3aOrEYjGoSNd0gFPwiLmw03H2tznvuhabGUh5xFEWftmvkO4PXYoJX etZl34CpfcWmf6sHDKlNFGjUCE/FCV40Uth9YBg6YKFKL0tY66NIvPlVyL6c39riMC auqWvK2YjQtrY6ONXvD+LEHVyZc1AUhQq1qiFAZs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vineeth Vijayan , Peter Oberparleiter , Jan Hoeppner , Vasily Gorbik Subject: [PATCH 5.16 190/203] s390/cio: verify the driver availability for path_event call Date: Mon, 14 Feb 2022 10:27:14 +0100 Message-Id: <20220214092516.709162994@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vineeth Vijayan commit dd9cb842fa9d90653a9b48aba52f89c069f3bc50 upstream. If no driver is attached to a device or the driver does not provide the path_event function, an FCES path-event on this device could end up in a kernel-panic. Verify the driver availability before the path_event function call. Fixes: 32ef938815c1 ("s390/cio: Add support for FCES status notification") Cc: stable@vger.kernel.org Signed-off-by: Vineeth Vijayan Suggested-by: Peter Oberparleiter Reviewed-by: Jan Hoeppner Reviewed-by: Peter Oberparleiter Signed-off-by: Vasily Gorbik Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/s390/cio/device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c @@ -1194,7 +1194,7 @@ static int io_subchannel_chp_event(struc else path_event[chpid] =3D PE_NONE; } - if (cdev) + if (cdev && cdev->drv && cdev->drv->path_event) cdev->drv->path_event(cdev, path_event); break; } From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84680C433F5 for ; Mon, 14 Feb 2022 10:41:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349941AbiBNKld (ORCPT ); Mon, 14 Feb 2022 05:41:33 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:52194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233396AbiBNKhb (ORCPT ); Mon, 14 Feb 2022 05:37:31 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A9CAA8882; Mon, 14 Feb 2022 02:03:46 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9F0436077B; Mon, 14 Feb 2022 10:03:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6426FC340E9; Mon, 14 Feb 2022 10:03:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832995; bh=p11gsTIR0/f7UkZ4V4WyUxCY6A2mvza/KzjBcE5aFc0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oiVU3Q5uvJUfbrX6Hyk7EqU/EdfyVHtPd2Wb9Q8w+TLOen/38ACW5YHVT+L9J3O39 qWosISejSg/sdzixwLXeVmvv4SN3S5Z30MwWpw0nUudi6EEaVqY+CP7VKGyOmP83L6 jkE41/VEBLZRnlan6GBQ1ztJf+R5yKQB9DMVWgow= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manivannan Sadhasivam , Slark Xiao , Manivannan Sadhasivam Subject: [PATCH 5.16 191/203] bus: mhi: pci_generic: Add mru_default for Foxconn SDX55 Date: Mon, 14 Feb 2022 10:27:15 +0100 Message-Id: <20220214092516.742116372@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Slark Xiao commit a0572cea8866230ac13da6358c88075f89e99b20 upstream. For default mechanism, product would use default MRU 3500 if they didn't define it. But for Foxconn SDX55, there is a known issue which MRU 3500 would lead to data connection lost. So we align it with Qualcomm default MRU settings. Link: https://lore.kernel.org/r/20220119101213.5008-1-slark_xiao@163.com [mani: Added pci_generic prefix to subject and CCed stable] Fixes: aac426562f56 ("bus: mhi: pci_generic: Introduce Foxconn T99W175 supp= ort") Cc: stable@vger.kernel.org # v5.12+ Reviewed-by: Manivannan Sadhasivam Signed-off-by: Slark Xiao Signed-off-by: Manivannan Sadhasivam Link: https://lore.kernel.org/r/20220205135731.157871-2-manivannan.sadhasiv= am@linaro.org Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/bus/mhi/pci_generic.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/bus/mhi/pci_generic.c +++ b/drivers/bus/mhi/pci_generic.c @@ -366,6 +366,7 @@ static const struct mhi_pci_dev_info mhi .config =3D &modem_foxconn_sdx55_config, .bar_num =3D MHI_PCI_DEFAULT_BAR_NUM, .dma_data_width =3D 32, + .mru_default =3D 32768, .sideband_wake =3D false, }; =20 From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D758C433F5 for ; Mon, 14 Feb 2022 10:42:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349761AbiBNKlZ (ORCPT ); Mon, 14 Feb 2022 05:41:25 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348452AbiBNKhP (ORCPT ); Mon, 14 Feb 2022 05:37:15 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1442A74FB; Mon, 14 Feb 2022 02:03:44 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 61D61B80D6D; Mon, 14 Feb 2022 10:03:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 830FBC340E9; Mon, 14 Feb 2022 10:03:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644832998; bh=9/6JzC8Ei1Q6WqapUktg2s5rVzX9QnQZ38BxlY9Zk18=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ep8KVCkHHJ6/lGQxYi5RxlRsyKdyN06vhGxvortR7emXTUHauxcIOm0/PGWkU+tiA XkZrb8rfEzrNbaW764QmaeZy3ylvS+Rz9aDChLAjq51PmjZ+mxlrbjkuim8+FHWHNS moPv07O9y5RWYsV1I/mC6uV9ozYiet/htb3vEZ08= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Manivannan Sadhasivam , Slark Xiao , Manivannan Sadhasivam Subject: [PATCH 5.16 192/203] bus: mhi: pci_generic: Add mru_default for Cinterion MV31-W Date: Mon, 14 Feb 2022 10:27:16 +0100 Message-Id: <20220214092516.775197639@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Slark Xiao commit 05daa805a86c831ad9692f6f15e1b877c8f10638 upstream. For default mechanism, product would use default MRU 3500 if they didn't define it. But for Cinterion MV31-W, there is a known issue which MRU 3500 would lead to data connection lost. So we align it with Qualcomm default MRU settings. Link: https://lore.kernel.org/r/20220119102519.5342-1-slark_xiao@163.com [mani: Modified the commit message to reflect Cinterion MV31-W and CCed sta= ble] Fixes: 87693e092bd0 ("bus: mhi: pci_generic: Add Cinterion MV31-W PCIe to M= HI") Cc: stable@vger.kernel.org # v5.14 + Reviewed-by: Manivannan Sadhasivam Signed-off-by: Slark Xiao Signed-off-by: Manivannan Sadhasivam Link: https://lore.kernel.org/r/20220205135731.157871-3-manivannan.sadhasiv= am@linaro.org Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/bus/mhi/pci_generic.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/bus/mhi/pci_generic.c +++ b/drivers/bus/mhi/pci_generic.c @@ -402,6 +402,7 @@ static const struct mhi_pci_dev_info mhi .config =3D &modem_mv31_config, .bar_num =3D MHI_PCI_DEFAULT_BAR_NUM, .dma_data_width =3D 32, + .mru_default =3D 32768, }; =20 static const struct pci_device_id mhi_pci_id_table[] =3D { From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A449FC433EF for ; Mon, 14 Feb 2022 10:41:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350008AbiBNKlj (ORCPT ); Mon, 14 Feb 2022 05:41:39 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:49858 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348645AbiBNKhf (ORCPT ); Mon, 14 Feb 2022 05:37:35 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50277A888D; Mon, 14 Feb 2022 02:03:48 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A058060C8A; Mon, 14 Feb 2022 10:03:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86A78C340E9; Mon, 14 Feb 2022 10:03:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644833002; bh=NOLA5kg11otvmBJsW+m0RL1uhgYczBCkkn/7e1ziXuw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hTcYYA/gc7HM/5p9jskP06/PPyJy4ipvhj//Xg/u+VhlLwtC267VZ7fqfNLd6Ys8M 5KSKBIonGTA6bqTXYUvDZ77hf/6GAXjDRBdvMvblxxmD6pQTu10cfJZnDZtRyFjjXe 6G8APY2YoMFwStX+F13fpn21+lFdCOnWTj+XH8dY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vijay Dhanraj , Reinette Chatre , Dave Hansen , Jarkko Sakkinen Subject: [PATCH 5.16 193/203] x86/sgx: Silence softlockup detection when releasing large enclaves Date: Mon, 14 Feb 2022 10:27:17 +0100 Message-Id: <20220214092516.943836506@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Reinette Chatre commit 8795359e35bc33bf86b6d0765aa7f37431db3b9c upstream. Vijay reported that the "unclobbered_vdso_oversubscribed" selftest triggers the softlockup detector. Actual SGX systems have 128GB of enclave memory or more. The "unclobbered_vdso_oversubscribed" selftest creates one enclave which consumes all of the enclave memory on the system. Tearing down such a large enclave takes around a minute, most of it in the loop where the EREMOVE instruction is applied to each individual 4k enclave page. Spending one minute in a loop triggers the softlockup detector. Add a cond_resched() to give other tasks a chance to run and placate the softlockup detector. Cc: stable@vger.kernel.org Fixes: 1728ab54b4be ("x86/sgx: Add a page reclaimer") Reported-by: Vijay Dhanraj Signed-off-by: Reinette Chatre Signed-off-by: Dave Hansen Reviewed-by: Jarkko Sakkinen Acked-by: Dave Hansen Tested-by: Jarkko Sakkinen (kselftest as sanity check) Link: https://lkml.kernel.org/r/ced01cac1e75f900251b0a4ae1150aa8ebd295ec.16= 44345232.git.reinette.chatre@intel.com Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/x86/kernel/cpu/sgx/encl.c | 2 ++ 1 file changed, 2 insertions(+) --- a/arch/x86/kernel/cpu/sgx/encl.c +++ b/arch/x86/kernel/cpu/sgx/encl.c @@ -410,6 +410,8 @@ void sgx_encl_release(struct kref *ref) } =20 kfree(entry); + /* Invoke scheduler to prevent soft lockups. */ + cond_resched(); } =20 xa_destroy(&encl->page_array); From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9F33C4332F for ; Mon, 14 Feb 2022 10:41:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350095AbiBNKlp (ORCPT ); Mon, 14 Feb 2022 05:41:45 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:52208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348323AbiBNKhi (ORCPT ); Mon, 14 Feb 2022 05:37:38 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AED28A888F; Mon, 14 Feb 2022 02:03:48 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1E3EA60DD6; Mon, 14 Feb 2022 10:03:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9E8FC340E9; Mon, 14 Feb 2022 10:03:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644833005; bh=WjWj5UqYMO2b8veFSO60vsb49mBfNNGgkUPB3nQIBpE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TPk0Jv+Vnvo+W+TZl45ybVPJKTbu5oh3R9MFGS2wmMNhHOZ/f5oiOnrLIqoJ8k655 59Bauk9/mOQsV4nsYP2LfJvT+GqWDo3qgrdz+ik0NZ/66SdJ+gxRLQFEOWsVoEpNIa WAeJHYn4u+bOmknvcV0GPPWjrOlcvSjsCqAVHpO0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+af7a719bc92395ee41b3@syzkaller.appspotmail.com, Tadeusz Struk , "Peter Zijlstra (Intel)" , Dietmar Eggemann Subject: [PATCH 5.16 194/203] sched/fair: Fix fault in reweight_entity Date: Mon, 14 Feb 2022 10:27:18 +0100 Message-Id: <20220214092516.983676726@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tadeusz Struk commit 13765de8148f71fa795e0a6607de37c49ea5915a upstream. Syzbot found a GPF in reweight_entity. This has been bisected to commit 4ef0c5c6b5ba ("kernel/sched: Fix sched_fork() access an invalid sched_task_group") There=C2=A0is a race between sched_post_fork() and setpriority(PRIO_PGRP) within a thread group that causes a null-ptr-deref=C2=A0in reweight_entity() in CFS. The scenario is that the main process spawns number of new threads, which then call setpriority(PRIO_PGRP, 0, -20), wait, and exit. For each of the new threads the copy_process() gets invoked, which adds the new task_struct and calls sched_post_fork() for it. In the above scenario there is a possibility that setpriority(PRIO_PGRP) and set_one_prio() will be called for a thread in the group that is just being created by copy_process(), and for which the sched_post_fork() has not been executed yet. This will trigger a null pointer dereference in reweight_entity(),=C2=A0as it will try to access the run queue pointer, which hasn't been set. Before the mentioned change the cfs_rq pointer for the task has been set in sched_fork(), which is called much earlier in copy_process(), before the new task is added to the thread_group. Now it is done in the sched_post_fork(), which is called after that. To fix the issue the remove the update_load param from the update_load param() function and call reweight_task() only if the task flag doesn't have the TASK_NEW flag set. Fixes: 4ef0c5c6b5ba ("kernel/sched: Fix sched_fork() access an invalid sche= d_task_group") Reported-by: syzbot+af7a719bc92395ee41b3@syzkaller.appspotmail.com Signed-off-by: Tadeusz Struk Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Dietmar Eggemann Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/20220203161846.1160750-1-tadeusz.struk@lina= ro.org Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- kernel/sched/core.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -1203,8 +1203,9 @@ int tg_nop(struct task_group *tg, void * } #endif =20 -static void set_load_weight(struct task_struct *p, bool update_load) +static void set_load_weight(struct task_struct *p) { + bool update_load =3D !(READ_ONCE(p->__state) & TASK_NEW); int prio =3D p->static_prio - MAX_RT_PRIO; struct load_weight *load =3D &p->se.load; =20 @@ -4392,7 +4393,7 @@ int sched_fork(unsigned long clone_flags p->static_prio =3D NICE_TO_PRIO(0); =20 p->prio =3D p->normal_prio =3D p->static_prio; - set_load_weight(p, false); + set_load_weight(p); =20 /* * We don't need the reset flag anymore after the fork. It has @@ -6879,7 +6880,7 @@ void set_user_nice(struct task_struct *p put_prev_task(rq, p); =20 p->static_prio =3D NICE_TO_PRIO(nice); - set_load_weight(p, true); + set_load_weight(p); old_prio =3D p->prio; p->prio =3D effective_prio(p); =20 @@ -7170,7 +7171,7 @@ static void __setscheduler_params(struct */ p->rt_priority =3D attr->sched_priority; p->normal_prio =3D normal_prio(p); - set_load_weight(p, true); + set_load_weight(p); } =20 /* @@ -9409,7 +9410,7 @@ void __init sched_init(void) #endif } =20 - set_load_weight(&init_task, false); + set_load_weight(&init_task); =20 /* * The boot idle thread does lazy MMU switching as well: From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3BE1C433F5 for ; Mon, 14 Feb 2022 10:40:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347762AbiBNKk2 (ORCPT ); Mon, 14 Feb 2022 05:40:28 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350269AbiBNKhB (ORCPT ); Mon, 14 Feb 2022 05:37:01 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73237A66FC; Mon, 14 Feb 2022 02:03:35 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5129CB80DA6; Mon, 14 Feb 2022 10:03:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78861C340E9; Mon, 14 Feb 2022 10:03:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644833012; bh=3AAAJwkkpJAVdQ8g3D/3TqrN1ZQgpjd4xMjw1mc5W6Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PvytXhlDQDhJxNnxhoFJFhTI/2xvnlJ57CQbCMNpIIZYz83dZNT1TREn0dpmX3g1b sZQG/nKVK+f/ZOPAG9B71K5dbIowywloNhNVCogDwNvvI2/UBJYar9E804eYlOxog7 DKfBfPWvRh+bub44F5cMXYnU8DPJmQqJlzR36K74= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nathan Chancellor , Nick Desaulniers , Masahiro Yamada Subject: [PATCH 5.16 195/203] Makefile.extrawarn: Move -Wunaligned-access to W=1 Date: Mon, 14 Feb 2022 10:27:19 +0100 Message-Id: <20220214092517.013301061@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nathan Chancellor commit 1cf5f151d25fcca94689efd91afa0253621fb33a upstream. -Wunaligned-access is a new warning in clang that is default enabled for arm and arm64 under certain circumstances within the clang frontend (see LLVM commit below). On v5.17-rc2, an ARCH=3Darm allmodconfig build shows 1284 total/70 unique instances of this warning (most of the instances are in header files), which is quite noisy. To keep a normal build green through CONFIG_WERROR, only show this warning with W=3D1, which will allow automated build systems to catch new instances of the warning so that the total number can be driven down to zero eventually since catching unaligned accesses at compile time would be generally useful. Cc: stable@vger.kernel.org Link: https://github.com/llvm/llvm-project/commit/35737df4dcd28534bd3090157= c224c19b501278a Link: https://github.com/ClangBuiltLinux/linux/issues/1569 Link: https://github.com/ClangBuiltLinux/linux/issues/1576 Signed-off-by: Nathan Chancellor Reviewed-by: Nick Desaulniers Signed-off-by: Masahiro Yamada Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- scripts/Makefile.extrawarn | 1 + 1 file changed, 1 insertion(+) --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn @@ -51,6 +51,7 @@ KBUILD_CFLAGS +=3D -Wno-sign-compare KBUILD_CFLAGS +=3D -Wno-format-zero-length KBUILD_CFLAGS +=3D $(call cc-disable-warning, pointer-to-enum-cast) KBUILD_CFLAGS +=3D -Wno-tautological-constant-out-of-range-compare +KBUILD_CFLAGS +=3D $(call cc-disable-warning, unaligned-access) endif =20 endif From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E723C433F5 for ; Mon, 14 Feb 2022 10:42:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236860AbiBNKmk (ORCPT ); Mon, 14 Feb 2022 05:42:40 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:49184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348912AbiBNKkH (ORCPT ); Mon, 14 Feb 2022 05:40:07 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0ECD41318; Mon, 14 Feb 2022 02:04:07 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BF9B0B80DCA; Mon, 14 Feb 2022 10:03:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9372C340EF; Mon, 14 Feb 2022 10:03:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644833015; bh=QUkw2cL9AMbwzEWly0EXBWLsADd+Rau9WRrGJKiibKI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XAhEvelr+6eJEMxi8JiMCRmfojz3cGjihhrj7VDVdOEaYyQk5xxAAWxqyf21TkrGT bkoDEiUjQPN51xsi4ISAf8XXxoVSBpkWACfT4z4Zn2aH1j/8Sen/aLtzmzXODf/YWu 8XCajxR9HLM0A90kkjS4cnDfsCDXhI3nf/dUWeKM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Ewan D. Milne" , James Smart , "Martin K. Petersen" Subject: [PATCH 5.16 196/203] scsi: lpfc: Remove NVMe support if kernel has NVME_FC disabled Date: Mon, 14 Feb 2022 10:27:20 +0100 Message-Id: <20220214092517.044600427@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 c80b27cfd93ba9f5161383f798414609e84729f3 upstream. The driver is initiating NVMe PRLIs to determine device NVMe support. This should not be occurring if CONFIG_NVME_FC support is disabled. Correct this by changing the default value for FC4 support. Currently it defaults to FCP and NVMe. With change, when NVME_FC support is not enabled in the kernel, the default value is just FCP. Link: https://lore.kernel.org/r/20220207180516.73052-1-jsmart2021@gmail.com Reviewed-by: Ewan D. Milne 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: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/scsi/lpfc/lpfc.h | 13 ++++++++++--- drivers/scsi/lpfc/lpfc_attr.c | 4 ++-- 2 files changed, 12 insertions(+), 5 deletions(-) --- a/drivers/scsi/lpfc/lpfc.h +++ b/drivers/scsi/lpfc/lpfc.h @@ -1165,6 +1165,16 @@ struct lpfc_hba { uint32_t cfg_hostmem_hgp; uint32_t cfg_log_verbose; uint32_t cfg_enable_fc4_type; +#define LPFC_ENABLE_FCP 1 +#define LPFC_ENABLE_NVME 2 +#define LPFC_ENABLE_BOTH 3 +#if (IS_ENABLED(CONFIG_NVME_FC)) +#define LPFC_MAX_ENBL_FC4_TYPE LPFC_ENABLE_BOTH +#define LPFC_DEF_ENBL_FC4_TYPE LPFC_ENABLE_BOTH +#else +#define LPFC_MAX_ENBL_FC4_TYPE LPFC_ENABLE_FCP +#define LPFC_DEF_ENBL_FC4_TYPE LPFC_ENABLE_FCP +#endif uint32_t cfg_aer_support; uint32_t cfg_sriov_nr_virtfn; uint32_t cfg_request_firmware_upgrade; @@ -1186,9 +1196,6 @@ struct lpfc_hba { uint32_t cfg_ras_fwlog_func; uint32_t cfg_enable_bbcr; /* Enable BB Credit Recovery */ uint32_t cfg_enable_dpp; /* Enable Direct Packet Push */ -#define LPFC_ENABLE_FCP 1 -#define LPFC_ENABLE_NVME 2 -#define LPFC_ENABLE_BOTH 3 uint32_t cfg_enable_pbde; uint32_t cfg_enable_mi; struct nvmet_fc_target_port *targetport; --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -3978,8 +3978,8 @@ LPFC_ATTR_R(nvmet_mrq_post, * 3 - register both FCP and NVME * Supported values are [1,3]. Default value is 3 */ -LPFC_ATTR_R(enable_fc4_type, LPFC_ENABLE_BOTH, - LPFC_ENABLE_FCP, LPFC_ENABLE_BOTH, +LPFC_ATTR_R(enable_fc4_type, LPFC_DEF_ENBL_FC4_TYPE, + LPFC_ENABLE_FCP, LPFC_MAX_ENBL_FC4_TYPE, "Enable FC4 Protocol support - FCP / NVME"); =20 /* From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92473C433F5 for ; Mon, 14 Feb 2022 10:42:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236375AbiBNKm3 (ORCPT ); Mon, 14 Feb 2022 05:42:29 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:60118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348913AbiBNKkH (ORCPT ); Mon, 14 Feb 2022 05:40:07 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00585A996C; Mon, 14 Feb 2022 02:04:07 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5760660C71; Mon, 14 Feb 2022 10:03:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F72FC340EF; Mon, 14 Feb 2022 10:03:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644833018; bh=Iba0bhVWbv65LEtyimLjewsI7MTZ4cgTdh9iuTXjT8U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oyP3XmsHY84Vfsvr+fcDybtyZ7DlfOYi1p47V5kxOgRyQekX0Pbk9Tst9bluZJXi0 RDBHNJenT4xQ3gs6UNZUMcpcHtx9b34m3iYNylr+UakGxwfE2w3hVUmTIEgMf8H87A pLjv0k65+nvegBQhrAIcpsQtd7Vdr4JFKW/sbpS0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Ewan D. Milne" , James Smart , "Martin K. Petersen" Subject: [PATCH 5.16 197/203] scsi: lpfc: Reduce log messages seen after firmware download Date: Mon, 14 Feb 2022 10:27:21 +0100 Message-Id: <20220214092517.074843878@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 5852ed2a6a39c862c8a3fdf646e1f4e01b91d710 upstream. Messages around firmware download were incorrectly tagged as being related to discovery trace events. Thus, firmware download status ended up dumping the trace log as well as the firmware update message. As there were a couple of log messages in this state, the trace log was dumped multiple times. Resolve this by converting from trace events to SLI events. Link: https://lore.kernel.org/r/20220207180442.72836-1-jsmart2021@gmail.com Reviewed-by: Ewan D. Milne 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: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/scsi/lpfc/lpfc_init.c | 2 +- drivers/scsi/lpfc/lpfc_sli.c | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c @@ -2104,7 +2104,7 @@ lpfc_handle_eratt_s4(struct lpfc_hba *ph } if (reg_err1 =3D=3D SLIPORT_ERR1_REG_ERR_CODE_2 && reg_err2 =3D=3D SLIPORT_ERR2_REG_FW_RESTART) { - lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, + lpfc_printf_log(phba, KERN_ERR, LOG_SLI, "3143 Port Down: Firmware Update " "Detected\n"); en_rn_msg =3D false; --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -13365,6 +13365,7 @@ lpfc_sli4_eratt_read(struct lpfc_hba *ph uint32_t uerr_sta_hi, uerr_sta_lo; uint32_t if_type, portsmphr; struct lpfc_register portstat_reg; + u32 logmask; =20 /* * For now, use the SLI4 device internal unrecoverable error @@ -13415,7 +13416,12 @@ lpfc_sli4_eratt_read(struct lpfc_hba *ph readl(phba->sli4_hba.u.if_type2.ERR1regaddr); phba->work_status[1] =3D readl(phba->sli4_hba.u.if_type2.ERR2regaddr); - lpfc_printf_log(phba, KERN_ERR, LOG_TRACE_EVENT, + logmask =3D LOG_TRACE_EVENT; + if (phba->work_status[0] =3D=3D + SLIPORT_ERR1_REG_ERR_CODE_2 && + phba->work_status[1] =3D=3D SLIPORT_ERR2_REG_FW_RESTART) + logmask =3D LOG_SLI; + lpfc_printf_log(phba, KERN_ERR, logmask, "2885 Port Status Event: " "port status reg 0x%x, " "port smphr reg 0x%x, " From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2D22C4321E for ; Mon, 14 Feb 2022 10:41:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349677AbiBNKlW (ORCPT ); Mon, 14 Feb 2022 05:41:22 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348427AbiBNKhO (ORCPT ); Mon, 14 Feb 2022 05:37:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60FFBA74FA; Mon, 14 Feb 2022 02:03:44 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F250CB80DFE; Mon, 14 Feb 2022 10:03:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27169C340E9; Mon, 14 Feb 2022 10:03:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644833021; bh=ITOrIx8iB3hB/ew+YJcfeMU3x2zKuqG38QfwPFUBUfw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zyVizqHXdPzI85I0AmD1NYQMMPSC23AhVZllc273fTa+u1ZCjqfy6ugVeyGC+MzPC MFNgTmTyNeieYvS3j3rGE+1UTRMJrensBri9zPA2lWIDBwmAQtHbThg0tBtTWNvVy3 IgZeyhguuCEbt45UM4UyAwEEQbzalAocx9959Sbw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Bogendoerfer Subject: [PATCH 5.16 198/203] MIPS: octeon: Fix missed PTR->PTR_WD conversion Date: Mon, 14 Feb 2022 10:27:22 +0100 Message-Id: <20220214092517.106713961@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Bogendoerfer commit 50317b636e7184d15126e2dfc83db0963a38d31e upstream. Fixes: fa62f39dc7e2 ("MIPS: Fix build error due to PTR used in more places") Signed-off-by: Thomas Bogendoerfer Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/mips/cavium-octeon/octeon-memcpy.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/mips/cavium-octeon/octeon-memcpy.S +++ b/arch/mips/cavium-octeon/octeon-memcpy.S @@ -74,7 +74,7 @@ #define EXC(inst_reg,addr,handler) \ 9: inst_reg, addr; \ .section __ex_table,"a"; \ - PTR 9b, handler; \ + PTR_WD 9b, handler; \ .previous =20 /* From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E28F5C43219 for ; Mon, 14 Feb 2022 10:41:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349864AbiBNKl1 (ORCPT ); Mon, 14 Feb 2022 05:41:27 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:49196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348550AbiBNKhV (ORCPT ); Mon, 14 Feb 2022 05:37:21 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11D9FA8881; Mon, 14 Feb 2022 02:03:46 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6E0CA60C76; Mon, 14 Feb 2022 10:03:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B9CFC340EF; Mon, 14 Feb 2022 10:03:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644833024; bh=PWC4MiolHqPxzZqlrPZg8QnjhC1NnQ1cEiBb2jdkjgg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wl34C9gt6QZdt3G4KclWS093pA1v+MmPqn6mKVAtyXBCo/155/1HXW5rQuV6RY0/A lh8UST8xs+QJS5Wr0Nl/fcmHqvWSoEB/Xl24UpxBUCJLohjZyE7HtRf3swJjhIpu9h et+xJlpqbJ0Cvb6PkdeybmHMH10w80AAEUHifyII= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Stein , Fabio Estevam , Shawn Guo Subject: [PATCH 5.16 199/203] arm64: dts: imx8mq: fix lcdif port node Date: Mon, 14 Feb 2022 10:27:23 +0100 Message-Id: <20220214092517.138672593@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Stein commit 91f6d5f181f6629dd74ab71759fe92d3f4eff966 upstream. The port node does not have a unit-address, remove it. This fixes the warnings: lcd-controller@30320000: 'port' is a required property lcd-controller@30320000: 'port@0' does not match any of the regexes: 'pinctrl-[0-9]+' Fixes: commit d0081bd02a03 ("arm64: dts: imx8mq: Add NWL MIPI DSI controlle= r") Signed-off-by: Alexander Stein Reviewed-by: Fabio Estevam Signed-off-by: Shawn Guo Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- arch/arm64/boot/dts/freescale/imx8mq.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/arch/arm64/boot/dts/freescale/imx8mq.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mq.dtsi @@ -526,7 +526,7 @@ assigned-clock-rates =3D <0>, <0>, <0>, <594000000>; status =3D "disabled"; =20 - port@0 { + port { lcdif_mipi_dsi: endpoint { remote-endpoint =3D <&mipi_dsi_lcdif_in>; }; From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4D8C2C4332F for ; Mon, 14 Feb 2022 10:42:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350173AbiBNKls (ORCPT ); Mon, 14 Feb 2022 05:41:48 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:52212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348680AbiBNKhk (ORCPT ); Mon, 14 Feb 2022 05:37:40 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19167A8892; Mon, 14 Feb 2022 02:03:49 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8DE1860DD7; Mon, 14 Feb 2022 10:03:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6FEA8C340E9; Mon, 14 Feb 2022 10:03:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644833028; bh=XHsiq3PFMyIQmhdaRWxgmjhLZbm1cobgoXAss8jZOOw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BBMMa0wjhQ2CpDQnJT6XsAaZzA7irc4nCbxVAxv/Vez5FvLtnGjNoCC7Ljog29Ttk o7Q0Cuthy0dA3+M0ozgSqwk5mMhcw1zfCm07fKXPVnqFhzi/XS3Y9Tfrj+NlLvUxSb tlmNfNOUrO9uR3fVhQa022WoiPMmYmtwGMXPzNNk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Song Liu , Rik van Riel , "Peter Zijlstra (Intel)" Subject: [PATCH 5.16 200/203] perf: Fix list corruption in perf_cgroup_switch() Date: Mon, 14 Feb 2022 10:27:24 +0100 Message-Id: <20220214092517.171509481@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Song Liu commit 5f4e5ce638e6a490b976ade4a40017b40abb2da0 upstream. There's list corruption on cgrp_cpuctx_list. This happens on the following path: perf_cgroup_switch: list_for_each_entry(cgrp_cpuctx_list) cpu_ctx_sched_in ctx_sched_in ctx_pinned_sched_in merge_sched_in perf_cgroup_event_disable: remove the event from the list Use list_for_each_entry_safe() to allow removing an entry during iteration. Fixes: 058fe1c0440e ("perf/core: Make cgroup switch visit only cpuctxs with= cgroup events") Signed-off-by: Song Liu Reviewed-by: Rik van Riel Signed-off-by: Peter Zijlstra (Intel) Link: https://lkml.kernel.org/r/20220204004057.2961252-1-song@kernel.org Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- kernel/events/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -839,7 +839,7 @@ static DEFINE_PER_CPU(struct list_head, */ static void perf_cgroup_switch(struct task_struct *task, int mode) { - struct perf_cpu_context *cpuctx; + struct perf_cpu_context *cpuctx, *tmp; struct list_head *list; unsigned long flags; =20 @@ -850,7 +850,7 @@ static void perf_cgroup_switch(struct ta local_irq_save(flags); =20 list =3D this_cpu_ptr(&cgrp_cpuctx_list); - list_for_each_entry(cpuctx, list, cgrp_cpuctx_entry) { + list_for_each_entry_safe(cpuctx, tmp, list, cgrp_cpuctx_entry) { WARN_ON_ONCE(cpuctx->ctx.nr_cgroups =3D=3D 0); =20 perf_ctx_lock(cpuctx, cpuctx->task_ctx); From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C3F1C433FE for ; Mon, 14 Feb 2022 10:42:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241668AbiBNKmU (ORCPT ); Mon, 14 Feb 2022 05:42:20 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:49188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348906AbiBNKkH (ORCPT ); Mon, 14 Feb 2022 05:40:07 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0DC840A3B; Mon, 14 Feb 2022 02:04:07 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 40578B80DA6; Mon, 14 Feb 2022 10:03:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6EBE2C340E9; Mon, 14 Feb 2022 10:03:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644833031; bh=fkDalG/b6PGqzj6WaVb4J36Ptr1/KBf8bM9KnaprYO0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yVcMV0G+hcjOzJfalCmi41onq/lbTEWVDdqxszH14utjHeGAB3/3iBpfgRClVOJQW AQGA0RXllpg+KaczGryYYVMDv5cDVHa63A/w772RbyqmVqMDskkCs5/mpL8dfRtbjK NKcI/YlFDV0rYW2qhJTlbEYB9C4krFxwDSZ7+RLE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ryan Cai , Masahiro Yamada Subject: [PATCH 5.16 201/203] kconfig: fix missing fclose() on error paths Date: Mon, 14 Feb 2022 10:27:25 +0100 Message-Id: <20220214092517.204082731@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Masahiro Yamada commit d23a0c3718222a42430fd56359478a6fc7675070 upstream. The file is not closed when ferror() fails. Fixes: 00d674cb3536 ("kconfig: refactor conf_write_dep()") Fixes: 57ddd07c4560 ("kconfig: refactor conf_write_autoconf()") Reported-by: Ryan Cai Signed-off-by: Masahiro Yamada Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- scripts/kconfig/confdata.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -977,10 +977,10 @@ static int conf_write_autoconf_cmd(const =20 fprintf(out, "\n$(deps_config): ;\n"); =20 - if (ferror(out)) /* error check for all fprintf() calls */ - return -1; - + ret =3D ferror(out); /* error check for all fprintf() calls */ fclose(out); + if (ret) + return -1; =20 if (rename(tmp, name)) { perror("rename"); @@ -1091,10 +1091,10 @@ static int __conf_write_autoconf(const c print_symbol(file, sym); =20 /* check possible errors in conf_write_heading() and print_symbol() */ - if (ferror(file)) - return -1; - + ret =3D ferror(file); fclose(file); + if (ret) + return -1; =20 if (rename(tmp, filename)) { perror("rename"); From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E019CC433FE for ; Mon, 14 Feb 2022 10:41:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349698AbiBNKly (ORCPT ); Mon, 14 Feb 2022 05:41:54 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348753AbiBNKic (ORCPT ); Mon, 14 Feb 2022 05:38:32 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E75BCA9949; Mon, 14 Feb 2022 02:03:56 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4E415B80DB7; Mon, 14 Feb 2022 10:03:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F0A6C340EF; Mon, 14 Feb 2022 10:03:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644833034; bh=zSxF394CzzOLorVxrPxYGvkJ2LgkRa2Vc1AgazkaAPA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Oye9LT94VrLqNbYCIJowybnHEcTNw3H8q8Jv3IS0yate0VpMMXC53CSW5A2QDMStJ 781Jmc5u+daQgBzNVonUfugch8DBSp+comXOO5Feqr/YNxtop6dWwcI3dzflGp7BKp S2gDPBVCkG1+ulC+KyBeQ6vLQ20j73LTzU8h1EKY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephen Rothwell , Chia-Wei Wang , Joel Stanley , Arnd Bergmann Subject: [PATCH 5.16 202/203] docs/ABI: testing: aspeed-uart-routing: Escape asterisk Date: Mon, 14 Feb 2022 10:27:26 +0100 Message-Id: <20220214092517.240687299@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chia-Wei Wang commit 088400521e421a1df7d0128dc0f9246db4ef1c7c upstream. Escape asterisk symbols to fix the following warning: "WARNING: Inline emphasis start-string without end-string" Fixes: c6807970c3bc ("soc: aspeed: Add UART routing support") Reported-by: Stephen Rothwell Signed-off-by: Chia-Wei Wang Signed-off-by: Joel Stanley Link: https://lore.kernel.org/r/20220124014351.9121-1-chiawei_wang@aspeedte= ch.com Link: https://lore.kernel.org/r/20220201070027.196314-1-joel@jms.id.au' Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- Documentation/ABI/testing/sysfs-driver-aspeed-uart-routing | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/Documentation/ABI/testing/sysfs-driver-aspeed-uart-routing +++ b/Documentation/ABI/testing/sysfs-driver-aspeed-uart-routing @@ -1,4 +1,4 @@ -What: /sys/bus/platform/drivers/aspeed-uart-routing/*/uart* +What: /sys/bus/platform/drivers/aspeed-uart-routing/\*/uart\* Date: September 2021 Contact: Oskar Senft Chia-Wei Wang @@ -9,7 +9,7 @@ Description: Selects the RX source of th depends on the selected file. =20 e.g. - cat /sys/bus/platform/drivers/aspeed-uart-routing/*.uart_routing/uart1 + cat /sys/bus/platform/drivers/aspeed-uart-routing/\*.uart_routing/uart1 [io1] io2 io3 io4 uart2 uart3 uart4 io6 =20 In this case, UART1 gets its input from IO1 (physical serial port 1). @@ -17,7 +17,7 @@ Description: Selects the RX source of th Users: OpenBMC. Proposed changes should be mailed to openbmc@lists.ozlabs.org =20 -What: /sys/bus/platform/drivers/aspeed-uart-routing/*/io* +What: /sys/bus/platform/drivers/aspeed-uart-routing/\*/io\* Date: September 2021 Contact: Oskar Senft Chia-Wei Wang From nobody Sun Jun 28 04:36:52 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EB47C43217 for ; Mon, 14 Feb 2022 10:42:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350259AbiBNKl6 (ORCPT ); Mon, 14 Feb 2022 05:41:58 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348831AbiBNKjC (ORCPT ); Mon, 14 Feb 2022 05:39:02 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B92F7A9952; Mon, 14 Feb 2022 02:03:58 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5509460F6F; Mon, 14 Feb 2022 10:03:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A959C340EF; Mon, 14 Feb 2022 10:03:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1644833037; bh=eoouvLz06CHKcUEApY0WLvSbsUzvgsZx8vVNA8xyZZU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tlHV2aSgiCxQfXTbGyku4M3XldbeSNh09qVESMx++kFxPqT8czEa2/W+vw83qt9Hs nTlEd5vvIQcfbTjYh+Rw4w5qOfqUEWvqbnBN/LDuNRBzpXlN++EHjhYWTXaXzbIQzi MsLCs+jMa7H6Zx+3t2YqO0qAFqHJvnE10sL4p150= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robin Murphy , Vijayanand Jitta , Joerg Roedel Subject: [PATCH 5.16 203/203] iommu: Fix potential use-after-free during probe Date: Mon, 14 Feb 2022 10:27:27 +0100 Message-Id: <20220214092517.273088998@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220214092510.221474733@linuxfoundation.org> References: <20220214092510.221474733@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vijayanand Jitta commit b54240ad494300ff0994c4539a531727874381f4 upstream. Kasan has reported the following use after free on dev->iommu. when a device probe fails and it is in process of freeing dev->iommu in dev_iommu_free function, a deferred_probe_work_func runs in parallel and tries to access dev->iommu->fwspec in of_iommu_configure path thus causing use after free. BUG: KASAN: use-after-free in of_iommu_configure+0xb4/0x4a4 Read of size 8 at addr ffffff87a2f1acb8 by task kworker/u16:2/153 Workqueue: events_unbound deferred_probe_work_func Call trace: dump_backtrace+0x0/0x33c show_stack+0x18/0x24 dump_stack_lvl+0x16c/0x1e0 print_address_description+0x84/0x39c __kasan_report+0x184/0x308 kasan_report+0x50/0x78 __asan_load8+0xc0/0xc4 of_iommu_configure+0xb4/0x4a4 of_dma_configure_id+0x2fc/0x4d4 platform_dma_configure+0x40/0x5c really_probe+0x1b4/0xb74 driver_probe_device+0x11c/0x228 __device_attach_driver+0x14c/0x304 bus_for_each_drv+0x124/0x1b0 __device_attach+0x25c/0x334 device_initial_probe+0x24/0x34 bus_probe_device+0x78/0x134 deferred_probe_work_func+0x130/0x1a8 process_one_work+0x4c8/0x970 worker_thread+0x5c8/0xaec kthread+0x1f8/0x220 ret_from_fork+0x10/0x18 Allocated by task 1: ____kasan_kmalloc+0xd4/0x114 __kasan_kmalloc+0x10/0x1c kmem_cache_alloc_trace+0xe4/0x3d4 __iommu_probe_device+0x90/0x394 probe_iommu_group+0x70/0x9c bus_for_each_dev+0x11c/0x19c bus_iommu_probe+0xb8/0x7d4 bus_set_iommu+0xcc/0x13c arm_smmu_bus_init+0x44/0x130 [arm_smmu] arm_smmu_device_probe+0xb88/0xc54 [arm_smmu] platform_drv_probe+0xe4/0x13c really_probe+0x2c8/0xb74 driver_probe_device+0x11c/0x228 device_driver_attach+0xf0/0x16c __driver_attach+0x80/0x320 bus_for_each_dev+0x11c/0x19c driver_attach+0x38/0x48 bus_add_driver+0x1dc/0x3a4 driver_register+0x18c/0x244 __platform_driver_register+0x88/0x9c init_module+0x64/0xff4 [arm_smmu] do_one_initcall+0x17c/0x2f0 do_init_module+0xe8/0x378 load_module+0x3f80/0x4a40 __se_sys_finit_module+0x1a0/0x1e4 __arm64_sys_finit_module+0x44/0x58 el0_svc_common+0x100/0x264 do_el0_svc+0x38/0xa4 el0_svc+0x20/0x30 el0_sync_handler+0x68/0xac el0_sync+0x160/0x180 Freed by task 1: kasan_set_track+0x4c/0x84 kasan_set_free_info+0x28/0x4c ____kasan_slab_free+0x120/0x15c __kasan_slab_free+0x18/0x28 slab_free_freelist_hook+0x204/0x2fc kfree+0xfc/0x3a4 __iommu_probe_device+0x284/0x394 probe_iommu_group+0x70/0x9c bus_for_each_dev+0x11c/0x19c bus_iommu_probe+0xb8/0x7d4 bus_set_iommu+0xcc/0x13c arm_smmu_bus_init+0x44/0x130 [arm_smmu] arm_smmu_device_probe+0xb88/0xc54 [arm_smmu] platform_drv_probe+0xe4/0x13c really_probe+0x2c8/0xb74 driver_probe_device+0x11c/0x228 device_driver_attach+0xf0/0x16c __driver_attach+0x80/0x320 bus_for_each_dev+0x11c/0x19c driver_attach+0x38/0x48 bus_add_driver+0x1dc/0x3a4 driver_register+0x18c/0x244 __platform_driver_register+0x88/0x9c init_module+0x64/0xff4 [arm_smmu] do_one_initcall+0x17c/0x2f0 do_init_module+0xe8/0x378 load_module+0x3f80/0x4a40 __se_sys_finit_module+0x1a0/0x1e4 __arm64_sys_finit_module+0x44/0x58 el0_svc_common+0x100/0x264 do_el0_svc+0x38/0xa4 el0_svc+0x20/0x30 el0_sync_handler+0x68/0xac el0_sync+0x160/0x180 Fix this by setting dev->iommu to NULL first and then freeing dev_iommu structure in dev_iommu_free function. Suggested-by: Robin Murphy Signed-off-by: Vijayanand Jitta Link: https://lore.kernel.org/r/1643613155-20215-1-git-send-email-quic_vjit= ta@quicinc.com Signed-off-by: Joerg Roedel Signed-off-by: Greg Kroah-Hartman Reported-by: Linux Kernel Functional Testing Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Jeffrin Jose T Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Scott Bruce Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Zan Aziz --- drivers/iommu/iommu.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -207,9 +207,14 @@ static struct dev_iommu *dev_iommu_get(s =20 static void dev_iommu_free(struct device *dev) { - iommu_fwspec_free(dev); - kfree(dev->iommu); + struct dev_iommu *param =3D dev->iommu; + dev->iommu =3D NULL; + if (param->fwspec) { + fwnode_handle_put(param->fwspec->iommu_fwnode); + kfree(param->fwspec); + } + kfree(param); } =20 static int __iommu_probe_device(struct device *dev, struct list_head *grou= p_list)