From nobody Thu Dec 18 22:29:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4DC4C433F5 for ; Mon, 3 Oct 2022 07:45:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232174AbiJCHpd (ORCPT ); Mon, 3 Oct 2022 03:45:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232280AbiJCHoD (ORCPT ); Mon, 3 Oct 2022 03:44:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA62A5725D; Mon, 3 Oct 2022 00:25:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E508A60FAD; Mon, 3 Oct 2022 07:24:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 008A3C433D6; Mon, 3 Oct 2022 07:24:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781866; bh=qA2SnoDnpquwixj7PTXMJPnHgXspquqBBBYQXotvYNU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LS0dXCE6uwrmoD4G1gZ4w6KAOqIb/1q7Yfq/2Ng1n085sClCxg0f1isD2SfdupMc9 pS7oCRj6zMkyMiT5CUpfCh613RCaMr8C7M8ywf86Pe/+bgbwYrwDLVC3X3wDL0t0Ng Sug2jyXeSh1t+M9SZ67k7pVvVsXemenBQbBuoxbs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern , stable , Hongling Zeng Subject: [PATCH 4.19 01/25] uas: add no-uas quirk for Hiksemi usb_disk Date: Mon, 3 Oct 2022 09:12:04 +0200 Message-Id: <20221003070715.450420206@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070715.406550966@linuxfoundation.org> References: <20221003070715.406550966@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hongling Zeng commit a625a4b8806cc1e928b7dd2cca1fee709c9de56e upstream. The UAS mode of Hiksemi is reported to fail to work on several platforms with the following error message, then after re-connecting the device will be offlined and not working at all. [ 592.518442][ 2] sd 8:0:0:0: [sda] tag#17 uas_eh_abort_handler 0 uas-tag = 18 inflight: CMD [ 592.527575][ 2] sd 8:0:0:0: [sda] tag#17 CDB: Write(10) 2a 00 03 6f 88 0= 0 00 04 00 00 [ 592.536330][ 2] sd 8:0:0:0: [sda] tag#0 uas_eh_abort_handler 0 uas-tag 1 inflight: CMD [ 592.545266][ 2] sd 8:0:0:0: [sda] tag#0 CDB: Write(10) 2a 00 07 44 1a 88= 00 00 08 00 These disks have a broken uas implementation, the tag field of the status iu-s is not set properly,so we need to fall-back to usb-storage. Acked-by: Alan Stern Cc: stable Signed-off-by: Hongling Zeng Link: https://lore.kernel.org/r/1663901173-21020-1-git-send-email-zenghongl= ing@kylinos.cn Signed-off-by: Greg Kroah-Hartman Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/usb/storage/unusual_uas.h | 7 +++++++ 1 file changed, 7 insertions(+) --- a/drivers/usb/storage/unusual_uas.h +++ b/drivers/usb/storage/unusual_uas.h @@ -52,6 +52,13 @@ UNUSUAL_DEV(0x059f, 0x1061, 0x0000, 0x99 USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_NO_REPORT_OPCODES | US_FL_NO_SAME), =20 +/* Reported-by: Hongling Zeng */ +UNUSUAL_DEV(0x090c, 0x2000, 0x0000, 0x9999, + "Hiksemi", + "External HDD", + USB_SC_DEVICE, USB_PR_DEVICE, NULL, + US_FL_IGNORE_UAS), + /* * Apricorn USB3 dongle sometimes returns "USBSUSBSUSBS" in response to SC= SI * commands in UAS mode. Observed with the 1.28 firmware; are there other= s? From nobody Thu Dec 18 22:29:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C740C4332F for ; Mon, 3 Oct 2022 07:42:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232063AbiJCHm2 (ORCPT ); Mon, 3 Oct 2022 03:42:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231776AbiJCHlk (ORCPT ); Mon, 3 Oct 2022 03:41:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7515811821; Mon, 3 Oct 2022 00:24:45 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9C03460F82; Mon, 3 Oct 2022 07:24:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ABA3CC433D7; Mon, 3 Oct 2022 07:24:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781885; bh=gcoji+IwOaxVnG3o+SYR8ObBzpQCYYfcz8oCmzRPUrg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vcbRVjlvlGGRHpphZlKrAfOkCUdgmbnqbwWjRn3N2BqkdJ/mUS27s1Avg+pF8VDtZ nrkKJPfqxNvF16WruArybUojfKfQ73q1Kc5PN6LYT2xB69lFw5QhRoMSaZpVgaICjn Mp7T2ZOu1IRIvI5rJ+s4/lQC6KUU4mxwGYO/dvG0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern , stable , Hongling Zeng Subject: [PATCH 4.19 02/25] usb-storage: Add Hiksemi USB3-FW to IGNORE_UAS Date: Mon, 3 Oct 2022 09:12:05 +0200 Message-Id: <20221003070715.478182052@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070715.406550966@linuxfoundation.org> References: <20221003070715.406550966@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hongling Zeng commit e00b488e813f0f1ad9f778e771b7cd2fe2877023 upstream. The UAS mode of Hiksemi USB_HDD is reported to fail to work on several platforms with the following error message, then after re-connecting the device will be offlined and not working at all. [ 592.518442][ 2] sd 8:0:0:0: [sda] tag#17 uas_eh_abort_handler 0 uas-tag = 18 inflight: CMD [ 592.527575][ 2] sd 8:0:0:0: [sda] tag#17 CDB: Write(10) 2a 00 03 6f 88 0= 0 00 04 00 00 [ 592.536330][ 2] sd 8:0:0:0: [sda] tag#0 uas_eh_abort_handler 0 uas-tag 1 inflight: CMD [ 592.545266][ 2] sd 8:0:0:0: [sda] tag#0 CDB: Write(10) 2a 00 07 44 1a 88= 00 00 08 00 These disks have a broken uas implementation, the tag field of the status iu-s is not set properly,so we need to fall-back to usb-storage. Acked-by: Alan Stern Cc: stable Signed-off-by: Hongling Zeng Link: https://lore.kernel.org/r/1663901185-21067-1-git-send-email-zenghongl= ing@kylinos.cn Signed-off-by: Greg Kroah-Hartman Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/usb/storage/unusual_uas.h | 7 +++++++ 1 file changed, 7 insertions(+) --- a/drivers/usb/storage/unusual_uas.h +++ b/drivers/usb/storage/unusual_uas.h @@ -83,6 +83,13 @@ UNUSUAL_DEV(0x0bc2, 0x331a, 0x0000, 0x99 USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_NO_REPORT_LUNS), =20 +/* Reported-by: Hongling Zeng */ +UNUSUAL_DEV(0x0bda, 0x9210, 0x0000, 0x9999, + "Hiksemi", + "External HDD", + USB_SC_DEVICE, USB_PR_DEVICE, NULL, + US_FL_IGNORE_UAS), + /* Reported-by: Benjamin Tissoires */ UNUSUAL_DEV(0x13fd, 0x3940, 0x0000, 0x9999, "Initio Corporation", From nobody Thu Dec 18 22:29:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8837BC43217 for ; Mon, 3 Oct 2022 07:47:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229762AbiJCHrY (ORCPT ); Mon, 3 Oct 2022 03:47:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232165AbiJCHpb (ORCPT ); Mon, 3 Oct 2022 03:45:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 498C358538; Mon, 3 Oct 2022 00:26:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3D57D60FA0; Mon, 3 Oct 2022 07:24:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 51A3FC433C1; Mon, 3 Oct 2022 07:24:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781887; bh=6pZ6UQlxPLXtJOJyXlnGRVygfTHsLZc0+Seg8suUn4s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xcjocA3fS8Qyz1d1I/bn0Nx1e2gczCrkttt6aRNJfX1gV7qay8zmjuKDZ+M2acyX6 w5dQm/dHKhcxXrkAZ56kZLkI/DNiNz7ylTbuz/3twS7EbZzQHs0yxbZsaDuB3u81oH W0ERmvrI0WLx7PDzKBfGjICD06oTLah6CF2Yg57k= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern , stable , Hongling Zeng Subject: [PATCH 4.19 03/25] uas: ignore UAS for Thinkplus chips Date: Mon, 3 Oct 2022 09:12:06 +0200 Message-Id: <20221003070715.511566017@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070715.406550966@linuxfoundation.org> References: <20221003070715.406550966@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hongling Zeng commit 0fb9703a3eade0bb84c635705d9c795345e55053 upstream. The UAS mode of Thinkplus(0x17ef, 0x3899) is reported to influence performance and trigger kernel panic on several platforms with the following error message: [ 39.702439] xhci_hcd 0000:0c:00.3: ERROR Transfer event for disabled endpoint or incorrect stream ring [ 39.702442] xhci_hcd 0000:0c:00.3: @000000026c61f810 00000000 00000000 1b000000 05038000 [ 720.545894][13] Workqueue: usb_hub_wq hub_event [ 720.550971][13] ffff88026c143c38 0000000000016300 ffff8802755bb900 ffff= 880 26cb80000 [ 720.559673][13] ffff88026c144000 ffff88026ca88100 0000000000000000 ffff= 880 26cb80000 [ 720.568374][13] ffff88026cb80000 ffff88026c143c50 ffffffff8186ae25 ffff= 880 26ca880f8 [ 720.577076][13] Call Trace: [ 720.580201][13] [] schedule+0x35/0x80 [ 720.586137][13] [] schedule_preempt_disabled+0xe/0x10 [ 720.593623][13] [] __mutex_lock_slowpath+0x164/0x1e0 [ 720.601012][13] [] mutex_lock+0x2f/0x40 [ 720.607141][13] [] usb_disconnect+0x59/0x290 Falling back to USB mass storage can solve this problem, so ignore UAS function of this chip. Acked-by: Alan Stern Cc: stable Signed-off-by: Hongling Zeng Link: https://lore.kernel.org/r/1663902249837086.19.seg@mailgw Signed-off-by: Greg Kroah-Hartman Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/usb/storage/unusual_uas.h | 7 +++++++ 1 file changed, 7 insertions(+) --- a/drivers/usb/storage/unusual_uas.h +++ b/drivers/usb/storage/unusual_uas.h @@ -132,6 +132,13 @@ UNUSUAL_DEV(0x154b, 0xf00d, 0x0000, 0x99 USB_SC_DEVICE, USB_PR_DEVICE, NULL, US_FL_NO_ATA_1X), =20 +/* Reported-by: Hongling Zeng */ +UNUSUAL_DEV(0x17ef, 0x3899, 0x0000, 0x9999, + "Thinkplus", + "External HDD", + USB_SC_DEVICE, USB_PR_DEVICE, NULL, + US_FL_IGNORE_UAS), + /* Reported-by: Hans de Goede */ UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999, "VIA", From nobody Thu Dec 18 22:29:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BDECDC433F5 for ; Mon, 3 Oct 2022 08:18:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229849AbiJCISC (ORCPT ); Mon, 3 Oct 2022 04:18:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229741AbiJCIRd (ORCPT ); Mon, 3 Oct 2022 04:17:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE9A35C34E; Mon, 3 Oct 2022 00:52:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8F1FDB80E8F; Mon, 3 Oct 2022 07:24:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0650C433C1; Mon, 3 Oct 2022 07:24:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781890; bh=8yICmdEnzrq6TvhtPNCViW6kELiGyg/XlVB3lpIgWsY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rl/O77T4/49gpDFUwaqp0yYNL3SQ2Xqjfw6dlqLrz8BQFMUqOLsVQ70idRwF59M/c 8ne1kVUDMC0INzGBL6bxV6pLI7KPLYFjYVsbqADUXu8CQFlr2fS+MMn2rFDZO2nCue DZ5R3WbC98o69Ir5zk4cGfS75KT/EIShUe0ekETY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Frank Wunderlich , =?UTF-8?q?Bj=C3=B8rn=20Mork?= , Jakub Kicinski Subject: [PATCH 4.19 04/25] net: usb: qmi_wwan: Add new usb-id for Dell branded EM7455 Date: Mon, 3 Oct 2022 09:12:07 +0200 Message-Id: <20221003070715.539356263@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070715.406550966@linuxfoundation.org> References: <20221003070715.406550966@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Frank Wunderlich commit 797666cd5af041ffb66642fff62f7389f08566a2 upstream. Add support for Dell 5811e (EM7455) with USB-id 0x413c:0x81c2. Signed-off-by: Frank Wunderlich Cc: stable@vger.kernel.org Acked-by: Bj=C3=B8rn Mork Link: https://lore.kernel.org/r/20220926150740.6684-3-linux@fw-web.de Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/net/usb/qmi_wwan.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/net/usb/qmi_wwan.c +++ b/drivers/net/usb/qmi_wwan.c @@ -1357,6 +1357,7 @@ static const struct usb_device_id produc {QMI_FIXED_INTF(0x413c, 0x81b3, 8)}, /* Dell Wireless 5809e Gobi(TM) 4G L= TE Mobile Broadband Card (rev3) */ {QMI_FIXED_INTF(0x413c, 0x81b6, 8)}, /* Dell Wireless 5811e */ {QMI_FIXED_INTF(0x413c, 0x81b6, 10)}, /* Dell Wireless 5811e */ + {QMI_FIXED_INTF(0x413c, 0x81c2, 8)}, /* Dell Wireless 5811e */ {QMI_FIXED_INTF(0x413c, 0x81cc, 8)}, /* Dell Wireless 5816e */ {QMI_FIXED_INTF(0x413c, 0x81d7, 0)}, /* Dell Wireless 5821e */ {QMI_FIXED_INTF(0x413c, 0x81d7, 1)}, /* Dell Wireless 5821e preproduction= config */ From nobody Thu Dec 18 22:29:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35F47C433F5 for ; Mon, 3 Oct 2022 07:43:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232087AbiJCHnI (ORCPT ); Mon, 3 Oct 2022 03:43:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229589AbiJCHmM (ORCPT ); Mon, 3 Oct 2022 03:42:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C99D218B1D; Mon, 3 Oct 2022 00:24:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3FAE0B80E85; Mon, 3 Oct 2022 07:24:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F3EEC433B5; Mon, 3 Oct 2022 07:24:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781893; bh=NDVewY7N+0JeaK4mQ8nR5KJuftCfb9aKfsSmUmzgNyI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1YUT4N9+hO1aUwioQv0nS89MRi4fScVbIpl4quheUm+1dw8YbNYYF7+5mKcXTuTVM QHqN17aTEpiCjaUIX/RTslCEib5waoSMi1hobx72mEjUuDjKyqLoL3I2stPNTWPtYn Ty+FVf9KPdRlSSC0nkhb/CGcOg9LVBLmrelV69q4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Walleij , Arnd Bergmann Subject: [PATCH 4.19 05/25] ARM: dts: integrator: Tag PCI host with device_type Date: Mon, 3 Oct 2022 09:12:08 +0200 Message-Id: <20221003070715.567407848@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070715.406550966@linuxfoundation.org> References: <20221003070715.406550966@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Linus Walleij commit 4952aa696a9f221c5e34e5961e02fca41ef67ad6 upstream. The DT parser is dependent on the PCI device being tagged as device_type =3D "pci" in order to parse memory ranges properly. Fix this up. Signed-off-by: Linus Walleij Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220919092608.813511-1-linus.walleij@linar= o.org' Signed-off-by: Arnd Bergmann Signed-off-by: Greg Kroah-Hartman Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- arch/arm/boot/dts/integratorap.dts | 1 + 1 file changed, 1 insertion(+) --- a/arch/arm/boot/dts/integratorap.dts +++ b/arch/arm/boot/dts/integratorap.dts @@ -155,6 +155,7 @@ =20 pci: pciv3@62000000 { compatible =3D "arm,integrator-ap-pci", "v3,v360epc-pci"; + device_type =3D "pci"; #interrupt-cells =3D <1>; #size-cells =3D <2>; #address-cells =3D <3>; From nobody Thu Dec 18 22:29:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 859FFC433FE for ; Mon, 3 Oct 2022 07:47:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232259AbiJCHre (ORCPT ); Mon, 3 Oct 2022 03:47:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231944AbiJCHqZ (ORCPT ); Mon, 3 Oct 2022 03:46:25 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47A645850A; Mon, 3 Oct 2022 00:26:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AEB91B80E6B; Mon, 3 Oct 2022 07:24:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 25C25C433C1; Mon, 3 Oct 2022 07:24:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781895; bh=V3WpwRAWt5cAB2K6+gSEMiz3McF42UPgqUC/ragvIrw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GvkXbldoMhumopMCqq3zcRtgZuH9mflaWmjmwMvL/ESlymZ1S2GKXeeBpoUubLvFr 8LBkjXYxmwEQlgabRsAEA5cUiZ+NGEIgoEcOxrKO3Mo/nFhVt768o0CYZvgTOB8a0d gz/ldpxy4IGqBn4o0D9IK2FZiL3hVlcAVkeT1lnI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, ChenXiaoSong , Anton Altaparmakov , Andrew Morton Subject: [PATCH 4.19 06/25] ntfs: fix BUG_ON in ntfs_lookup_inode_by_name() Date: Mon, 3 Oct 2022 09:12:09 +0200 Message-Id: <20221003070715.595769925@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070715.406550966@linuxfoundation.org> References: <20221003070715.406550966@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: ChenXiaoSong commit 1b513f613731e2afc05550e8070d79fac80c661e upstream. Syzkaller reported BUG_ON as follows: Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee ------------[ cut here ]------------ kernel BUG at fs/ntfs/dir.c:86! invalid opcode: 0000 [#1] PREEMPT SMP KASAN PTI CPU: 3 PID: 758 Comm: a.out Not tainted 5.19.0-next-20220808 #5 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd= 239552ce722-prebuilt.qemu.org 04/01/2014 RIP: 0010:ntfs_lookup_inode_by_name+0xd11/0x2d10 Code: ff e9 b9 01 00 00 e8 1e fe d6 fe 48 8b 7d 98 49 8d 5d 07 e8 91 85 29 = ff 48 c7 45 98 00 00 00 00 e9 5a fb ff ff e8 ff fd d6 fe <0f> 0b e8 f8 fd d= 6 fe 0f 0b e8 f1 fd d6 fe 48 8b b5 50 ff ff ff 4c RSP: 0018:ffff888079607978 EFLAGS: 00010293 RAX: 0000000000000000 RBX: 0000000000008000 RCX: 0000000000000000 RDX: ffff88807cf10000 RSI: ffffffff82a4a081 RDI: 0000000000000003 RBP: ffff888079607a70 R08: 0000000000000001 R09: ffff88807a6d01d7 R10: ffffed100f4da03a R11: 0000000000000000 R12: ffff88800f0fb110 R13: ffff88800f0ee000 R14: ffff88800f0fb000 R15: 0000000000000001 FS: 00007f33b63c7540(0000) GS:ffff888108580000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f33b635c090 CR3: 000000000f39e005 CR4: 0000000000770ee0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: load_system_files+0x1f7f/0x3620 ntfs_fill_super+0xa01/0x1be0 mount_bdev+0x36a/0x440 ntfs_mount+0x3a/0x50 legacy_get_tree+0xfb/0x210 vfs_get_tree+0x8f/0x2f0 do_new_mount+0x30a/0x760 path_mount+0x4de/0x1880 __x64_sys_mount+0x2b3/0x340 do_syscall_64+0x38/0x90 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f33b62ff9ea Code: 48 8b 0d a9 f4 0b 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 = 00 00 00 00 0f 1f 44 00 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff f= f 73 01 c3 48 8b 0d 76 f4 0b 00 f7 d8 64 89 01 48 RSP: 002b:00007ffd0c471aa8 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5 RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f33b62ff9ea RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007ffd0c471be0 RBP: 00007ffd0c471c60 R08: 00007ffd0c471ae0 R09: 00007ffd0c471c24 R10: 0000000000000000 R11: 0000000000000202 R12: 000055bac5afc160 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Modules linked in: ---[ end trace 0000000000000000 ]--- Fix this by adding sanity check on extended system files' directory inode to ensure that it is directory, just like ntfs_extend_init() when mounting ntfs3. Link: https://lkml.kernel.org/r/20220809064730.2316892-1-chenxiaosong2@huaw= ei.com Signed-off-by: ChenXiaoSong Cc: Anton Altaparmakov Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- fs/ntfs/super.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c @@ -2106,7 +2106,8 @@ get_ctx_vol_failed: // TODO: Initialize security. /* Get the extended system files' directory inode. */ vol->extend_ino =3D ntfs_iget(sb, FILE_Extend); - if (IS_ERR(vol->extend_ino) || is_bad_inode(vol->extend_ino)) { + if (IS_ERR(vol->extend_ino) || is_bad_inode(vol->extend_ino) || + !S_ISDIR(vol->extend_ino->i_mode)) { if (!IS_ERR(vol->extend_ino)) iput(vol->extend_ino); ntfs_error(sb, "Failed to load $Extend."); From nobody Thu Dec 18 22:29:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E696AC433F5 for ; Mon, 3 Oct 2022 07:44:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231489AbiJCHoa (ORCPT ); Mon, 3 Oct 2022 03:44:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231965AbiJCHms (ORCPT ); Mon, 3 Oct 2022 03:42:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97ADD237FD; Mon, 3 Oct 2022 00:25:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 67949B80E96; Mon, 3 Oct 2022 07:24:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD5E2C433D6; Mon, 3 Oct 2022 07:24:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781898; bh=Fic6drM20wOIy+Wl7LBE8Scc1pXUDEJK0y2SJhw/2g8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pTFqt+xF65KDB2e3JiJngKonASXxM9TZUAH+bhpPFH1tn0q+XqgOPhrUZugXpIsY0 CxrPmo2SY1FRtMhwjnAlKaCWxMb6M9tT2qBuIMz31+NGlVLSfnrKiliSPJlzR+FmaC QjAyUm+cYfKYloDBF0h8Bq9AvrBzrKUIBrxYN9Xg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jaap Berkhout , Niklas Cassel , Mario Limonciello , Damien Le Moal Subject: [PATCH 4.19 07/25] libata: add ATA_HORKAGE_NOLPM for Pioneer BDR-207M and BDR-205 Date: Mon, 3 Oct 2022 09:12:10 +0200 Message-Id: <20221003070715.622701551@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070715.406550966@linuxfoundation.org> References: <20221003070715.406550966@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Niklas Cassel commit ea08aec7e77bfd6599489ec430f9f859ab84575a upstream. Commit 1527f69204fe ("ata: ahci: Add Green Sardine vendor ID as board_ahci_mobile") added an explicit entry for AMD Green Sardine AHCI controller using the board_ahci_mobile configuration (this configuration has later been renamed to board_ahci_low_power). The board_ahci_low_power configuration enables support for low power modes. This explicit entry takes precedence over the generic AHCI controller entry, which does not enable support for low power modes. Therefore, when commit 1527f69204fe ("ata: ahci: Add Green Sardine vendor ID as board_ahci_mobile") was backported to stable kernels, it make some Pioneer optical drives, which was working perfectly fine before the commit was backported, stop working. The real problem is that the Pioneer optical drives do not handle low power modes correctly. If these optical drives would have been tested on another AHCI controller using the board_ahci_low_power configuration, this issue would have been detected earlier. Unfortunately, the board_ahci_low_power configuration is only used in less than 15% of the total AHCI controller entries, so many devices have never been tested with an AHCI controller with low power modes. Fixes: 1527f69204fe ("ata: ahci: Add Green Sardine vendor ID as board_ahci_= mobile") Cc: stable@vger.kernel.org Reported-by: Jaap Berkhout Signed-off-by: Niklas Cassel Reviewed-by: Mario Limonciello Signed-off-by: Damien Le Moal Signed-off-by: Greg Kroah-Hartman Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/ata/libata-core.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -4560,6 +4560,10 @@ static const struct ata_blacklist_entry { "PIONEER DVD-RW DVR-212D", NULL, ATA_HORKAGE_NOSETXFER }, { "PIONEER DVD-RW DVR-216D", NULL, ATA_HORKAGE_NOSETXFER }, =20 + /* These specific Pioneer models have LPM issues */ + { "PIONEER BD-RW BDR-207M", NULL, ATA_HORKAGE_NOLPM }, + { "PIONEER BD-RW BDR-205", NULL, ATA_HORKAGE_NOLPM }, + /* Crucial BX100 SSD 500GB has broken LPM support */ { "CT500BX100SSD1", NULL, ATA_HORKAGE_NOLPM }, From nobody Thu Dec 18 22:29:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 039CEC433F5 for ; Mon, 3 Oct 2022 07:48:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232406AbiJCHsN (ORCPT ); Mon, 3 Oct 2022 03:48:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232443AbiJCHrT (ORCPT ); Mon, 3 Oct 2022 03:47:19 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD5FA5A142; Mon, 3 Oct 2022 00:27:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1309DB80E93; Mon, 3 Oct 2022 07:25:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6BC89C433D6; Mon, 3 Oct 2022 07:25:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781900; bh=q0My1NRdS5ALMXpoYH2Fi1xX8qrY9UD0s3A2OdbcL/w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p4iLJjZzOTQBRBcBn7nVTQEf6lr+GlVK+8bDxiNJ+tyQWofxRiwLFoLTG71C+Df+F wFkFEyrDfnJ67JUidtyKID1OK0OKBVNcttpPzvfOuzJ3XvzQiPUanBfJLw4Twj6brB wcInTr5tIGqXjoK8gXLSVowBqZT7skW++B+TeaZo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergei Antonov , Jonas Jensen , Ulf Hansson Subject: [PATCH 4.19 08/25] mmc: moxart: fix 4-bit bus width and remove 8-bit bus width Date: Mon, 3 Oct 2022 09:12:11 +0200 Message-Id: <20221003070715.652543170@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070715.406550966@linuxfoundation.org> References: <20221003070715.406550966@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sergei Antonov commit 35ca91d1338ae158f6dcc0de5d1e86197924ffda upstream. According to the datasheet [1] at page 377, 4-bit bus width is turned on by bit 2 of the Bus Width Register. Thus the current bitmask is wrong: define BUS_WIDTH_4 BIT(1) BIT(1) does not work but BIT(2) works. This has been verified on real MOXA hardware with FTSDC010 controller revision 1_6_0. The corrected value of BUS_WIDTH_4 mask collides with: define BUS_WIDTH_8 BIT(2). Additionally, 8-bit bus width mode isn't supported according to the datasheet, so let's remove the corresponding code. [1] https://bitbucket.org/Kasreyn/mkrom-uc7112lx/src/master/documents/FIC8120_D= S_v1.2.pdf Fixes: 1b66e94e6b99 ("mmc: moxart: Add MOXA ART SD/MMC driver") Signed-off-by: Sergei Antonov Cc: Jonas Jensen Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20220907205753.1577434-1-saproj@gmail.com Signed-off-by: Ulf Hansson Signed-off-by: Greg Kroah-Hartman Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/mmc/host/moxart-mmc.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) --- a/drivers/mmc/host/moxart-mmc.c +++ b/drivers/mmc/host/moxart-mmc.c @@ -111,8 +111,8 @@ #define CLK_DIV_MASK 0x7f =20 /* REG_BUS_WIDTH */ -#define BUS_WIDTH_8 BIT(2) -#define BUS_WIDTH_4 BIT(1) +#define BUS_WIDTH_4_SUPPORT BIT(3) +#define BUS_WIDTH_4 BIT(2) #define BUS_WIDTH_1 BIT(0) =20 #define MMC_VDD_360 23 @@ -527,9 +527,6 @@ static void moxart_set_ios(struct mmc_ho case MMC_BUS_WIDTH_4: writel(BUS_WIDTH_4, host->base + REG_BUS_WIDTH); break; - case MMC_BUS_WIDTH_8: - writel(BUS_WIDTH_8, host->base + REG_BUS_WIDTH); - break; default: writel(BUS_WIDTH_1, host->base + REG_BUS_WIDTH); break; @@ -646,16 +643,8 @@ static int moxart_probe(struct platform_ dmaengine_slave_config(host->dma_chan_rx, &cfg); } =20 - switch ((readl(host->base + REG_BUS_WIDTH) >> 3) & 3) { - case 1: + if (readl(host->base + REG_BUS_WIDTH) & BUS_WIDTH_4_SUPPORT) mmc->caps |=3D MMC_CAP_4_BIT_DATA; - break; - case 2: - mmc->caps |=3D MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA; - break; - default: - break; - } =20 writel(0, host->base + REG_INTERRUPT_MASK); From nobody Thu Dec 18 22:29:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1BE14C4332F for ; Mon, 3 Oct 2022 07:44:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231966AbiJCHoh (ORCPT ); Mon, 3 Oct 2022 03:44:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232008AbiJCHnB (ORCPT ); Mon, 3 Oct 2022 03:43:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9448229C82; Mon, 3 Oct 2022 00:25:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9B644B80E99; Mon, 3 Oct 2022 07:25:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F33CEC433D7; Mon, 3 Oct 2022 07:25:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781903; bh=c6sGz4EJ7kQZs57qQszILA6gNTFIFnsTWXhKjSCjgg8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BVuxB9WvOicBvruY5Umk7AEWOnOIp8z9SXSa7VTBqkdfSPBkTh9QhWvhIHZxJ16N6 273ujSQV1IxV3eXGJ0cQ5P88cCRpG9kevoF9kXiB1cVRKFO4RifnHzAPojClYGHSYf Y4W83eN7737EV/2lvxcGTarvq9QZGWRWJc6eJgF8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mel Gorman , Patrick Daly , Michal Hocko , David Hildenbrand , Andrew Morton Subject: [PATCH 4.19 09/25] mm/page_alloc: fix race condition between build_all_zonelists and page allocation Date: Mon, 3 Oct 2022 09:12:12 +0200 Message-Id: <20221003070715.683093171@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070715.406550966@linuxfoundation.org> References: <20221003070715.406550966@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mel Gorman commit 3d36424b3b5850bd92f3e89b953a430d7cfc88ef upstream. Patrick Daly reported the following problem; NODE_DATA(nid)->node_zonelists[ZONELIST_FALLBACK] - before offline operati= on [0] - ZONE_MOVABLE [1] - ZONE_NORMAL [2] - NULL For a GFP_KERNEL allocation, alloc_pages_slowpath() will save the offset of ZONE_NORMAL in ac->preferred_zoneref. If a concurrent memory_offline operation removes the last page from ZONE_MOVABLE, build_all_zonelists() & build_zonerefs_node() will update node_zonelists as shown below. Only populated zones are added. NODE_DATA(nid)->node_zonelists[ZONELIST_FALLBACK] - after offline operation [0] - ZONE_NORMAL [1] - NULL [2] - NULL The race is simple -- page allocation could be in progress when a memory hot-remove operation triggers a zonelist rebuild that removes zones. The allocation request will still have a valid ac->preferred_zoneref that is now pointing to NULL and triggers an OOM kill. This problem probably always existed but may be slightly easier to trigger due to 6aa303defb74 ("mm, vmscan: only allocate and reclaim from zones with pages managed by the buddy allocator") which distinguishes between zones that are completely unpopulated versus zones that have valid pages not managed by the buddy allocator (e.g. reserved, memblock, ballooning etc). Memory hotplug had multiple stages with timing considerations around managed/present page updates, the zonelist rebuild and the zone span updates. As David Hildenbrand puts it memory offlining adjusts managed+present pages of the zone essentially in one go. If after the adjustments, the zone is no longer populated (present=3D=3D0), we rebuild the zone lists. Once that's done, we try shrinking the zone (start+spanned pages) -- which results in zone_start_pfn =3D=3D 0 if there are no more pages. That happens *after* rebuilding the zonelists via remove_pfn_range_from_zone(). The only requirement to fix the race is that a page allocation request identifies when a zonelist rebuild has happened since the allocation request started and no page has yet been allocated. Use a seqlock_t to track zonelist updates with a lockless read-side of the zonelist and protecting the rebuild and update of the counter with a spinlock. [akpm@linux-foundation.org: make zonelist_update_seq static] Link: https://lkml.kernel.org/r/20220824110900.vh674ltxmzb3proq@techsingula= rity.net Fixes: 6aa303defb74 ("mm, vmscan: only allocate and reclaim from zones with= pages managed by the buddy allocator") Signed-off-by: Mel Gorman Reported-by: Patrick Daly Acked-by: Michal Hocko Reviewed-by: David Hildenbrand Cc: [4.9+] Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- mm/page_alloc.c | 53 +++++++++++++++++++++++++++++++++++++++++++--------= -- 1 file changed, 43 insertions(+), 10 deletions(-) --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3779,6 +3779,30 @@ void fs_reclaim_release(gfp_t gfp_mask) EXPORT_SYMBOL_GPL(fs_reclaim_release); #endif =20 +/* + * Zonelists may change due to hotplug during allocation. Detect when zone= lists + * have been rebuilt so allocation retries. Reader side does not lock and + * retries the allocation if zonelist changes. Writer side is protected by= the + * embedded spin_lock. + */ +static DEFINE_SEQLOCK(zonelist_update_seq); + +static unsigned int zonelist_iter_begin(void) +{ + if (IS_ENABLED(CONFIG_MEMORY_HOTREMOVE)) + return read_seqbegin(&zonelist_update_seq); + + return 0; +} + +static unsigned int check_retry_zonelist(unsigned int seq) +{ + if (IS_ENABLED(CONFIG_MEMORY_HOTREMOVE)) + return read_seqretry(&zonelist_update_seq, seq); + + return seq; +} + /* Perform direct synchronous page reclaim */ static int __perform_reclaim(gfp_t gfp_mask, unsigned int order, @@ -4084,6 +4108,7 @@ __alloc_pages_slowpath(gfp_t gfp_mask, u int compaction_retries; int no_progress_loops; unsigned int cpuset_mems_cookie; + unsigned int zonelist_iter_cookie; int reserve_flags; =20 /* @@ -4094,11 +4119,12 @@ __alloc_pages_slowpath(gfp_t gfp_mask, u (__GFP_ATOMIC|__GFP_DIRECT_RECLAIM))) gfp_mask &=3D ~__GFP_ATOMIC; =20 -retry_cpuset: +restart: compaction_retries =3D 0; no_progress_loops =3D 0; compact_priority =3D DEF_COMPACT_PRIORITY; cpuset_mems_cookie =3D read_mems_allowed_begin(); + zonelist_iter_cookie =3D zonelist_iter_begin(); =20 /* * The fast path uses conservative alloc_flags to succeed only until @@ -4247,9 +4273,13 @@ retry: goto retry; =20 =20 - /* Deal with possible cpuset update races before we start OOM killing */ - if (check_retry_cpuset(cpuset_mems_cookie, ac)) - goto retry_cpuset; + /* + * Deal with possible cpuset update races or zonelist updates to avoid + * a unnecessary OOM kill. + */ + if (check_retry_cpuset(cpuset_mems_cookie, ac) || + check_retry_zonelist(zonelist_iter_cookie)) + goto restart; =20 /* Reclaim has failed us, start killing things */ page =3D __alloc_pages_may_oom(gfp_mask, order, ac, &did_some_progress); @@ -4269,9 +4299,13 @@ retry: } =20 nopage: - /* Deal with possible cpuset update races before we fail */ - if (check_retry_cpuset(cpuset_mems_cookie, ac)) - goto retry_cpuset; + /* + * Deal with possible cpuset update races or zonelist updates to avoid + * a unnecessary OOM kill. + */ + if (check_retry_cpuset(cpuset_mems_cookie, ac) || + check_retry_zonelist(zonelist_iter_cookie)) + goto restart; =20 /* * Make sure that __GFP_NOFAIL request doesn't leak out and make sure @@ -5379,9 +5413,8 @@ static void __build_all_zonelists(void * int nid; int __maybe_unused cpu; pg_data_t *self =3D data; - static DEFINE_SPINLOCK(lock); =20 - spin_lock(&lock); + write_seqlock(&zonelist_update_seq); =20 #ifdef CONFIG_NUMA memset(node_load, 0, sizeof(node_load)); @@ -5414,7 +5447,7 @@ static void __build_all_zonelists(void * #endif } =20 - spin_unlock(&lock); + write_sequnlock(&zonelist_update_seq); } =20 static noinline void __init From nobody Thu Dec 18 22:29:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB4B4C433F5 for ; Mon, 3 Oct 2022 07:42:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232000AbiJCHmB (ORCPT ); Mon, 3 Oct 2022 03:42:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231976AbiJCHlU (ORCPT ); Mon, 3 Oct 2022 03:41:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E43EB491FB; Mon, 3 Oct 2022 00:24:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9407060F82; Mon, 3 Oct 2022 07:24:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5261C433D7; Mon, 3 Oct 2022 07:24:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781869; bh=ivNjXrfrIXCEFG5ZUWRbebZnTyy8wgJJVSWxFA6JxRg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lczw+nVtqJDfydECUD0maTGX97Cg1uk2XrrE1rKAkGMgPriJJPCsWQhCaUMFlSlZY e7t9AlYWUnYZS0xyQeb2HghMrSsfp7vncSKkhJZg1l1Sw9ljYhJGeZ2gTo1XYU6vGO +pHUn53denh8Gtp5dTUpFVrOcVMUVEDxcbTeQ4eQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maurizio Lombardi , Alexander Duyck , Chen Lin , Jakub Kicinski , Andrew Morton Subject: [PATCH 4.19 10/25] mm: prevent page_frag_alloc() from corrupting the memory Date: Mon, 3 Oct 2022 09:12:13 +0200 Message-Id: <20221003070715.711618269@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070715.406550966@linuxfoundation.org> References: <20221003070715.406550966@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Maurizio Lombardi commit dac22531bbd4af2426c4e29e05594415ccfa365d upstream. A number of drivers call page_frag_alloc() with a fragment's size > PAGE_SIZE. In low memory conditions, __page_frag_cache_refill() may fail the order 3 cache allocation and fall back to order 0; In this case, the cache will be smaller than the fragment, causing memory corruptions. Prevent this from happening by checking if the newly allocated cache is large enough for the fragment; if not, the allocation will fail and page_frag_alloc() will return NULL. Link: https://lkml.kernel.org/r/20220715125013.247085-1-mlombard@redhat.com Fixes: b63ae8ca096d ("mm/net: Rename and move page fragment handling from n= et/ to mm/") Signed-off-by: Maurizio Lombardi Reviewed-by: Alexander Duyck Cc: Chen Lin Cc: Jakub Kicinski Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- mm/page_alloc.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -4603,6 +4603,18 @@ refill: /* reset page count bias and offset to start of new frag */ nc->pagecnt_bias =3D PAGE_FRAG_CACHE_MAX_SIZE + 1; offset =3D size - fragsz; + if (unlikely(offset < 0)) { + /* + * The caller is trying to allocate a fragment + * with fragsz > PAGE_SIZE but the cache isn't big + * enough to satisfy the request, this may + * happen in low memory conditions. + * We don't release the cache page because + * it could make memory pressure worse + * so we simply return NULL here. + */ + return NULL; + } } =20 nc->pagecnt_bias--; From nobody Thu Dec 18 22:29:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9990C433FE for ; Mon, 3 Oct 2022 08:44:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230174AbiJCIod (ORCPT ); Mon, 3 Oct 2022 04:44:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230157AbiJCIoE (ORCPT ); Mon, 3 Oct 2022 04:44:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 202B9255B1; Mon, 3 Oct 2022 01:22:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4C33060FCE; Mon, 3 Oct 2022 07:24:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2BB3CC433C1; Mon, 3 Oct 2022 07:24:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781871; bh=4EQt3gJL7vdLpZkM2VX2fkNa6c6Mdv3DxSB71+wkw9Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pFFCeKEtQaktZ0Rbv9CHS19i6ZDmL9IbBNogZR2e9UcIySBgwYBoCVdtN43E+2h42 /UWjtz2F/XBLU9RDBi+6CMZBWNOgwvihkHZx7SlSF9fOSIJGfDeAzPP0BayAcnTJxn vT9IputnkTstoieFJ2oE75a6sTW1SVoF+5zOeA3Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alistair Popple , Nadav Amit , "Huang, Ying" , David Hildenbrand , Peter Xu , Alex Sierra , Ben Skeggs , Felix Kuehling , huang ying , Jason Gunthorpe , John Hubbard , Karol Herbst , Logan Gunthorpe , Lyude Paul , Matthew Wilcox , Paul Mackerras , Ralph Campbell , Andrew Morton Subject: [PATCH 4.19 11/25] mm/migrate_device.c: flush TLB while holding PTL Date: Mon, 3 Oct 2022 09:12:14 +0200 Message-Id: <20221003070715.743561818@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070715.406550966@linuxfoundation.org> References: <20221003070715.406550966@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alistair Popple commit 60bae73708963de4a17231077285bd9ff2f41c44 upstream. When clearing a PTE the TLB should be flushed whilst still holding the PTL to avoid a potential race with madvise/munmap/etc. For example consider the following sequence: CPU0 CPU1 ---- ---- migrate_vma_collect_pmd() pte_unmap_unlock() madvise(MADV_DONTNEED) -> zap_pte_range() pte_offset_map_lock() [ PTE not present, TLB not flushed ] pte_unmap_unlock() [ page is still accessible via stale TLB ] flush_tlb_range() In this case the page may still be accessed via the stale TLB entry after madvise returns. Fix this by flushing the TLB while holding the PTL. Fixes: 8c3328f1f36a ("mm/migrate: migrate_vma() unmap page from vma while c= ollecting pages") Link: https://lkml.kernel.org/r/9f801e9d8d830408f2ca27821f606e09aa856899.16= 62078528.git-series.apopple@nvidia.com Signed-off-by: Alistair Popple Reported-by: Nadav Amit Reviewed-by: "Huang, Ying" Acked-by: David Hildenbrand Acked-by: Peter Xu Cc: Alex Sierra Cc: Ben Skeggs Cc: Felix Kuehling Cc: huang ying Cc: Jason Gunthorpe Cc: John Hubbard Cc: Karol Herbst Cc: Logan Gunthorpe Cc: Lyude Paul Cc: Matthew Wilcox Cc: Paul Mackerras Cc: Ralph Campbell Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- mm/migrate.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/mm/migrate.c +++ b/mm/migrate.c @@ -2359,13 +2359,14 @@ next: migrate->dst[migrate->npages] =3D 0; migrate->src[migrate->npages++] =3D mpfn; } - arch_leave_lazy_mmu_mode(); - pte_unmap_unlock(ptep - 1, ptl); =20 /* Only flush the TLB if we actually modified any entries */ if (unmapped) flush_tlb_range(walk->vma, start, end); =20 + arch_leave_lazy_mmu_mode(); + pte_unmap_unlock(ptep - 1, ptl); + return 0; } From nobody Thu Dec 18 22:29:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C5D2C433FE for ; Mon, 3 Oct 2022 07:47:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232295AbiJCHro (ORCPT ); Mon, 3 Oct 2022 03:47:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230311AbiJCHqm (ORCPT ); Mon, 3 Oct 2022 03:46:42 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4596D58526; Mon, 3 Oct 2022 00:26:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8823CB80E89; Mon, 3 Oct 2022 07:24:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F020DC433D7; Mon, 3 Oct 2022 07:24:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781874; bh=lfT5Sb/B3uL8Vk29p+EkIcR/HdZXKH5A9Ykqm1Y9UAM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M/kslXZdKPsIn1Th4BAnee+n4e/CYdHw1eE8bAfAHfsXZhPHMGVlV3LtSTryFD5Zw LnRLHyU7PPOYS3aBrKBqrefh/j7YrBu2JxRIPsSUxRgG228OZmtcoXIXCfbG64G1xq deTWxbdyExkP1qCRBijYAOGMZNuxa6/hgH8kp9Fg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Tyler Hicks , Janne Karhunen , Casey Schaufler , Mimi Zohar , Gou Hao Subject: [PATCH 4.19 12/25] ima: Have the LSM free its audit rule Date: Mon, 3 Oct 2022 09:12:15 +0200 Message-Id: <20221003070715.772124468@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070715.406550966@linuxfoundation.org> References: <20221003070715.406550966@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tyler Hicks commit 9ff8a616dfab96a4fa0ddd36190907dc68886d9b upstream. Ask the LSM to free its audit rule rather than directly calling kfree(). Both AppArmor and SELinux do additional work in their audit_rule_free() hooks. Fix memory leaks by allowing the LSMs to perform necessary work. Fixes: b16942455193 ("ima: use the lsm policy update notifier") Signed-off-by: Tyler Hicks Cc: Janne Karhunen Cc: Casey Schaufler Reviewed-by: Mimi Zohar Signed-off-by: Mimi Zohar Cc: # 4.19+ Signed-off-by: Gou Hao Signed-off-by: Greg Kroah-Hartman Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- security/integrity/ima/ima.h | 5 +++++ security/integrity/ima/ima_policy.c | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) --- a/security/integrity/ima/ima.h +++ b/security/integrity/ima/ima.h @@ -298,6 +298,7 @@ static inline int ima_read_xattr(struct #ifdef CONFIG_IMA_LSM_RULES =20 #define security_filter_rule_init security_audit_rule_init +#define security_filter_rule_free security_audit_rule_free #define security_filter_rule_match security_audit_rule_match =20 #else @@ -308,6 +309,10 @@ static inline int security_filter_rule_i return -EINVAL; } =20 +static inline void security_filter_rule_free(void *lsmrule) +{ +} + static inline int security_filter_rule_match(u32 secid, u32 field, u32 op, void *lsmrule, struct audit_context *actx) --- a/security/integrity/ima/ima_policy.c +++ b/security/integrity/ima/ima_policy.c @@ -1044,8 +1044,10 @@ void ima_delete_rules(void) =20 temp_ima_appraise =3D 0; list_for_each_entry_safe(entry, tmp, &ima_temp_rules, list) { - for (i =3D 0; i < MAX_LSM_RULES; i++) + for (i =3D 0; i < MAX_LSM_RULES; i++) { + security_filter_rule_free(entry->lsm[i].rule); kfree(entry->lsm[i].args_p); + } =20 list_del(&entry->list); kfree(entry); From nobody Thu Dec 18 22:29:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72D6FC433FE for ; Mon, 3 Oct 2022 08:25:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229801AbiJCIZA (ORCPT ); Mon, 3 Oct 2022 04:25:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229605AbiJCIYX (ORCPT ); Mon, 3 Oct 2022 04:24:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6367824F11; Mon, 3 Oct 2022 00:58:56 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 24CCBB80E90; Mon, 3 Oct 2022 07:24:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C7B4C433C1; Mon, 3 Oct 2022 07:24:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781876; bh=CQa9aHIsHJ/Fq5xcdiiAk9NAQbh+vDgkS4lNrFPfjtg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SJlSpQBp1JDg/nO+HXSpHgxLixBYsYFC254YEG2jdlcrX9ctSlu64tTGGa1UzbtKf Wf2tMZfQoHC0cTUWSdiUM3sir4ldIE4eaVGF77cLKpPZ7ml2subsIaqu/aZC/pQphc j9+KFeN/kbgKVaXE1IwbQK/SAEGFb3lmjITLMjlk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Tyler Hicks , Mimi Zohar , Gou Hao Subject: [PATCH 4.19 13/25] ima: Free the entire rule when deleting a list of rules Date: Mon, 3 Oct 2022 09:12:16 +0200 Message-Id: <20221003070715.800430612@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070715.406550966@linuxfoundation.org> References: <20221003070715.406550966@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tyler Hicks commit 465aee77aae857b5fcde56ee192b33dc369fba04 upstream. Create a function, ima_free_rule(), to free all memory associated with an ima_rule_entry. Use the new function to fix memory leaks of allocated ima_rule_entry members, such as .fsname and .keyrings, when deleting a list of rules. Make the existing ima_lsm_free_rule() function specific to the LSM audit rule array of an ima_rule_entry and require that callers make an additional call to kfree to free the ima_rule_entry itself. This fixes a memory leak seen when loading by a valid rule that contains an additional piece of allocated memory, such as an fsname, followed by an invalid rule that triggers a policy load failure: # echo -e "dont_measure fsname=3Dsecurityfs\nbad syntax" > \ /sys/kernel/security/ima/policy -bash: echo: write error: Invalid argument # echo scan > /sys/kernel/debug/kmemleak # cat /sys/kernel/debug/kmemleak unreferenced object 0xffff9bab67ca12c0 (size 16): comm "bash", pid 684, jiffies 4295212803 (age 252.344s) hex dump (first 16 bytes): 73 65 63 75 72 69 74 79 66 73 00 6b 6b 6b 6b a5 securityfs.kkkk. backtrace: [<00000000adc80b1b>] kstrdup+0x2e/0x60 [<00000000d504cb0d>] ima_parse_add_rule+0x7d4/0x1020 [<00000000444825ac>] ima_write_policy+0xab/0x1d0 [<000000002b7f0d6c>] vfs_write+0xde/0x1d0 [<0000000096feedcf>] ksys_write+0x68/0xe0 [<0000000052b544a2>] do_syscall_64+0x56/0xa0 [<000000007ead1ba7>] entry_SYSCALL_64_after_hwframe+0x44/0xa9 Fixes: f1b08bbcbdaf ("ima: define a new policy condition based on the files= ystem name") Fixes: 2b60c0ecedf8 ("IMA: Read keyrings=3D option from the IMA policy") Signed-off-by: Tyler Hicks Signed-off-by: Mimi Zohar Cc: # 4.19+ Signed-off-by: Gou Hao Signed-off-by: Greg Kroah-Hartman Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- security/integrity/ima/ima_policy.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) --- a/security/integrity/ima/ima_policy.c +++ b/security/integrity/ima/ima_policy.c @@ -241,6 +241,21 @@ static int __init default_appraise_polic } __setup("ima_appraise_tcb", default_appraise_policy_setup); =20 +static void ima_free_rule(struct ima_rule_entry *entry) +{ + int i; + + if (!entry) + return; + + kfree(entry->fsname); + for (i =3D 0; i < MAX_LSM_RULES; i++) { + security_filter_rule_free(entry->lsm[i].rule); + kfree(entry->lsm[i].args_p); + } + kfree(entry); +} + /* * The LSM policy can be reloaded, leaving the IMA LSM based rules referri= ng * to the old, stale LSM policy. Update the IMA LSM based rules to reflect @@ -1040,17 +1055,11 @@ ssize_t ima_parse_add_rule(char *rule) void ima_delete_rules(void) { struct ima_rule_entry *entry, *tmp; - int i; =20 temp_ima_appraise =3D 0; list_for_each_entry_safe(entry, tmp, &ima_temp_rules, list) { - for (i =3D 0; i < MAX_LSM_RULES; i++) { - security_filter_rule_free(entry->lsm[i].rule); - kfree(entry->lsm[i].args_p); - } - list_del(&entry->list); - kfree(entry); + ima_free_rule(entry); } } From nobody Thu Dec 18 22:29:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48626C433FE for ; Mon, 3 Oct 2022 07:42:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231932AbiJCHmd (ORCPT ); Mon, 3 Oct 2022 03:42:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231817AbiJCHll (ORCPT ); Mon, 3 Oct 2022 03:41:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2492E637B; Mon, 3 Oct 2022 00:24:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 31A9B60F63; Mon, 3 Oct 2022 07:24:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F74EC433C1; Mon, 3 Oct 2022 07:24:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781879; bh=xM5y8YomQJngbkbV7wJV9nosQk9T+fU4DmNA9kCnYnM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VHPFTcdsSAlf7oAstyTGuUF3z7wvwkjJxunqjgMgzTN7bbwmLdt1ENGZwGIl5E8Y2 vmwbGYjEv0t3b12/8JJxznSy7tnBiaHfp5Z34ajBJkFeXUiJkI+rexyO8Pzh7sJAT/ SdgGClU8MBBCCkqd8KA44jU4uPVzy+x/nvxIr+QE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Tyler Hicks , Mimi Zohar , Gou Hao Subject: [PATCH 4.19 14/25] ima: Free the entire rule if it fails to parse Date: Mon, 3 Oct 2022 09:12:17 +0200 Message-Id: <20221003070715.827351832@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070715.406550966@linuxfoundation.org> References: <20221003070715.406550966@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tyler Hicks commit 2bdd737c5687d6dec30e205953146ede8a87dbdd upstream. Use ima_free_rule() to fix memory leaks of allocated ima_rule_entry members, such as .fsname and .keyrings, when an error is encountered during rule parsing. Set the args_p pointer to NULL after freeing it in the error path of ima_lsm_rule_init() so that it isn't freed twice. This fixes a memory leak seen when loading an rule that contains an additional piece of allocated memory, such as an fsname, followed by an invalid conditional: # echo "measure fsname=3Dtmpfs bad=3Dcond" > /sys/kernel/security/ima/poli= cy -bash: echo: write error: Invalid argument # echo scan > /sys/kernel/debug/kmemleak # cat /sys/kernel/debug/kmemleak unreferenced object 0xffff98e7e4ece6c0 (size 8): comm "bash", pid 672, jiffies 4294791843 (age 21.855s) hex dump (first 8 bytes): 74 6d 70 66 73 00 6b a5 tmpfs.k. backtrace: [<00000000abab7413>] kstrdup+0x2e/0x60 [<00000000f11ede32>] ima_parse_add_rule+0x7d4/0x1020 [<00000000f883dd7a>] ima_write_policy+0xab/0x1d0 [<00000000b17cf753>] vfs_write+0xde/0x1d0 [<00000000b8ddfdea>] ksys_write+0x68/0xe0 [<00000000b8e21e87>] do_syscall_64+0x56/0xa0 [<0000000089ea7b98>] entry_SYSCALL_64_after_hwframe+0x44/0xa9 Fixes: f1b08bbcbdaf ("ima: define a new policy condition based on the files= ystem name") Fixes: 2b60c0ecedf8 ("IMA: Read keyrings=3D option from the IMA policy") Signed-off-by: Tyler Hicks Signed-off-by: Mimi Zohar Cc: # 4.19+ Signed-off-by: Gou Hao Signed-off-by: Greg Kroah-Hartman Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- security/integrity/ima/ima_policy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/security/integrity/ima/ima_policy.c +++ b/security/integrity/ima/ima_policy.c @@ -662,6 +662,7 @@ static int ima_lsm_rule_init(struct ima_ &entry->lsm[lsm_rule].rule); if (!entry->lsm[lsm_rule].rule) { kfree(entry->lsm[lsm_rule].args_p); + entry->lsm[lsm_rule].args_p =3D NULL; return -EINVAL; } =20 @@ -1034,7 +1035,7 @@ ssize_t ima_parse_add_rule(char *rule) =20 result =3D ima_parse_rule(p, entry); if (result) { - kfree(entry); + ima_free_rule(entry); integrity_audit_msg(AUDIT_INTEGRITY_STATUS, NULL, NULL, op, "invalid-policy", result, audit_info); From nobody Thu Dec 18 22:29:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D7B7C433FE for ; Mon, 3 Oct 2022 07:57:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230155AbiJCH5t (ORCPT ); Mon, 3 Oct 2022 03:57:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229592AbiJCH5S (ORCPT ); Mon, 3 Oct 2022 03:57:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E1F952477; Mon, 3 Oct 2022 00:34:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D1BDE60FA6; Mon, 3 Oct 2022 07:24:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4BFBC433C1; Mon, 3 Oct 2022 07:24:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781882; bh=M19qWWpj7hIxF4l2BwUhgVu2KARdWE1WxgabXLaQQLQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O8VKCrUM+v0FlcZdSaHfJCgvBPJzlOc0HWrOT2BIfcDSaJXjNzj9aZ5epH+ncPQ8v JWm9gWxHddiyGiYEP2CpLTU3zQ3mzgVHCMyivIpTnl1Vsr7TDh5IDqYM9v3fMFYhD1 rCsZclkbecjwDg1S8gbnPZnF5q+MZ0qun8DnGFfg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jernej Skrabec , Samuel Holland , Heiko Stuebner , Sasha Levin Subject: [PATCH 4.19 15/25] soc: sunxi: sram: Actually claim SRAM regions Date: Mon, 3 Oct 2022 09:12:18 +0200 Message-Id: <20221003070715.861345549@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070715.406550966@linuxfoundation.org> References: <20221003070715.406550966@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Samuel Holland [ Upstream commit fd362baad2e659ef0fb5652f023a606b248f1781 ] sunxi_sram_claim() checks the sram_desc->claimed flag before updating the register, with the intent that only one device can claim a region. However, this was ineffective because the flag was never set. Fixes: 4af34b572a85 ("drivers: soc: sunxi: Introduce SoC driver to map SRAM= s") Reviewed-by: Jernej Skrabec Signed-off-by: Samuel Holland Reviewed-by: Heiko Stuebner Tested-by: Heiko Stuebner Signed-off-by: Jernej Skrabec Link: https://lore.kernel.org/r/20220815041248.53268-4-samuel@sholland.org Signed-off-by: Sasha Levin Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/soc/sunxi/sunxi_sram.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/soc/sunxi/sunxi_sram.c b/drivers/soc/sunxi/sunxi_sram.c index b4b0f3480bd3..51148704af49 100644 --- a/drivers/soc/sunxi/sunxi_sram.c +++ b/drivers/soc/sunxi/sunxi_sram.c @@ -264,6 +264,7 @@ int sunxi_sram_claim(struct device *dev) writel(val | ((device << sram_data->offset) & mask), base + sram_data->reg); =20 + sram_desc->claimed =3D true; spin_unlock(&sram_lock); =20 return 0; --=20 2.35.1 From nobody Thu Dec 18 22:29:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CB10C433F5 for ; Mon, 3 Oct 2022 08:25:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231370AbiJCIZK (ORCPT ); Mon, 3 Oct 2022 04:25:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230408AbiJCIY2 (ORCPT ); Mon, 3 Oct 2022 04:24:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A36EE7C74B; Mon, 3 Oct 2022 00:58:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 42F3AB80E84; Mon, 3 Oct 2022 07:25:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA544C433D6; Mon, 3 Oct 2022 07:25:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781933; bh=mrRFi32sbq9Rq0GDubF8C4u0vJyiLjztz12bHOgC7Ag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0ZuNS4BbWdrXlik9IUmnLXuNBdCHDhfWxmgrWKQrto4toveFAyZjsDkNrA+tTUhu7 AD7Fv091as0F4johjetPRLMgTln/ggel3TaAfJGIDGKcq18vyY+58SDXj9riTsGjWD 2ygqgJnx+DAy6ATI1Kv17bAZ995SkSa7kZyo4vIc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jernej Skrabec , Samuel Holland , Heiko Stuebner , Sasha Levin Subject: [PATCH 4.19 16/25] soc: sunxi: sram: Prevent the driver from being unbound Date: Mon, 3 Oct 2022 09:12:19 +0200 Message-Id: <20221003070715.894740740@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070715.406550966@linuxfoundation.org> References: <20221003070715.406550966@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Samuel Holland [ Upstream commit 90e10a1fcd9b24b4ba8c0d35136127473dcd829e ] This driver exports a regmap tied to the platform device (as opposed to a syscon, which exports a regmap tied to the OF node). Because of this, the driver can never be unbound, as that would destroy the regmap. Use builtin_platform_driver_probe() to enforce this limitation. Fixes: 5828729bebbb ("soc: sunxi: export a regmap for EMAC clock reg on A64= ") Reviewed-by: Jernej Skrabec Signed-off-by: Samuel Holland Reviewed-by: Heiko Stuebner Tested-by: Heiko Stuebner Signed-off-by: Jernej Skrabec Link: https://lore.kernel.org/r/20220815041248.53268-5-samuel@sholland.org Signed-off-by: Sasha Levin Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/soc/sunxi/sunxi_sram.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/soc/sunxi/sunxi_sram.c b/drivers/soc/sunxi/sunxi_sram.c index 51148704af49..17ac818622fe 100644 --- a/drivers/soc/sunxi/sunxi_sram.c +++ b/drivers/soc/sunxi/sunxi_sram.c @@ -325,7 +325,7 @@ static struct regmap_config sunxi_sram_emac_clock_regma= p =3D { .writeable_reg =3D sunxi_sram_regmap_accessible_reg, }; =20 -static int sunxi_sram_probe(struct platform_device *pdev) +static int __init sunxi_sram_probe(struct platform_device *pdev) { struct resource *res; struct dentry *d; @@ -399,9 +399,8 @@ static struct platform_driver sunxi_sram_driver =3D { .name =3D "sunxi-sram", .of_match_table =3D sunxi_sram_dt_match, }, - .probe =3D sunxi_sram_probe, }; -module_platform_driver(sunxi_sram_driver); +builtin_platform_driver_probe(sunxi_sram_driver, sunxi_sram_probe); =20 MODULE_AUTHOR("Maxime Ripard "); MODULE_DESCRIPTION("Allwinner sunXi SRAM Controller Driver"); --=20 2.35.1 From nobody Thu Dec 18 22:29:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABDCDC433F5 for ; Mon, 3 Oct 2022 07:45:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232075AbiJCHo6 (ORCPT ); Mon, 3 Oct 2022 03:44:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232174AbiJCHnp (ORCPT ); Mon, 3 Oct 2022 03:43:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E8402980E; Mon, 3 Oct 2022 00:25:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 38C19B80E9D; Mon, 3 Oct 2022 07:25:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87716C433C1; Mon, 3 Oct 2022 07:25:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781908; bh=bH8tmTDyX6oq9H2j2RQ6weiKAgLRb0hcdLrWON/XEuw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LRls+2ez4H1UDwosMEYnhFeyeogJ/akNGCgh6OfYG+f/t3rQs6xda0dLUJSzbzwY4 JKgt9/UVrVqQvOvpB10PcCgykob0u5HEfAtWOEvMMhK5lUnpsEBtLaMoeJeXnl2i9m AtINPggdhmyFOFlhsjbvDFF+3UdgK2zXi7BE/s0U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jernej Skrabec , Samuel Holland , Heiko Stuebner , Sasha Levin Subject: [PATCH 4.19 17/25] soc: sunxi: sram: Fix probe function ordering issues Date: Mon, 3 Oct 2022 09:12:20 +0200 Message-Id: <20221003070715.921132977@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070715.406550966@linuxfoundation.org> References: <20221003070715.406550966@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Samuel Holland [ Upstream commit 49fad91a7b8941979c3e9a35f9894ac45bc5d3d6 ] Errors from debugfs are intended to be non-fatal, and should not prevent the driver from probing. Since debugfs file creation is treated as infallible, move it below the parts of the probe function that can fail. This prevents an error elsewhere in the probe function from causing the file to leak. Do the same for the call to of_platform_populate(). Finally, checkpatch suggests an octal literal for the file permissions. Fixes: 4af34b572a85 ("drivers: soc: sunxi: Introduce SoC driver to map SRAM= s") Fixes: 5828729bebbb ("soc: sunxi: export a regmap for EMAC clock reg on A64= ") Reviewed-by: Jernej Skrabec Signed-off-by: Samuel Holland Tested-by: Heiko Stuebner Signed-off-by: Jernej Skrabec Link: https://lore.kernel.org/r/20220815041248.53268-6-samuel@sholland.org Signed-off-by: Sasha Levin Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/soc/sunxi/sunxi_sram.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/soc/sunxi/sunxi_sram.c b/drivers/soc/sunxi/sunxi_sram.c index 17ac818622fe..98a4d4548a23 100644 --- a/drivers/soc/sunxi/sunxi_sram.c +++ b/drivers/soc/sunxi/sunxi_sram.c @@ -328,9 +328,9 @@ static struct regmap_config sunxi_sram_emac_clock_regma= p =3D { static int __init sunxi_sram_probe(struct platform_device *pdev) { struct resource *res; - struct dentry *d; struct regmap *emac_clock; const struct sunxi_sramc_variant *variant; + struct device *dev =3D &pdev->dev; =20 sram_dev =3D &pdev->dev; =20 @@ -343,13 +343,6 @@ static int __init sunxi_sram_probe(struct platform_dev= ice *pdev) if (IS_ERR(base)) return PTR_ERR(base); =20 - of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev); - - d =3D debugfs_create_file("sram", S_IRUGO, NULL, NULL, - &sunxi_sram_fops); - if (!d) - return -ENOMEM; - if (variant->has_emac_clock) { emac_clock =3D devm_regmap_init_mmio(&pdev->dev, base, &sunxi_sram_emac_clock_regmap); @@ -358,6 +351,10 @@ static int __init sunxi_sram_probe(struct platform_dev= ice *pdev) return PTR_ERR(emac_clock); } =20 + of_platform_populate(dev->of_node, NULL, NULL, dev); + + debugfs_create_file("sram", 0444, NULL, NULL, &sunxi_sram_fops); + return 0; } =20 --=20 2.35.1 From nobody Thu Dec 18 22:29:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0CE0C433F5 for ; Mon, 3 Oct 2022 07:49:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232143AbiJCHtj (ORCPT ); Mon, 3 Oct 2022 03:49:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232504AbiJCHsu (ORCPT ); Mon, 3 Oct 2022 03:48:50 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50E474CA2D; Mon, 3 Oct 2022 00:27:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1A9A2B80E95; Mon, 3 Oct 2022 07:25:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68CBAC433C1; Mon, 3 Oct 2022 07:25:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781911; bh=HF3Bai1FuaDExbJPKkn3jxEmi1N1I4dUecZ7Yor5B1I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s7KDtKZcICe4qlJacQZMFOFURkIBEQhdbgczEV22zN+blNdkR/c4xFk2PSu23kvVB VlRM23XCsvqMx2yIfpR7jcBy2Au3B3Pn5ZJNI9L+jsUHcAvXxGN+mcMRFraZ0ee2fW 2uQhZaDCAqamTQx1f9UyT2ASJeF8a7trqrJ/3dcY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jernej Skrabec , Samuel Holland , Sasha Levin Subject: [PATCH 4.19 18/25] soc: sunxi: sram: Fix debugfs info for A64 SRAM C Date: Mon, 3 Oct 2022 09:12:21 +0200 Message-Id: <20221003070715.951863669@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070715.406550966@linuxfoundation.org> References: <20221003070715.406550966@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Samuel Holland [ Upstream commit e3c95edb1bd8b9c2cb0caa6ae382fc8080f6a0ed ] The labels were backward with respect to the register values. The SRAM is mapped to the CPU when the register value is 1. Fixes: 5e4fb6429761 ("drivers: soc: sunxi: add support for A64 and its SRAM= C") Acked-by: Jernej Skrabec Signed-off-by: Samuel Holland Signed-off-by: Jernej Skrabec Link: https://lore.kernel.org/r/20220815041248.53268-7-samuel@sholland.org Signed-off-by: Sasha Levin Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/soc/sunxi/sunxi_sram.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/soc/sunxi/sunxi_sram.c b/drivers/soc/sunxi/sunxi_sram.c index 98a4d4548a23..2c1672f9aac9 100644 --- a/drivers/soc/sunxi/sunxi_sram.c +++ b/drivers/soc/sunxi/sunxi_sram.c @@ -78,8 +78,8 @@ static struct sunxi_sram_desc sun4i_a10_sram_d =3D { =20 static struct sunxi_sram_desc sun50i_a64_sram_c =3D { .data =3D SUNXI_SRAM_DATA("C", 0x4, 24, 1, - SUNXI_SRAM_MAP(0, 1, "cpu"), - SUNXI_SRAM_MAP(1, 0, "de2")), + SUNXI_SRAM_MAP(1, 0, "cpu"), + SUNXI_SRAM_MAP(0, 1, "de2")), }; =20 static const struct of_device_id sunxi_sram_dt_ids[] =3D { --=20 2.35.1 From nobody Thu Dec 18 22:29:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9366C433FE for ; Mon, 3 Oct 2022 07:56:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229681AbiJCH4g (ORCPT ); Mon, 3 Oct 2022 03:56:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230071AbiJCHzx (ORCPT ); Mon, 3 Oct 2022 03:55:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11A7248C94; Mon, 3 Oct 2022 00:32:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F041C60FB1; Mon, 3 Oct 2022 07:25:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0E3E0C433D6; Mon, 3 Oct 2022 07:25:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781914; bh=BiCoUirCjlqMTJk4znZZpmbL78DcpfXn2B6JW7fzKvg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gMgYeQUflRoFr1522Jg70pySi39ZKYV80jICKBmkID3cOL/yXmBEIYz4bkfanxRC0 9JhFb023Qze/UJhEmWDEpZzsrPULoAxCIa6z6lVmkt8MGOcOzJyqemp1eYxLjXhtiF COd/XdCUWlaJSeHapAm6Y3aty68XPqIi9/FsDG50= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brian Norris , Douglas Anderson , Sasha Levin Subject: [PATCH 4.19 19/25] Revert "drm: bridge: analogix/dp: add panel prepare/unprepare in suspend/resume time" Date: Mon, 3 Oct 2022 09:12:22 +0200 Message-Id: <20221003070715.984212515@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070715.406550966@linuxfoundation.org> References: <20221003070715.406550966@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Brian Norris [ Upstream commit cc62d98bd56d45de4531844ca23913a15136c05b ] This reverts commit 211f276ed3d96e964d2d1106a198c7f4a4b3f4c0. For quite some time, core DRM helpers already ensure that any relevant connectors/CRTCs/etc. are disabled, as well as their associated components (e.g., bridges) when suspending the system. Thus, analogix_dp_bridge_{enable,disable}() already get called, which in turn call drm_panel_{prepare,unprepare}(). This makes these drm_panel_*() calls redundant. Besides redundancy, there are a few problems with this handling: (1) drm_panel_{prepare,unprepare}() are *not* reference-counted APIs and are not in general designed to be handled by multiple callers -- although some panel drivers have a coarse 'prepared' flag that mitigates some damage, at least. So at a minimum this is redundant and confusing, but in some cases, this could be actively harmful. (2) The error-handling is a bit non-standard. We ignored errors in suspend(), but handled errors in resume(). And recently, people noticed that the clk handling is unbalanced in error paths, and getting *that* right is not actually trivial, given the current way errors are mostly ignored. (3) In the particular way analogix_dp_{suspend,resume}() get used (e.g., in rockchip_dp_*(), as a late/early callback), we don't necessarily have a proper PM relationship between the DP/bridge device and the panel device. So while the DP bridge gets resumed, the panel's parent device (e.g., platform_device) may still be suspended, and so any prepare() calls may fail. So remove the superfluous, possibly-harmful suspend()/resume() handling of panel state. Fixes: 211f276ed3d9 ("drm: bridge: analogix/dp: add panel prepare/unprepare= in suspend/resume time") Link: https://lore.kernel.org/all/Yv2CPBD3Picg%2FgVe@google.com/ Signed-off-by: Brian Norris Reviewed-by: Douglas Anderson Signed-off-by: Douglas Anderson Link: https://patchwork.freedesktop.org/patch/msgid/20220822180729.1.I8ac5a= be3a4c1c6fd5c061686c6e883c22f69022c@changeid Signed-off-by: Sasha Levin Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/g= pu/drm/bridge/analogix/analogix_dp_core.c index e21c7673cd5b..57781833cae1 100644 --- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c @@ -1690,12 +1690,6 @@ EXPORT_SYMBOL_GPL(analogix_dp_unbind); int analogix_dp_suspend(struct analogix_dp_device *dp) { clk_disable_unprepare(dp->clock); - - if (dp->plat_data->panel) { - if (drm_panel_unprepare(dp->plat_data->panel)) - DRM_ERROR("failed to turnoff the panel\n"); - } - return 0; } EXPORT_SYMBOL_GPL(analogix_dp_suspend); @@ -1710,13 +1704,6 @@ int analogix_dp_resume(struct analogix_dp_device *dp) return ret; } =20 - if (dp->plat_data->panel) { - if (drm_panel_prepare(dp->plat_data->panel)) { - DRM_ERROR("failed to setup the panel\n"); - return -EBUSY; - } - } - return 0; } EXPORT_SYMBOL_GPL(analogix_dp_resume); --=20 2.35.1 From nobody Thu Dec 18 22:29:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE686C433F5 for ; Mon, 3 Oct 2022 07:44:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232062AbiJCHoz (ORCPT ); Mon, 3 Oct 2022 03:44:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232165AbiJCHno (ORCPT ); Mon, 3 Oct 2022 03:43:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D95F9543DE; Mon, 3 Oct 2022 00:25:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 4D197B80E96; Mon, 3 Oct 2022 07:25:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7110C433B5; Mon, 3 Oct 2022 07:25:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781917; bh=dn25CVpD2oaYtaktFbYJOqPGka3DxfJ6hLgw9cNW8sQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EhHDRfsjIQVsvfb29GUQi5a7H3pKnJQeOjC+1v1DoEG+of/TaBV5mncZWGDgomw1a AqTft7SFsyiyIoYzgwfXPgMQ6RW7sQrCmkQoIABCQjVFYYUcjA3nKUkNxjQnvdc8Xj W0US4NxLZr2v2a9850BZoJgkLwlSSLn9Sh5UwZJY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yang Yingliang , Dmitry Torokhov , Sasha Levin Subject: [PATCH 4.19 20/25] Input: melfas_mip4 - fix return value check in mip4_probe() Date: Mon, 3 Oct 2022 09:12:23 +0200 Message-Id: <20221003070716.014220255@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070715.406550966@linuxfoundation.org> References: <20221003070715.406550966@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yang Yingliang [ Upstream commit a54dc27bd25f20ee3ea2009584b3166d25178243 ] devm_gpiod_get_optional() may return ERR_PTR(-EPROBE_DEFER), add a minus sign to fix it. Fixes: 6ccb1d8f78bd ("Input: add MELFAS MIP4 Touchscreen driver") Signed-off-by: Yang Yingliang Link: https://lore.kernel.org/r/20220924030715.1653538-1-yangyingliang@huaw= ei.com Signed-off-by: Dmitry Torokhov Signed-off-by: Sasha Levin Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/input/touchscreen/melfas_mip4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/melfas_mip4.c b/drivers/input/touchs= creen/melfas_mip4.c index 430a2bc5f7ca..5d947e721fa5 100644 --- a/drivers/input/touchscreen/melfas_mip4.c +++ b/drivers/input/touchscreen/melfas_mip4.c @@ -1462,7 +1462,7 @@ static int mip4_probe(struct i2c_client *client, cons= t struct i2c_device_id *id) "ce", GPIOD_OUT_LOW); if (IS_ERR(ts->gpio_ce)) { error =3D PTR_ERR(ts->gpio_ce); - if (error !=3D EPROBE_DEFER) + if (error !=3D -EPROBE_DEFER) dev_err(&client->dev, "Failed to get gpio: %d\n", error); return error; --=20 2.35.1 From nobody Thu Dec 18 22:29:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFC27C433F5 for ; Mon, 3 Oct 2022 08:28:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230041AbiJCI2r (ORCPT ); Mon, 3 Oct 2022 04:28:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230510AbiJCI2E (ORCPT ); Mon, 3 Oct 2022 04:28:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F417647DF; Mon, 3 Oct 2022 01:01:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 31498B80E9F; Mon, 3 Oct 2022 07:25:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B13BC433C1; Mon, 3 Oct 2022 07:25:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781919; bh=6z4X8fdc30EX8EybZYHf6yJ9cjSlrxFgDetFSSUifgk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p9G7GjyJir+xaP+SrT5eSGVEphNR0xYgU3FIS5r7mLzBg8FZjHwdslCWUXnR2p/mP 9WBF1aQ9tCEGP7nCcTNct+FfxDdrOgSBE02bQMo09rOl4Ecxy027DHR7wOrnpV7fmQ jehsBPrjtHM9KeWP1FF0CxVnJEtYDv88tAorCU/o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peilin Ye , Jakub Kicinski , Sasha Levin , syzbot+dcd3e13cf4472f2e0ba1@syzkaller.appspotmail.com Subject: [PATCH 4.19 21/25] usbnet: Fix memory leak in usbnet_disconnect() Date: Mon, 3 Oct 2022 09:12:24 +0200 Message-Id: <20221003070716.040690340@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070715.406550966@linuxfoundation.org> References: <20221003070715.406550966@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peilin Ye [ Upstream commit a43206156263fbaf1f2b7f96257441f331e91bb7 ] Currently usbnet_disconnect() unanchors and frees all deferred URBs using usb_scuttle_anchored_urbs(), which does not free urb->context, causing a memory leak as reported by syzbot. Use a usb_get_from_anchor() while loop instead, similar to what we did in commit 19cfe912c37b ("Bluetooth: btusb: Fix memory leak in play_deferred"). Also free urb->sg. Reported-and-tested-by: syzbot+dcd3e13cf4472f2e0ba1@syzkaller.appspotmail.c= om Fixes: 69ee472f2706 ("usbnet & cdc-ether: Autosuspend for online devices") Fixes: 638c5115a794 ("USBNET: support DMA SG") Signed-off-by: Peilin Ye Link: https://lore.kernel.org/r/20220923042551.2745-1-yepeilin.cs@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/net/usb/usbnet.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/usb/usbnet.c b/drivers/net/usb/usbnet.c index 1316f5b0c0d7..2263a66f6314 100644 --- a/drivers/net/usb/usbnet.c +++ b/drivers/net/usb/usbnet.c @@ -1596,6 +1596,7 @@ void usbnet_disconnect (struct usb_interface *intf) struct usbnet *dev; struct usb_device *xdev; struct net_device *net; + struct urb *urb; =20 dev =3D usb_get_intfdata(intf); usb_set_intfdata(intf, NULL); @@ -1612,7 +1613,11 @@ void usbnet_disconnect (struct usb_interface *intf) net =3D dev->net; unregister_netdev (net); =20 - usb_scuttle_anchored_urbs(&dev->deferred); + while ((urb =3D usb_get_from_anchor(&dev->deferred))) { + dev_kfree_skb(urb->context); + kfree(urb->sg); + usb_free_urb(urb); + } =20 if (dev->driver_info->unbind) dev->driver_info->unbind (dev, intf); --=20 2.35.1 From nobody Thu Dec 18 22:29:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC3C8C433FE for ; Mon, 3 Oct 2022 07:47:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232305AbiJCHrr (ORCPT ); Mon, 3 Oct 2022 03:47:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229529AbiJCHrG (ORCPT ); Mon, 3 Oct 2022 03:47:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2DFE958B6F; Mon, 3 Oct 2022 00:26:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 309EA60FB7; Mon, 3 Oct 2022 07:25:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3F197C433D7; Mon, 3 Oct 2022 07:25:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781922; bh=x1TsmQwnhKpWtR98rfenZukIz1vkN+WDBx41TaE2b5E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R6kokqxU1lToGjed5nL3zoTBNQQgvXvuBvk8Js8almTPBAlsFwKhnvsEqC28e3JDA 29Onc8+qqrHtUIRyoKy9GFOojQWrmNAvyUm9RnJZy803pfKHAqXB0f2gSLX6AZu6FO lfizdGJKaNTE6gvu17+CflgPgRhsnxzWfS/aCX60= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chaitanya Kulkarni , Christoph Hellwig , Sasha Levin Subject: [PATCH 4.19 22/25] nvme: add new line after variable declatation Date: Mon, 3 Oct 2022 09:12:25 +0200 Message-Id: <20221003070716.067118204@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070715.406550966@linuxfoundation.org> References: <20221003070715.406550966@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chaitanya Kulkarni [ Upstream commit f1c772d581843e3a14bbd62ef7e40b56fc307f27 ] Add a new line in functions nvme_pr_preempt(), nvme_pr_clear(), and nvme_pr_release() after variable declaration which follows the rest of the code in the nvme/host/core.c. No functional change(s) in this patch. Signed-off-by: Chaitanya Kulkarni Signed-off-by: Christoph Hellwig Stable-dep-of: c292a337d0e4 ("nvme: Fix IOC_PR_CLEAR and IOC_PR_RELEASE ioc= tls for nvme devices") Signed-off-by: Sasha Levin Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/nvme/host/core.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index a0a805a5ab6b..44ee6dc5e0ca 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1716,18 +1716,21 @@ static int nvme_pr_preempt(struct block_device *bde= v, u64 old, u64 new, enum pr_type type, bool abort) { u32 cdw10 =3D nvme_pr_type(type) << 8 | (abort ? 2 : 1); + return nvme_pr_command(bdev, cdw10, old, new, nvme_cmd_resv_acquire); } =20 static int nvme_pr_clear(struct block_device *bdev, u64 key) { u32 cdw10 =3D 1 | (key ? 1 << 3 : 0); + return nvme_pr_command(bdev, cdw10, key, 0, nvme_cmd_resv_register); } =20 static int nvme_pr_release(struct block_device *bdev, u64 key, enum pr_typ= e type) { u32 cdw10 =3D nvme_pr_type(type) << 8 | (key ? 1 << 3 : 0); + return nvme_pr_command(bdev, cdw10, key, 0, nvme_cmd_resv_release); } =20 --=20 2.35.1 From nobody Thu Dec 18 22:29:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B25AC433F5 for ; Mon, 3 Oct 2022 07:56:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229982AbiJCH4B (ORCPT ); Mon, 3 Oct 2022 03:56:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229699AbiJCHzc (ORCPT ); Mon, 3 Oct 2022 03:55:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DCA52127D; Mon, 3 Oct 2022 00:32:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BE03B60FA2; Mon, 3 Oct 2022 07:25:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3A4BC433D6; Mon, 3 Oct 2022 07:25:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781925; bh=QTx2zcyJaFTx5dJid3Fi2UGBhUpjVPbtJms/BBu/RO4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y9ooMqLd6ws3xIwURKiokmQGDq642TCVHjH1RXLXjH+zzhaFyH1fT6PEx4E9ywrkI xOiJH6+CcIkXzJbF+vO5MJVSSsAtU8QT2jM8JTmPKI1VhF5BHTsUJnbcFuWaHhmhnV pF53OSS63o9cmVaejmwKKnFx34iIeFprP0qzQ4GE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Kelley , Christoph Hellwig , Sasha Levin Subject: [PATCH 4.19 23/25] nvme: Fix IOC_PR_CLEAR and IOC_PR_RELEASE ioctls for nvme devices Date: Mon, 3 Oct 2022 09:12:26 +0200 Message-Id: <20221003070716.094318426@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070715.406550966@linuxfoundation.org> References: <20221003070715.406550966@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michael Kelley [ Upstream commit c292a337d0e45a292c301e3cd51c35aa0ae91e95 ] The IOC_PR_CLEAR and IOC_PR_RELEASE ioctls are non-functional on NVMe devices because the nvme_pr_clear() and nvme_pr_release() functions set the IEKEY field incorrectly. The IEKEY field should be set only when the key is zero (i.e, not specified). The current code does it backwards. Furthermore, the NVMe spec describes the persistent reservation "clear" function as an option on the reservation release command. The current implementation of nvme_pr_clear() erroneously uses the reservation register command. Fix these errors. Note that NVMe version 1.3 and later specify that setting the IEKEY field will return an error of Invalid Field in Command. The fix will set IEKEY when the key is zero, which is appropriate as these ioctls consider a zero key to be "unspecified", and the intention of the spec change is to require a valid key. Tested on a version 1.4 PCI NVMe device in an Azure VM. Fixes: 1673f1f08c88 ("nvme: move block_device_operations and ns/ctrl freein= g to common code") Fixes: 1d277a637a71 ("NVMe: Add persistent reservation ops") Signed-off-by: Michael Kelley Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/nvme/host/core.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 44ee6dc5e0ca..582c3b190418 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -1722,14 +1722,14 @@ static int nvme_pr_preempt(struct block_device *bde= v, u64 old, u64 new, =20 static int nvme_pr_clear(struct block_device *bdev, u64 key) { - u32 cdw10 =3D 1 | (key ? 1 << 3 : 0); + u32 cdw10 =3D 1 | (key ? 0 : 1 << 3); =20 - return nvme_pr_command(bdev, cdw10, key, 0, nvme_cmd_resv_register); + return nvme_pr_command(bdev, cdw10, key, 0, nvme_cmd_resv_release); } =20 static int nvme_pr_release(struct block_device *bdev, u64 key, enum pr_typ= e type) { - u32 cdw10 =3D nvme_pr_type(type) << 8 | (key ? 1 << 3 : 0); + u32 cdw10 =3D nvme_pr_type(type) << 8 | (key ? 0 : 1 << 3); =20 return nvme_pr_command(bdev, cdw10, key, 0, nvme_cmd_resv_release); } --=20 2.35.1 From nobody Thu Dec 18 22:29:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27980C433FE for ; Mon, 3 Oct 2022 07:47:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229712AbiJCHr5 (ORCPT ); Mon, 3 Oct 2022 03:47:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229549AbiJCHrJ (ORCPT ); Mon, 3 Oct 2022 03:47:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D895258DCF; Mon, 3 Oct 2022 00:26:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5627760FD1; Mon, 3 Oct 2022 07:25:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B435C433C1; Mon, 3 Oct 2022 07:25:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781927; bh=HzWNp5YyPkS2fPfnmk/Ug6wOXveeiRA34eO/DWm4nXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aRCgYBrSpdO+19aNJXjttuTxlosBZW3z0yNZA9XmVc8JYCH/ZOoD+J428UuPBvUGj tri2xA/lu7IOIwRrFP2y+yU8s2VEh/JlilRKenE0EaWBRCfQGRw9Fl9i/Nf8/Jd6BE yTVmXeF0aN7jPTzlYjKAXjcTQXZTaAs43o91gz4A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wang Yufen , Paolo Abeni , Sasha Levin Subject: [PATCH 4.19 24/25] selftests: Fix the if conditions of in test_extra_filter() Date: Mon, 3 Oct 2022 09:12:27 +0200 Message-Id: <20221003070716.119830172@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070715.406550966@linuxfoundation.org> References: <20221003070715.406550966@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wang Yufen [ Upstream commit bc7a319844891746135dc1f34ab9df78d636a3ac ] The socket 2 bind the addr in use, bind should fail with EADDRINUSE. So if bind success or errno !=3D EADDRINUSE, testcase should be failed. Fixes: 3ca8e4029969 ("soreuseport: BPF selection functional test") Signed-off-by: Wang Yufen Link: https://lore.kernel.org/r/1663916557-10730-1-git-send-email-wangyufen= @huawei.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- tools/testing/selftests/net/reuseport_bpf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/net/reuseport_bpf.c b/tools/testing/se= lftests/net/reuseport_bpf.c index b5277106df1f..b0cc082fbb84 100644 --- a/tools/testing/selftests/net/reuseport_bpf.c +++ b/tools/testing/selftests/net/reuseport_bpf.c @@ -330,7 +330,7 @@ static void test_extra_filter(const struct test_params = p) if (bind(fd1, addr, sockaddr_size())) error(1, errno, "failed to bind recv socket 1"); =20 - if (!bind(fd2, addr, sockaddr_size()) && errno !=3D EADDRINUSE) + if (!bind(fd2, addr, sockaddr_size()) || errno !=3D EADDRINUSE) error(1, errno, "bind socket 2 should fail with EADDRINUSE"); =20 free(addr); --=20 2.35.1 From nobody Thu Dec 18 22:29:01 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19D20C433FE for ; Mon, 3 Oct 2022 07:45:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232085AbiJCHpF (ORCPT ); Mon, 3 Oct 2022 03:45:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232199AbiJCHnt (ORCPT ); Mon, 3 Oct 2022 03:43:49 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B6BC4F7F; Mon, 3 Oct 2022 00:25:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BD45AB80E85; Mon, 3 Oct 2022 07:25:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1191DC43470; Mon, 3 Oct 2022 07:25:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781930; bh=7QuY/R7TUa6IcLI0yP2FjJ56tqDnwMl1fXfia1kTBLs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pXHOsFF/kvhMQG0nsjyOf74hrGSj+cffL2zwck3BPaybs5xUTPwaUMww8TnxjSWdm e9yPUfm6Z4BK/l+BOXnLz9jfRicPzC6FLvjhB8LdcFEqVx1lYgnRJnYqCtaX48Kjxs Mz+OtC8L9I1ThZQPEC5nxoFChlc5MV0u+emdVn3Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Fainelli , =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= , Stephen Boyd , Sasha Levin Subject: [PATCH 4.19 25/25] clk: iproc: Do not rely on node name for correct PLL setup Date: Mon, 3 Oct 2022 09:12:28 +0200 Message-Id: <20221003070716.149633667@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070715.406550966@linuxfoundation.org> References: <20221003070715.406550966@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Florian Fainelli [ Upstream commit 1b24a132eba7a1c19475ba2510ec1c00af3ff914 ] After commit 31fd9b79dc58 ("ARM: dts: BCM5301X: update CRU block description") a warning from clk-iproc-pll.c was generated due to a duplicate PLL name as well as the console stopped working. Upon closer inspection it became clear that iproc_pll_clk_setup() used the Device Tree node unit name as an unique identifier as well as a parent name to parent all clocks under the PLL. BCM5301X was the first platform on which that got noticed because of the DT node unit name renaming but the same assumptions hold true for any user of the iproc_pll_clk_setup() function. The first 'clock-output-names' property is always guaranteed to be unique as well as providing the actual desired PLL clock name, so we utilize that to register the PLL and as a parent name of all children clock. Fixes: 5fe225c105fd ("clk: iproc: add initial common clock support") Signed-off-by: Florian Fainelli Acked-by: Rafa=C5=82 Mi=C5=82ecki Link: https://lore.kernel.org/r/20220905161504.1526-1-f.fainelli@gmail.com Signed-off-by: Stephen Boyd Signed-off-by: Sasha Levin Tested-by: Guenter Roeck Tested-by: Hulk Robot Tested-by: Linux Kernel Functional Testing Tested-by: Pavel Machek (CIP) Tested-by: Shuah Khan Tested-by: Slade Watkins Tested-by: Sudip Mukherjee --- drivers/clk/bcm/clk-iproc-pll.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/clk/bcm/clk-iproc-pll.c b/drivers/clk/bcm/clk-iproc-pl= l.c index 274441e2ddb2..8f0619f362e3 100644 --- a/drivers/clk/bcm/clk-iproc-pll.c +++ b/drivers/clk/bcm/clk-iproc-pll.c @@ -736,6 +736,7 @@ void iproc_pll_clk_setup(struct device_node *node, const char *parent_name; struct iproc_clk *iclk_array; struct clk_hw_onecell_data *clk_data; + const char *clk_name; =20 if (WARN_ON(!pll_ctrl) || WARN_ON(!clk_ctrl)) return; @@ -783,7 +784,12 @@ void iproc_pll_clk_setup(struct device_node *node, iclk =3D &iclk_array[0]; iclk->pll =3D pll; =20 - init.name =3D node->name; + ret =3D of_property_read_string_index(node, "clock-output-names", + 0, &clk_name); + if (WARN_ON(ret)) + goto err_pll_register; + + init.name =3D clk_name; init.ops =3D &iproc_pll_ops; init.flags =3D 0; parent_name =3D of_clk_get_parent_name(node, 0); @@ -803,13 +809,11 @@ void iproc_pll_clk_setup(struct device_node *node, goto err_pll_register; =20 clk_data->hws[0] =3D &iclk->hw; + parent_name =3D clk_name; =20 /* now initialize and register all leaf clocks */ for (i =3D 1; i < num_clks; i++) { - const char *clk_name; - memset(&init, 0, sizeof(init)); - parent_name =3D node->name; =20 ret =3D of_property_read_string_index(node, "clock-output-names", i, &clk_name); --=20 2.35.1