From nobody Tue Jun 23 11:09:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0089AC433F5 for ; Mon, 7 Mar 2022 09:19:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234690AbiCGJUI (ORCPT ); Mon, 7 Mar 2022 04:20:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48294 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233897AbiCGJUE (ORCPT ); Mon, 7 Mar 2022 04:20:04 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8514C3BBF6; Mon, 7 Mar 2022 01:19:09 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2E309B810B9; Mon, 7 Mar 2022 09:19:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FA5AC340F4; Mon, 7 Mar 2022 09:19:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644746; bh=jo6f6GFQYpBh1S1JZ2qS9JxUOqZLb8zQ5UToys65nZk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XhdqK8a+BC0ruZD+qVShjvc6fc9OywMocm4gOxbvh01YVpV6HxGrCtDpB9h8kuj34 n9QT9lSypNK9hFxIarNRZxoJa2eJXUxk+TGX9rABU2/vv4Y1UhWqYt0OVeYm7wp9hj yAolHXAUS4U6e9HyorhPRL4EjuKLPVmHcM4rYc68= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benjamin Beichler , Johannes Berg , Sasha Levin Subject: [PATCH 4.9 01/32] mac80211_hwsim: report NOACK frames in tx_status Date: Mon, 7 Mar 2022 10:18:27 +0100 Message-Id: <20220307091634.478526029@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091634.434478485@linuxfoundation.org> References: <20220307091634.434478485@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Benjamin Beichler [ Upstream commit 42a79960ffa50bfe9e0bf5d6280be89bf563a5dd ] Add IEEE80211_TX_STAT_NOACK_TRANSMITTED to tx_status flags to have proper statistics for non-acked frames. Signed-off-by: Benjamin Beichler Link: https://lore.kernel.org/r/20220111221327.1499881-1-benjamin.beichler@= uni-rostock.de Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/mac80211_hwsim.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/m= ac80211_hwsim.c index dd6924d21b8a1..a965ce9261d3a 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -2919,6 +2919,10 @@ static int hwsim_tx_info_frame_received_nl(struct sk= _buff *skb_2, } txi->flags |=3D IEEE80211_TX_STAT_ACK; } + + if (hwsim_flags & HWSIM_TX_CTL_NO_ACK) + txi->flags |=3D IEEE80211_TX_STAT_NOACK_TRANSMITTED; + ieee80211_tx_status_irqsafe(data2->hw, skb); return 0; out: --=20 2.34.1 From nobody Tue Jun 23 11:09:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CC0EC433F5 for ; Mon, 7 Mar 2022 09:20:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236550AbiCGJVS (ORCPT ); Mon, 7 Mar 2022 04:21:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236381AbiCGJUs (ORCPT ); Mon, 7 Mar 2022 04:20:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D6F3517F4; Mon, 7 Mar 2022 01:19:41 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CBF2B6103D; Mon, 7 Mar 2022 09:19:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9811C340F6; Mon, 7 Mar 2022 09:19:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644780; bh=ajqEBc+WHQgS/A0sHKtldUjwemPzGFKvKtzhAy1csHE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JdJA5dbC7qBdCBLoUwwdnNK/SeQPEumr8omZRFCe+HPbSJuGBskWlBc//H8bmoaw4 Wy3vv75WVyuLlOqAAomdX2nfLiM18GWguPGDczrz2odwOMaEch7cBZ6eM1vWXist3a BzLdNHO3rTUAgoEs3rpChCGahyxJQDccWNQT8Sic= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, JaeMan Park , Johannes Berg , Sasha Levin Subject: [PATCH 4.9 02/32] mac80211_hwsim: initialize ieee80211_tx_info at hw_scan_work Date: Mon, 7 Mar 2022 10:18:28 +0100 Message-Id: <20220307091634.506680595@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091634.434478485@linuxfoundation.org> References: <20220307091634.434478485@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: JaeMan Park [ Upstream commit cacfddf82baf1470e5741edeecb187260868f195 ] In mac80211_hwsim, the probe_req frame is created and sent while scanning. It is sent with ieee80211_tx_info which is not initialized. Uninitialized ieee80211_tx_info can cause problems when using mac80211_hwsim with wmediumd. wmediumd checks the tx_rates field of ieee80211_tx_info and doesn't relay probe_req frame to other clients even if it is a broadcasting message. Call ieee80211_tx_prepare_skb() to initialize ieee80211_tx_info for the probe_req that is created by hw_scan_work in mac80211_hwsim. Signed-off-by: JaeMan Park Link: https://lore.kernel.org/r/20220113060235.546107-1-jaeman@google.com [fix memory leak] Signed-off-by: Johannes Berg Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/wireless/mac80211_hwsim.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/m= ac80211_hwsim.c index a965ce9261d3a..a34647efb5ea5 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c @@ -1987,6 +1987,15 @@ static void hw_scan_work(struct work_struct *work) memcpy(skb_put(probe, req->ie_len), req->ie, req->ie_len); =20 + if (!ieee80211_tx_prepare_skb(hwsim->hw, + hwsim->hw_scan_vif, + probe, + hwsim->tmp_chan->band, + NULL)) { + kfree_skb(probe); + continue; + } + local_bh_disable(); mac80211_hwsim_tx_frame(hwsim->hw, probe, hwsim->tmp_chan); --=20 2.34.1 From nobody Tue Jun 23 11:09:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EE93C433FE for ; Mon, 7 Mar 2022 09:21:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235940AbiCGJWW (ORCPT ); Mon, 7 Mar 2022 04:22:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236615AbiCGJVq (ORCPT ); Mon, 7 Mar 2022 04:21:46 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B02265831; Mon, 7 Mar 2022 01:20:20 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D159E6103D; Mon, 7 Mar 2022 09:20:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C064EC340F3; Mon, 7 Mar 2022 09:20:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644819; bh=0J4jcFKw6gaKR0MPzB8D3qoZdK16pSHJvlNpqL7WFAE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mmxh1ZaXtS1Lzy8ZhMTd3Yd4m6+ueo3CBOLMzP2ugjuG1pLSWiSvvy/H5AAyxIjwO 9Oa+girRJxZWKyG4p2JMHWI0WAE8nTPoVSE6CpppNnUkx4b7mMB8j4XeVqSBwcVWFi xOXt3c+P9mbjqgvyOpCsyPYvpzbWGmNgHpqPSgHY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Anholt , Stefan Wahren , Wolfram Sang , Sasha Levin Subject: [PATCH 4.9 03/32] i2c: bcm2835: Avoid clock stretching timeouts Date: Mon, 7 Mar 2022 10:18:29 +0100 Message-Id: <20220307091634.536040265@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091634.434478485@linuxfoundation.org> References: <20220307091634.434478485@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Anholt [ Upstream commit 9495b9b31abe525ebd93da58de2c88b9f66d3a0e ] The CLKT register contains at poweron 0x40, which at our typical 100kHz bus rate means .64ms. But there is no specified limit to how long devices should be able to stretch the clocks, so just disable the timeout. We still have a timeout wrapping the entire transfer. Signed-off-by: Eric Anholt Signed-off-by: Stefan Wahren BugLink: https://github.com/raspberrypi/linux/issues/3064 Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/i2c/busses/i2c-bcm2835.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2= 835.c index 7ed09865cb4b9..4729c14b75017 100644 --- a/drivers/i2c/busses/i2c-bcm2835.c +++ b/drivers/i2c/busses/i2c-bcm2835.c @@ -28,6 +28,11 @@ #define BCM2835_I2C_FIFO 0x10 #define BCM2835_I2C_DIV 0x14 #define BCM2835_I2C_DEL 0x18 +/* + * 16-bit field for the number of SCL cycles to wait after rising SCL + * before deciding the slave is not responding. 0 disables the + * timeout detection. + */ #define BCM2835_I2C_CLKT 0x1c =20 #define BCM2835_I2C_C_READ BIT(0) @@ -313,6 +318,12 @@ static int bcm2835_i2c_probe(struct platform_device *p= dev) adap->dev.of_node =3D pdev->dev.of_node; adap->quirks =3D &bcm2835_i2c_quirks; =20 + /* + * Disable the hardware clock stretching timeout. SMBUS + * specifies a limit for how long the device can stretch the + * clock, but core I2C doesn't. + */ + bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_CLKT, 0); bcm2835_i2c_writel(i2c_dev, BCM2835_I2C_C, 0); =20 ret =3D i2c_add_adapter(adap); --=20 2.34.1 From nobody Tue Jun 23 11:09:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C74E4C433FE for ; Mon, 7 Mar 2022 09:21:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232774AbiCGJWn (ORCPT ); Mon, 7 Mar 2022 04:22:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236606AbiCGJWS (ORCPT ); Mon, 7 Mar 2022 04:22:18 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28782522E0; Mon, 7 Mar 2022 01:20:33 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B556061033; Mon, 7 Mar 2022 09:20:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 91034C340F7; Mon, 7 Mar 2022 09:20:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644832; bh=+6XjYk4EJwm/J+lyiGtf8jIrpFJkTC+MKtWsP5gwjrc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SqxX67VQNNlmHXYhhA6pfgp5mUOrKNG3582u7kS1uJ8kAAkqyXIzZM6RxyHz4XKsD Wf76hPP9GhRHo8WH8YUlR1cBKlL6Gp1MkPb2F4ZNCYjAEzhiobClALxwHnXkK5gZr/ YWOjaURcT6g/lv3wICctKtGT3CZnDJXCkcVfGLMI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Hutterer , Benjamin Tissoires , Jiri Kosina , =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= , Dmitry Torokhov , Sasha Levin Subject: [PATCH 4.9 04/32] Input: clear BTN_RIGHT/MIDDLE on buttonpads Date: Mon, 7 Mar 2022 10:18:30 +0100 Message-Id: <20220307091634.566777307@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091634.434478485@linuxfoundation.org> References: <20220307091634.434478485@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: Jos=C3=A9 Exp=C3=B3sito [ Upstream commit 37ef4c19b4c659926ce65a7ac709ceaefb211c40 ] Buttonpads are expected to map the INPUT_PROP_BUTTONPAD property bit and the BTN_LEFT key bit. As explained in the specification, where a device has a button type value of 0 (click-pad) or 1 (pressure-pad) there should not be discrete buttons: https://docs.microsoft.com/en-us/windows-hardware/design/component-guidelin= es/touchpad-windows-precision-touchpad-collection#device-capabilities-featu= re-report However, some drivers map the BTN_RIGHT and/or BTN_MIDDLE key bits even though the device is a buttonpad and therefore does not have those buttons. This behavior has forced userspace applications like libinput to implement different workarounds and quirks to detect buttonpads and offer to the user the right set of features and configuration options. For more information: https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/726 In order to avoid this issue clear the BTN_RIGHT and BTN_MIDDLE key bits when the input device is register if the INPUT_PROP_BUTTONPAD property bit is set. Notice that this change will not affect udev because it does not check for buttons. See systemd/src/udev/udev-builtin-input_id.c. List of known affected hardware: - Chuwi AeroBook Plus - Chuwi Gemibook - Framework Laptop - GPD Win Max - Huawei MateBook 2020 - Prestigio Smartbook 141 C2 - Purism Librem 14v1 - StarLite Mk II - AMI firmware - StarLite Mk II - Coreboot firmware - StarLite Mk III - AMI firmware - StarLite Mk III - Coreboot firmware - StarLabTop Mk IV - AMI firmware - StarLabTop Mk IV - Coreboot firmware - StarBook Mk V Acked-by: Peter Hutterer Acked-by: Benjamin Tissoires Acked-by: Jiri Kosina Signed-off-by: Jos=C3=A9 Exp=C3=B3sito Link: https://lore.kernel.org/r/20220208174806.17183-1-jose.exposito89@gmai= l.com Signed-off-by: Dmitry Torokhov Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/input/input.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/input/input.c b/drivers/input/input.c index 5d94fc3fce0bb..cb31236425a11 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -2112,6 +2112,12 @@ int input_register_device(struct input_dev *dev) /* KEY_RESERVED is not supposed to be transmitted to userspace. */ __clear_bit(KEY_RESERVED, dev->keybit); =20 + /* Buttonpads should not map BTN_RIGHT and/or BTN_MIDDLE. */ + if (test_bit(INPUT_PROP_BUTTONPAD, dev->propbit)) { + __clear_bit(BTN_RIGHT, dev->keybit); + __clear_bit(BTN_MIDDLE, dev->keybit); + } + /* Make sure that bitmasks not mentioned in dev->evbit are clean. */ input_cleanse_bitmasks(dev); =20 --=20 2.34.1 From nobody Tue Jun 23 11:09:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CCACAC433EF for ; Mon, 7 Mar 2022 09:21:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236531AbiCGJWq (ORCPT ); Mon, 7 Mar 2022 04:22:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52484 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236576AbiCGJWY (ORCPT ); Mon, 7 Mar 2022 04:22:24 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF48A66AC6; Mon, 7 Mar 2022 01:20:37 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 764B4B810BD; Mon, 7 Mar 2022 09:20:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A3FAAC36AE3; Mon, 7 Mar 2022 09:20:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644835; bh=2uGSyrZm/lbfmqs0uoxEHOH1brc8mb3+/UaCeclkXOw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sVVjZQouGqWjj/fwi5g/GBq6f2BXUacfzI2ygLH4QFXOjsBBMQDnvBIuaOX4mVkSS dgbEk4qG8qkWt4uDsuRk85iv//17wM1c9mZ+JjBGQjOrb4nZwBM2RbNZxX3W3UqBcZ HCnh/jek6BRIaT7LvTpEQ2KiBQIYT6lANGI4yo3k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shyam Prasad N , Ronnie Sahlberg , Steve French , Sasha Levin Subject: [PATCH 4.9 05/32] cifs: fix double free race when mount fails in cifs_get_root() Date: Mon, 7 Mar 2022 10:18:31 +0100 Message-Id: <20220307091634.595125710@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091634.434478485@linuxfoundation.org> References: <20220307091634.434478485@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ronnie Sahlberg [ Upstream commit 3d6cc9898efdfb062efb74dc18cfc700e082f5d5 ] When cifs_get_root() fails during cifs_smb3_do_mount() we call deactivate_locked_super() which eventually will call delayed_free() which will free the context. In this situation we should not proceed to enter the out: section in cifs_smb3_do_mount() and free the same resources a second time. [Thu Feb 10 12:59:06 2022] BUG: KASAN: use-after-free in rcu_cblist_dequeue= +0x32/0x60 [Thu Feb 10 12:59:06 2022] Read of size 8 at addr ffff888364f4d110 by task = swapper/1/0 [Thu Feb 10 12:59:06 2022] CPU: 1 PID: 0 Comm: swapper/1 Tainted: G = OE 5.17.0-rc3+ #4 [Thu Feb 10 12:59:06 2022] Hardware name: Microsoft Corporation Virtual Mac= hine/Virtual Machine, BIOS Hyper-V UEFI Release v4.0 12/17/2019 [Thu Feb 10 12:59:06 2022] Call Trace: [Thu Feb 10 12:59:06 2022] [Thu Feb 10 12:59:06 2022] dump_stack_lvl+0x5d/0x78 [Thu Feb 10 12:59:06 2022] print_address_description.constprop.0+0x24/0x150 [Thu Feb 10 12:59:06 2022] ? rcu_cblist_dequeue+0x32/0x60 [Thu Feb 10 12:59:06 2022] kasan_report.cold+0x7d/0x117 [Thu Feb 10 12:59:06 2022] ? rcu_cblist_dequeue+0x32/0x60 [Thu Feb 10 12:59:06 2022] __asan_load8+0x86/0xa0 [Thu Feb 10 12:59:06 2022] rcu_cblist_dequeue+0x32/0x60 [Thu Feb 10 12:59:06 2022] rcu_core+0x547/0xca0 [Thu Feb 10 12:59:06 2022] ? call_rcu+0x3c0/0x3c0 [Thu Feb 10 12:59:06 2022] ? __this_cpu_preempt_check+0x13/0x20 [Thu Feb 10 12:59:06 2022] ? lock_is_held_type+0xea/0x140 [Thu Feb 10 12:59:06 2022] rcu_core_si+0xe/0x10 [Thu Feb 10 12:59:06 2022] __do_softirq+0x1d4/0x67b [Thu Feb 10 12:59:06 2022] __irq_exit_rcu+0x100/0x150 [Thu Feb 10 12:59:06 2022] irq_exit_rcu+0xe/0x30 [Thu Feb 10 12:59:06 2022] sysvec_hyperv_stimer0+0x9d/0xc0 ... [Thu Feb 10 12:59:07 2022] Freed by task 58179: [Thu Feb 10 12:59:07 2022] kasan_save_stack+0x26/0x50 [Thu Feb 10 12:59:07 2022] kasan_set_track+0x25/0x30 [Thu Feb 10 12:59:07 2022] kasan_set_free_info+0x24/0x40 [Thu Feb 10 12:59:07 2022] ____kasan_slab_free+0x137/0x170 [Thu Feb 10 12:59:07 2022] __kasan_slab_free+0x12/0x20 [Thu Feb 10 12:59:07 2022] slab_free_freelist_hook+0xb3/0x1d0 [Thu Feb 10 12:59:07 2022] kfree+0xcd/0x520 [Thu Feb 10 12:59:07 2022] cifs_smb3_do_mount+0x149/0xbe0 [cifs] [Thu Feb 10 12:59:07 2022] smb3_get_tree+0x1a0/0x2e0 [cifs] [Thu Feb 10 12:59:07 2022] vfs_get_tree+0x52/0x140 [Thu Feb 10 12:59:07 2022] path_mount+0x635/0x10c0 [Thu Feb 10 12:59:07 2022] __x64_sys_mount+0x1bf/0x210 [Thu Feb 10 12:59:07 2022] do_syscall_64+0x5c/0xc0 [Thu Feb 10 12:59:07 2022] entry_SYSCALL_64_after_hwframe+0x44/0xae [Thu Feb 10 12:59:07 2022] Last potentially related work creation: [Thu Feb 10 12:59:07 2022] kasan_save_stack+0x26/0x50 [Thu Feb 10 12:59:07 2022] __kasan_record_aux_stack+0xb6/0xc0 [Thu Feb 10 12:59:07 2022] kasan_record_aux_stack_noalloc+0xb/0x10 [Thu Feb 10 12:59:07 2022] call_rcu+0x76/0x3c0 [Thu Feb 10 12:59:07 2022] cifs_umount+0xce/0xe0 [cifs] [Thu Feb 10 12:59:07 2022] cifs_kill_sb+0xc8/0xe0 [cifs] [Thu Feb 10 12:59:07 2022] deactivate_locked_super+0x5d/0xd0 [Thu Feb 10 12:59:07 2022] cifs_smb3_do_mount+0xab9/0xbe0 [cifs] [Thu Feb 10 12:59:07 2022] smb3_get_tree+0x1a0/0x2e0 [cifs] [Thu Feb 10 12:59:07 2022] vfs_get_tree+0x52/0x140 [Thu Feb 10 12:59:07 2022] path_mount+0x635/0x10c0 [Thu Feb 10 12:59:07 2022] __x64_sys_mount+0x1bf/0x210 [Thu Feb 10 12:59:07 2022] do_syscall_64+0x5c/0xc0 [Thu Feb 10 12:59:07 2022] entry_SYSCALL_64_after_hwframe+0x44/0xae Reported-by: Shyam Prasad N Reviewed-by: Shyam Prasad N Signed-off-by: Ronnie Sahlberg Signed-off-by: Steve French Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- fs/cifs/cifsfs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 375ccd209206a..95e4f074b7665 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -746,6 +746,7 @@ cifs_do_mount(struct file_system_type *fs_type, =20 out_super: deactivate_locked_super(sb); + return root; out: cifs_cleanup_volume_info(volume_info); return root; --=20 2.34.1 From nobody Tue Jun 23 11:09:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3042AC433F5 for ; Mon, 7 Mar 2022 09:21:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236635AbiCGJWr (ORCPT ); Mon, 7 Mar 2022 04:22:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236580AbiCGJWb (ORCPT ); Mon, 7 Mar 2022 04:22:31 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A506766AD4; Mon, 7 Mar 2022 01:20:39 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 41D0BB810C3; Mon, 7 Mar 2022 09:20:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84DD8C36AE5; Mon, 7 Mar 2022 09:20:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644837; bh=z26jdcz8ETQiT0yMjJkEpAN2tFFILIDjhzcZj/5HSQU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ydGYYxF89mum7zhyJjwpvZkTlU62elUEoVTsEX5FWYGtQgZzSwWhR/qbAr3XpdnAG UaHacoseEmHsLZZiHk04JBObWpQj467wA5se1Zt8bEsaAOHoumWUbU6zlIWHMamaoK ODQ/VCsC8TK/co5lvWXusFj8CeM1FGlSzPa7UpxA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yongzhi Liu , Vinod Koul , Sasha Levin Subject: [PATCH 4.9 06/32] dmaengine: shdma: Fix runtime PM imbalance on error Date: Mon, 7 Mar 2022 10:18:32 +0100 Message-Id: <20220307091634.624065326@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091634.434478485@linuxfoundation.org> References: <20220307091634.434478485@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yongzhi Liu [ Upstream commit 455896c53d5b803733ddd84e1bf8a430644439b6 ] pm_runtime_get_() increments the runtime PM usage counter even when it returns an error code, thus a matching decrement is needed on the error handling path to keep the counter balanced. Signed-off-by: Yongzhi Liu Link: https://lore.kernel.org/r/1642311296-87020-1-git-send-email-lyz_cs@pk= u.edu.cn Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/dma/sh/shdma-base.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/dma/sh/shdma-base.c b/drivers/dma/sh/shdma-base.c index 12fa48e380cf5..4f8dfe77da3c5 100644 --- a/drivers/dma/sh/shdma-base.c +++ b/drivers/dma/sh/shdma-base.c @@ -118,8 +118,10 @@ static dma_cookie_t shdma_tx_submit(struct dma_async_t= x_descriptor *tx) ret =3D pm_runtime_get(schan->dev); =20 spin_unlock_irq(&schan->chan_lock); - if (ret < 0) + if (ret < 0) { dev_err(schan->dev, "%s(): GET =3D %d\n", __func__, ret); + pm_runtime_put(schan->dev); + } =20 pm_runtime_barrier(schan->dev); =20 --=20 2.34.1 From nobody Tue Jun 23 11:09:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5EC9C433F5 for ; Mon, 7 Mar 2022 09:25:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236916AbiCGJ0N (ORCPT ); Mon, 7 Mar 2022 04:26:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233429AbiCGJWe (ORCPT ); Mon, 7 Mar 2022 04:22:34 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 652F166AF0; Mon, 7 Mar 2022 01:20:43 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 157C9B810CE; Mon, 7 Mar 2022 09:20:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7DE23C340E9; Mon, 7 Mar 2022 09:20:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644840; bh=+HjWtkyg5blV/CSVSQ1sFF66D+smH/UPn9Xx4gaydoE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NcLTF9u3vM9rAaZ3t6u5T6g/nTrjRd6htOcIEYER0aUwJtLTpYU6DwkNDdFOolCSd NlJsVxNGSlxTUkBOlTp1kF49RdFYNV910GI/wxb2T7RuZTcTp0srs5WqWkYL/NXasX XEWCrBa2ClSFUyuJNaNInLE0+q5Cweuo5KJJSIKY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wolfram Sang , Sasha Levin Subject: [PATCH 4.9 07/32] i2c: qup: allow COMPILE_TEST Date: Mon, 7 Mar 2022 10:18:33 +0100 Message-Id: <20220307091634.651736748@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091634.434478485@linuxfoundation.org> References: <20220307091634.434478485@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wolfram Sang [ Upstream commit 5de717974005fcad2502281e9f82e139ca91f4bb ] Driver builds fine with COMPILE_TEST. Enable it for wider test coverage and easier maintenance. Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/i2c/busses/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 759c621a860a9..be4b7b1ad39b6 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig @@ -783,7 +783,7 @@ config I2C_PXA_SLAVE =20 config I2C_QUP tristate "Qualcomm QUP based I2C controller" - depends on ARCH_QCOM + depends on ARCH_QCOM || COMPILE_TEST help If you say yes to this option, support will be included for the built-in I2C interface on the Qualcomm SoCs. --=20 2.34.1 From nobody Tue Jun 23 11:09:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3ABE4C4332F for ; Mon, 7 Mar 2022 09:23:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236709AbiCGJYg (ORCPT ); Mon, 7 Mar 2022 04:24:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236599AbiCGJWf (ORCPT ); Mon, 7 Mar 2022 04:22:35 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7385866C95; Mon, 7 Mar 2022 01:20:46 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1C0DBB810B2; Mon, 7 Mar 2022 09:20:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B446C340E9; Mon, 7 Mar 2022 09:20:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644843; bh=qQGPmeaAYFXyIjtv0HVDAMGkMn9oVjkstYLU3NOcbuA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YRktDqWTx/ki93fL+PpDRNIMdeM3M/oIV9hq1XTsH4RpqIs9R4U1hqkM9S/KIy8// FJdPoUgtStFo9AfJ4LIExOWayXp5gb2vlg/G7FsHowbS+CoStrqP8whnOle51NX8xB WxrO4m2OXF59FseocAKylroXk142cjJlSV+x4VUs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniele Palmas , "David S. Miller" , Sasha Levin Subject: [PATCH 4.9 08/32] net: usb: cdc_mbim: avoid altsetting toggling for Telit FN990 Date: Mon, 7 Mar 2022 10:18:34 +0100 Message-Id: <20220307091634.680134851@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091634.434478485@linuxfoundation.org> References: <20220307091634.434478485@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Daniele Palmas [ Upstream commit 21e8a96377e6b6debae42164605bf9dcbe5720c5 ] Add quirk CDC_MBIM_FLAG_AVOID_ALTSETTING_TOGGLE for Telit FN990 0x1071 composition in order to avoid bind error. Signed-off-by: Daniele Palmas Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/usb/cdc_mbim.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c index d86132d41416d..95256765b3887 100644 --- a/drivers/net/usb/cdc_mbim.c +++ b/drivers/net/usb/cdc_mbim.c @@ -652,6 +652,11 @@ static const struct usb_device_id mbim_devs[] =3D { .driver_info =3D (unsigned long)&cdc_mbim_info_avoid_altsetting_toggle, }, =20 + /* Telit FN990 */ + { USB_DEVICE_AND_INTERFACE_INFO(0x1bc7, 0x1071, USB_CLASS_COMM, USB_CDC_S= UBCLASS_MBIM, USB_CDC_PROTO_NONE), + .driver_info =3D (unsigned long)&cdc_mbim_info_avoid_altsetting_toggle, + }, + /* default entry */ { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_MBIM, USB_CDC_PROTO= _NONE), .driver_info =3D (unsigned long)&cdc_mbim_info_zlp, --=20 2.34.1 From nobody Tue Jun 23 11:09:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B304C433FE for ; Mon, 7 Mar 2022 09:25:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236926AbiCGJ0R (ORCPT ); Mon, 7 Mar 2022 04:26:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236653AbiCGJWi (ORCPT ); Mon, 7 Mar 2022 04:22:38 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D130527ED; Mon, 7 Mar 2022 01:20:48 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E5711B810BD; Mon, 7 Mar 2022 09:20:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 486BDC340E9; Mon, 7 Mar 2022 09:20:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644846; bh=rEQmAFSM5skYf2Cxsh8HavJvc5jurQZGsLq/sl+SbUI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ywHUzAkR6YGwueealA0ulPMGXFpn7Cu2qbuQX+WbvZk0ih8QsnbVzytysOOKBIolm E5K2Wpong+ve89DDN1pTF7SVFEyk4bUtZ1gIP/swKgNr3+YIHFexLUzQJgpU0j2gxA IXarKaOaWXeiMg9i1wGi9NPFDllrJo5YHh+lrr9E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern , Hangyu Hua Subject: [PATCH 4.9 09/32] usb: gadget: dont release an existing dev->buf Date: Mon, 7 Mar 2022 10:18:35 +0100 Message-Id: <20220307091634.707872973@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091634.434478485@linuxfoundation.org> References: <20220307091634.434478485@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hangyu Hua commit 89f3594d0de58e8a57d92d497dea9fee3d4b9cda upstream. dev->buf does not need to be released if it already exists before executing dev_config. Acked-by: Alan Stern Signed-off-by: Hangyu Hua Link: https://lore.kernel.org/r/20211231172138.7993-2-hbh25y@gmail.com Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/gadget/legacy/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/usb/gadget/legacy/inode.c +++ b/drivers/usb/gadget/legacy/inode.c @@ -1833,8 +1833,9 @@ dev_config (struct file *fd, const char spin_lock_irq (&dev->lock); value =3D -EINVAL; if (dev->buf) { + spin_unlock_irq(&dev->lock); kfree(kbuf); - goto fail; + return value; } dev->buf =3D kbuf; From nobody Tue Jun 23 11:09:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23E36C433EF for ; Mon, 7 Mar 2022 09:19:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233444AbiCGJUM (ORCPT ); Mon, 7 Mar 2022 04:20:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234625AbiCGJUE (ORCPT ); Mon, 7 Mar 2022 04:20:04 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BB6F3D4B9; Mon, 7 Mar 2022 01:19:11 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9241160FF6; Mon, 7 Mar 2022 09:19:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8E187C340E9; Mon, 7 Mar 2022 09:19:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644750; bh=b0QbXIwWULP++mDECtLCC1rkT8pU58SCObbnwCI+Rq8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=noK+/AD0lP5270BP1NMk0ShQO/S/YQ7tnE046JzVAkvMm7lHoMY52/FQHY/z9tQpe 2OS04HE5RcrtXTQ8tLSZmGj2AhcIJJ4/Ll0Aj3neMsjc9uAnkdUSbRBILHOP4YK+Ih KcuJnGogtbTubPFfuA/qjPe50ELC0M2QDATa308Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern , Hangyu Hua Subject: [PATCH 4.9 10/32] usb: gadget: clear related members when goto fail Date: Mon, 7 Mar 2022 10:18:36 +0100 Message-Id: <20220307091634.735190570@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091634.434478485@linuxfoundation.org> References: <20220307091634.434478485@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hangyu Hua commit 501e38a5531efbd77d5c73c0ba838a889bfc1d74 upstream. dev->config and dev->hs_config and dev->dev need to be cleaned if dev_config fails to avoid UAF. Acked-by: Alan Stern Signed-off-by: Hangyu Hua Link: https://lore.kernel.org/r/20211231172138.7993-3-hbh25y@gmail.com Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/usb/gadget/legacy/inode.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) --- a/drivers/usb/gadget/legacy/inode.c +++ b/drivers/usb/gadget/legacy/inode.c @@ -1883,8 +1883,8 @@ dev_config (struct file *fd, const char =20 value =3D usb_gadget_probe_driver(&gadgetfs_driver); if (value !=3D 0) { - kfree (dev->buf); - dev->buf =3D NULL; + spin_lock_irq(&dev->lock); + goto fail; } else { /* at this point "good" hardware has for the first time * let the USB the host see us. alternatively, if users @@ -1901,6 +1901,9 @@ dev_config (struct file *fd, const char return value; =20 fail: + dev->config =3D NULL; + dev->hs_config =3D NULL; + dev->dev =3D NULL; spin_unlock_irq (&dev->lock); pr_debug ("%s: %s fail %Zd, %p\n", shortname, __func__, value, dev); kfree (dev->buf); From nobody Tue Jun 23 11:09:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BA04C433EF for ; Mon, 7 Mar 2022 09:19:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236349AbiCGJUP (ORCPT ); Mon, 7 Mar 2022 04:20:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233897AbiCGJUJ (ORCPT ); Mon, 7 Mar 2022 04:20:09 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2F903D1FD; Mon, 7 Mar 2022 01:19:15 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 615A5B81054; Mon, 7 Mar 2022 09:19:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2BBBC340E9; Mon, 7 Mar 2022 09:19:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644753; bh=71sl323eS025K3hQqxRUXxE4Bl6X+RJEAawq5oEERzk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=br/bHE10kfWr5HerhbRzqlQW1HXcOK/F2il779uFdnF0MVeuJnF8kfSUYEKM0/uyd jhcbrZkCnZfIh0rwqkHfAZndSnpy/bfC40gDUWTeJ3JpXK2t8MI9NQUf0rddyGAV23 3Y0u0KpAF/Pu00BzpvbzPwpjEWMyr1ZRVaGuK4Lg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Shtylyov , Damien Le Moal , Sasha Levin Subject: [PATCH 4.9 11/32] ata: pata_hpt37x: fix PCI clock detection Date: Mon, 7 Mar 2022 10:18:37 +0100 Message-Id: <20220307091634.763233497@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091634.434478485@linuxfoundation.org> References: <20220307091634.434478485@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sergey Shtylyov [ Upstream commit 5f6b0f2d037c8864f20ff15311c695f65eb09db5 ] The f_CNT register (at the PCI config. address 0x78) is 16-bit, not 8-bit! The bug was there from the very start... :-( Signed-off-by: Sergey Shtylyov Fixes: 669a5db411d8 ("[libata] Add a bunch of PATA drivers.") Cc: stable@vger.kernel.org Signed-off-by: Damien Le Moal Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/ata/pata_hpt37x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/ata/pata_hpt37x.c +++ b/drivers/ata/pata_hpt37x.c @@ -964,14 +964,14 @@ static int hpt37x_init_one(struct pci_de =20 if ((freq >> 12) !=3D 0xABCDE) { int i; - u8 sr; + u16 sr; u32 total =3D 0; =20 pr_warn("BIOS has not set timing clocks\n"); =20 /* This is the process the HPT371 BIOS is reported to use */ for (i =3D 0; i < 128; i++) { - pci_read_config_byte(dev, 0x78, &sr); + pci_read_config_word(dev, 0x78, &sr); total +=3D sr & 0x1FF; udelay(15); } From nobody Tue Jun 23 11:09:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E32FC43217 for ; Mon, 7 Mar 2022 09:19:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236377AbiCGJUW (ORCPT ); Mon, 7 Mar 2022 04:20:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236164AbiCGJUN (ORCPT ); Mon, 7 Mar 2022 04:20:13 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98AC449913; Mon, 7 Mar 2022 01:19:18 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2F3FFB810B9; Mon, 7 Mar 2022 09:19:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8ADFDC340F3; Mon, 7 Mar 2022 09:19:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644756; bh=FiohOt7NoQYLxo5ix/ERErfoSi8NWtSUiMdB3zj+G9Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=00/nN/vAoQDPnQUTqH55kuxp3cEtRYDq5t/INNzaUXXrSqNRQOO+++mqdEtkomakq Uf5D9fQl/a9G5S6sRjo23clE2fLhZeJ8iFmvL/LiIc9cZh1VzKTmMKUW/taFsIJsvZ V+9dWzXV6xWWci+PJ0t8wAoS3FX4nRq1qlXZZsns= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marek Vasut , Mark Brown Subject: [PATCH 4.9 12/32] ASoC: ops: Shift tested values in snd_soc_put_volsw() by +min Date: Mon, 7 Mar 2022 10:18:38 +0100 Message-Id: <20220307091634.790582784@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091634.434478485@linuxfoundation.org> References: <20220307091634.434478485@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marek Vasut commit 9bdd10d57a8807dba0003af0325191f3cec0f11c upstream. While the $val/$val2 values passed in from userspace are always >=3D 0 integers, the limits of the control can be signed integers and the $min can be non-zero and less than zero. To correctly validate $val/$val2 against platform_max, add the $min offset to val first. Fixes: 817f7c9335ec0 ("ASoC: ops: Reject out of bounds values in snd_soc_pu= t_volsw()") Signed-off-by: Marek Vasut Cc: Mark Brown Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220215130645.164025-1-marex@denx.de Signed-off-by: Mark Brown Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- sound/soc/soc-ops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/sound/soc/soc-ops.c +++ b/sound/soc/soc-ops.c @@ -328,7 +328,7 @@ int snd_soc_put_volsw(struct snd_kcontro mask =3D BIT(sign_bit + 1) - 1; =20 val =3D ucontrol->value.integer.value[0]; - if (mc->platform_max && val > mc->platform_max) + if (mc->platform_max && ((int)val + min) > mc->platform_max) return -EINVAL; if (val > max - min) return -EINVAL; @@ -341,7 +341,7 @@ int snd_soc_put_volsw(struct snd_kcontro val =3D val << shift; if (snd_soc_volsw_is_stereo(mc)) { val2 =3D ucontrol->value.integer.value[1]; - if (mc->platform_max && val2 > mc->platform_max) + if (mc->platform_max && ((int)val2 + min) > mc->platform_max) return -EINVAL; if (val2 > max - min) return -EINVAL; From nobody Tue Jun 23 11:09:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0ADA2C433F5 for ; Mon, 7 Mar 2022 09:19:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230119AbiCGJU0 (ORCPT ); Mon, 7 Mar 2022 04:20:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236374AbiCGJUT (ORCPT ); Mon, 7 Mar 2022 04:20:19 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73C7A4BB9E; Mon, 7 Mar 2022 01:19:21 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 30013B810B2; Mon, 7 Mar 2022 09:19:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8EC2FC340F5; Mon, 7 Mar 2022 09:19:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644759; bh=j6TUN0r8UfveiHMI6u6iwnzfl6vV6ocFAP0/ty86B9I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q+9+jEmgBiNV+bcbMWnb+L9tA1jP5hfjt/2jQ0qMUG2BHbjGB6MQ8RMHor7BVal+G 7mkKva4T3YHeaiD/nSq/7GXY1nyc+jVO9DALeEkihgrxkB4FHAkagdzctvqjLSZvst 4dLCRkXmiqoeeVjjsQFfSYWpPagCX6KqhGt8Zs7g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiri Bohac , Steffen Klassert Subject: [PATCH 4.9 13/32] xfrm: fix MTU regression Date: Mon, 7 Mar 2022 10:18:39 +0100 Message-Id: <20220307091634.818002970@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091634.434478485@linuxfoundation.org> References: <20220307091634.434478485@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiri Bohac commit 6596a0229541270fb8d38d989f91b78838e5e9da upstream. Commit 749439bfac6e1a2932c582e2699f91d329658196 ("ipv6: fix udpv6 sendmsg crash caused by too small MTU") breaks PMTU for xfrm. A Packet Too Big ICMPv6 message received in response to an ESP packet will prevent all further communication through the tunnel if the reported MTU minus the ESP overhead is smaller than 1280. E.g. in a case of a tunnel-mode ESP with sha256/aes the overhead is 92 bytes. Receiving a PTB with MTU of 1371 or less will result in all further packets in the tunnel dropped. A ping through the tunnel fails with "ping: sendmsg: Invalid argument". Apparently the MTU on the xfrm route is smaller than 1280 and fails the check inside ip6_setup_cork() added by 749439bf. We found this by debugging USGv6/ipv6ready failures. Failing tests are: "Phase-2 Interoperability Test Scenario IPsec" / 5.3.11 and 5.4.11 (Tunnel Mode: Fragmentation). Commit b515d2637276a3810d6595e10ab02c13bfd0b63a ("xfrm: xfrm_state_mtu should return at least 1280 for ipv6") attempted to fix this but caused another regression in TCP MSS calculations and had to be reverted. The patch below fixes the situation by dropping the MTU check and instead checking for the underflows described in the 749439bf commit message. Signed-off-by: Jiri Bohac Fixes: 749439bfac6e ("ipv6: fix udpv6 sendmsg crash caused by too small MTU= ") Signed-off-by: Steffen Klassert Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/ipv6/ip6_output.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -1274,8 +1274,6 @@ static int ip6_setup_cork(struct sock *s if (np->frag_size) mtu =3D np->frag_size; } - if (mtu < IPV6_MIN_MTU) - return -EINVAL; cork->base.fragsize =3D mtu; if (dst_allfrag(rt->dst.path)) cork->base.flags |=3D IPCORK_ALLFRAG; @@ -1324,8 +1322,6 @@ static int __ip6_append_data(struct sock =20 fragheaderlen =3D sizeof(struct ipv6hdr) + rt->rt6i_nfheader_len + (opt ? opt->opt_nflen : 0); - maxfraglen =3D ((mtu - fragheaderlen) & ~7) + fragheaderlen - - sizeof(struct frag_hdr); =20 headersize =3D sizeof(struct ipv6hdr) + (opt ? opt->opt_flen + opt->opt_nflen : 0) + @@ -1333,6 +1329,13 @@ static int __ip6_append_data(struct sock sizeof(struct frag_hdr) : 0) + rt->rt6i_nfheader_len; =20 + if (mtu < fragheaderlen || + ((mtu - fragheaderlen) & ~7) + fragheaderlen < sizeof(struct frag_hdr= )) + goto emsgsize; + + maxfraglen =3D ((mtu - fragheaderlen) & ~7) + fragheaderlen - + sizeof(struct frag_hdr); + /* as per RFC 7112 section 5, the entire IPv6 Header Chain must fit * the first fragment */ From nobody Tue Jun 23 11:09:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B446FC433F5 for ; Mon, 7 Mar 2022 09:19:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236417AbiCGJUb (ORCPT ); Mon, 7 Mar 2022 04:20:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49548 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236399AbiCGJUU (ORCPT ); Mon, 7 Mar 2022 04:20:20 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C99CE50E3D; Mon, 7 Mar 2022 01:19:24 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 12F9BB810B9; Mon, 7 Mar 2022 09:19:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7F473C340E9; Mon, 7 Mar 2022 09:19:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644761; bh=SMjhGzvyBQIr5ixAIOlOYHqg0n+x4DBNfeHbKsz0Z7E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=syBfgIQpVrTQ4RXMTqUZ9s6f9+2uf+A6dwz59oOtjp6pHvDa7LJ38XCoepNxQofLz 46G3fiWVm/7q0K7yivJFkmNQM9uAYwLf0s80FgPbm8/hFfg7JRZHWYmaShs5vqNZeJ SJ9SRuckQkjcZWafJeAIobUYzXXnvjZnz51B7Ckw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oleksandr Natalenko , Florian Westphal Subject: [PATCH 4.9 14/32] netfilter: nf_queue: dont assume sk is full socket Date: Mon, 7 Mar 2022 10:18:40 +0100 Message-Id: <20220307091634.846257335@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091634.434478485@linuxfoundation.org> References: <20220307091634.434478485@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Westphal commit 747670fd9a2d1b7774030dba65ca022ba442ce71 upstream. There is no guarantee that state->sk refers to a full socket. If refcount transitions to 0, sock_put calls sk_free which then ends up with garbage fields. I'd like to thank Oleksandr Natalenko and Jiri Benc for considerable debug work and pointing out state->sk oddities. Fixes: ca6fb0651883 ("tcp: attach SYNACK messages to request sockets instea= d of listener") Tested-by: Oleksandr Natalenko Signed-off-by: Florian Westphal Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/netfilter/nf_queue.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) --- a/net/netfilter/nf_queue.c +++ b/net/netfilter/nf_queue.c @@ -44,6 +44,15 @@ void nf_unregister_queue_handler(struct } EXPORT_SYMBOL(nf_unregister_queue_handler); =20 +static void nf_queue_sock_put(struct sock *sk) +{ +#ifdef CONFIG_INET + sock_gen_put(sk); +#else + sock_put(sk); +#endif +} + void nf_queue_entry_release_refs(struct nf_queue_entry *entry) { struct nf_hook_state *state =3D &entry->state; @@ -54,7 +63,7 @@ void nf_queue_entry_release_refs(struct if (state->out) dev_put(state->out); if (state->sk) - sock_put(state->sk); + nf_queue_sock_put(state->sk); #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) if (entry->skb->nf_bridge) { struct net_device *physdev; From nobody Tue Jun 23 11:09:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC78EC433EF for ; Mon, 7 Mar 2022 09:19:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236423AbiCGJUf (ORCPT ); Mon, 7 Mar 2022 04:20:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236164AbiCGJUW (ORCPT ); Mon, 7 Mar 2022 04:20:22 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59F7145792; Mon, 7 Mar 2022 01:19:27 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 05CDFB810B9; Mon, 7 Mar 2022 09:19:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71326C340E9; Mon, 7 Mar 2022 09:19:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644764; bh=dvkQIVaVU/XwX/y85aJnhScdigTtuAhBAx1OV2QuNa4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DeeBDI+w20OkWTuhfOIOkibO9bLb9OVQwE8fCR8olRSH7MFATIbWGZcjYx9YecHVM PdnhU6WliIziJBWxoJPlt0khk0tKtxkZlOW+MfK0GjugDwet4nQIaHZ5Lf05fGYDnk M08H3H0vRpbjnonrBk3f7Ef2rTVJ17B3Gk394950= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , Eric Dumazet , Florian Westphal Subject: [PATCH 4.9 15/32] netfilter: nf_queue: fix possible use-after-free Date: Mon, 7 Mar 2022 10:18:41 +0100 Message-Id: <20220307091634.873450554@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091634.434478485@linuxfoundation.org> References: <20220307091634.434478485@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Westphal commit c3873070247d9e3c7a6b0cf9bf9b45e8018427b1 upstream. Eric Dumazet says: The sock_hold() side seems suspect, because there is no guarantee that sk_refcnt is not already 0. On failure, we cannot queue the packet and need to indicate an error. The packet will be dropped by the caller. v2: split skb prefetch hunk into separate change Fixes: 271b72c7fa82c ("udp: RCU handling for Unicast packets.") Reported-by: Eric Dumazet Reviewed-by: Eric Dumazet Signed-off-by: Florian Westphal Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- include/net/netfilter/nf_queue.h | 2 +- net/netfilter/nf_queue.c | 12 ++++++++++-- net/netfilter/nfnetlink_queue.c | 12 +++++++++--- 3 files changed, 20 insertions(+), 6 deletions(-) --- a/include/net/netfilter/nf_queue.h +++ b/include/net/netfilter/nf_queue.h @@ -31,7 +31,7 @@ void nf_register_queue_handler(struct ne void nf_unregister_queue_handler(struct net *net); void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict); =20 -void nf_queue_entry_get_refs(struct nf_queue_entry *entry); +bool nf_queue_entry_get_refs(struct nf_queue_entry *entry); void nf_queue_entry_release_refs(struct nf_queue_entry *entry); =20 static inline void init_hashrandom(u32 *jhash_initval) --- a/net/netfilter/nf_queue.c +++ b/net/netfilter/nf_queue.c @@ -80,10 +80,13 @@ void nf_queue_entry_release_refs(struct EXPORT_SYMBOL_GPL(nf_queue_entry_release_refs); =20 /* Bump dev refs so they don't vanish while packet is out */ -void nf_queue_entry_get_refs(struct nf_queue_entry *entry) +bool nf_queue_entry_get_refs(struct nf_queue_entry *entry) { struct nf_hook_state *state =3D &entry->state; =20 + if (state->sk && !atomic_inc_not_zero(&state->sk->sk_refcnt)) + return false; + if (state->in) dev_hold(state->in); if (state->out) @@ -102,6 +105,7 @@ void nf_queue_entry_get_refs(struct nf_q dev_hold(physdev); } #endif + return true; } EXPORT_SYMBOL_GPL(nf_queue_entry_get_refs); =20 @@ -148,7 +152,11 @@ static int __nf_queue(struct sk_buff *sk .size =3D sizeof(*entry) + afinfo->route_key_size, }; =20 - nf_queue_entry_get_refs(entry); + if (!nf_queue_entry_get_refs(entry)) { + kfree(entry); + return -ENOTCONN; + } + skb_dst_force(skb); afinfo->saveroute(skb, entry); status =3D qh->outfn(entry, queuenum); --- a/net/netfilter/nfnetlink_queue.c +++ b/net/netfilter/nfnetlink_queue.c @@ -673,9 +673,15 @@ static struct nf_queue_entry * nf_queue_entry_dup(struct nf_queue_entry *e) { struct nf_queue_entry *entry =3D kmemdup(e, e->size, GFP_ATOMIC); - if (entry) - nf_queue_entry_get_refs(entry); - return entry; + + if (!entry) + return NULL; + + if (nf_queue_entry_get_refs(entry)) + return entry; + + kfree(entry); + return NULL; } =20 #if IS_ENABLED(CONFIG_BRIDGE_NETFILTER) From nobody Tue Jun 23 11:09:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A184C433F5 for ; Mon, 7 Mar 2022 09:19:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236429AbiCGJUi (ORCPT ); Mon, 7 Mar 2022 04:20:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236401AbiCGJU1 (ORCPT ); Mon, 7 Mar 2022 04:20:27 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1196506F1; Mon, 7 Mar 2022 01:19:30 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9B402B810BD; Mon, 7 Mar 2022 09:19:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ACF3AC340F3; Mon, 7 Mar 2022 09:19:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644768; bh=hGZGKF3eIIGA7dSlt4GgSw/n9/o1tLEFOlULyzLuRZ8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rzeZrAOxhaqqQYN9mhC3bcXqOx22V8pxBjJhqYfON6OMMoAzwz5Npa53rcRE6VUEW o9T9pgejBskyoxp8l/Bo0HEjtG4CXj6v7R1fdfsOmncWlU8rXlJHWhpUlG1dzEsqnD /ivrCQ9SG0FlaorANxUxdj19hbZOipJa5bniXMN8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vladimir Oltean , "David S. Miller" Subject: [PATCH 4.9 16/32] net: dcb: flush lingering app table entries for unregistered devices Date: Mon, 7 Mar 2022 10:18:42 +0100 Message-Id: <20220307091634.901220025@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091634.434478485@linuxfoundation.org> References: <20220307091634.434478485@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 commit 91b0383fef06f20b847fa9e4f0e3054ead0b1a1b upstream. If I'm not mistaken (and I don't think I am), the way in which the dcbnl_ops work is that drivers call dcb_ieee_setapp() and this populates the application table with dynamically allocated struct dcb_app_type entries that are kept in the module-global dcb_app_list. However, nobody keeps exact track of these entries, and although dcb_ieee_delapp() is supposed to remove them, nobody does so when the interface goes away (example: driver unbinds from device). So the dcb_app_list will contain lingering entries with an ifindex that no longer matches any device in dcb_app_lookup(). Reclaim the lost memory by listening for the NETDEV_UNREGISTER event and flushing the app table entries of interfaces that are now gone. In fact something like this used to be done as part of the initial commit (blamed below), but it was done in dcbnl_exit() -> dcb_flushapp(), essentially at module_exit time. That became dead code after commit 7a6b6f515f77 ("DCB: fix kconfig option") which essentially merged "tristate config DCB" and "bool config DCBNL" into a single "bool config DCB", so net/dcb/dcbnl.c could not be built as a module anymore. Commit 36b9ad8084bd ("net/dcb: make dcbnl.c explicitly non-modular") recognized this and deleted dcbnl_exit() and dcb_flushapp() altogether, leaving us with the version we have today. Since flushing application table entries can and should be done as soon as the netdevice disappears, fundamentally the commit that is to blame is the one that introduced the design of this API. Fixes: 9ab933ab2cc8 ("dcbnl: add appliction tlv handlers") Signed-off-by: Vladimir Oltean Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/dcb/dcbnl.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) --- a/net/dcb/dcbnl.c +++ b/net/dcb/dcbnl.c @@ -1938,10 +1938,54 @@ int dcb_ieee_delapp(struct net_device *d } EXPORT_SYMBOL(dcb_ieee_delapp); =20 +static void dcbnl_flush_dev(struct net_device *dev) +{ + struct dcb_app_type *itr, *tmp; + + spin_lock(&dcb_lock); + + list_for_each_entry_safe(itr, tmp, &dcb_app_list, list) { + if (itr->ifindex =3D=3D dev->ifindex) { + list_del(&itr->list); + kfree(itr); + } + } + + spin_unlock(&dcb_lock); +} + +static int dcbnl_netdevice_event(struct notifier_block *nb, + unsigned long event, void *ptr) +{ + struct net_device *dev =3D netdev_notifier_info_to_dev(ptr); + + switch (event) { + case NETDEV_UNREGISTER: + if (!dev->dcbnl_ops) + return NOTIFY_DONE; + + dcbnl_flush_dev(dev); + + return NOTIFY_OK; + default: + return NOTIFY_DONE; + } +} + +static struct notifier_block dcbnl_nb __read_mostly =3D { + .notifier_call =3D dcbnl_netdevice_event, +}; + static int __init dcbnl_init(void) { + int err; + INIT_LIST_HEAD(&dcb_app_list); =20 + err =3D register_netdevice_notifier(&dcbnl_nb); + if (err) + return err; + rtnl_register(PF_UNSPEC, RTM_GETDCB, dcb_doit, NULL, NULL); rtnl_register(PF_UNSPEC, RTM_SETDCB, dcb_doit, NULL, NULL); From nobody Tue Jun 23 11:09:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48635C433EF for ; Mon, 7 Mar 2022 09:20:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236446AbiCGJUx (ORCPT ); Mon, 7 Mar 2022 04:20:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236412AbiCGJU1 (ORCPT ); Mon, 7 Mar 2022 04:20:27 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1353C51312; Mon, 7 Mar 2022 01:19:34 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A418AB810BF; Mon, 7 Mar 2022 09:19:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0127C340E9; Mon, 7 Mar 2022 09:19:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644771; bh=EKlNeRm8n7rn3wTopxpaOhV7jlkMIUFOoC8L4W+BktQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=W+ESyYl8IP5PEchnMX9IXKmj265jbseNAoDAhwCJDb2uLKm/5fn6ahA93tt35V8T5 Bc59CLQjXd1J1rbpZVeP2fOq4yp1q6tymV39jhnDCeib2xvvocNtvVG3eyBbxdqKzY VVSWuQb2uXnNXcsAwca1zjhycH/bqkDWcZ6Eye1A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qiushi Wu , "Michael S. Tsirkin" , Sudip Mukherjee Subject: [PATCH 4.9 17/32] firmware: Fix a reference count leak. Date: Mon, 7 Mar 2022 10:18:43 +0100 Message-Id: <20220307091634.929397930@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091634.434478485@linuxfoundation.org> References: <20220307091634.434478485@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Qiushi Wu commit fe3c60684377d5ad9b0569b87ed3e26e12c8173b upstream. kobject_init_and_add() takes reference even when it fails. If this function returns an error, kobject_put() must be called to properly clean up the memory associated with the object. Callback function fw_cfg_sysfs_release_entry() in kobject_put() can handle the pointer "entry" properly. Signed-off-by: Qiushi Wu Link: https://lore.kernel.org/r/20200613190533.15712-1-wu000273@umn.edu Signed-off-by: Michael S. Tsirkin [sudip: adjust context] Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/firmware/qemu_fw_cfg.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/drivers/firmware/qemu_fw_cfg.c +++ b/drivers/firmware/qemu_fw_cfg.c @@ -461,8 +461,10 @@ static int fw_cfg_register_file(const st /* register entry under "/sys/firmware/qemu_fw_cfg/by_key/" */ err =3D kobject_init_and_add(&entry->kobj, &fw_cfg_sysfs_entry_ktype, fw_cfg_sel_ko, "%d", entry->f.select); - if (err) - goto err_register; + if (err) { + kobject_put(&entry->kobj); + return err; + } =20 /* add raw binary content access */ err =3D sysfs_create_bin_file(&entry->kobj, &fw_cfg_sysfs_attr_raw); @@ -478,7 +480,6 @@ static int fw_cfg_register_file(const st =20 err_add_raw: kobject_del(&entry->kobj); -err_register: kfree(entry); return err; } From nobody Tue Jun 23 11:09:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A49CCC433FE for ; Mon, 7 Mar 2022 09:20:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236452AbiCGJU6 (ORCPT ); Mon, 7 Mar 2022 04:20:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236369AbiCGJU3 (ORCPT ); Mon, 7 Mar 2022 04:20:29 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98ECB4DF4C; Mon, 7 Mar 2022 01:19:35 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 32E5761016; Mon, 7 Mar 2022 09:19:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 300F7C340F4; Mon, 7 Mar 2022 09:19:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644774; bh=wghIGJkzpuodDEQFADyhIM+kLpXkawWG1rofmq3dkMY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=riDz0tpj+g63VWQv496gZ8dHIpySKIIA+TGavHyEr2U2UezYo7g6lb+69mvDQbSvl oyfdHG9a3cvFjK1viGjfMWjQjzq2te1Q2slgNkA7udpFH3Q1208NoCgVvoIdhGFnXK 9hto9Zyz1Cxza1V7+crz2/5zj2W8xhDnpWvcLP+M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Gabriel Somlo , Johan Hovold , Sudip Mukherjee Subject: [PATCH 4.9 18/32] firmware: qemu_fw_cfg: fix kobject leak in probe error path Date: Mon, 7 Mar 2022 10:18:44 +0100 Message-Id: <20220307091634.956473211@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091634.434478485@linuxfoundation.org> References: <20220307091634.434478485@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Johan Hovold commit 47a1db8e797da01a1309bf42e0c0d771d4e4d4f3 upstream. An initialised kobject must be freed using kobject_put() to avoid leaking associated resources (e.g. the object name). Commit fe3c60684377 ("firmware: Fix a reference count leak.") "fixed" the leak in the first error path of the file registration helper but left the second one unchanged. This "fix" would however result in a NULL pointer dereference due to the release function also removing the never added entry from the fw_cfg_entry_cache list. This has now been addressed. Fix the remaining kobject leak by restoring the common error path and adding the missing kobject_put(). Fixes: 75f3e8e47f38 ("firmware: introduce sysfs driver for QEMU's fw_cfg de= vice") Cc: stable@vger.kernel.org # 4.6 Cc: Gabriel Somlo Signed-off-by: Johan Hovold Link: https://lore.kernel.org/r/20211201132528.30025-3-johan@kernel.org Signed-off-by: Greg Kroah-Hartman [sudip: adjust context] Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/firmware/qemu_fw_cfg.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) --- a/drivers/firmware/qemu_fw_cfg.c +++ b/drivers/firmware/qemu_fw_cfg.c @@ -461,15 +461,13 @@ static int fw_cfg_register_file(const st /* register entry under "/sys/firmware/qemu_fw_cfg/by_key/" */ err =3D kobject_init_and_add(&entry->kobj, &fw_cfg_sysfs_entry_ktype, fw_cfg_sel_ko, "%d", entry->f.select); - if (err) { - kobject_put(&entry->kobj); - return err; - } + if (err) + goto err_put_entry; =20 /* add raw binary content access */ err =3D sysfs_create_bin_file(&entry->kobj, &fw_cfg_sysfs_attr_raw); if (err) - goto err_add_raw; + goto err_del_entry; =20 /* try adding "/sys/firmware/qemu_fw_cfg/by_name/" symlink */ fw_cfg_build_symlink(fw_cfg_fname_kset, &entry->kobj, entry->f.name); @@ -478,9 +476,10 @@ static int fw_cfg_register_file(const st fw_cfg_sysfs_cache_enlist(entry); return 0; =20 -err_add_raw: +err_del_entry: kobject_del(&entry->kobj); - kfree(entry); +err_put_entry: + kobject_put(&entry->kobj); return err; } From nobody Tue Jun 23 11:09:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CF3A9C433FE for ; Mon, 7 Mar 2022 09:20:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236438AbiCGJVF (ORCPT ); Mon, 7 Mar 2022 04:21:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236434AbiCGJUs (ORCPT ); Mon, 7 Mar 2022 04:20:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 604505133B; Mon, 7 Mar 2022 01:19:38 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EDE7B6101F; Mon, 7 Mar 2022 09:19:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F12D3C340E9; Mon, 7 Mar 2022 09:19:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644777; bh=vCgL2hV3nGo0goigmoCYE77tBg14/GA4u2bI+Jja/Yg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FGcaJGVVagRPThdo5Nqbmw29XQF5tS/YU+Uc5wFfECrPadrjKI5bJVaPaARMffiqz S+o9SJsnT8d7WJOwVatBA+L54vM54/FYUibMPGW0J4R9UKZQzQSiifxRpQtjKEAbXU /fCNDyGi7CeCrG0NcXzxLh+YhVD6HveX5kcgPibU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Remi Pommarel , Nicolas Escande , Johannes Berg Subject: [PATCH 4.9 19/32] mac80211: fix forwarded mesh frames AC & queue selection Date: Mon, 7 Mar 2022 10:18:45 +0100 Message-Id: <20220307091634.985087061@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091634.434478485@linuxfoundation.org> References: <20220307091634.434478485@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 Escande commit 859ae7018316daa4adbc496012dcbbb458d7e510 upstream. There are two problems with the current code that have been highlighted with the AQL feature that is now enbaled by default. First problem is in ieee80211_rx_h_mesh_fwding(), ieee80211_select_queue_80211() is used on received packets to choose the sending AC queue of the forwarding packet although this function should only be called on TX packet (it uses ieee80211_tx_info). This ends with forwarded mesh packets been sent on unrelated random AC queue. To fix that, AC queue can directly be infered from skb->priority which has been extracted from QOS info (see ieee80211_parse_qos()). Second problem is the value of queue_mapping set on forwarded mesh frames via skb_set_queue_mapping() is not the AC of the packet but a hardware queue index. This may or may not work depending on AC to HW queue mapping which is driver specific. Both of these issues lead to improper AC selection while forwarding mesh packets but more importantly due to improper airtime accounting (which is done on a per STA, per AC basis) caused traffic stall with the introduction of AQL. Fixes: cf44012810cc ("mac80211: fix unnecessary frame drops in mesh fwding") Fixes: d3c1597b8d1b ("mac80211: fix forwarded mesh frame queue mapping") Co-developed-by: Remi Pommarel Signed-off-by: Remi Pommarel Signed-off-by: Nicolas Escande Link: https://lore.kernel.org/r/20220214173214.368862-1-nico.escande@gmail.= com Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/mac80211/rx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/net/mac80211/rx.c +++ b/net/mac80211/rx.c @@ -2607,13 +2607,13 @@ ieee80211_rx_h_mesh_fwding(struct ieee80 ether_addr_equal(sdata->vif.addr, hdr->addr3)) return RX_CONTINUE; =20 - ac =3D ieee80211_select_queue_80211(sdata, skb, hdr); + ac =3D ieee802_1d_to_ac[skb->priority]; q =3D sdata->vif.hw_queue[ac]; if (ieee80211_queue_stopped(&local->hw, q)) { IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_congestion); return RX_DROP_MONITOR; } - skb_set_queue_mapping(skb, q); + skb_set_queue_mapping(skb, ac); =20 if (!--mesh_hdr->ttl) { if (!is_multicast_ether_addr(hdr->addr1)) From nobody Tue Jun 23 11:09:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC146C433F5 for ; Mon, 7 Mar 2022 09:20:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236554AbiCGJVX (ORCPT ); Mon, 7 Mar 2022 04:21:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236477AbiCGJUu (ORCPT ); Mon, 7 Mar 2022 04:20:50 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87A78522CC; Mon, 7 Mar 2022 01:19:46 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 17D04B810C2; Mon, 7 Mar 2022 09:19:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D843C340F6; Mon, 7 Mar 2022 09:19:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644783; bh=y9KA5wwVId2J/79PmTHLJjOXo7qU9HSGK1698oX2Oug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vIjpe4eTfpDj7/sMqOk5LL8KOCFIuHhqxObOH+6vgElFj7W15G/qS/tqeC23BDmTZ 5mgVMjxlgU1iDROn7urPcKC04seylGNQY7E1Jbz0PhYQMEXmzvY+sLLbYFZTMc0VUX eKBFwzaxkCF3KCgcxO4/nVzLISiP0e0gWQXLbeHo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , Igor Zhbanov , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Jakub Kicinski Subject: [PATCH 4.9 20/32] net: stmmac: fix return value of __setup handler Date: Mon, 7 Mar 2022 10:18:46 +0100 Message-Id: <20220307091635.013218557@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091634.434478485@linuxfoundation.org> References: <20220307091634.434478485@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 commit e01b042e580f1fbf4fd8da467442451da00c7a90 upstream. __setup() handlers should return 1 on success, i.e., the parameter has been handled. A return of 0 causes the "option=3Dvalue" string to be added to init's environment strings, polluting it. Fixes: 47dd7a540b8a ("net: add support for STMicroelectronics Ethernet cont= rollers.") Fixes: f3240e2811f0 ("stmmac: remove warning when compile as built-in (V2)") Signed-off-by: Randy Dunlap Reported-by: Igor Zhbanov Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru Cc: Giuseppe Cavallaro Cc: Alexandre Torgue Cc: Jose Abreu Link: https://lore.kernel.org/r/20220224033536.25056-1-rdunlap@infradead.org Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3608,7 +3608,7 @@ static int __init stmmac_cmdline_opt(cha char *opt; =20 if (!str || !*str) - return -EINVAL; + return 1; while ((opt =3D strsep(&str, ",")) !=3D NULL) { if (!strncmp(opt, "debug:", 6)) { if (kstrtoint(opt + 6, 0, &debug)) @@ -3639,11 +3639,11 @@ static int __init stmmac_cmdline_opt(cha goto err; } } - return 0; + return 1; =20 err: pr_err("%s: ERROR broken module parameter conversion", __func__); - return -EINVAL; + return 1; } =20 __setup("stmmaceth=3D", stmmac_cmdline_opt); From nobody Tue Jun 23 11:09:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D862C433F5 for ; Mon, 7 Mar 2022 09:20:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236514AbiCGJVd (ORCPT ); Mon, 7 Mar 2022 04:21:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236489AbiCGJUv (ORCPT ); Mon, 7 Mar 2022 04:20:51 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2BDF522EA; Mon, 7 Mar 2022 01:19:47 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 368D76103D; Mon, 7 Mar 2022 09:19:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3A6CDC340E9; Mon, 7 Mar 2022 09:19:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644786; bh=LntkZKegsCyg9u/Sf/iVZ+X529LcGlSxZZxyt8lVe54=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DGPJWj9JI091/rPd+R0LcgVW+VUDfSfGrYrp/wJu6/UL0my18tCEjbP/mj7Ok4Mxg p+mmh/4URW9RtNS6IOku9EhtsAH0jrZR9N1YY+z8jwoKvO4h8DkcivjFn7/EB6siB6 3KdGIXHrqF+wfziLPmH7h7qE9fLDBT8relu15tT4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , Igor Zhbanov , Siva Reddy , Girish K S , Byungho An , Jakub Kicinski Subject: [PATCH 4.9 21/32] net: sxgbe: fix return value of __setup handler Date: Mon, 7 Mar 2022 10:18:47 +0100 Message-Id: <20220307091635.040862260@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091634.434478485@linuxfoundation.org> References: <20220307091634.434478485@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 commit 50e06ddceeea263f57fe92baa677c638ecd65bb6 upstream. __setup() handlers should return 1 on success, i.e., the parameter has been handled. A return of 0 causes the "option=3Dvalue" string to be added to init's environment strings, polluting it. Fixes: acc18c147b22 ("net: sxgbe: add EEE(Energy Efficient Ethernet) for Sa= msung sxgbe") Fixes: 1edb9ca69e8a ("net: sxgbe: add basic framework for Samsung 10Gb ethe= rnet driver") Signed-off-by: Randy Dunlap Reported-by: Igor Zhbanov Link: lore.kernel.org/r/64644a2f-4a20-bab3-1e15-3b2cdd0defe3@omprussia.ru Cc: Siva Reddy Cc: Girish K S Cc: Byungho An Link: https://lore.kernel.org/r/20220224033528.24640-1-rdunlap@infradead.org Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_main.c @@ -2311,18 +2311,18 @@ static int __init sxgbe_cmdline_opt(char char *opt; =20 if (!str || !*str) - return -EINVAL; + return 1; while ((opt =3D strsep(&str, ",")) !=3D NULL) { if (!strncmp(opt, "eee_timer:", 10)) { if (kstrtoint(opt + 10, 0, &eee_timer)) goto err; } } - return 0; + return 1; =20 err: pr_err("%s: ERROR broken module parameter conversion\n", __func__); - return -EINVAL; + return 1; } =20 __setup("sxgbeeth=3D", sxgbe_cmdline_opt); From nobody Tue Jun 23 11:09:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91A60C433F5 for ; Mon, 7 Mar 2022 09:20:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236518AbiCGJVh (ORCPT ); Mon, 7 Mar 2022 04:21:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235472AbiCGJUx (ORCPT ); Mon, 7 Mar 2022 04:20:53 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 854A6522DA; Mon, 7 Mar 2022 01:19:52 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1FDF0B81054; Mon, 7 Mar 2022 09:19:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 651EFC340E9; Mon, 7 Mar 2022 09:19:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644789; bh=hdK4MuXLdl4rqSG8YM/abu1pg43mrcrfmAr0QdbwaS8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kdrg8P9IyZ9c5PMFNYwMK2EyeQrvbry0x2KtNERIb9y1bDcRh2cYqSMyPIZbN4+yx VT+7MtGi4ZPnCIz6ltZLkL+TOmaCCYGSSylMrEThtqNzGGqWm7RNw1DTMi+d9FufYC JxjoqSP9QOmAkDPwoEcrtCUpTn35HnEA/1mn8hk0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheyu Ma , "David S. Miller" Subject: [PATCH 4.9 22/32] net: arcnet: com20020: Fix null-ptr-deref in com20020pci_probe() Date: Mon, 7 Mar 2022 10:18:48 +0100 Message-Id: <20220307091635.069776356@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091634.434478485@linuxfoundation.org> References: <20220307091634.434478485@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zheyu Ma commit bd6f1fd5d33dfe5d1b4f2502d3694a7cc13f166d upstream. During driver initialization, the pointer of card info, i.e. the variable 'ci' is required. However, the definition of 'com20020pci_id_table' reveals that this field is empty for some devices, which will cause null pointer dereference when initializing these devices. The following log reveals it: [ 3.973806] KASAN: null-ptr-deref in range [0x0000000000000028-0x0000000= 00000002f] [ 3.973819] RIP: 0010:com20020pci_probe+0x18d/0x13e0 [com20020_pci] [ 3.975181] Call Trace: [ 3.976208] local_pci_probe+0x13f/0x210 [ 3.977248] pci_device_probe+0x34c/0x6d0 [ 3.977255] ? pci_uevent+0x470/0x470 [ 3.978265] really_probe+0x24c/0x8d0 [ 3.978273] __driver_probe_device+0x1b3/0x280 [ 3.979288] driver_probe_device+0x50/0x370 Fix this by checking whether the 'ci' is a null pointer first. Fixes: 8c14f9c70327 ("ARCNET: add com20020 PCI IDs with metadata") Signed-off-by: Zheyu Ma Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/arcnet/com20020-pci.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/net/arcnet/com20020-pci.c +++ b/drivers/net/arcnet/com20020-pci.c @@ -115,6 +115,9 @@ static int com20020pci_probe(struct pci_ return -ENOMEM; =20 ci =3D (struct com20020_pci_card_info *)id->driver_data; + if (!ci) + return -EINVAL; + priv->ci =3D ci; mm =3D &ci->misc_map; From nobody Tue Jun 23 11:09:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88D4CC433EF for ; Mon, 7 Mar 2022 09:20:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236598AbiCGJVp (ORCPT ); Mon, 7 Mar 2022 04:21:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236461AbiCGJUy (ORCPT ); Mon, 7 Mar 2022 04:20:54 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5505549913; Mon, 7 Mar 2022 01:19:55 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1090FB810BD; Mon, 7 Mar 2022 09:19:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6628DC340E9; Mon, 7 Mar 2022 09:19:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644792; bh=EWQa5r9e93SJmy+EJGlMIbPR/OtWqdd39e8vMt+MA2E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tNNh73uzKIIXSNiVdnfxuLeO/9wvojMGB+2vDrt50/ziqKXfBN6R2NvFI7kyLJPgZ xtJZ/LaDm+2TuF7jySQRtuHuvY0HPK/HywliwMb+Yn5SJK/dbY1TfxUtkdLejoW/c8 6wKnsWkvHdv1CuDSzPdqLz3CFD3wNWsd5ioR+ksM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jann Horn , Ard Biesheuvel Subject: [PATCH 4.9 23/32] efivars: Respect "block" flag in efivar_entry_set_safe() Date: Mon, 7 Mar 2022 10:18:49 +0100 Message-Id: <20220307091635.096966375@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091634.434478485@linuxfoundation.org> References: <20220307091634.434478485@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jann Horn commit 258dd902022cb10c83671176688074879517fd21 upstream. When the "block" flag is false, the old code would sometimes still call check_var_size(), which wrongly tells ->query_variable_store() that it can block. As far as I can tell, this can't really materialize as a bug at the moment, because ->query_variable_store only does something on X86 with generic EFI, and in that configuration we always take the efivar_entry_set_nonblocking() path. Fixes: ca0e30dcaa53 ("efi: Add nonblocking option to efi_query_variable_sto= re()") Signed-off-by: Jann Horn Signed-off-by: Ard Biesheuvel Link: https://lore.kernel.org/r/20220218180559.1432559-1-jannh@google.com Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/firmware/efi/vars.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/firmware/efi/vars.c +++ b/drivers/firmware/efi/vars.c @@ -763,6 +763,7 @@ int efivar_entry_set_safe(efi_char16_t * { const struct efivar_operations *ops; efi_status_t status; + unsigned long varsize; =20 if (!__efivars) return -EINVAL; @@ -785,15 +786,17 @@ int efivar_entry_set_safe(efi_char16_t * return efivar_entry_set_nonblocking(name, vendor, attributes, size, data); =20 + varsize =3D size + ucs2_strsize(name, 1024); if (!block) { if (down_trylock(&efivars_lock)) return -EBUSY; + status =3D check_var_size_nonblocking(attributes, varsize); } else { if (down_interruptible(&efivars_lock)) return -EINTR; + status =3D check_var_size(attributes, varsize); } =20 - status =3D check_var_size(attributes, size + ucs2_strsize(name, 1024)); if (status !=3D EFI_SUCCESS) { up(&efivars_lock); return -ENOSPC; From nobody Tue Jun 23 11:09:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A839C433EF for ; Mon, 7 Mar 2022 09:20:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235703AbiCGJVs (ORCPT ); Mon, 7 Mar 2022 04:21:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236458AbiCGJUz (ORCPT ); Mon, 7 Mar 2022 04:20:55 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC9F652E0C; Mon, 7 Mar 2022 01:19:58 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 81015B810B2; Mon, 7 Mar 2022 09:19:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3F97C340F3; Mon, 7 Mar 2022 09:19:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644796; bh=iBvjP1rGofaAshTMa1YLhVUOkhCZApTWJjLw46wGUmo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hKm9LpGjIRIPhtorSh93goe+wmdRxnSxk5y9rn6BPkcYJIVSQjU+3C2jjh1l68Uuh 9BhGJa+BYog1cLwHXG+zOLAEMZTfBw0o2B1Yv8OhZfAt3LMKIFJ2alJmEVysUbBMR9 GCY7ED19860VymjJj3WRaCLbJBhNS9zQKVatAc1M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Mailhol , Marc Kleine-Budde Subject: [PATCH 4.9 24/32] can: gs_usb: change active_channelss type from atomic_t to u8 Date: Mon, 7 Mar 2022 10:18:50 +0100 Message-Id: <20220307091635.123858288@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091634.434478485@linuxfoundation.org> References: <20220307091634.434478485@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vincent Mailhol commit 035b0fcf02707d3c9c2890dc1484b11aa5335eb1 upstream. The driver uses an atomic_t variable: gs_usb:active_channels to keep track of the number of opened channels in order to only allocate memory for the URBs when this count changes from zero to one. However, the driver does not decrement the counter when an error occurs in gs_can_open(). This issue is fixed by changing the type from atomic_t to u8 and by simplifying the logic accordingly. It is safe to use an u8 here because the network stack big kernel lock (a.k.a. rtnl_mutex) is being hold. For details, please refer to [1]. [1] https://lore.kernel.org/linux-can/CAMZ6Rq+sHpiw34ijPsmp7vbUpDtJwvVtdV7C= vRZJsLixjAFfrg@mail.gmail.com/T/#t Fixes: d08e973a77d1 ("can: gs_usb: Added support for the GS_USB CAN devices= ") Link: https://lore.kernel.org/all/20220214234814.1321599-1-mailhol.vincent@= wanadoo.fr Signed-off-by: Vincent Mailhol Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/can/usb/gs_usb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) --- a/drivers/net/can/usb/gs_usb.c +++ b/drivers/net/can/usb/gs_usb.c @@ -198,8 +198,8 @@ struct gs_can { struct gs_usb { struct gs_can *canch[GS_MAX_INTF]; struct usb_anchor rx_submitted; - atomic_t active_channels; struct usb_device *udev; + u8 active_channels; }; =20 /* 'allocate' a tx context. @@ -597,7 +597,7 @@ static int gs_can_open(struct net_device if (rc) return rc; =20 - if (atomic_add_return(1, &parent->active_channels) =3D=3D 1) { + if (!parent->active_channels) { for (i =3D 0; i < GS_MAX_RX_URBS; i++) { struct urb *urb; u8 *buf; @@ -698,6 +698,7 @@ static int gs_can_open(struct net_device =20 dev->can.state =3D CAN_STATE_ERROR_ACTIVE; =20 + parent->active_channels++; if (!(dev->can.ctrlmode & CAN_CTRLMODE_LISTENONLY)) netif_start_queue(netdev); =20 @@ -713,7 +714,8 @@ static int gs_can_close(struct net_devic netif_stop_queue(netdev); =20 /* Stop polling */ - if (atomic_dec_and_test(&parent->active_channels)) + parent->active_channels--; + if (!parent->active_channels) usb_kill_anchored_urbs(&parent->rx_submitted); =20 /* Stop sending URBs */ @@ -992,8 +994,6 @@ static int gs_usb_probe(struct usb_inter =20 init_usb_anchor(&dev->rx_submitted); =20 - atomic_set(&dev->active_channels, 0); - usb_set_intfdata(intf, dev); dev->udev =3D interface_to_usbdev(intf); From nobody Tue Jun 23 11:09:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 834A4C433F5 for ; Mon, 7 Mar 2022 09:21:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236522AbiCGJVz (ORCPT ); Mon, 7 Mar 2022 04:21:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236433AbiCGJVA (ORCPT ); Mon, 7 Mar 2022 04:21:00 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 684DC52E41; Mon, 7 Mar 2022 01:20:00 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 025036102A; Mon, 7 Mar 2022 09:20:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D698C340E9; Mon, 7 Mar 2022 09:19:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644799; bh=w/LSniU9HL7T8izO5RIoccVJlyRX4WWQVkesBO8mLoU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AK2wbqW10TMccMvsTAaD5wbBQ0MZvJ/5tpjQwsD5X/dqTlz5uZt/a4tLA+4HAqP+O HmFz30XGO66jBOWD9EkuuTlnP0jePpWOm5lLMh3VeAIfjLtZaad8W2hYEMCrJCsq/i HiUTGuKU8wYFkmDCcqExomyD+ZvLJdxZmbhYfV0E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , Igor Zhbanov , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , linux-arm-kernel@lists.infradead.org, patches@armlinux.org.uk, "Russell King (Oracle)" Subject: [PATCH 4.9 25/32] ARM: 9182/1: mmu: fix returns from early_param() and __setup() functions Date: Mon, 7 Mar 2022 10:18:51 +0100 Message-Id: <20220307091635.153023221@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091634.434478485@linuxfoundation.org> References: <20220307091634.434478485@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: Randy Dunlap commit 7b83299e5b9385943a857d59e15cba270df20d7e upstream. early_param() handlers should return 0 on success. __setup() handlers should return 1 on success, i.e., the parameter has been handled. A return of 0 would cause the "option=3Dvalue" string to be added to init's environment strings, polluting it. ../arch/arm/mm/mmu.c: In function 'test_early_cachepolicy': ../arch/arm/mm/mmu.c:215:1: error: no return statement in function returnin= g non-void [-Werror=3Dreturn-type] ../arch/arm/mm/mmu.c: In function 'test_noalign_setup': ../arch/arm/mm/mmu.c:221:1: error: no return statement in function returnin= g non-void [-Werror=3Dreturn-type] Fixes: b849a60e0903 ("ARM: make cr_alignment read-only #ifndef CONFIG_CPU_C= P15") Signed-off-by: Randy Dunlap Reported-by: Igor Zhbanov Cc: Uwe Kleine-K=C3=B6nig Cc: linux-arm-kernel@lists.infradead.org Cc: patches@armlinux.org.uk Signed-off-by: Russell King (Oracle) Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- arch/arm/mm/mmu.c | 2 ++ 1 file changed, 2 insertions(+) --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -228,12 +228,14 @@ early_param("ecc", early_ecc); static int __init early_cachepolicy(char *p) { pr_warn("cachepolicy kernel parameter not supported without cp15\n"); + return 0; } early_param("cachepolicy", early_cachepolicy); =20 static int __init noalign_setup(char *__unused) { pr_warn("noalign kernel parameter not supported without cp15\n"); + return 1; } __setup("noalign", noalign_setup); =20 From nobody Tue Jun 23 11:09:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 90CE0C433EF for ; Mon, 7 Mar 2022 09:21:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236545AbiCGJV6 (ORCPT ); Mon, 7 Mar 2022 04:21:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236566AbiCGJVZ (ORCPT ); Mon, 7 Mar 2022 04:21:25 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1001532C0; Mon, 7 Mar 2022 01:20:04 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5E5DBB810BF; Mon, 7 Mar 2022 09:20:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C36FEC340E9; Mon, 7 Mar 2022 09:20:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644802; bh=8HVQ0bK50UVVZlUYGGpvPde5Jchndo2Q57B4WADFTzI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aP1NcW7MzuQZLWJeyJBnZuFWTuQO3yhyowCgbzgr6mEv88OnJyfYi2sa36M6VYk4J wpbT3ND4KSnWe48NkvNwl8ouMpyBni196ZmDIpT21SmdwF91UItJH7XWEYTRDYehuz xIGC8WXvO0gRn/sv+SMEg6o4P4rBHXW1Tj3n78VA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Li Yang , Sasha Levin Subject: [PATCH 4.9 26/32] soc: fsl: qe: Check of ioremap return value Date: Mon, 7 Mar 2022 10:18:52 +0100 Message-Id: <20220307091635.182258183@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091634.434478485@linuxfoundation.org> References: <20220307091634.434478485@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 a222fd8541394b36b13c89d1698d9530afd59a9c ] As the possible failure of the ioremap(), the par_io could be NULL. Therefore it should be better to check it and return error in order to guarantee the success of the initiation. But, I also notice that all the caller like mpc85xx_qe_par_io_init() in `arch/powerpc/platforms/85xx/common.c` don't check the return value of the par_io_init(). Actually, par_io_init() needs to check to handle the potential error. I will submit another patch to fix that. Anyway, par_io_init() itsely should be fixed. Fixes: 7aa1aa6ecec2 ("QE: Move QE from arch/powerpc to drivers/soc") Signed-off-by: Jiasheng Jiang Signed-off-by: Li Yang Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/soc/fsl/qe/qe_io.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/soc/fsl/qe/qe_io.c b/drivers/soc/fsl/qe/qe_io.c index 7ae59abc7863..127a4a836e67 100644 --- a/drivers/soc/fsl/qe/qe_io.c +++ b/drivers/soc/fsl/qe/qe_io.c @@ -41,6 +41,8 @@ int par_io_init(struct device_node *np) if (ret) return ret; par_io =3D ioremap(res.start, resource_size(&res)); + if (!par_io) + return -ENOMEM; =20 num_ports =3D of_get_property(np, "num-ports", NULL); if (num_ports) --=20 2.34.1 From nobody Tue Jun 23 11:09:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3C1FC433FE for ; Mon, 7 Mar 2022 09:21:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236575AbiCGJWC (ORCPT ); Mon, 7 Mar 2022 04:22:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231336AbiCGJV0 (ORCPT ); Mon, 7 Mar 2022 04:21:26 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DEAA53E1F; Mon, 7 Mar 2022 01:20:06 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AD97F60FF6; Mon, 7 Mar 2022 09:20:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1F8BC340F3; Mon, 7 Mar 2022 09:20:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644805; bh=H4TVj+cf/uNrpTzIJj6dLxFemyB75Dl783yOAYEYQhQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j2fnjQILFAm6Fkc0VOun5+rveLpynMFoFr1apE+ogIMGdR3VFu1lOZEE/cSkLS7dw bHxy4NoacDH1xH1V20710CpUHuZ8K4uwz2EuSIovbX0kQfIMVVKJeYPDLYf5vMgZa8 gqC2/M36X+G9TB9ls49Fal2Qx+4PSn2BXqstlvDU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, TOTE Robot , Jia-Ju Bai , "David S. Miller" , Sasha Levin Subject: [PATCH 4.9 27/32] net: chelsio: cxgb3: check the return value of pci_find_capability() Date: Mon, 7 Mar 2022 10:18:53 +0100 Message-Id: <20220307091635.210152083@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091634.434478485@linuxfoundation.org> References: <20220307091634.434478485@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jia-Ju Bai [ Upstream commit 767b9825ed1765894e569a3d698749d40d83762a ] The function pci_find_capability() in t3_prep_adapter() can fail, so its return value should be checked. Fixes: 4d22de3e6cc4 ("Add support for the latest 1G/10G Chelsio adapter, T3= ") Reported-by: TOTE Robot Signed-off-by: Jia-Ju Bai Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Florian Fainelli Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/net/ethernet/chelsio/cxgb3/t3_hw.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c b/drivers/net/ether= net/chelsio/cxgb3/t3_hw.c index a89721fad633..29220141e4e4 100644 --- a/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c +++ b/drivers/net/ethernet/chelsio/cxgb3/t3_hw.c @@ -3677,6 +3677,8 @@ int t3_prep_adapter(struct adapter *adapter, const st= ruct adapter_info *ai, MAC_STATS_ACCUM_SECS : (MAC_STATS_ACCUM_SECS * 10); adapter->params.pci.vpd_cap_addr =3D pci_find_capability(adapter->pdev, PCI_CAP_ID_VPD); + if (!adapter->params.pci.vpd_cap_addr) + return -ENODEV; ret =3D get_vpd_params(adapter, &adapter->params.vpd); if (ret < 0) return ret; --=20 2.34.1 From nobody Tue Jun 23 11:09:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E281DC433F5 for ; Mon, 7 Mar 2022 09:21:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236488AbiCGJWK (ORCPT ); Mon, 7 Mar 2022 04:22:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236591AbiCGJVo (ORCPT ); Mon, 7 Mar 2022 04:21:44 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 456B765433; Mon, 7 Mar 2022 01:20:14 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A9F6561029; Mon, 7 Mar 2022 09:20:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4B04C340F4; Mon, 7 Mar 2022 09:20:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644813; bh=2gO547OLSlpbogOwW/5AiNadq3GKTKLPFPNb1dAQYO4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ui7ncDp9vfZXHmbfnmTzHPD9o9GsylmWcNYTKCqh744DC9Z6JfAaFv14m67XdpKhh ZA98vyfdLxQUEVViZX4bY8Ug/WIdtrnquM0tQGkKXmCHEPB/S3Y/4G0OpFjwE7xUOj wtEBqcyb3YqhxG28cly6aUGOI1zqgMFrCqu+hGvE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Dmitry Torokhov Subject: [PATCH 4.9 28/32] Input: elan_i2c - move regulator_[en|dis]able() out of elan_[en|dis]able_power() Date: Mon, 7 Mar 2022 10:18:54 +0100 Message-Id: <20220307091635.237206483@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091634.434478485@linuxfoundation.org> References: <20220307091634.434478485@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans de Goede commit 81a36d8ce554b82b0a08e2b95d0bd44fcbff339b upstream. elan_disable_power() is called conditionally on suspend, where as elan_enable_power() is always called on resume. This leads to an imbalance in the regulator's enable count. Move the regulator_[en|dis]able() calls out of elan_[en|dis]able_power() in preparation of fixing this. No functional changes intended. Signed-off-by: Hans de Goede Link: https://lore.kernel.org/r/20220131135436.29638-1-hdegoede@redhat.com [dtor: consolidate elan_[en|dis]able() into elan_set_power()] Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/input/mouse/elan_i2c_core.c | 62 ++++++++++++-------------------= ----- 1 file changed, 22 insertions(+), 40 deletions(-) --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c @@ -132,55 +132,21 @@ static int elan_get_fwinfo(u8 iap_versio return 0; } =20 -static int elan_enable_power(struct elan_tp_data *data) +static int elan_set_power(struct elan_tp_data *data, bool on) { int repeat =3D ETP_RETRY_COUNT; int error; =20 - error =3D regulator_enable(data->vcc); - if (error) { - dev_err(&data->client->dev, - "failed to enable regulator: %d\n", error); - return error; - } - do { - error =3D data->ops->power_control(data->client, true); + error =3D data->ops->power_control(data->client, on); if (error >=3D 0) return 0; =20 msleep(30); } while (--repeat > 0); =20 - dev_err(&data->client->dev, "failed to enable power: %d\n", error); - return error; -} - -static int elan_disable_power(struct elan_tp_data *data) -{ - int repeat =3D ETP_RETRY_COUNT; - int error; - - do { - error =3D data->ops->power_control(data->client, false); - if (!error) { - error =3D regulator_disable(data->vcc); - if (error) { - dev_err(&data->client->dev, - "failed to disable regulator: %d\n", - error); - /* Attempt to power the chip back up */ - data->ops->power_control(data->client, true); - break; - } - - return 0; - } - - msleep(30); - } while (--repeat > 0); - - dev_err(&data->client->dev, "failed to disable power: %d\n", error); + dev_err(&data->client->dev, "failed to set power %s: %d\n", + on ? "on" : "off", error); return error; } =20 @@ -1195,9 +1161,19 @@ static int __maybe_unused elan_suspend(s /* Enable wake from IRQ */ data->irq_wake =3D (enable_irq_wake(client->irq) =3D=3D 0); } else { - ret =3D elan_disable_power(data); + ret =3D elan_set_power(data, false); + if (ret) + goto err; + + ret =3D regulator_disable(data->vcc); + if (ret) { + dev_err(dev, "error %d disabling regulator\n", ret); + /* Attempt to power the chip back up */ + elan_set_power(data, true); + } } =20 +err: mutex_unlock(&data->sysfs_mutex); return ret; } @@ -1213,7 +1189,13 @@ static int __maybe_unused elan_resume(st data->irq_wake =3D false; } =20 - error =3D elan_enable_power(data); + error =3D regulator_enable(data->vcc); + if (error) { + dev_err(dev, "error %d enabling regulator\n", error); + goto err; + } + + error =3D elan_set_power(data, true); if (error) { dev_err(dev, "power up when resuming failed: %d\n", error); goto err; From nobody Tue Jun 23 11:09:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA5CBC433F5 for ; Mon, 7 Mar 2022 09:21:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236656AbiCGJWT (ORCPT ); Mon, 7 Mar 2022 04:22:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236600AbiCGJVp (ORCPT ); Mon, 7 Mar 2022 04:21:45 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3358F6578F; Mon, 7 Mar 2022 01:20:17 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9149761015; Mon, 7 Mar 2022 09:20:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9EAA2C340F3; Mon, 7 Mar 2022 09:20:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644816; bh=aEuGtaH+pzgMEYr/ie4R5dIEbmvkR7gT5wVusq4ep4s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NXArMbF1Z9RiA1jhiyoGaPavHsmxsZN7eEl4Yk48ymODQ/yAZxPJQ8fOvKovynVeW eIw3zMh5bOCW0oLipjFblfNl75PiHn5Fh6ooggk8QVidOSlS84AgLi/KVknjCKJdTH a6sDISuebQE3M/PAcuWkDHNGY4kEN1lqaoX4PRW0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans de Goede , Dmitry Torokhov Subject: [PATCH 4.9 29/32] Input: elan_i2c - fix regulator enable count imbalance after suspend/resume Date: Mon, 7 Mar 2022 10:18:55 +0100 Message-Id: <20220307091635.265451948@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091634.434478485@linuxfoundation.org> References: <20220307091634.434478485@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hans de Goede commit 04b7762e37c95d9b965d16bb0e18dbd1fa2e2861 upstream. Before these changes elan_suspend() would only disable the regulator when device_may_wakeup() returns false; whereas elan_resume() would unconditionally enable it, leading to an enable count imbalance when device_may_wakeup() returns true. This triggers the "WARN_ON(regulator->enable_count)" in regulator_put() when the elan_i2c driver gets unbound, this happens e.g. with the hot-plugable dock with Elan I2C touchpad for the Asus TF103C 2-in-1. Fix this by making the regulator_enable() call also be conditional on device_may_wakeup() returning false. Signed-off-by: Hans de Goede Link: https://lore.kernel.org/r/20220131135436.29638-2-hdegoede@redhat.com Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/input/mouse/elan_i2c_core.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c @@ -1184,17 +1184,17 @@ static int __maybe_unused elan_resume(st struct elan_tp_data *data =3D i2c_get_clientdata(client); int error; =20 - if (device_may_wakeup(dev) && data->irq_wake) { + if (!device_may_wakeup(dev)) { + error =3D regulator_enable(data->vcc); + if (error) { + dev_err(dev, "error %d enabling regulator\n", error); + goto err; + } + } else if (data->irq_wake) { disable_irq_wake(client->irq); data->irq_wake =3D false; } =20 - error =3D regulator_enable(data->vcc); - if (error) { - dev_err(dev, "error %d enabling regulator\n", error); - goto err; - } - error =3D elan_set_power(data, true); if (error) { dev_err(dev, "power up when resuming failed: %d\n", error); From nobody Tue Jun 23 11:09:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0A96BC433F5 for ; Mon, 7 Mar 2022 09:21:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236634AbiCGJW1 (ORCPT ); Mon, 7 Mar 2022 04:22:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236630AbiCGJWE (ORCPT ); Mon, 7 Mar 2022 04:22:04 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E88AB6621E; Mon, 7 Mar 2022 01:20:24 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 96ECAB810BD; Mon, 7 Mar 2022 09:20:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0001FC340E9; Mon, 7 Mar 2022 09:20:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644822; bh=3nyyhG8mEedFzdLoB7Y/fMxZd+KD3iJrmNB4FdbsMic=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L3eIsGRjjE2EJ9ku4oW45++LRZ8KIbMCSN1VW6HimcA61nnV69M3I2Zurs4OuY+cl QLtaSrVIWRweITsPR4/gY/TtOlkOu8++pM8LKVWD36tKuyDondLxMr+esKi2yg5n1x 4dt+zLMb9XU0p1X9TPQaSdWoFlRISsSEe5jS854o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, William Mahon , Benjamin Tissoires , Dmitry Torokhov Subject: [PATCH 4.9 30/32] HID: add mapping for KEY_ALL_APPLICATIONS Date: Mon, 7 Mar 2022 10:18:56 +0100 Message-Id: <20220307091635.292689667@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091634.434478485@linuxfoundation.org> References: <20220307091634.434478485@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: William Mahon commit 327b89f0acc4c20a06ed59e4d9af7f6d804dc2e2 upstream. This patch adds a new key definition for KEY_ALL_APPLICATIONS and aliases KEY_DASHBOARD to it. It also maps the 0x0c/0x2a2 usage code to KEY_ALL_APPLICATIONS. Signed-off-by: William Mahon Acked-by: Benjamin Tissoires Link: https://lore.kernel.org/r/20220303035618.1.I3a7746ad05d270161a18334ae= 06e3b6db1a1d339@changeid Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- drivers/hid/hid-debug.c | 4 +++- drivers/hid/hid-input.c | 2 ++ include/uapi/linux/input-event-codes.h | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) --- a/drivers/hid/hid-debug.c +++ b/drivers/hid/hid-debug.c @@ -833,7 +833,9 @@ static const char *keys[KEY_MAX + 1] =3D { [KEY_F22] =3D "F22", [KEY_F23] =3D "F23", [KEY_F24] =3D "F24", [KEY_PLAYCD] =3D "PlayCD", [KEY_PAUSECD] =3D "PauseCD", [KEY_PROG3] =3D "Prog3", - [KEY_PROG4] =3D "Prog4", [KEY_SUSPEND] =3D "Suspend", + [KEY_PROG4] =3D "Prog4", + [KEY_ALL_APPLICATIONS] =3D "AllApplications", + [KEY_SUSPEND] =3D "Suspend", [KEY_CLOSE] =3D "Close", [KEY_PLAY] =3D "Play", [KEY_FASTFORWARD] =3D "FastForward", [KEY_BASSBOOST] =3D "BassBoost", [KEY_PRINT] =3D "Print", [KEY_HP] =3D "HP", --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c @@ -937,6 +937,8 @@ static void hidinput_configure_usage(str case 0x28b: map_key_clear(KEY_FORWARDMAIL); break; case 0x28c: map_key_clear(KEY_SEND); break; =20 + case 0x2a2: map_key_clear(KEY_ALL_APPLICATIONS); break; + case 0x2c7: map_key_clear(KEY_KBDINPUTASSIST_PREV); break; case 0x2c8: map_key_clear(KEY_KBDINPUTASSIST_NEXT); break; case 0x2c9: map_key_clear(KEY_KBDINPUTASSIST_PREVGROUP); break; --- a/include/uapi/linux/input-event-codes.h +++ b/include/uapi/linux/input-event-codes.h @@ -277,7 +277,8 @@ #define KEY_PAUSECD 201 #define KEY_PROG3 202 #define KEY_PROG4 203 -#define KEY_DASHBOARD 204 /* AL Dashboard */ +#define KEY_ALL_APPLICATIONS 204 /* AC Desktop Show All Applications */ +#define KEY_DASHBOARD KEY_ALL_APPLICATIONS #define KEY_SUSPEND 205 #define KEY_CLOSE 206 /* AC Close */ #define KEY_PLAY 207 From nobody Tue Jun 23 11:09:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C50FEC433EF for ; Mon, 7 Mar 2022 09:21:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236591AbiCGJWe (ORCPT ); Mon, 7 Mar 2022 04:22:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236585AbiCGJWG (ORCPT ); Mon, 7 Mar 2022 04:22:06 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5041F66608; Mon, 7 Mar 2022 01:20:28 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0BC14B810C2; Mon, 7 Mar 2022 09:20:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E97BFC340E9; Mon, 7 Mar 2022 09:20:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644825; bh=PZvMsgCi9WxB8C/9nmbvpKu+4Ec0qTUjUX+o2X8/BsQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h7Kh8aWht0RgJ2Jke/CMaRj8JIyoZXkhom0WyXEIV/wiGtAZ4wg/7SxgWkadLnQ/u lAEo5/amyvM32wF+7Mk8hjwKBJTs87hK6MZ33Q9dAyap/Kt/jiz1YUo90JlNwkFLga ZuIdg35GcaoXtPzxGQXDkJExt6mDuS1oTvyfUAXI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hugh Dickins , Zeal Robot , wangyong , Mike Kravetz , "Matthew Wilcox (Oracle)" , CGEL ZTE , "Kirill A. Shutemov" , Song Liu , Yang Yang , Andrew Morton , Linus Torvalds Subject: [PATCH 4.9 31/32] memfd: fix F_SEAL_WRITE after shmem huge page allocated Date: Mon, 7 Mar 2022 10:18:57 +0100 Message-Id: <20220307091635.323434658@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091634.434478485@linuxfoundation.org> References: <20220307091634.434478485@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hugh Dickins commit f2b277c4d1c63a85127e8aa2588e9cc3bd21cb99 upstream. Wangyong reports: after enabling tmpfs filesystem to support transparent hugepage with the following command: echo always > /sys/kernel/mm/transparent_hugepage/shmem_enabled the docker program tries to add F_SEAL_WRITE through the following command, but it fails unexpectedly with errno EBUSY: fcntl(5, F_ADD_SEALS, F_SEAL_WRITE) =3D -1. That is because memfd_tag_pins() and memfd_wait_for_pins() were never updated for shmem huge pages: checking page_mapcount() against page_count() is hopeless on THP subpages - they need to check total_mapcount() against page_count() on THP heads only. Make memfd_tag_pins() (compared > 1) as strict as memfd_wait_for_pins() (compared !=3D 1): either can be justified, but given the non-atomic total_mapcount() calculation, it is better now to be strict. Bear in mind that total_mapcount() itself scans all of the THP subpages, when choosing to take an XA_CHECK_SCHED latency break. Also fix the unlikely xa_is_value() case in memfd_wait_for_pins(): if a page has been swapped out since memfd_tag_pins(), then its refcount must have fallen, and so it can safely be untagged. Link: https://lkml.kernel.org/r/a4f79248-df75-2c8c-3df-ba3317ccb5da@google.= com Signed-off-by: Hugh Dickins Reported-by: Zeal Robot Reported-by: wangyong Cc: Mike Kravetz Cc: Matthew Wilcox (Oracle) Cc: CGEL ZTE Cc: Kirill A. Shutemov Cc: Song Liu Cc: Yang Yang Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- mm/shmem.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) --- a/mm/shmem.c +++ b/mm/shmem.c @@ -2478,7 +2478,8 @@ static void shmem_tag_pins(struct addres slot =3D radix_tree_iter_retry(&iter); continue; } - } else if (page_count(page) - page_mapcount(page) > 1) { + } else if (!PageTail(page) && page_count(page) !=3D + hpage_nr_pages(page) + total_mapcount(page)) { radix_tree_tag_set(&mapping->page_tree, iter.index, SHMEM_TAG_PINNED); } @@ -2538,8 +2539,8 @@ static int shmem_wait_for_pins(struct ad page =3D NULL; } =20 - if (page && - page_count(page) - page_mapcount(page) !=3D 1) { + if (page && page_count(page) !=3D + hpage_nr_pages(page) + total_mapcount(page)) { if (scan < LAST_SCAN) goto continue_resched; From nobody Tue Jun 23 11:09:27 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D5DBC433FE for ; Mon, 7 Mar 2022 09:21:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236613AbiCGJWh (ORCPT ); Mon, 7 Mar 2022 04:22:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236596AbiCGJWR (ORCPT ); Mon, 7 Mar 2022 04:22:17 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9520A6662A; Mon, 7 Mar 2022 01:20:31 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 45507B81054; Mon, 7 Mar 2022 09:20:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 730FBC340E9; Mon, 7 Mar 2022 09:20:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1646644828; bh=tohyZRhddFOBEy3gO5lm9g2AbMMXdntkNRSQfG7NnjQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sdIEpxWQvbf0i5E56MqkCPIx9lVSZYExpxQ/S9oVeLjnnX6bgEESLPOO9jCzzb/rk QHVsTBqGzj7ZsLbypMPYCFPkREkNYOLNLLoptw1Qk5ynSYLVtuw814JFBMjyEpuvRs rChmU8V3VyQcN7p6hyaDt4R3Ik+WNveV5+/ptn5U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ido Schimmel , Vladimir Oltean , Jakub Kicinski Subject: [PATCH 4.9 32/32] net: dcb: disable softirqs in dcbnl_flush_dev() Date: Mon, 7 Mar 2022 10:18:58 +0100 Message-Id: <20220307091635.351396827@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220307091634.434478485@linuxfoundation.org> References: <20220307091634.434478485@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-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 commit 10b6bb62ae1a49ee818fc479cf57b8900176773e upstream. Ido Schimmel points out that since commit 52cff74eef5d ("dcbnl : Disable software interrupts before taking dcb_lock"), the DCB API can be called by drivers from softirq context. One such in-tree example is the chelsio cxgb4 driver: dcb_rpl -> cxgb4_dcb_handle_fw_update -> dcb_ieee_setapp If the firmware for this driver happened to send an event which resulted in a call to dcb_ieee_setapp() at the exact same time as another DCB-enabled interface was unregistering on the same CPU, the softirq would deadlock, because the interrupted process was already holding the dcb_lock in dcbnl_flush_dev(). Fix this unlikely event by using spin_lock_bh() in dcbnl_flush_dev() as in the rest of the dcbnl code. Fixes: 91b0383fef06 ("net: dcb: flush lingering app table entries for unreg= istered devices") Reported-by: Ido Schimmel Signed-off-by: Vladimir Oltean Link: https://lore.kernel.org/r/20220302193939.1368823-1-vladimir.oltean@nx= p.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Florian Fainelli Tested-by: Linux Kernel Functional Testing Tested-by: Shuah Khan --- net/dcb/dcbnl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/net/dcb/dcbnl.c +++ b/net/dcb/dcbnl.c @@ -1942,7 +1942,7 @@ static void dcbnl_flush_dev(struct net_d { struct dcb_app_type *itr, *tmp; =20 - spin_lock(&dcb_lock); + spin_lock_bh(&dcb_lock); =20 list_for_each_entry_safe(itr, tmp, &dcb_app_list, list) { if (itr->ifindex =3D=3D dev->ifindex) { @@ -1951,7 +1951,7 @@ static void dcbnl_flush_dev(struct net_d } } =20 - spin_unlock(&dcb_lock); + spin_unlock_bh(&dcb_lock); } =20 static int dcbnl_netdevice_event(struct notifier_block *nb,