From nobody Mon Jun 22 15:38:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 642B4C433F5 for ; Mon, 21 Mar 2022 14:05:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347426AbiCUOHU (ORCPT ); Mon, 21 Mar 2022 10:07:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346367AbiCUN75 (ORCPT ); Mon, 21 Mar 2022 09:59:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D1CE2E9CD; Mon, 21 Mar 2022 06:58:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CCE5F6126E; Mon, 21 Mar 2022 13:58:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB44FC340FB; Mon, 21 Mar 2022 13:58:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871111; bh=AJsb5X7wBUotw3TxRY558vOtFqFD4GfaPxqom60XZWc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZglJy2Xaoi3qAMNKPjl3ahwkvgRYizp0PdQ0kiIy84cBDi5WN0N7OpJuxSwN43bOt +L9CPwB2C2b4hxHBEgtNbS3oMl+Jk+bv9GW64PlGZEo5PglmqiHpRtp1z3QSbqyT5r HAVNpQ5DO0L7V6R73VvXKygUyZJTcBcz+vomqjQM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Masney , Bjorn Andersson , Andrew Halaney , Herbert Xu Subject: [PATCH 5.10 01/30] crypto: qcom-rng - ensure buffer for generate is completely filled Date: Mon, 21 Mar 2022 14:52:31 +0100 Message-Id: <20220321133219.688329836@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133219.643490199@linuxfoundation.org> References: <20220321133219.643490199@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Brian Masney commit a680b1832ced3b5fa7c93484248fd221ea0d614b upstream. The generate function in struct rng_alg expects that the destination buffer is completely filled if the function returns 0. qcom_rng_read() can run into a situation where the buffer is partially filled with randomness and the remaining part of the buffer is zeroed since qcom_rng_generate() doesn't check the return value. This issue can be reproduced by running the following from libkcapi: kcapi-rng -b 9000000 > OUTFILE The generated OUTFILE will have three huge sections that contain all zeros, and this is caused by the code where the test 'val & PRNG_STATUS_DATA_AVAIL' fails. Let's fix this issue by ensuring that qcom_rng_read() always returns with a full buffer if the function returns success. Let's also have qcom_rng_generate() return the correct value. Here's some statistics from the ent project (https://www.fourmilab.ch/random/) that shows information about the quality of the generated numbers: $ ent -c qcom-random-before Value Char Occurrences Fraction 0 606748 0.067416 1 33104 0.003678 2 33001 0.003667 ... 253 =EF=BF=BD 32883 0.003654 254 =EF=BF=BD 33035 0.003671 255 =EF=BF=BD 33239 0.003693 Total: 9000000 1.000000 Entropy =3D 7.811590 bits per byte. Optimum compression would reduce the size of this 9000000 byte file by 2 percent. Chi square distribution for 9000000 samples is 9329962.81, and randomly would exceed this value less than 0.01 percent of the times. Arithmetic mean value of data bytes is 119.3731 (127.5 =3D random). Monte Carlo value for Pi is 3.197293333 (error 1.77 percent). Serial correlation coefficient is 0.159130 (totally uncorrelated =3D 0.0). Without this patch, the results of the chi-square test is 0.01%, and the numbers are certainly not random according to ent's project page. The results improve with this patch: $ ent -c qcom-random-after Value Char Occurrences Fraction 0 35432 0.003937 1 35127 0.003903 2 35424 0.003936 ... 253 =EF=BF=BD 35201 0.003911 254 =EF=BF=BD 34835 0.003871 255 =EF=BF=BD 35368 0.003930 Total: 9000000 1.000000 Entropy =3D 7.999979 bits per byte. Optimum compression would reduce the size of this 9000000 byte file by 0 percent. Chi square distribution for 9000000 samples is 258.77, and randomly would exceed this value 42.24 percent of the times. Arithmetic mean value of data bytes is 127.5006 (127.5 =3D random). Monte Carlo value for Pi is 3.141277333 (error 0.01 percent). Serial correlation coefficient is 0.000468 (totally uncorrelated =3D 0.0). This change was tested on a Nexus 5 phone (msm8974 SoC). Signed-off-by: Brian Masney Fixes: ceec5f5b5988 ("crypto: qcom-rng - Add Qcom prng driver") Cc: stable@vger.kernel.org # 4.19+ Reviewed-by: Bjorn Andersson Reviewed-by: Andrew Halaney Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/crypto/qcom-rng.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) --- a/drivers/crypto/qcom-rng.c +++ b/drivers/crypto/qcom-rng.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -43,16 +44,19 @@ static int qcom_rng_read(struct qcom_rng { unsigned int currsize =3D 0; u32 val; + int ret; =20 /* read random data from hardware */ do { - val =3D readl_relaxed(rng->base + PRNG_STATUS); - if (!(val & PRNG_STATUS_DATA_AVAIL)) - break; + ret =3D readl_poll_timeout(rng->base + PRNG_STATUS, val, + val & PRNG_STATUS_DATA_AVAIL, + 200, 10000); + if (ret) + return ret; =20 val =3D readl_relaxed(rng->base + PRNG_DATA_OUT); if (!val) - break; + return -EINVAL; =20 if ((max - currsize) >=3D WORD_SZ) { memcpy(data, &val, WORD_SZ); @@ -61,11 +65,10 @@ static int qcom_rng_read(struct qcom_rng } else { /* copy only remaining bytes */ memcpy(data, &val, max - currsize); - break; } } while (currsize < max); =20 - return currsize; + return 0; } =20 static int qcom_rng_generate(struct crypto_rng *tfm, @@ -87,7 +90,7 @@ static int qcom_rng_generate(struct cryp mutex_unlock(&rng->lock); clk_disable_unprepare(rng->clk); =20 - return 0; + return ret; } =20 static int qcom_rng_seed(struct crypto_rng *tfm, const u8 *seed, From nobody Mon Jun 22 15:38:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13D71C4167D for ; Mon, 21 Mar 2022 14:11:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349493AbiCUOI0 (ORCPT ); Mon, 21 Mar 2022 10:08:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348692AbiCUOBD (ORCPT ); Mon, 21 Mar 2022 10:01:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2725D40E79; Mon, 21 Mar 2022 06:59:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8A591B816D8; Mon, 21 Mar 2022 13:59:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF7A1C36AE7; Mon, 21 Mar 2022 13:58:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871140; bh=gBv0ktP47tMp4zSS382fSjACWfsSnLnoTOPO5fvY1FI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V1ZbVR9vJ7Wg3HL+nob/EO1vYbtVvDnSMkpheDtpWdGgDR9yMk9XB30NFOIfAkZS+ KRv18D+0ITToajbNW63rjJkHDsAKGm8T6oBJDW3hilCIHiabywAmxbOdp2MSXPzAzw eFqHxyFdQzeS33R5E2r84awuFpduPNRpUW15jyuk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joseph Qi , Mark Fasheh , Joel Becker , Junxiao Bi , Changwei Ge , Gang He , Jun Piao , Andrew Morton , Linus Torvalds Subject: [PATCH 5.10 02/30] ocfs2: fix crash when initialize filecheck kobj fails Date: Mon, 21 Mar 2022 14:52:32 +0100 Message-Id: <20220321133219.717685948@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133219.643490199@linuxfoundation.org> References: <20220321133219.643490199@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Joseph Qi commit 7b0b1332cfdb94489836b67d088a779699f8e47e upstream. Once s_root is set, genric_shutdown_super() will be called if fill_super() fails. That means, we will call ocfs2_dismount_volume() twice in such case, which can lead to kernel crash. Fix this issue by initializing filecheck kobj before setting s_root. Link: https://lkml.kernel.org/r/20220310081930.86305-1-joseph.qi@linux.alib= aba.com Fixes: 5f483c4abb50 ("ocfs2: add kobject for online file check") Signed-off-by: Joseph Qi Cc: Mark Fasheh Cc: Joel Becker Cc: Junxiao Bi Cc: Changwei Ge Cc: Gang He Cc: Jun Piao Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- fs/ocfs2/super.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c @@ -1110,17 +1110,6 @@ static int ocfs2_fill_super(struct super goto read_super_error; } =20 - root =3D d_make_root(inode); - if (!root) { - status =3D -ENOMEM; - mlog_errno(status); - goto read_super_error; - } - - sb->s_root =3D root; - - ocfs2_complete_mount_recovery(osb); - osb->osb_dev_kset =3D kset_create_and_add(sb->s_id, NULL, &ocfs2_kset->kobj); if (!osb->osb_dev_kset) { @@ -1138,6 +1127,17 @@ static int ocfs2_fill_super(struct super goto read_super_error; } =20 + root =3D d_make_root(inode); + if (!root) { + status =3D -ENOMEM; + mlog_errno(status); + goto read_super_error; + } + + sb->s_root =3D root; + + ocfs2_complete_mount_recovery(osb); + if (ocfs2_mount_local(osb)) snprintf(nodestr, sizeof(nodestr), "local"); else From nobody Mon Jun 22 15:38:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 050AAC4321E for ; Mon, 21 Mar 2022 14:11:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349418AbiCUOIX (ORCPT ); Mon, 21 Mar 2022 10:08:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348688AbiCUOBD (ORCPT ); Mon, 21 Mar 2022 10:01:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8482340A33; Mon, 21 Mar 2022 06:59:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 99ADE612E7; Mon, 21 Mar 2022 13:59:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D1C3C36AED; Mon, 21 Mar 2022 13:59:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871143; bh=f+LCZ3bh2GVBGvSo0w7qmYnQgZRd9peEz0XanTctYBE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D88Uel+kL9gxoKF46XxcuNYjlD03D/1CAuv658uqAJwhYKhI6cYrArI0IB0b7jm2s JCRsweHbZ0GcOOJpHUCHLIMkDuYi8e2FvH7AeA7A9iaIcZNJO9P802WsKMxGiCIY2K ht7aB5jbSVphFEu45pqr7cnfuPrXvw+hNNKeWbNo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guo Ziliang , Zeal Robot , Ran Xiaokai , Jiang Xuexin , Yang Yang , Hugh Dickins , Naoya Horiguchi , Michal Hocko , Minchan Kim , Johannes Weiner , Roger Quadros , Andrew Morton , Linus Torvalds Subject: [PATCH 5.10 03/30] mm: swap: get rid of livelock in swapin readahead Date: Mon, 21 Mar 2022 14:52:33 +0100 Message-Id: <20220321133219.745437892@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133219.643490199@linuxfoundation.org> References: <20220321133219.643490199@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Guo Ziliang commit 029c4628b2eb2ca969e9bf979b05dc18d8d5575e upstream. In our testing, a livelock task was found. Through sysrq printing, same stack was found every time, as follows: __swap_duplicate+0x58/0x1a0 swapcache_prepare+0x24/0x30 __read_swap_cache_async+0xac/0x220 read_swap_cache_async+0x58/0xa0 swapin_readahead+0x24c/0x628 do_swap_page+0x374/0x8a0 __handle_mm_fault+0x598/0xd60 handle_mm_fault+0x114/0x200 do_page_fault+0x148/0x4d0 do_translation_fault+0xb0/0xd4 do_mem_abort+0x50/0xb0 The reason for the livelock is that swapcache_prepare() always returns EEXIST, indicating that SWAP_HAS_CACHE has not been cleared, so that it cannot jump out of the loop. We suspect that the task that clears the SWAP_HAS_CACHE flag never gets a chance to run. We try to lower the priority of the task stuck in a livelock so that the task that clears the SWAP_HAS_CACHE flag will run. The results show that the system returns to normal after the priority is lowered. In our testing, multiple real-time tasks are bound to the same core, and the task in the livelock is the highest priority task of the core, so the livelocked task cannot be preempted. Although cond_resched() is used by __read_swap_cache_async, it is an empty function in the preemptive system and cannot achieve the purpose of releasing the CPU. A high-priority task cannot release the CPU unless preempted by a higher-priority task. But when this task is already the highest priority task on this core, other tasks will not be able to be scheduled. So we think we should replace cond_resched() with schedule_timeout_uninterruptible(1), schedule_timeout_interruptible will call set_current_state first to set the task state, so the task will be removed from the running queue, so as to achieve the purpose of giving up the CPU and prevent it from running in kernel mode for too long. (akpm: ugly hack becomes uglier. But it fixes the issue in a backportable-to-stable fashion while we hopefully work on something better) Link: https://lkml.kernel.org/r/20220221111749.1928222-1-cgel.zte@gmail.com Signed-off-by: Guo Ziliang Reported-by: Zeal Robot Reviewed-by: Ran Xiaokai Reviewed-by: Jiang Xuexin Reviewed-by: Yang Yang Acked-by: Hugh Dickins Cc: Naoya Horiguchi Cc: Michal Hocko Cc: Minchan Kim Cc: Johannes Weiner Cc: Roger Quadros Cc: Ziliang Guo Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- mm/swap_state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/swap_state.c +++ b/mm/swap_state.c @@ -512,7 +512,7 @@ struct page *__read_swap_cache_async(swp * __read_swap_cache_async(), which has set SWAP_HAS_CACHE * in swap_map, but not yet added its page to swap cache. */ - cond_resched(); + schedule_timeout_uninterruptible(1); } =20 /* From nobody Mon Jun 22 15:38:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7BEE6C433EF for ; Mon, 21 Mar 2022 14:12:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349553AbiCUOIa (ORCPT ); Mon, 21 Mar 2022 10:08:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348580AbiCUOBS (ORCPT ); Mon, 21 Mar 2022 10:01:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95CFB41FA3; Mon, 21 Mar 2022 06:59:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 39718B816E1; Mon, 21 Mar 2022 13:59:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47F59C340ED; Mon, 21 Mar 2022 13:59:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871145; bh=WXRZNREbEysgY3ucIvbUH+IXo9ESUOMduBe4vKaz5f0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fpb7unY5pqUTqIAEdKKtMBP0BdcMYeLMEBpmO+PCyaobHZSQj1zblEqRRvUdMVq/c 3Iff73EeetcadfezHcfWsuq+55XvlUX3YM9C7hJUxB9L6hHu4juAymoNWib0UPDu5G gVCZ5uzDLDWNTrOPZSOGOe43wCxsty0Lo22+g8x0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , Igor Zhbanov , Ard Biesheuvel , linux-efi@vger.kernel.org, Lukas Wunner , Octavian Purdila , "Rafael J. Wysocki" , Matt Fleming , Sasha Levin Subject: [PATCH 5.10 04/30] efi: fix return value of __setup handlers Date: Mon, 21 Mar 2022 14:52:34 +0100 Message-Id: <20220321133219.774098049@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133219.643490199@linuxfoundation.org> References: <20220321133219.643490199@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Randy Dunlap [ Upstream commit 9feaf8b387ee0ece9c1d7add308776b502a35d0c ] When "dump_apple_properties" is used on the kernel boot command line, it causes an Unknown parameter message and the string is added to init's argument strings: Unknown kernel command line parameters "dump_apple_properties BOOT_IMAGE=3D/boot/bzImage-517rc6 efivar_ssdt=3Dnewcpu_ssdt", will be passed to user space. Run /sbin/init as init process with arguments: /sbin/init dump_apple_properties with environment: HOME=3D/ TERM=3Dlinux BOOT_IMAGE=3D/boot/bzImage-517rc6 efivar_ssdt=3Dnewcpu_ssdt Similarly when "efivar_ssdt=3Dsomestring" is used, it is added to the Unknown parameter message and to init's environment strings, polluting them (see examples above). Change the return value of the __setup functions to 1 to indicate that the __setup options have been handled. Fixes: 58c5475aba67 ("x86/efi: Retrieve and assign Apple device properties") Fixes: 475fb4e8b2f4 ("efi / ACPI: load SSTDs from EFI variables") Signed-off-by: Randy Dunlap Reported-by: Igor Zhbanov Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru Cc: Ard Biesheuvel Cc: linux-efi@vger.kernel.org Cc: Lukas Wunner Cc: Octavian Purdila Cc: "Rafael J. Wysocki" Cc: Matt Fleming Link: https://lore.kernel.org/r/20220301041851.12459-1-rdunlap@infradead.org Signed-off-by: Ard Biesheuvel Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/firmware/efi/apple-properties.c | 2 +- drivers/firmware/efi/efi.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/efi/apple-properties.c b/drivers/firmware/efi= /apple-properties.c index e1926483ae2f..e51838d749e2 100644 --- a/drivers/firmware/efi/apple-properties.c +++ b/drivers/firmware/efi/apple-properties.c @@ -24,7 +24,7 @@ static bool dump_properties __initdata; static int __init dump_properties_enable(char *arg) { dump_properties =3D true; - return 0; + return 1; } =20 __setup("dump_apple_properties", dump_properties_enable); diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index 9fa86288b78a..e3df82d5d37a 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c @@ -209,7 +209,7 @@ static int __init efivar_ssdt_setup(char *str) memcpy(efivar_ssdt, str, strlen(str)); else pr_warn("efivar_ssdt: name too long: %s\n", str); - return 0; + return 1; } __setup("efivar_ssdt=3D", efivar_ssdt_setup); =20 --=20 2.34.1 From nobody Mon Jun 22 15:38:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 231DFC4167B for ; Mon, 21 Mar 2022 14:11:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349602AbiCUOId (ORCPT ); Mon, 21 Mar 2022 10:08:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348649AbiCUOBT (ORCPT ); Mon, 21 Mar 2022 10:01:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18375427F9; Mon, 21 Mar 2022 06:59:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2C821B816DC; Mon, 21 Mar 2022 13:59:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70A2DC340F3; Mon, 21 Mar 2022 13:59:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871148; bh=lAMHPulqEqOiND2NpHdKTHaqCKB/UsOgnSZbqLaRA10=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PF3VcwpqUMeoA5HqVffvfMHhXGSeOEGahxzfkfn+h9r2moU73NgQqbeZ/G94fku8l h4q8hi26YZKr0nWDNtf45TqagUutS4iQyh/n+/edmddKPAcNliXYa73P3AIwgc8Z7y kKqHurOAztc8jzvXAwZn6929VB3utcgcAeiCYMKI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefano Garzarella , "Michael S. Tsirkin" , Jiyong Park , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 05/30] vsock: each transport cycles only on its own sockets Date: Mon, 21 Mar 2022 14:52:35 +0100 Message-Id: <20220321133219.802271799@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133219.643490199@linuxfoundation.org> References: <20220321133219.643490199@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiyong Park [ Upstream commit 8e6ed963763fe21429eabfc76c69ce2b0163a3dd ] When iterating over sockets using vsock_for_each_connected_socket, make sure that a transport filters out sockets that don't belong to the transport. There actually was an issue caused by this; in a nested VM configuration, destroying the nested VM (which often involves the closing of /dev/vhost-vsock if there was h2g connections to the nested VM) kills not only the h2g connections, but also all existing g2h connections to the (outmost) host which are totally unrelated. Tested: Executed the following steps on Cuttlefish (Android running on a VM) [1]: (1) Enter into an `adb shell` session - to have a g2h connection inside the VM, (2) open and then close /dev/vhost-vsock by `exec 3< /dev/vhost-vsock && exec 3<&-`, (3) observe that the adb session is not reset. [1] https://android.googlesource.com/device/google/cuttlefish/ Fixes: c0cfa2d8a788 ("vsock: add multi-transports support") Reviewed-by: Stefano Garzarella Acked-by: Michael S. Tsirkin Signed-off-by: Jiyong Park Link: https://lore.kernel.org/r/20220311020017.1509316-1-jiyong@google.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/vhost/vsock.c | 3 ++- include/net/af_vsock.h | 3 ++- net/vmw_vsock/af_vsock.c | 9 +++++++-- net/vmw_vsock/virtio_transport.c | 7 +++++-- net/vmw_vsock/vmci_transport.c | 5 ++++- 5 files changed, 20 insertions(+), 7 deletions(-) diff --git a/drivers/vhost/vsock.c b/drivers/vhost/vsock.c index c282fc0d04bd..5d2d6ce7ff41 100644 --- a/drivers/vhost/vsock.c +++ b/drivers/vhost/vsock.c @@ -697,7 +697,8 @@ static int vhost_vsock_dev_release(struct inode *inode,= struct file *file) =20 /* Iterating over all connections for all CIDs to find orphans is * inefficient. Room for improvement here. */ - vsock_for_each_connected_socket(vhost_vsock_reset_orphans); + vsock_for_each_connected_socket(&vhost_transport.transport, + vhost_vsock_reset_orphans); =20 /* Don't check the owner, because we are in the release path, so we * need to stop the vsock device in any case. diff --git a/include/net/af_vsock.h b/include/net/af_vsock.h index b1c717286993..4d8589244dc7 100644 --- a/include/net/af_vsock.h +++ b/include/net/af_vsock.h @@ -197,7 +197,8 @@ struct sock *vsock_find_bound_socket(struct sockaddr_vm= *addr); struct sock *vsock_find_connected_socket(struct sockaddr_vm *src, struct sockaddr_vm *dst); void vsock_remove_sock(struct vsock_sock *vsk); -void vsock_for_each_connected_socket(void (*fn)(struct sock *sk)); +void vsock_for_each_connected_socket(struct vsock_transport *transport, + void (*fn)(struct sock *sk)); int vsock_assign_transport(struct vsock_sock *vsk, struct vsock_sock *psk); bool vsock_find_cid(unsigned int cid); =20 diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c index 005aa701f4d5..c59806253a65 100644 --- a/net/vmw_vsock/af_vsock.c +++ b/net/vmw_vsock/af_vsock.c @@ -333,7 +333,8 @@ void vsock_remove_sock(struct vsock_sock *vsk) } EXPORT_SYMBOL_GPL(vsock_remove_sock); =20 -void vsock_for_each_connected_socket(void (*fn)(struct sock *sk)) +void vsock_for_each_connected_socket(struct vsock_transport *transport, + void (*fn)(struct sock *sk)) { int i; =20 @@ -342,8 +343,12 @@ void vsock_for_each_connected_socket(void (*fn)(struct= sock *sk)) for (i =3D 0; i < ARRAY_SIZE(vsock_connected_table); i++) { struct vsock_sock *vsk; list_for_each_entry(vsk, &vsock_connected_table[i], - connected_table) + connected_table) { + if (vsk->transport !=3D transport) + continue; + fn(sk_vsock(vsk)); + } } =20 spin_unlock_bh(&vsock_table_lock); diff --git a/net/vmw_vsock/virtio_transport.c b/net/vmw_vsock/virtio_transp= ort.c index 3a056f8affd1..e131121533ad 100644 --- a/net/vmw_vsock/virtio_transport.c +++ b/net/vmw_vsock/virtio_transport.c @@ -24,6 +24,7 @@ static struct workqueue_struct *virtio_vsock_workqueue; static struct virtio_vsock __rcu *the_virtio_vsock; static DEFINE_MUTEX(the_virtio_vsock_mutex); /* protects the_virtio_vsock = */ +static struct virtio_transport virtio_transport; /* forward declaration */ =20 struct virtio_vsock { struct virtio_device *vdev; @@ -383,7 +384,8 @@ static void virtio_vsock_event_handle(struct virtio_vso= ck *vsock, switch (le32_to_cpu(event->id)) { case VIRTIO_VSOCK_EVENT_TRANSPORT_RESET: virtio_vsock_update_guest_cid(vsock); - vsock_for_each_connected_socket(virtio_vsock_reset_sock); + vsock_for_each_connected_socket(&virtio_transport.transport, + virtio_vsock_reset_sock); break; } } @@ -635,7 +637,8 @@ static void virtio_vsock_remove(struct virtio_device *v= dev) synchronize_rcu(); =20 /* Reset all connected sockets when the device disappear */ - vsock_for_each_connected_socket(virtio_vsock_reset_sock); + vsock_for_each_connected_socket(&virtio_transport.transport, + virtio_vsock_reset_sock); =20 /* Stop all work handlers to make sure no one is accessing the device, * so we can safely call vdev->config->reset(). diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c index 1c9ecb18b8e6..a9ca95a0fcdd 100644 --- a/net/vmw_vsock/vmci_transport.c +++ b/net/vmw_vsock/vmci_transport.c @@ -75,6 +75,8 @@ static u32 vmci_transport_qp_resumed_sub_id =3D VMCI_INVA= LID_ID; =20 static int PROTOCOL_OVERRIDE =3D -1; =20 +static struct vsock_transport vmci_transport; /* forward declaration */ + /* Helper function to convert from a VMCI error code to a VSock error code= . */ =20 static s32 vmci_transport_error_to_vsock_error(s32 vmci_error) @@ -882,7 +884,8 @@ static void vmci_transport_qp_resumed_cb(u32 sub_id, const struct vmci_event_data *e_data, void *client_data) { - vsock_for_each_connected_socket(vmci_transport_handle_detach); + vsock_for_each_connected_socket(&vmci_transport, + vmci_transport_handle_detach); } =20 static void vmci_transport_recv_pkt_work(struct work_struct *work) --=20 2.34.1 From nobody Mon Jun 22 15:38:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47DBDC4167E for ; Mon, 21 Mar 2022 14:11:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349744AbiCUOIl (ORCPT ); Mon, 21 Mar 2022 10:08:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348591AbiCUOBg (ORCPT ); Mon, 21 Mar 2022 10:01:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 073559AE6F; Mon, 21 Mar 2022 06:59:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C8700B816D9; Mon, 21 Mar 2022 13:59:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39791C340E8; Mon, 21 Mar 2022 13:59:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871151; bh=y8A8duvnQBc5gtrsNqlLqi4iN3RL7tqC4SsOZNQfcrI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o46Ee6V/VFJgIlCoDcJRQUa8UX1LswfFcCMDVzh3WnNBFnxHxDlCFRTu+hVjsriAx nzKIbKt5nhN2zSsK9b7N7dDIXLgcQs2WcdF6Doiba43a5AVjpxLuxy4SVv0iqQqpi0 4Z9k8T9C1ek5Bz/rsE0gJgLnBSQ/wxQKR1ZZR1bA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiumei Mu , Sabrina Dubroca , Steffen Klassert , Sasha Levin Subject: [PATCH 5.10 06/30] esp6: fix check on ipv6_skip_exthdrs return value Date: Mon, 21 Mar 2022 14:52:36 +0100 Message-Id: <20220321133219.832569425@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133219.643490199@linuxfoundation.org> References: <20220321133219.643490199@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sabrina Dubroca [ Upstream commit 4db4075f92af2b28f415fc979ab626e6b37d67b6 ] Commit 5f9c55c8066b ("ipv6: check return value of ipv6_skip_exthdr") introduced an incorrect check, which leads to all ESP packets over either TCPv6 or UDPv6 encapsulation being dropped. In this particular case, offset is negative, since skb->data points to the ESP header in the following chain of headers, while skb->network_header points to the IPv6 header: IPv6 | ext | ... | ext | UDP | ESP | ... That doesn't seem to be a problem, especially considering that if we reach esp6_input_done2, we're guaranteed to have a full set of headers available (otherwise the packet would have been dropped earlier in the stack). However, it means that the return value will (intentionally) be negative. We can make the test more specific, as the expected return value of ipv6_skip_exthdr will be the (negated) size of either a UDP header, or a TCP header with possible options. In the future, we should probably either make ipv6_skip_exthdr explicitly accept negative offsets (and adjust its return value for error cases), or make ipv6_skip_exthdr only take non-negative offsets (and audit all callers). Fixes: 5f9c55c8066b ("ipv6: check return value of ipv6_skip_exthdr") Reported-by: Xiumei Mu Signed-off-by: Sabrina Dubroca Signed-off-by: Steffen Klassert Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- net/ipv6/esp6.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/ipv6/esp6.c b/net/ipv6/esp6.c index fc8acb15dcfb..5ce8b6c344b8 100644 --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c @@ -808,8 +808,7 @@ int esp6_input_done2(struct sk_buff *skb, int err) struct tcphdr *th; =20 offset =3D ipv6_skip_exthdr(skb, offset, &nexthdr, &frag_off); - - if (offset < 0) { + if (offset =3D=3D -1) { err =3D -EINVAL; goto out; } --=20 2.34.1 From nobody Mon Jun 22 15:38:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3351AC41535 for ; Mon, 21 Mar 2022 14:11:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349681AbiCUOIi (ORCPT ); Mon, 21 Mar 2022 10:08:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348578AbiCUOBg (ORCPT ); Mon, 21 Mar 2022 10:01:36 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14A9C44745; Mon, 21 Mar 2022 06:59:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ECEF7611D5; Mon, 21 Mar 2022 13:59:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F32C8C340E8; Mon, 21 Mar 2022 13:59:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871154; bh=7xh3drwf+VYtvLvhQqinf+lnwZkr3z7FFQHSQFrnSaQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LXDcQyzZ7g1v1I70wFfq+Em3p14DQN3qHfZdfvOpvgtb0p2Fvjn6XPNO+c7lwkPq2 rMhL0DSR/bDFUjgXol8SI5LJ7LaoGX74g6WZMFhI80kr+LD+5cR0A57vDtkx3wM1G7 drulmfnOf41dLh6KP30fa3GSQX3+NAjDP+lc8geA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kurt Cancemi , Andrew Lunn , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 07/30] net: phy: marvell: Fix invalid comparison in the resume and suspend functions Date: Mon, 21 Mar 2022 14:52:37 +0100 Message-Id: <20220321133219.861122873@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133219.643490199@linuxfoundation.org> References: <20220321133219.643490199@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Kurt Cancemi [ Upstream commit 837d9e49402eaf030db55a49f96fc51d73b4b441 ] This bug resulted in only the current mode being resumed and suspended when the PHY supported both fiber and copper modes and when the PHY only support= ed copper mode the fiber mode would incorrectly be attempted to be resumed and suspended. Fixes: 3758be3dc162 ("Marvell phy: add functions to suspend and resume both= interfaces: fiber and copper links.") Signed-off-by: Kurt Cancemi Reviewed-by: Andrew Lunn Link: https://lore.kernel.org/r/20220312201512.326047-1-kurt@x64architectur= e.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/phy/marvell.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c index cb9d1852a75c..54786712a991 100644 --- a/drivers/net/phy/marvell.c +++ b/drivers/net/phy/marvell.c @@ -1536,8 +1536,8 @@ static int marvell_suspend(struct phy_device *phydev) int err; =20 /* Suspend the fiber mode first */ - if (!linkmode_test_bit(ETHTOOL_LINK_MODE_FIBRE_BIT, - phydev->supported)) { + if (linkmode_test_bit(ETHTOOL_LINK_MODE_FIBRE_BIT, + phydev->supported)) { err =3D marvell_set_page(phydev, MII_MARVELL_FIBER_PAGE); if (err < 0) goto error; @@ -1571,8 +1571,8 @@ static int marvell_resume(struct phy_device *phydev) int err; =20 /* Resume the fiber mode first */ - if (!linkmode_test_bit(ETHTOOL_LINK_MODE_FIBRE_BIT, - phydev->supported)) { + if (linkmode_test_bit(ETHTOOL_LINK_MODE_FIBRE_BIT, + phydev->supported)) { err =3D marvell_set_page(phydev, MII_MARVELL_FIBER_PAGE); if (err < 0) goto error; --=20 2.34.1 From nobody Mon Jun 22 15:38:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22449C35294 for ; Mon, 21 Mar 2022 14:11:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351774AbiCUOLo (ORCPT ); Mon, 21 Mar 2022 10:11:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348747AbiCUOCi (ORCPT ); Mon, 21 Mar 2022 10:02:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6D353B565; Mon, 21 Mar 2022 06:59:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A7162612A1; Mon, 21 Mar 2022 13:59:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6D0DC340E8; Mon, 21 Mar 2022 13:59:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871157; bh=+EgaiHZSotoZIM9JUYSNx32Rt1/zHze/2ZvDe21kRe4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qpu29IsLfGbLvJMyi9hAzBNQsV1SPVI6ipysti6b/IecbiKTN3AtxrT1ms43GLmVB 0t1LCsz1l2WLyZjq9J/Y8jrAhfOuLtsUUhXi9ekrDN7zD67oxLiE3yix9UoxBBYTuL Bdh4r3c1EajA2TmqiAPU/y8J3LKQqSJihd/78IUk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , syzbot , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 08/30] net/packet: fix slab-out-of-bounds access in packet_recvmsg() Date: Mon, 21 Mar 2022 14:52:38 +0100 Message-Id: <20220321133219.889728310@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133219.643490199@linuxfoundation.org> References: <20220321133219.643490199@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 c700525fcc06b05adfea78039de02628af79e07a ] syzbot found that when an AF_PACKET socket is using PACKET_COPY_THRESH and mmap operations, tpacket_rcv() is queueing skbs with garbage in skb->cb[], triggering a too big copy [1] Presumably, users of af_packet using mmap() already gets correct metadata from the mapped buffer, we can simply make sure to clear 12 bytes that might be copied to user space later. BUG: KASAN: stack-out-of-bounds in memcpy include/linux/fortify-string.h:22= 5 [inline] BUG: KASAN: stack-out-of-bounds in packet_recvmsg+0x56c/0x1150 net/packet/a= f_packet.c:3489 Write of size 165 at addr ffffc9000385fb78 by task syz-executor233/3631 CPU: 0 PID: 3631 Comm: syz-executor233 Not tainted 5.17.0-rc7-syzkaller-023= 96-g0b3660695e80 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Goo= gle 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description.constprop.0.cold+0xf/0x336 mm/kasan/report.c:255 __kasan_report mm/kasan/report.c:442 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:459 check_region_inline mm/kasan/generic.c:183 [inline] kasan_check_range+0x13d/0x180 mm/kasan/generic.c:189 memcpy+0x39/0x60 mm/kasan/shadow.c:66 memcpy include/linux/fortify-string.h:225 [inline] packet_recvmsg+0x56c/0x1150 net/packet/af_packet.c:3489 sock_recvmsg_nosec net/socket.c:948 [inline] sock_recvmsg net/socket.c:966 [inline] sock_recvmsg net/socket.c:962 [inline] ____sys_recvmsg+0x2c4/0x600 net/socket.c:2632 ___sys_recvmsg+0x127/0x200 net/socket.c:2674 __sys_recvmsg+0xe2/0x1a0 net/socket.c:2704 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:0x7fdfd5954c29 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 41 15 00 00 90 48 89 f8 48 89 f7 = 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff f= f 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007ffcf8e71e48 EFLAGS: 00000246 ORIG_RAX: 000000000000002f RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007fdfd5954c29 RDX: 0000000000000000 RSI: 0000000020000500 RDI: 0000000000000005 RBP: 0000000000000000 R08: 000000000000000d R09: 000000000000000d R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffcf8e71e60 R13: 00000000000f4240 R14: 000000000000c1ff R15: 00007ffcf8e71e54 addr ffffc9000385fb78 is located in stack of task syz-executor233/3631 at o= ffset 32 in frame: ____sys_recvmsg+0x0/0x600 include/linux/uio.h:246 this frame has 1 object: [32, 160) 'addr' Memory state around the buggy address: ffffc9000385fa80: 00 04 f3 f3 f3 f3 f3 00 00 00 00 00 00 00 00 00 ffffc9000385fb00: 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00 >ffffc9000385fb80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 f3 ^ ffffc9000385fc00: f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00 f1 ffffc9000385fc80: f1 f1 f1 00 f2 f2 f2 00 f2 f2 f2 00 00 00 00 00 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Fixes: 0fb375fb9b93 ("[AF_PACKET]: Allow for > 8 byte hardware addresses.") Signed-off-by: Eric Dumazet Reported-by: syzbot Link: https://lore.kernel.org/r/20220312232958.3535620-1-eric.dumazet@gmail= .com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- net/packet/af_packet.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index a31334b92be7..d0c95d7dd292 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -2278,8 +2278,11 @@ static int tpacket_rcv(struct sk_buff *skb, struct n= et_device *dev, copy_skb =3D skb_get(skb); skb_head =3D skb->data; } - if (copy_skb) + if (copy_skb) { + memset(&PACKET_SKB_CB(copy_skb)->sa.ll, 0, + sizeof(PACKET_SKB_CB(copy_skb)->sa.ll)); skb_set_owner_r(copy_skb, sk); + } } snaplen =3D po->rx_ring.frame_size - macoff; if ((int)snaplen < 0) { @@ -3434,6 +3437,8 @@ static int packet_recvmsg(struct socket *sock, struct= msghdr *msg, size_t len, sock_recv_ts_and_drops(msg, sk, skb); =20 if (msg->msg_name) { + const size_t max_len =3D min(sizeof(skb->cb), + sizeof(struct sockaddr_storage)); int copy_len; =20 /* If the address length field is there to be filled @@ -3456,6 +3461,10 @@ static int packet_recvmsg(struct socket *sock, struc= t msghdr *msg, size_t len, msg->msg_namelen =3D sizeof(struct sockaddr_ll); } } + if (WARN_ON_ONCE(copy_len > max_len)) { + copy_len =3D max_len; + msg->msg_namelen =3D copy_len; + } memcpy(msg->msg_name, &PACKET_SKB_CB(skb)->sa, copy_len); } =20 --=20 2.34.1 From nobody Mon Jun 22 15:38:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56BB7C46467 for ; Mon, 21 Mar 2022 14:11:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349798AbiCUOIr (ORCPT ); Mon, 21 Mar 2022 10:08:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348685AbiCUOBs (ORCPT ); Mon, 21 Mar 2022 10:01:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 424569D0D1; Mon, 21 Mar 2022 06:59:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5D82D612EC; Mon, 21 Mar 2022 13:59:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A848C36AE5; Mon, 21 Mar 2022 13:59:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871159; bh=Plcu9F1XdHYz/hQLZ0JanjGcp2uWjHOnsKvUPjK2klk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qb74SmO+xvPxXhXaq6k4vdV/RlL5/F7d5sGEIsq+3c/tOnFlD0WlUBQ/5IxWSWX7n xDG2d/T/WaFBhz67OSSmzMBRSfqpWnsSQB40O1cWZnuHoI3xPT26+ml91UQEZrwKIR Ba8gI+bZFUS/kIxXib2KKIhmXGZ0F1Y4VLXJb+Xs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , "David S. Miller" , Sasha Levin Subject: [PATCH 5.10 09/30] atm: eni: Add check for dma_map_single Date: Mon, 21 Mar 2022 14:52:39 +0100 Message-Id: <20220321133219.918430097@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133219.643490199@linuxfoundation.org> References: <20220321133219.643490199@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiasheng Jiang [ Upstream commit 0f74b29a4f53627376cf5a5fb7b0b3fa748a0b2b ] As the potential failure of the dma_map_single(), it should be better to check it and return error if fails. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Jiasheng Jiang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/atm/eni.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/atm/eni.c b/drivers/atm/eni.c index b574cce98dc3..9fcc49be499f 100644 --- a/drivers/atm/eni.c +++ b/drivers/atm/eni.c @@ -1112,6 +1112,8 @@ DPRINTK("iovcnt =3D %d\n",skb_shinfo(skb)->nr_frags); skb_data3 =3D skb->data[3]; paddr =3D dma_map_single(&eni_dev->pci_dev->dev,skb->data,skb->len, DMA_TO_DEVICE); + if (dma_mapping_error(&eni_dev->pci_dev->dev, paddr)) + return enq_next; ENI_PRV_PADDR(skb) =3D paddr; /* prepare DMA queue entries */ j =3D 0; --=20 2.34.1 From nobody Mon Jun 22 15:38:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAE39C433EF for ; Mon, 21 Mar 2022 14:06:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349061AbiCUOHZ (ORCPT ); Mon, 21 Mar 2022 10:07:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348384AbiCUOAC (ORCPT ); Mon, 21 Mar 2022 10:00:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 213F4326EF; Mon, 21 Mar 2022 06:58:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AD14C6126E; Mon, 21 Mar 2022 13:58:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B132DC340E8; Mon, 21 Mar 2022 13:58:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871114; bh=R3418Rrg5V8B1c05XGDtRWXcwFIPVmKBkAGQp1+t2as=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R56KceI1PdSDLgVeto2O4yY/CcfK1443Pzv3lcdp5JUnwWEBlp0mUH8dIOtDgndhQ P+AUpBPVgzagC4+WusY3YdnE2xfvZGs8IqZ5cVUy9mEgfYQneGntfDMieiqnk6ak8b NzW42+zFr9Oys2oqh6ajkZlb1D2EGSu8MiAYh+W8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 10/30] hv_netvsc: Add check for kvmalloc_array Date: Mon, 21 Mar 2022 14:52:40 +0100 Message-Id: <20220321133219.946203430@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133219.643490199@linuxfoundation.org> References: <20220321133219.643490199@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiasheng Jiang [ Upstream commit 886e44c9298a6b428ae046e2fa092ca52e822e6a ] As the potential failure of the kvmalloc_array(), it should be better to check and restore the 'data' if fails in order to avoid the dereference of the NULL pointer. Fixes: 6ae746711263 ("hv_netvsc: Add per-cpu ethtool stats for netvsc") Signed-off-by: Jiasheng Jiang Link: https://lore.kernel.org/r/20220314020125.2365084-1-jiasheng@iscas.ac.= cn Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/hyperv/netvsc_drv.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_dr= v.c index 261e6e55a907..e3676386d0ee 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -1562,6 +1562,9 @@ static void netvsc_get_ethtool_stats(struct net_devic= e *dev, pcpu_sum =3D kvmalloc_array(num_possible_cpus(), sizeof(struct netvsc_ethtool_pcpu_stats), GFP_KERNEL); + if (!pcpu_sum) + return; + netvsc_get_pcpu_stats(dev, pcpu_sum); for_each_present_cpu(cpu) { struct netvsc_ethtool_pcpu_stats *this_sum =3D &pcpu_sum[cpu]; --=20 2.34.1 From nobody Mon Jun 22 15:38:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D0F3C433F5 for ; Mon, 21 Mar 2022 14:06:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349071AbiCUOHj (ORCPT ); Mon, 21 Mar 2022 10:07:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348403AbiCUOAF (ORCPT ); Mon, 21 Mar 2022 10:00:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24B1F35DD8; Mon, 21 Mar 2022 06:58:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9E2D36125C; Mon, 21 Mar 2022 13:58:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7ED5DC340E8; Mon, 21 Mar 2022 13:58:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871117; bh=wCtlhzyVh7eEx2vCINhC9Y7uEvjVr+GVgYMntv5pJWI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s7RYhEMU13gqWKYuL1r7Fv5wocoxzOW1jthULM6ac8iUJQLxaqer5bc7TyUUmqjk4 zmtYsP5FdlEc/FQKspf3YlOzyV4TExU12rJc9x5DEbyA+6yvIyw//ec733V3DfKXwN QvTWrWL/HEOnX6JRxLoBb7UNjjKucVKSbpQui5yI= 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 , Boris Brezillon , Philipp Zabel , David Airlie , Daniel Vetter , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , linux-arm-kernel@lists.infradead.org, Max Krummenacher , Maarten Lankhorst , Sasha Levin Subject: [PATCH 5.10 11/30] drm/imx: parallel-display: Remove bus flags check in imx_pd_bridge_atomic_check() Date: Mon, 21 Mar 2022 14:52:41 +0100 Message-Id: <20220321133219.974486080@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133219.643490199@linuxfoundation.org> References: <20220321133219.643490199@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 6061806a863e8b65b109eb06a280041cc7525442 ] If display timings were read from the devicetree using of_get_display_timing() and pixelclk-active is defined there, the flag DISPLAY_FLAGS_SYNC_POSEDGE/NEGEDGE is automatically generated. Through the function drm_bus_flags_from_videomode() e.g. called in the panel-simple driver this flag got into the bus flags, but then in imx_pd_bridge_atomic_check() the bus flag check failed and will not initialize the display. The original commit fe141cedc433 does not explain why this check was introduced. So remove the bus flags check, because it stops the initialization of the display with valid bus flags. Fixes: fe141cedc433 ("drm/imx: pd: Use bus format/flags provided by the bri= dge when available") Signed-off-by: Christoph Niedermaier Cc: Marek Vasut Cc: Boris Brezillon Cc: Philipp Zabel Cc: David Airlie Cc: Daniel Vetter Cc: Shawn Guo Cc: Sascha Hauer Cc: Pengutronix Kernel Team Cc: Fabio Estevam Cc: NXP Linux Team Cc: linux-arm-kernel@lists.infradead.org To: dri-devel@lists.freedesktop.org Tested-by: Max Krummenacher Acked-by: Boris Brezillon Signed-off-by: Marek Vasut Link: https://patchwork.freedesktop.org/patch/msgid/20220201113643.4638-1-c= niedermaier@dh-electronics.com Signed-off-by: Maarten Lankhorst Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/gpu/drm/imx/parallel-display.c | 8 -------- 1 file changed, 8 deletions(-) diff --git a/drivers/gpu/drm/imx/parallel-display.c b/drivers/gpu/drm/imx/p= arallel-display.c index 2eb8df4697df..605ac8825a59 100644 --- a/drivers/gpu/drm/imx/parallel-display.c +++ b/drivers/gpu/drm/imx/parallel-display.c @@ -212,14 +212,6 @@ static int imx_pd_bridge_atomic_check(struct drm_bridg= e *bridge, if (!imx_pd_format_supported(bus_fmt)) return -EINVAL; =20 - if (bus_flags & - ~(DRM_BUS_FLAG_DE_LOW | DRM_BUS_FLAG_DE_HIGH | - DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE | - DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE)) { - dev_warn(imxpd->dev, "invalid bus_flags (%x)\n", bus_flags); - return -EINVAL; - } - bridge_state->output_bus_cfg.flags =3D bus_flags; bridge_state->input_bus_cfg.flags =3D bus_flags; imx_crtc_state->bus_flags =3D bus_flags; --=20 2.34.1 From nobody Mon Jun 22 15:38:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2B73AC433EF for ; Mon, 21 Mar 2022 14:06:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349066AbiCUOHa (ORCPT ); Mon, 21 Mar 2022 10:07:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348435AbiCUOAL (ORCPT ); Mon, 21 Mar 2022 10:00:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 427E2369DC; Mon, 21 Mar 2022 06:58:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A67FD612ED; Mon, 21 Mar 2022 13:58:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7968FC340ED; Mon, 21 Mar 2022 13:58:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871120; bh=g/Blq5cKIEPWCWplMLMYhEi+1mqL6HFNaZtEtsVL4Gg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=w8rLHOwUfVjLYVBaK3OgozF2w7OKT+ffmiU5tpAC14/PAFrwWPJBUoX9Qx1CruZL4 5h3F5/2J2vVGTodosnPJB9D5Gqc1bLg9p27m4yob06XeRQL1bT665cBmqPaYOV3X/y kop8AXnU4uo8pshuSKTT4UIDd0J5WDfMYPLN/1+Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Vasut , Christoph Fritz , Laurent Pinchart , Maxime Ripard , Sam Ravnborg , Thomas Zimmermann , Laurent Pinchart , Maarten Lankhorst , Sasha Levin Subject: [PATCH 5.10 12/30] drm/panel: simple: Fix Innolux G070Y2-L01 BPP settings Date: Mon, 21 Mar 2022 14:52:42 +0100 Message-Id: <20220321133220.002301624@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133219.643490199@linuxfoundation.org> References: <20220321133219.643490199@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marek Vasut [ Upstream commit fc1b6ef7bfb3d1d4df868b1c3e0480cacda6cd81 ] The Innolux G070Y2-L01 supports two modes of operation: 1) FRC=3DLow/NC ... MEDIA_BUS_FMT_RGB666_1X7X3_SPWG ... BPP=3D6 2) FRC=3DHigh ..... MEDIA_BUS_FMT_RGB888_1X7X4_SPWG ... BPP=3D8 Currently the panel description mixes both, BPP from 1) and bus format from 2), which triggers a warning at panel-simple.c:615. Pick the later, set bpp=3D8, fix the warning. Fixes: a5d2ade627dca ("drm/panel: simple: Add support for Innolux G070Y2-L0= 1") Signed-off-by: Marek Vasut Cc: Christoph Fritz Cc: Laurent Pinchart Cc: Maxime Ripard Cc: Sam Ravnborg Cc: Thomas Zimmermann Reviewed-by: Laurent Pinchart Link: https://patchwork.freedesktop.org/patch/msgid/20220220040718.532866-1= -marex@denx.de Signed-off-by: Maarten Lankhorst Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/gpu/drm/panel/panel-simple.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/p= anel-simple.c index 7ffd2a04ab23..959dcbd8a29c 100644 --- a/drivers/gpu/drm/panel/panel-simple.c +++ b/drivers/gpu/drm/panel/panel-simple.c @@ -2132,7 +2132,7 @@ static const struct display_timing innolux_g070y2_l01= _timing =3D { static const struct panel_desc innolux_g070y2_l01 =3D { .timings =3D &innolux_g070y2_l01_timing, .num_timings =3D 1, - .bpc =3D 6, + .bpc =3D 8, .size =3D { .width =3D 152, .height =3D 91, --=20 2.34.1 From nobody Mon Jun 22 15:38:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0C8CC43219 for ; Mon, 21 Mar 2022 14:11:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349288AbiCUOII (ORCPT ); Mon, 21 Mar 2022 10:08:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348398AbiCUOAV (ORCPT ); Mon, 21 Mar 2022 10:00:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 255563585C; Mon, 21 Mar 2022 06:58:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9FE24B816DC; Mon, 21 Mar 2022 13:58:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3A50C340E8; Mon, 21 Mar 2022 13:58:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871123; bh=z5b40hV7USiaybTi52DgQM4KYPVIVs5XmZFdjoSRWQE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NlQnZx7E5qHdS+15dRhZJp7Im+9SiuOqN/M1CgKW7U7ulzlHdmA7IabKw/Fvnk2EI 5IIU3n/KRYGdJg3Fa+NaVOri0G6FcJxZULsAzh3v9u8RClIoD7ZduXQ8wAqZEZdNyT 2E5EcDuk7jA7Ux9MiC68beQWZUK1Yo9kh3jlFPnQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicolas Dichtel , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 13/30] net: handle ARPHRD_PIMREG in dev_is_mac_header_xmit() Date: Mon, 21 Mar 2022 14:52:43 +0100 Message-Id: <20220321133220.030602413@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133219.643490199@linuxfoundation.org> References: <20220321133219.643490199@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Nicolas Dichtel [ Upstream commit 4ee06de7729d795773145692e246a06448b1eb7a ] This kind of interface doesn't have a mac header. This patch fixes bpf_redirect() to a PIM interface. Fixes: 27b29f63058d ("bpf: add bpf_redirect() helper") Signed-off-by: Nicolas Dichtel Link: https://lore.kernel.org/r/20220315092008.31423-1-nicolas.dichtel@6win= d.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- include/linux/if_arp.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/if_arp.h b/include/linux/if_arp.h index bf5c5f32c65e..e147ea679467 100644 --- a/include/linux/if_arp.h +++ b/include/linux/if_arp.h @@ -51,6 +51,7 @@ static inline bool dev_is_mac_header_xmit(const struct ne= t_device *dev) case ARPHRD_VOID: case ARPHRD_NONE: case ARPHRD_RAWIP: + case ARPHRD_PIMREG: return false; default: return true; --=20 2.34.1 From nobody Mon Jun 22 15:38:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2B19C433EF for ; Mon, 21 Mar 2022 14:11:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348888AbiCUOHp (ORCPT ); Mon, 21 Mar 2022 10:07:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348513AbiCUOAW (ORCPT ); Mon, 21 Mar 2022 10:00:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18C9B396A6; Mon, 21 Mar 2022 06:58:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 925596125C; Mon, 21 Mar 2022 13:58:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A8084C340F2; Mon, 21 Mar 2022 13:58:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871126; bh=lhp5KPgkqNQMD0iMwsTPMTbGR16W4F3pRMK30uJXhLY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VXFT1sHfWHi3FSTV8U3w7z9tYRqc37t9twwL1fL24uuplD2WkBjKMzdGBaw1dJQ1g eg9gc6lcZYflBfLlUHmnbsa3vEPbcy6AHhIS9pD1IYzAlxcNg648UxH1EqYvfeRiTt 9uwZ7uuudEV8pug3R6dTzs05BWRJYa/eaWgquaZE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Paolo Abeni , Sasha Levin Subject: [PATCH 5.10 14/30] net: dsa: Add missing of_node_put() in dsa_port_parse_of Date: Mon, 21 Mar 2022 14:52:44 +0100 Message-Id: <20220321133220.058790653@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133219.643490199@linuxfoundation.org> References: <20220321133219.643490199@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit cb0b430b4e3acc88c85e0ad2e25f2a25a5765262 ] The device_node pointer is returned by of_parse_phandle() with refcount incremented. We should use of_node_put() on it when done. Fixes: 6d4e5c570c2d ("net: dsa: get port type at parse time") Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220316082602.10785-1-linmq006@gmail.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- net/dsa/dsa2.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/dsa/dsa2.c b/net/dsa/dsa2.c index 71c8ef7d4087..f543fca6dfcb 100644 --- a/net/dsa/dsa2.c +++ b/net/dsa/dsa2.c @@ -766,6 +766,7 @@ static int dsa_port_parse_of(struct dsa_port *dp, struc= t device_node *dn) struct net_device *master; =20 master =3D of_find_net_device_by_node(ethernet); + of_node_put(ethernet); if (!master) return -EPROBE_DEFER; =20 --=20 2.34.1 From nobody Mon Jun 22 15:38:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2BDCC4332F for ; Mon, 21 Mar 2022 14:11:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349198AbiCUOIC (ORCPT ); Mon, 21 Mar 2022 10:08:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348452AbiCUOAd (ORCPT ); Mon, 21 Mar 2022 10:00:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB0D439BA1; Mon, 21 Mar 2022 06:58:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3AAF561291; Mon, 21 Mar 2022 13:58:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 512CBC340ED; Mon, 21 Mar 2022 13:58:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871128; bh=WeHYTISiGy0tEOfyzMPaacVtWPx3fEeGhuDRgUWbPNA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XXHZr5gi8qyoJtyr7ytE0Yrw+eKs7Mw1cPfKjnmSFJZHhT9zSemDUB2GSRqjgSMdm bCvoZ3/Nj2CKnkwzu4gvrXmXx4kVAFNSadR/lzI78h4h4Q9LgNm5PFfZW+lB3GfsVK FKBNH9wqjEBSxoApb6+0a7JqzD8xiomH37e3qU9I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Juerg Haefliger , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 15/30] net: phy: mscc: Add MODULE_FIRMWARE macros Date: Mon, 21 Mar 2022 14:52:45 +0100 Message-Id: <20220321133220.087608399@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133219.643490199@linuxfoundation.org> References: <20220321133219.643490199@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Juerg Haefliger [ Upstream commit f1858c277ba40172005b76a31e6bb931bfc19d9c ] The driver requires firmware so define MODULE_FIRMWARE so that modinfo provides the details. Fixes: fa164e40c53b ("net: phy: mscc: split the driver into separate files") Signed-off-by: Juerg Haefliger Link: https://lore.kernel.org/r/20220316151835.88765-1-juergh@canonical.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/phy/mscc/mscc_main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/phy/mscc/mscc_main.c b/drivers/net/phy/mscc/mscc_m= ain.c index 41a410124437..e14fa72791b0 100644 --- a/drivers/net/phy/mscc/mscc_main.c +++ b/drivers/net/phy/mscc/mscc_main.c @@ -2584,3 +2584,6 @@ MODULE_DEVICE_TABLE(mdio, vsc85xx_tbl); MODULE_DESCRIPTION("Microsemi VSC85xx PHY driver"); MODULE_AUTHOR("Nagaraju Lakkaraju"); MODULE_LICENSE("Dual MIT/GPL"); + +MODULE_FIRMWARE(MSCC_VSC8584_REVB_INT8051_FW); +MODULE_FIRMWARE(MSCC_VSC8574_REVB_INT8051_FW); --=20 2.34.1 From nobody Mon Jun 22 15:38:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C2E3C433F5 for ; Mon, 21 Mar 2022 14:11:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349091AbiCUOHx (ORCPT ); Mon, 21 Mar 2022 10:07:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348603AbiCUOAy (ORCPT ); Mon, 21 Mar 2022 10:00:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B93E13B294; Mon, 21 Mar 2022 06:58:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 234E66126A; Mon, 21 Mar 2022 13:58:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30489C340ED; Mon, 21 Mar 2022 13:58:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871131; bh=Goby18dRB64LCcK9TGq6lA+23ZiElZYoSMeCyCkZ5Pw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hcaOiTgVUMTtZLXot+UGCGBCsLlm2B5HS1ZRo7DZJ5ptx56Kzt6tIGMRnVyDN3krp OIbcvZlWGp1DCcZs1od7InEQPY/pxchM8y8/wRzuo+JaIzQtgTgvw1J4lbg4BegyWH y2YG8ucyU6uqffKKdIYEZqUggqgRgxrqBgVXiLrA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Menzel , Manish Chopra , Ariel Elior , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 16/30] bnx2x: fix built-in kernel driver load failure Date: Mon, 21 Mar 2022 14:52:46 +0100 Message-Id: <20220321133220.116321726@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133219.643490199@linuxfoundation.org> References: <20220321133219.643490199@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Manish Chopra [ Upstream commit 424e7834e293936a54fcf05173f2884171adc5a3 ] Commit b7a49f73059f ("bnx2x: Utilize firmware 7.13.21.0") added request_firmware() logic in probe() which caused load failure when firmware file is not present in initrd (below), as access to firmware file is not feasible during probe. Direct firmware load for bnx2x/bnx2x-e2-7.13.15.0.fw failed with error -2 Direct firmware load for bnx2x/bnx2x-e2-7.13.21.0.fw failed with error -2 This patch fixes this issue by - 1. Removing request_firmware() logic from the probe() such that .ndo_open() handle it as it used to handle it earlier 2. Given request_firmware() is removed from probe(), so driver has to relax FW version comparisons a bit against the already loaded FW version (by some other PFs of same adapter) to allow different compatible/close enough FWs with which multiple PFs may run with (in different environments), as the given PF who is in probe flow has no idea now with which firmware file version it is going to initialize the device in ndo_open() Link: https://lore.kernel.org/all/46f2d9d9-ae7f-b332-ddeb-b59802be2bab@molg= en.mpg.de/ Reported-by: Paul Menzel Tested-by: Paul Menzel Fixes: b7a49f73059f ("bnx2x: Utilize firmware 7.13.21.0") Signed-off-by: Manish Chopra Signed-off-by: Ariel Elior Link: https://lore.kernel.org/r/20220316214613.6884-1-manishc@marvell.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/ethernet/broadcom/bnx2x/bnx2x.h | 2 -- .../net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 28 +++++++++++-------- .../net/ethernet/broadcom/bnx2x/bnx2x_main.c | 15 ++-------- 3 files changed, 19 insertions(+), 26 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h b/drivers/net/ethe= rnet/broadcom/bnx2x/bnx2x.h index bb3ba614fb17..2a61229d3f97 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x.h @@ -2534,6 +2534,4 @@ void bnx2x_register_phc(struct bnx2x *bp); * Meant for implicit re-load flows. */ int bnx2x_vlan_reconfigure_vid(struct bnx2x *bp); -int bnx2x_init_firmware(struct bnx2x *bp); -void bnx2x_release_firmware(struct bnx2x *bp); #endif /* bnx2x.h */ diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/= ethernet/broadcom/bnx2x/bnx2x_cmn.c index 41ebbb2c7d3a..198e041d8410 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c @@ -2363,24 +2363,30 @@ int bnx2x_compare_fw_ver(struct bnx2x *bp, u32 load= _code, bool print_err) /* is another pf loaded on this engine? */ if (load_code !=3D FW_MSG_CODE_DRV_LOAD_COMMON_CHIP && load_code !=3D FW_MSG_CODE_DRV_LOAD_COMMON) { - /* build my FW version dword */ - u32 my_fw =3D (bp->fw_major) + (bp->fw_minor << 8) + - (bp->fw_rev << 16) + (bp->fw_eng << 24); + u8 loaded_fw_major, loaded_fw_minor, loaded_fw_rev, loaded_fw_eng; + u32 loaded_fw; =20 /* read loaded FW from chip */ - u32 loaded_fw =3D REG_RD(bp, XSEM_REG_PRAM); + loaded_fw =3D REG_RD(bp, XSEM_REG_PRAM); =20 - DP(BNX2X_MSG_SP, "loaded fw %x, my fw %x\n", - loaded_fw, my_fw); + loaded_fw_major =3D loaded_fw & 0xff; + loaded_fw_minor =3D (loaded_fw >> 8) & 0xff; + loaded_fw_rev =3D (loaded_fw >> 16) & 0xff; + loaded_fw_eng =3D (loaded_fw >> 24) & 0xff; + + DP(BNX2X_MSG_SP, "loaded fw 0x%x major 0x%x minor 0x%x rev 0x%x eng 0x%x= \n", + loaded_fw, loaded_fw_major, loaded_fw_minor, loaded_fw_rev, loaded_fw= _eng); =20 /* abort nic load if version mismatch */ - if (my_fw !=3D loaded_fw) { + if (loaded_fw_major !=3D BCM_5710_FW_MAJOR_VERSION || + loaded_fw_minor !=3D BCM_5710_FW_MINOR_VERSION || + loaded_fw_eng !=3D BCM_5710_FW_ENGINEERING_VERSION || + loaded_fw_rev < BCM_5710_FW_REVISION_VERSION_V15) { if (print_err) - BNX2X_ERR("bnx2x with FW %x was already loaded which mismatches my %x = FW. Aborting\n", - loaded_fw, my_fw); + BNX2X_ERR("loaded FW incompatible. Aborting\n"); else - BNX2X_DEV_INFO("bnx2x with FW %x was already loaded which mismatches m= y %x FW, possibly due to MF UNDI\n", - loaded_fw, my_fw); + BNX2X_DEV_INFO("loaded FW incompatible, possibly due to MF UNDI\n"); + return -EBUSY; } } diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net= /ethernet/broadcom/bnx2x/bnx2x_main.c index 7fa271db41b0..6333471916be 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c @@ -12366,15 +12366,6 @@ static int bnx2x_init_bp(struct bnx2x *bp) =20 bnx2x_read_fwinfo(bp); =20 - if (IS_PF(bp)) { - rc =3D bnx2x_init_firmware(bp); - - if (rc) { - bnx2x_free_mem_bp(bp); - return rc; - } - } - func =3D BP_FUNC(bp); =20 /* need to reset chip if undi was active */ @@ -12387,7 +12378,6 @@ static int bnx2x_init_bp(struct bnx2x *bp) =20 rc =3D bnx2x_prev_unload(bp); if (rc) { - bnx2x_release_firmware(bp); bnx2x_free_mem_bp(bp); return rc; } @@ -13469,7 +13459,7 @@ do { \ (u8 *)bp->arr, len); \ } while (0) =20 -int bnx2x_init_firmware(struct bnx2x *bp) +static int bnx2x_init_firmware(struct bnx2x *bp) { const char *fw_file_name, *fw_file_name_v15; struct bnx2x_fw_file_hdr *fw_hdr; @@ -13569,7 +13559,7 @@ int bnx2x_init_firmware(struct bnx2x *bp) return rc; } =20 -void bnx2x_release_firmware(struct bnx2x *bp) +static void bnx2x_release_firmware(struct bnx2x *bp) { kfree(bp->init_ops_offsets); kfree(bp->init_ops); @@ -14086,7 +14076,6 @@ static int bnx2x_init_one(struct pci_dev *pdev, return 0; =20 init_one_freemem: - bnx2x_release_firmware(bp); bnx2x_free_mem_bp(bp); =20 init_one_exit: --=20 2.34.1 From nobody Mon Jun 22 15:38:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD8EBC433FE for ; Mon, 21 Mar 2022 14:11:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349116AbiCUOH6 (ORCPT ); Mon, 21 Mar 2022 10:07:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348635AbiCUOAz (ORCPT ); Mon, 21 Mar 2022 10:00:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BFB033E9B; Mon, 21 Mar 2022 06:58:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C05BBB816C8; Mon, 21 Mar 2022 13:58:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 148C0C340E8; Mon, 21 Mar 2022 13:58:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871134; bh=CjL/5lpWAEaZS+q0TB+7Ysy9hllqnIj2eeqoVU0PgtE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O+4KIcc+Ao5ZCDLfKN9S9kcW7rAUjiYkyUD+fLHkIudQvr/sa3Nv0Rz482YxuDbXe nZbRM3gFRrHtC8VA4llWn/n6/u+P30DNcZKI+Z39yRIipF3WChFqbmuMm33ZCmlZ81 IU1GRs2f5f1VjAZP9zClY0b+KKZpaViWba2Hd7+c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Doug Berger , Florian Fainelli , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 17/30] net: bcmgenet: skip invalid partial checksums Date: Mon, 21 Mar 2022 14:52:47 +0100 Message-Id: <20220321133220.145489200@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133219.643490199@linuxfoundation.org> References: <20220321133219.643490199@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Doug Berger [ Upstream commit 0f643c88c8d240eba0ea25c2e095a46515ff46e9 ] The RXCHK block will return a partial checksum of 0 if it encounters a problem while receiving a packet. Since a 1's complement sum can only produce this result if no bits are set in the received data stream it is fair to treat it as an invalid partial checksum and not pass it up the stack. Fixes: 810155397890 ("net: bcmgenet: use CHECKSUM_COMPLETE for NETIF_F_RXCS= UM") Signed-off-by: Doug Berger Acked-by: Florian Fainelli Link: https://lore.kernel.org/r/20220317012812.1313196-1-opendmb@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/e= thernet/broadcom/genet/bcmgenet.c index e19cf020e5ae..a2062144d7ca 100644 --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c @@ -2239,8 +2239,10 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet= _rx_ring *ring, dma_length_status =3D status->length_status; if (dev->features & NETIF_F_RXCSUM) { rx_csum =3D (__force __be16)(status->rx_csum & 0xffff); - skb->csum =3D (__force __wsum)ntohs(rx_csum); - skb->ip_summed =3D CHECKSUM_COMPLETE; + if (rx_csum) { + skb->csum =3D (__force __wsum)ntohs(rx_csum); + skb->ip_summed =3D CHECKSUM_COMPLETE; + } } =20 /* DMA flags and length are still valid no matter how --=20 2.34.1 From nobody Mon Jun 22 15:38:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 856FDC43217 for ; Mon, 21 Mar 2022 14:11:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349382AbiCUOIM (ORCPT ); Mon, 21 Mar 2022 10:08:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348676AbiCUOA5 (ORCPT ); Mon, 21 Mar 2022 10:00:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F8F33D48F; Mon, 21 Mar 2022 06:58:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1F19C612A1; Mon, 21 Mar 2022 13:58:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 109A6C340ED; Mon, 21 Mar 2022 13:58:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871137; bh=saHmvrY9uxdGezIR6fec89oK13Fs/l/1MxLyPHD9tpQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f14wjtNXL7RMQ1CUngUqRSEhktxPmRrQFkD0fCPd5fp4Xkr+q2WvcvfVlAAsVsNJK wXoxqQ9OGpaUlQkmkdbY3Yq4R+G1Qe2vwkDVnipsCJJI4RkieCaQ/4+rQvRBRHQXwP m+5Dr2hRrXUTGuIk9yqJO3vhEXYNWCUJHy/0fjBU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 18/30] net: mscc: ocelot: fix backwards compatibility with single-chain tc-flower offload Date: Mon, 21 Mar 2022 14:52:48 +0100 Message-Id: <20220321133220.173764440@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133219.643490199@linuxfoundation.org> References: <20220321133219.643490199@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 8e0341aefcc9133f3f48683873284b169581315b ] ACL rules can be offloaded to VCAP IS2 either through chain 0, or, since the blamed commit, through a chain index whose number encodes a specific PAG (Policy Action Group) and lookup number. The chain number is translated through ocelot_chain_to_pag() into a PAG, and through ocelot_chain_to_lookup() into a lookup number. The problem with the blamed commit is that the above 2 functions don't have special treatment for chain 0. So ocelot_chain_to_pag(0) returns filter->pag =3D 224, which is in fact -32, but the "pag" field is an u8. So we end up programming the hardware with VCAP IS2 entries having a PAG of 224. But the way in which the PAG works is that it defines a subset of VCAP IS2 filters which should match on a packet. The default PAG is 0, and previous VCAP IS1 rules (which we offload using 'goto') can modify it. So basically, we are installing filters with a PAG on which no packet will ever match. This is the hardware equivalent of adding filters to a chain which has no 'goto' to it. Restore the previous functionality by making ACL filters offloaded to chain 0 go to PAG 0 and lookup number 0. The choice of PAG is clearly correct, but the choice of lookup number isn't "as before" (which was to leave the lookup a "don't care"). However, lookup 0 should be fine, since even though there are ACL actions (policers) which have a requirement to be used in a specific lookup, that lookup is 0. Fixes: 226e9cd82a96 ("net: mscc: ocelot: only install TCAM entries into a s= pecific lookup and PAG") Signed-off-by: Vladimir Oltean Link: https://lore.kernel.org/r/20220316192117.2568261-1-vladimir.oltean@nx= p.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/ethernet/mscc/ocelot_flower.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mscc/ocelot_flower.c b/drivers/net/ethern= et/mscc/ocelot_flower.c index 217e8333de6c..c4c4649b2088 100644 --- a/drivers/net/ethernet/mscc/ocelot_flower.c +++ b/drivers/net/ethernet/mscc/ocelot_flower.c @@ -54,6 +54,12 @@ static int ocelot_chain_to_block(int chain, bool ingress) */ static int ocelot_chain_to_lookup(int chain) { + /* Backwards compatibility with older, single-chain tc-flower + * offload support in Ocelot + */ + if (chain =3D=3D 0) + return 0; + return (chain / VCAP_LOOKUP) % 10; } =20 @@ -62,7 +68,15 @@ static int ocelot_chain_to_lookup(int chain) */ static int ocelot_chain_to_pag(int chain) { - int lookup =3D ocelot_chain_to_lookup(chain); + int lookup; + + /* Backwards compatibility with older, single-chain tc-flower + * offload support in Ocelot + */ + if (chain =3D=3D 0) + return 0; + + lookup =3D ocelot_chain_to_lookup(chain); =20 /* calculate PAG value as chain index relative to the first PAG */ return chain - VCAP_IS2_CHAIN(lookup, 0); --=20 2.34.1 From nobody Mon Jun 22 15:38:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55918C4167E for ; Mon, 21 Mar 2022 14:11:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350721AbiCUOKL (ORCPT ); Mon, 21 Mar 2022 10:10:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348919AbiCUODK (ORCPT ); Mon, 21 Mar 2022 10:03:10 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FBC33FBF9; Mon, 21 Mar 2022 06:59:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4C9CEB816E3; Mon, 21 Mar 2022 13:59:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B04C6C340E8; Mon, 21 Mar 2022 13:59:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871196; bh=jbi74pirWmIJryKTHRKMdiKZsXWXK+wLnFhWCEPB59E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I8PQMFrJCjHMeX8Am5DIMHgAgrKLK2FUe4gglGJoRLLgsUsUFO5/Nv7mhi2Kbx/LN JGv7UDpfKRl69FQClN87Bsc9m8fEjxBWJwS8YTXYEVs1rgglB+rdgEfaNOuFh2fPyB s9pkm2Ma85ww/0memxmdl53LDCDsLlVdhLlGRjJ0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arnd Bergmann , James Morse , Catalin Marinas , Sasha Levin Subject: [PATCH 5.10 19/30] arm64: fix clang warning about TRAMP_VALIAS Date: Mon, 21 Mar 2022 14:52:49 +0100 Message-Id: <20220321133220.201591833@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133219.643490199@linuxfoundation.org> References: <20220321133219.643490199@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Arnd Bergmann [ Upstream commit 7f34b43e07cb512b28543fdcb9f35d1fbfda9ebc ] The newly introduced TRAMP_VALIAS definition causes a build warning with clang-14: arch/arm64/include/asm/vectors.h:66:31: error: arithmetic on a null pointer= treated as a cast from integer to pointer is a GNU extension [-Werror,-Wnu= ll-pointer-arithmetic] return (char *)TRAMP_VALIAS + SZ_2K * slot; Change the addition to something clang does not complain about. Fixes: bd09128d16fa ("arm64: Add percpu vectors for EL1") Signed-off-by: Arnd Bergmann Acked-by: James Morse Link: https://lore.kernel.org/r/20220316183833.1563139-1-arnd@kernel.org Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- arch/arm64/include/asm/vectors.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/include/asm/vectors.h b/arch/arm64/include/asm/vect= ors.h index f64613a96d53..bc9a2145f419 100644 --- a/arch/arm64/include/asm/vectors.h +++ b/arch/arm64/include/asm/vectors.h @@ -56,14 +56,14 @@ enum arm64_bp_harden_el1_vectors { DECLARE_PER_CPU_READ_MOSTLY(const char *, this_cpu_vector); =20 #ifndef CONFIG_UNMAP_KERNEL_AT_EL0 -#define TRAMP_VALIAS 0 +#define TRAMP_VALIAS 0ul #endif =20 static inline const char * arm64_get_bp_hardening_vector(enum arm64_bp_harden_el1_vectors slot) { if (arm64_kernel_unmapped_at_el0()) - return (char *)TRAMP_VALIAS + SZ_2K * slot; + return (char *)(TRAMP_VALIAS + SZ_2K * slot); =20 WARN_ON_ONCE(slot =3D=3D EL1_VECTOR_KPTI); =20 --=20 2.34.1 From nobody Mon Jun 22 15:38:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C761C41535 for ; Mon, 21 Mar 2022 14:12:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351788AbiCUOLq (ORCPT ); Mon, 21 Mar 2022 10:11:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243034AbiCUOCc (ORCPT ); Mon, 21 Mar 2022 10:02:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 271A63A722; Mon, 21 Mar 2022 06:59:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C6AC461291; Mon, 21 Mar 2022 13:59:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB1D0C340E8; Mon, 21 Mar 2022 13:59:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871165; bh=JBwT2FpWuW+DXrzrhNxMCQ2pX1GZUCBphhPILV5OTbU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DSJuKUbHUs1qyDDOQpg35MJstcdazu3gKDoFiyEzLTXmoR43arbjb7/DbOKg35o0u 8nRwVxcOFV7B/IqgaUJ7DUG0R/pVtwMTdmQAZjkf/UUpNjmfNwIN1op0Gr7+AKplG1 12NvIuMJJvDaiAaBRlPNZybnXbE5InFfesb+U68I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Dan Carpenter Subject: [PATCH 5.10 20/30] usb: gadget: rndis: prevent integer overflow in rndis_set_response() Date: Mon, 21 Mar 2022 14:52:50 +0100 Message-Id: <20220321133220.230272220@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133219.643490199@linuxfoundation.org> References: <20220321133219.643490199@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 commit 65f3324f4b6fed78b8761c3b74615ecf0ffa81fa upstream. If "BufOffset" is very large the "BufOffset + 8" operation can have an integer overflow. Cc: stable@kernel.org Fixes: 38ea1eac7d88 ("usb: gadget: rndis: check size of RNDIS_MSG_SET comma= nd") Signed-off-by: Dan Carpenter Link: https://lore.kernel.org/r/20220301080424.GA17208@kili Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/usb/gadget/function/rndis.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/usb/gadget/function/rndis.c +++ b/drivers/usb/gadget/function/rndis.c @@ -640,6 +640,7 @@ static int rndis_set_response(struct rnd BufLength =3D le32_to_cpu(buf->InformationBufferLength); BufOffset =3D le32_to_cpu(buf->InformationBufferOffset); if ((BufLength > RNDIS_MAX_TOTAL_SIZE) || + (BufOffset > RNDIS_MAX_TOTAL_SIZE) || (BufOffset + 8 >=3D RNDIS_MAX_TOTAL_SIZE)) return -EINVAL; From nobody Mon Jun 22 15:38:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1C00C35295 for ; Mon, 21 Mar 2022 14:11:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351730AbiCUOLg (ORCPT ); Mon, 21 Mar 2022 10:11:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348767AbiCUOCl (ORCPT ); Mon, 21 Mar 2022 10:02:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A0BC33E9B; Mon, 21 Mar 2022 06:59:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7A7796132C; Mon, 21 Mar 2022 13:59:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8161EC340F3; Mon, 21 Mar 2022 13:59:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871173; bh=SisNPNMwIL3YAd74uiLsbQc1ojVwhNKoLmnSOriiSr0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1IWQp0u2MYu5Jtj0lqkxQynQNPpzjyIBNuMFMOizIkSgeey+XS9cn7uBfjGwPFqpV ImkcgWAz5iyMYXLXa8ZNVpx1yOrj10Dgy/GwYRj0y30SSMifpHBflzP/H04BbEcrWZ yMv4FadCRIdRRBBOtE7+ACk7x8EZrtCPXPr7Jl+8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern , syzbot+348b571beb5eeb70a582@syzkaller.appspotmail.com Subject: [PATCH 5.10 21/30] usb: gadget: Fix use-after-free bug by not setting udc->dev.driver Date: Mon, 21 Mar 2022 14:52:51 +0100 Message-Id: <20220321133220.258860038@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133219.643490199@linuxfoundation.org> References: <20220321133219.643490199@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alan Stern commit 16b1941eac2bd499f065a6739a40ce0011a3d740 upstream. The syzbot fuzzer found a use-after-free bug: BUG: KASAN: use-after-free in dev_uevent+0x712/0x780 drivers/base/core.c:23= 20 Read of size 8 at addr ffff88802b934098 by task udevd/3689 CPU: 2 PID: 3689 Comm: udevd Not tainted 5.17.0-rc4-syzkaller-00229-g4f12b7= 42eb2b #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106 print_address_description.constprop.0.cold+0x8d/0x303 mm/kasan/report.c:255 __kasan_report mm/kasan/report.c:442 [inline] kasan_report.cold+0x83/0xdf mm/kasan/report.c:459 dev_uevent+0x712/0x780 drivers/base/core.c:2320 uevent_show+0x1b8/0x380 drivers/base/core.c:2391 dev_attr_show+0x4b/0x90 drivers/base/core.c:2094 Although the bug manifested in the driver core, the real cause was a race with the gadget core. dev_uevent() does: if (dev->driver) add_uevent_var(env, "DRIVER=3D%s", dev->driver->name); and between the test and the dereference of dev->driver, the gadget core sets dev->driver to NULL. The race wouldn't occur if the gadget core registered its devices on a real bus, using the standard synchronization techniques of the driver core. However, it's not necessary to make such a large change in order to fix this bug; all we need to do is make sure that udc->dev.driver is always NULL. In fact, there is no reason for udc->dev.driver ever to be set to anything, let alone to the value it currently gets: the address of the gadget's driver. After all, a gadget driver only knows how to manage a gadget, not how to manage a UDC. This patch simply removes the statements in the gadget core that touch udc->dev.driver. Fixes: 2ccea03a8f7e ("usb: gadget: introduce UDC Class") CC: Reported-and-tested-by: syzbot+348b571beb5eeb70a582@syzkaller.appspotmail.c= om Signed-off-by: Alan Stern Link: https://lore.kernel.org/r/YiQgukfFFbBnwJ/9@rowland.harvard.edu Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/usb/gadget/udc/core.c | 3 --- 1 file changed, 3 deletions(-) --- a/drivers/usb/gadget/udc/core.c +++ b/drivers/usb/gadget/udc/core.c @@ -1343,7 +1343,6 @@ static void usb_gadget_remove_driver(str usb_gadget_udc_stop(udc); =20 udc->driver =3D NULL; - udc->dev.driver =3D NULL; udc->gadget->dev.driver =3D NULL; } =20 @@ -1405,7 +1404,6 @@ static int udc_bind_to_driver(struct usb driver->function); =20 udc->driver =3D driver; - udc->dev.driver =3D &driver->driver; udc->gadget->dev.driver =3D &driver->driver; =20 usb_gadget_udc_set_speed(udc, driver->max_speed); @@ -1427,7 +1425,6 @@ err1: dev_err(&udc->dev, "failed to start %s: %d\n", udc->driver->function, ret); udc->driver =3D NULL; - udc->dev.driver =3D NULL; udc->gadget->dev.driver =3D NULL; return ret; } From nobody Mon Jun 22 15:38:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 31B71C4167B for ; Mon, 21 Mar 2022 14:11:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350606AbiCUOKA (ORCPT ); Mon, 21 Mar 2022 10:10:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348903AbiCUODJ (ORCPT ); Mon, 21 Mar 2022 10:03:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 100E13EF3E; Mon, 21 Mar 2022 06:59:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 370546131F; Mon, 21 Mar 2022 13:59:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46F89C36AE7; Mon, 21 Mar 2022 13:59:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871176; bh=B2PwWKJauXDFQuvSQYT/EWCzPk39Vbs2uYKXUVD7pOM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=06ofGKOpSv04Slz7EMElP9T/T31tmZD4tZwyQCIzoAey6tDBzAW3xVlvis0RumlZ8 ex7oKxfukWtnQko8qbuX3F3MxkJgnEpep9pj+qY6Trz7QLOlzd65QMMMgE+pTxC8wT BKkxepjWq9Iu+CxLAkKjc9pYoZc7Irc2IjeX9eTA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern , syzbot+a48e3d1a875240cab5de@syzkaller.appspotmail.com Subject: [PATCH 5.10 22/30] usb: usbtmc: Fix bug in pipe direction for control transfers Date: Mon, 21 Mar 2022 14:52:52 +0100 Message-Id: <20220321133220.287521534@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133219.643490199@linuxfoundation.org> References: <20220321133219.643490199@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alan Stern commit e9b667a82cdcfe21d590344447d65daed52b353b upstream. The syzbot fuzzer reported a minor bug in the usbtmc driver: usb 5-1: BOGUS control dir, pipe 80001e80 doesn't match bRequestType 0 WARNING: CPU: 0 PID: 3813 at drivers/usb/core/urb.c:412 usb_submit_urb+0x13a5/0x1970 drivers/usb/core/urb.c:410 Modules linked in: CPU: 0 PID: 3813 Comm: syz-executor122 Not tainted 5.17.0-rc5-syzkaller-00306-g2293be58d6a1 #0 ... Call Trace: usb_start_wait_urb+0x113/0x530 drivers/usb/core/message.c:58 usb_internal_control_msg drivers/usb/core/message.c:102 [inline] usb_control_msg+0x2a5/0x4b0 drivers/usb/core/message.c:153 usbtmc_ioctl_request drivers/usb/class/usbtmc.c:1947 [inline] The problem is that usbtmc_ioctl_request() uses usb_rcvctrlpipe() for all of its transfers, whether they are in or out. It's easy to fix. CC: Reported-and-tested-by: syzbot+a48e3d1a875240cab5de@syzkaller.appspotmail.c= om Signed-off-by: Alan Stern Link: https://lore.kernel.org/r/YiEsYTPEE6lOCOA5@rowland.harvard.edu Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/usb/class/usbtmc.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) --- a/drivers/usb/class/usbtmc.c +++ b/drivers/usb/class/usbtmc.c @@ -1889,6 +1889,7 @@ static int usbtmc_ioctl_request(struct u struct usbtmc_ctrlrequest request; u8 *buffer =3D NULL; int rv; + unsigned int is_in, pipe; unsigned long res; =20 res =3D copy_from_user(&request, arg, sizeof(struct usbtmc_ctrlrequest)); @@ -1898,12 +1899,14 @@ static int usbtmc_ioctl_request(struct u if (request.req.wLength > USBTMC_BUFSIZE) return -EMSGSIZE; =20 + is_in =3D request.req.bRequestType & USB_DIR_IN; + if (request.req.wLength) { buffer =3D kmalloc(request.req.wLength, GFP_KERNEL); if (!buffer) return -ENOMEM; =20 - if ((request.req.bRequestType & USB_DIR_IN) =3D=3D 0) { + if (!is_in) { /* Send control data to device */ res =3D copy_from_user(buffer, request.data, request.req.wLength); @@ -1914,8 +1917,12 @@ static int usbtmc_ioctl_request(struct u } } =20 + if (is_in) + pipe =3D usb_rcvctrlpipe(data->usb_dev, 0); + else + pipe =3D usb_sndctrlpipe(data->usb_dev, 0); rv =3D usb_control_msg(data->usb_dev, - usb_rcvctrlpipe(data->usb_dev, 0), + pipe, request.req.bRequest, request.req.bRequestType, request.req.wValue, @@ -1927,7 +1934,7 @@ static int usbtmc_ioctl_request(struct u goto exit; } =20 - if (rv && (request.req.bRequestType & USB_DIR_IN)) { + if (rv && is_in) { /* Read control data from device */ res =3D copy_to_user(request.data, buffer, rv); if (res) From nobody Mon Jun 22 15:38:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85488C35278 for ; Mon, 21 Mar 2022 14:11:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349909AbiCUOI4 (ORCPT ); Mon, 21 Mar 2022 10:08:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348819AbiCUODB (ORCPT ); Mon, 21 Mar 2022 10:03:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 84CFBBD7E9; Mon, 21 Mar 2022 06:59:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9F334B81598; Mon, 21 Mar 2022 13:59:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4854C340F2; Mon, 21 Mar 2022 13:59:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871179; bh=TvLU7XgDbq4FG8A8TsB4hsfrKgfT3NhKOFUGfv4zHF4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yGWSr7nzFAkvAdb+0nRv4zoZE5MEvWky8cU6gZ6A5XC4K3smOmWHbTaq1MZkzoEKA 7lepxWk/Q5MPT1b3IGz/vNN5ERzGM7tJxBc/PesTYq8WZ1Xr8BfdiUsG+sW/E906G7 zNPwaBcHfPp3Jsqo+d1rzesPU0tmdXaV4bgOa5LA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sreekanth Reddy , Matt Lupfer , "Martin K. Petersen" Subject: [PATCH 5.10 23/30] scsi: mpt3sas: Page fault in reply q processing Date: Mon, 21 Mar 2022 14:52:53 +0100 Message-Id: <20220321133220.316060192@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133219.643490199@linuxfoundation.org> References: <20220321133219.643490199@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Matt Lupfer commit 69ad4ef868c1fc7609daa235dfa46d28ba7a3ba3 upstream. A page fault was encountered in mpt3sas on a LUN reset error path: [ 145.763216] mpt3sas_cm1: Task abort tm failed: handle(0x0002),timeout(30= ) tr_method(0x0) smid(3) msix_index(0) [ 145.778932] scsi 1:0:0:0: task abort: FAILED scmd(0x0000000024ba29a2) [ 145.817307] scsi 1:0:0:0: attempting device reset! scmd(0x0000000024ba29= a2) [ 145.827253] scsi 1:0:0:0: [sg1] tag#2 CDB: Receive Diagnostic 1c 01 01 f= f fc 00 [ 145.837617] scsi target1:0:0: handle(0x0002), sas_address(0x500605b00002= 72b9), phy(0) [ 145.848598] scsi target1:0:0: enclosure logical id(0x500605b0000272b8), = slot(0) [ 149.858378] mpt3sas_cm1: Poll ReplyDescriptor queues for completion of s= mid(0), task_type(0x05), handle(0x0002) [ 149.875202] BUG: unable to handle page fault for address: 00000007fffc44= 5d [ 149.885617] #PF: supervisor read access in kernel mode [ 149.894346] #PF: error_code(0x0000) - not-present page [ 149.903123] PGD 0 P4D 0 [ 149.909387] Oops: 0000 [#1] PREEMPT SMP NOPTI [ 149.917417] CPU: 24 PID: 3512 Comm: scsi_eh_1 Kdump: loaded Tainted: G S= O 5.10.89-altav-1 #1 [ 149.934327] Hardware name: DDN 200NVX2 /200NVX2-MB= , BIOS ATHG2.2.02.01 09/10/2021 [ 149.951871] RIP: 0010:_base_process_reply_queue+0x4b/0x900 [mpt3sas] [ 149.961889] Code: 0f 84 22 02 00 00 8d 48 01 49 89 fd 48 8d 57 38 f0 0f = b1 4f 38 0f 85 d8 01 00 00 49 8b 45 10 45 31 e4 41 8b 55 0c 48 8d 1c d0 <0f= > b6 03 83 e0 0f 3c 0f 0f 85 a2 00 00 00 e9 e6 01 00 00 0f b7 ee [ 149.991952] RSP: 0018:ffffc9000f1ebcb8 EFLAGS: 00010246 [ 150.000937] RAX: 0000000000000055 RBX: 00000007fffc445d RCX: 00000000254= 8f071 [ 150.011841] RDX: 00000000ffff8881 RSI: 0000000000000001 RDI: ffff888125e= d50d8 [ 150.022670] RBP: 0000000000000000 R08: 0000000000000000 R09: c0000000fff= f7fff [ 150.033445] R10: ffffc9000f1ebb68 R11: ffffc9000f1ebb60 R12: 00000000000= 00000 [ 150.044204] R13: ffff888125ed50d8 R14: 0000000000000080 R15: 34cdc00034c= dea80 [ 150.054963] FS: 0000000000000000(0000) GS:ffff88dfaf200000(0000) knlGS:= 0000000000000000 [ 150.066715] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 150.076078] CR2: 00000007fffc445d CR3: 000000012448a006 CR4: 00000000007= 70ee0 [ 150.086887] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 00000000000= 00000 [ 150.097670] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 00000000000= 00400 [ 150.108323] PKRU: 55555554 [ 150.114690] Call Trace: [ 150.120497] ? printk+0x48/0x4a [ 150.127049] mpt3sas_scsih_issue_tm.cold.114+0x2e/0x2b3 [mpt3sas] [ 150.136453] mpt3sas_scsih_issue_locked_tm+0x86/0xb0 [mpt3sas] [ 150.145759] scsih_dev_reset+0xea/0x300 [mpt3sas] [ 150.153891] scsi_eh_ready_devs+0x541/0x9e0 [scsi_mod] [ 150.162206] ? __scsi_host_match+0x20/0x20 [scsi_mod] [ 150.170406] ? scsi_try_target_reset+0x90/0x90 [scsi_mod] [ 150.178925] ? blk_mq_tagset_busy_iter+0x45/0x60 [ 150.186638] ? scsi_try_target_reset+0x90/0x90 [scsi_mod] [ 150.195087] scsi_error_handler+0x3a5/0x4a0 [scsi_mod] [ 150.203206] ? __schedule+0x1e9/0x610 [ 150.209783] ? scsi_eh_get_sense+0x210/0x210 [scsi_mod] [ 150.217924] kthread+0x12e/0x150 [ 150.224041] ? kthread_worker_fn+0x130/0x130 [ 150.231206] ret_from_fork+0x1f/0x30 This is caused by mpt3sas_base_sync_reply_irqs() using an invalid reply_q pointer outside of the list_for_each_entry() loop. At the end of the full list traversal the pointer is invalid. Move the _base_process_reply_queue() call inside of the loop. Link: https://lore.kernel.org/r/d625deae-a958-0ace-2ba3-0888dd0a415b@ddn.com Fixes: 711a923c14d9 ("scsi: mpt3sas: Postprocessing of target and LUN reset= ") Cc: stable@vger.kernel.org Acked-by: Sreekanth Reddy Signed-off-by: Matt Lupfer Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/scsi/mpt3sas/mpt3sas_base.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -1832,9 +1832,10 @@ mpt3sas_base_sync_reply_irqs(struct MPT3 enable_irq(reply_q->os_irq); } } + + if (poll) + _base_process_reply_queue(reply_q); } - if (poll) - _base_process_reply_queue(reply_q); } =20 /** From nobody Mon Jun 22 15:38:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4183EC4321E for ; Mon, 21 Mar 2022 14:11:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350676AbiCUOKH (ORCPT ); Mon, 21 Mar 2022 10:10:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348938AbiCUODL (ORCPT ); Mon, 21 Mar 2022 10:03:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0692173369; Mon, 21 Mar 2022 07:00:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8394E6125C; Mon, 21 Mar 2022 13:59:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94223C340E8; Mon, 21 Mar 2022 13:59:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871182; bh=dGOcXsBKGb+pa/3WupTRMH4qEFSFdcbUJ2kNGLJFczo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l7Wx7ntCuTC8Rm2tNoGI27cAHag33a7Tam8yfRIb92nd1iN2JCVdt9JmuwS6aMoAQ A4iqgta699eCt0EZJDPGV/tYxbAzafvT4ISWnp/xemcJZwG+jfRcLm3EAH50QHDvXM oPHkuqzWhLdqf+LMEixkR4h2os0PcrDKPP33MWo0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Skripkin , Dmitry Torokhov , syzbot+75cccf2b7da87fb6f84b@syzkaller.appspotmail.com Subject: [PATCH 5.10 24/30] Input: aiptek - properly check endpoint type Date: Mon, 21 Mar 2022 14:52:54 +0100 Message-Id: <20220321133220.344651840@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133219.643490199@linuxfoundation.org> References: <20220321133219.643490199@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pavel Skripkin commit 5600f6986628dde8881734090588474f54a540a8 upstream. Syzbot reported warning in usb_submit_urb() which is caused by wrong endpoint type. There was a check for the number of endpoints, but not for the type of endpoint. Fix it by replacing old desc.bNumEndpoints check with usb_find_common_endpoints() helper for finding endpoints Fail log: usb 5-1: BOGUS urb xfer, pipe 1 !=3D type 3 WARNING: CPU: 2 PID: 48 at drivers/usb/core/urb.c:502 usb_submit_urb+0xed2/= 0x18a0 drivers/usb/core/urb.c:502 Modules linked in: CPU: 2 PID: 48 Comm: kworker/2:2 Not tainted 5.17.0-rc6-syzkaller-00226-g07= ebd38a0da2 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.14.0-2 04/01/2014 Workqueue: usb_hub_wq hub_event ... Call Trace: aiptek_open+0xd5/0x130 drivers/input/tablet/aiptek.c:830 input_open_device+0x1bb/0x320 drivers/input/input.c:629 kbd_connect+0xfe/0x160 drivers/tty/vt/keyboard.c:1593 Fixes: 8e20cf2bce12 ("Input: aiptek - fix crash on detecting device without= endpoints") Reported-and-tested-by: syzbot+75cccf2b7da87fb6f84b@syzkaller.appspotmail.c= om Signed-off-by: Pavel Skripkin Link: https://lore.kernel.org/r/20220308194328.26220-1-paskripkin@gmail.com Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/input/tablet/aiptek.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) --- a/drivers/input/tablet/aiptek.c +++ b/drivers/input/tablet/aiptek.c @@ -1801,15 +1801,13 @@ aiptek_probe(struct usb_interface *intf, input_set_abs_params(inputdev, ABS_TILT_Y, AIPTEK_TILT_MIN, AIPTEK_TILT_M= AX, 0, 0); input_set_abs_params(inputdev, ABS_WHEEL, AIPTEK_WHEEL_MIN, AIPTEK_WHEEL_= MAX - 1, 0, 0); =20 - /* Verify that a device really has an endpoint */ - if (intf->cur_altsetting->desc.bNumEndpoints < 1) { + err =3D usb_find_common_endpoints(intf->cur_altsetting, + NULL, NULL, &endpoint, NULL); + if (err) { dev_err(&intf->dev, - "interface has %d endpoints, but must have minimum 1\n", - intf->cur_altsetting->desc.bNumEndpoints); - err =3D -EINVAL; + "interface has no int in endpoints, but must have minimum 1\n"); goto fail3; } - endpoint =3D &intf->cur_altsetting->endpoint[0].desc; =20 /* Go set up our URB, which is called when the tablet receives * input. From nobody Mon Jun 22 15:38:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 904D0C433FE for ; Mon, 21 Mar 2022 14:12:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351626AbiCUOLT (ORCPT ); Mon, 21 Mar 2022 10:11:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348835AbiCUODC (ORCPT ); Mon, 21 Mar 2022 10:03:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 68F0D1667EA; Mon, 21 Mar 2022 06:59:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 44D9EB816DA; Mon, 21 Mar 2022 13:59:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87C64C340E8; Mon, 21 Mar 2022 13:59:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871185; bh=tj33CDVipt3Hwcf7gdEjoaIZbWPVmkUS+u0jcdrdLGM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YCZRCJZsrYamb4DvZiwKL45ZsuuOZJJ76jNmDH5NE+WHwFb3J1pW9QibzIRXtkzAk jTrc1/cZPiD7QO/3t6fsX5aRFJqWvFgb2uVfYVQPQCgU9cpBadsr6GxuY5yUCLCP+W ozlk3Lmjyu+YVUvw3qLrrKC8cGHEUklx/kFrPiMc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Petlan , Athira Jajeev , Jiri Olsa , Kajol Jain , Madhavan Srinivasan , Arnaldo Carvalho de Melo Subject: [PATCH 5.10 25/30] perf symbols: Fix symbol size calculation condition Date: Mon, 21 Mar 2022 14:52:55 +0100 Message-Id: <20220321133220.373087229@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133219.643490199@linuxfoundation.org> References: <20220321133219.643490199@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Petlan commit 3cf6a32f3f2a45944dd5be5c6ac4deb46bcd3bee upstream. Before this patch, the symbol end address fixup to be called, needed two conditions being met: if (prev->end =3D=3D prev->start && prev->end !=3D curr->start) Where "prev->end =3D=3D prev->start" means that prev is zero-long (and thus needs a fixup) and "prev->end !=3D curr->start" means that fixup hasn't been applied yet However, this logic is incorrect in the following situation: *curr =3D {rb_node =3D {__rb_parent_color =3D 278218928, rb_right =3D 0x0, rb_left =3D 0x0}, start =3D 0xc000000000062354, end =3D 0xc000000000062354, namelen =3D 40, type =3D 2 '\002', binding =3D 0 '\000', idle =3D 0 '\000', ignore =3D 0 '\000', inlined =3D 0 '\000', arch_sym =3D 0 '\000', annotate2 =3D false, name =3D 0x1159739e "kprobe_optinsn_page\t[__builtin__kprobes]"} *prev =3D {rb_node =3D {__rb_parent_color =3D 278219041, rb_right =3D 0x109548b0, rb_left =3D 0x109547c0}, start =3D 0xc000000000062354, end =3D 0xc000000000062354, namelen =3D 12, type =3D 2 '\002', binding =3D 1 '\001', idle =3D 0 '\000', ignore =3D 0 '\000', inlined =3D 0 '\000', arch_sym =3D 0 '\000', annotate2 =3D false, name =3D 0x1095486e "optinsn_slot"} In this case, prev->start =3D=3D prev->end =3D=3D curr->start =3D=3D curr->= end, thus the condition above thinks that "we need a fixup due to zero length of prev symbol, but it has been probably done, since the prev->end =3D=3D curr->start", which is wrong. After the patch, the execution path proceeds to arch__symbols__fixup_end function which fixes up the size of prev symbol by adding page_size to its end offset. Fixes: 3b01a413c196c910 ("perf symbols: Improve kallsyms symbol end addr ca= lculation") Signed-off-by: Michael Petlan Cc: Athira Jajeev Cc: Jiri Olsa Cc: Kajol Jain Cc: Madhavan Srinivasan Link: http://lore.kernel.org/lkml/20220317135536.805-1-mpetlan@redhat.com Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- tools/perf/util/symbol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c @@ -231,7 +231,7 @@ void symbols__fixup_end(struct rb_root_c prev =3D curr; curr =3D rb_entry(nd, struct symbol, rb_node); =20 - if (prev->end =3D=3D prev->start && prev->end !=3D curr->start) + if (prev->end =3D=3D prev->start || prev->end !=3D curr->start) arch__symbols__fixup_end(prev, curr); } From nobody Mon Jun 22 15:38:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A990C46467 for ; Mon, 21 Mar 2022 14:12:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351848AbiCUOMA (ORCPT ); Mon, 21 Mar 2022 10:12:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348870AbiCUODE (ORCPT ); Mon, 21 Mar 2022 10:03:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4958C1704ED; Mon, 21 Mar 2022 06:59:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F320EB816DC; Mon, 21 Mar 2022 13:59:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46605C340F3; Mon, 21 Mar 2022 13:59:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871187; bh=1GkGbp+woQAYIZFvNfmP6jLYMMfHNQio+dIQLZuYlvw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a/E4lSrJ2wndvRZKA4fzdlsOhJg2I56OksCks7q/43RHUqV1UqRvx0LqE3MLB8Sxo DyYsO26jMlzslmO24+mKs4YMqEWzRI69bF1ojkYOPzaWKPkzPC4eYLiCWUimdf8QmZ N5vEthrHjtZNeh/pFXQJPi+yeMJ0VlDxyCrxvks4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martyn Welch , Steve Glendinning , UNGLinuxDriver@microchip.com, "David S. Miller" , Jakub Kicinski , Fabio Estevam , stable@kernel.org Subject: [PATCH 5.10 26/30] net: usb: Correct PHY handling of smsc95xx Date: Mon, 21 Mar 2022 14:52:56 +0100 Message-Id: <20220321133220.401737185@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133219.643490199@linuxfoundation.org> References: <20220321133219.643490199@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: Martyn Welch commit a049a30fc27c1cb2e12889bbdbd463dbf750103a upstream. The smsc95xx driver is dropping phy speed settings and causing a stack trace at device unbind: [ =C2=A0536.379147] smsc95xx 2-1:1.0 eth1: unregister 'smsc95xx' usb-ci_hdr= c.2-1, smsc95xx USB 2.0 Ethernet [ =C2=A0536.425029] ------------[ cut here ]------------ [ =C2=A0536.429650] WARNING: CPU: 0 PID: 439 at fs/kernfs/dir.c:1535 kernfs= _remove_by_name_ns+0xb8/0xc0 [ =C2=A0536.438416] kernfs: can not remove 'attached_dev', no directory [ =C2=A0536.444363] Modules linked in: xts dm_crypt dm_mod atmel_mxt_ts sms= c95xx usbnet [ =C2=A0536.451748] CPU: 0 PID: 439 Comm: sh Tainted: G =C2=A0 =C2=A0 =C2= =A0 =C2=A0W =C2=A0 =C2=A0 =C2=A0 =C2=A0 5.15.0 #1 [ =C2=A0536.458636] Hardware name: Freescale i.MX53 (Device Tree Support) [ =C2=A0536.464735] Backtrace:=C2=A0 [ =C2=A0536.467190] [<80b1c904>] (dump_backtrace) from [<80b1cb48>] (show_s= tack+0x20/0x24) [ =C2=A0536.474787] =C2=A0r7:000005ff r6:8035b294 r5:600f0013 r4:80d8af78 [ =C2=A0536.480449] [<80b1cb28>] (show_stack) from [<80b1f764>] (dump_stack= _lvl+0x48/0x54) [ =C2=A0536.488035] [<80b1f71c>] (dump_stack_lvl) from [<80b1f788>] (dump_s= tack+0x18/0x1c) [ =C2=A0536.495620] =C2=A0r5:00000009 r4:80d9b820 [ =C2=A0536.499198] [<80b1f770>] (dump_stack) from [<80124fac>] (__warn+0xf= c/0x114) [ =C2=A0536.506187] [<80124eb0>] (__warn) from [<80b1d21c>] (warn_slowpath_= fmt+0xa8/0xdc) [ =C2=A0536.513688] =C2=A0r7:000005ff r6:80d9b820 r5:80d9b8e0 r4:83744000 [ =C2=A0536.519349] [<80b1d178>] (warn_slowpath_fmt) from [<8035b294>] (ker= nfs_remove_by_name_ns+0xb8/0xc0) [ =C2=A0536.528416] =C2=A0r9:00000001 r8:00000000 r7:824926dc r6:00000000 r= 5:80df6c2c r4:00000000 [ =C2=A0536.536162] [<8035b1dc>] (kernfs_remove_by_name_ns) from [<80b1f56c= >] (sysfs_remove_link+0x4c/0x50) [ =C2=A0536.545225] =C2=A0r6:7f00f02c r5:80df6c2c r4:83306400 [ =C2=A0536.549845] [<80b1f520>] (sysfs_remove_link) from [<806f9c8c>] (phy= _detach+0xfc/0x11c) [ =C2=A0536.557780] =C2=A0r5:82492000 r4:83306400 [ =C2=A0536.561359] [<806f9b90>] (phy_detach) from [<806f9cf8>] (phy_discon= nect+0x4c/0x58) [ =C2=A0536.568943] =C2=A0r7:824926dc r6:7f00f02c r5:82492580 r4:83306400 [ =C2=A0536.574604] [<806f9cac>] (phy_disconnect) from [<7f00a310>] (smsc95= xx_disconnect_phy+0x30/0x38 [smsc95xx]) [ =C2=A0536.584290] =C2=A0r5:82492580 r4:82492580 [ =C2=A0536.587868] [<7f00a2e0>] (smsc95xx_disconnect_phy [smsc95xx]) from = [<7f001570>] (usbnet_stop+0x70/0x1a0 [usbnet]) [ =C2=A0536.598161] =C2=A0r5:82492580 r4:82492000 [ =C2=A0536.601740] [<7f001500>] (usbnet_stop [usbnet]) from [<808baa70>] (= __dev_close_many+0xb4/0x12c) [ =C2=A0536.610466] =C2=A0r8:83744000 r7:00000000 r6:83744000 r5:83745b74 r= 4:82492000 [ =C2=A0536.617170] [<808ba9bc>] (__dev_close_many) from [<808bab78>] (dev_= close_many+0x90/0x120) [ =C2=A0536.625365] =C2=A0r7:00000001 r6:83745b74 r5:83745b8c r4:82492000 [ =C2=A0536.631026] [<808baae8>] (dev_close_many) from [<808bf408>] (unregi= ster_netdevice_many+0x15c/0x704) [ =C2=A0536.640094] =C2=A0r9:00000001 r8:81130b98 r7:83745b74 r6:83745bc4 r= 5:83745b8c r4:82492000 [ =C2=A0536.647840] [<808bf2ac>] (unregister_netdevice_many) from [<808bfa5= 0>] (unregister_netdevice_queue+0xa0/0xe8) [ =C2=A0536.657775] =C2=A0r10:8112bcc0 r9:83306c00 r8:83306c80 r7:8291e420 = r6:83744000 r5:00000000 [ =C2=A0536.665608] =C2=A0r4:82492000 [ =C2=A0536.668143] [<808bf9b0>] (unregister_netdevice_queue) from [<808bfa= c0>] (unregister_netdev+0x28/0x30) [ =C2=A0536.677381] =C2=A0r6:7f01003c r5:82492000 r4:82492000 [ =C2=A0536.682000] [<808bfa98>] (unregister_netdev) from [<7f000b40>] (usb= net_disconnect+0x64/0xdc [usbnet]) [ =C2=A0536.691241] =C2=A0r5:82492000 r4:82492580 [ =C2=A0536.694819] [<7f000adc>] (usbnet_disconnect [usbnet]) from [<8076b9= 58>] (usb_unbind_interface+0x80/0x248) [ =C2=A0536.704406] =C2=A0r5:7f01003c r4:83306c80 [ =C2=A0536.707984] [<8076b8d8>] (usb_unbind_interface) from [<8061765c>] (= device_release_driver_internal+0x1c4/0x1cc) [ =C2=A0536.718005] =C2=A0r10:8112bcc0 r9:80dff1dc r8:83306c80 r7:83744000 = r6:7f01003c r5:00000000 [ =C2=A0536.725838] =C2=A0r4:8291e420 [ =C2=A0536.728373] [<80617498>] (device_release_driver_internal) from [<80= 617684>] (device_release_driver+0x20/0x24) [ =C2=A0536.738302] =C2=A0r7:83744000 r6:810d4f4c r5:8291e420 r4:8176ae30 [ =C2=A0536.743963] [<80617664>] (device_release_driver) from [<806156cc>] = (bus_remove_device+0xf0/0x148) [ =C2=A0536.752858] [<806155dc>] (bus_remove_device) from [<80610018>] (dev= ice_del+0x198/0x41c) [ =C2=A0536.760880] =C2=A0r7:83744000 r6:8116e2e4 r5:8291e464 r4:8291e420 [ =C2=A0536.766542] [<8060fe80>] (device_del) from [<80768fe8>] (usb_disabl= e_device+0xcc/0x1e0) [ =C2=A0536.774576] =C2=A0r10:8112bcc0 r9:80dff1dc r8:00000001 r7:8112bc48 = r6:8291e400 r5:00000001 [ =C2=A0536.782410] =C2=A0r4:83306c00 [ =C2=A0536.784945] [<80768f1c>] (usb_disable_device) from [<80769c30>] (us= b_set_configuration+0x514/0x8dc) [ =C2=A0536.794011] =C2=A0r10:00000000 r9:00000000 r8:832c3600 r7:00000004 = r6:810d5688 r5:00000000 [ =C2=A0536.801844] =C2=A0r4:83306c00 [ =C2=A0536.804379] [<8076971c>] (usb_set_configuration) from [<80775fac>] = (usb_generic_driver_disconnect+0x34/0x38) [ =C2=A0536.814236] =C2=A0r10:832c3610 r9:83745ef8 r8:832c3600 r7:00000004 = r6:810d5688 r5:83306c00 [ =C2=A0536.822069] =C2=A0r4:83306c00 [ =C2=A0536.824605] [<80775f78>] (usb_generic_driver_disconnect) from [<807= 6b850>] (usb_unbind_device+0x30/0x70) [ =C2=A0536.834100] =C2=A0r5:83306c00 r4:810d5688 [ =C2=A0536.837678] [<8076b820>] (usb_unbind_device) from [<8061765c>] (dev= ice_release_driver_internal+0x1c4/0x1cc) [ =C2=A0536.847432] =C2=A0r5:822fb480 r4:83306c80 [ =C2=A0536.851009] [<80617498>] (device_release_driver_internal) from [<80= 6176a8>] (device_driver_detach+0x20/0x24) [ =C2=A0536.860853] =C2=A0r7:00000004 r6:810d4f4c r5:810d5688 r4:83306c80 [ =C2=A0536.866515] [<80617688>] (device_driver_detach) from [<80614d98>] (= unbind_store+0x70/0xe4) [ =C2=A0536.874793] [<80614d28>] (unbind_store) from [<80614118>] (drv_attr= _store+0x30/0x3c) [ =C2=A0536.882554] =C2=A0r7:00000000 r6:00000000 r5:83739200 r4:80614d28 [ =C2=A0536.888217] [<806140e8>] (drv_attr_store) from [<8035cb68>] (sysfs_= kf_write+0x48/0x54) [ =C2=A0536.896154] =C2=A0r5:83739200 r4:806140e8 [ =C2=A0536.899732] [<8035cb20>] (sysfs_kf_write) from [<8035be84>] (kernfs= _fop_write_iter+0x11c/0x1d4) [ =C2=A0536.908446] =C2=A0r5:83739200 r4:00000004 [ =C2=A0536.912024] [<8035bd68>] (kernfs_fop_write_iter) from [<802b87fc>] = (vfs_write+0x258/0x3e4) [ =C2=A0536.920317] =C2=A0r10:00000000 r9:83745f58 r8:83744000 r7:00000000 = r6:00000004 r5:00000000 [ =C2=A0536.928151] =C2=A0r4:82adacc0 [ =C2=A0536.930687] [<802b85a4>] (vfs_write) from [<802b8b0c>] (ksys_write+= 0x74/0xf4) [ =C2=A0536.937842] =C2=A0r10:00000004 r9:007767a0 r8:83744000 r7:00000000 = r6:00000000 r5:82adacc0 [ =C2=A0536.945676] =C2=A0r4:82adacc0 [ =C2=A0536.948213] [<802b8a98>] (ksys_write) from [<802b8ba4>] (sys_write+= 0x18/0x1c) [ =C2=A0536.955367] =C2=A0r10:00000004 r9:83744000 r8:80100244 r7:00000004 = r6:76f47b58 r5:76fc0350 [ =C2=A0536.963200] =C2=A0r4:00000004 [ =C2=A0536.965735] [<802b8b8c>] (sys_write) from [<80100060>] (ret_fast_sy= scall+0x0/0x48) [ =C2=A0536.973320] Exception stack(0x83745fa8 to 0x83745ff0) [ =C2=A0536.978383] 5fa0: =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 00000004 76fc0350 00000001 007767a0 00000004 00000000 [ =C2=A0536.986569] 5fc0: 00000004 76fc0350 76f47b58 00000004 76f47c7c 76f4= 8114 00000000 7e87991c [ =C2=A0536.994753] 5fe0: 00000498 7e879908 76e6dce8 76eca2e8 [ =C2=A0536.999922] ---[ end trace 9b835d809816b435 ]--- The driver should not be connecting and disconnecting the PHY when the device is opened and closed, it should be stopping and starting the PHY. The phy should be connected as part of binding and disconnected during unbinding. As this results in the PHY not being reset during open, link speed, etc. settings set prior to the link coming up are now not being lost. It is necessary for phy_stop() to only be called when the phydev still exists (resolving the above stack trace). When unbinding, ".unbind" will be called prior to ".stop", with phy_disconnect() already having called phy_stop() before the phydev becomes inaccessible. Signed-off-by: Martyn Welch Cc: Steve Glendinning Cc: UNGLinuxDriver@microchip.com Cc: "David S. Miller" Cc: Jakub Kicinski Cc: stable@kernel.org # v5.15 Signed-off-by: David S. Miller Cc: Fabio Estevam Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/usb/smsc95xx.c | 55 +++++++++++++++++++++-------------------= ----- 1 file changed, 26 insertions(+), 29 deletions(-) --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c @@ -1049,6 +1049,14 @@ static const struct net_device_ops smsc9 .ndo_set_features =3D smsc95xx_set_features, }; =20 +static void smsc95xx_handle_link_change(struct net_device *net) +{ + struct usbnet *dev =3D netdev_priv(net); + + phy_print_status(net->phydev); + usbnet_defer_kevent(dev, EVENT_LINK_CHANGE); +} + static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf) { struct smsc95xx_priv *pdata; @@ -1153,6 +1161,17 @@ static int smsc95xx_bind(struct usbnet * dev->net->min_mtu =3D ETH_MIN_MTU; dev->net->max_mtu =3D ETH_DATA_LEN; dev->hard_mtu =3D dev->net->mtu + dev->net->hard_header_len; + + ret =3D phy_connect_direct(dev->net, pdata->phydev, + &smsc95xx_handle_link_change, + PHY_INTERFACE_MODE_MII); + if (ret) { + netdev_err(dev->net, "can't attach PHY to %s\n", pdata->mdiobus->id); + goto unregister_mdio; + } + + phy_attached_info(dev->net->phydev); + return 0; =20 unregister_mdio: @@ -1170,47 +1189,25 @@ static void smsc95xx_unbind(struct usbne { struct smsc95xx_priv *pdata =3D dev->driver_priv; =20 + phy_disconnect(dev->net->phydev); mdiobus_unregister(pdata->mdiobus); mdiobus_free(pdata->mdiobus); netif_dbg(dev, ifdown, dev->net, "free pdata\n"); kfree(pdata); } =20 -static void smsc95xx_handle_link_change(struct net_device *net) -{ - struct usbnet *dev =3D netdev_priv(net); - - phy_print_status(net->phydev); - usbnet_defer_kevent(dev, EVENT_LINK_CHANGE); -} - static int smsc95xx_start_phy(struct usbnet *dev) { - struct smsc95xx_priv *pdata =3D dev->driver_priv; - struct net_device *net =3D dev->net; - int ret; + phy_start(dev->net->phydev); =20 - ret =3D smsc95xx_reset(dev); - if (ret < 0) - return ret; - - ret =3D phy_connect_direct(net, pdata->phydev, - &smsc95xx_handle_link_change, - PHY_INTERFACE_MODE_MII); - if (ret) { - netdev_err(net, "can't attach PHY to %s\n", pdata->mdiobus->id); - return ret; - } - - phy_attached_info(net->phydev); - phy_start(net->phydev); return 0; } =20 -static int smsc95xx_disconnect_phy(struct usbnet *dev) +static int smsc95xx_stop(struct usbnet *dev) { - phy_stop(dev->net->phydev); - phy_disconnect(dev->net->phydev); + if (dev->net->phydev) + phy_stop(dev->net->phydev); + return 0; } =20 @@ -1965,7 +1962,7 @@ static const struct driver_info smsc95xx .unbind =3D smsc95xx_unbind, .link_reset =3D smsc95xx_link_reset, .reset =3D smsc95xx_start_phy, - .stop =3D smsc95xx_disconnect_phy, + .stop =3D smsc95xx_stop, .rx_fixup =3D smsc95xx_rx_fixup, .tx_fixup =3D smsc95xx_tx_fixup, .status =3D smsc95xx_status, From nobody Mon Jun 22 15:38:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BFE81C433EF for ; Mon, 21 Mar 2022 14:11:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350081AbiCUOJU (ORCPT ); Mon, 21 Mar 2022 10:09:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349005AbiCUODO (ORCPT ); Mon, 21 Mar 2022 10:03:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 806C840A12; Mon, 21 Mar 2022 07:00:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C61B4B816D7; Mon, 21 Mar 2022 13:59:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2CFB7C340E8; Mon, 21 Mar 2022 13:59:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871190; bh=VyqiZa+McEGjcbbsPS6zcIHRdgCkZADjXTnVD631GgM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LhTJSF763UyG5N3jxHUDPy+yvJaPUBftO02ZcR6PDj6XfzKfxo+dratpm9gOE5Z0q yp6urCEu7H1UxvH0dCRXr6xvyK8KBySV20YZl0gcJ0BK9eXygEKUV2RQstIhrGc6vz Dr8xDw8bFw9ouwuCPHKFHPNpB08UPcjeLE6V3esY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gabriel Hojda , Markus Reichl , Alexander Stein , "David S. Miller" , Fabio Estevam Subject: [PATCH 5.10 27/30] net: usb: Correct reset handling of smsc95xx Date: Mon, 21 Mar 2022 14:52:57 +0100 Message-Id: <20220321133220.431816122@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133219.643490199@linuxfoundation.org> References: <20220321133219.643490199@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Markus Reichl commit 0bf3885324a8599e3af4c7379b8d4f621c9bbffa upstream. On boards with LAN9514 and no preconfigured MAC address we don't get an ip address from DHCP after commit a049a30fc27c ("net: usb: Correct PHY hand= ling of smsc95xx") anymore. Adding an explicit reset before starting the phy fixes the issue. [1] https://lore.kernel.org/netdev/199eebbd6b97f52b9119c9fa4fd8504f8a34de18.cam= el@collabora.com/ From: Gabriel Hojda Fixes: a049a30fc27c ("net: usb: Correct PHY handling of smsc95xx") Signed-off-by: Gabriel Hojda Signed-off-by: Markus Reichl Tested-by: Alexander Stein Signed-off-by: David S. Miller Cc: Fabio Estevam Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/usb/smsc95xx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c @@ -1961,7 +1961,8 @@ static const struct driver_info smsc95xx .bind =3D smsc95xx_bind, .unbind =3D smsc95xx_unbind, .link_reset =3D smsc95xx_link_reset, - .reset =3D smsc95xx_start_phy, + .reset =3D smsc95xx_reset, + .check_connect =3D smsc95xx_start_phy, .stop =3D smsc95xx_stop, .rx_fixup =3D smsc95xx_rx_fixup, .tx_fixup =3D smsc95xx_tx_fixup, From nobody Mon Jun 22 15:38:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A004C4707A for ; Mon, 21 Mar 2022 14:11:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349929AbiCUOJF (ORCPT ); Mon, 21 Mar 2022 10:09:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348900AbiCUODI (ORCPT ); Mon, 21 Mar 2022 10:03:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 925363E5D5; Mon, 21 Mar 2022 06:59:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B0826B816E1; Mon, 21 Mar 2022 13:59:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 010FDC36AE2; Mon, 21 Mar 2022 13:59:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871193; bh=tSiYwyvm2o3VzobvOPnZ0wLmRBeQ9/MJTudx/KFTPdE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xNILd0gmiWc+zXiEJ8YeKfBidVSY4Dw6oBV8yqXwc4ZzBoGdhYwEdJP7ptPw4PEF1 jowDOfmLoakdhJRFfiVz0IxRTwmuMHn0Y30/1xyP+9UibedsEFbDisAYZOdKLXXeiF HtoZQPVSMwGDy/vGqvyrog2wS/B4B3Ei8XIInnPM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Fabio Estevam , "David S. Miller" , Fabio Estevam Subject: [PATCH 5.10 28/30] smsc95xx: Ignore -ENODEV errors when device is unplugged Date: Mon, 21 Mar 2022 14:52:58 +0100 Message-Id: <20220321133220.461577191@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133219.643490199@linuxfoundation.org> References: <20220321133219.643490199@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 c70c453abcbf3ecbaadd4c3236a5119b8da365cf upstream. According to Documentation/driver-api/usb/URB.rst when a device is unplugged usb_submit_urb() returns -ENODEV. This error code propagates all the way up to usbnet_read_cmd() and usbnet_write_cmd() calls inside the smsc95xx.c driver during Ethernet cable unplug, unbind or reboot. This causes the following errors to be shown on reboot, for example: ci_hdrc ci_hdrc.1: remove, state 1 usb usb2: USB disconnect, device number 1 usb 2-1: USB disconnect, device number 2 usb 2-1.1: USB disconnect, device number 3 smsc95xx 2-1.1:1.0 eth1: unregister 'smsc95xx' usb-ci_hdrc.1-1.1, smsc95xx = USB 2.0 Ethernet smsc95xx 2-1.1:1.0 eth1: Failed to read reg index 0x00000114: -19 smsc95xx 2-1.1:1.0 eth1: Error reading MII_ACCESS smsc95xx 2-1.1:1.0 eth1: __smsc95xx_mdio_read: MII is busy smsc95xx 2-1.1:1.0 eth1: Failed to read reg index 0x00000114: -19 smsc95xx 2-1.1:1.0 eth1: Error reading MII_ACCESS smsc95xx 2-1.1:1.0 eth1: __smsc95xx_mdio_read: MII is busy smsc95xx 2-1.1:1.0 eth1: hardware isn't capable of remote wakeup usb 2-1.4: USB disconnect, device number 4 ci_hdrc ci_hdrc.1: USB bus 2 deregistered ci_hdrc ci_hdrc.0: remove, state 4 usb usb1: USB disconnect, device number 1 ci_hdrc ci_hdrc.0: USB bus 1 deregistered imx2-wdt 30280000.watchdog: Device shutdown: Expect reboot! reboot: Restarting system Ignore the -ENODEV errors inside __smsc95xx_mdio_read() and __smsc95xx_phy_wait_not_busy() and do not print error messages when -ENODEV is returned. Fixes: a049a30fc27c ("net: usb: Correct PHY handling of smsc95xx") Signed-off-by: Fabio Estevam Signed-off-by: David S. Miller Cc: Fabio Estevam Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- drivers/net/usb/smsc95xx.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c @@ -84,9 +84,10 @@ static int __must_check __smsc95xx_read_ ret =3D fn(dev, USB_VENDOR_REQUEST_READ_REGISTER, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0, index, &buf, 4); - if (unlikely(ret < 0)) { - netdev_warn(dev->net, "Failed to read reg index 0x%08x: %d\n", - index, ret); + if (ret < 0) { + if (ret !=3D -ENODEV) + netdev_warn(dev->net, "Failed to read reg index 0x%08x: %d\n", + index, ret); return ret; } =20 @@ -116,7 +117,7 @@ static int __must_check __smsc95xx_write ret =3D fn(dev, USB_VENDOR_REQUEST_WRITE_REGISTER, USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 0, index, &buf, 4); - if (unlikely(ret < 0)) + if (ret < 0 && ret !=3D -ENODEV) netdev_warn(dev->net, "Failed to write reg index 0x%08x: %d\n", index, ret); =20 @@ -159,6 +160,9 @@ static int __must_check __smsc95xx_phy_w do { ret =3D __smsc95xx_read_reg(dev, MII_ADDR, &val, in_pm); if (ret < 0) { + /* Ignore -ENODEV error during disconnect() */ + if (ret =3D=3D -ENODEV) + return 0; netdev_warn(dev->net, "Error reading MII_ACCESS\n"); return ret; } @@ -194,7 +198,8 @@ static int __smsc95xx_mdio_read(struct u addr =3D mii_address_cmd(phy_id, idx, MII_READ_ | MII_BUSY_); ret =3D __smsc95xx_write_reg(dev, MII_ADDR, addr, in_pm); if (ret < 0) { - netdev_warn(dev->net, "Error writing MII_ADDR\n"); + if (ret !=3D -ENODEV) + netdev_warn(dev->net, "Error writing MII_ADDR\n"); goto done; } =20 @@ -206,7 +211,8 @@ static int __smsc95xx_mdio_read(struct u =20 ret =3D __smsc95xx_read_reg(dev, MII_DATA, &val, in_pm); if (ret < 0) { - netdev_warn(dev->net, "Error reading MII_DATA\n"); + if (ret !=3D -ENODEV) + netdev_warn(dev->net, "Error reading MII_DATA\n"); goto done; } =20 @@ -214,6 +220,10 @@ static int __smsc95xx_mdio_read(struct u =20 done: mutex_unlock(&dev->phy_mutex); + + /* Ignore -ENODEV error during disconnect() */ + if (ret =3D=3D -ENODEV) + return 0; return ret; } =20 @@ -235,7 +245,8 @@ static void __smsc95xx_mdio_write(struct val =3D regval; ret =3D __smsc95xx_write_reg(dev, MII_DATA, val, in_pm); if (ret < 0) { - netdev_warn(dev->net, "Error writing MII_DATA\n"); + if (ret !=3D -ENODEV) + netdev_warn(dev->net, "Error writing MII_DATA\n"); goto done; } =20 @@ -243,7 +254,8 @@ static void __smsc95xx_mdio_write(struct addr =3D mii_address_cmd(phy_id, idx, MII_WRITE_ | MII_BUSY_); ret =3D __smsc95xx_write_reg(dev, MII_ADDR, addr, in_pm); if (ret < 0) { - netdev_warn(dev->net, "Error writing MII_ADDR\n"); + if (ret !=3D -ENODEV) + netdev_warn(dev->net, "Error writing MII_ADDR\n"); goto done; } From nobody Mon Jun 22 15:38:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1AF6C4167B for ; Mon, 21 Mar 2022 14:12:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351759AbiCUOLm (ORCPT ); Mon, 21 Mar 2022 10:11:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348565AbiCUOCj (ORCPT ); Mon, 21 Mar 2022 10:02:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7F5CA27D3; Mon, 21 Mar 2022 06:59:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B386B61325; Mon, 21 Mar 2022 13:59:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9938C340ED; Mon, 21 Mar 2022 13:59:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871168; bh=WbAXIMIpSRb7OSyInJWIlEk1e63sTaThqozBnDrl2dY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u02wL1SW39FzXRYbI6Wr4VNYBTOOjMJFXrUt23gT3ZDI3RVepUxUI0zW1Vxq2u+Lm u9fiQmv0GVCry/THldhali7hCktgIj+LbIgy1fxP66cCfjMSu2/Wdy8BQCGxo61Zv4 nr47/p4qZH5xVxu65ls4I8Ud48tMpB8Qezomftx0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, valis , Steffen Klassert , Tadeusz Struk Subject: [PATCH 5.10 29/30] esp: Fix possible buffer overflow in ESP transformation Date: Mon, 21 Mar 2022 14:52:59 +0100 Message-Id: <20220321133220.490047170@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133219.643490199@linuxfoundation.org> References: <20220321133219.643490199@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Steffen Klassert commit ebe48d368e97d007bfeb76fcb065d6cfc4c96645 upstream. The maximum message size that can be send is bigger than the maximum site that skb_page_frag_refill can allocate. So it is possible to write beyond the allocated buffer. Fix this by doing a fallback to COW in that case. v2: Avoid get get_order() costs as suggested by Linus Torvalds. Fixes: cac2661c53f3 ("esp4: Avoid skb_cow_data whenever possible") Fixes: 03e2a30f6a27 ("esp6: Avoid skb_cow_data whenever possible") Reported-by: valis Signed-off-by: Steffen Klassert Signed-off-by: Tadeusz Struk Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- include/net/esp.h | 2 ++ include/net/sock.h | 1 + net/ipv4/esp4.c | 5 +++++ net/ipv6/esp6.c | 5 +++++ 4 files changed, 13 insertions(+) --- a/include/net/esp.h +++ b/include/net/esp.h @@ -4,6 +4,8 @@ =20 #include =20 +#define ESP_SKB_FRAG_MAXSIZE (PAGE_SIZE << SKB_FRAG_PAGE_ORDER) + struct ip_esp_hdr; =20 static inline struct ip_esp_hdr *ip_esp_hdr(const struct sk_buff *skb) --- a/include/net/sock.h +++ b/include/net/sock.h @@ -2670,6 +2670,7 @@ extern int sysctl_optmem_max; extern __u32 sysctl_wmem_default; extern __u32 sysctl_rmem_default; =20 +#define SKB_FRAG_PAGE_ORDER get_order(32768) DECLARE_STATIC_KEY_FALSE(net_high_order_alloc_disable_key); =20 static inline int sk_get_wmem0(const struct sock *sk, const struct proto *= proto) --- a/net/ipv4/esp4.c +++ b/net/ipv4/esp4.c @@ -448,6 +448,7 @@ int esp_output_head(struct xfrm_state *x struct page *page; struct sk_buff *trailer; int tailen =3D esp->tailen; + unsigned int allocsz; =20 /* this is non-NULL only with TCP/UDP Encapsulation */ if (x->encap) { @@ -457,6 +458,10 @@ int esp_output_head(struct xfrm_state *x return err; } =20 + allocsz =3D ALIGN(skb->data_len + tailen, L1_CACHE_BYTES); + if (allocsz > ESP_SKB_FRAG_MAXSIZE) + goto cow; + if (!skb_cloned(skb)) { if (tailen <=3D skb_tailroom(skb)) { nfrags =3D 1; --- a/net/ipv6/esp6.c +++ b/net/ipv6/esp6.c @@ -483,6 +483,7 @@ int esp6_output_head(struct xfrm_state * struct page *page; struct sk_buff *trailer; int tailen =3D esp->tailen; + unsigned int allocsz; =20 if (x->encap) { int err =3D esp6_output_encap(x, skb, esp); @@ -491,6 +492,10 @@ int esp6_output_head(struct xfrm_state * return err; } =20 + allocsz =3D ALIGN(skb->data_len + tailen, L1_CACHE_BYTES); + if (allocsz > ESP_SKB_FRAG_MAXSIZE) + goto cow; + if (!skb_cloned(skb)) { if (tailen <=3D skb_tailroom(skb)) { nfrags =3D 1; From nobody Mon Jun 22 15:38:40 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2D61C4167D for ; Mon, 21 Mar 2022 14:12:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351745AbiCUOLj (ORCPT ); Mon, 21 Mar 2022 10:11:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348758AbiCUOCk (ORCPT ); Mon, 21 Mar 2022 10:02:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F27E4B1A8A; Mon, 21 Mar 2022 06:59:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8B2616126A; Mon, 21 Mar 2022 13:59:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92C63C36AE9; Mon, 21 Mar 2022 13:59:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647871171; bh=61xg3ooRqbjaYkRAfa/nCUQGRnjsqDJWwrdBHMkMXOU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RRVshK95ALqJw3rXsbIDExvfT3nac1epcSQfkFpBdAwtkyaSitSJOniU3uc2FgbeY 2PYgUHfHLkoCZZz7YouOmfBG4/NqscvTxkFTtSOvkX4eLd+Fq1J8e9kKa71JkpZ3uI WM8HjMCv/TpkuDfGFc7JmjFMtENDUjfGoRZdlOpA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Geliang Tang , Tommi Rantala , Kumar Kartikeya Dwivedi , Alexei Starovoitov , Sasha Levin Subject: [PATCH 5.10 30/30] Revert "selftests/bpf: Add test for bpf_timer overwriting crash" Date: Mon, 21 Mar 2022 14:53:00 +0100 Message-Id: <20220321133220.519251852@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220321133219.643490199@linuxfoundation.org> References: <20220321133219.643490199@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 This reverts commit 4fb9be675be8360bede6fb8f0cad7948393fbef8 which is commit a7e75016a0753c24d6c995bc02501ae35368e333 upstream. It is reported to break the bpf self-tests. Reported-by: Geliang Tang Reported-by: Tommi Rantala Cc: Kumar Kartikeya Dwivedi Cc: Alexei Starovoitov Link: https://lore.kernel.org/bpf/20220209070324.1093182-3-memxor@gmail.com Cc: Sasha Levin Link: https://lore.kernel.org/r/a0a7298ca5c64b3d0ecfcc8821c2de79186fa9f7.ca= mel@nokia.com Link: https://lore.kernel.org/r/HE1PR0402MB3497CB13A12C4D15D20A1FCCF8139@HE= 1PR0402MB3497.eurprd04.prod.outlook.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Sudip Mukherjee --- tools/testing/selftests/bpf/prog_tests/timer_crash.c | 32 ----------- tools/testing/selftests/bpf/progs/timer_crash.c | 54 --------------= ----- 2 files changed, 86 deletions(-) delete mode 100644 tools/testing/selftests/bpf/prog_tests/timer_crash.c delete mode 100644 tools/testing/selftests/bpf/progs/timer_crash.c --- a/tools/testing/selftests/bpf/prog_tests/timer_crash.c +++ /dev/null @@ -1,32 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include -#include "timer_crash.skel.h" - -enum { - MODE_ARRAY, - MODE_HASH, -}; - -static void test_timer_crash_mode(int mode) -{ - struct timer_crash *skel; - - skel =3D timer_crash__open_and_load(); - if (!ASSERT_OK_PTR(skel, "timer_crash__open_and_load")) - return; - skel->bss->pid =3D getpid(); - skel->bss->crash_map =3D mode; - if (!ASSERT_OK(timer_crash__attach(skel), "timer_crash__attach")) - goto end; - usleep(1); -end: - timer_crash__destroy(skel); -} - -void test_timer_crash(void) -{ - if (test__start_subtest("array")) - test_timer_crash_mode(MODE_ARRAY); - if (test__start_subtest("hash")) - test_timer_crash_mode(MODE_HASH); -} --- a/tools/testing/selftests/bpf/progs/timer_crash.c +++ /dev/null @@ -1,54 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 - -#include -#include -#include - -struct map_elem { - struct bpf_timer timer; - struct bpf_spin_lock lock; -}; - -struct { - __uint(type, BPF_MAP_TYPE_ARRAY); - __uint(max_entries, 1); - __type(key, int); - __type(value, struct map_elem); -} amap SEC(".maps"); - -struct { - __uint(type, BPF_MAP_TYPE_HASH); - __uint(max_entries, 1); - __type(key, int); - __type(value, struct map_elem); -} hmap SEC(".maps"); - -int pid =3D 0; -int crash_map =3D 0; /* 0 for amap, 1 for hmap */ - -SEC("fentry/do_nanosleep") -int sys_enter(void *ctx) -{ - struct map_elem *e, value =3D {}; - void *map =3D crash_map ? (void *)&hmap : (void *)&amap; - - if (bpf_get_current_task_btf()->tgid !=3D pid) - return 0; - - *(void **)&value =3D (void *)0xdeadcaf3; - - bpf_map_update_elem(map, &(int){0}, &value, 0); - /* For array map, doing bpf_map_update_elem will do a - * check_and_free_timer_in_array, which will trigger the crash if timer - * pointer was overwritten, for hmap we need to use bpf_timer_cancel. - */ - if (crash_map =3D=3D 1) { - e =3D bpf_map_lookup_elem(map, &(int){0}); - if (!e) - return 0; - bpf_timer_cancel(&e->timer); - } - return 0; -} - -char _license[] SEC("license") =3D "GPL";