From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6F5DCCA47C for ; Mon, 20 Jun 2022 12:53:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241471AbiFTMxI (ORCPT ); Mon, 20 Jun 2022 08:53:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241345AbiFTMxF (ORCPT ); Mon, 20 Jun 2022 08:53:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 823FBDEE; Mon, 20 Jun 2022 05:53:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3F65CB811A2; Mon, 20 Jun 2022 12:53:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 65B82C3411B; Mon, 20 Jun 2022 12:53:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729581; bh=pKqvNCdZg3v1ahitohlcLAY3SfAkUAhwKbCU6xelYlQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=faanviX1/uLAtjAxmT2fS/7N6fGIPLM/Z52mQhuGWVwi18i5eMhK+89SAN/fT1d1/ fCiMPr1cbnpDY0tN/ZJf3l5swnqAywGzPrdIffvAeQsQEqfnhscFokHzAqDQkwVZ4g lhBsnSZZNXe1K8Ls55+8EyikWmA84q7comM6PeyU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stylon Wang , Nicholas Kazlauskas , Daniel Wheeler , Alex Deucher , "Limonciello, Mario" Subject: [PATCH 5.18 001/141] Revert "drm/amd/display: Fix DCN3 B0 DP Alt Mapping" Date: Mon, 20 Jun 2022 14:48:59 +0200 Message-Id: <20220620124729.555038849@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stylon Wang commit 1039188806d4cfdf9c412bb4ddb51b4d8cd15478 upstream. This reverts commit 4b7786d87fb3adf3e534c4f1e4f824d8700b786b. Commit 4b7786d87fb3 ("drm/amd/display: Fix DCN3 B0 DP Alt Mapping") is causing 2nd USB-C display not lighting up. Phy id remapping is done differently than is assumed in this patch. Signed-off-by: Stylon Wang Reviewed-by: Nicholas Kazlauskas Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Cc: "Limonciello, Mario" Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c | 6 ------ 1 file changed, 6 deletions(-) --- a/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c +++ b/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_resource.c @@ -1392,12 +1392,6 @@ static struct stream_encoder *dcn31_stre return NULL; } =20 - if (ctx->asic_id.chip_family =3D=3D FAMILY_YELLOW_CARP && - ctx->asic_id.hw_internal_rev =3D=3D YELLOW_CARP_B0) { - if ((eng_id =3D=3D ENGINE_ID_DIGC) || (eng_id =3D=3D ENGINE_ID_DIGD)) - eng_id =3D eng_id + 3; // For B0 only. C->F, D->G. - } - dcn30_dio_stream_encoder_construct(enc1, ctx, ctx->dc_bios, eng_id, vpg, afmt, &stream_enc_regs[eng_id], From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 88D35C43334 for ; Mon, 20 Jun 2022 12:54:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242961AbiFTMyD (ORCPT ); Mon, 20 Jun 2022 08:54:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242877AbiFTMxi (ORCPT ); Mon, 20 Jun 2022 08:53:38 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D443DFC2; Mon, 20 Jun 2022 05:53: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 EF266B811A2; Mon, 20 Jun 2022 12:53:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E812C3411B; Mon, 20 Jun 2022 12:53:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729615; bh=0T5pLQ2jcyVXZqHu1Zl2epmxPE4gtirDF3BkhxV0uDg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wAocZ3n59j3tnYWH3tT726u9IwGu0Hbmr0wp5gKpUZuYztjpYZtp5iM+fxBz4Ld7j 5FmX9O//fNp8b3plIsPq8v0z8E62GkgCP9ZwWfTqtOVQIVVFG1ZsVUpLxcn6uXOt2t cOk+xuZeXA5Gba+5DP3SpImvXn/9+Ffw88Lp/6pA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adam Ford , Shawn Guo Subject: [PATCH 5.18 002/141] arm64: dts: imx8mm-beacon: Enable RTS-CTS on UART3 Date: Mon, 20 Jun 2022 14:49:00 +0200 Message-Id: <20220620124729.585626370@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Adam Ford commit 4ce01ce36d77137cf60776b320babed89de6bd4c upstream. There is a header for a DB9 serial port, but any attempts to use hardware handshaking fail. Enable RTS and CTS pin muxing and enable handshaking in the uart node. Signed-off-by: Adam Ford Signed-off-by: Shawn Guo Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/arm64/boot/dts/freescale/imx8mm-beacon-baseboard.dtsi | 3 +++ 1 file changed, 3 insertions(+) --- a/arch/arm64/boot/dts/freescale/imx8mm-beacon-baseboard.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mm-beacon-baseboard.dtsi @@ -278,6 +278,7 @@ pinctrl-0 =3D <&pinctrl_uart3>; assigned-clocks =3D <&clk IMX8MM_CLK_UART3>; assigned-clock-parents =3D <&clk IMX8MM_SYS_PLL1_80M>; + uart-has-rtscts; status =3D "okay"; }; =20 @@ -386,6 +387,8 @@ fsl,pins =3D < MX8MM_IOMUXC_ECSPI1_SCLK_UART3_DCE_RX 0x40 MX8MM_IOMUXC_ECSPI1_MOSI_UART3_DCE_TX 0x40 + MX8MM_IOMUXC_ECSPI1_MISO_UART3_DCE_CTS_B 0x40 + MX8MM_IOMUXC_ECSPI1_SS0_UART3_DCE_RTS_B 0x40 >; }; From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66B1CC433EF for ; Mon, 20 Jun 2022 12:54:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242978AbiFTMyi (ORCPT ); Mon, 20 Jun 2022 08:54:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242999AbiFTMyB (ORCPT ); Mon, 20 Jun 2022 08:54:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA13B18395; Mon, 20 Jun 2022 05:53:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id CDADE614CE; Mon, 20 Jun 2022 12:53:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D63C9C341C4; Mon, 20 Jun 2022 12:53:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729637; bh=ibMduh7HuIyviPvicq4OHZNjcigY+9TDiyymYuZPtYE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yoLS0PjJWczGhUnEBgosskr939yMPBLGH5/O9VNrg52ZytbbQh+48sXG0azej0oQK BWU8LUtCx9IsOpx+8IZ2/CcJkmyfdJUucFdsrEA8AEfdYF3m+MHkD55H+JniAildti /WibLJqNZwG3JFznIuk+tTnqb8SW51PJt7oTvV7A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adam Ford , Shawn Guo Subject: [PATCH 5.18 003/141] arm64: dts: imx8mn-beacon: Enable RTS-CTS on UART3 Date: Mon, 20 Jun 2022 14:49:01 +0200 Message-Id: <20220620124729.615182130@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Adam Ford commit 5446ff1a67160ad92d9aae9530846aa54750be36 upstream. There is a header for a DB9 serial port, but any attempts to use hardware handshaking fail. Enable RTS and CTS pin muxing and enable handshaking in the uart node. Signed-off-by: Adam Ford Signed-off-by: Shawn Guo Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/arm64/boot/dts/freescale/imx8mn-beacon-baseboard.dtsi | 3 +++ 1 file changed, 3 insertions(+) --- a/arch/arm64/boot/dts/freescale/imx8mn-beacon-baseboard.dtsi +++ b/arch/arm64/boot/dts/freescale/imx8mn-beacon-baseboard.dtsi @@ -175,6 +175,7 @@ pinctrl-0 =3D <&pinctrl_uart3>; assigned-clocks =3D <&clk IMX8MN_CLK_UART3>; assigned-clock-parents =3D <&clk IMX8MN_SYS_PLL1_80M>; + uart-has-rtscts; status =3D "okay"; }; =20 @@ -258,6 +259,8 @@ fsl,pins =3D < MX8MN_IOMUXC_ECSPI1_SCLK_UART3_DCE_RX 0x40 MX8MN_IOMUXC_ECSPI1_MOSI_UART3_DCE_TX 0x40 + MX8MN_IOMUXC_ECSPI1_MISO_UART3_DCE_CTS_B 0x40 + MX8MN_IOMUXC_ECSPI1_SS0_UART3_DCE_RTS_B 0x40 >; }; From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A28D3CCA479 for ; Mon, 20 Jun 2022 12:54:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242969AbiFTMyo (ORCPT ); Mon, 20 Jun 2022 08:54:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243037AbiFTMyJ (ORCPT ); Mon, 20 Jun 2022 08:54:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52E0713D05; Mon, 20 Jun 2022 05:54:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id F1D95B811A5; Mon, 20 Jun 2022 12:54:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2971C3411B; Mon, 20 Jun 2022 12:53:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729640; bh=ZWtcHloOu6ofyAaoiLZjNBR4ku6v8PDGWroEVzoiiTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zb7WO5yXsiSeMrApoNZPB6xFhbezsU+hc+FAX13gtTI5+oFK71Gv5g6oKMTfYWcUG ePaCeCgs4jG6R3sj22v319Z5LR7WQ1clKQeR9ud8dFTUWiw09WBe1Din0axIvZ7o1X MLoOMGX0a+kifeuVXhNDNVWxKciS6tCMfhnb0igs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jens Axboe Subject: [PATCH 5.18 004/141] io_uring: reinstate the inflight tracking Date: Mon, 20 Jun 2022 14:49:02 +0200 Message-Id: <20220620124729.645732782@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jens Axboe commit 9cae36a094e7e9d6e5fe8b6dcd4642138b3eb0c7 upstream. After some debugging, it was realized that we really do still need the old inflight tracking for any file type that has io_uring_fops assigned. If we don't, then trivial circular references will mean that we never get the ctx cleaned up and hence it'll leak. Just bring back the inflight tracking, which then also means we can eliminate the conditional dropping of the file when task_work is queued. Fixes: d5361233e9ab ("io_uring: drop the old style inflight file tracking") Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- fs/io_uring.c | 82 +++++++++++++++++++++++++++++++++++++++--------------= ----- 1 file changed, 56 insertions(+), 26 deletions(-) --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -111,7 +111,8 @@ IOSQE_IO_DRAIN | IOSQE_CQE_SKIP_SUCCESS) =20 #define IO_REQ_CLEAN_FLAGS (REQ_F_BUFFER_SELECTED | REQ_F_NEED_CLEANUP | \ - REQ_F_POLLED | REQ_F_CREDS | REQ_F_ASYNC_DATA) + REQ_F_POLLED | REQ_F_INFLIGHT | REQ_F_CREDS | \ + REQ_F_ASYNC_DATA) =20 #define IO_TCTX_REFS_CACHE_NR (1U << 10) =20 @@ -493,6 +494,7 @@ struct io_uring_task { const struct io_ring_ctx *last; struct io_wq *io_wq; struct percpu_counter inflight; + atomic_t inflight_tracked; atomic_t in_idle; =20 spinlock_t task_lock; @@ -1186,8 +1188,6 @@ static void io_clean_op(struct io_kiocb static inline struct file *io_file_get_fixed(struct io_kiocb *req, int fd, unsigned issue_flags); static inline struct file *io_file_get_normal(struct io_kiocb *req, int fd= ); -static void io_drop_inflight_file(struct io_kiocb *req); -static bool io_assign_file(struct io_kiocb *req, unsigned int issue_flags); static void __io_queue_sqe(struct io_kiocb *req); static void io_rsrc_put_work(struct work_struct *work); =20 @@ -1435,9 +1435,29 @@ static bool io_match_task(struct io_kioc bool cancel_all) __must_hold(&req->ctx->timeout_lock) { + struct io_kiocb *req; + if (task && head->task !=3D task) return false; - return cancel_all; + if (cancel_all) + return true; + + io_for_each_link(req, head) { + if (req->flags & REQ_F_INFLIGHT) + return true; + } + return false; +} + +static bool io_match_linked(struct io_kiocb *head) +{ + struct io_kiocb *req; + + io_for_each_link(req, head) { + if (req->flags & REQ_F_INFLIGHT) + return true; + } + return false; } =20 /* @@ -1447,9 +1467,24 @@ static bool io_match_task(struct io_kioc static bool io_match_task_safe(struct io_kiocb *head, struct task_struct *= task, bool cancel_all) { + bool matched; + if (task && head->task !=3D task) return false; - return cancel_all; + if (cancel_all) + return true; + + if (head->flags & REQ_F_LINK_TIMEOUT) { + struct io_ring_ctx *ctx =3D head->ctx; + + /* protect against races with linked timeouts */ + spin_lock_irq(&ctx->timeout_lock); + matched =3D io_match_linked(head); + spin_unlock_irq(&ctx->timeout_lock); + } else { + matched =3D io_match_linked(head); + } + return matched; } =20 static inline bool req_has_async_data(struct io_kiocb *req) @@ -1608,6 +1643,14 @@ static inline bool io_req_ffs_set(struct return req->flags & REQ_F_FIXED_FILE; } =20 +static inline void io_req_track_inflight(struct io_kiocb *req) +{ + if (!(req->flags & REQ_F_INFLIGHT)) { + req->flags |=3D REQ_F_INFLIGHT; + atomic_inc(¤t->io_uring->inflight_tracked); + } +} + static struct io_kiocb *__io_prep_linked_timeout(struct io_kiocb *req) { if (WARN_ON_ONCE(!req->link)) @@ -2516,8 +2559,6 @@ static void io_req_task_work_add(struct =20 WARN_ON_ONCE(!tctx); =20 - io_drop_inflight_file(req); - spin_lock_irqsave(&tctx->task_lock, flags); if (priority) wq_list_add_tail(&req->io_task_work.node, &tctx->prior_task_list); @@ -5869,10 +5910,6 @@ static int io_poll_check_events(struct i =20 if (!req->result) { struct poll_table_struct pt =3D { ._key =3D req->apoll_events }; - unsigned flags =3D locked ? 0 : IO_URING_F_UNLOCKED; - - if (unlikely(!io_assign_file(req, flags))) - return -EBADF; req->result =3D vfs_poll(req->file, &pt) & req->apoll_events; } =20 @@ -7097,6 +7134,11 @@ static void io_clean_op(struct io_kiocb kfree(req->apoll); req->apoll =3D NULL; } + if (req->flags & REQ_F_INFLIGHT) { + struct io_uring_task *tctx =3D req->task->io_uring; + + atomic_dec(&tctx->inflight_tracked); + } if (req->flags & REQ_F_CREDS) put_cred(req->creds); if (req->flags & REQ_F_ASYNC_DATA) { @@ -7393,19 +7435,6 @@ out: return file; } =20 -/* - * Drop the file for requeue operations. Only used of req->file is the - * io_uring descriptor itself. - */ -static void io_drop_inflight_file(struct io_kiocb *req) -{ - if (unlikely(req->flags & REQ_F_INFLIGHT)) { - fput(req->file); - req->file =3D NULL; - req->flags &=3D ~REQ_F_INFLIGHT; - } -} - static struct file *io_file_get_normal(struct io_kiocb *req, int fd) { struct file *file =3D fget(fd); @@ -7414,7 +7443,7 @@ static struct file *io_file_get_normal(s =20 /* we don't allow fixed io_uring files */ if (file && file->f_op =3D=3D &io_uring_fops) - req->flags |=3D REQ_F_INFLIGHT; + io_req_track_inflight(req); return file; } =20 @@ -9211,6 +9240,7 @@ static __cold int io_uring_alloc_task_co xa_init(&tctx->xa); init_waitqueue_head(&tctx->wait); atomic_set(&tctx->in_idle, 0); + atomic_set(&tctx->inflight_tracked, 0); task->io_uring =3D tctx; spin_lock_init(&tctx->task_lock); INIT_WQ_LIST(&tctx->task_list); @@ -10402,7 +10432,7 @@ static __cold void io_uring_clean_tctx(s static s64 tctx_inflight(struct io_uring_task *tctx, bool tracked) { if (tracked) - return 0; + return atomic_read(&tctx->inflight_tracked); return percpu_counter_sum(&tctx->inflight); } From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D3F0C433EF for ; Mon, 20 Jun 2022 12:54:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243196AbiFTMyr (ORCPT ); Mon, 20 Jun 2022 08:54:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243038AbiFTMyJ (ORCPT ); Mon, 20 Jun 2022 08:54:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DD95183B0; Mon, 20 Jun 2022 05:54:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 48767614B7; Mon, 20 Jun 2022 12:54:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56FCBC3411B; Mon, 20 Jun 2022 12:54:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729643; bh=z4nS/GuBUxpX0GXkgOCIkr9OBX7vs0RMQDyx7CNotDw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YNymwzfhmu1rKtVuJrTIV3aAukFtZNmXg8nzbfyaPkMt//IRC+fKgLEwZGzfcCaUL g7XGIQKfgLk3Qc61A1uOetnx+wDWiztwA9JylDGlttcD7R5Qj/hyHRRhkXexbgJEO1 8WA23l/aboPOhkqOdprSvJizP7Qn619ojohGawQ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wanming Hu , He Ying , Chen Jingwen , Kees Cook , Michael Ellerman , Sasha Levin Subject: [PATCH 5.18 005/141] powerpc/kasan: Silence KASAN warnings in __get_wchan() Date: Mon, 20 Jun 2022 14:49:03 +0200 Message-Id: <20220620124729.674826505@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: He Ying [ Upstream commit a1b29ba2f2c171b9bea73be993bfdf0a62d37d15 ] The following KASAN warning was reported in our kernel. BUG: KASAN: stack-out-of-bounds in get_wchan+0x188/0x250 Read of size 4 at addr d216f958 by task ps/14437 CPU: 3 PID: 14437 Comm: ps Tainted: G O 5.10.0 #1 Call Trace: [daa63858] [c0654348] dump_stack+0x9c/0xe4 (unreliable) [daa63888] [c035cf0c] print_address_description.constprop.3+0x8c/0x570 [daa63908] [c035d6bc] kasan_report+0x1ac/0x218 [daa63948] [c00496e8] get_wchan+0x188/0x250 [daa63978] [c0461ec8] do_task_stat+0xce8/0xe60 [daa63b98] [c0455ac8] proc_single_show+0x98/0x170 [daa63bc8] [c03cab8c] seq_read_iter+0x1ec/0x900 [daa63c38] [c03cb47c] seq_read+0x1dc/0x290 [daa63d68] [c037fc94] vfs_read+0x164/0x510 [daa63ea8] [c03808e4] ksys_read+0x144/0x1d0 [daa63f38] [c005b1dc] ret_from_syscall+0x0/0x38 --- interrupt: c00 at 0x8fa8f4 LR =3D 0x8fa8cc The buggy address belongs to the page: page:98ebcdd2 refcount:0 mapcount:0 mapping:00000000 index:0x2 pfn:0x1216f flags: 0x0() raw: 00000000 00000000 01010122 00000000 00000002 00000000 ffffffff 00000= 000 raw: 00000000 page dumped because: kasan: bad access detected Memory state around the buggy address: d216f800: 00 00 00 00 00 f1 f1 f1 f1 00 00 00 00 00 00 00 d216f880: f2 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 >d216f900: 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00 ^ d216f980: f2 f2 f2 f2 f2 f2 f2 00 00 00 00 00 00 00 00 00 d216fa00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 After looking into this issue, I find the buggy address belongs to the task stack region. It seems KASAN has something wrong. I look into the code of __get_wchan in x86 architecture and find the same issue has been resolved by the commit f7d27c35ddff ("x86/mm, kasan: Silence KASAN warnings in get_wchan()"). The solution could be applied to powerpc architecture too. As Andrey Ryabinin said, get_wchan() is racy by design, it may access volatile stack of running task, thus it may access redzone in a stack frame and cause KASAN to warn about this. Use READ_ONCE_NOCHECK() to silence these warnings. Reported-by: Wanming Hu Signed-off-by: He Ying Signed-off-by: Chen Jingwen Reviewed-by: Kees Cook Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220121014418.155675-1-heying24@huawei.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/powerpc/kernel/process.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 984813a4d5dc..a75d20f23dac 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c @@ -2160,12 +2160,12 @@ static unsigned long ___get_wchan(struct task_struc= t *p) return 0; =20 do { - sp =3D *(unsigned long *)sp; + sp =3D READ_ONCE_NOCHECK(*(unsigned long *)sp); if (!validate_sp(sp, p, STACK_FRAME_OVERHEAD) || task_is_running(p)) return 0; if (count > 0) { - ip =3D ((unsigned long *)sp)[STACK_FRAME_LR_SAVE]; + ip =3D READ_ONCE_NOCHECK(((unsigned long *)sp)[STACK_FRAME_LR_SAVE]); if (!in_sched_functions(ip)) return ip; } --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA830C43334 for ; Mon, 20 Jun 2022 12:54:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243077AbiFTMyu (ORCPT ); Mon, 20 Jun 2022 08:54:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243062AbiFTMyN (ORCPT ); Mon, 20 Jun 2022 08:54:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 546ED167E9; Mon, 20 Jun 2022 05:54:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DE172B811B3; Mon, 20 Jun 2022 12:54:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C4C9C3411B; Mon, 20 Jun 2022 12:54:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729646; bh=bk35GxZMSvgCi98hPj3XUWJh2GZvRMQ+zORPkX2Ju3s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H5jVZ6TLiVYuKv3PHbGvLxhTrFi4pQeDL129rMZGt4xO5rvOqzZaMAVtF8/OSjVdE VugY7/n87+LaY0OJdnWQgP8i6CWZgfIN34qfL0vfVT05HMrwZu5gIY7R+3QJazGrvG nR/7SsoxiasjcWyl6SFPbj9iULD87yGJkPifIvHA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Lin , John Hsu , Seven Li , Hui Wang , Mark Brown , Sasha Levin Subject: [PATCH 5.18 006/141] ASoC: nau8822: Add operation for internal PLL off and on Date: Mon, 20 Jun 2022 14:49:04 +0200 Message-Id: <20220620124729.704218116@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Hui Wang [ Upstream commit aeca8a3295022bcec46697f16e098140423d8463 ] We tried to enable the audio on an imx6sx EVB with the codec nau8822, after setting the internal PLL fractional parameters, the audio still couldn't work and the there was no sdma irq at all. After checking with the section "8.1.1 Phase Locked Loop (PLL) Design Example" of "NAU88C22 Datasheet Rev 0.6", we found we need to turn off the PLL before programming fractional parameters and turn on the PLL after programming. After this change, the audio driver could record and play sound and the sdma's irq is triggered when playing or recording. Cc: David Lin Cc: John Hsu Cc: Seven Li Signed-off-by: Hui Wang Link: https://lore.kernel.org/r/20220530040151.95221-2-hui.wang@canonical.c= om Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- sound/soc/codecs/nau8822.c | 4 ++++ sound/soc/codecs/nau8822.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/sound/soc/codecs/nau8822.c b/sound/soc/codecs/nau8822.c index 58123390c7a3..b436e532993d 100644 --- a/sound/soc/codecs/nau8822.c +++ b/sound/soc/codecs/nau8822.c @@ -740,6 +740,8 @@ static int nau8822_set_pll(struct snd_soc_dai *dai, int= pll_id, int source, pll_param->pll_int, pll_param->pll_frac, pll_param->mclk_scaler, pll_param->pre_factor); =20 + snd_soc_component_update_bits(component, + NAU8822_REG_POWER_MANAGEMENT_1, NAU8822_PLL_EN_MASK, NAU8822_PLL_OFF); snd_soc_component_update_bits(component, NAU8822_REG_PLL_N, NAU8822_PLLMCLK_DIV2 | NAU8822_PLLN_MASK, (pll_param->pre_factor ? NAU8822_PLLMCLK_DIV2 : 0) | @@ -757,6 +759,8 @@ static int nau8822_set_pll(struct snd_soc_dai *dai, int= pll_id, int source, pll_param->mclk_scaler << NAU8822_MCLKSEL_SFT); snd_soc_component_update_bits(component, NAU8822_REG_CLOCKING, NAU8822_CLKM_MASK, NAU8822_CLKM_PLL); + snd_soc_component_update_bits(component, + NAU8822_REG_POWER_MANAGEMENT_1, NAU8822_PLL_EN_MASK, NAU8822_PLL_ON); =20 return 0; } diff --git a/sound/soc/codecs/nau8822.h b/sound/soc/codecs/nau8822.h index 489191ff187e..b45d42c15de6 100644 --- a/sound/soc/codecs/nau8822.h +++ b/sound/soc/codecs/nau8822.h @@ -90,6 +90,9 @@ #define NAU8822_REFIMP_3K 0x3 #define NAU8822_IOBUF_EN (0x1 << 2) #define NAU8822_ABIAS_EN (0x1 << 3) +#define NAU8822_PLL_EN_MASK (0x1 << 5) +#define NAU8822_PLL_ON (0x1 << 5) +#define NAU8822_PLL_OFF (0x0 << 5) =20 /* NAU8822_REG_AUDIO_INTERFACE (0x4) */ #define NAU8822_AIFMT_MASK (0x3 << 3) --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BEACDC43334 for ; Mon, 20 Jun 2022 12:54:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243236AbiFTMyz (ORCPT ); Mon, 20 Jun 2022 08:54:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243073AbiFTMyO (ORCPT ); Mon, 20 Jun 2022 08:54:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA7FE17053; Mon, 20 Jun 2022 05:54:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 341EC614B7; Mon, 20 Jun 2022 12:54:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C021C3411B; Mon, 20 Jun 2022 12:54:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729649; bh=GuudOFzGcIiyKA5KR5gswm2awcHdQDRTnz0Xdb4dC+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=2hJpE4CaA7UkUyMDhWAagZnmVNgEwXu0hIuq0aLVfXGExM91yQFQoIz4Jrq/jC+7h pR63rtCoDPsWWRgRlgXmIhmxzFMN/d9t/KVW6T2eFCYNA3lMmNzEzVQMhkcRH8E2mu WeKIOMP99CjhDhfph0YtIV1J+R6HdLocZhQzDxlQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Srinivasa Rao Mandadapu , Mark Brown , Sasha Levin Subject: [PATCH 5.18 007/141] ASoC: qcom: lpass-platform: Update VMA access permissions in mmap callback Date: Mon, 20 Jun 2022 14:49:05 +0200 Message-Id: <20220620124729.733286840@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Srinivasa Rao Mandadapu [ Upstream commit ef8d89b83bf453ea9cc3c4873a84b50ff334f797 ] Replace page protection permissions from noncashed to writecombine, in lpass codec DMA path mmp callabck, to support 64 bit chromeOS. Avoid SIGBUS error in userspace caused by noncached permissions in 64 bit chromeOS. Signed-off-by: Srinivasa Rao Mandadapu Link: https://lore.kernel.org/r/1653660608-27245-1-git-send-email-quic_sriv= asam@quicinc.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- sound/soc/qcom/lpass-platform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platfor= m.c index 74d62f377dfd..ae2a7837e5cc 100644 --- a/sound/soc/qcom/lpass-platform.c +++ b/sound/soc/qcom/lpass-platform.c @@ -898,7 +898,7 @@ static int lpass_platform_cdc_dma_mmap(struct snd_pcm_s= ubstream *substream, struct snd_pcm_runtime *runtime =3D substream->runtime; unsigned long size, offset; =20 - vma->vm_page_prot =3D pgprot_noncached(vma->vm_page_prot); + vma->vm_page_prot =3D pgprot_writecombine(vma->vm_page_prot); size =3D vma->vm_end - vma->vm_start; offset =3D vma->vm_pgoff << PAGE_SHIFT; return io_remap_pfn_range(vma, vma->vm_start, --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEA31C433EF for ; Mon, 20 Jun 2022 12:55:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243052AbiFTMzG (ORCPT ); Mon, 20 Jun 2022 08:55:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243108AbiFTMyS (ORCPT ); Mon, 20 Jun 2022 08:54:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F37717AB5; Mon, 20 Jun 2022 05:54:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 32400614EE; Mon, 20 Jun 2022 12:54:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E1F5C36AE2; Mon, 20 Jun 2022 12:54:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729652; bh=O2vdw0HEg897hRd43A10FqgazzP4XDA4R8BDuGWT6UM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LRBVb5Mhxhr/aAVlGmUw9c+yWnqaeC0NXSKXQzvSKFbBY2XrkyFiFsLZ0IGMu7f8j rJI+QDKaOt1zjXxXQ8y1s5PdVYrFWHY1foMHFJqWUZywiKtFXR1dT1GHW/XPyEL0mR 65yw5Q+KGhz/XeEzs/5C/X1Gd4Itru6sjKp8i+EQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Kazlauskas , Jasdeep Dhillon , Daniel Wheeler , Sherry Wang , Alex Deucher , Sasha Levin Subject: [PATCH 5.18 008/141] drm/amd/display: Read Golden Settings Table from VBIOS Date: Mon, 20 Jun 2022 14:49:06 +0200 Message-Id: <20220620124729.763572134@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sherry Wang [ Upstream commit 4b81dd2cc6f4f4e8cea0ed6ee8d5193a8ae14a72 ] [Why] Dmub read AUX_DPHY_RX_CONTROL0 from Golden Setting Table, but driver will set it to default value 0x103d1110, which causes issue in some case [How] Remove the driver code, use the value set by dmub in dp_aux_init Reviewed-by: Nicholas Kazlauskas Acked-by: Jasdeep Dhillon Tested-by: Daniel Wheeler Signed-off-by: Sherry Wang Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/amd/display/dc/dcn31/dcn31_dio_link_encoder.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_dio_link_encoder.c = b/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_dio_link_encoder.c index d94fd1010deb..8b12b4111c88 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_dio_link_encoder.c +++ b/drivers/gpu/drm/amd/display/dc/dcn31/dcn31_dio_link_encoder.c @@ -230,9 +230,7 @@ static void enc31_hw_init(struct link_encoder *enc) AUX_RX_PHASE_DETECT_LEN, [21,20] =3D 0x3 default is 3 AUX_RX_DETECTION_THRESHOLD [30:28] =3D 1 */ - AUX_REG_WRITE(AUX_DPHY_RX_CONTROL0, 0x103d1110); - - AUX_REG_WRITE(AUX_DPHY_TX_CONTROL, 0x21c7a); + // dmub will read AUX_DPHY_RX_CONTROL0/AUX_DPHY_TX_CONTROL from vbios tab= le in dp_aux_init =20 //AUX_DPHY_TX_REF_CONTROL'AUX_TX_REF_DIV HW default is 0x32; // Set AUX_TX_REF_DIV Divider to generate 2 MHz reference from refclk --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84DC7C433EF for ; Mon, 20 Jun 2022 12:55:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243200AbiFTMzM (ORCPT ); Mon, 20 Jun 2022 08:55:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243188AbiFTMyo (ORCPT ); Mon, 20 Jun 2022 08:54: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 2575F18E3B; Mon, 20 Jun 2022 05:54:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B834FB811AF; Mon, 20 Jun 2022 12:54:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 31BFEC3411B; Mon, 20 Jun 2022 12:54:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729655; bh=Oe8B+tchnVatPgmf1JiGtjFdAcKA9NcNW0/WlQM8Gcw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1uc2NU0U+YrUnnEmgI7wG5y8v/nceDBl7Ea0VzOpf/evGeiyQI7oQYpmZQGxNqB60 QiotDyftZh4Ds0KLLiiKZFUnpsSsmmL0kwYv8a5f2N/8oRJv/WaSubqngr1pIFFmDB b9rXF1L3CVvkg6A+unD7GDfTLc9FATEpUJdBHo00= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Candice Li , Hawking Zhang , Alex Deucher , Sasha Levin Subject: [PATCH 5.18 009/141] drm/amdgpu: Resolve RAS GFX error count issue after cold boot on Arcturus Date: Mon, 20 Jun 2022 14:49:07 +0200 Message-Id: <20220620124729.793573170@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Candice Li [ Upstream commit 2a460963350ec6b1534d28d7f943b5f84815aff2 ] Adjust the sequence for ras late init and separate ras reset error status from query status. v2: squash in fix from Candice Signed-off-by: Candice Li Reviewed-by: Hawking Zhang Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 9 ++++++--- drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c | 27 ++++++++++++++++++++----- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/= amdgpu/amdgpu_gfx.c index 28a736c507bb..bd3b32e5ba9e 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c @@ -625,17 +625,20 @@ int amdgpu_get_gfx_off_status(struct amdgpu_device *a= dev, uint32_t *value) int amdgpu_gfx_ras_late_init(struct amdgpu_device *adev, struct ras_common= _if *ras_block) { int r; - r =3D amdgpu_ras_block_late_init(adev, ras_block); - if (r) - return r; =20 if (amdgpu_ras_is_supported(adev, ras_block->block)) { if (!amdgpu_persistent_edc_harvesting_supported(adev)) amdgpu_ras_reset_error_status(adev, AMDGPU_RAS_BLOCK__GFX); =20 + r =3D amdgpu_ras_block_late_init(adev, ras_block); + if (r) + return r; + r =3D amdgpu_irq_get(adev, &adev->gfx.cp_ecc_error_irq, 0); if (r) goto late_fini; + } else { + amdgpu_ras_feature_enable_on_boot(adev, ras_block, 0); } =20 return 0; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c b/drivers/gpu/drm/amd/= amdgpu/amdgpu_ras.c index 424c22a841f4..3f96dadf2698 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ras.c @@ -195,6 +195,13 @@ static ssize_t amdgpu_ras_debugfs_read(struct file *f,= char __user *buf, if (amdgpu_ras_query_error_status(obj->adev, &info)) return -EINVAL; =20 + /* Hardware counter will be reset automatically after the query on Vega20= and Arcturus */ + if (obj->adev->ip_versions[MP0_HWIP][0] !=3D IP_VERSION(11, 0, 2) && + obj->adev->ip_versions[MP0_HWIP][0] !=3D IP_VERSION(11, 0, 4)) { + if (amdgpu_ras_reset_error_status(obj->adev, info.head.block)) + dev_warn(obj->adev->dev, "Failed to reset error counter and error statu= s"); + } + s =3D snprintf(val, sizeof(val), "%s: %lu\n%s: %lu\n", "ue", info.ue_count, "ce", info.ce_count); @@ -548,9 +555,10 @@ static ssize_t amdgpu_ras_sysfs_read(struct device *de= v, if (amdgpu_ras_query_error_status(obj->adev, &info)) return -EINVAL; =20 - if (obj->adev->asic_type =3D=3D CHIP_ALDEBARAN) { + if (obj->adev->ip_versions[MP0_HWIP][0] !=3D IP_VERSION(11, 0, 2) && + obj->adev->ip_versions[MP0_HWIP][0] !=3D IP_VERSION(11, 0, 4)) { if (amdgpu_ras_reset_error_status(obj->adev, info.head.block)) - DRM_WARN("Failed to reset error counter and error status"); + dev_warn(obj->adev->dev, "Failed to reset error counter and error statu= s"); } =20 return sysfs_emit(buf, "%s: %lu\n%s: %lu\n", "ue", info.ue_count, @@ -1023,9 +1031,6 @@ int amdgpu_ras_query_error_status(struct amdgpu_devic= e *adev, } } =20 - if (!amdgpu_persistent_edc_harvesting_supported(adev)) - amdgpu_ras_reset_error_status(adev, info->head.block); - return 0; } =20 @@ -1145,6 +1150,12 @@ int amdgpu_ras_query_error_count(struct amdgpu_devic= e *adev, if (res) return res; =20 + if (adev->ip_versions[MP0_HWIP][0] !=3D IP_VERSION(11, 0, 2) && + adev->ip_versions[MP0_HWIP][0] !=3D IP_VERSION(11, 0, 4)) { + if (amdgpu_ras_reset_error_status(adev, info.head.block)) + dev_warn(adev->dev, "Failed to reset error counter and error status"); + } + ce +=3D info.ce_count; ue +=3D info.ue_count; } @@ -1705,6 +1716,12 @@ static void amdgpu_ras_log_on_err_counter(struct amd= gpu_device *adev) continue; =20 amdgpu_ras_query_error_status(adev, &info); + + if (adev->ip_versions[MP0_HWIP][0] !=3D IP_VERSION(11, 0, 2) && + adev->ip_versions[MP0_HWIP][0] !=3D IP_VERSION(11, 0, 4)) { + if (amdgpu_ras_reset_error_status(adev, info.head.block)) + dev_warn(adev->dev, "Failed to reset error counter and error status"); + } } } =20 --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EEB7FC43334 for ; Mon, 20 Jun 2022 12:53:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241786AbiFTMxL (ORCPT ); Mon, 20 Jun 2022 08:53:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241511AbiFTMxI (ORCPT ); Mon, 20 Jun 2022 08:53:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4598CD11B; Mon, 20 Jun 2022 05:53:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0BB59B811A6; Mon, 20 Jun 2022 12:53:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 685A8C3411B; Mon, 20 Jun 2022 12:53:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729584; bh=osKyJ1+KTbP33abJvrFOEn7PkpMGgyBTQRpahpLYjcc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PpBlVjuv5IZdpi9pVyLov2O70llMCEYFl6auDUe8o+pKCTrAjYxwJZZDqLD71JxZK WvyP45Q2cjnSro5sOE/PDM5+EIt0NLskwflppN9enz06cb7XCxP8iNTSTn2iMTbAIk EKMlUjmmCF/dAUqEOrODQc9HsGOtHSxq8WxyBmIc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Philip Yang , Felix Kuehling , Alex Deucher , Sasha Levin Subject: [PATCH 5.18 010/141] drm/amdkfd: Use mmget_not_zero in MMU notifier Date: Mon, 20 Jun 2022 14:49:08 +0200 Message-Id: <20220620124729.823328758@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Philip Yang [ Upstream commit fa582c6f3684ac0098a9d02ddf0ed52a02b37127 ] MMU notifier callback may pass in mm with mm->mm_users=3D=3D0 when process is exiting, use mmget_no_zero to avoid accessing invalid mm in deferred list work after mm is gone. Signed-off-by: Philip Yang Reviewed-by: Felix Kuehling Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c b/drivers/gpu/drm/amd/amd= kfd/kfd_svm.c index 3b8856b4cece..5979335d7afd 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c @@ -2286,6 +2286,8 @@ svm_range_cpu_invalidate_pagetables(struct mmu_interv= al_notifier *mni, =20 if (range->event =3D=3D MMU_NOTIFY_RELEASE) return true; + if (!mmget_not_zero(mni->mm)) + return true; =20 start =3D mni->interval_tree.start; last =3D mni->interval_tree.last; @@ -2312,6 +2314,7 @@ svm_range_cpu_invalidate_pagetables(struct mmu_interv= al_notifier *mni, } =20 svm_range_unlock(prange); + mmput(mni->mm); =20 return true; } --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD913C433EF for ; Mon, 20 Jun 2022 12:53:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242057AbiFTMxR (ORCPT ); Mon, 20 Jun 2022 08:53:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241878AbiFTMxL (ORCPT ); Mon, 20 Jun 2022 08:53:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E8BC1A47E; Mon, 20 Jun 2022 05:53:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 94CCCB811AB; Mon, 20 Jun 2022 12:53:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 99D79C3411B; Mon, 20 Jun 2022 12:53:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729588; bh=jpahqU4Ez2Jv2ovq+6xWJVXthFohCC2sf6mGPWztRhY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uRXraJslE664cO+IxmD4PT+zwxCuV7rbBPm5tj8XE0Qoc9e+Em3rFXftihRcZFdip 3DbwHOP1LpWdPa+1yA/ax7oAN0pksjldWoRxO3fpksfzkrSP1k+/+sih7+/7NXr0mL KhG3FcXwcSwyIYOY+MlCmR7xLDT4l45NVxmVjWSw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rob Clark , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.18 011/141] dma-debug: make things less spammy under memory pressure Date: Mon, 20 Jun 2022 14:49:09 +0200 Message-Id: <20220620124729.852674260@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Rob Clark [ Upstream commit e19f8fa6ce1ca9b8b934ba7d2e8f34c95abc6e60 ] Limit the error msg to avoid flooding the console. If you have a lot of threads hitting this at once, they could have already gotten passed the dma_debug_disabled() check before they get to the point of allocation failure, resulting in quite a lot of this error message spamming the log. Use pr_err_once() to limit that. Signed-off-by: Rob Clark Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- kernel/dma/debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/dma/debug.c b/kernel/dma/debug.c index ac740630c79c..2caafd13f8aa 100644 --- a/kernel/dma/debug.c +++ b/kernel/dma/debug.c @@ -564,7 +564,7 @@ static void add_dma_entry(struct dma_debug_entry *entry= , unsigned long attrs) =20 rc =3D active_cacheline_insert(entry); if (rc =3D=3D -ENOMEM) { - pr_err("cacheline tracking ENOMEM, dma-debug disabled\n"); + pr_err_once("cacheline tracking ENOMEM, dma-debug disabled\n"); global_disable =3D true; } else if (rc =3D=3D -EEXIST && !(attrs & DMA_ATTR_SKIP_CPU_SYNC)) { err_printk(entry->dev, entry, --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC61DCCA479 for ; Mon, 20 Jun 2022 12:53:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242873AbiFTMxi (ORCPT ); Mon, 20 Jun 2022 08:53:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241906AbiFTMxM (ORCPT ); Mon, 20 Jun 2022 08:53:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A6BBDFC2; Mon, 20 Jun 2022 05:53: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 AA174614CA; Mon, 20 Jun 2022 12:53:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B759EC3411C; Mon, 20 Jun 2022 12:53:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729591; bh=2Z1+VyDmSP217IlxogHI6k4uHyug/J80iBfbbftIv3M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m/ARWKSPp5St//vX9o8yyuyPtIdbN1L/74a1h09IduMTVwIY3Q/Ilix5g15IurTfd gnraYrbu4BDCGUTiXblBJV3S4rQI1wZH1OH6fUM4q+EayAfS/aHHolUWIvBnwrk9C6 E4H+xor8EpEYQmUy0evjMzYEWRwp/Nrt2aX15JA0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, xliu , Brent Lu , Pierre-Louis Bossart , Mark Brown , Sasha Levin Subject: [PATCH 5.18 012/141] ASoC: Intel: cirrus-common: fix incorrect channel mapping Date: Mon, 20 Jun 2022 14:49:10 +0200 Message-Id: <20220620124729.882789615@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: xliu [ Upstream commit d69a155555c9d57463b788c400f6b452d976bacd ] The default mapping of ASPRX1 (DAC source) is slot 0. Change the slot mapping of right amplifiers (WR and TR) to slot 1 to receive right channel data. Also update the ACPI instance ID mapping according to HW configuration. Signed-off-by: xliu Signed-off-by: Brent Lu Acked-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20220602051922.1232457-1-brent.lu@intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- sound/soc/intel/boards/sof_cirrus_common.c | 40 +++++++++++++++++++--- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/sound/soc/intel/boards/sof_cirrus_common.c b/sound/soc/intel/b= oards/sof_cirrus_common.c index e71d74ec1b0b..f4192df962d6 100644 --- a/sound/soc/intel/boards/sof_cirrus_common.c +++ b/sound/soc/intel/boards/sof_cirrus_common.c @@ -54,22 +54,29 @@ static struct snd_soc_dai_link_component cs35l41_compon= ents[] =3D { }, }; =20 +/* + * Mapping between ACPI instance id and speaker position. + * + * Four speakers: + * 0: Tweeter left, 1: Woofer left + * 2: Tweeter right, 3: Woofer right + */ static struct snd_soc_codec_conf cs35l41_codec_conf[] =3D { { .dlc =3D COMP_CODEC_CONF(CS35L41_DEV0_NAME), - .name_prefix =3D "WL", + .name_prefix =3D "TL", }, { .dlc =3D COMP_CODEC_CONF(CS35L41_DEV1_NAME), - .name_prefix =3D "WR", + .name_prefix =3D "WL", }, { .dlc =3D COMP_CODEC_CONF(CS35L41_DEV2_NAME), - .name_prefix =3D "TL", + .name_prefix =3D "TR", }, { .dlc =3D COMP_CODEC_CONF(CS35L41_DEV3_NAME), - .name_prefix =3D "TR", + .name_prefix =3D "WR", }, }; =20 @@ -101,6 +108,21 @@ static int cs35l41_init(struct snd_soc_pcm_runtime *rt= d) return ret; } =20 +/* + * Channel map: + * + * TL/WL: ASPRX1 on slot 0, ASPRX2 on slot 1 (default) + * TR/WR: ASPRX1 on slot 1, ASPRX2 on slot 0 + */ +static const struct { + unsigned int rx[2]; +} cs35l41_channel_map[] =3D { + {.rx =3D {0, 1}}, /* TL */ + {.rx =3D {0, 1}}, /* WL */ + {.rx =3D {1, 0}}, /* TR */ + {.rx =3D {1, 0}}, /* WR */ +}; + static int cs35l41_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { @@ -134,6 +156,16 @@ static int cs35l41_hw_params(struct snd_pcm_substream = *substream, ret); return ret; } + + /* setup channel map */ + ret =3D snd_soc_dai_set_channel_map(codec_dai, 0, NULL, + ARRAY_SIZE(cs35l41_channel_map[i].rx), + (unsigned int *)cs35l41_channel_map[i].rx); + if (ret < 0) { + dev_err(codec_dai->dev, "fail to set channel map, ret %d\n", + ret); + return ret; + } } =20 return 0; --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 444DCCCA479 for ; Mon, 20 Jun 2022 12:53:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242899AbiFTMxk (ORCPT ); Mon, 20 Jun 2022 08:53:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36626 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242042AbiFTMxQ (ORCPT ); Mon, 20 Jun 2022 08:53:16 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48115B7F; Mon, 20 Jun 2022 05:53:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0D673B811A5; Mon, 20 Jun 2022 12:53:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6404FC3411B; Mon, 20 Jun 2022 12:53:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729593; bh=sQibBj59stp4hCGLyB0NmNThh+E78SK0QzT/7J/IQME=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I7Ml/KIFeAmyyLKmeMN6obqqd5jt/Rocn2qBvSdromGI0ZkdwwUJErfwIOpmNLQog OhO+5SD8Ja6TJu2lLSyi2RVZ9T7wbD7SZLVlWx2vyb7yBHIJclzaebeiwLRlz95u5O DskRze2xK815C8g4ehK8w5iA/AdRxfA8Zvb4NLEI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Charles Keepax , Mark Brown , Sasha Levin Subject: [PATCH 5.18 013/141] ASoC: cs42l52: Fix TLV scales for mixer controls Date: Mon, 20 Jun 2022 14:49:11 +0200 Message-Id: <20220620124729.912345105@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Charles Keepax [ Upstream commit 8bf5aabf524eec61013e506f764a0b2652dc5665 ] The datasheet specifies the range of the mixer volumes as between -51.5dB and 12dB with a 0.5dB step. Update the TLVs for this. Signed-off-by: Charles Keepax Link: https://lore.kernel.org/r/20220602162119.3393857-2-ckeepax@opensource= .cirrus.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- sound/soc/codecs/cs42l52.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/cs42l52.c b/sound/soc/codecs/cs42l52.c index 80161151b3f2..785caba3f653 100644 --- a/sound/soc/codecs/cs42l52.c +++ b/sound/soc/codecs/cs42l52.c @@ -137,7 +137,7 @@ static DECLARE_TLV_DB_SCALE(mic_tlv, 1600, 100, 0); =20 static DECLARE_TLV_DB_SCALE(pga_tlv, -600, 50, 0); =20 -static DECLARE_TLV_DB_SCALE(mix_tlv, -50, 50, 0); +static DECLARE_TLV_DB_SCALE(mix_tlv, -5150, 50, 0); =20 static DECLARE_TLV_DB_SCALE(beep_tlv, -56, 200, 0); =20 @@ -364,7 +364,7 @@ static const struct snd_kcontrol_new cs42l52_snd_contro= ls[] =3D { CS42L52_ADCB_VOL, 0, 0xA0, 0x78, ipd_tlv), SOC_DOUBLE_R_SX_TLV("ADC Mixer Volume", CS42L52_ADCA_MIXER_VOL, CS42L52_ADCB_MIXER_VOL, - 0, 0x19, 0x7F, ipd_tlv), + 0, 0x19, 0x7F, mix_tlv), =20 SOC_DOUBLE("ADC Switch", CS42L52_ADC_MISC_CTL, 0, 1, 1, 0), =20 --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA7F8C433EF for ; Mon, 20 Jun 2022 12:53:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242324AbiFTMxr (ORCPT ); Mon, 20 Jun 2022 08:53:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242327AbiFTMxT (ORCPT ); Mon, 20 Jun 2022 08:53:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89CD064F4; Mon, 20 Jun 2022 05:53:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 28EFD614DA; Mon, 20 Jun 2022 12:53:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3CFEC341C4; Mon, 20 Jun 2022 12:53:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729597; bh=4seMafuumCFqNw+bDTbGN5XERJrkspwfxmcEylUX7QY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bQOzHadvdscPwCSufpjM2XHPx883vVAbEPzN7XM8u6ixwM1e43Ns2XqwCtGSGGCOf zvTX6jfzjbkAppEEezJ2WOuPhL+C9F+/rPbY+wcm3YhpR6tcDg6ykTXmMphCKYs3o1 I9xFBX10DSbJZClAPjG3N++F9kCrnUVF+c/fsdeM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Charles Keepax , Mark Brown , Sasha Levin Subject: [PATCH 5.18 014/141] ASoC: cs35l36: Update digital volume TLV Date: Mon, 20 Jun 2022 14:49:12 +0200 Message-Id: <20220620124729.941458307@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Charles Keepax [ Upstream commit 5005a2345825eb8346546d99bfe669f73111b5c5 ] The digital volume TLV specifies the step as 0.25dB but the actual step of the control is 0.125dB. Update the TLV to correct this. Signed-off-by: Charles Keepax Link: https://lore.kernel.org/r/20220602162119.3393857-3-ckeepax@opensource= .cirrus.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- sound/soc/codecs/cs35l36.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/cs35l36.c b/sound/soc/codecs/cs35l36.c index d83c1b318c1c..0accdb45ed72 100644 --- a/sound/soc/codecs/cs35l36.c +++ b/sound/soc/codecs/cs35l36.c @@ -444,7 +444,8 @@ static bool cs35l36_volatile_reg(struct device *dev, un= signed int reg) } } =20 -static DECLARE_TLV_DB_SCALE(dig_vol_tlv, -10200, 25, 0); +static const DECLARE_TLV_DB_RANGE(dig_vol_tlv, 0, 912, + TLV_DB_MINMAX_ITEM(-10200, 1200)); static DECLARE_TLV_DB_SCALE(amp_gain_tlv, 0, 1, 1); =20 static const char * const cs35l36_pcm_sftramp_text[] =3D { --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BCA39C43334 for ; Mon, 20 Jun 2022 12:53:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242921AbiFTMxs (ORCPT ); Mon, 20 Jun 2022 08:53:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36692 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242573AbiFTMxY (ORCPT ); Mon, 20 Jun 2022 08:53:24 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B97BB7F; Mon, 20 Jun 2022 05:53:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D8981B811A5; Mon, 20 Jun 2022 12:53:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13782C3411B; Mon, 20 Jun 2022 12:53:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729600; bh=OeVBfzjrN+Okk5tVPGJUb3SZYwRtI0f6xEJ5aPPDBug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C0Qkhxoj59gIYkAouRg7c1OSucoZc08gjcn8NWegsIkxpA2vfQUp39oS5vTTB5uiE qmjeElFZ8xmflj9f2VeVTjUMvOCFBQ0q6y4NZpT62kMjUuez8PwyD+GTqfgMAYO856 WHLdY6VA5UufF8wOlE+B71ewl72nDdRBXYS+9fPo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Rhodes , Charles Keepax , Mark Brown , Sasha Levin Subject: [PATCH 5.18 015/141] ASoC: cs53l30: Correct number of volume levels on SX controls Date: Mon, 20 Jun 2022 14:49:13 +0200 Message-Id: <20220620124729.969666617@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Charles Keepax [ Upstream commit 7fbd6dd68127927e844912a16741016d432a0737 ] This driver specified the maximum value rather than the number of volume levels on the SX controls, this is incorrect, so correct them. Reported-by: David Rhodes Signed-off-by: Charles Keepax Link: https://lore.kernel.org/r/20220602162119.3393857-4-ckeepax@opensource= .cirrus.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- sound/soc/codecs/cs53l30.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sound/soc/codecs/cs53l30.c b/sound/soc/codecs/cs53l30.c index f2087bd38dbc..c2912ad3851b 100644 --- a/sound/soc/codecs/cs53l30.c +++ b/sound/soc/codecs/cs53l30.c @@ -348,22 +348,22 @@ static const struct snd_kcontrol_new cs53l30_snd_cont= rols[] =3D { SOC_ENUM("ADC2 NG Delay", adc2_ng_delay_enum), =20 SOC_SINGLE_SX_TLV("ADC1A PGA Volume", - CS53L30_ADC1A_AFE_CTL, 0, 0x34, 0x18, pga_tlv), + CS53L30_ADC1A_AFE_CTL, 0, 0x34, 0x24, pga_tlv), SOC_SINGLE_SX_TLV("ADC1B PGA Volume", - CS53L30_ADC1B_AFE_CTL, 0, 0x34, 0x18, pga_tlv), + CS53L30_ADC1B_AFE_CTL, 0, 0x34, 0x24, pga_tlv), SOC_SINGLE_SX_TLV("ADC2A PGA Volume", - CS53L30_ADC2A_AFE_CTL, 0, 0x34, 0x18, pga_tlv), + CS53L30_ADC2A_AFE_CTL, 0, 0x34, 0x24, pga_tlv), SOC_SINGLE_SX_TLV("ADC2B PGA Volume", - CS53L30_ADC2B_AFE_CTL, 0, 0x34, 0x18, pga_tlv), + CS53L30_ADC2B_AFE_CTL, 0, 0x34, 0x24, pga_tlv), =20 SOC_SINGLE_SX_TLV("ADC1A Digital Volume", - CS53L30_ADC1A_DIG_VOL, 0, 0xA0, 0x0C, dig_tlv), + CS53L30_ADC1A_DIG_VOL, 0, 0xA0, 0x6C, dig_tlv), SOC_SINGLE_SX_TLV("ADC1B Digital Volume", - CS53L30_ADC1B_DIG_VOL, 0, 0xA0, 0x0C, dig_tlv), + CS53L30_ADC1B_DIG_VOL, 0, 0xA0, 0x6C, dig_tlv), SOC_SINGLE_SX_TLV("ADC2A Digital Volume", - CS53L30_ADC2A_DIG_VOL, 0, 0xA0, 0x0C, dig_tlv), + CS53L30_ADC2A_DIG_VOL, 0, 0xA0, 0x6C, dig_tlv), SOC_SINGLE_SX_TLV("ADC2B Digital Volume", - CS53L30_ADC2B_DIG_VOL, 0, 0xA0, 0x0C, dig_tlv), + CS53L30_ADC2B_DIG_VOL, 0, 0xA0, 0x6C, dig_tlv), }; =20 static const struct snd_soc_dapm_widget cs53l30_dapm_widgets[] =3D { --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3C33CC433EF for ; Mon, 20 Jun 2022 12:53:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242640AbiFTMxw (ORCPT ); Mon, 20 Jun 2022 08:53:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242672AbiFTMx0 (ORCPT ); Mon, 20 Jun 2022 08:53:26 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2424DB7F; Mon, 20 Jun 2022 05:53:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id CB52DB811A9; Mon, 20 Jun 2022 12:53:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 043FCC3411B; Mon, 20 Jun 2022 12:53:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729603; bh=+PYrvTFnip/gg9TheCSfPkipohp84RZ+kbpGq3MpCVQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ifUcpygrAomcG8s32c/pbrva2RoxrIpEC1nPRSFPedU85M5i9Q4y3a6FVunQNWopt 6y67EA9gxfSf6eg2Rxc5uBMcoFgEKGD30KTZ2ZTxYnwdza9BE3Fh0qbrEAHqsrqTWX T7ie12PYOTpkAUIiQhoTOeviRs2G/OXazNjLok90= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Charles Keepax , Mark Brown , Sasha Levin Subject: [PATCH 5.18 016/141] ASoC: cs42l52: Correct TLV for Bypass Volume Date: Mon, 20 Jun 2022 14:49:14 +0200 Message-Id: <20220620124729.999667573@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Charles Keepax [ Upstream commit 91e90c712fade0b69cdff7cc6512f6099bd18ae5 ] The Bypass Volume is accidentally using a -6dB minimum TLV rather than the correct -60dB minimum. Add a new TLV to correct this. Signed-off-by: Charles Keepax Link: https://lore.kernel.org/r/20220602162119.3393857-5-ckeepax@opensource= .cirrus.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- sound/soc/codecs/cs42l52.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/cs42l52.c b/sound/soc/codecs/cs42l52.c index 785caba3f653..c19ad3c24702 100644 --- a/sound/soc/codecs/cs42l52.c +++ b/sound/soc/codecs/cs42l52.c @@ -137,6 +137,8 @@ static DECLARE_TLV_DB_SCALE(mic_tlv, 1600, 100, 0); =20 static DECLARE_TLV_DB_SCALE(pga_tlv, -600, 50, 0); =20 +static DECLARE_TLV_DB_SCALE(pass_tlv, -6000, 50, 0); + static DECLARE_TLV_DB_SCALE(mix_tlv, -5150, 50, 0); =20 static DECLARE_TLV_DB_SCALE(beep_tlv, -56, 200, 0); @@ -351,7 +353,7 @@ static const struct snd_kcontrol_new cs42l52_snd_contro= ls[] =3D { CS42L52_SPKB_VOL, 0, 0x40, 0xC0, hl_tlv), =20 SOC_DOUBLE_R_SX_TLV("Bypass Volume", CS42L52_PASSTHRUA_VOL, - CS42L52_PASSTHRUB_VOL, 0, 0x88, 0x90, pga_tlv), + CS42L52_PASSTHRUB_VOL, 0, 0x88, 0x90, pass_tlv), =20 SOC_DOUBLE("Bypass Mute", CS42L52_MISC_CTL, 4, 5, 1, 0), =20 --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3015DC433EF for ; Mon, 20 Jun 2022 12:53:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242934AbiFTMxy (ORCPT ); Mon, 20 Jun 2022 08:53:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242827AbiFTMx2 (ORCPT ); Mon, 20 Jun 2022 08:53:28 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2832B7F; Mon, 20 Jun 2022 05:53:27 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3F532614E4; Mon, 20 Jun 2022 12:53:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1EFECC3411B; Mon, 20 Jun 2022 12:53:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729606; bh=Hk15Ko+XriFcMJvHOag9fZWU72/YW9YpHBaQUG75oCY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UCWVeafT0FBOkQsGUExus3dFsCdM2mo2e488NSrrKxp5KMyUz2hLdtP2I0snh4CEw tAUPnssHptVS1DMZg0QImPkrUribtQfm5LAAjrM0L9QnZRKVxte3JtYd+aaq2HDraF cYQnsWupxeMpiNMLlTWRB4xlcyXR+S9Dc8m2AyEY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Charles Keepax , Mark Brown , Sasha Levin Subject: [PATCH 5.18 017/141] ASoC: cs42l56: Correct typo in minimum level for SX volume controls Date: Mon, 20 Jun 2022 14:49:15 +0200 Message-Id: <20220620124730.029363311@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Charles Keepax [ Upstream commit a8928ada9b96944cadd8b65d191e33199fd38782 ] A couple of the SX volume controls specify 0x84 as the lowest volume value, however the correct value from the datasheet is 0x44. The datasheet don't include spaces in the value it displays as binary so this was almost certainly just a typo reading 1000100. Signed-off-by: Charles Keepax Link: https://lore.kernel.org/r/20220602162119.3393857-6-ckeepax@opensource= .cirrus.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- sound/soc/codecs/cs42l56.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/cs42l56.c b/sound/soc/codecs/cs42l56.c index 3cf8a0b4478c..b39c25409c23 100644 --- a/sound/soc/codecs/cs42l56.c +++ b/sound/soc/codecs/cs42l56.c @@ -391,9 +391,9 @@ static const struct snd_kcontrol_new cs42l56_snd_contro= ls[] =3D { SOC_DOUBLE("ADC Boost Switch", CS42L56_GAIN_BIAS_CTL, 3, 2, 1, 1), =20 SOC_DOUBLE_R_SX_TLV("Headphone Volume", CS42L56_HPA_VOLUME, - CS42L56_HPB_VOLUME, 0, 0x84, 0x48, hl_tlv), + CS42L56_HPB_VOLUME, 0, 0x44, 0x48, hl_tlv), SOC_DOUBLE_R_SX_TLV("LineOut Volume", CS42L56_LOA_VOLUME, - CS42L56_LOB_VOLUME, 0, 0x84, 0x48, hl_tlv), + CS42L56_LOB_VOLUME, 0, 0x44, 0x48, hl_tlv), =20 SOC_SINGLE_TLV("Bass Shelving Volume", CS42L56_TONE_CTL, 0, 0x00, 1, tone_tlv), --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A277C433EF for ; Mon, 20 Jun 2022 12:54:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242949AbiFTMx6 (ORCPT ); Mon, 20 Jun 2022 08:53:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242856AbiFTMxc (ORCPT ); Mon, 20 Jun 2022 08:53:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26271B7F; Mon, 20 Jun 2022 05:53: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 D6222B811AB; Mon, 20 Jun 2022 12:53:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B83EC3411B; Mon, 20 Jun 2022 12:53:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729609; bh=S/Vkk66dwA0IO7czVdg1bfEsT+DY2lAwrlHSsB0U1QU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G5dIpTUoKXDRlJuyaXTORJZzIK3O1ZK5LfaDkANnQefpoXlOq2ci1FbO/pLf+az36 wsjLiuAgx85Y7FqZCDyF0DWyg5fdP47ROXP7I90hzEd/D1TXACfsThJMlFAnicOhRd AqOrfUaA5qrzFCl67PN9wKbdfqMrqwtoLTJAGQgo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Charles Keepax , Mark Brown , Sasha Levin Subject: [PATCH 5.18 018/141] ASoC: cs42l51: Correct minimum value for SX volume control Date: Mon, 20 Jun 2022 14:49:16 +0200 Message-Id: <20220620124730.058892182@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Charles Keepax [ Upstream commit fcb3b5a58926d16d9a338841b74af06d4c29be15 ] The minimum value for the PGA Volume is given as 0x1A, however the values from there to 0x19 are all the same volume and this is not represented in the TLV structure. The number of volumes given is correct so this leads to all the volumes being shifted. Move the minimum value up to 0x19 to fix this. Signed-off-by: Charles Keepax Link: https://lore.kernel.org/r/20220602162119.3393857-7-ckeepax@opensource= .cirrus.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- sound/soc/codecs/cs42l51.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/cs42l51.c b/sound/soc/codecs/cs42l51.c index e9c3cb4e2bfc..b9c262a15edf 100644 --- a/sound/soc/codecs/cs42l51.c +++ b/sound/soc/codecs/cs42l51.c @@ -146,7 +146,7 @@ static const struct snd_kcontrol_new cs42l51_snd_contro= ls[] =3D { 0, 0xA0, 96, adc_att_tlv), SOC_DOUBLE_R_SX_TLV("PGA Volume", CS42L51_ALC_PGA_CTL, CS42L51_ALC_PGB_CTL, - 0, 0x1A, 30, pga_tlv), + 0, 0x19, 30, pga_tlv), SOC_SINGLE("Playback Deemphasis Switch", CS42L51_DAC_CTL, 3, 1, 0), SOC_SINGLE("Auto-Mute Switch", CS42L51_DAC_CTL, 2, 1, 0), SOC_SINGLE("Soft Ramp Switch", CS42L51_DAC_CTL, 1, 1, 0), --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36ED1C433EF for ; Mon, 20 Jun 2022 12:54:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242993AbiFTMyA (ORCPT ); Mon, 20 Jun 2022 08:54:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242864AbiFTMxe (ORCPT ); Mon, 20 Jun 2022 08:53:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4D88B7F; Mon, 20 Jun 2022 05:53:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 41082614CE; Mon, 20 Jun 2022 12:53:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 34702C3411C; Mon, 20 Jun 2022 12:53:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729612; bh=jvY6zLIFYZFwPqwJyHm4FYdTHBXHgYFw9HzPnyPYv5M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J7qHylR+4W7oXO2JhzalvVzXeIbeJH/OIRfvADiDi6/hIwenGN+ALB+X/iCNz4Dju V1zKZKJ/uQLK2/+NSUyj02pvFe86+vruTZEIIQ0i28M3qkYVPeR52xoLIEhpRivOQp Yn8yBy6aEsKvRu2nZIrQKGir4SFFM9r4IFFjJOeQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lang Yu , =?UTF-8?q?Christian=20K=C3=B6nig?= , Felix Kuehling , Alex Deucher , Sasha Levin Subject: [PATCH 5.18 019/141] drm/amdkfd: add pinned BOs to kfd_bo_list Date: Mon, 20 Jun 2022 14:49:17 +0200 Message-Id: <20220620124730.087677638@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lang Yu [ Upstream commit 4fac4fcf4500bce515b0f32195e7bb86aa0246c6 ] The kfd_bo_list is used to restore process BOs after evictions. As page tables could be destroyed during evictions, we should also update pinned BOs' page tables during restoring to make sure they are valid. So for pinned BOs, 1, Validate them and update their page tables. 2, Don't add eviction fence for them. v2: - Don't handle pinned ones specially in BO validation.(Felix) Signed-off-by: Lang Yu Acked-by: Christian K=C3=B6nig Reviewed-by: Felix Kuehling Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu= /drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c index cd89d2e46852..f4509656ea8c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c @@ -1955,9 +1955,6 @@ int amdgpu_amdkfd_gpuvm_map_gtt_bo_to_kernel(struct a= mdgpu_device *adev, return -EINVAL; } =20 - /* delete kgd_mem from kfd_bo_list to avoid re-validating - * this BO in BO's restoring after eviction. - */ mutex_lock(&mem->process_info->lock); =20 ret =3D amdgpu_bo_reserve(bo, true); @@ -1980,7 +1977,6 @@ int amdgpu_amdkfd_gpuvm_map_gtt_bo_to_kernel(struct a= mdgpu_device *adev, =20 amdgpu_amdkfd_remove_eviction_fence( bo, mem->process_info->eviction_fence); - list_del_init(&mem->validate_list.head); =20 if (size) *size =3D amdgpu_bo_size(bo); @@ -2544,12 +2540,15 @@ int amdgpu_amdkfd_gpuvm_restore_process_bos(void *i= nfo, struct dma_fence **ef) process_info->eviction_fence =3D new_fence; *ef =3D dma_fence_get(&new_fence->base); =20 - /* Attach new eviction fence to all BOs */ + /* Attach new eviction fence to all BOs except pinned ones */ list_for_each_entry(mem, &process_info->kfd_bo_list, - validate_list.head) + validate_list.head) { + if (mem->bo->tbo.pin_count) + continue; + amdgpu_bo_fence(mem->bo, &process_info->eviction_fence->base, true); - + } /* Attach eviction fence to PD / PT BOs */ list_for_each_entry(peer_vm, &process_info->vm_list_head, vm_list_node) { --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC935C43334 for ; Mon, 20 Jun 2022 12:54:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243018AbiFTMyH (ORCPT ); Mon, 20 Jun 2022 08:54:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242912AbiFTMxo (ORCPT ); Mon, 20 Jun 2022 08:53: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 74CB1140A7; Mon, 20 Jun 2022 05:53:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 35C55B811A2; Mon, 20 Jun 2022 12:53:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7090EC3411B; Mon, 20 Jun 2022 12:53:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729618; bh=/S8yQzz0bEZtXnByi4TQCeaXrYJNa/rP7ocesI2o9rc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XtJb6mvVbX+lNZoquJkhEsvdtl+K+Drvsbro7mgbjQmgunvFW3qRXaW9tS7O3WReQ vI/8whB+86LP6xRa0Zi0mv7do2fsyf7R6replqAraWuP3R45AbGG7ow5+MZfLMKuVO M4hVUban8wLHwQfd2U1sJj3Xlct1GrcW/qGmKB0Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sergey Shtylyov , Damien Le Moal , Sasha Levin Subject: [PATCH 5.18 020/141] ata: libata-core: fix NULL pointer deref in ata_host_alloc_pinfo() Date: Mon, 20 Jun 2022 14:49:18 +0200 Message-Id: <20220620124730.118972624@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sergey Shtylyov [ Upstream commit bf476fe22aa1851bab4728e0c49025a6a0bea307 ] In an unlikely (and probably wrong?) case that the 'ppi' parameter of ata_host_alloc_pinfo() points to an array starting with a NULL pointer, there's going to be a kernel oops as the 'pi' local variable won't get reassigned from the initial value of NULL. Initialize 'pi' instead to '&ata_dummy_port_info' to fix the possible kernel oops for good... Found by Linux Verification Center (linuxtesting.org) with the SVACE static analysis tool. Signed-off-by: Sergey Shtylyov Signed-off-by: Damien Le Moal Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/ata/libata-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 3d57fa84e2be..ea9671821258 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c @@ -5506,7 +5506,7 @@ struct ata_host *ata_host_alloc_pinfo(struct device *= dev, const struct ata_port_info * const * ppi, int n_ports) { - const struct ata_port_info *pi; + const struct ata_port_info *pi =3D &ata_dummy_port_info; struct ata_host *host; int i, j; =20 @@ -5514,7 +5514,7 @@ struct ata_host *ata_host_alloc_pinfo(struct device *= dev, if (!host) return NULL; =20 - for (i =3D 0, j =3D 0, pi =3D NULL; i < host->n_ports; i++) { + for (i =3D 0, j =3D 0; i < host->n_ports; i++) { struct ata_port *ap =3D host->ports[i]; =20 if (ppi[j]) --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B621BCCA47C for ; Mon, 20 Jun 2022 12:54:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243060AbiFTMyM (ORCPT ); Mon, 20 Jun 2022 08:54:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242952AbiFTMx7 (ORCPT ); Mon, 20 Jun 2022 08:53:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D802A167D2; Mon, 20 Jun 2022 05:53:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 77C51614DA; Mon, 20 Jun 2022 12:53:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 70AD7C3411B; Mon, 20 Jun 2022 12:53:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729621; bh=vJjdRV6suW58wg8UxIw6dYY+UwjX1tnxBI4Y8tgNXmY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b082EFioQmDjo/jJYn93T77OO/7jJIAJ9de5fiTbYgELpQ3IbEVH1lKsE4KEbRZIA a7ZzL2dZwzE/DqG/6sjdBfTWz/qER/JGFcQDLsxjQbuijbqPwuSS8Dp7c5rc7ugNbB NaXPhY/xQFGlbQy99OHsN8DP/qAfekZskfihNTRA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Matthew Wilcox (Oracle)" , Jan Kara , Sasha Levin Subject: [PATCH 5.18 021/141] quota: Prevent memory allocation recursion while holding dq_lock Date: Mon, 20 Jun 2022 14:49:19 +0200 Message-Id: <20220620124730.149891524@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Matthew Wilcox (Oracle) [ Upstream commit 537e11cdc7a6b3ce94fa25ed41306193df9677b7 ] As described in commit 02117b8ae9c0 ("f2fs: Set GF_NOFS in read_cache_page_gfp while doing f2fs_quota_read"), we must not enter filesystem reclaim while holding the dq_lock. Prevent this more generally by using memalloc_nofs_save() while holding the lock. Link: https://lore.kernel.org/r/20220605143815.2330891-2-willy@infradead.org Signed-off-by: Matthew Wilcox (Oracle) Signed-off-by: Jan Kara Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- fs/quota/dquot.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index a74aef99bd3d..09d1307959d0 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c @@ -79,6 +79,7 @@ #include #include #include +#include #include "../internal.h" /* ugh */ =20 #include @@ -425,9 +426,11 @@ EXPORT_SYMBOL(mark_info_dirty); int dquot_acquire(struct dquot *dquot) { int ret =3D 0, ret2 =3D 0; + unsigned int memalloc; struct quota_info *dqopt =3D sb_dqopt(dquot->dq_sb); =20 mutex_lock(&dquot->dq_lock); + memalloc =3D memalloc_nofs_save(); if (!test_bit(DQ_READ_B, &dquot->dq_flags)) { ret =3D dqopt->ops[dquot->dq_id.type]->read_dqblk(dquot); if (ret < 0) @@ -458,6 +461,7 @@ int dquot_acquire(struct dquot *dquot) smp_mb__before_atomic(); set_bit(DQ_ACTIVE_B, &dquot->dq_flags); out_iolock: + memalloc_nofs_restore(memalloc); mutex_unlock(&dquot->dq_lock); return ret; } @@ -469,9 +473,11 @@ EXPORT_SYMBOL(dquot_acquire); int dquot_commit(struct dquot *dquot) { int ret =3D 0; + unsigned int memalloc; struct quota_info *dqopt =3D sb_dqopt(dquot->dq_sb); =20 mutex_lock(&dquot->dq_lock); + memalloc =3D memalloc_nofs_save(); if (!clear_dquot_dirty(dquot)) goto out_lock; /* Inactive dquot can be only if there was error during read/init @@ -481,6 +487,7 @@ int dquot_commit(struct dquot *dquot) else ret =3D -EIO; out_lock: + memalloc_nofs_restore(memalloc); mutex_unlock(&dquot->dq_lock); return ret; } @@ -492,9 +499,11 @@ EXPORT_SYMBOL(dquot_commit); int dquot_release(struct dquot *dquot) { int ret =3D 0, ret2 =3D 0; + unsigned int memalloc; struct quota_info *dqopt =3D sb_dqopt(dquot->dq_sb); =20 mutex_lock(&dquot->dq_lock); + memalloc =3D memalloc_nofs_save(); /* Check whether we are not racing with some other dqget() */ if (dquot_is_busy(dquot)) goto out_dqlock; @@ -510,6 +519,7 @@ int dquot_release(struct dquot *dquot) } clear_bit(DQ_ACTIVE_B, &dquot->dq_flags); out_dqlock: + memalloc_nofs_restore(memalloc); mutex_unlock(&dquot->dq_lock); return ret; } --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6331CCA479 for ; Mon, 20 Jun 2022 12:54:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243000AbiFTMyS (ORCPT ); Mon, 20 Jun 2022 08:54:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242906AbiFTMx7 (ORCPT ); Mon, 20 Jun 2022 08:53:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEA05167F4; Mon, 20 Jun 2022 05:53: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 6D853614D5; Mon, 20 Jun 2022 12:53:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79E45C3411C; Mon, 20 Jun 2022 12:53:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729624; bh=Pbt0fZV4EK9xrklXK2Rl75OGY0kyIJHvwKpZ+/cLZ+E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gnm8EyHhHBu2m65avhzXPDt1Xq3pW2AMqVlP02ap9/78IJ2rdDzyFo+WLbcKtafXW jooVnxguDODQUquOwmaULwdUz/oSVenofwhjhVbhHjiqe9o7Mx4TBLe68+hVtCGzR3 HpSzAKrVb0gnQLW96BypdwOsPIhinVI3S1PdqXk4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Adam Ford , Charles Keepax , Mark Brown , Sasha Levin Subject: [PATCH 5.18 022/141] ASoC: wm8962: Fix suspend while playing music Date: Mon, 20 Jun 2022 14:49:20 +0200 Message-Id: <20220620124730.180106168@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Adam Ford [ Upstream commit d1f5272c0f7d2e53c6f2480f46725442776f5f78 ] If the audio CODEC is playing sound when the system is suspended, it can be left in a state which throws the following error: wm8962 3-001a: ASoC: error at soc_component_read_no_lock on wm8962.3-001a: = -16 Once this error has occurred, the audio will not work again until rebooted. Fix this by configuring SET_SYSTEM_SLEEP_PM_OPS. Signed-off-by: Adam Ford Acked-by: Charles Keepax Link: https://lore.kernel.org/r/20220526182129.538472-1-aford173@gmail.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- sound/soc/codecs/wm8962.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index 2c41d31956aa..f622a6bbd2fb 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c @@ -3871,6 +3871,7 @@ static int wm8962_runtime_suspend(struct device *dev) #endif =20 static const struct dev_pm_ops wm8962_pm =3D { + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) SET_RUNTIME_PM_OPS(wm8962_runtime_suspend, wm8962_runtime_resume, NULL) }; =20 --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93EF3C43334 for ; Mon, 20 Jun 2022 12:54:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243112AbiFTMyV (ORCPT ); Mon, 20 Jun 2022 08:54:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242983AbiFTMx7 (ORCPT ); Mon, 20 Jun 2022 08:53:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9893317053; Mon, 20 Jun 2022 05:53:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 512EBB811AB; Mon, 20 Jun 2022 12:53:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73CE5C3411B; Mon, 20 Jun 2022 12:53:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729627; bh=tzW7zB6n+0Qkd9R+/zK1+fs/LETpXudDWxsaCRdi3+k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q6nXQ5nyOitwmIj62GsCRxwWHFT395+gHGvjUnhjhehS941cGTAM2m54idma0hN1j ochIxNyoqaMGJUiMeEIlUMhO1lfUbeeb0dF67cx1/+4XR39fGFcKlYSvdXnTEdH8Fj hsKGRcjaWanjDr4GfLTGyLCXeB2Kk9zWg8JQmbf8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Brown , Sasha Levin Subject: [PATCH 5.18 023/141] ASoC: es8328: Fix event generation for deemphasis control Date: Mon, 20 Jun 2022 14:49:21 +0200 Message-Id: <20220620124730.210344113@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mark Brown [ Upstream commit 8259610c2ec01c5cbfb61882ae176aabacac9c19 ] Currently the put() method for the deemphasis control returns 0 when a new value is written to the control even if the value changed, meaning events are not generated. Fix this, skip the work of updating the value when it is unchanged and then return 1 after having done so. Signed-off-by: Mark Brown Link: https://lore.kernel.org/r/20220603123937.4013603-1-broonie@kernel.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- sound/soc/codecs/es8328.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/es8328.c b/sound/soc/codecs/es8328.c index 3f00ead97006..dd53dfd87b04 100644 --- a/sound/soc/codecs/es8328.c +++ b/sound/soc/codecs/es8328.c @@ -161,13 +161,16 @@ static int es8328_put_deemph(struct snd_kcontrol *kco= ntrol, if (deemph > 1) return -EINVAL; =20 + if (es8328->deemph =3D=3D deemph) + return 0; + ret =3D es8328_set_deemph(component); if (ret < 0) return ret; =20 es8328->deemph =3D deemph; =20 - return 0; + return 1; } =20 =20 --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B38FFC433EF for ; Mon, 20 Jun 2022 12:54:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243126AbiFTMyf (ORCPT ); Mon, 20 Jun 2022 08:54:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242989AbiFTMx7 (ORCPT ); Mon, 20 Jun 2022 08:53:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42E8B17E06; Mon, 20 Jun 2022 05:53:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E3BB6B811A5; Mon, 20 Jun 2022 12:53:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 55736C3411C; Mon, 20 Jun 2022 12:53:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729630; bh=QyA7bmOpgTHe++ypbwOYleAT8DYMiXUQDDhCe7vK3cc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B4reRu58WatLWps4L5lDAlW/o/JTocbGs046dasQIoygkUCO1/8tMs5iOBsTBkMYF lVTqaD1zLFLxHtQc4FzY/SAxKBxiGbnXmOGAfS4uRducsgkDDtNFo9p1lu/hOnm6KY cbr1piQcy2kXRGNf1Fs5LzrLXU1Oe6XFKxnyersg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Brown , Richard Fitzgerald , Sasha Levin Subject: [PATCH 5.18 024/141] ASoC: wm_adsp: Fix event generation for wm_adsp_fw_put() Date: Mon, 20 Jun 2022 14:49:22 +0200 Message-Id: <20220620124730.243537395@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mark Brown [ Upstream commit 2abdf9f80019e8244d3806ed0e1c9f725e50b452 ] Currently wm_adsp_fw_put() returns 0 rather than 1 when updating the value of the control, meaning that no event is generated to userspace. Fix this by setting the default return value to 1, the code already exits early with a return value of 0 if the value is unchanged. Signed-off-by: Mark Brown Reviewed-by: Richard Fitzgerald Link: https://lore.kernel.org/r/20220603115003.3865834-1-broonie@kernel.org Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- sound/soc/codecs/wm_adsp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index e32c8ded181d..9cfd4f18493f 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c @@ -333,7 +333,7 @@ int wm_adsp_fw_put(struct snd_kcontrol *kcontrol, struct snd_soc_component *component =3D snd_soc_kcontrol_component(kcontr= ol); struct soc_enum *e =3D (struct soc_enum *)kcontrol->private_value; struct wm_adsp *dsp =3D snd_soc_component_get_drvdata(component); - int ret =3D 0; + int ret =3D 1; =20 if (ucontrol->value.enumerated.item[0] =3D=3D dsp[e->shift_l].fw) return 0; --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF4C8C433EF for ; Mon, 20 Jun 2022 12:54:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243164AbiFTMyk (ORCPT ); Mon, 20 Jun 2022 08:54:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242997AbiFTMyB (ORCPT ); Mon, 20 Jun 2022 08:54: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 896D1183AA; Mon, 20 Jun 2022 05:53:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 440FCB811B1; Mon, 20 Jun 2022 12:53:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75EF3C3411C; Mon, 20 Jun 2022 12:53:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729634; bh=BNWdDw+2tibaH1KJgoWfPTrT73BOAUZaxMUa+1BI214=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O7qEZHJrd18n5mifJ7lwTJxTihddynQKjlhOkQMP/HttiZYiJrN3atw9eFtrGhPmy WqGX/KRwL2IIHNQ9bzm/VM/P0/pYwhn8vavx4U83J1OsRL/Upcmj2StxM28fk+NugA X3m5Y4k+yc5fqd6kDYH9uv/O3fK3ZqX+F2gYFFNk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kai Vehmanen , Yong Zhi , Pierre-Louis Bossart , Takashi Iwai , Sasha Levin Subject: [PATCH 5.18 025/141] ALSA: hda: MTL: add HD Audio PCI ID and HDMI codec vendor ID Date: Mon, 20 Jun 2022 14:49:23 +0200 Message-Id: <20220620124730.274117177@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yong Zhi [ Upstream commit 2e45f2185283a2d927ef2cdbdc246cd65740c8df ] Add HD Audio PCI ID for Intel Meteorlake platform. [ corrected the hex number to lower letters by tiwai ] Signed-off-by: Kai Vehmanen Signed-off-by: Yong Zhi Signed-off-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20220606204232.144296-1-pierre-louis.bossar= t@linux.intel.com Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- sound/pci/hda/hda_intel.c | 3 +++ sound/pci/hda/patch_hdmi.c | 1 + 2 files changed, 4 insertions(+) diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 0a83eb6b88b1..a77165bd92a9 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -2525,6 +2525,9 @@ static const struct pci_device_id azx_ids[] =3D { .driver_data =3D AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, { PCI_DEVICE(0x8086, 0x51cf), .driver_data =3D AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, + /* Meteorlake-P */ + { PCI_DEVICE(0x8086, 0x7e28), + .driver_data =3D AZX_DRIVER_SKL | AZX_DCAPS_INTEL_SKYLAKE}, /* Broxton-P(Apollolake) */ { PCI_DEVICE(0x8086, 0x5a98), .driver_data =3D AZX_DRIVER_SKL | AZX_DCAPS_INTEL_BROXTON }, diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 31fe41795571..6c209cd26c0c 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -4554,6 +4554,7 @@ HDA_CODEC_ENTRY(0x8086281a, "Jasperlake HDMI", patch_= i915_icl_hdmi), HDA_CODEC_ENTRY(0x8086281b, "Elkhartlake HDMI", patch_i915_icl_hdmi), HDA_CODEC_ENTRY(0x8086281c, "Alderlake-P HDMI", patch_i915_adlp_hdmi), HDA_CODEC_ENTRY(0x8086281f, "Raptorlake-P HDMI", patch_i915_adlp_hdmi), +HDA_CODEC_ENTRY(0x8086281d, "Meteorlake HDMI", patch_i915_adlp_hdmi), HDA_CODEC_ENTRY(0x80862880, "CedarTrail HDMI", patch_generic_hdmi), HDA_CODEC_ENTRY(0x80862882, "Valleyview2 HDMI", patch_i915_byt_hdmi), HDA_CODEC_ENTRY(0x80862883, "Braswell HDMI", patch_i915_byt_hdmi), --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8323C43334 for ; Mon, 20 Jun 2022 13:00:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243595AbiFTNA3 (ORCPT ); Mon, 20 Jun 2022 09:00:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244579AbiFTM7n (ORCPT ); Mon, 20 Jun 2022 08:59:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 434F419FB9; Mon, 20 Jun 2022 05:56: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 919D6B811A0; Mon, 20 Jun 2022 12:56:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE15FC341C4; Mon, 20 Jun 2022 12:56:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729795; bh=D2UwmSnr5W4IRYDH4+1SoWClJ8DsSUAmAlrFDCiml44=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kyB1MXYhVucFYGssMdM9NFWpfTypS6ELzgceS/IOLpHnQF0SoJsahtKTZoh9XBW/M bCWLCP02dNs75VmT6UWz1Zr4HvDti5zFgWJOid4p59NrWvGfGVkQPnzAhmSumYMFwP pMKKKg3X1Ks6VPOEEk+Iy//cKy7s28IcNIAfKaaU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marius Hoch , Hans de Goede , Dmitry Torokhov , Sasha Levin Subject: [PATCH 5.18 026/141] Input: soc_button_array - also add Lenovo Yoga Tablet2 1051F to dmi_use_low_level_irq Date: Mon, 20 Jun 2022 14:49:24 +0200 Message-Id: <20220620124730.302867023@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marius Hoch [ Upstream commit 6ab2e51898cd4343bbdf8587af8ce8fbabddbcb5 ] Commit 223f61b8c5ad ("Input: soc_button_array - add Lenovo Yoga Tablet2 1051L to the dmi_use_low_level_irq list") added the 1051L to this list already, but the same problem applies to the 1051F. As there are no further 1051 variants (just the F/L), we can just DMI match 1051. Tested on a Lenovo Yoga Tablet2 1051F: Without this patch the home-button stops working after a wakeup from suspend. Signed-off-by: Marius Hoch Reviewed-by: Hans de Goede Link: https://lore.kernel.org/r/20220603120246.3065-1-mail@mariushoch.de Signed-off-by: Dmitry Torokhov Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/input/misc/soc_button_array.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc= _button_array.c index cbb1599a520e..480476121c01 100644 --- a/drivers/input/misc/soc_button_array.c +++ b/drivers/input/misc/soc_button_array.c @@ -85,13 +85,13 @@ static const struct dmi_system_id dmi_use_low_level_irq= [] =3D { }, { /* - * Lenovo Yoga Tab2 1051L, something messes with the home-button + * Lenovo Yoga Tab2 1051F/1051L, something messes with the home-button * IRQ settings, leading to a non working home-button. */ .matches =3D { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_NAME, "60073"), - DMI_MATCH(DMI_PRODUCT_VERSION, "1051L"), + DMI_MATCH(DMI_PRODUCT_VERSION, "1051"), }, }, {} /* Terminating entry */ --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 975A5C433EF for ; Mon, 20 Jun 2022 12:55:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243314AbiFTMza (ORCPT ); Mon, 20 Jun 2022 08:55:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243087AbiFTMyu (ORCPT ); Mon, 20 Jun 2022 08:54: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 6E81419032; Mon, 20 Jun 2022 05:54: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 11E18B811A2; Mon, 20 Jun 2022 12:54:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59266C3411B; Mon, 20 Jun 2022 12:54:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729661; bh=fc7MFvLBl5S0Dpre7Mc7IFBpLtZ3FB1t+p8Ol2drvI4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rHY3Vgo00SHkNvA8yoBazFPDmLwRp9Us0dFYj+h/HFz0DE6xnhJoXMjwwQDLEJjR3 C3ZhqnlVzX6lee8BxXZGSXO7ZMBDL9NAZ0xySwaTfwTh2MPFB4oAxPcvEw2DaKh4Xg 6ZGBs3nT+0BcALlt5CAsHS+3Fh5UlCqE85vWqFCM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wentao Wang , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 027/141] scsi: vmw_pvscsi: Expand vcpuHint to 16 bits Date: Mon, 20 Jun 2022 14:49:25 +0200 Message-Id: <20220620124730.331819477@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wentao Wang [ Upstream commit cf71d59c2eceadfcde0fb52e237990a0909880d7 ] vcpuHint has been expanded to 16 bit on host to enable routing to more CPUs. Guest side should align with the change. This change has been tested with hosts with 8-bit and 16-bit vcpuHint, on both platforms host side can get correct value. Link: https://lore.kernel.org/r/EF35F4D5-5DCC-42C5-BCC4-29DF1729B24C@vmware= .com Signed-off-by: Wentao Wang Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/scsi/vmw_pvscsi.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/vmw_pvscsi.h b/drivers/scsi/vmw_pvscsi.h index 51a82f7803d3..9d16cf925483 100644 --- a/drivers/scsi/vmw_pvscsi.h +++ b/drivers/scsi/vmw_pvscsi.h @@ -331,8 +331,8 @@ struct PVSCSIRingReqDesc { u8 tag; u8 bus; u8 target; - u8 vcpuHint; - u8 unused[59]; + u16 vcpuHint; + u8 unused[58]; } __packed; =20 /* --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5F3DCCA479 for ; Mon, 20 Jun 2022 12:57:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243325AbiFTM5A (ORCPT ); Mon, 20 Jun 2022 08:57:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243224AbiFTM4j (ORCPT ); Mon, 20 Jun 2022 08:56:39 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9385A1A07F; Mon, 20 Jun 2022 05:54:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AF11261476; Mon, 20 Jun 2022 12:54:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6789C3411B; Mon, 20 Jun 2022 12:54:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729696; bh=wH1jD07RcbhORAYwFh0vGkqjoepRYwCcbcsNy0Z1jkA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DMKJmg78Jdfgvq51UfVww2MGbdOIqHp2DxMVZKQPwVFnkjKJA35AkJSz7gBKBl0u/ AWjdOBYy4S6VQ6THev04XFU2gR5kRmgB/s6S88LGz8Z/7U63Kd7tJ2maZ7Q6T9FSoz Ri7n+vq23tY0Z8xwXSCjJu/1xed/FnuYnRm4tQJs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Justin Tee , James Smart , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 028/141] scsi: lpfc: Resolve NULL ptr dereference after an ELS LOGO is aborted Date: Mon, 20 Jun 2022 14:49:26 +0200 Message-Id: <20220620124730.362008601@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: James Smart [ Upstream commit b1b3440f437b75fb2a9b0cfe58df461e40eca474 ] A use-after-free crash can occur after an ELS LOGO is aborted. Specifically, a nodelist structure is freed and then ndlp->vport->cfg_log_verbose is dereferenced in lpfc_nlp_get() when the discovery state machine is mistakenly called a second time with NLP_EVT_DEVICE_RM argument. Rework lpfc_cmpl_els_logo() to prevent the duplicate calls to release a nodelist structure. Link: https://lore.kernel.org/r/20220603174329.63777-6-jsmart2021@gmail.com Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/scsi/lpfc/lpfc_els.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c index 892b3da1ba45..9e3899580039 100644 --- a/drivers/scsi/lpfc/lpfc_els.c +++ b/drivers/scsi/lpfc/lpfc_els.c @@ -3035,18 +3035,10 @@ lpfc_cmpl_els_logo(struct lpfc_hba *phba, struct lp= fc_iocbq *cmdiocb, spin_unlock_irq(&ndlp->lock); lpfc_disc_state_machine(vport, ndlp, cmdiocb, NLP_EVT_DEVICE_RM); - lpfc_els_free_iocb(phba, cmdiocb); - lpfc_nlp_put(ndlp); - - /* Presume the node was released. */ - return; + goto out_rsrc_free; } =20 out: - /* Driver is done with the IO. */ - lpfc_els_free_iocb(phba, cmdiocb); - lpfc_nlp_put(ndlp); - /* At this point, the LOGO processing is complete. NOTE: For a * pt2pt topology, we are assuming the NPortID will only change * on link up processing. For a LOGO / PLOGI initiated by the @@ -3073,6 +3065,10 @@ lpfc_cmpl_els_logo(struct lpfc_hba *phba, struct lpf= c_iocbq *cmdiocb, ndlp->nlp_DID, ulp_status, ulp_word4, tmo, vport->num_disc_nodes); + + lpfc_els_free_iocb(phba, cmdiocb); + lpfc_nlp_put(ndlp); + lpfc_disc_start(vport); return; } @@ -3089,6 +3085,10 @@ lpfc_cmpl_els_logo(struct lpfc_hba *phba, struct lpf= c_iocbq *cmdiocb, lpfc_disc_state_machine(vport, ndlp, cmdiocb, NLP_EVT_DEVICE_RM); } +out_rsrc_free: + /* Driver is done with the I/O. */ + lpfc_els_free_iocb(phba, cmdiocb); + lpfc_nlp_put(ndlp); } =20 /** --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 079F7C433EF for ; Mon, 20 Jun 2022 13:01:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232153AbiFTNBv (ORCPT ); Mon, 20 Jun 2022 09:01:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241339AbiFTM5p (ORCPT ); Mon, 20 Jun 2022 08:57: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 3927F1AF04; Mon, 20 Jun 2022 05:55:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 016A4B811AC; Mon, 20 Jun 2022 12:55:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDDC4C3411B; Mon, 20 Jun 2022 12:55:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729729; bh=mR8UpIC9hOX8Y1EYshjyfXKNN3emi3SIWnW3qyzOb88=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=joxxqVebS1fLO/IYPp3mvAj4aEEAElUfYsRI5Ydjl3QCiN7ydu1ufjpUA1mfMZc34 jbTxl1KO7T4lapcqZTdDQdtfIYzmqXqCUHw8UDwMLLtkAlDCf06D3GQqchDZUBCJyk SyDQBZNhoFKZ9loBHuk/h5gGFGTu4msil1VCsSvI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Justin Tee , James Smart , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 029/141] scsi: lpfc: Fix port stuck in bypassed state after LIP in PT2PT topology Date: Mon, 20 Jun 2022 14:49:27 +0200 Message-Id: <20220620124730.391590041@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: James Smart [ Upstream commit 336d63615466b4c06b9401c987813fd19bdde39b ] After issuing a LIP, a specific target vendor does not ACC the FLOGI that lpfc sends. However, it does send its own FLOGI that lpfc ACCs. The target then establishes the port IDs by sending a PLOGI. lpfc PLOGI_ACCs and starts the RPI registration for DID 0x000001. The target then sends a LOGO to the fabric DID. lpfc is currently treating the LOGO from the fabric DID as a link down and cleans up all the ndlps. The ndlp for DID 0x000001 is put back into NPR and discovery stops, leaving the port in stuck in bypassed mode. Change lpfc behavior such that if a LOGO is received for the fabric DID in PT2PT topology skip the lpfc_linkdown_port() routine and just move the fabric DID back to NPR. Link: https://lore.kernel.org/r/20220603174329.63777-7-jsmart2021@gmail.com Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/scsi/lpfc/lpfc_nportdisc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_np= ortdisc.c index 4b065c51ee1b..f5de88877ffe 100644 --- a/drivers/scsi/lpfc/lpfc_nportdisc.c +++ b/drivers/scsi/lpfc/lpfc_nportdisc.c @@ -835,7 +835,8 @@ lpfc_rcv_logo(struct lpfc_vport *vport, struct lpfc_nod= elist *ndlp, lpfc_nvmet_invalidate_host(phba, ndlp); =20 if (ndlp->nlp_DID =3D=3D Fabric_DID) { - if (vport->port_state <=3D LPFC_FDISC) + if (vport->port_state <=3D LPFC_FDISC || + vport->fc_flag & FC_PT2PT) goto out; lpfc_linkdown_port(vport); spin_lock_irq(shost->host_lock); --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B6F1C43334 for ; Mon, 20 Jun 2022 13:02:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243812AbiFTNCK (ORCPT ); Mon, 20 Jun 2022 09:02:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243942AbiFTM7H (ORCPT ); Mon, 20 Jun 2022 08:59:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC04719C06; Mon, 20 Jun 2022 05:56:07 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 43835614EE; Mon, 20 Jun 2022 12:56:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 16D10C3411B; Mon, 20 Jun 2022 12:56:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729763; bh=Kk6o3/zjhbF2uiw5hY13A16AYGT/zqgM3J+eArhmefA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XzfF+v6Kv8T19VTpAqvpMzP0zMa3FqSt/CQsuTjuDbLbLipYWBy4vC+JgS0/MHpma sKplBt2XWfKnWKYlUbTDT2Xi/1LeSXiNHmPMq/AE/fsxcTRmu1J9LQpCSZnpwMJJFy QmlKKgiQ65TZ+W3bNGpuqz6ZY5S7r8AvlSXPFTG8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Justin Tee , James Smart , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 030/141] scsi: lpfc: Allow reduced polling rate for nvme_admin_async_event cmd completion Date: Mon, 20 Jun 2022 14:49:28 +0200 Message-Id: <20220620124730.421249120@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: James Smart [ Upstream commit 2e7e9c0c1ec05f18d320ecc8a31eec59d2af1af9 ] NVMe Asynchronous Event Request commands have no command timeout value per specifications. Set WQE option to allow a reduced FLUSH polling rate for I/O error detection specifically for nvme_admin_async_event commands. Link: https://lore.kernel.org/r/20220603174329.63777-9-jsmart2021@gmail.com Co-developed-by: Justin Tee Signed-off-by: Justin Tee Signed-off-by: James Smart Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/scsi/lpfc/lpfc_hw4.h | 3 +++ drivers/scsi/lpfc/lpfc_nvme.c | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h index 02e230ed6280..e7daef550095 100644 --- a/drivers/scsi/lpfc/lpfc_hw4.h +++ b/drivers/scsi/lpfc/lpfc_hw4.h @@ -4488,6 +4488,9 @@ struct wqe_common { #define wqe_sup_SHIFT 6 #define wqe_sup_MASK 0x00000001 #define wqe_sup_WORD word11 +#define wqe_ffrq_SHIFT 6 +#define wqe_ffrq_MASK 0x00000001 +#define wqe_ffrq_WORD word11 #define wqe_wqec_SHIFT 7 #define wqe_wqec_MASK 0x00000001 #define wqe_wqec_WORD word11 diff --git a/drivers/scsi/lpfc/lpfc_nvme.c b/drivers/scsi/lpfc/lpfc_nvme.c index d3a542466e98..49f44d9d04ea 100644 --- a/drivers/scsi/lpfc/lpfc_nvme.c +++ b/drivers/scsi/lpfc/lpfc_nvme.c @@ -1194,7 +1194,8 @@ lpfc_nvme_prep_io_cmd(struct lpfc_vport *vport, { struct lpfc_hba *phba =3D vport->phba; struct nvmefc_fcp_req *nCmd =3D lpfc_ncmd->nvmeCmd; - struct lpfc_iocbq *pwqeq =3D &(lpfc_ncmd->cur_iocbq); + struct nvme_common_command *sqe; + struct lpfc_iocbq *pwqeq =3D &lpfc_ncmd->cur_iocbq; union lpfc_wqe128 *wqe =3D &pwqeq->wqe; uint32_t req_len; =20 @@ -1251,8 +1252,14 @@ lpfc_nvme_prep_io_cmd(struct lpfc_vport *vport, cstat->control_requests++; } =20 - if (pnode->nlp_nvme_info & NLP_NVME_NSLER) + if (pnode->nlp_nvme_info & NLP_NVME_NSLER) { bf_set(wqe_erp, &wqe->generic.wqe_com, 1); + sqe =3D &((struct nvme_fc_cmd_iu *) + nCmd->cmdaddr)->sqe.common; + if (sqe->opcode =3D=3D nvme_admin_async_event) + bf_set(wqe_ffrq, &wqe->generic.wqe_com, 1); + } + /* * Finish initializing those WQE fields that are independent * of the nvme_cmnd request_buffer --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6A4ECCA479 for ; Mon, 20 Jun 2022 13:00:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242818AbiFTNAG (ORCPT ); Mon, 20 Jun 2022 09:00:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244219AbiFTM7T (ORCPT ); Mon, 20 Jun 2022 08:59:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96B9519F9D; Mon, 20 Jun 2022 05:56:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EC987614EE; Mon, 20 Jun 2022 12:56:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0473C3411B; Mon, 20 Jun 2022 12:56:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729779; bh=uwAQaPti/1/J1p+T9AY4QW5WMHXHqCAaLZPkOva8Atk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xhopjewlC3E6AHW33+V4fjtxygQL29hzLQLN74RaJJN8x9fvJ3k7HgEZSRetYmKIF asLjyPXpMKnx5xD+FiMvXOjGXw5biu+u2yk5XeTvKHanBLS7wlrmCr/aNlSea1z3RC +snl7AqacvgEljkYFM2VkLK5ks7tVzz7HA/pWjqI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Helge Deller , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 031/141] scsi: mpt3sas: Fix out-of-bounds compiler warning Date: Mon, 20 Jun 2022 14:49:29 +0200 Message-Id: <20220620124730.450300443@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Helge Deller [ Upstream commit 120f1d95efb1cdb6fe023c84e38ba06d8f78cd03 ] I'm facing this warning when building for the parisc64 architecture: drivers/scsi/mpt3sas/mpt3sas_base.c: In function =E2=80=98_base_make_ioc_op= erational=E2=80=99: drivers/scsi/mpt3sas/mpt3sas_base.c:5396:40: warning: array subscript =E2= =80=98Mpi2SasIOUnitPage1_t {aka struct _MPI2_CONFIG_PAGE_SASIOUNIT_1}[0]=E2= =80=99 is partly outside array bounds of =E2=80=98unsigned char[20]=E2=80= =99 [-Warray-bounds] 5396 | (le16_to_cpu(sas_iounit_pg1->SASWideMaxQueueDepth)) ? drivers/scsi/mpt3sas/mpt3sas_base.c:5382:26: note: referencing an object of= size 20 allocated by =E2=80=98kzalloc=E2=80=99 5382 | sas_iounit_pg1 =3D kzalloc(sz, GFP_KERNEL); | ^~~~~~~~~~~~~~~~~~~~~~~ The problem is, that only 20 bytes are allocated with kmalloc(), which is sufficient to hold the bytes which are needed. Nevertheless, gcc complains because the whole Mpi2SasIOUnitPage1_t struct is 32 bytes in size and thus doesn't fit into those 20 bytes. This patch simply allocates all 32 bytes (instead of 20) and thus avoids the warning. There is no functional change introduced by this patch. While touching the code I cleaned up to calculation of max_wideport_qd, max_narrowport_qd and max_sata_qd to make it easier readable. Test successfully tested on a HP C8000 PA-RISC workstation with 64-bit kernel. Link: https://lore.kernel.org/r/YpZ197iZdDZSCzrT@p100 Signed-off-by: Helge Deller Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/scsi/mpt3sas/mpt3sas_base.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.c b/drivers/scsi/mpt3sas/mpt= 3sas_base.c index 538d2c0cd971..aa142052ebe4 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_base.c +++ b/drivers/scsi/mpt3sas/mpt3sas_base.c @@ -5368,6 +5368,7 @@ static int _base_assign_fw_reported_qd(struct MPT3SAS= _ADAPTER *ioc) Mpi2ConfigReply_t mpi_reply; Mpi2SasIOUnitPage1_t *sas_iounit_pg1 =3D NULL; Mpi26PCIeIOUnitPage1_t pcie_iounit_pg1; + u16 depth; int sz; int rc =3D 0; =20 @@ -5379,7 +5380,7 @@ static int _base_assign_fw_reported_qd(struct MPT3SAS= _ADAPTER *ioc) goto out; /* sas iounit page 1 */ sz =3D offsetof(Mpi2SasIOUnitPage1_t, PhyData); - sas_iounit_pg1 =3D kzalloc(sz, GFP_KERNEL); + sas_iounit_pg1 =3D kzalloc(sizeof(Mpi2SasIOUnitPage1_t), GFP_KERNEL); if (!sas_iounit_pg1) { pr_err("%s: failure at %s:%d/%s()!\n", ioc->name, __FILE__, __LINE__, __func__); @@ -5392,16 +5393,16 @@ static int _base_assign_fw_reported_qd(struct MPT3S= AS_ADAPTER *ioc) ioc->name, __FILE__, __LINE__, __func__); goto out; } - ioc->max_wideport_qd =3D - (le16_to_cpu(sas_iounit_pg1->SASWideMaxQueueDepth)) ? - le16_to_cpu(sas_iounit_pg1->SASWideMaxQueueDepth) : - MPT3SAS_SAS_QUEUE_DEPTH; - ioc->max_narrowport_qd =3D - (le16_to_cpu(sas_iounit_pg1->SASNarrowMaxQueueDepth)) ? - le16_to_cpu(sas_iounit_pg1->SASNarrowMaxQueueDepth) : - MPT3SAS_SAS_QUEUE_DEPTH; - ioc->max_sata_qd =3D (sas_iounit_pg1->SATAMaxQDepth) ? - sas_iounit_pg1->SATAMaxQDepth : MPT3SAS_SATA_QUEUE_DEPTH; + + depth =3D le16_to_cpu(sas_iounit_pg1->SASWideMaxQueueDepth); + ioc->max_wideport_qd =3D (depth ? depth : MPT3SAS_SAS_QUEUE_DEPTH); + + depth =3D le16_to_cpu(sas_iounit_pg1->SASNarrowMaxQueueDepth); + ioc->max_narrowport_qd =3D (depth ? depth : MPT3SAS_SAS_QUEUE_DEPTH); + + depth =3D sas_iounit_pg1->SATAMaxQDepth; + ioc->max_sata_qd =3D (depth ? depth : MPT3SAS_SATA_QUEUE_DEPTH); + /* pcie iounit page 1 */ rc =3D mpt3sas_config_get_pcie_iounit_pg1(ioc, &mpi_reply, &pcie_iounit_pg1, sizeof(Mpi26PCIeIOUnitPage1_t)); --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3572ACCA479 for ; Mon, 20 Jun 2022 13:00:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243545AbiFTNAY (ORCPT ); Mon, 20 Jun 2022 09:00:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244381AbiFTM7a (ORCPT ); Mon, 20 Jun 2022 08:59:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0387A19F95; Mon, 20 Jun 2022 05:56:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0475C614B7; Mon, 20 Jun 2022 12:56:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0FF25C3411B; Mon, 20 Jun 2022 12:56:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729782; bh=Y7btmtWqz+zAxG7Ja3P/n/px+Y7cn2ZHLPzm5BXZRds=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aetnlOlnRsYSlUul8iChS9UCUkOKZK2ph+iZUxPzNXg2b3eQw43ZbnQAP22GcEsNq YkHtziJPBotS5kKqAbu3WIh+A8OdUKLIono88t9BixmRCmna5U0dnkOaJPjJyma7NL KYhkKtGFxVQxj0lckLEOWm0wcmhlgveYDHbu4swc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Brian King , Chengguang Xu , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 032/141] scsi: ipr: Fix missing/incorrect resource cleanup in error case Date: Mon, 20 Jun 2022 14:49:30 +0200 Message-Id: <20220620124730.480598927@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chengguang Xu [ Upstream commit d64c491911322af1dcada98e5b9ee0d87e8c8fee ] Fix missing resource cleanup (when '(--i) =3D=3D 0') for error case in ipr_alloc_mem() and skip incorrect resource cleanup (when '(--i) =3D=3D 0')= for error case in ipr_request_other_msi_irqs() because variable i started from 1. Link: https://lore.kernel.org/r/20220529153456.4183738-4-cgxu519@mykernel.n= et Reviewed-by: Dan Carpenter Acked-by: Brian King Signed-off-by: Chengguang Xu Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/scsi/ipr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index 104bee9b3a9d..00593d8953f1 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c @@ -9795,7 +9795,7 @@ static int ipr_alloc_mem(struct ipr_ioa_cfg *ioa_cfg) GFP_KERNEL); =20 if (!ioa_cfg->hrrq[i].host_rrq) { - while (--i > 0) + while (--i >=3D 0) dma_free_coherent(&pdev->dev, sizeof(u32) * ioa_cfg->hrrq[i].size, ioa_cfg->hrrq[i].host_rrq, @@ -10068,7 +10068,7 @@ static int ipr_request_other_msi_irqs(struct ipr_io= a_cfg *ioa_cfg, ioa_cfg->vectors_info[i].desc, &ioa_cfg->hrrq[i]); if (rc) { - while (--i >=3D 0) + while (--i > 0) free_irq(pci_irq_vector(pdev, i), &ioa_cfg->hrrq[i]); return rc; --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96F47CCA479 for ; Mon, 20 Jun 2022 13:01:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243759AbiFTNBE (ORCPT ); Mon, 20 Jun 2022 09:01:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244424AbiFTM7f (ORCPT ); Mon, 20 Jun 2022 08:59:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 513BB1CB10; Mon, 20 Jun 2022 05:56: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 0C9B1614CA; Mon, 20 Jun 2022 12:56:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1C061C3411B; Mon, 20 Jun 2022 12:56:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729785; bh=jnvaKL2ylP9hoy1It4rGwhTXwZO5J+36jAw+FL5Cfcs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KzfYTxNbt2tVhybMSFjta95oT6HtqzPp/1mCzMAn9JaiEKZu6zzJ/kxx7zo45sIwk Nm3RSOjC4OFiX1HMyogITIYE1q1wAa/9u2hBDPLal0iJ4Vj+H97TADqTeMC5i7Mk7J QH/pxsD7CqpYZVA4L/OLUrHyEy5XuGLwmNX1iWYs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Chengguang Xu , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.18 033/141] scsi: pmcraid: Fix missing resource cleanup in error case Date: Mon, 20 Jun 2022 14:49:31 +0200 Message-Id: <20220620124730.511907555@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chengguang Xu [ Upstream commit ec1e8adcbdf661c57c395bca342945f4f815add7 ] Fix missing resource cleanup (when '(--i) =3D=3D 0') for error case in pmcraid_register_interrupt_handler(). Link: https://lore.kernel.org/r/20220529153456.4183738-6-cgxu519@mykernel.n= et Reviewed-by: Dan Carpenter Signed-off-by: Chengguang Xu Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/scsi/pmcraid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c index fd674ed1febe..6d94837c9049 100644 --- a/drivers/scsi/pmcraid.c +++ b/drivers/scsi/pmcraid.c @@ -4031,7 +4031,7 @@ pmcraid_register_interrupt_handler(struct pmcraid_ins= tance *pinstance) return 0; =20 out_unwind: - while (--i > 0) + while (--i >=3D 0) free_irq(pci_irq_vector(pdev, i), &pinstance->hrrq_vector[i]); pci_free_irq_vectors(pdev); return rc; --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA38EC43334 for ; Mon, 20 Jun 2022 13:01:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243614AbiFTNBl (ORCPT ); Mon, 20 Jun 2022 09:01:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244406AbiFTM7d (ORCPT ); Mon, 20 Jun 2022 08:59:33 -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 D9D4E1CB0B; Mon, 20 Jun 2022 05:56: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 1695161524; Mon, 20 Jun 2022 12:56:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1CB59C3411B; Mon, 20 Jun 2022 12:56:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729788; bh=3hGefnrG2ZbmzJy7O5GiqQ+y2RWsx9LR7I0RBC8whkA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FL5cwuHfKQItepDOHsEm71zDYzHCMvc3AKR4BjKdXXqDOLsJTt77cVU8dEjSfDifO dLsM5MbXhxfTMQ/WoMOQ75nigUqoQojyikylOEbVx/7/FDjqQKFjJCPfE6Imbl6uRX H3nLiF5FQzYFV4LnOyP4AF01aom1Y8oDPPxyy9VU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, huangwenhui , Takashi Iwai , Sasha Levin Subject: [PATCH 5.18 034/141] ALSA: hda/realtek - Add HW8326 support Date: Mon, 20 Jun 2022 14:49:32 +0200 Message-Id: <20220620124730.541591634@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: huangwenhui [ Upstream commit 527f4643e03c298c1e3321cfa27866b1374a55e1 ] Added the support of new Huawei codec HW8326. The HW8326 is developed by Huawei with Realtek's IP Core, and it's compatible with ALC256. Signed-off-by: huangwenhui Link: https://lore.kernel.org/r/20220608082357.26898-1-huangwenhuia@unionte= ch.com Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- sound/hda/hdac_device.c | 1 + sound/pci/hda/patch_realtek.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/sound/hda/hdac_device.c b/sound/hda/hdac_device.c index 3e9e9ac804f6..b7e5032b61c9 100644 --- a/sound/hda/hdac_device.c +++ b/sound/hda/hdac_device.c @@ -660,6 +660,7 @@ static const struct hda_vendor_id hda_vendor_ids[] =3D { { 0x14f1, "Conexant" }, { 0x17e8, "Chrontel" }, { 0x1854, "LG" }, + { 0x19e5, "Huawei" }, { 0x1aec, "Wolfson Microelectronics" }, { 0x1af4, "QEMU" }, { 0x434d, "C-Media" }, diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 8d2d29880716..588d4a59c8d9 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -443,6 +443,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec) case 0x10ec0245: case 0x10ec0255: case 0x10ec0256: + case 0x19e58326: case 0x10ec0257: case 0x10ec0282: case 0x10ec0283: @@ -580,6 +581,7 @@ static void alc_shutup_pins(struct hda_codec *codec) switch (codec->core.vendor_id) { case 0x10ec0236: case 0x10ec0256: + case 0x19e58326: case 0x10ec0283: case 0x10ec0286: case 0x10ec0288: @@ -3247,6 +3249,7 @@ static void alc_disable_headset_jack_key(struct hda_c= odec *codec) case 0x10ec0230: case 0x10ec0236: case 0x10ec0256: + case 0x19e58326: alc_write_coef_idx(codec, 0x48, 0x0); alc_update_coef_idx(codec, 0x49, 0x0045, 0x0); break; @@ -3275,6 +3278,7 @@ static void alc_enable_headset_jack_key(struct hda_co= dec *codec) case 0x10ec0230: case 0x10ec0236: case 0x10ec0256: + case 0x19e58326: alc_write_coef_idx(codec, 0x48, 0xd011); alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045); break; @@ -4910,6 +4914,7 @@ static void alc_headset_mode_unplugged(struct hda_cod= ec *codec) case 0x10ec0230: case 0x10ec0236: case 0x10ec0256: + case 0x19e58326: alc_process_coef_fw(codec, coef0256); break; case 0x10ec0234: @@ -5025,6 +5030,7 @@ static void alc_headset_mode_mic_in(struct hda_codec = *codec, hda_nid_t hp_pin, case 0x10ec0230: case 0x10ec0236: case 0x10ec0256: + case 0x19e58326: alc_write_coef_idx(codec, 0x45, 0xc489); snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); alc_process_coef_fw(codec, coef0256); @@ -5175,6 +5181,7 @@ static void alc_headset_mode_default(struct hda_codec= *codec) case 0x10ec0230: case 0x10ec0236: case 0x10ec0256: + case 0x19e58326: alc_write_coef_idx(codec, 0x1b, 0x0e4b); alc_write_coef_idx(codec, 0x45, 0xc089); msleep(50); @@ -5274,6 +5281,7 @@ static void alc_headset_mode_ctia(struct hda_codec *c= odec) case 0x10ec0230: case 0x10ec0236: case 0x10ec0256: + case 0x19e58326: alc_process_coef_fw(codec, coef0256); break; case 0x10ec0234: @@ -5388,6 +5396,7 @@ static void alc_headset_mode_omtp(struct hda_codec *c= odec) case 0x10ec0230: case 0x10ec0236: case 0x10ec0256: + case 0x19e58326: alc_process_coef_fw(codec, coef0256); break; case 0x10ec0234: @@ -5489,6 +5498,7 @@ static void alc_determine_headset_type(struct hda_cod= ec *codec) case 0x10ec0230: case 0x10ec0236: case 0x10ec0256: + case 0x19e58326: alc_write_coef_idx(codec, 0x1b, 0x0e4b); alc_write_coef_idx(codec, 0x06, 0x6104); alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3); @@ -5783,6 +5793,7 @@ static void alc255_set_default_jack_type(struct hda_c= odec *codec) case 0x10ec0230: case 0x10ec0236: case 0x10ec0256: + case 0x19e58326: alc_process_coef_fw(codec, alc256fw); break; } @@ -6385,6 +6396,7 @@ static void alc_combo_jack_hp_jd_restart(struct hda_c= odec *codec) case 0x10ec0236: case 0x10ec0255: case 0x10ec0256: + case 0x19e58326: alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */ alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15); break; @@ -10149,6 +10161,7 @@ static int patch_alc269(struct hda_codec *codec) case 0x10ec0230: case 0x10ec0236: case 0x10ec0256: + case 0x19e58326: spec->codec_variant =3D ALC269_TYPE_ALC256; spec->shutup =3D alc256_shutup; spec->init_hook =3D alc256_init; @@ -11599,6 +11612,7 @@ static const struct hda_device_id snd_hda_id_realte= k[] =3D { HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882), HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882), HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882), + HDA_CODEC_ENTRY(0x19e58326, "HW8326", patch_alc269), {} /* terminator */ }; MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek); --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA4EDC43334 for ; Mon, 20 Jun 2022 13:01:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243703AbiFTNBA (ORCPT ); Mon, 20 Jun 2022 09:01:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244489AbiFTM7k (ORCPT ); Mon, 20 Jun 2022 08:59: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 59C5819F8F; Mon, 20 Jun 2022 05:56:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5654D614DA; Mon, 20 Jun 2022 12:56:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A2B7C3411B; Mon, 20 Jun 2022 12:56:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729791; bh=EN2LSdwrHyUj4sryCNoBl23CVmDro7Q1flq5/ck1sI4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pmkslvr3fc1SH4fIqRk15ejGN0eZReHnUXhWTZDIo9qq+5YQUmVDNNZxjYQCGXCp+ OXSDZFWSvEKtyoOqymgg6AuL+OGAAez31bA+eCLOH+CDhqvsELvoc5PfZWdnKb9JBO 4w72LbMQT8K8ucAYD3NWX2D3ihYXG+xU6qsWgkF8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, chengkaitao , "Michael S. Tsirkin" , Jason Wang , Sasha Levin Subject: [PATCH 5.18 035/141] virtio-mmio: fix missing put_device() when vm_cmdline_parent registration failed Date: Mon, 20 Jun 2022 14:49:33 +0200 Message-Id: <20220620124730.573184308@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: chengkaitao [ Upstream commit a58a7f97ba11391d2d0d408e0b24f38d86ae748e ] The reference must be released when device_register(&vm_cmdline_parent) failed. Add the corresponding 'put_device()' in the error handling path. Signed-off-by: chengkaitao Message-Id: <20220602005542.16489-1-chengkaitao@didiglobal.com> Signed-off-by: Michael S. Tsirkin Acked-by: Jason Wang Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/virtio/virtio_mmio.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c index 56128b9c46eb..1dd396d4bebb 100644 --- a/drivers/virtio/virtio_mmio.c +++ b/drivers/virtio/virtio_mmio.c @@ -688,6 +688,7 @@ static int vm_cmdline_set(const char *device, if (!vm_cmdline_parent_registered) { err =3D device_register(&vm_cmdline_parent); if (err) { + put_device(&vm_cmdline_parent); pr_err("Failed to register parent device!\n"); return err; } --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E803C433EF for ; Mon, 20 Jun 2022 12:55:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243249AbiFTMzh (ORCPT ); Mon, 20 Jun 2022 08:55:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243243AbiFTMzB (ORCPT ); Mon, 20 Jun 2022 08:55:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1942919286; Mon, 20 Jun 2022 05:54:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C85D1B811A2; Mon, 20 Jun 2022 12:54:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7E16FC3411B; Mon, 20 Jun 2022 12:54:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729665; bh=WVB2cZoIsM8ti2+D/PLRAPxWV297NPg1wTNvLUzUnTo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uyDJgfRbDA55USfZTtuqmWKdVXxiyJkQrz3SpRNdg6f0arf6MfQiz1EeD6QkGLlOI OPCrZsw+v8KBYIkOQm44I6Hz2GRB2SDq+h2dmEYvr3vthG0Jy2BtMYm9VD/TA4MhU8 UmgoDEg3MU87kDjjj6yTUbXpaq5wdx+gA7XT0wL0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Xiaohui Zhang , Krzysztof Kozlowski , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 036/141] nfc: nfcmrvl: Fix memory leak in nfcmrvl_play_deferred Date: Mon, 20 Jun 2022 14:49:34 +0200 Message-Id: <20220620124730.601716595@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Xiaohui Zhang [ Upstream commit 8a4d480702b71184fabcf379b80bf7539716752e ] Similar to the handling of play_deferred in commit 19cfe912c37b ("Bluetooth: btusb: Fix memory leak in play_deferred"), we thought a patch might be needed here as well. Currently usb_submit_urb is called directly to submit deferred tx urbs after unanchor them. So the usb_giveback_urb_bh would failed to unref it in usb_unanchor_urb and cause memory leak. Put those urbs in tx_anchor to avoid the leak, and also fix the error handling. Signed-off-by: Xiaohui Zhang Acked-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20220607083230.6182-1-xiaohuizhang@ruc.edu.= cn Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/nfc/nfcmrvl/usb.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/nfc/nfcmrvl/usb.c b/drivers/nfc/nfcmrvl/usb.c index a99aedff795d..ea7309453096 100644 --- a/drivers/nfc/nfcmrvl/usb.c +++ b/drivers/nfc/nfcmrvl/usb.c @@ -388,13 +388,25 @@ static void nfcmrvl_play_deferred(struct nfcmrvl_usb_= drv_data *drv_data) int err; =20 while ((urb =3D usb_get_from_anchor(&drv_data->deferred))) { + usb_anchor_urb(urb, &drv_data->tx_anchor); + err =3D usb_submit_urb(urb, GFP_ATOMIC); - if (err) + if (err) { + kfree(urb->setup_packet); + usb_unanchor_urb(urb); + usb_free_urb(urb); break; + } =20 drv_data->tx_in_flight++; + usb_free_urb(urb); + } + + /* Cleanup the rest deferred urbs. */ + while ((urb =3D usb_get_from_anchor(&drv_data->deferred))) { + kfree(urb->setup_packet); + usb_free_urb(urb); } - usb_scuttle_anchored_urbs(&drv_data->deferred); } =20 static int nfcmrvl_resume(struct usb_interface *intf) --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11575C433EF for ; Mon, 20 Jun 2022 12:55:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243349AbiFTMzo (ORCPT ); Mon, 20 Jun 2022 08:55:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243251AbiFTMzB (ORCPT ); Mon, 20 Jun 2022 08:55:01 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59C3B19295; Mon, 20 Jun 2022 05:54: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 E9EC661449; Mon, 20 Jun 2022 12:54:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EADECC3411B; Mon, 20 Jun 2022 12:54:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729668; bh=+0lnCICOakkc5xCVlYlg5vEMHIhXXyayy+UhRU2d+C8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U8qcUDgKWJpsZF/lk966RHTl6bmsZmq3AD5Y7xOmDNXmvuATvEjGgZi0B8oaDjmj1 5dVxMXmUJi9XQNCPR7/FhoLu4GxkNgswPgBXA1+aJI2hSj/EpeY4N9eeKdZsZrWnjj TGJ1BJ1ylSmm3WNl436ejodlGlazP7I49mWIiQv8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Wang Yufen , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 037/141] ipv6: Fix signed integer overflow in __ip6_append_data Date: Mon, 20 Jun 2022 14:49:35 +0200 Message-Id: <20220620124730.632853573@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wang Yufen [ Upstream commit f93431c86b631bbca5614c66f966bf3ddb3c2803 ] Resurrect ubsan overflow checks and ubsan report this warning, fix it by change the variable [length] type to size_t. UBSAN: signed-integer-overflow in net/ipv6/ip6_output.c:1489:19 2147479552 + 8567 cannot be represented in type 'int' CPU: 0 PID: 253 Comm: err Not tainted 5.16.0+ #1 Hardware name: linux,dummy-virt (DT) Call trace: dump_backtrace+0x214/0x230 show_stack+0x30/0x78 dump_stack_lvl+0xf8/0x118 dump_stack+0x18/0x30 ubsan_epilogue+0x18/0x60 handle_overflow+0xd0/0xf0 __ubsan_handle_add_overflow+0x34/0x44 __ip6_append_data.isra.48+0x1598/0x1688 ip6_append_data+0x128/0x260 udpv6_sendmsg+0x680/0xdd0 inet6_sendmsg+0x54/0x90 sock_sendmsg+0x70/0x88 ____sys_sendmsg+0xe8/0x368 ___sys_sendmsg+0x98/0xe0 __sys_sendmmsg+0xf4/0x3b8 __arm64_sys_sendmmsg+0x34/0x48 invoke_syscall+0x64/0x160 el0_svc_common.constprop.4+0x124/0x300 do_el0_svc+0x44/0xc8 el0_svc+0x3c/0x1e8 el0t_64_sync_handler+0x88/0xb0 el0t_64_sync+0x16c/0x170 Changes since v1: -Change the variable [length] type to unsigned, as Eric Dumazet suggested. Changes since v2: -Don't change exthdrlen type in ip6_make_skb, as Paolo Abeni suggested. Changes since v3: -Don't change ulen type in udpv6_sendmsg and l2tp_ip6_sendmsg, as Jakub Kicinski suggested. Reported-by: Hulk Robot Signed-off-by: Wang Yufen Link: https://lore.kernel.org/r/20220607120028.845916-1-wangyufen@huawei.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- include/net/ipv6.h | 4 ++-- net/ipv6/ip6_output.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/net/ipv6.h b/include/net/ipv6.h index 213612f1680c..023435ce1606 100644 --- a/include/net/ipv6.h +++ b/include/net/ipv6.h @@ -1019,7 +1019,7 @@ int ip6_find_1stfragopt(struct sk_buff *skb, u8 **nex= thdr); int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb), - void *from, int length, int transhdrlen, + void *from, size_t length, int transhdrlen, struct ipcm6_cookie *ipc6, struct flowi6 *fl6, struct rt6_info *rt, unsigned int flags); =20 @@ -1035,7 +1035,7 @@ struct sk_buff *__ip6_make_skb(struct sock *sk, struc= t sk_buff_head *queue, struct sk_buff *ip6_make_skb(struct sock *sk, int getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb), - void *from, int length, int transhdrlen, + void *from, size_t length, int transhdrlen, struct ipcm6_cookie *ipc6, struct rt6_info *rt, unsigned int flags, struct inet_cork_full *cork); diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index fa63ef2bd99c..87067e0ddaa3 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -1428,7 +1428,7 @@ static int __ip6_append_data(struct sock *sk, struct page_frag *pfrag, int getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb), - void *from, int length, int transhdrlen, + void *from, size_t length, int transhdrlen, unsigned int flags, struct ipcm6_cookie *ipc6) { struct sk_buff *skb, *skb_prev =3D NULL; @@ -1776,7 +1776,7 @@ static int __ip6_append_data(struct sock *sk, int ip6_append_data(struct sock *sk, int getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb), - void *from, int length, int transhdrlen, + void *from, size_t length, int transhdrlen, struct ipcm6_cookie *ipc6, struct flowi6 *fl6, struct rt6_info *rt, unsigned int flags) { @@ -1973,7 +1973,7 @@ EXPORT_SYMBOL_GPL(ip6_flush_pending_frames); struct sk_buff *ip6_make_skb(struct sock *sk, int getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb), - void *from, int length, int transhdrlen, + void *from, size_t length, int transhdrlen, struct ipcm6_cookie *ipc6, struct rt6_info *rt, unsigned int flags, struct inet_cork_full *cork) { --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE84BCCA479 for ; Mon, 20 Jun 2022 12:55:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243366AbiFTMzs (ORCPT ); Mon, 20 Jun 2022 08:55:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243042AbiFTMzE (ORCPT ); Mon, 20 Jun 2022 08:55:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05B69192B8; Mon, 20 Jun 2022 05:54:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B3A93B811A9; Mon, 20 Jun 2022 12:54:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDBFEC3411B; Mon, 20 Jun 2022 12:54:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729671; bh=kY7M+cF6jVAw2h72tzuT6A72g36+rLAemXxLHPg6FwY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T9Sfm4+thB8gctl0Gu5hF+55MflFFsGGtDWiLgydugSxgV03F8FhscNH8++qjGe46 NYyuO2TU8b0fYmMD2ZuCo0JEGxg0Y3H94kIc6QE/rujdduYQzRr+Cv5NAXH1XIBuH4 boZU96vjQgvUcHgxLqi6d79+E8jtDFXpq9nZCAGk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wang Yufen , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 038/141] ipv6: Fix signed integer overflow in l2tp_ip6_sendmsg Date: Mon, 20 Jun 2022 14:49:36 +0200 Message-Id: <20220620124730.661939596@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wang Yufen [ Upstream commit f638a84afef3dfe10554c51820c16e39a278c915 ] When len >=3D INT_MAX - transhdrlen, ulen =3D len + transhdrlen will be overflow. To fix, we can follow what udpv6 does and subtract the transhdrlen from the max. Signed-off-by: Wang Yufen Link: https://lore.kernel.org/r/20220607120028.845916-2-wangyufen@huawei.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- net/l2tp/l2tp_ip6.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c index 96f975777438..d54dbd01d86f 100644 --- a/net/l2tp/l2tp_ip6.c +++ b/net/l2tp/l2tp_ip6.c @@ -502,14 +502,15 @@ static int l2tp_ip6_sendmsg(struct sock *sk, struct m= sghdr *msg, size_t len) struct ipcm6_cookie ipc6; int addr_len =3D msg->msg_namelen; int transhdrlen =3D 4; /* zero session-id */ - int ulen =3D len + transhdrlen; + int ulen; int err; =20 /* Rough check on arithmetic overflow, * better check is made in ip6_append_data(). */ - if (len > INT_MAX) + if (len > INT_MAX - transhdrlen) return -EMSGSIZE; + ulen =3D len + transhdrlen; =20 /* Mirror BSD error message compatibility */ if (msg->msg_flags & MSG_OOB) --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4191C433EF for ; Mon, 20 Jun 2022 12:55:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243376AbiFTMzv (ORCPT ); Mon, 20 Jun 2022 08:55:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243135AbiFTMzF (ORCPT ); Mon, 20 Jun 2022 08:55:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1CBEF193C0; Mon, 20 Jun 2022 05:54:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ADB7F61476; Mon, 20 Jun 2022 12:54:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C001BC3411B; Mon, 20 Jun 2022 12:54:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729674; bh=HJuwirrEietMOqxRTqIzoOclb8YqjBXr2ORRAqpYdoU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CNItky0iA5bzPe0kxiu+zmQdBwM6yRym8edhHTJYFyZqm8o2OZQppWbnwtWq+je6J K2qFk7UBJUivGMF+oB6+67Mmns+2+IJvFluxGAoOrY7T6qHDOUCupfm4mDpoZkDJqg hACvvzyrViHsY8LUY654PMmTZsmOtROCHg4aq2v8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen Lin , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 039/141] net: ethernet: mtk_eth_soc: fix misuse of mem alloc interface netdev[napi]_alloc_frag Date: Mon, 20 Jun 2022 14:49:37 +0200 Message-Id: <20220620124730.691939953@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Chen Lin [ Upstream commit 2f2c0d2919a14002760f89f4e02960c735a316d2 ] When rx_flag =3D=3D MTK_RX_FLAGS_HWLRO, rx_data_len =3D MTK_MAX_LRO_RX_LENGTH(4096 * 3) > PAGE_SIZE. netdev_alloc_frag is for alloction of page fragment only. Reference to other drivers and Documentation/vm/page_frags.rst Branch to use __get_free_pages when ring->frag_size > PAGE_SIZE. Signed-off-by: Chen Lin Link: https://lore.kernel.org/r/1654692413-2598-1-git-send-email-chen454645= 46@163.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethe= rnet/mediatek/mtk_eth_soc.c index a50090e62c8f..c075670bc562 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -778,6 +778,17 @@ static inline bool mtk_rx_get_desc(struct mtk_rx_dma *= rxd, return true; } =20 +static void *mtk_max_lro_buf_alloc(gfp_t gfp_mask) +{ + unsigned int size =3D mtk_max_frag_size(MTK_MAX_LRO_RX_LENGTH); + unsigned long data; + + data =3D __get_free_pages(gfp_mask | __GFP_COMP | __GFP_NOWARN, + get_order(size)); + + return (void *)data; +} + /* the qdma core needs scratch memory to be setup */ static int mtk_init_fq_dma(struct mtk_eth *eth) { @@ -1269,7 +1280,10 @@ static int mtk_poll_rx(struct napi_struct *napi, int= budget, goto release_desc; =20 /* alloc new buffer */ - new_data =3D napi_alloc_frag(ring->frag_size); + if (ring->frag_size <=3D PAGE_SIZE) + new_data =3D napi_alloc_frag(ring->frag_size); + else + new_data =3D mtk_max_lro_buf_alloc(GFP_ATOMIC); if (unlikely(!new_data)) { netdev->stats.rx_dropped++; goto release_desc; @@ -1683,7 +1697,10 @@ static int mtk_rx_alloc(struct mtk_eth *eth, int rin= g_no, int rx_flag) return -ENOMEM; =20 for (i =3D 0; i < rx_dma_size; i++) { - ring->data[i] =3D netdev_alloc_frag(ring->frag_size); + if (ring->frag_size <=3D PAGE_SIZE) + ring->data[i] =3D netdev_alloc_frag(ring->frag_size); + else + ring->data[i] =3D mtk_max_lro_buf_alloc(GFP_KERNEL); if (!ring->data[i]) return -ENOMEM; } --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42B4EC433EF for ; Mon, 20 Jun 2022 12:55:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243178AbiFTMz4 (ORCPT ); Mon, 20 Jun 2022 08:55:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243173AbiFTMzJ (ORCPT ); Mon, 20 Jun 2022 08:55:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9758186E2; Mon, 20 Jun 2022 05:54:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 79265B811A9; Mon, 20 Jun 2022 12:54:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CEFCDC3411B; Mon, 20 Jun 2022 12:54:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729677; bh=FrNSqYBkLrLmW2BO/kUAsvNcSI8f6oVaalIXEkMXFLo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ln+kgqI/4PCjtzIIoE6V6K2HUZxNF900NpE0k6SY/aq6yARwoS5Af5UNDcxwYz1oj 385mq/HyQ7mMwlSU096Qb1J8sCjCDU+5BtORIii3LjGDncC71NRHEew2gFh0Si1aIN RR/VoJeGfTEnhTk0F8fQtNvzEai2Ncab6oeCbDz8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Torvalds , Sasha Levin Subject: [PATCH 5.18 040/141] gcc-12: disable -Wdangling-pointer warning for now Date: Mon, 20 Jun 2022 14:49:38 +0200 Message-Id: <20220620124730.721618831@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Linus Torvalds [ Upstream commit 49beadbd47c270a00754c107a837b4f29df4c822 ] While the concept of checking for dangling pointers to local variables at function exit is really interesting, the gcc-12 implementation is not compatible with reality, and results in false positives. For example, gcc sees us putting things on a local list head allocated on the stack, which involves exactly those kinds of pointers to the local stack entry: In function =E2=80=98__list_add=E2=80=99, inlined from =E2=80=98list_add_tail=E2=80=99 at include/linux/list.h:= 102:2, inlined from =E2=80=98rebuild_snap_realms=E2=80=99 at fs/ceph/snap.c:= 434:2: include/linux/list.h:74:19: warning: storing the address of local variabl= e =E2=80=98realm_queue=E2=80=99 in =E2=80=98*&realm_27(D)->rebuild_item.pre= v=E2=80=99 [-Wdangling-pointer=3D] 74 | new->prev =3D prev; | ~~~~~~~~~~^~~~~~ But then gcc - understandably - doesn't really understand the big picture how the doubly linked list works, so doesn't see how we then end up emptying said list head in a loop and the pointer we added has been removed. Gcc also complains about us (intentionally) using this as a way to store a kind of fake stack trace, eg drivers/acpi/acpica/utdebug.c:40:38: warning: storing the address of loca= l variable =E2=80=98current_sp=E2=80=99 in =E2=80=98acpi_gbl_entry_stack_po= inter=E2=80=99 [-Wdangling-pointer=3D] 40 | acpi_gbl_entry_stack_pointer =3D ¤t_sp; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~ which is entirely reasonable from a compiler standpoint, and we may want to change those kinds of patterns, but not not. So this is one of those "it would be lovely if the compiler were to complain about us leaving dangling pointers to the stack", but not this way. Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 34bfb76d6333..476cbe751b17 100644 --- a/Makefile +++ b/Makefile @@ -804,6 +804,9 @@ endif KBUILD_CFLAGS +=3D $(call cc-disable-warning, unused-but-set-variable) KBUILD_CFLAGS +=3D $(call cc-disable-warning, unused-const-variable) =20 +# These result in bogus false positives +KBUILD_CFLAGS +=3D $(call cc-disable-warning, dangling-pointer) + ifdef CONFIG_FRAME_POINTER KBUILD_CFLAGS +=3D -fno-omit-frame-pointer -fno-optimize-sibling-calls else --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6470CCA479 for ; Mon, 20 Jun 2022 12:55:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243399AbiFTMz6 (ORCPT ); Mon, 20 Jun 2022 08:55:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243184AbiFTMzL (ORCPT ); Mon, 20 Jun 2022 08:55:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C4AA193EA; Mon, 20 Jun 2022 05:54:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D189A614F0; Mon, 20 Jun 2022 12:54:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD766C3411B; Mon, 20 Jun 2022 12:54:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729680; bh=3+TjRApg31Kdh5COe4/h8BpJnLyMhiRmcAOy4HX2bjc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WPNG59mn6QIm7v35j2xuc8Z+Z+u+sf6ZkYH0FO4ZpFwS2HX05CJ7X1NKZJJzDYP5S HbXxN7vpvvP7DGqicICDEaW1slvYXNOtXTco4uan9AVoeGOcCGxNi3kl4CiWk6/ZBk 72EyH3ZOAhjr5ak6GlKQiIDJ3jR8+NKnbb3mQgsk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Torvalds , Sasha Levin Subject: [PATCH 5.18 041/141] mellanox: mlx5: avoid uninitialized variable warning with gcc-12 Date: Mon, 20 Jun 2022 14:49:39 +0200 Message-Id: <20220620124730.749469733@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Linus Torvalds [ Upstream commit 842c3b3ddc5f4d17275edbaa09e23d712bf8b915 ] gcc-12 started warning about 'tracker' being used uninitialized: drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c: In function =E2=80=98m= lx5_do_bond=E2=80=99: drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c:786:28: warning: =E2=80= =98tracker=E2=80=99 is used uninitialized [-Wuninitialized] 786 | struct lag_tracker tracker; | ^~~~~~~ which seems to be because it doesn't track how the use (and initialization) is bound by the 'do_bond' flag. But admittedly that 'do_bond' usage is fairly complicated, and involves passing it around as an argument to helper functions, so it's somewhat understandable that gcc doesn't see how that all works. This function could be rewritten to make the use of that tracker variable more obviously safe, but for now I'm just adding the forced initialization of it. Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c b/drivers/ne= t/ethernet/mellanox/mlx5/core/lag/lag.c index a8b98242edb1..a1e9d3051533 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c @@ -561,7 +561,7 @@ static void mlx5_do_bond(struct mlx5_lag *ldev) { struct mlx5_core_dev *dev0 =3D ldev->pf[MLX5_LAG_P1].dev; struct mlx5_core_dev *dev1 =3D ldev->pf[MLX5_LAG_P2].dev; - struct lag_tracker tracker; + struct lag_tracker tracker =3D { }; bool do_bond, roce_lag; int err; =20 --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96DD4C43334 for ; Mon, 20 Jun 2022 12:56:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243420AbiFTM4G (ORCPT ); Mon, 20 Jun 2022 08:56:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243072AbiFTMzO (ORCPT ); Mon, 20 Jun 2022 08:55:14 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54128193D4; Mon, 20 Jun 2022 05:54: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 E72D9614EB; Mon, 20 Jun 2022 12:54:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9BBEC3411C; Mon, 20 Jun 2022 12:54:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729684; bh=Nc4h6bd5VOFVAoL8VfnNszRDRrDW6XCZctGLW0J005k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y71f6qeAQNwjtZZVcSQEU2Qszk4MrHCFN37fK/KIBmZbPwaVRoIY2qJiknU2gW7Vd O+zGA+UR7xt5NOArOFqGb4h1LhkVt56v87u1GiOXfFh9/CdOYQqaW3Ar/W93lYC/S1 1fN2qHNgImyWvZOhWPwiyF/kDa7C2mP/96MYTcrM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kees Cook , Nathan Chancellor , Linus Torvalds , Sasha Levin Subject: [PATCH 5.18 042/141] gcc-12: disable -Warray-bounds universally for now Date: Mon, 20 Jun 2022 14:49:40 +0200 Message-Id: <20220620124730.778643675@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Linus Torvalds [ Upstream commit f0be87c42cbd341d436d06da4792e6b0c83c3aeb ] In commit 8b202ee21839 ("s390: disable -Warray-bounds") the s390 people disabled the '-Warray-bounds' warning for gcc-12, because the new logic in gcc would cause warnings for their use of the S390_lowcore macro, which accesses absolute pointers. It turns out gcc-12 has many other issues in this area, so this takes that s390 warning disable logic, and turns it into a kernel build config entry instead. Part of the intent is that we can make this all much more targeted, and use this conflig flag to disable it in only particular configurations that cause problems, with the s390 case as an example: select GCC12_NO_ARRAY_BOUNDS and we could do that for other configuration cases that cause issues. Or we could possibly use the CONFIG_CC_NO_ARRAY_BOUNDS thing in a more targeted way, and disable the warning only for particular uses: again the s390 case as an example: KBUILD_CFLAGS_DECOMPRESSOR +=3D $(if $(CONFIG_CC_NO_ARRAY_BOUNDS),-Wno-ar= ray-bounds) but this ends up just doing it globally in the top-level Makefile, since the current issues are spread fairly widely all over: KBUILD_CFLAGS-$(CONFIG_CC_NO_ARRAY_BOUNDS) +=3D -Wno-array-bounds We'll try to limit this later, since the gcc-12 problems are rare enough that *much* of the kernel can be built with it without disabling this warning. Cc: Kees Cook Cc: Nathan Chancellor Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- Makefile | 1 + arch/s390/Kconfig | 1 + arch/s390/Makefile | 10 +--------- init/Kconfig | 9 +++++++++ 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 476cbe751b17..d19e3b425bd6 100644 --- a/Makefile +++ b/Makefile @@ -787,6 +787,7 @@ stackp-flags-$(CONFIG_STACKPROTECTOR_STRONG) :=3D = -fstack-protector-strong KBUILD_CFLAGS +=3D $(stackp-flags-y) =20 KBUILD_CFLAGS-$(CONFIG_WERROR) +=3D -Werror +KBUILD_CFLAGS-$(CONFIG_CC_NO_ARRAY_BOUNDS) +=3D -Wno-array-bounds KBUILD_CFLAGS +=3D $(KBUILD_CFLAGS-y) $(CONFIG_CC_IMPLICIT_FALLTHROUGH) =20 ifdef CONFIG_CC_IS_CLANG diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index e084c72104f8..359b0cc0dc35 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -125,6 +125,7 @@ config S390 select CLONE_BACKWARDS2 select DMA_OPS if PCI select DYNAMIC_FTRACE if FUNCTION_TRACER + select GCC12_NO_ARRAY_BOUNDS select GENERIC_ALLOCATOR select GENERIC_CPU_AUTOPROBE select GENERIC_CPU_VULNERABILITIES diff --git a/arch/s390/Makefile b/arch/s390/Makefile index df325eacf62d..eba70d585cb2 100644 --- a/arch/s390/Makefile +++ b/arch/s390/Makefile @@ -30,15 +30,7 @@ KBUILD_CFLAGS_DECOMPRESSOR +=3D -fno-stack-protector KBUILD_CFLAGS_DECOMPRESSOR +=3D $(call cc-disable-warning, address-of-pack= ed-member) KBUILD_CFLAGS_DECOMPRESSOR +=3D $(if $(CONFIG_DEBUG_INFO),-g) KBUILD_CFLAGS_DECOMPRESSOR +=3D $(if $(CONFIG_DEBUG_INFO_DWARF4), $(call c= c-option, -gdwarf-4,)) - -ifdef CONFIG_CC_IS_GCC - ifeq ($(call cc-ifversion, -ge, 1200, y), y) - ifeq ($(call cc-ifversion, -lt, 1300, y), y) - KBUILD_CFLAGS +=3D $(call cc-disable-warning, array-bounds) - KBUILD_CFLAGS_DECOMPRESSOR +=3D $(call cc-disable-warning, array-bounds) - endif - endif -endif +KBUILD_CFLAGS_DECOMPRESSOR +=3D $(if $(CONFIG_CC_NO_ARRAY_BOUNDS),-Wno-arr= ay-bounds) =20 UTS_MACHINE :=3D s390x STACK_SIZE :=3D $(if $(CONFIG_KASAN),65536,16384) diff --git a/init/Kconfig b/init/Kconfig index b19e2eeaae80..fa63cc019ebf 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -899,6 +899,15 @@ config CC_IMPLICIT_FALLTHROUGH default "-Wimplicit-fallthrough=3D5" if CC_IS_GCC && $(cc-option,-Wimplic= it-fallthrough=3D5) default "-Wimplicit-fallthrough" if CC_IS_CLANG && $(cc-option,-Wunreacha= ble-code-fallthrough) =20 +# Currently, disable gcc-12 array-bounds globally. +# We may want to target only particular configurations some day. +config GCC12_NO_ARRAY_BOUNDS + def_bool y + +config CC_NO_ARRAY_BOUNDS + bool + default y if CC_IS_GCC && GCC_VERSION >=3D 120000 && GCC_VERSION < 130000= && GCC12_NO_ARRAY_BOUNDS + # # For architectures that know their GCC __int128 support is sound # --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 523D3CCA479 for ; Mon, 20 Jun 2022 12:56:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243174AbiFTM4U (ORCPT ); Mon, 20 Jun 2022 08:56:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243130AbiFTMzq (ORCPT ); Mon, 20 Jun 2022 08:55:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDD0B18B2F; Mon, 20 Jun 2022 05:54:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E4AA2614EC; Mon, 20 Jun 2022 12:54:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBC22C3411B; Mon, 20 Jun 2022 12:54:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729687; bh=g6hV2nEfu4q7fWk0v9EQw/74GXzsuzsOm5CE2k8SdLk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ODvCNQfCAbtAiCfo6e112jcux+saC0jVByG7CxSrJyKM/Vp1UPUyrZEV1T5TJJGm1 bygBgAu1mDUbGxGtfYMWan/2hgLy8OltttJwQVvgWp4nyk1NQQJiJAPoLcLwpH4v19 sHSwbSPRwiAU7YPCEFSZcI6rn6FfD+XjTfDX+6CI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kees Cook , David Howells , Linus Torvalds , Sasha Levin Subject: [PATCH 5.18 043/141] netfs: gcc-12: temporarily disable -Wattribute-warning for now Date: Mon, 20 Jun 2022 14:49:41 +0200 Message-Id: <20220620124730.809601885@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Linus Torvalds [ Upstream commit 507160f46c55913955d272ebf559d63809a8e560 ] This is a pure band-aid so that I can continue merging stuff from people while some of the gcc-12 fallout gets sorted out. In particular, gcc-12 is very unhappy about the kinds of pointer arithmetic tricks that netfs does, and that makes the fortify checks trigger in afs and ceph: In function =E2=80=98fortify_memset_chk=E2=80=99, inlined from =E2=80=98netfs_i_context_init=E2=80=99 at include/linux/= netfs.h:327:2, inlined from =E2=80=98afs_set_netfs_context=E2=80=99 at fs/afs/inode.= c:61:2, inlined from =E2=80=98afs_root_iget=E2=80=99 at fs/afs/inode.c:543:2: include/linux/fortify-string.h:258:25: warning: call to =E2=80=98__write_= overflow_field=E2=80=99 declared with attribute warning: detected write bey= ond size of field (1st parameter); maybe use struct_group()? [-Wattribute-w= arning] 258 | __write_overflow_field(p_size_field, size= ); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ and the reason is that netfs_i_context_init() is passed a 'struct inode' pointer, and then it does struct netfs_i_context *ctx =3D netfs_i_context(inode); memset(ctx, 0, sizeof(*ctx)); where that netfs_i_context() function just does pointer arithmetic on the inode pointer, knowing that the netfs_i_context is laid out immediately after it in memory. This is all truly disgusting, since the whole "netfs_i_context is laid out immediately after it in memory" is not actually remotely true in general, but is just made to be that way for afs and ceph. See for example fs/cifs/cifsglob.h: struct cifsInodeInfo { struct { /* These must be contiguous */ struct inode vfs_inode; /* the VFS's inode record */ struct netfs_i_context netfs_ctx; /* Netfslib context */ }; [...] and realize that this is all entirely wrong, and the pointer arithmetic that netfs_i_context() is doing is also very very wrong and wouldn't give the right answer if netfs_ctx had different alignment rules from a 'struct inode', for example). Anyway, that's just a long-winded way to say "the gcc-12 warning is actually quite reasonable, and our code happens to work but is pretty disgusting". This is getting fixed properly, but for now I made the mistake of thinking "the week right after the merge window tends to be calm for me as people take a breather" and I did a sustem upgrade. And I got gcc-12 as a result, so to continue merging fixes from people and not have the end result drown in warnings, I am fixing all these gcc-12 issues I hit. Including with these kinds of temporary fixes. Cc: Kees Cook Cc: David Howells Link: https://lore.kernel.org/all/AEEBCF5D-8402-441D-940B-105AA718C71F@chro= mium.org/ Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- fs/afs/inode.c | 3 +++ fs/ceph/inode.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/fs/afs/inode.c b/fs/afs/inode.c index 30b066299d39..65b439cd53d2 100644 --- a/fs/afs/inode.c +++ b/fs/afs/inode.c @@ -25,6 +25,9 @@ #include "internal.h" #include "afs_fs.h" =20 +// Temporary: netfs does disgusting things with inode pointers +#pragma GCC diagnostic ignored "-Wattribute-warning" + static const struct inode_operations afs_symlink_inode_operations =3D { .get_link =3D page_get_link, }; diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 63113e2a4890..83739dae5268 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -20,6 +20,9 @@ #include "cache.h" #include =20 +// Temporary: netfs does disgusting things with inode pointers +#pragma GCC diagnostic ignored "-Wattribute-warning" + /* * Ceph inode operations * --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E7E38C43334 for ; Mon, 20 Jun 2022 12:56:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243184AbiFTM4X (ORCPT ); Mon, 20 Jun 2022 08:56:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243369AbiFTMzs (ORCPT ); Mon, 20 Jun 2022 08:55:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74C9B19F95; Mon, 20 Jun 2022 05:54:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D4BD5614CE; Mon, 20 Jun 2022 12:54:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4D06C3411B; Mon, 20 Jun 2022 12:54:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729690; bh=YGPJSIN4rLQzhxISScC7BKlrycx2fKnKwDHRfnaUlJ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vyJG/wHuU33FtiGHzui43jTn6r/n3BiNcyaOT10OHwKj7OYrTgWn0b4si6vWzl//k 0heR1GoP84mr4jP+9M3AYt47YEIFmt4fRYkNOCtZ5cz9MGopjIDtwUJKPRLxy/ZtIQ ET17wXaZpgk+r8/mKZusOcrLyh854A1+WbSJGUP0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yupeng Li , Guenter Roeck , Huacai Chen , Thomas Bogendoerfer , Sasha Levin Subject: [PATCH 5.18 044/141] MIPS: Loongson-3: fix compile mips cpu_hwmon as module build error. Date: Mon, 20 Jun 2022 14:49:42 +0200 Message-Id: <20220620124730.837456177@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yupeng Li [ Upstream commit 41e456400212803704e82691716e1d7b0865114a ] set cpu_hwmon as a module build with loongson_sysconf, loongson_chiptemp undefined error,fix cpu_hwmon compile options to be bool.Some kernel compilation error information is as follows: Checking missing-syscalls for N32 CALL scripts/checksyscalls.sh Checking missing-syscalls for O32 CALL scripts/checksyscalls.sh CALL scripts/checksyscalls.sh CHK include/generated/compile.h CC [M] drivers/platform/mips/cpu_hwmon.o Building modules, stage 2. MODPOST 200 modules ERROR: "loongson_sysconf" [drivers/platform/mips/cpu_hwmon.ko] undefined! ERROR: "loongson_chiptemp" [drivers/platform/mips/cpu_hwmon.ko] undefined! make[1]: *** [scripts/Makefile.modpost:92=EF=BC=9A__modpost] =E9=94=99=E8= =AF=AF 1 make: *** [Makefile:1261=EF=BC=9Amodules] =E9=94=99=E8=AF=AF 2 Signed-off-by: Yupeng Li Reviewed-by: Guenter Roeck Reviewed-by: Huacai Chen Signed-off-by: Thomas Bogendoerfer Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/platform/mips/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/mips/Kconfig b/drivers/platform/mips/Kconfig index d421e1482395..6b51ad01f791 100644 --- a/drivers/platform/mips/Kconfig +++ b/drivers/platform/mips/Kconfig @@ -17,7 +17,7 @@ menuconfig MIPS_PLATFORM_DEVICES if MIPS_PLATFORM_DEVICES =20 config CPU_HWMON - tristate "Loongson-3 CPU HWMon Driver" + bool "Loongson-3 CPU HWMon Driver" depends on MACH_LOONGSON64 select HWMON default y --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06BA2C433EF for ; Mon, 20 Jun 2022 12:56:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243171AbiFTM4r (ORCPT ); Mon, 20 Jun 2022 08:56:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243138AbiFTM4S (ORCPT ); Mon, 20 Jun 2022 08:56:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EA3F1A061; Mon, 20 Jun 2022 05:54: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 61864B811B3; Mon, 20 Jun 2022 12:54:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2B16C3411B; Mon, 20 Jun 2022 12:54:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729693; bh=cvSQdQ9FeCMsC6QFqLTFFI5N56fpaeXWKG9aKZ8paYk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YDTyiDUp4xA5OHquJmeaSMxS2uwFSFWvRJLCFtC3hy6iBN4rRI+I3CmN/QDlx+Bww sdCHqRgMOPruzcDtsadj/KPbjqOEgs4wft8E0TNGiW4Kv9C71Mzq1SpshXLNhbZKF/ ErjGDg45UOWgGDfoHV73rNDT4IqZWD8IwjVXP+yI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Theodore Tso , Ard Biesheuvel , "Jason A. Donenfeld" , Sasha Levin Subject: [PATCH 5.18 045/141] random: credit cpu and bootloader seeds by default Date: Mon, 20 Jun 2022 14:49:43 +0200 Message-Id: <20220620124730.866527770@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jason A. Donenfeld [ Upstream commit 846bb97e131d7938847963cca00657c995b1fce1 ] This commit changes the default Kconfig values of RANDOM_TRUST_CPU and RANDOM_TRUST_BOOTLOADER to be Y by default. It does not change any existing configs or change any kernel behavior. The reason for this is several fold. As background, I recently had an email thread with the kernel maintainers of Fedora/RHEL, Debian, Ubuntu, Gentoo, Arch, NixOS, Alpine, SUSE, and Void as recipients. I noted that some distros trust RDRAND, some trust EFI, and some trust both, and I asked why or why not. There wasn't really much of a "debate" but rather an interesting discussion of what the historical reasons have been for this, and it came up that some distros just missed the introduction of the bootloader Kconfig knob, while another didn't want to enable it until there was a boot time switch to turn it off for more concerned users (which has since been added). The result of the rather uneventful discussion is that every major Linux distro enables these two options by default. While I didn't have really too strong of an opinion going into this thread -- and I mostly wanted to learn what the distros' thinking was one way or another -- ultimately I think their choice was a decent enough one for a default option (which can be disabled at boot time). I'll try to summarize the pros and cons: Pros: - The RNG machinery gets initialized super quickly, and there's no messing around with subsequent blocking behavior. - The bootloader mechanism is used by kexec in order for the prior kernel to initialize the RNG of the next kernel, which increases the entropy available to early boot daemons of the next kernel. - Previous objections related to backdoors centered around Dual_EC_DRBG-like kleptographic systems, in which observing some amount of the output stream enables an adversary holding the right key to determine the entire output stream. This used to be a partially justified concern, because RDRAND output was mixed into the output stream in varying ways, some of which may have lacked pre-image resistance (e.g. XOR or an LFSR). But this is no longer the case. Now, all usage of RDRAND and bootloader seeds go through a cryptographic hash function. This means that the CPU would have to compute a hash pre-image, which is not considered to be feasible (otherwise the hash function would be terribly broken). - More generally, if the CPU is backdoored, the RNG is probably not the realistic vector of choice for an attacker. - These CPU or bootloader seeds are far from being the only source of entropy. Rather, there is generally a pretty huge amount of entropy, not all of which is credited, especially on CPUs that support instructions like RDRAND. In other words, assuming RDRAND outputs all zeros, an attacker would *still* have to accurately model every single other entropy source also in use. - The RNG now reseeds itself quite rapidly during boot, starting at 2 seconds, then 4, then 8, then 16, and so forth, so that other sources of entropy get used without much delay. - Paranoid users can set random.trust_{cpu,bootloader}=3Dno in the kernel command line, and paranoid system builders can set the Kconfig options to N, so there's no reduction or restriction of optionality. - It's a practical default. - All the distros have it set this way. Microsoft and Apple trust it too. Bandwagon. Cons: - RDRAND *could* still be backdoored with something like a fixed key or limited space serial number seed or another indexable scheme like that. (However, it's hard to imagine threat models where the CPU is backdoored like this, yet people are still okay making *any* computations with it or connecting it to networks, etc.) - RDRAND *could* be defective, rather than backdoored, and produce garbage that is in one way or another insufficient for crypto. - Suggesting a *reduction* in paranoia, as this commit effectively does, may cause some to question my personal integrity as a "security person". - Bootloader seeds and RDRAND are generally very difficult if not all together impossible to audit. Keep in mind that this doesn't actually change any behavior. This is just a change in the default Kconfig value. The distros already are shipping kernels that set things this way. Ard made an additional argument in [1]: We're at the mercy of firmware and micro-architecture anyway, given that we are also relying on it to ensure that every instruction in the kernel's executable image has been faithfully copied to memory, and that the CPU implements those instructions as documented. So I don't think firmware or ISA bugs related to RNGs deserve special treatment - if they are broken, we should quirk around them like we usually do. So enabling these by default is a step in the right direction IMHO. In [2], Phil pointed out that having this disabled masked a bug that CI otherwise would have caught: A clean 5.15.45 boots cleanly, whereas a downstream kernel shows the static key warning (but it does go on to boot). The significant difference is that our defconfigs set CONFIG_RANDOM_TRUST_BOOTLOADER=3Dy defining that on top of multi_v7_defconfig demonstrates the issue on a clean 5.15.45. Conversely, not setting that option in a downstream kernel build avoids the warning [1] https://lore.kernel.org/lkml/CAMj1kXGi+ieviFjXv9zQBSaGyyzeGW_VpMpTLJK8P= Jb2QHEQ-w@mail.gmail.com/ [2] https://lore.kernel.org/lkml/c47c42e3-1d56-5859-a6ad-976a1a3381c6@raspb= errypi.com/ Cc: Theodore Ts'o Reviewed-by: Ard Biesheuvel Signed-off-by: Jason A. Donenfeld Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/char/Kconfig | 50 +++++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 55f48375e3fe..d454428f4981 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig @@ -428,28 +428,40 @@ config ADI driver include crash and makedumpfile. =20 config RANDOM_TRUST_CPU - bool "Trust the CPU manufacturer to initialize Linux's CRNG" + bool "Initialize RNG using CPU RNG instructions" + default y depends on ARCH_RANDOM - default n help - Assume that CPU manufacturer (e.g., Intel or AMD for RDSEED or - RDRAND, IBM for the S390 and Power PC architectures) is trustworthy - for the purposes of initializing Linux's CRNG. Since this is not - something that can be independently audited, this amounts to trusting - that CPU manufacturer (perhaps with the insistence or mandate - of a Nation State's intelligence or law enforcement agencies) - has not installed a hidden back door to compromise the CPU's - random number generation facilities. This can also be configured - at boot with "random.trust_cpu=3Don/off". + Initialize the RNG using random numbers supplied by the CPU's + RNG instructions (e.g. RDRAND), if supported and available. These + random numbers are never used directly, but are rather hashed into + the main input pool, and this happens regardless of whether or not + this option is enabled. Instead, this option controls whether the + they are credited and hence can initialize the RNG. Additionally, + other sources of randomness are always used, regardless of this + setting. Enabling this implies trusting that the CPU can supply high + quality and non-backdoored random numbers. + + Say Y here unless you have reason to mistrust your CPU or believe + its RNG facilities may be faulty. This may also be configured at + boot time with "random.trust_cpu=3Don/off". =20 config RANDOM_TRUST_BOOTLOADER - bool "Trust the bootloader to initialize Linux's CRNG" - help - Some bootloaders can provide entropy to increase the kernel's initial - device randomness. Say Y here to assume the entropy provided by the - booloader is trustworthy so it will be added to the kernel's entropy - pool. Otherwise, say N here so it will be regarded as device input that - only mixes the entropy pool. This can also be configured at boot with - "random.trust_bootloader=3Don/off". + bool "Initialize RNG using bootloader-supplied seed" + default y + help + Initialize the RNG using a seed supplied by the bootloader or boot + environment (e.g. EFI or a bootloader-generated device tree). This + seed is not used directly, but is rather hashed into the main input + pool, and this happens regardless of whether or not this option is + enabled. Instead, this option controls whether the seed is credited + and hence can initialize the RNG. Additionally, other sources of + randomness are always used, regardless of this setting. Enabling + this implies trusting that the bootloader can supply high quality and + non-backdoored seeds. + + Say Y here unless you have reason to mistrust your bootloader or + believe its RNG facilities may be faulty. This may also be configured + at boot time with "random.trust_bootloader=3Don/off". =20 endmenu --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 169CCC433EF for ; Mon, 20 Jun 2022 12:57:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243261AbiFTM5E (ORCPT ); Mon, 20 Jun 2022 08:57:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243295AbiFTM4l (ORCPT ); Mon, 20 Jun 2022 08:56:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43DFF18B3C; Mon, 20 Jun 2022 05:55:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6B7B1B811A3; Mon, 20 Jun 2022 12:55:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C068BC3411B; Mon, 20 Jun 2022 12:54:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729699; bh=Gc6fuGZ+6DADRITiZxkitRn492CZ5PoYNJGVIcbu6d8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hpgL/2OxLikM4KwV8G1cCSmfsXI1cv/0r+a7ZyqFCGgO4NJlXB6Hrt3NhJ3FkTZLW /RH+1Xj1XdCwO3qJ21ogcdXSuo3C7gW/ictYFvYQacFcWgCy1X8TP+FPA+1Bm21cBX zqwQZ+fi3ArQfC+i+ShVvuflRFgVEEwriHv8AdaU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Semin , Andy Shevchenko , Bartosz Golaszewski , Sasha Levin Subject: [PATCH 5.18 046/141] gpio: dwapb: Dont print error on -EPROBE_DEFER Date: Mon, 20 Jun 2022 14:49:44 +0200 Message-Id: <20220620124730.895298056@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Serge Semin [ Upstream commit 77006f6edc0e0f58617eb25e53731f78641e820d ] Currently if the APB or Debounce clocks aren't yet ready to be requested the DW GPIO driver will correctly handle that by deferring the probe procedure, but the error is still printed to the system log. It needlessly pollutes the log since there was no real error but a request to postpone the clock request procedure since the clocks subsystem hasn't been fully initialized yet. Let's fix that by using the dev_err_probe method to print the APB/clock request error status. It will correctly handle the deferred probe situation and print the error if it actually happens. Signed-off-by: Serge Semin Reviewed-by: Andy Shevchenko Signed-off-by: Bartosz Golaszewski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpio/gpio-dwapb.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/gpio/gpio-dwapb.c b/drivers/gpio/gpio-dwapb.c index b0f3aca61974..9467d695a33e 100644 --- a/drivers/gpio/gpio-dwapb.c +++ b/drivers/gpio/gpio-dwapb.c @@ -652,10 +652,9 @@ static int dwapb_get_clks(struct dwapb_gpio *gpio) gpio->clks[1].id =3D "db"; err =3D devm_clk_bulk_get_optional(gpio->dev, DWAPB_NR_CLOCKS, gpio->clks); - if (err) { - dev_err(gpio->dev, "Cannot get APB/Debounce clocks\n"); - return err; - } + if (err) + return dev_err_probe(gpio->dev, err, + "Cannot get APB/Debounce clocks\n"); =20 err =3D clk_bulk_prepare_enable(DWAPB_NR_CLOCKS, gpio->clks); if (err) { --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E5C3C43334 for ; Mon, 20 Jun 2022 12:57:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243445AbiFTM5N (ORCPT ); Mon, 20 Jun 2022 08:57:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38648 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243468AbiFTM4s (ORCPT ); Mon, 20 Jun 2022 08:56:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 678781A068; Mon, 20 Jun 2022 05:55:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0DC99614EB; Mon, 20 Jun 2022 12:55:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04296C341C4; Mon, 20 Jun 2022 12:55:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729702; bh=9jDDsgQyQTjlFBuKLov8y6UFAbc1Ox58tCBgC74fWGY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TfzlQwcCe+JvNSSgZRNR/jCI1i3Gd2eBAxmZiH0wxGQAHR9G2T2Udjj8VrTp9YcTI YjJRS1m8NiLxm0ToPcdu5eXTCslvu04D3qu+iy5sVhvLap7ia+4/DTC73Kz7MldE60 w4bnSevc7mx3QnVhNCAD+r0rUFZ6Wxd18ZNKkf4I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "David E. Box" , Hans de Goede , Mark Gross , David Arcari , Sasha Levin Subject: [PATCH 5.18 047/141] platform/x86/intel: Fix pmt_crashlog array reference Date: Mon, 20 Jun 2022 14:49:45 +0200 Message-Id: <20220620124730.925164063@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: David Arcari [ Upstream commit 66cb3a2d7ad0d0e9af4d3430a4f2a32ffb9ac098 ] The probe function pmt_crashlog_probe() may incorrectly reference the 'priv->entry array' as it uses 'i' to reference the array instead of 'priv->num_entries' as it should. This is similar to the problem that was addressed in pmt_telemetry_probe via commit 2cdfa0c20d58 ("platform/x86/intel: Fix 'rmmod pmt_telemetry' panic"). Cc: "David E. Box" Cc: Hans de Goede Cc: Mark Gross Cc: linux-kernel@vger.kernel.org Signed-off-by: David Arcari Reviewed-by: David E. Box Link: https://lore.kernel.org/r/20220526203140.339120-1-darcari@redhat.com Signed-off-by: Hans de Goede Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/platform/x86/intel/pmt/crashlog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/x86/intel/pmt/crashlog.c b/drivers/platform/x= 86/intel/pmt/crashlog.c index 34daf9df168b..ace1239bc0a0 100644 --- a/drivers/platform/x86/intel/pmt/crashlog.c +++ b/drivers/platform/x86/intel/pmt/crashlog.c @@ -282,7 +282,7 @@ static int pmt_crashlog_probe(struct auxiliary_device *= auxdev, auxiliary_set_drvdata(auxdev, priv); =20 for (i =3D 0; i < intel_vsec_dev->num_resources; i++) { - struct intel_pmt_entry *entry =3D &priv->entry[i].entry; + struct intel_pmt_entry *entry =3D &priv->entry[priv->num_entries].entry; =20 ret =3D intel_pmt_dev_create(entry, &pmt_crashlog_ns, intel_vsec_dev, i); if (ret < 0) --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79175C43334 for ; Mon, 20 Jun 2022 12:57:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243519AbiFTM5f (ORCPT ); Mon, 20 Jun 2022 08:57:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243472AbiFTM47 (ORCPT ); Mon, 20 Jun 2022 08:56:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3470618E35; Mon, 20 Jun 2022 05:55:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 07BD8614EC; Mon, 20 Jun 2022 12:55:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 141D9C3411B; Mon, 20 Jun 2022 12:55:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729705; bh=LUqjWhd2x19oH7kQGPvqJsFKkYqV5H/4feAZdzzEdv0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ax588mkbze4xDLODyWtIkUgJuOyCk8Sy9QgvicIpXVYF/K03JHKQA4PAtGKO+/wi/ rkelbSKSSmYi8UOJ+yOqEqKNF5u/RwSDzCB367hmB+TK1XuIy1NoS9hGkTKNokvtG4 r0j/Zfjqnft+EN5ozE5dFGLNtA3Qw2L4fiups1D4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, George D Sworo , "David E. Box" , Hans de Goede , Sasha Levin Subject: [PATCH 5.18 048/141] platform/x86/intel: pmc: Support Intel Raptorlake P Date: Mon, 20 Jun 2022 14:49:46 +0200 Message-Id: <20220620124730.955235929@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: George D Sworo [ Upstream commit 552f3b801de6eb062b225a76e140995483a0609c ] Add Raptorlake P to the list of the platforms that intel_pmc_core driver supports for pmc_core device. Raptorlake P PCH is based on Alderlake P PCH. Signed-off-by: George D Sworo Reviewed-by: David E. Box Link: https://lore.kernel.org/r/20220602012617.20100-1-george.d.sworo@intel= .com Signed-off-by: Hans de Goede Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/platform/x86/intel/pmc/core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/platform/x86/intel/pmc/core.c b/drivers/platform/x86/i= ntel/pmc/core.c index ac19fcc9abbf..8ee15a7252c7 100644 --- a/drivers/platform/x86/intel/pmc/core.c +++ b/drivers/platform/x86/intel/pmc/core.c @@ -1912,6 +1912,7 @@ static const struct x86_cpu_id intel_pmc_core_ids[] = =3D { X86_MATCH_INTEL_FAM6_MODEL(ROCKETLAKE, &tgl_reg_map), X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE_L, &tgl_reg_map), X86_MATCH_INTEL_FAM6_MODEL(ALDERLAKE, &adl_reg_map), + X86_MATCH_INTEL_FAM6_MODEL(RAPTORLAKE_P, &tgl_reg_map), {} }; =20 --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A787AC43334 for ; Mon, 20 Jun 2022 12:58:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236244AbiFTM6P (ORCPT ); Mon, 20 Jun 2022 08:58:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243273AbiFTM5b (ORCPT ); Mon, 20 Jun 2022 08:57:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 402B31AD84; Mon, 20 Jun 2022 05:55: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 A9D7FB811B8; Mon, 20 Jun 2022 12:55:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9DFFC341C5; Mon, 20 Jun 2022 12:55:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729708; bh=auP6D/jWIaQ/Z7xaV4u7K4m5SlM2yD1KPaGjIjeAf0U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OTchcy8KvziMVJ5g+TSTGmtjsOolLP2tRity82AnU+aVkezK+19IXEg/iMiFYbvh9 +qTIkihebTsc2V13FVsV6MgIcEmqXu1BvdFc828LazqOdnLZHIrT8GctmzKQR8fzUn 7rwXjyGo4tImgWKI3Y7A0BQ+QXqQmnvaHs0+BeHE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Piotr Chmura , Hans de Goede , Sasha Levin Subject: [PATCH 5.18 049/141] platform/x86: gigabyte-wmi: Add Z690M AORUS ELITE AX DDR4 support Date: Mon, 20 Jun 2022 14:49:47 +0200 Message-Id: <20220620124730.984139414@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Piotr Chmura [ Upstream commit 8a041afe3e774bedd3e0a9b96f65e48a1299a595 ] Add dmi_system_id of Gigabyte Z690M AORUS ELITE AX DDR4 board. Tested on my PC. Signed-off-by: Piotr Chmura Link: https://lore.kernel.org/r/bd83567e-ebf5-0b31-074b-5f6dc7f7c147@gmail.= com Signed-off-by: Hans de Goede Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/platform/x86/gigabyte-wmi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/platform/x86/gigabyte-wmi.c b/drivers/platform/x86/gig= abyte-wmi.c index e87a931eab1e..05588a47ac38 100644 --- a/drivers/platform/x86/gigabyte-wmi.c +++ b/drivers/platform/x86/gigabyte-wmi.c @@ -154,6 +154,7 @@ static const struct dmi_system_id gigabyte_wmi_known_wo= rking_platforms[] =3D { DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("X570 GAMING X"), DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("X570 I AORUS PRO WIFI"), DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("X570 UD"), + DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("Z690M AORUS ELITE AX DDR4"), { } }; =20 --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2067CC43334 for ; Mon, 20 Jun 2022 12:57:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243525AbiFTM5k (ORCPT ); Mon, 20 Jun 2022 08:57:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243423AbiFTM5L (ORCPT ); Mon, 20 Jun 2022 08:57:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B60E1A825; Mon, 20 Jun 2022 05:55:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2874D614B7; Mon, 20 Jun 2022 12:55:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37EB9C3411B; Mon, 20 Jun 2022 12:55:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729711; bh=7NUMHzQlN+H4b3c+QV6ZaAVLc79YAd+yAe4WU2xah7I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ezTInej09ZDVm5czNvBle1CgVfXWjD1JaAd4XncaTvluoYLXB2xVm1rMi7rNhSSGi ofW1XM1BqKgLlz+RytYrmmOgehdq03nyk7YSj8dbmTey4cN8/Oeo8SAHaCXN2wHgSy rNPkzMeJg1JEy9vLIimcYG2+dZcMExakcHIOKHP4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, August Wikerfors , Hans de Goede , Sasha Levin Subject: [PATCH 5.18 050/141] platform/x86: gigabyte-wmi: Add support for B450M DS3H-CF Date: Mon, 20 Jun 2022 14:49:48 +0200 Message-Id: <20220620124731.013625484@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: August Wikerfors [ Upstream commit c6bc7e8ee90845556a90faf8b043cbefd77b8903 ] Tested and works on my system. Signed-off-by: August Wikerfors Link: https://lore.kernel.org/r/20220608212028.28307-1-git@augustwikerfors.= se Signed-off-by: Hans de Goede Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/platform/x86/gigabyte-wmi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/platform/x86/gigabyte-wmi.c b/drivers/platform/x86/gig= abyte-wmi.c index 05588a47ac38..78446b1953f7 100644 --- a/drivers/platform/x86/gigabyte-wmi.c +++ b/drivers/platform/x86/gigabyte-wmi.c @@ -140,6 +140,7 @@ static u8 gigabyte_wmi_detect_sensor_usability(struct w= mi_device *wdev) }} =20 static const struct dmi_system_id gigabyte_wmi_known_working_platforms[] = =3D { + DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B450M DS3H-CF"), DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B450M S2H V2"), DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550 AORUS ELITE AX V2"), DMI_EXACT_MATCH_GIGABYTE_BOARD_NAME("B550 AORUS ELITE"), --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E516C43334 for ; Mon, 20 Jun 2022 13:01:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242852AbiFTNB6 (ORCPT ); Mon, 20 Jun 2022 09:01:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243209AbiFTM5s (ORCPT ); Mon, 20 Jun 2022 08:57:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28F6419294; Mon, 20 Jun 2022 05:55:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9EED1B811A0; Mon, 20 Jun 2022 12:55:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFC60C3411B; Mon, 20 Jun 2022 12:55:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729714; bh=o4xZ5Na3RkwWIDOlYsfRkLahEYmnqPKWG46lPr0m57E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s97uI+Nv5mlVsE35GqlvdJfD5ARMgKdg4l0AXsK0ZNoEqB6C+c2SvfRbqaExsa8gS 1eHzhYDXbqJiIXU70GytL/wn2c4Nw18SVQViLWJn6iWYPbMQ6UX7DDf0OsMeXQ40/+ ZzTHGBDshsHl8Vc2ULLoxJysz9FoVUGSBJr9guio= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Duke Lee , Andy Shevchenko , Hans de Goede , Sasha Levin Subject: [PATCH 5.18 051/141] platform/x86/intel: hid: Add Surface Go to VGBS allow list Date: Mon, 20 Jun 2022 14:49:49 +0200 Message-Id: <20220620124731.043914458@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Duke Lee [ Upstream commit d4fe9cc4ff8656704b58cfd9363d7c3c9d65e519 ] The Surface Go reports Chassis Type 9 (Laptop,) so the device needs to be added to dmi_vgbs_allow_list to enable tablet mode when an attached Type Cover is folded back. BugLink: https://github.com/linux-surface/linux-surface/issues/837 Signed-off-by: Duke Lee Reviewed-by: Andy Shevchenko Link: https://lore.kernel.org/r/20220607213654.5567-1-krnhotwings@gmail.com Reviewed-by: Hans de Goede Signed-off-by: Hans de Goede Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/platform/x86/intel/hid.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/platform/x86/intel/hid.c b/drivers/platform/x86/intel/= hid.c index 216d31e3403d..79cff1fc675c 100644 --- a/drivers/platform/x86/intel/hid.c +++ b/drivers/platform/x86/intel/hid.c @@ -122,6 +122,12 @@ static const struct dmi_system_id dmi_vgbs_allow_list[= ] =3D { DMI_MATCH(DMI_PRODUCT_NAME, "HP Spectre x360 Convertible 15-df0xxx"), }, }, + { + .matches =3D { + DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"), + DMI_MATCH(DMI_PRODUCT_NAME, "Surface Go"), + }, + }, { } }; =20 --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1973CC43334 for ; Mon, 20 Jun 2022 13:02:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242696AbiFTNCF (ORCPT ); Mon, 20 Jun 2022 09:02:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243505AbiFTM5s (ORCPT ); Mon, 20 Jun 2022 08:57:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EA7A71AF1E; Mon, 20 Jun 2022 05:55:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 663E6B811A5; Mon, 20 Jun 2022 12:55:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0C72C3411B; Mon, 20 Jun 2022 12:55:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729717; bh=3xskMTnqAoA7ji7EWzaiuRyYBc2XRfwajg78zpssRZg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TXGbXBko07XMOj+SQ2I2RI35PWtHfjqelH4nZnJzFj95IP6rV/wT1/wkz4dyxS1D7 FiYziR1GY5U7crCgOyfj30sb2+pEeBRDhqx22v+jmmCd7xxe5eFyi4wkBYAu19QecW K89A6BgbjxFUrXHjcI3OoKUXefrqIG7yDWOQ1wBI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Phillip Potter , Sasha Levin Subject: [PATCH 5.18 052/141] staging: r8188eu: fix rtw_alloc_hwxmits error detection for now Date: Mon, 20 Jun 2022 14:49:50 +0200 Message-Id: <20220620124731.073717226@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Phillip Potter [ Upstream commit 5b7419ae1d208cab1e2826d473d8dab045aa75c7 ] In _rtw_init_xmit_priv, we use the res variable to store the error return from the newly converted rtw_alloc_hwxmits function. Sadly, the calling function interprets res using _SUCCESS and _FAIL still, meaning we change the semantics of the variable, even in the success case. This leads to the following on boot: r8188eu 1-2:1.0: _rtw_init_xmit_priv failed In the long term, we should reverse these semantics, but for now, this fixes the driver. Also, inside rtw_alloc_hwxmits remove the if blocks, as HWXMIT_ENTRY is always 4. Fixes: f94b47c6bde6 ("staging: r8188eu: add check for kzalloc") Signed-off-by: Phillip Potter Link: https://lore.kernel.org/r/20220521204741.921-1-phil@philpotter.co.uk Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/staging/r8188eu/core/rtw_xmit.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_xmit.c b/drivers/staging/r818= 8eu/core/rtw_xmit.c index 2ee92bbe66a0..ea5c88904961 100644 --- a/drivers/staging/r8188eu/core/rtw_xmit.c +++ b/drivers/staging/r8188eu/core/rtw_xmit.c @@ -178,8 +178,7 @@ s32 _rtw_init_xmit_priv(struct xmit_priv *pxmitpriv, st= ruct adapter *padapter) =20 pxmitpriv->free_xmit_extbuf_cnt =3D num_xmit_extbuf; =20 - res =3D rtw_alloc_hwxmits(padapter); - if (res) { + if (rtw_alloc_hwxmits(padapter)) { res =3D _FAIL; goto exit; } @@ -1492,19 +1491,10 @@ int rtw_alloc_hwxmits(struct adapter *padapter) =20 hwxmits =3D pxmitpriv->hwxmits; =20 - if (pxmitpriv->hwxmit_entry =3D=3D 5) { - hwxmits[0] .sta_queue =3D &pxmitpriv->bm_pending; - hwxmits[1] .sta_queue =3D &pxmitpriv->vo_pending; - hwxmits[2] .sta_queue =3D &pxmitpriv->vi_pending; - hwxmits[3] .sta_queue =3D &pxmitpriv->bk_pending; - hwxmits[4] .sta_queue =3D &pxmitpriv->be_pending; - } else if (pxmitpriv->hwxmit_entry =3D=3D 4) { - hwxmits[0] .sta_queue =3D &pxmitpriv->vo_pending; - hwxmits[1] .sta_queue =3D &pxmitpriv->vi_pending; - hwxmits[2] .sta_queue =3D &pxmitpriv->be_pending; - hwxmits[3] .sta_queue =3D &pxmitpriv->bk_pending; - } else { - } + hwxmits[0].sta_queue =3D &pxmitpriv->vo_pending; + hwxmits[1].sta_queue =3D &pxmitpriv->vi_pending; + hwxmits[2].sta_queue =3D &pxmitpriv->be_pending; + hwxmits[3].sta_queue =3D &pxmitpriv->bk_pending; =20 return 0; } --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F4A4C43334 for ; Mon, 20 Jun 2022 12:57:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243549AbiFTM5y (ORCPT ); Mon, 20 Jun 2022 08:57:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243272AbiFTM51 (ORCPT ); Mon, 20 Jun 2022 08:57:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FB1A1AD80; Mon, 20 Jun 2022 05:55:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 15756B811A3; Mon, 20 Jun 2022 12:55:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A853C3411B; Mon, 20 Jun 2022 12:55:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729719; bh=ZNITDWnOHqy+yw+B4Q7xomhpdap+YNYWvyjpMY0ed+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wcKgwUDt8DQ3wiX7lUOVfmeLXfx511V60ELivP5Kitb/UAjmgIuOpFNvT4gDjApna /DlcxMLv/vtiAy3t6c4paRXzSvil6lA7IRIFHas00KZnVIocEqLHgYIymR8QnD+k1t BAf8qjwnaRbagvq+2cGQEL2U1Ba7160vg+ctqs/8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Larry Finger , Phillip Potter , Dan Carpenter , Sasha Levin Subject: [PATCH 5.18 053/141] staging: r8188eu: Fix warning of array overflow in ioctl_linux.c Date: Mon, 20 Jun 2022 14:49:51 +0200 Message-Id: <20220620124731.104290428@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Larry Finger [ Upstream commit 96f0a54e8e65a765b3a4ad4b53751581f23279f3 ] Building with -Warray-bounds results in the following warning plus others related to the same problem: CC [M] drivers/staging/r8188eu/os_dep/ioctl_linux.o In function =E2=80=98wpa_set_encryption=E2=80=99, inlined from =E2=80=98rtw_wx_set_enc_ext=E2=80=99 at drivers/staging/r8= 188eu/os_dep/ioctl_linux.c:1868:9: drivers/staging/r8188eu/os_dep/ioctl_linux.c:412:41: warning: array subscri= pt =E2=80=98struct ndis_802_11_wep[0]=E2=80=99 is partly outside array boun= ds of =E2=80=98void[25]=E2=80=99 [-Warray-bounds] 412 | pwep->KeyLength =3D wep_key_len; | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~ In file included from drivers/staging/r8188eu/os_dep/../include/osdep_servi= ce.h:19, from drivers/staging/r8188eu/os_dep/ioctl_linux.c:4: In function =E2=80=98kmalloc=E2=80=99, inlined from =E2=80=98kzalloc=E2=80=99 at ./include/linux/slab.h:733:9, inlined from =E2=80=98wpa_set_encryption=E2=80=99 at drivers/staging/r8= 188eu/os_dep/ioctl_linux.c:408:11, inlined from =E2=80=98rtw_wx_set_enc_ext=E2=80=99 at drivers/staging/r8= 188eu/os_dep/ioctl_linux.c:1868:9: ./include/linux/slab.h:605:16: note: object of size [17, 25] allocated by = =E2=80=98__kmalloc=E2=80=99 605 | return __kmalloc(size, flags); | ^~~~~~~~~~~~~~~~~~~~~~ ./include/linux/slab.h:600:24: note: object of size [17, 25] allocated by = =E2=80=98kmem_cache_alloc_trace=E2=80=99 600 | return kmem_cache_alloc_trace( | ^~~~~~~~~~~~~~~~~~~~~~~ 601 | kmalloc_caches[kmalloc_type(flags)]= [index], | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~~~ 602 | flags, size); | ~~~~~~~~~~~~ Although it is unlikely that anyone is still using WEP encryption, the size of the allocation needs to be increased just in case. Fixes commit 2b42bd58b321 ("staging: r8188eu: introduce new os_dep dir for = RTL8188eu driver") Fixes: 2b42bd58b321 ("staging: r8188eu: introduce new os_dep dir for RTL818= 8eu driver") Signed-off-by: Larry Finger Cc: Phillip Potter Cc: Dan Carpenter Link: https://lore.kernel.org/r/20220531013103.2175-3-Larry.Finger@lwfinger= .net Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging= /r8188eu/os_dep/ioctl_linux.c index 60bd1cc2b3af..607c5e1eb320 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -404,7 +404,7 @@ static int wpa_set_encryption(struct net_device *dev, s= truct ieee_param *param, =20 if (wep_key_len > 0) { wep_key_len =3D wep_key_len <=3D 5 ? 5 : 13; - wep_total_len =3D wep_key_len + FIELD_OFFSET(struct ndis_802_11_wep, Ke= yMaterial); + wep_total_len =3D wep_key_len + sizeof(*pwep); pwep =3D kzalloc(wep_total_len, GFP_KERNEL); if (!pwep) goto exit; --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7E7DCC43334 for ; Mon, 20 Jun 2022 13:00:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243665AbiFTNAu (ORCPT ); Mon, 20 Jun 2022 09:00:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243565AbiFTM6W (ORCPT ); Mon, 20 Jun 2022 08:58:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46E4B1AF3A; Mon, 20 Jun 2022 05:55: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 C3189B811B9; Mon, 20 Jun 2022 12:55:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FF9AC3411B; Mon, 20 Jun 2022 12:55:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729722; bh=ytIKxNPMR/ON6qCoV4pdLutqzkT/aHVGjQyYP1RQHKs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=psQynmSRhAsrVqtesiSsBLZermF41CvbdSv5K5625d0LaSICReNZVZb71FkVP1bZc jp87PIjD0xCWRG+QTXdM6KVDKzyIqC+sKa8vK1cgONIRAdE6lh1KpVJhmQuCdIZ7RS PbqeJS0PfiKcdUpFOwl0u3/Ql81sMJ5ch0CTx/q0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust , Anna Schumaker , Sasha Levin Subject: [PATCH 5.18 054/141] pNFS: Dont keep retrying if the server replied NFS4ERR_LAYOUTUNAVAILABLE Date: Mon, 20 Jun 2022 14:49:52 +0200 Message-Id: <20220620124731.133200012@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Trond Myklebust [ Upstream commit fe44fb23d6ccde4c914c44ef74ab8d9d9ba02bea ] If the server tells us that a pNFS layout is not available for a specific file, then we should not keep pounding it with further layoutget requests. Fixes: 183d9e7b112a ("pnfs: rework LAYOUTGET retry handling") Signed-off-by: Trond Myklebust Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- fs/nfs/pnfs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 68a87be3e6f9..4609e641710e 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -2152,6 +2152,12 @@ pnfs_update_layout(struct inode *ino, case -ERECALLCONFLICT: case -EAGAIN: break; + case -ENODATA: + /* The server returned NFS4ERR_LAYOUTUNAVAILABLE */ + pnfs_layout_set_fail_bit( + lo, pnfs_iomode_to_fail_bit(iomode)); + lseg =3D NULL; + goto out_put_layout_hdr; default: if (!nfs_error_is_fatal(PTR_ERR(lseg))) { pnfs_layout_clear_fail_bit(lo, pnfs_iomode_to_fail_bit(iomode)); --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB8F4C43334 for ; Mon, 20 Jun 2022 13:01:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243971AbiFTNBr (ORCPT ); Mon, 20 Jun 2022 09:01:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243348AbiFTM5h (ORCPT ); Mon, 20 Jun 2022 08:57:37 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D440A1ADAC; Mon, 20 Jun 2022 05:55:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DE461614E8; Mon, 20 Jun 2022 12:55:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5483C3411B; Mon, 20 Jun 2022 12:55:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729726; bh=xKJgGnAp0JtvzVTO3ZMiIPxvPcxB/Pl0bxgrqj+nqCk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G6VnUSlQF925hJW1keRQYnpdDpFYCrHzVy7lD7dhJTlX2KUnzGTVNfA+UzOVUOfnh 8PUo1fKp4LZroqr0Z44OAkexaIa/B6/7H4B8l+I5ZDDc+/3WV9bISw46EBLaDaPgTI O1CG9ZkX02Gx1EVrxFSHSnQfXIfrg8688oQg80EU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust , Anna Schumaker , Sasha Levin Subject: [PATCH 5.18 055/141] pNFS: Avoid a live lock condition in pnfs_update_layout() Date: Mon, 20 Jun 2022 14:49:53 +0200 Message-Id: <20220620124731.162638823@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Trond Myklebust [ Upstream commit 880265c77ac415090090d1fe72a188fee71cb458 ] If we're about to send the first layoutget for an empty layout, we want to make sure that we drain out the existing pending layoutget calls first. The reason is that these layouts may have been already implicitly returned to the server by a recall to which the client gave a NFS4ERR_NOMATCHING_LAYOUT response. The problem is that wait_var_event_killable() could in principle see the plh_outstanding count go back to '1' when the first process to wake up starts sending a new layoutget. If it fails to get a layout, then this loop can continue ad infinitum... Fixes: 0b77f97a7e42 ("NFSv4/pnfs: Fix layoutget behaviour after invalidatio= n") Signed-off-by: Trond Myklebust Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- fs/nfs/callback_proc.c | 1 + fs/nfs/pnfs.c | 15 +++++++++------ fs/nfs/pnfs.h | 1 + 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c index c8520284dda7..c1eda73254e1 100644 --- a/fs/nfs/callback_proc.c +++ b/fs/nfs/callback_proc.c @@ -288,6 +288,7 @@ static u32 initiate_file_draining(struct nfs_client *cl= p, rv =3D NFS4_OK; break; case -ENOENT: + set_bit(NFS_LAYOUT_DRAIN, &lo->plh_flags); /* Embrace your forgetfulness! */ rv =3D NFS4ERR_NOMATCHING_LAYOUT; =20 diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c index 4609e641710e..41a9b6b58fb9 100644 --- a/fs/nfs/pnfs.c +++ b/fs/nfs/pnfs.c @@ -469,6 +469,7 @@ pnfs_mark_layout_stateid_invalid(struct pnfs_layout_hdr= *lo, pnfs_clear_lseg_state(lseg, lseg_list); pnfs_clear_layoutreturn_info(lo); pnfs_free_returned_lsegs(lo, lseg_list, &range, 0); + set_bit(NFS_LAYOUT_DRAIN, &lo->plh_flags); if (test_bit(NFS_LAYOUT_RETURN, &lo->plh_flags) && !test_and_set_bit(NFS_LAYOUT_RETURN_LOCK, &lo->plh_flags)) pnfs_clear_layoutreturn_waitbit(lo); @@ -1917,8 +1918,9 @@ static void nfs_layoutget_begin(struct pnfs_layout_hd= r *lo) =20 static void nfs_layoutget_end(struct pnfs_layout_hdr *lo) { - if (atomic_dec_and_test(&lo->plh_outstanding)) - wake_up_var(&lo->plh_outstanding); + if (atomic_dec_and_test(&lo->plh_outstanding) && + test_and_clear_bit(NFS_LAYOUT_DRAIN, &lo->plh_flags)) + wake_up_bit(&lo->plh_flags, NFS_LAYOUT_DRAIN); } =20 static bool pnfs_is_first_layoutget(struct pnfs_layout_hdr *lo) @@ -2025,11 +2027,11 @@ pnfs_update_layout(struct inode *ino, * If the layout segment list is empty, but there are outstanding * layoutget calls, then they might be subject to a layoutrecall. */ - if ((list_empty(&lo->plh_segs) || !pnfs_layout_is_valid(lo)) && + if (test_bit(NFS_LAYOUT_DRAIN, &lo->plh_flags) && atomic_read(&lo->plh_outstanding) !=3D 0) { spin_unlock(&ino->i_lock); - lseg =3D ERR_PTR(wait_var_event_killable(&lo->plh_outstanding, - !atomic_read(&lo->plh_outstanding))); + lseg =3D ERR_PTR(wait_on_bit(&lo->plh_flags, NFS_LAYOUT_DRAIN, + TASK_KILLABLE)); if (IS_ERR(lseg)) goto out_put_layout_hdr; pnfs_put_layout_hdr(lo); @@ -2413,7 +2415,8 @@ pnfs_layout_process(struct nfs4_layoutget *lgp) goto out_forget; } =20 - if (!pnfs_layout_is_valid(lo) && !pnfs_is_first_layoutget(lo)) + if (test_bit(NFS_LAYOUT_DRAIN, &lo->plh_flags) && + !pnfs_is_first_layoutget(lo)) goto out_forget; =20 if (nfs4_stateid_match_other(&lo->plh_stateid, &res->stateid)) { diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h index 07f11489e4e9..f331f067691b 100644 --- a/fs/nfs/pnfs.h +++ b/fs/nfs/pnfs.h @@ -105,6 +105,7 @@ enum { NFS_LAYOUT_FIRST_LAYOUTGET, /* Serialize first layoutget */ NFS_LAYOUT_INODE_FREEING, /* The inode is being freed */ NFS_LAYOUT_HASHED, /* The layout visible */ + NFS_LAYOUT_DRAIN, }; =20 enum layoutdriver_policy_flags { --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9F8DC433EF for ; Mon, 20 Jun 2022 13:01:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243898AbiFTNB4 (ORCPT ); Mon, 20 Jun 2022 09:01:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238387AbiFTM5r (ORCPT ); Mon, 20 Jun 2022 08:57:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF97A1AF16; Mon, 20 Jun 2022 05:55:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C8C76B811B3; Mon, 20 Jun 2022 12:55:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2645EC341C4; Mon, 20 Jun 2022 12:55:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729732; bh=YNWu+/GXQUo6nD402dR+q/FDYgLXdn3YWTkwGKNtjQo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zUnSa3DTcdlET0doZL0shE2eQIzWjfziKvvC3PkVc+YypdceDghDOXJ5tLYsksXhP 0ZV7sU0zWG+qyn6bZEf/kB/OEwAW70AYKb9UfrZGAIOBCHy6J65XTnD3n8L2n/vAND VNyVtXM859x9NZQh5HSeyv2Lv/cGocilhWYb16bU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Scott Mayhew , Anna Schumaker , Sasha Levin Subject: [PATCH 5.18 056/141] sunrpc: set cl_max_connect when cloning an rpc_clnt Date: Mon, 20 Jun 2022 14:49:54 +0200 Message-Id: <20220620124731.192061123@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Scott Mayhew [ Upstream commit 304791255a2dc1c9be7e7c8a6cbdb31b6847b0e5 ] If the initial attempt at trunking detection using the krb5i auth flavor fails with -EACCES, -NFS4ERR_CLID_INUSE, or -NFS4ERR_WRONGSEC, then the NFS client tries again using auth_sys, cloning the rpc_clnt in the process. If this second attempt at trunking detection succeeds, then the resulting nfs_client->cl_rpcclient winds up having cl_max_connect=3D0 and subsequent attempts to add additional transport connections to the rpc_clnt will fail with a message similar to the following being logged: [502044.312640] SUNRPC: reached max allowed number (0) did not add transport to server: 192.168.122.3 Signed-off-by: Scott Mayhew Fixes: dc48e0abee24 ("SUNRPC enforce creation of no more than max_connect x= prts") Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- net/sunrpc/clnt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index e2c6eca0271b..b6781ada3aa8 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -651,6 +651,7 @@ static struct rpc_clnt *__rpc_clone_client(struct rpc_c= reate_args *args, new->cl_discrtry =3D clnt->cl_discrtry; new->cl_chatty =3D clnt->cl_chatty; new->cl_principal =3D clnt->cl_principal; + new->cl_max_connect =3D clnt->cl_max_connect; return new; =20 out_err: --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28B58CCA47C for ; Mon, 20 Jun 2022 13:00:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243575AbiFTNA0 (ORCPT ); Mon, 20 Jun 2022 09:00:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243657AbiFTM62 (ORCPT ); Mon, 20 Jun 2022 08:58:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17B7E1B79D; Mon, 20 Jun 2022 05:55:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A10A3B811BF; Mon, 20 Jun 2022 12:55:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EBA15C3411B; Mon, 20 Jun 2022 12:55:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729735; bh=ZDUqt44bbeOu9tG6SfC5lmwbRy4fFSZTfMu/NpoAug8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jtCq5lXGjl27FrCGi6L2oqTom5z/exd0QNvTX+X18/4kKr9rFY6e0dvCX7U8BqZ64 xA1zeUJ3uf0zGEIv+KOUI8i3onrpT1uKGOZcweEYrY7rAP/Q3y8JWNmdOA4KPmLSqV k6tlQE5codJ1kFIW0ZokZ2HZtMzPx5uem7y33GG8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephen Rothwell , Masahiro Yamada , Vitaly Kuznetsov , Michael Kelley , Wei Liu , Sasha Levin Subject: [PATCH 5.18 057/141] clocksource: hyper-v: unexport __init-annotated hv_init_clocksource() Date: Mon, 20 Jun 2022 14:49:55 +0200 Message-Id: <20220620124731.222892274@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Masahiro Yamada [ Upstream commit 245b993d8f6c4e25f19191edfbd8080b645e12b1 ] EXPORT_SYMBOL and __init is a bad combination because the .init.text section is freed up after the initialization. Hence, modules cannot use symbols annotated __init. The access to a freed symbol may end up with kernel panic. modpost used to detect it, but it has been broken for a decade. Recently, I fixed modpost so it started to warn it again, then this showed up in linux-next builds. There are two ways to fix it: - Remove __init - Remove EXPORT_SYMBOL I chose the latter for this case because the only in-tree call-site, arch/x86/kernel/cpu/mshyperv.c is never compiled as modular. (CONFIG_HYPERVISOR_GUEST is boolean) Fixes: dd2cb348613b ("clocksource/drivers: Continue making Hyper-V clocksou= rce ISA agnostic") Reported-by: Stephen Rothwell Signed-off-by: Masahiro Yamada Reviewed-by: Vitaly Kuznetsov Reviewed-by: Michael Kelley Link: https://lore.kernel.org/r/20220606050238.4162200-1-masahiroy@kernel.o= rg Signed-off-by: Wei Liu Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/clocksource/hyperv_timer.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/clocksource/hyperv_timer.c b/drivers/clocksource/hyper= v_timer.c index ff188ab68496..bb47610bbd1c 100644 --- a/drivers/clocksource/hyperv_timer.c +++ b/drivers/clocksource/hyperv_timer.c @@ -565,4 +565,3 @@ void __init hv_init_clocksource(void) hv_sched_clock_offset =3D hv_read_reference_counter(); hv_setup_sched_clock(read_hv_sched_clock_msr); } -EXPORT_SYMBOL_GPL(hv_init_clocksource); --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0ABAEC433EF for ; Mon, 20 Jun 2022 13:00:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238694AbiFTNAz (ORCPT ); Mon, 20 Jun 2022 09:00:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243701AbiFTM6b (ORCPT ); Mon, 20 Jun 2022 08:58:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BDEF1B7AA; Mon, 20 Jun 2022 05:55:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9D73BB811A9; Mon, 20 Jun 2022 12:55:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0904C3411B; Mon, 20 Jun 2022 12:55:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729738; bh=1UGWyHsgoE8E5WlvbcwhMzAmuODbM36nWvBTLQ2IXR8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YJwbQ6JWyBRggKEkkkQgdFJanhfFYmxF3BihHg0CCYbZm649VL4WxsLu0i0ksR68W F+UiMQIgXLKn7PJMQAz2ah+160RA0OhrPFnnOkmS3fI61bQIhFhHG6JBdS3pLtQ9Ft FeyISBfX9RUcS61fjVh4nsZ33sDTEjkOk1iL3kaU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Grzegorz Szczurek , Jedrzej Jagielski , Bharathi Sreenivas , Tony Nguyen , Sasha Levin Subject: [PATCH 5.18 058/141] i40e: Fix adding ADQ filter to TC0 Date: Mon, 20 Jun 2022 14:49:56 +0200 Message-Id: <20220620124731.252175025@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Grzegorz Szczurek [ Upstream commit c3238d36c3a2be0a29a9d848d6c51e1b14be6692 ] Procedure of configure tc flower filters erroneously allows to create filters on TC0 where unfiltered packets are also directed by default. Issue was caused by insufficient checks of hw_tc parameter specifying the hardware traffic class to pass matching packets to. Fix checking hw_tc parameter which blocks creation of filters on TC0. Fixes: 2f4b411a3d67 ("i40e: Enable cloud filters via tc-flower") Signed-off-by: Grzegorz Szczurek Signed-off-by: Jedrzej Jagielski Tested-by: Bharathi Sreenivas Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/intel/i40e/i40e_main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethe= rnet/intel/i40e/i40e_main.c index 98871f014994..46bb1169a004 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_main.c +++ b/drivers/net/ethernet/intel/i40e/i40e_main.c @@ -8537,6 +8537,11 @@ static int i40e_configure_clsflower(struct i40e_vsi = *vsi, return -EOPNOTSUPP; } =20 + if (!tc) { + dev_err(&pf->pdev->dev, "Unable to add filter because of invalid destina= tion"); + return -EINVAL; + } + if (test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state) || test_bit(__I40E_RESET_INTR_RECEIVED, pf->state)) return -EBUSY; --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CBC6C43334 for ; Mon, 20 Jun 2022 13:00:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243646AbiFTNAr (ORCPT ); Mon, 20 Jun 2022 09:00:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243710AbiFTM6c (ORCPT ); Mon, 20 Jun 2022 08:58:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9065E1B7B7; Mon, 20 Jun 2022 05:55:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E0542614E8; Mon, 20 Jun 2022 12:55:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F191BC3411B; Mon, 20 Jun 2022 12:55:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729741; bh=gtE2dNF9bLFouJJ01VSMIAbH3vpPiagTMoot2XNi7x4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zZCzV5v1Oe6CmWW348NSn0GlQUWj/5ocAvd0ShqS+jf/Yj1WR293B4vpwMzjW5Ahs yycshbvo6kEQGVkMv1iQLszYMFL79JaU75XvUdQoD/NSeq6iaAexvKGMGgJytcVxJw 9Ae8oTIaoWFqx0q4BD0U2LPVWb60lq3gNaNLgr3s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Grzegorz Szczurek , Jedrzej Jagielski , Bharathi Sreenivas , Tony Nguyen , Sasha Levin Subject: [PATCH 5.18 059/141] i40e: Fix calculating the number of queue pairs Date: Mon, 20 Jun 2022 14:49:57 +0200 Message-Id: <20220620124731.282138032@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Grzegorz Szczurek [ Upstream commit 0bb050670ac90a167ecfa3f9590f92966c9a3677 ] If ADQ is enabled for a VF, then actual number of queue pair is a number of currently available traffic classes for this VF. Without this change the configuration of the Rx/Tx queues fails with error. Fixes: d29e0d233e0d ("i40e: missing input validation on VF message handling= by the PF") Signed-off-by: Grzegorz Szczurek Signed-off-by: Jedrzej Jagielski Tested-by: Bharathi Sreenivas Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/n= et/ethernet/intel/i40e/i40e_virtchnl_pf.c index 2606e8f0f19b..033ea71763e3 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c @@ -2282,7 +2282,7 @@ static int i40e_vc_config_queues_msg(struct i40e_vf *= vf, u8 *msg) } =20 if (vf->adq_enabled) { - for (i =3D 0; i < I40E_MAX_VF_VSI; i++) + for (i =3D 0; i < vf->num_tc; i++) num_qps_all +=3D vf->ch[i].num_qps; if (num_qps_all !=3D qci->num_queue_pairs) { aq_ret =3D I40E_ERR_PARAM; --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 12DC5C433EF for ; Mon, 20 Jun 2022 13:01:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243807AbiFTNBI (ORCPT ); Mon, 20 Jun 2022 09:01:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243673AbiFTM62 (ORCPT ); Mon, 20 Jun 2022 08:58:28 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01356193CB; Mon, 20 Jun 2022 05:55:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 644C3B811AC; Mon, 20 Jun 2022 12:55:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC0E7C3411B; Mon, 20 Jun 2022 12:55:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729744; bh=PCNgaEBVRKBmezcn+MpndPZjURty+KU0BWVj3KL5+4Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=biIL677foJ2TVZyRUg7eN0rNqZptOgyldhUNRZUjKOu2HgGpNjC7mVyFvSSXUShP6 hXDgrM9WLsSLYWVXdT+YEOCWoNQqbeI5sdAx/R/ZOLBvHpKRzc8X50rSSzUUXQ2pnh 9D684JDLSbRwt2kDKLxX9AJDu67iqn0EpEgHV7jw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Jaron , Aleksandr Loktionov , Tony Nguyen , Sasha Levin , Gurucharan Subject: [PATCH 5.18 060/141] i40e: Fix call trace in setup_tx_descriptors Date: Mon, 20 Jun 2022 14:49:58 +0200 Message-Id: <20220620124731.312906413@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Aleksandr Loktionov [ Upstream commit fd5855e6b1358e816710afee68a1d2bc685176ca ] After PF reset and ethtool -t there was call trace in dmesg sometimes leading to panic. When there was some time, around 5 seconds, between reset and test there were no errors. Problem was that pf reset calls i40e_vsi_close in prep_for_reset and ethtool -t calls i40e_vsi_close in diag_test. If there was not enough time between those commands the second i40e_vsi_close starts before previous i40e_vsi_close was done which leads to crash. Add check to diag_test if pf is in reset and don't start offline tests if it is true. Add netif_info("testing failed") into unhappy path of i40e_diag_test() Fixes: e17bc411aea8 ("i40e: Disable offline diagnostics if VFs are enabled") Fixes: 510efb2682b3 ("i40e: Fix ethtool offline diagnostic with netqueues") Signed-off-by: Michal Jaron Signed-off-by: Aleksandr Loktionov Tested-by: Gurucharan (A Contingent worker at Int= el) Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- .../net/ethernet/intel/i40e/i40e_ethtool.c | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/e= thernet/intel/i40e/i40e_ethtool.c index e48499624d22..06c05a6b8b71 100644 --- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c +++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c @@ -2584,15 +2584,16 @@ static void i40e_diag_test(struct net_device *netde= v, =20 set_bit(__I40E_TESTING, pf->state); =20 + if (test_bit(__I40E_RESET_RECOVERY_PENDING, pf->state) || + test_bit(__I40E_RESET_INTR_RECEIVED, pf->state)) { + dev_warn(&pf->pdev->dev, + "Cannot start offline testing when PF is in reset state.\n"); + goto skip_ol_tests; + } + if (i40e_active_vfs(pf) || i40e_active_vmdqs(pf)) { dev_warn(&pf->pdev->dev, "Please take active VFs and Netqueues offline and restart the adapter= before running NIC diagnostics\n"); - data[I40E_ETH_TEST_REG] =3D 1; - data[I40E_ETH_TEST_EEPROM] =3D 1; - data[I40E_ETH_TEST_INTR] =3D 1; - data[I40E_ETH_TEST_LINK] =3D 1; - eth_test->flags |=3D ETH_TEST_FL_FAILED; - clear_bit(__I40E_TESTING, pf->state); goto skip_ol_tests; } =20 @@ -2639,9 +2640,17 @@ static void i40e_diag_test(struct net_device *netdev, data[I40E_ETH_TEST_INTR] =3D 0; } =20 -skip_ol_tests: - netif_info(pf, drv, netdev, "testing finished\n"); + return; + +skip_ol_tests: + data[I40E_ETH_TEST_REG] =3D 1; + data[I40E_ETH_TEST_EEPROM] =3D 1; + data[I40E_ETH_TEST_INTR] =3D 1; + data[I40E_ETH_TEST_LINK] =3D 1; + eth_test->flags |=3D ETH_TEST_FL_FAILED; + clear_bit(__I40E_TESTING, pf->state); + netif_info(pf, drv, netdev, "testing failed\n"); } =20 static void i40e_get_wol(struct net_device *netdev, --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C71BC433EF for ; Mon, 20 Jun 2022 13:01:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243829AbiFTNBN (ORCPT ); Mon, 20 Jun 2022 09:01:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38830 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243792AbiFTM6k (ORCPT ); Mon, 20 Jun 2022 08:58:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 767731BE91; Mon, 20 Jun 2022 05:55:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 89921B811A0; Mon, 20 Jun 2022 12:55:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2C11C3411B; Mon, 20 Jun 2022 12:55:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729747; bh=yIYtRfu76ISBMbAAz5Ej0mo7PqRgJKMWfOg+qBi6yK4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TO3a5E+X8RajqRY3xtDyzubb2eydYJ/cvIyBV2p2N32Le0QDxlGu/VtmLcgU0viFm 3glHzIxvwB0376czP4lJQ/U+e9GGGSEAxR1m05ftQCsie2nImMe1fE2XlE4MOCSOgo a4V09AcB3icoz5jQRxPNC5du15HoDIiIGBl408s4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Wilczynski , Maciej Fijalkowski , Konrad Jankowski , Tony Nguyen , Sasha Levin Subject: [PATCH 5.18 061/141] iavf: Fix issue with MAC address of VF shown as zero Date: Mon, 20 Jun 2022 14:49:59 +0200 Message-Id: <20220620124731.343986611@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michal Wilczynski [ Upstream commit 645603844270b69175899268be68b871295764fe ] After reinitialization of iavf, ice driver gets VIRTCHNL_OP_ADD_ETH_ADDR message with incorrectly set type of MAC address. Hardware address should have is_primary flag set as true. This way ice driver knows what it has to set as a MAC address. Check if the address is primary in iavf_add_filter function and set flag accordingly. To test set all-zero MAC on a VF. This triggers iavf re-initialization and VIRTCHNL_OP_ADD_ETH_ADDR message gets sent to PF. For example: ip link set dev ens785 vf 0 mac 00:00:00:00:00:00 This triggers re-initialization of iavf. New MAC should be assigned. Now check if MAC is non-zero: ip link show dev ens785 Fixes: a3e839d539e0 ("iavf: Add usage of new virtchnl format to set default= MAC") Signed-off-by: Michal Wilczynski Reviewed-by: Maciej Fijalkowski Tested-by: Konrad Jankowski Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/intel/iavf/iavf_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethe= rnet/intel/iavf/iavf_main.c index 7dfcf78b57fb..f3ecb3bca33d 100644 --- a/drivers/net/ethernet/intel/iavf/iavf_main.c +++ b/drivers/net/ethernet/intel/iavf/iavf_main.c @@ -984,7 +984,7 @@ struct iavf_mac_filter *iavf_add_filter(struct iavf_ada= pter *adapter, list_add_tail(&f->list, &adapter->mac_filter_list); f->add =3D true; f->is_new_mac =3D true; - f->is_primary =3D false; + f->is_primary =3D ether_addr_equal(macaddr, adapter->hw.mac.addr); adapter->aq_required |=3D IAVF_FLAG_AQ_ADD_MAC_FILTER; } else { f->remove =3D false; --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D3CBC43334 for ; Mon, 20 Jun 2022 13:01:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242786AbiFTNB2 (ORCPT ); Mon, 20 Jun 2022 09:01:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243966AbiFTM7J (ORCPT ); Mon, 20 Jun 2022 08:59:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44AE11C10B; Mon, 20 Jun 2022 05:56: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 379A0B811A3; Mon, 20 Jun 2022 12:55:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75A11C3411B; Mon, 20 Jun 2022 12:55:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729751; bh=BxlpKTalVEkBk0tBaPAm8eqtVfisQ6VMPRChsYYOfaU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mclWt2A5SsWdPkKTMW1iBu5n49IfqAixFqVZe/9baUXnoJZEZd9yOSX0fEFMQmanN X3dQoyCLXmVVEhB9PQAnu/CSWiM9YvgDtWMZxZovd7KYG1Of6djzL0Xs1OEumqTm67 2pf3zAinnEpzkvlRMi5t+RfoYBdPvCsfNal/Nxlo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Saurabh Sengar , Michael Kelley , Wei Liu , Sasha Levin Subject: [PATCH 5.18 062/141] Drivers: hv: vmbus: Release cpu lock in error case Date: Mon, 20 Jun 2022 14:50:00 +0200 Message-Id: <20220620124731.373333892@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Saurabh Sengar [ Upstream commit 656c5ba50b7172a0ea25dc1b37606bd51d01fe8d ] In case of invalid sub channel, release cpu lock before returning. Fixes: a949e86c0d780 ("Drivers: hv: vmbus: Resolve race between init_vp_ind= ex() and CPU hotplug") Signed-off-by: Saurabh Sengar Reviewed-by: Michael Kelley Link: https://lore.kernel.org/r/1654794996-13244-1-git-send-email-ssengar@l= inux.microsoft.com Signed-off-by: Wei Liu Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/hv/channel_mgmt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index 85a2142c9384..073ff9b6f535 100644 --- a/drivers/hv/channel_mgmt.c +++ b/drivers/hv/channel_mgmt.c @@ -637,6 +637,7 @@ static void vmbus_process_offer(struct vmbus_channel *n= ewchannel) */ if (newchannel->offermsg.offer.sub_channel_index =3D=3D 0) { mutex_unlock(&vmbus_connection.channel_mutex); + cpus_read_unlock(); /* * Don't call free_channel(), because newchannel->kobj * is not initialized yet. --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3ED5FC433EF for ; Mon, 20 Jun 2022 13:01:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243167AbiFTNBV (ORCPT ); Mon, 20 Jun 2022 09:01:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243905AbiFTM7E (ORCPT ); Mon, 20 Jun 2022 08:59:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D4D71BEB8; Mon, 20 Jun 2022 05:56:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 613C2B811B8; Mon, 20 Jun 2022 12:55:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6BBEC3411B; Mon, 20 Jun 2022 12:55:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729754; bh=0fY06b4THzUd2GA+Mqdw6njwqGawpw9ywsBP6EmQI90=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IhbeiPwON+kwX7BfWkoUBGmewChiINRdTIgV1q4aqgJBJiAGvpivvas5S2Sp/OBlc y0t9RgQOLZnMtjJLo/HmxQqixQMlfpCaD2eI4b495kZHFA/I9DwlJiB8pL7JO2be27 YHyxdNjqDYB4xqlo5VrB2t/l+7m+Mc0YovXDOWUU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vincent Whitchurch , Sasha Levin Subject: [PATCH 5.18 063/141] tty: goldfish: Fix free_irq() on remove Date: Mon, 20 Jun 2022 14:50:01 +0200 Message-Id: <20220620124731.401412742@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Vincent Whitchurch [ Upstream commit 499e13aac6c762e1e828172b0f0f5275651d6512 ] Pass the correct dev_id to free_irq() to fix this splat when the driver is unbound: WARNING: CPU: 0 PID: 30 at kernel/irq/manage.c:1895 free_irq Trying to free already-free IRQ 65 Call Trace: warn_slowpath_fmt free_irq goldfish_tty_remove platform_remove device_remove device_release_driver_internal device_driver_detach unbind_store drv_attr_store ... Fixes: 465893e18878e119 ("tty: goldfish: support platform_device with id -1= ") Signed-off-by: Vincent Whitchurch Link: https://lore.kernel.org/r/20220609141704.1080024-1-vincent.whitchurch= @axis.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/tty/goldfish.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/tty/goldfish.c b/drivers/tty/goldfish.c index c7968aecd870..d02de3f0326f 100644 --- a/drivers/tty/goldfish.c +++ b/drivers/tty/goldfish.c @@ -426,7 +426,7 @@ static int goldfish_tty_remove(struct platform_device *= pdev) tty_unregister_device(goldfish_tty_driver, qtty->console.index); iounmap(qtty->base); qtty->base =3D NULL; - free_irq(qtty->irq, pdev); + free_irq(qtty->irq, qtty); tty_port_destroy(&qtty->port); goldfish_tty_current_line_count--; if (goldfish_tty_current_line_count =3D=3D 0) --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDCF4C43334 for ; Mon, 20 Jun 2022 13:01:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242368AbiFTNBd (ORCPT ); Mon, 20 Jun 2022 09:01:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244017AbiFTM7L (ORCPT ); Mon, 20 Jun 2022 08:59:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCC5619C15; Mon, 20 Jun 2022 05:56:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 852E1614DA; Mon, 20 Jun 2022 12:55:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9A2E2C3411C; Mon, 20 Jun 2022 12:55:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729757; bh=G9sVT9BCC2t1SfzLQZXZjkGeZ3YE+zHFK85LE1yWtJo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f7erjJ7yy4VvjSivh6EkI2e2uduepLfkVic9nzOFkdTIVueULvaIpSgPY+BlLe5n7 n6d0vqn0SHtXM0rXGfJDYS4QPkUhi1jpR1m8T04YrPlkeuj4RKISajPKtNsEsR4IBA 2wrkpM9CDOl1nlQbH2m6iYMqtFnhbKlsPFdOCnKI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Claudiu Beznea , Miaoqian Lin , Sasha Levin Subject: [PATCH 5.18 064/141] misc: atmel-ssc: Fix IRQ check in ssc_probe Date: Mon, 20 Jun 2022 14:50:02 +0200 Message-Id: <20220620124731.431779966@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 1c245358ce0b13669f6d1625f7a4e05c41f28980 ] platform_get_irq() returns negative error number instead 0 on failure. And the doc of platform_get_irq() provides a usage example: int irq =3D platform_get_irq(pdev, 0); if (irq < 0) return irq; Fix the check of return value to catch errors correctly. Fixes: eb1f2930609b ("Driver for the Atmel on-chip SSC on AT32AP and AT91") Reviewed-by: Claudiu Beznea Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220601123026.7119-1-linmq006@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/misc/atmel-ssc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c index d6cd5537126c..69f9b0336410 100644 --- a/drivers/misc/atmel-ssc.c +++ b/drivers/misc/atmel-ssc.c @@ -232,9 +232,9 @@ static int ssc_probe(struct platform_device *pdev) clk_disable_unprepare(ssc->clk); =20 ssc->irq =3D platform_get_irq(pdev, 0); - if (!ssc->irq) { + if (ssc->irq < 0) { dev_dbg(&pdev->dev, "could not get irq\n"); - return -ENXIO; + return ssc->irq; } =20 mutex_lock(&user_lock); --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65FB5C43334 for ; Mon, 20 Jun 2022 13:01:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243679AbiFTNBo (ORCPT ); Mon, 20 Jun 2022 09:01:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244046AbiFTM7N (ORCPT ); Mon, 20 Jun 2022 08:59:13 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B2BA1C126; Mon, 20 Jun 2022 05:56:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 36BD8B811BD; Mon, 20 Jun 2022 12:56:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 972E0C3411B; Mon, 20 Jun 2022 12:55:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729760; bh=sOZBAWivpOdaJB97LH1wnMTFxhDL3WcJmZwd5LtZD4A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YcuUflVzI3njIFWc7EJm2sYFDb2s2MWZudcHD94VT8IogvPG+i4KmMx187Lhz3MAB lHi7XKyHOqxP94BR2hmmBePdYSD3rQNZylUFYspDYfOdAyV+yOWAOIgFeqvZgEBehb fNpcRYN3jlJJgxf7frjUYpcUQMyb+LKUafukLWA4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Conor Dooley , Sasha Levin Subject: [PATCH 5.18 065/141] riscv: dts: microchip: re-add pdma to mpfs device tree Date: Mon, 20 Jun 2022 14:50:03 +0200 Message-Id: <20220620124731.461595614@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Conor Dooley [ Upstream commit 5e757deddd918edb8cb2fdb56eb79656ffc6dade ] PolarFire SoC /does/ have a SiFive pdma, despite what I suggested as a conflict resolution to Zong. Somehow the entry fell through the cracks between versions of my dt patches, so re-add it with Zong's updated compatible & dma-channels property. Fixes: c5094f371008 ("riscv: dts: microchip: refactor icicle kit device tre= e") Signed-off-by: Conor Dooley Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/riscv/boot/dts/microchip/microchip-mpfs.dtsi | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/riscv/boot/dts/microchip/microchip-mpfs.dtsi b/arch/riscv= /boot/dts/microchip/microchip-mpfs.dtsi index cf2f55e1dcb6..f44fce1fe080 100644 --- a/arch/riscv/boot/dts/microchip/microchip-mpfs.dtsi +++ b/arch/riscv/boot/dts/microchip/microchip-mpfs.dtsi @@ -188,6 +188,15 @@ riscv,ndev =3D <186>; }; =20 + pdma: dma-controller@3000000 { + compatible =3D "sifive,fu540-c000-pdma", "sifive,pdma0"; + reg =3D <0x0 0x3000000 0x0 0x8000>; + interrupt-parent =3D <&plic>; + interrupts =3D <5 6>, <7 8>, <9 10>, <11 12>; + dma-channels =3D <4>; + #dma-cells =3D <1>; + }; + clkcfg: clkcfg@20002000 { compatible =3D "microchip,mpfs-clkcfg"; reg =3D <0x0 0x20002000 0x0 0x1000>, <0x0 0x3E001000 0x0 0x1000>; --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8CC10C43334 for ; Mon, 20 Jun 2022 13:01:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243895AbiFTNB0 (ORCPT ); Mon, 20 Jun 2022 09:01:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243958AbiFTM7I (ORCPT ); Mon, 20 Jun 2022 08:59:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74CDB1BE80; Mon, 20 Jun 2022 05:56:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5D1B561524; Mon, 20 Jun 2022 12:56:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50AE8C3411B; Mon, 20 Jun 2022 12:56:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729766; bh=AAKjTYTHTzBZLCi9DHNHmED5xxkxD9PHoX1a1KXhIbw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n7yxyw7I1PNC6nIuOphPtNgNOEfUva3xeux7QT/TCvc0LVe3Mn9ZD4MCRcmcgPdhf 1/cU9LFqtRn6HaJsbBvMwA+Oc/bzp6no1pVK8w2sGfYHmEc0ASGV8ez1ANjHQucVP0 Vu8VRZRsSvCuhN/NkNFe+bBacqaAAPSXC13N2CPk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Begunkov , Sasha Levin , van fantasy Subject: [PATCH 5.18 066/141] io_uring: fix races with file table unregister Date: Mon, 20 Jun 2022 14:50:04 +0200 Message-Id: <20220620124731.491373962@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pavel Begunkov [ Upstream commit b0380bf6dad4601d92025841e2b7a135d566c6e3 ] Fixed file table quiesce might unlock ->uring_lock, potentially letting new requests to be submitted, don't allow those requests to use the table as they will race with unregistration. Reported-and-tested-by: van fantasy Fixes: 05f3fb3c53975 ("io_uring: avoid ring quiesce for fixed file set unre= gister and update") Signed-off-by: Pavel Begunkov Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- fs/io_uring.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fs/io_uring.c b/fs/io_uring.c index 3582db014aad..0a9f9000fc80 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -8508,11 +8508,19 @@ static void __io_sqe_files_unregister(struct io_rin= g_ctx *ctx) =20 static int io_sqe_files_unregister(struct io_ring_ctx *ctx) { + unsigned nr =3D ctx->nr_user_files; int ret; =20 if (!ctx->file_data) return -ENXIO; + + /* + * Quiesce may unlock ->uring_lock, and while it's not held + * prevent new requests using the table. + */ + ctx->nr_user_files =3D 0; ret =3D io_rsrc_ref_quiesce(ctx->file_data, ctx); + ctx->nr_user_files =3D nr; if (!ret) __io_sqe_files_unregister(ctx); return ret; --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8467CCCA479 for ; Mon, 20 Jun 2022 13:00:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243504AbiFTNAT (ORCPT ); Mon, 20 Jun 2022 09:00:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244080AbiFTM7O (ORCPT ); Mon, 20 Jun 2022 08:59:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F147C183A7; Mon, 20 Jun 2022 05:56:16 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 16F0AB811A6; Mon, 20 Jun 2022 12:56:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 62DC9C3411B; Mon, 20 Jun 2022 12:56:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729769; bh=wW0qIChg5DhZAZiynCS13PgfmFZjwtltvi+ebPMRs+Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BnvP7rEBk53BAVCI/P0Hd3Wr5y/sAeUUFV1ZMfW5DmFYS8oz2Lx9Qkk7LmTn7IAVu 3QX+INAEORNgN1Jvfojbf3aXZEiTWveGecQtLsLmr5Eq82DM3eFg5izbzawGrWBy8T UBFMHKdaJvEmTW3KyPIHDNpv7qLOczKH9u4G0Nz8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pavel Begunkov , Sasha Levin , van fantasy Subject: [PATCH 5.18 067/141] io_uring: fix races with buffer table unregister Date: Mon, 20 Jun 2022 14:50:05 +0200 Message-Id: <20220620124731.519623762@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Pavel Begunkov [ Upstream commit d11d31fc5d8a96f707facee0babdcffaafa38de2 ] Fixed buffer table quiesce might unlock ->uring_lock, potentially letting new requests to be submitted, don't allow those requests to use the table as they will race with unregistration. Reported-and-tested-by: van fantasy Fixes: bd54b6fe3316ec ("io_uring: implement fixed buffers registration simi= lar to fixed files") Signed-off-by: Pavel Begunkov Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- fs/io_uring.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/io_uring.c b/fs/io_uring.c index 0a9f9000fc80..3d123ca028c9 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c @@ -9495,12 +9495,19 @@ static void __io_sqe_buffers_unregister(struct io_r= ing_ctx *ctx) =20 static int io_sqe_buffers_unregister(struct io_ring_ctx *ctx) { + unsigned nr =3D ctx->nr_user_bufs; int ret; =20 if (!ctx->buf_data) return -ENXIO; =20 + /* + * Quiesce may unlock ->uring_lock, and while it's not held + * prevent new requests using the table. + */ + ctx->nr_user_bufs =3D 0; ret =3D io_rsrc_ref_quiesce(ctx->buf_data, ctx); + ctx->nr_user_bufs =3D nr; if (!ret) __io_sqe_buffers_unregister(ctx); return ret; --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92605C433EF for ; Mon, 20 Jun 2022 13:00:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243401AbiFTNAQ (ORCPT ); Mon, 20 Jun 2022 09:00:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244053AbiFTM7N (ORCPT ); Mon, 20 Jun 2022 08:59:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45E631C12A; Mon, 20 Jun 2022 05:56:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9107D614F4; Mon, 20 Jun 2022 12:56:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7329DC3411B; Mon, 20 Jun 2022 12:56:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729772; bh=34I+pPxbCyhoKi8p4ISZNO/ykA+6Oja4LB85YqEVgp8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WDWmrdIu8Y/da3+ks31duVo49LjcsDRMZWuDHalqz4i9kilP3v33K09C5RkbfTq9q LtdcBGxuQt8kew0WaXzROO5FrLFKfbdn89olQ9Ke3HbL0u/d0DaakZlCfshH3sH3AT 9J9tas9WNYSDZUrdto5qw89g+x1UFgPSKAAjWJFA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Previn , John Harrison , Jani Nikula , Sasha Levin Subject: [PATCH 5.18 068/141] drm/i915/reset: Fix error_state_read ptr + offset use Date: Mon, 20 Jun 2022 14:50:06 +0200 Message-Id: <20220620124731.548292058@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alan Previn [ Upstream commit c9b576d0c7bf55aeae1a736da7974fa202c4394d ] Fix our pointer offset usage in error_state_read when there is no i915_gpu_coredump but buf offset is non-zero. This fixes a kernel page fault can happen when multiple tests are running concurrently in a loop and one is producing engine resets and consuming the i915 error_state dump while the other is forcing full GT resets. (takes a while to trigger). The dmesg call trace: [ 5590.803000] BUG: unable to handle page fault for address: ffffffffa0b0e000 [ 5590.803009] #PF: supervisor read access in kernel mode [ 5590.803013] #PF: error_code(0x0000) - not-present page [ 5590.803016] PGD 5814067 P4D 5814067 PUD 5815063 PMD 109de4067 PTE 0 [ 5590.803022] Oops: 0000 [#1] PREEMPT SMP NOPTI [ 5590.803026] CPU: 5 PID: 13656 Comm: i915_hangman Tainted: G U 5.17.0-rc5-ups69-guc-err-capt-rev6+ #136 [ 5590.803033] Hardware name: Intel Corporation Alder Lake Client Platform/AlderLake-M LP4x RVP, BIOS ADLPFWI1.R00. 3031.A02.2201171222 01/17/2022 [ 5590.803039] RIP: 0010:memcpy_erms+0x6/0x10 [ 5590.803045] Code: fe ff ff cc eb 1e 0f 1f 00 48 89 f8 48 89 d1 48 c1 e9 03 83 e2 07 f3 48 a5 89 d1 f3 a4 c3 66 0f 1f 44 00 00 48 89 f8 48 89 d1 a4 c3 0f 1f 80 00 00 00 00 48 89 f8 48 83 fa 20 72 7e 40 38 fe [ 5590.803054] RSP: 0018:ffffc90003a8fdf0 EFLAGS: 00010282 [ 5590.803057] RAX: ffff888107ee9000 RBX: ffff888108cb1a00 RCX: 0000000000000f8f [ 5590.803061] RDX: 0000000000001000 RSI: ffffffffa0b0e000 RDI: ffff888107ee9071 [ 5590.803065] RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000001 [ 5590.803069] R10: 0000000000000001 R11: 0000000000000002 R12: 0000000000000019 [ 5590.803073] R13: 0000000000174fff R14: 0000000000001000 R15: ffff888107ee9000 [ 5590.803077] FS: 00007f62a99bee80(0000) GS:ffff88849f880000(0000) knlGS:0000000000000000 [ 5590.803082] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 5590.803085] CR2: ffffffffa0b0e000 CR3: 000000010a1a8004 CR4: 0000000000770ee0 [ 5590.803089] PKRU: 55555554 [ 5590.803091] Call Trace: [ 5590.803093] [ 5590.803096] error_state_read+0xa1/0xd0 [i915] [ 5590.803175] kernfs_fop_read_iter+0xb2/0x1b0 [ 5590.803180] new_sync_read+0x116/0x1a0 [ 5590.803185] vfs_read+0x114/0x1b0 [ 5590.803189] ksys_read+0x63/0xe0 [ 5590.803193] do_syscall_64+0x38/0xc0 [ 5590.803197] entry_SYSCALL_64_after_hwframe+0x44/0xae [ 5590.803201] RIP: 0033:0x7f62aaea5912 [ 5590.803204] Code: c0 e9 b2 fe ff ff 50 48 8d 3d 5a b9 0c 00 e8 05 19 02 00 0f 1f 44 00 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 0f 05 <48> 3d 00 f0 ff ff 77 56 c3 0f 1f 44 00 00 48 83 ec 28 48 89 54 24 [ 5590.803213] RSP: 002b:00007fff5b659ae8 EFLAGS: 00000246 ORIG_RAX: 0000000000000000 [ 5590.803218] RAX: ffffffffffffffda RBX: 0000000000100000 RCX: 00007f62aaea5912 [ 5590.803221] RDX: 000000000008b000 RSI: 00007f62a8c4000f RDI: 0000000000000006 [ 5590.803225] RBP: 00007f62a8bcb00f R08: 0000000000200010 R09: 0000000000101000 [ 5590.803229] R10: 0000000000000001 R11: 0000000000000246 R12: 0000000000000006 [ 5590.803233] R13: 0000000000075000 R14: 00007f62a8acb010 R15: 0000000000200000 [ 5590.803238] [ 5590.803240] Modules linked in: i915 ttm drm_buddy drm_dp_helper drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops prime_numbers nfnetlink br_netfilter overlay mei_pxp mei_hdcp x86_pkg_temp_thermal coretemp kvm_intel snd_hda_codec_hdmi snd_hda_intel snd_intel_dspcfg snd_hda_codec snd_hwdep snd_hda_core snd_pcm mei_me mei fuse ip_tables x_tables crct10dif_pclmul e1000e crc32_pclmul ptp i2c_i801 ghash_clmulni_intel i2c_smbus pps_core [last unloa ded: ttm] [ 5590.803277] CR2: ffffffffa0b0e000 [ 5590.803280] ---[ end trace 0000000000000000 ]--- Fixes: 0e39037b3165 ("drm/i915: Cache the error string") Signed-off-by: Alan Previn Reviewed-by: John Harrison Signed-off-by: John Harrison Link: https://patchwork.freedesktop.org/patch/msgid/20220311004311.514198-2= -alan.previn.teres.alexis@intel.com (cherry picked from commit 3304033a1e69cd81a2044b4422f0d7e593afb4e6) Signed-off-by: Jani Nikula Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/i915/i915_sysfs.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_= sysfs.c index a4d1759375b9..66a8880eaf19 100644 --- a/drivers/gpu/drm/i915/i915_sysfs.c +++ b/drivers/gpu/drm/i915/i915_sysfs.c @@ -432,7 +432,14 @@ static ssize_t error_state_read(struct file *filp, str= uct kobject *kobj, struct device *kdev =3D kobj_to_dev(kobj); struct drm_i915_private *i915 =3D kdev_minor_to_i915(kdev); struct i915_gpu_coredump *gpu; - ssize_t ret; + ssize_t ret =3D 0; + + /* + * FIXME: Concurrent clients triggering resets and reading + clearing + * dumps can cause inconsistent sysfs reads when a user calls in with a + * non-zero offset to complete a prior partial read but the + * gpu_coredump has been cleared or replaced. + */ =20 gpu =3D i915_first_error_state(i915); if (IS_ERR(gpu)) { @@ -444,8 +451,10 @@ static ssize_t error_state_read(struct file *filp, str= uct kobject *kobj, const char *str =3D "No error state collected\n"; size_t len =3D strlen(str); =20 - ret =3D min_t(size_t, count, len - off); - memcpy(buf, str + off, ret); + if (off < len) { + ret =3D min_t(size_t, count, len - off); + memcpy(buf, str + off, ret); + } } =20 return ret; --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1647CCA479 for ; Mon, 20 Jun 2022 13:00:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243218AbiFTNAM (ORCPT ); Mon, 20 Jun 2022 09:00:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244088AbiFTM7O (ORCPT ); Mon, 20 Jun 2022 08:59:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96AD618B0C; Mon, 20 Jun 2022 05:56: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 3C306B811A0; Mon, 20 Jun 2022 12:56:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A974C3411B; Mon, 20 Jun 2022 12:56:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729776; bh=zU0vCiW5Glqa+FnlR3SUqx1nsQyiU2Ml+h1jd4dFlno=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jh6NZHPTPEdazlpyburRUZwW7wT2AmSlYImUiJ2aoA9nOxWuOzgMd3NBXaHVIlx+i vxG9EMbkPImlQOhuCUf5jDrB/TTVUqzcfPQxlWaVOlPZd6s8Peu6Nq3jOJx3ff90/x ox8EkDYWleScVQGvtaIU4YwrY/u6BjzjXjlETUiE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guangbin Huang , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 069/141] net: hns3: set port base vlan tbl_sta to false before removing old vlan Date: Mon, 20 Jun 2022 14:50:07 +0200 Message-Id: <20220620124731.578483792@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Guangbin Huang [ Upstream commit 9eda7d8bcbdb6909f202edeedff51948f1cad1e5 ] When modify port base vlan, the port base vlan tbl_sta needs to set to false before removing old vlan, to indicate this operation is not finish. Fixes: c0f46de30c96 ("net: hns3: fix port base vlan add fail when concurren= t with reset") Signed-off-by: Guangbin Huang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/driv= ers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 8cebb180c812..5d1615e27a1c 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -10136,6 +10136,7 @@ static int hclge_modify_port_base_vlan_tag(struct h= clge_vport *vport, if (ret) return ret; =20 + vport->port_base_vlan_cfg.tbl_sta =3D false; /* remove old VLAN tag */ if (old_info->vlan_tag =3D=3D 0) ret =3D hclge_set_vf_vlan_common(hdev, vport->vport_id, --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D3C7C433EF for ; Mon, 20 Jun 2022 13:04:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244114AbiFTNDA (ORCPT ); Mon, 20 Jun 2022 09:03:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243823AbiFTNBL (ORCPT ); Mon, 20 Jun 2022 09:01:11 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F40EA1CFD4; Mon, 20 Jun 2022 05:57:15 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5D04EB811BD; Mon, 20 Jun 2022 12:57:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E5F2C3411B; Mon, 20 Jun 2022 12:57:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729832; bh=EwPaBTg4uRgoErXhKRZXM6RnPI0iuAxbfKZUuX7aFNk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LL4WlYy/t4ask9RJWhjHjPGJk6PhWVNcIHulxszQoQqm7IkXzBTcC5E+8Lm8uP1oP /KAnXsF/OgNFF8Yr55bS9pJmd3Jzx1Ug0XCKe/85z18AmUyP8GxwvINm574yEJTzf4 Leoq8P+tfbPwG+QTJfOQzuYEL4l5qSy2IGiqCCd4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jian Shen , Guangbin Huang , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 070/141] net: hns3: dont push link state to VF if unalive Date: Mon, 20 Jun 2022 14:50:08 +0200 Message-Id: <20220620124731.606158757@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jian Shen [ Upstream commit 283847e3ef6dbf79bf67083b5ce7b8033e8b6f34 ] It's unnecessary to push link state to unalive VF, and the VF will query link state from PF when it being start works. Fixes: 18b6e31f8bf4 ("net: hns3: PF add support for pushing link status to = VFs") Signed-off-by: Jian Shen Signed-off-by: Guangbin Huang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/driv= ers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index 5d1615e27a1c..c8c99ab60ec1 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -3384,6 +3384,12 @@ static int hclge_set_vf_link_state(struct hnae3_hand= le *handle, int vf, link_state_old =3D vport->vf_info.link_state; vport->vf_info.link_state =3D link_state; =20 + /* return success directly if the VF is unalive, VF will + * query link state itself when it starts work. + */ + if (!test_bit(HCLGE_VPORT_STATE_ALIVE, &vport->state)) + return 0; + ret =3D hclge_push_vf_link_status(vport); if (ret) { vport->vf_info.link_state =3D link_state_old; --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1D2EC433EF for ; Mon, 20 Jun 2022 13:02:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243910AbiFTNCP (ORCPT ); Mon, 20 Jun 2022 09:02:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244659AbiFTM7r (ORCPT ); Mon, 20 Jun 2022 08:59:47 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BFB61A052; Mon, 20 Jun 2022 05:56:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 533C4CE138A; Mon, 20 Jun 2022 12:56:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0338BC3411B; Mon, 20 Jun 2022 12:56:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729798; bh=WvDC5wxXqXnNA8e+WNw8hqCRYkEqfWusLnMux/2jvUI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s1oeeo1Hp30SzjqTNIhqf9QkFwEn0oOEOLCBL8rFQVNQgfOJ9TZlcMK7JegSuTpfh L8W8Tj4j+v9xEx8zmeuc6lkYO9ReSn2VvqRbBA6Db6GrujK44n+PXxqgZbu/vGJS5Q KStCc/BbSO1DGzyG0RKUVX06o0G6k8bqaBvgEuVE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guangbin Huang , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 071/141] net: hns3: restore tm priority/qset to default settings when tc disabled Date: Mon, 20 Jun 2022 14:50:09 +0200 Message-Id: <20220620124731.634745023@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Guangbin Huang [ Upstream commit e93530ae0e5d8fcf2d908933d206e0c93bc3c09b ] Currently, settings parameters of schedule mode, dwrr, shaper of tm priority or qset of one tc are only be set when tc is enabled, they are not restored to the default settings when tc is disabled. It confuses users when they cat tm_priority or tm_qset files of debugfs. So this patch fixes it. Fixes: 848440544b41 ("net: hns3: Add support of TX Scheduler & Shaper to HN= S3 driver") Signed-off-by: Guangbin Huang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/hisilicon/hns3/hnae3.h | 1 + .../ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 95 +++++++++++++------ 2 files changed, 65 insertions(+), 31 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethe= rnet/hisilicon/hns3/hnae3.h index 79c64f4e67d2..3affcdb34c91 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h +++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h @@ -765,6 +765,7 @@ struct hnae3_tc_info { u8 prio_tc[HNAE3_MAX_USER_PRIO]; /* TC indexed by prio */ u16 tqp_count[HNAE3_MAX_TC]; u16 tqp_offset[HNAE3_MAX_TC]; + u8 max_tc; /* Total number of TCs */ u8 num_tc; /* Total number of enabled TCs */ bool mqprio_active; }; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c b/driver= s/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c index 1f87a8a3fe32..ad53a3447322 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c @@ -282,8 +282,8 @@ static int hclge_tm_pg_to_pri_map_cfg(struct hclge_dev = *hdev, return hclge_cmd_send(&hdev->hw, &desc, 1); } =20 -static int hclge_tm_qs_to_pri_map_cfg(struct hclge_dev *hdev, - u16 qs_id, u8 pri) +static int hclge_tm_qs_to_pri_map_cfg(struct hclge_dev *hdev, u16 qs_id, u= 8 pri, + bool link_vld) { struct hclge_qs_to_pri_link_cmd *map; struct hclge_desc desc; @@ -294,7 +294,7 @@ static int hclge_tm_qs_to_pri_map_cfg(struct hclge_dev = *hdev, =20 map->qs_id =3D cpu_to_le16(qs_id); map->priority =3D pri; - map->link_vld =3D HCLGE_TM_QS_PRI_LINK_VLD_MSK; + map->link_vld =3D link_vld ? HCLGE_TM_QS_PRI_LINK_VLD_MSK : 0; =20 return hclge_cmd_send(&hdev->hw, &desc, 1); } @@ -642,11 +642,13 @@ static void hclge_tm_update_kinfo_rss_size(struct hcl= ge_vport *vport) * one tc for VF for simplicity. VF's vport_id is non zero. */ if (vport->vport_id) { + kinfo->tc_info.max_tc =3D 1; kinfo->tc_info.num_tc =3D 1; vport->qs_offset =3D HNAE3_MAX_TC + vport->vport_id - HCLGE_VF_VPORT_START_NUM; vport_max_rss_size =3D hdev->vf_rss_size_max; } else { + kinfo->tc_info.max_tc =3D hdev->tc_max; kinfo->tc_info.num_tc =3D min_t(u16, vport->alloc_tqps, hdev->tm_info.num_tc); vport->qs_offset =3D 0; @@ -714,14 +716,22 @@ static void hclge_tm_vport_info_update(struct hclge_d= ev *hdev) =20 static void hclge_tm_tc_info_init(struct hclge_dev *hdev) { - u8 i; + u8 i, tc_sch_mode; + u32 bw_limit; + + for (i =3D 0; i < hdev->tc_max; i++) { + if (i < hdev->tm_info.num_tc) { + tc_sch_mode =3D HCLGE_SCH_MODE_DWRR; + bw_limit =3D hdev->tm_info.pg_info[0].bw_limit; + } else { + tc_sch_mode =3D HCLGE_SCH_MODE_SP; + bw_limit =3D 0; + } =20 - for (i =3D 0; i < hdev->tm_info.num_tc; i++) { hdev->tm_info.tc_info[i].tc_id =3D i; - hdev->tm_info.tc_info[i].tc_sch_mode =3D HCLGE_SCH_MODE_DWRR; + hdev->tm_info.tc_info[i].tc_sch_mode =3D tc_sch_mode; hdev->tm_info.tc_info[i].pgid =3D 0; - hdev->tm_info.tc_info[i].bw_limit =3D - hdev->tm_info.pg_info[0].bw_limit; + hdev->tm_info.tc_info[i].bw_limit =3D bw_limit; } =20 for (i =3D 0; i < HNAE3_MAX_USER_PRIO; i++) @@ -926,10 +936,13 @@ static int hclge_tm_pri_q_qs_cfg_tc_base(struct hclge= _dev *hdev) for (k =3D 0; k < hdev->num_alloc_vport; k++) { struct hnae3_knic_private_info *kinfo =3D &vport[k].nic.kinfo; =20 - for (i =3D 0; i < kinfo->tc_info.num_tc; i++) { + for (i =3D 0; i < kinfo->tc_info.max_tc; i++) { + u8 pri =3D i < kinfo->tc_info.num_tc ? i : 0; + bool link_vld =3D i < kinfo->tc_info.num_tc; + ret =3D hclge_tm_qs_to_pri_map_cfg(hdev, vport[k].qs_offset + i, - i); + pri, link_vld); if (ret) return ret; } @@ -949,7 +962,7 @@ static int hclge_tm_pri_q_qs_cfg_vnet_base(struct hclge= _dev *hdev) for (i =3D 0; i < HNAE3_MAX_TC; i++) { ret =3D hclge_tm_qs_to_pri_map_cfg(hdev, vport[k].qs_offset + i, - k); + k, true); if (ret) return ret; } @@ -989,33 +1002,39 @@ static int hclge_tm_pri_tc_base_shaper_cfg(struct hc= lge_dev *hdev) { u32 max_tm_rate =3D hdev->ae_dev->dev_specs.max_tm_rate; struct hclge_shaper_ir_para ir_para; - u32 shaper_para; + u32 shaper_para_c, shaper_para_p; int ret; u32 i; =20 - for (i =3D 0; i < hdev->tm_info.num_tc; i++) { + for (i =3D 0; i < hdev->tc_max; i++) { u32 rate =3D hdev->tm_info.tc_info[i].bw_limit; =20 - ret =3D hclge_shaper_para_calc(rate, HCLGE_SHAPER_LVL_PRI, - &ir_para, max_tm_rate); - if (ret) - return ret; + if (rate) { + ret =3D hclge_shaper_para_calc(rate, HCLGE_SHAPER_LVL_PRI, + &ir_para, max_tm_rate); + if (ret) + return ret; + + shaper_para_c =3D hclge_tm_get_shapping_para(0, 0, 0, + HCLGE_SHAPER_BS_U_DEF, + HCLGE_SHAPER_BS_S_DEF); + shaper_para_p =3D hclge_tm_get_shapping_para(ir_para.ir_b, + ir_para.ir_u, + ir_para.ir_s, + HCLGE_SHAPER_BS_U_DEF, + HCLGE_SHAPER_BS_S_DEF); + } else { + shaper_para_c =3D 0; + shaper_para_p =3D 0; + } =20 - shaper_para =3D hclge_tm_get_shapping_para(0, 0, 0, - HCLGE_SHAPER_BS_U_DEF, - HCLGE_SHAPER_BS_S_DEF); ret =3D hclge_tm_pri_shapping_cfg(hdev, HCLGE_TM_SHAP_C_BUCKET, i, - shaper_para, rate); + shaper_para_c, rate); if (ret) return ret; =20 - shaper_para =3D hclge_tm_get_shapping_para(ir_para.ir_b, - ir_para.ir_u, - ir_para.ir_s, - HCLGE_SHAPER_BS_U_DEF, - HCLGE_SHAPER_BS_S_DEF); ret =3D hclge_tm_pri_shapping_cfg(hdev, HCLGE_TM_SHAP_P_BUCKET, i, - shaper_para, rate); + shaper_para_p, rate); if (ret) return ret; } @@ -1125,7 +1144,7 @@ static int hclge_tm_pri_tc_base_dwrr_cfg(struct hclge= _dev *hdev) int ret; u32 i, k; =20 - for (i =3D 0; i < hdev->tm_info.num_tc; i++) { + for (i =3D 0; i < hdev->tc_max; i++) { pg_info =3D &hdev->tm_info.pg_info[hdev->tm_info.tc_info[i].pgid]; dwrr =3D pg_info->tc_dwrr[i]; @@ -1135,9 +1154,15 @@ static int hclge_tm_pri_tc_base_dwrr_cfg(struct hclg= e_dev *hdev) return ret; =20 for (k =3D 0; k < hdev->num_alloc_vport; k++) { + struct hnae3_knic_private_info *kinfo =3D &vport[k].nic.kinfo; + + if (i >=3D kinfo->tc_info.max_tc) + continue; + + dwrr =3D i < kinfo->tc_info.num_tc ? vport[k].dwrr : 0; ret =3D hclge_tm_qs_weight_cfg( hdev, vport[k].qs_offset + i, - vport[k].dwrr); + dwrr); if (ret) return ret; } @@ -1303,6 +1328,7 @@ static int hclge_tm_schd_mode_tc_base_cfg(struct hclg= e_dev *hdev, u8 pri_id) { struct hclge_vport *vport =3D hdev->vport; int ret; + u8 mode; u16 i; =20 ret =3D hclge_tm_pri_schd_mode_cfg(hdev, pri_id); @@ -1310,9 +1336,16 @@ static int hclge_tm_schd_mode_tc_base_cfg(struct hcl= ge_dev *hdev, u8 pri_id) return ret; =20 for (i =3D 0; i < hdev->num_alloc_vport; i++) { + struct hnae3_knic_private_info *kinfo =3D &vport[i].nic.kinfo; + + if (pri_id >=3D kinfo->tc_info.max_tc) + continue; + + mode =3D pri_id < kinfo->tc_info.num_tc ? HCLGE_SCH_MODE_DWRR : + HCLGE_SCH_MODE_SP; ret =3D hclge_tm_qs_schd_mode_cfg(hdev, vport[i].qs_offset + pri_id, - HCLGE_SCH_MODE_DWRR); + mode); if (ret) return ret; } @@ -1353,7 +1386,7 @@ static int hclge_tm_lvl34_schd_mode_cfg(struct hclge_= dev *hdev) u8 i; =20 if (hdev->tx_sch_mode =3D=3D HCLGE_FLAG_TC_BASE_SCH_MODE) { - for (i =3D 0; i < hdev->tm_info.num_tc; i++) { + for (i =3D 0; i < hdev->tc_max; i++) { ret =3D hclge_tm_schd_mode_tc_base_cfg(hdev, i); if (ret) return ret; --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6175EC43334 for ; Mon, 20 Jun 2022 13:02:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243927AbiFTNCR (ORCPT ); Mon, 20 Jun 2022 09:02:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244789AbiFTM7w (ORCPT ); Mon, 20 Jun 2022 08:59:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF7261CFC8; Mon, 20 Jun 2022 05:56:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 65A71614DA; Mon, 20 Jun 2022 12:56:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78A65C3411C; Mon, 20 Jun 2022 12:56:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729807; bh=qrkbySgKhibtVCFL0La5dUdABQ+I8ii8SIbiNjB7t0U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SSXcnqPyjQDA9kC4lC2Ql+X+U6rBJT6q5Y/zCwHOQewg2Aqh7iNqOL6BvoeewjunO C6Uqu20pruzAWGg+kX6h5DgzxaHqEEynAFPQdNjasoOYZHoWHtEUOkQTU/LEZJ/Y6a OXkzGSMnljDO3LoX1JsmAo9uokuBOx4ZNQwWZfDY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jie Wang , Guangbin Huang , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 072/141] net: hns3: fix PF rss size initialization bug Date: Mon, 20 Jun 2022 14:50:10 +0200 Message-Id: <20220620124731.667222691@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jie Wang [ Upstream commit 71b215f36dca1a3d5d1c576b2099e6d7ea03047e ] Currently hns3 driver misuses the VF rss size to initialize the PF rss size in hclge_tm_vport_tc_info_update. So this patch fix it by checking the vport id before initialization. Fixes: 7347255ea389 ("net: hns3: refactor PF rss get APIs with new common r= ss get APIs") Signed-off-by: Jie Wang Signed-off-by: Guangbin Huang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c b/driver= s/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c index ad53a3447322..f5296ff60694 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c @@ -681,7 +681,9 @@ static void hclge_tm_vport_tc_info_update(struct hclge_= vport *vport) kinfo->num_tqps =3D hclge_vport_get_tqp_num(vport); vport->dwrr =3D 100; /* 100 percent as init */ vport->bw_limit =3D hdev->tm_info.pg_info[0].bw_limit; - hdev->rss_cfg.rss_size =3D kinfo->rss_size; + + if (vport->vport_id =3D=3D PF_VPORT_ID) + hdev->rss_cfg.rss_size =3D kinfo->rss_size; =20 /* when enable mqprio, the tc_info has been updated. */ if (kinfo->tc_info.mqprio_active) --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2BFB4CCA479 for ; Mon, 20 Jun 2022 13:02:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243956AbiFTNCf (ORCPT ); Mon, 20 Jun 2022 09:02:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244915AbiFTNAD (ORCPT ); Mon, 20 Jun 2022 09:00:03 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCCEB1A3A9; Mon, 20 Jun 2022 05:56: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 sin.source.kernel.org (Postfix) with ESMTPS id 81487CE138A; Mon, 20 Jun 2022 12:56:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C32AC341C6; Mon, 20 Jun 2022 12:56:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729810; bh=Rl2yJlwfl/wqcLveA/n079p33M4Fb+zHO8zRFtpI5zA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yp9kk/nhS3xWs3+5eGQHqv7obEehVvUZxs2z3Lq7pGZzS+0hFtmc/uT6vMcIlq8CW Oc/xP3Ao6e3hbtESD8P4O8q7S7csiqk+22qb14LgAPvcfJ1f5uLBOsk55Ena5iX+nF uuWJD4x1LO8TYmA8Su66IBT6HK740NdIeIT4+tYA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guangbin Huang , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 073/141] net: hns3: fix tm port shapping of fibre port is incorrect after driver initialization Date: Mon, 20 Jun 2022 14:50:11 +0200 Message-Id: <20220620124731.697043679@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Guangbin Huang [ Upstream commit 12a3670887725df364cc3e030cf3bede6f13b364 ] Currently in driver initialization process, driver will set shapping parameters of tm port to default speed read from firmware. However, the speed of SFP module may not be default speed, so shapping parameters of tm port may be incorrect. To fix this problem, driver sets new shapping parameters for tm port after getting exact speed of SFP module in this case. Fixes: 88d10bd6f730 ("net: hns3: add support for multiple media type") Signed-off-by: Guangbin Huang Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- .../net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 11 ++++++++--- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/driv= ers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c index c8c99ab60ec1..c0b4ff73128f 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c @@ -3276,7 +3276,7 @@ static int hclge_tp_port_init(struct hclge_dev *hdev) static int hclge_update_port_info(struct hclge_dev *hdev) { struct hclge_mac *mac =3D &hdev->hw.mac; - int speed =3D HCLGE_MAC_SPEED_UNKNOWN; + int speed; int ret; =20 /* get the port info from SFP cmd if not copper port */ @@ -3287,10 +3287,13 @@ static int hclge_update_port_info(struct hclge_dev = *hdev) if (!hdev->support_sfp_query) return 0; =20 - if (hdev->ae_dev->dev_version >=3D HNAE3_DEVICE_VERSION_V2) + if (hdev->ae_dev->dev_version >=3D HNAE3_DEVICE_VERSION_V2) { + speed =3D mac->speed; ret =3D hclge_get_sfp_info(hdev, mac); - else + } else { + speed =3D HCLGE_MAC_SPEED_UNKNOWN; ret =3D hclge_get_sfp_speed(hdev, &speed); + } =20 if (ret =3D=3D -EOPNOTSUPP) { hdev->support_sfp_query =3D false; @@ -3302,6 +3305,8 @@ static int hclge_update_port_info(struct hclge_dev *h= dev) if (hdev->ae_dev->dev_version >=3D HNAE3_DEVICE_VERSION_V2) { if (mac->speed_type =3D=3D QUERY_ACTIVE_SPEED) { hclge_update_port_capability(hdev, mac); + if (mac->speed !=3D speed) + (void)hclge_tm_port_shaper_cfg(hdev); return 0; } return hclge_cfg_mac_speed_dup(hdev, mac->speed, diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c b/driver= s/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c index f5296ff60694..2f33b036a47a 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c @@ -420,7 +420,7 @@ static int hclge_tm_pg_shapping_cfg(struct hclge_dev *h= dev, return hclge_cmd_send(&hdev->hw, &desc, 1); } =20 -static int hclge_tm_port_shaper_cfg(struct hclge_dev *hdev) +int hclge_tm_port_shaper_cfg(struct hclge_dev *hdev) { struct hclge_port_shapping_cmd *shap_cfg_cmd; struct hclge_shaper_ir_para ir_para; diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h b/driver= s/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h index 619cc30a2dfc..d943943912f7 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h @@ -237,6 +237,7 @@ int hclge_pause_addr_cfg(struct hclge_dev *hdev, const = u8 *mac_addr); void hclge_pfc_rx_stats_get(struct hclge_dev *hdev, u64 *stats); void hclge_pfc_tx_stats_get(struct hclge_dev *hdev, u64 *stats); int hclge_tm_qs_shaper_cfg(struct hclge_vport *vport, int max_tx_rate); +int hclge_tm_port_shaper_cfg(struct hclge_dev *hdev); int hclge_tm_get_qset_num(struct hclge_dev *hdev, u16 *qset_num); int hclge_tm_get_pri_num(struct hclge_dev *hdev, u8 *pri_num); int hclge_tm_get_qset_map_pri(struct hclge_dev *hdev, u16 qset_id, u8 *pri= ority, --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81069C43334 for ; Mon, 20 Jun 2022 13:02:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243606AbiFTNCV (ORCPT ); Mon, 20 Jun 2022 09:02:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242756AbiFTNAA (ORCPT ); Mon, 20 Jun 2022 09:00:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DEAB1CFFB; Mon, 20 Jun 2022 05:56: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 D3F0C614CE; Mon, 20 Jun 2022 12:56:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6A486C341C4; Mon, 20 Jun 2022 12:56:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729814; bh=NY3J8kQlVXglfPf8Lzkwc6k5b+VTjHUvUCXI5tTtqKM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ndOSjepOD/n9C6YSGdiz8QwKSniZ+aKI79UXFUPYcsIKTJ/fhgbxV7xRasANb+VRq t0u79cCHAUWdtp3pd7e/3zqDlLmRj3ZoYicswcMFWNT/S9nNAnM/5ANgaFK8KkqFsN wD465avCm650Ck1HrUuSsS3aUFO1bBk+24hBGmEg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.18 074/141] nvme: add device name to warning in uuid_show() Date: Mon, 20 Jun 2022 14:50:12 +0200 Message-Id: <20220620124731.726537509@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thomas Wei=C3=9Fschuh [ Upstream commit 1fc766b5c08417248e0008bca14c3572ac0f1c26 ] This provides more context to users. Old message: [ 00.000000] No UUID available providing old NGUID New message: [ 00.000000] block nvme0n1: No UUID available providing old NGUID Fixes: d934f9848a77 ("nvme: provide UUID value to userspace") Signed-off-by: Thomas Wei=C3=9Fschuh Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/nvme/host/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 2d6a01853109..1ea85c88d795 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -3226,8 +3226,8 @@ static ssize_t uuid_show(struct device *dev, struct d= evice_attribute *attr, * we have no UUID set */ if (uuid_is_null(&ids->uuid)) { - printk_ratelimited(KERN_WARNING - "No UUID available providing old NGUID\n"); + dev_warn_ratelimited(dev, + "No UUID available providing old NGUID\n"); return sysfs_emit(buf, "%pU\n", ids->nguid); } return sysfs_emit(buf, "%pU\n", &ids->uuid); --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7CEFC43334 for ; Mon, 20 Jun 2022 13:02:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243867AbiFTNCc (ORCPT ); Mon, 20 Jun 2022 09:02:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244928AbiFTNAF (ORCPT ); Mon, 20 Jun 2022 09:00:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E0941A06F; Mon, 20 Jun 2022 05:56:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id EB88F614CA; Mon, 20 Jun 2022 12:56:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0D74C3411B; Mon, 20 Jun 2022 12:56:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729817; bh=M/2gDY7ZzNb/oAKKkhfnwbKWyEObv/vJS66e1WXjz3U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pDXUbGlm7deDfcERBx55dInoM51EKmoyR2mYRS84A7yLTPtjkj6o9dJ17KhfPP2OP WAiiE8cR8aRznDnBjTQteA8iALAPTZS5UOyYP8gX2emHu4uJQV4Ci1Tl2N/BtCTjCF VPz0Cdn24hgDkq9qZcmY51RXV+Ib7kXykzS3YtPs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Maksym Yaremchuk , Petr Machata , Ido Schimmel , Paolo Abeni , Sasha Levin Subject: [PATCH 5.18 075/141] mlxsw: spectrum_cnt: Reorder counter pools Date: Mon, 20 Jun 2022 14:50:13 +0200 Message-Id: <20220620124731.755588962@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Petr Machata [ Upstream commit 4b7a632ac4e7101ceefee8484d5c2ca505d347b3 ] Both RIF and ACL flow counters use a 24-bit SW-managed counter address to communicate which counter they want to bind. In a number of Spectrum FW releases, binding a RIF counter is broken and slices the counter index to 16 bits. As a result, on Spectrum-2 and above, no more than about 410 RIF counters can be effectively used. This translates to 205 netdevices for which L3 HW stats can be enabled. (This does not happen on Spectrum-1, because there are fewer counters available overall and the counter index never exceeds 16 bits.) Binding counters to ACLs does not have this issue. Therefore reorder the counter allocation scheme so that RIF counters come first and therefore get lower indices that are below the 16-bit barrier. Fixes: 98e60dce4da1 ("Merge branch 'mlxsw-Introduce-initial-Spectrum-2-supp= ort'") Reported-by: Maksym Yaremchuk Signed-off-by: Petr Machata Signed-off-by: Ido Schimmel Link: https://lore.kernel.org/r/20220613125017.2018162-1-idosch@nvidia.com Signed-off-by: Paolo Abeni Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/mellanox/mlxsw/spectrum_cnt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_cnt.h b/drivers/n= et/ethernet/mellanox/mlxsw/spectrum_cnt.h index a68d931090dd..15c8d4de8350 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_cnt.h +++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_cnt.h @@ -8,8 +8,8 @@ #include "spectrum.h" =20 enum mlxsw_sp_counter_sub_pool_id { - MLXSW_SP_COUNTER_SUB_POOL_FLOW, MLXSW_SP_COUNTER_SUB_POOL_RIF, + MLXSW_SP_COUNTER_SUB_POOL_FLOW, }; =20 int mlxsw_sp_counter_alloc(struct mlxsw_sp *mlxsw_sp, --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95681C43334 for ; Mon, 20 Jun 2022 13:02:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243798AbiFTNCm (ORCPT ); Mon, 20 Jun 2022 09:02:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243243AbiFTNAG (ORCPT ); Mon, 20 Jun 2022 09:00:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 818531A397; Mon, 20 Jun 2022 05:57:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5C8EE614DA; Mon, 20 Jun 2022 12:57:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0625C3411B; Mon, 20 Jun 2022 12:56:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729820; bh=J4GKVgzV5EMFVfT389DAZgVtD9P7mBr/j5cWGA2DIWk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZQNGhBQazVnt3UWgH+jKvClSlMC02Oz/zA5qb3KG3UYbrLXZER3LUzhLeydrc02/G P86wU+7TbRbnbkyXk8wnUKyMZZ3jQkc/+boD601QoeMnpAXp/tfVn2MOZOZmZm7GM7 2QvQ1PQz6G+297/FSY8TLNM9BTzAs6sTw8fe4WR8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michal Michalik , Tony Nguyen , Sasha Levin , Gurucharan Subject: [PATCH 5.18 076/141] ice: Fix PTP TX timestamp offset calculation Date: Mon, 20 Jun 2022 14:50:14 +0200 Message-Id: <20220620124731.783806252@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Michal Michalik [ Upstream commit 71a579f0d3777a704355e6f1572dfba92a9b58b2 ] The offset was being incorrectly calculated for E822 - that led to collisions in choosing TX timestamp register location when more than one port was trying to use timestamping mechanism. In E822 one quad is being logically split between ports, so quad 0 is having trackers for ports 0-3, quad 1 ports 4-7 etc. Each port should have separate memory location for tracking timestamps. Due to error for example ports 1 and 2 had been assigned to quad 0 with same offset (0), while port 1 should have offset 0 and 1 offset 16. Fix it by correctly calculating quad offset. Fixes: 3a7496234d17 ("ice: implement basic E822 PTP support") Signed-off-by: Michal Michalik Tested-by: Gurucharan (A Contingent worker at Int= el) Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/intel/ice/ice_ptp.c | 2 +- drivers/net/ethernet/intel/ice/ice_ptp.h | 31 ++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/etherne= t/intel/ice/ice_ptp.c index 662947c882e8..ef9344ef0d8e 100644 --- a/drivers/net/ethernet/intel/ice/ice_ptp.c +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c @@ -2271,7 +2271,7 @@ static int ice_ptp_init_tx_e822(struct ice_pf *pf, struct ice_ptp_tx *tx, u8 port) { tx->quad =3D port / ICE_PORTS_PER_QUAD; - tx->quad_offset =3D tx->quad * INDEX_PER_PORT; + tx->quad_offset =3D (port % ICE_PORTS_PER_QUAD) * INDEX_PER_PORT; tx->len =3D INDEX_PER_PORT; =20 return ice_ptp_alloc_tx_tracker(tx); diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.h b/drivers/net/etherne= t/intel/ice/ice_ptp.h index afd048d69959..10e396abf130 100644 --- a/drivers/net/ethernet/intel/ice/ice_ptp.h +++ b/drivers/net/ethernet/intel/ice/ice_ptp.h @@ -49,6 +49,37 @@ struct ice_perout_channel { * To allow multiple ports to access the shared register block independent= ly, * the blocks are split up so that indexes are assigned to each port based= on * hardware logical port number. + * + * The timestamp blocks are handled differently for E810- and E822-based + * devices. In E810 devices, each port has its own block of timestamps, wh= ile in + * E822 there is a need to logically break the block of registers into sma= ller + * chunks based on the port number to avoid collisions. + * + * Example for port 5 in E810: + * +--------+--------+--------+--------+--------+--------+--------+------= --+ + * |register|register|register|register|register|register|register|regist= er| + * | block | block | block | block | block | block | block | block= | + * | for | for | for | for | for | for | for | for = | + * | port 0 | port 1 | port 2 | port 3 | port 4 | port 5 | port 6 | port = 7 | + * +--------+--------+--------+--------+--------+--------+--------+------= --+ + * ^^ + * || + * |--- quad offset is alwa= ys 0 + * ---- quad number + * + * Example for port 5 in E822: + * +-----------------------------+-----------------------------+ + * | register block for quad 0 | register block for quad 1 | + * |+------+------+------+------+|+------+------+------+------+| + * ||port 0|port 1|port 2|port 3|||port 0|port 1|port 2|port 3|| + * |+------+------+------+------+|+------+------+------+------+| + * +-----------------------------+-------^---------------------+ + * ^ | + * | --- quad offset* + * ---- quad number + * + * * PHY port 5 is port 1 in quad 1 + * */ =20 /** --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2CB4C43334 for ; Mon, 20 Jun 2022 13:02:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243938AbiFTNCq (ORCPT ); Mon, 20 Jun 2022 09:02:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243488AbiFTNAS (ORCPT ); Mon, 20 Jun 2022 09:00:18 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 817B81CFFC; Mon, 20 Jun 2022 05:57:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 49641614EE; Mon, 20 Jun 2022 12:57:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58D36C3411B; Mon, 20 Jun 2022 12:57:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729823; bh=DwDIzfNA74efO02ffba1vutT/7QIvyWeKb/pLH4Ju+o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kW1VY3CU8BKaBvpk+68KloExB40FiRlnirhQGqkyuhBbLYJpYKx92nNcBulS8IVNJ C6BgzZr6GI4fWq7U1ZF0pE/p9TkjcmhQUqAgswlTFOniOn8f9sBb59Vwayzem/THNN VgHs/r2QoHfuBft5ryyxihsCnTIkhNHryRfm2Yts= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Roman Storozhenko , Anatolii Gerasymenko , Tony Nguyen , Sasha Levin , Gurucharan Subject: [PATCH 5.18 077/141] ice: Sync VLAN filtering features for DVM Date: Mon, 20 Jun 2022 14:50:15 +0200 Message-Id: <20220620124731.813634220@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Roman Storozhenko [ Upstream commit 9542ef4fba8c73e176b8aa18a8adf04aecb889e5 ] VLAN filtering features, that is C-Tag and S-Tag, in DVM mode must be both enabled or disabled. In case of turning off/on only one of the features, another feature must be turned off/on automatically with issuing an appropriate message to the kernel log. Fixes: 1babaf77f49d ("ice: Advertise 802.1ad VLAN filtering and offloads fo= r PF netdev") Signed-off-by: Roman Storozhenko Co-developed-by: Anatolii Gerasymenko Signed-off-by: Anatolii Gerasymenko Tested-by: Gurucharan (A Contingent worker at Int= el) Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/intel/ice/ice_main.c | 49 ++++++++++++++--------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethern= et/intel/ice/ice_main.c index 963a5f40e071..d069b19f9bf7 100644 --- a/drivers/net/ethernet/intel/ice/ice_main.c +++ b/drivers/net/ethernet/intel/ice/ice_main.c @@ -5746,25 +5746,38 @@ static netdev_features_t ice_fix_features(struct net_device *netdev, netdev_features_t features) { struct ice_netdev_priv *np =3D netdev_priv(netdev); - netdev_features_t supported_vlan_filtering; - netdev_features_t requested_vlan_filtering; - struct ice_vsi *vsi =3D np->vsi; - - requested_vlan_filtering =3D features & NETIF_VLAN_FILTERING_FEATURES; - - /* make sure supported_vlan_filtering works for both SVM and DVM */ - supported_vlan_filtering =3D NETIF_F_HW_VLAN_CTAG_FILTER; - if (ice_is_dvm_ena(&vsi->back->hw)) - supported_vlan_filtering |=3D NETIF_F_HW_VLAN_STAG_FILTER; - - if (requested_vlan_filtering && - requested_vlan_filtering !=3D supported_vlan_filtering) { - if (requested_vlan_filtering & NETIF_F_HW_VLAN_CTAG_FILTER) { - netdev_warn(netdev, "cannot support requested VLAN filtering settings, = enabling all supported VLAN filtering settings\n"); - features |=3D supported_vlan_filtering; + netdev_features_t req_vlan_fltr, cur_vlan_fltr; + bool cur_ctag, cur_stag, req_ctag, req_stag; + + cur_vlan_fltr =3D netdev->features & NETIF_VLAN_FILTERING_FEATURES; + cur_ctag =3D cur_vlan_fltr & NETIF_F_HW_VLAN_CTAG_FILTER; + cur_stag =3D cur_vlan_fltr & NETIF_F_HW_VLAN_STAG_FILTER; + + req_vlan_fltr =3D features & NETIF_VLAN_FILTERING_FEATURES; + req_ctag =3D req_vlan_fltr & NETIF_F_HW_VLAN_CTAG_FILTER; + req_stag =3D req_vlan_fltr & NETIF_F_HW_VLAN_STAG_FILTER; + + if (req_vlan_fltr !=3D cur_vlan_fltr) { + if (ice_is_dvm_ena(&np->vsi->back->hw)) { + if (req_ctag && req_stag) { + features |=3D NETIF_VLAN_FILTERING_FEATURES; + } else if (!req_ctag && !req_stag) { + features &=3D ~NETIF_VLAN_FILTERING_FEATURES; + } else if ((!cur_ctag && req_ctag && !cur_stag) || + (!cur_stag && req_stag && !cur_ctag)) { + features |=3D NETIF_VLAN_FILTERING_FEATURES; + netdev_warn(netdev, "802.1Q and 802.1ad VLAN filtering must be either= both on or both off. VLAN filtering has been enabled for both types.\n"); + } else if ((cur_ctag && !req_ctag && cur_stag) || + (cur_stag && !req_stag && cur_ctag)) { + features &=3D ~NETIF_VLAN_FILTERING_FEATURES; + netdev_warn(netdev, "802.1Q and 802.1ad VLAN filtering must be either= both on or both off. VLAN filtering has been disabled for both types.\n"); + } } else { - netdev_warn(netdev, "cannot support requested VLAN filtering settings, = clearing all supported VLAN filtering settings\n"); - features &=3D ~supported_vlan_filtering; + if (req_vlan_fltr & NETIF_F_HW_VLAN_STAG_FILTER) + netdev_warn(netdev, "cannot support requested 802.1ad filtering settin= g in SVM mode\n"); + + if (req_vlan_fltr & NETIF_F_HW_VLAN_CTAG_FILTER) + features |=3D NETIF_F_HW_VLAN_CTAG_FILTER; } } =20 --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF8D9C43334 for ; Mon, 20 Jun 2022 13:02:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243771AbiFTNCv (ORCPT ); Mon, 20 Jun 2022 09:02:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239153AbiFTNBB (ORCPT ); Mon, 20 Jun 2022 09:01:01 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D0651A3A8; Mon, 20 Jun 2022 05:57:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 5213ECE138D; Mon, 20 Jun 2022 12:57:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 390C2C3411B; Mon, 20 Jun 2022 12:57:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729826; bh=ULXuZEx+wPprd2ATZdU7/l5I6Y3n1V0jGzccBRPto+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U5wCsvGSAO44I06SqCRYHkk90FLKBmnCIJQSu8LNjQFf2Tx58F9+OjDmqYe///Ubw s2QpzIlcbinMoTBIGjJwz7pKkVh4FLNU/XhvpoEwlwkFsvJQctH9kD/N8KR5rCAYjs X59/N7AWj5QadAba4BNI1Pl7dC2rKpUMSmeUdLT0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Slawomir Laba , Przemyslaw Patynowski , Mateusz Palczewski , Konrad Jankowski , Tony Nguyen , Sasha Levin Subject: [PATCH 5.18 078/141] ice: Fix queue config fail handling Date: Mon, 20 Jun 2022 14:50:16 +0200 Message-Id: <20220620124731.844684308@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Przemyslaw Patynowski [ Upstream commit be2af71496a54a7195ac62caba6fab49cfe5006c ] Disable VF's RX/TX queues, when VIRTCHNL_OP_CONFIG_VSI_QUEUES fail. Not disabling them might lead to scenario, where PF driver leaves VF queues enabled, when VF's VSI failed queue config. In this scenario VF should not have RX/TX queues enabled. If PF failed to set up VF's queues, VF will reset due to TX timeouts in VF driver. Initialize iterator 'i' to -1, so if error happens prior to configuring queues then error path code will not disable queue 0. Loop that configures queues will is using same iterator, so error path code will only disable queues that were configured. Fixes: 77ca27c41705 ("ice: add support for virtchnl_queue_select.[tx|rx]_qu= eues bitmap") Suggested-by: Slawomir Laba Signed-off-by: Przemyslaw Patynowski Signed-off-by: Mateusz Palczewski Tested-by: Konrad Jankowski Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/intel/ice/ice_virtchnl.c | 53 +++++++++---------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl.c b/drivers/net/et= hernet/intel/ice/ice_virtchnl.c index 5405a0e752cf..da7c5ce15be0 100644 --- a/drivers/net/ethernet/intel/ice/ice_virtchnl.c +++ b/drivers/net/ethernet/intel/ice/ice_virtchnl.c @@ -1587,35 +1587,27 @@ static int ice_vc_cfg_irq_map_msg(struct ice_vf *vf= , u8 *msg) */ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *msg) { - enum virtchnl_status_code v_ret =3D VIRTCHNL_STATUS_SUCCESS; struct virtchnl_vsi_queue_config_info *qci =3D (struct virtchnl_vsi_queue_config_info *)msg; struct virtchnl_queue_pair_info *qpi; struct ice_pf *pf =3D vf->pf; struct ice_vsi *vsi; - int i, q_idx; + int i =3D -1, q_idx; =20 - if (!test_bit(ICE_VF_STATE_ACTIVE, vf->vf_states)) { - v_ret =3D VIRTCHNL_STATUS_ERR_PARAM; + if (!test_bit(ICE_VF_STATE_ACTIVE, vf->vf_states)) goto error_param; - } =20 - if (!ice_vc_isvalid_vsi_id(vf, qci->vsi_id)) { - v_ret =3D VIRTCHNL_STATUS_ERR_PARAM; + if (!ice_vc_isvalid_vsi_id(vf, qci->vsi_id)) goto error_param; - } =20 vsi =3D ice_get_vf_vsi(vf); - if (!vsi) { - v_ret =3D VIRTCHNL_STATUS_ERR_PARAM; + if (!vsi) goto error_param; - } =20 if (qci->num_queue_pairs > ICE_MAX_RSS_QS_PER_VF || qci->num_queue_pairs > min_t(u16, vsi->alloc_txq, vsi->alloc_rxq)) { dev_err(ice_pf_to_dev(pf), "VF-%d requesting more than supported number = of queues: %d\n", vf->vf_id, min_t(u16, vsi->alloc_txq, vsi->alloc_rxq)); - v_ret =3D VIRTCHNL_STATUS_ERR_PARAM; goto error_param; } =20 @@ -1628,7 +1620,6 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *m= sg) !ice_vc_isvalid_ring_len(qpi->txq.ring_len) || !ice_vc_isvalid_ring_len(qpi->rxq.ring_len) || !ice_vc_isvalid_q_id(vf, qci->vsi_id, qpi->txq.queue_id)) { - v_ret =3D VIRTCHNL_STATUS_ERR_PARAM; goto error_param; } =20 @@ -1638,7 +1629,6 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 *m= sg) * for selected "vsi" */ if (q_idx >=3D vsi->alloc_txq || q_idx >=3D vsi->alloc_rxq) { - v_ret =3D VIRTCHNL_STATUS_ERR_PARAM; goto error_param; } =20 @@ -1648,14 +1638,13 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 = *msg) vsi->tx_rings[i]->count =3D qpi->txq.ring_len; =20 /* Disable any existing queue first */ - if (ice_vf_vsi_dis_single_txq(vf, vsi, q_idx)) { - v_ret =3D VIRTCHNL_STATUS_ERR_PARAM; + if (ice_vf_vsi_dis_single_txq(vf, vsi, q_idx)) goto error_param; - } =20 /* Configure a queue with the requested settings */ if (ice_vsi_cfg_single_txq(vsi, vsi->tx_rings, q_idx)) { - v_ret =3D VIRTCHNL_STATUS_ERR_PARAM; + dev_warn(ice_pf_to_dev(pf), "VF-%d failed to configure TX queue %d\n", + vf->vf_id, i); goto error_param; } } @@ -1669,17 +1658,13 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 = *msg) =20 if (qpi->rxq.databuffer_size !=3D 0 && (qpi->rxq.databuffer_size > ((16 * 1024) - 128) || - qpi->rxq.databuffer_size < 1024)) { - v_ret =3D VIRTCHNL_STATUS_ERR_PARAM; + qpi->rxq.databuffer_size < 1024)) goto error_param; - } vsi->rx_buf_len =3D qpi->rxq.databuffer_size; vsi->rx_rings[i]->rx_buf_len =3D vsi->rx_buf_len; if (qpi->rxq.max_pkt_size > max_frame_size || - qpi->rxq.max_pkt_size < 64) { - v_ret =3D VIRTCHNL_STATUS_ERR_PARAM; + qpi->rxq.max_pkt_size < 64) goto error_param; - } =20 vsi->max_frame =3D qpi->rxq.max_pkt_size; /* add space for the port VLAN since the VF driver is @@ -1690,16 +1675,30 @@ static int ice_vc_cfg_qs_msg(struct ice_vf *vf, u8 = *msg) vsi->max_frame +=3D VLAN_HLEN; =20 if (ice_vsi_cfg_single_rxq(vsi, q_idx)) { - v_ret =3D VIRTCHNL_STATUS_ERR_PARAM; + dev_warn(ice_pf_to_dev(pf), "VF-%d failed to configure RX queue %d\n", + vf->vf_id, i); goto error_param; } } } =20 + /* send the response to the VF */ + return ice_vc_send_msg_to_vf(vf, VIRTCHNL_OP_CONFIG_VSI_QUEUES, + VIRTCHNL_STATUS_SUCCESS, NULL, 0); error_param: + /* disable whatever we can */ + for (; i >=3D 0; i--) { + if (ice_vsi_ctrl_one_rx_ring(vsi, false, i, true)) + dev_err(ice_pf_to_dev(pf), "VF-%d could not disable RX queue %d\n", + vf->vf_id, i); + if (ice_vf_vsi_dis_single_txq(vf, vsi, i)) + dev_err(ice_pf_to_dev(pf), "VF-%d could not disable TX queue %d\n", + vf->vf_id, i); + } + /* send the response to the VF */ - return ice_vc_send_msg_to_vf(vf, VIRTCHNL_OP_CONFIG_VSI_QUEUES, v_ret, - NULL, 0); + return ice_vc_send_msg_to_vf(vf, VIRTCHNL_OP_CONFIG_VSI_QUEUES, + VIRTCHNL_STATUS_ERR_PARAM, NULL, 0); } =20 /** --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2449AC43334 for ; Mon, 20 Jun 2022 13:03:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243725AbiFTNCz (ORCPT ); Mon, 20 Jun 2022 09:02:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243738AbiFTNBC (ORCPT ); Mon, 20 Jun 2022 09:01:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 328A31A3B7; Mon, 20 Jun 2022 05:57:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DBDF6B811A0; Mon, 20 Jun 2022 12:57:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36548C3411C; Mon, 20 Jun 2022 12:57:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729829; bh=jGDQcoA1Nyq2F0vj3IoWtzmfncJCZSjIDXqt46YmTEc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rg5YiSEwi4hgxl3gOIRG0o+rHWVJMa/gBgXr28IFDWaqX+Mc068IM32nwsibgEwXR YysNt1kZdi4o1Wsk5utRBoAAIzmEa/yO7Uwg/9GdwkmrH0Vt2ydei+iVXP3emZnoIQ l4RXeNoeG2UvzyYxaPAGCVkklJUzLeZEQz/HJS/Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Przemyslaw Patynowski , Slawomir Laba , Mateusz Palczewski , Konrad Jankowski , Tony Nguyen , Sasha Levin Subject: [PATCH 5.18 079/141] ice: Fix memory corruption in VF driver Date: Mon, 20 Jun 2022 14:50:17 +0200 Message-Id: <20220620124731.873829021@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Przemyslaw Patynowski [ Upstream commit efe41860008e57fb6b69855b4b93fdf34bc42798 ] Disable VF's RX/TX queues, when it's disabled. VF can have queues enabled, when it requests a reset. If PF driver assumes that VF is disabled, while VF still has queues configured, VF may unmap DMA resources. In such scenario device still can map packets to memory, which ends up silently corrupting it. Previously, VF driver could experience memory corruption, which lead to crash: [ 5119.170157] BUG: unable to handle kernel paging request at 00001b9780003= 237 [ 5119.170166] PGD 0 P4D 0 [ 5119.170173] Oops: 0002 [#1] PREEMPT_RT SMP PTI [ 5119.170181] CPU: 30 PID: 427592 Comm: kworker/u96:2 Kdump: loaded Tainte= d: G W I --------- - - 4.18.0-372.9.1.rt7.166.el8.x86_64 #1 [ 5119.170189] Hardware name: Dell Inc. PowerEdge R740/014X06, BIOS 2.3.10 = 08/15/2019 [ 5119.170193] Workqueue: iavf iavf_adminq_task [iavf] [ 5119.170219] RIP: 0010:__page_frag_cache_drain+0x5/0x30 [ 5119.170238] Code: 0f 0f b6 77 51 85 f6 74 07 31 d2 e9 05 df ff ff e9 90 = fe ff ff 48 8b 05 49 db 33 01 eb b4 0f 1f 80 00 00 00 00 0f 1f 44 00 00 29 77 34 74 01 c3 48 8b 07 f6 c4 80 74 0f 0f b6 77 51 85 f6 74 [ 5119.170244] RSP: 0018:ffffa43b0bdcfd78 EFLAGS: 00010282 [ 5119.170250] RAX: ffffffff896b3e40 RBX: ffff8fb282524000 RCX: 00000000000= 00002 [ 5119.170254] RDX: 0000000049000000 RSI: 0000000000000000 RDI: 00001b97800= 03203 [ 5119.170259] RBP: ffff8fb248217b00 R08: 0000000000000022 R09: 00000000000= 00009 [ 5119.170262] R10: 2b849d6300000000 R11: 0000000000000020 R12: 00000000000= 00000 [ 5119.170265] R13: 0000000000001000 R14: 0000000000000009 R15: 00000000000= 00000 [ 5119.170269] FS: 0000000000000000(0000) GS:ffff8fb1201c0000(0000) knlGS:= 0000000000000000 [ 5119.170274] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 5119.170279] CR2: 00001b9780003237 CR3: 00000008f3e1a003 CR4: 00000000007= 726e0 [ 5119.170283] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 00000000000= 00000 [ 5119.170286] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 00000000000= 00400 [ 5119.170290] PKRU: 55555554 [ 5119.170292] Call Trace: [ 5119.170298] iavf_clean_rx_ring+0xad/0x110 [iavf] [ 5119.170324] iavf_free_rx_resources+0xe/0x50 [iavf] [ 5119.170342] iavf_free_all_rx_resources.part.51+0x30/0x40 [iavf] [ 5119.170358] iavf_virtchnl_completion+0xd8a/0x15b0 [iavf] [ 5119.170377] ? iavf_clean_arq_element+0x210/0x280 [iavf] [ 5119.170397] iavf_adminq_task+0x126/0x2e0 [iavf] [ 5119.170416] process_one_work+0x18f/0x420 [ 5119.170429] worker_thread+0x30/0x370 [ 5119.170437] ? process_one_work+0x420/0x420 [ 5119.170445] kthread+0x151/0x170 [ 5119.170452] ? set_kthread_struct+0x40/0x40 [ 5119.170460] ret_from_fork+0x35/0x40 [ 5119.170477] Modules linked in: iavf sctp ip6_udp_tunnel udp_tunnel mlx4_= en mlx4_core nfp tls vhost_net vhost vhost_iotlb tap tun xt_CHECKSUM ipt_MA= SQUERADE xt_conntrack ipt_REJECT nf_reject_ipv4 nft_compat nft_counter nft_= chain_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 nf_tables nfnet= link bridge stp llc rpcsec_gss_krb5 auth_rpcgss nfsv4 dns_resolver nfs lock= d grace fscache sunrpc intel_rapl_msr iTCO_wdt iTCO_vendor_support dell_smb= ios wmi_bmof dell_wmi_descriptor dcdbas kvm_intel kvm irqbypass intel_rapl_= common isst_if_common skx_edac irdma nfit libnvdimm x86_pkg_temp_thermal i4= 0e intel_powerclamp coretemp crct10dif_pclmul crc32_pclmul ghash_clmulni_in= tel ib_uverbs rapl ipmi_ssif intel_cstate intel_uncore mei_me pcspkr acpi_i= pmi ib_core mei lpc_ich i2c_i801 ipmi_si ipmi_devintf wmi ipmi_msghandler a= cpi_power_meter xfs libcrc32c sd_mod t10_pi sg mgag200 drm_kms_helper sysco= pyarea sysfillrect sysimgblt fb_sys_fops ice ahci drm libahci crc32c_intel = libata tg3 megaraid_sas [ 5119.170613] i2c_algo_bit dm_mirror dm_region_hash dm_log dm_mod fuse [l= ast unloaded: iavf] [ 5119.170627] CR2: 00001b9780003237 Fixes: ec4f5a436bdf ("ice: Check if VF is disabled for Opcode and other ope= rations") Signed-off-by: Przemyslaw Patynowski Co-developed-by: Slawomir Laba Signed-off-by: Slawomir Laba Signed-off-by: Mateusz Palczewski Tested-by: Konrad Jankowski Signed-off-by: Tony Nguyen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/intel/ice/ice_vf_lib.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/ethernet/intel/ice/ice_vf_lib.c b/drivers/net/ethe= rnet/intel/ice/ice_vf_lib.c index aefd66a4db80..9790df872c2a 100644 --- a/drivers/net/ethernet/intel/ice/ice_vf_lib.c +++ b/drivers/net/ethernet/intel/ice/ice_vf_lib.c @@ -504,6 +504,11 @@ int ice_reset_vf(struct ice_vf *vf, u32 flags) } =20 if (ice_is_vf_disabled(vf)) { + vsi =3D ice_get_vf_vsi(vf); + if (WARN_ON(!vsi)) + return -EINVAL; + ice_vsi_stop_lan_tx_rings(vsi, ICE_NO_RESET, vf->vf_id); + ice_vsi_stop_all_rx_rings(vsi); dev_dbg(dev, "VF is already disabled, there is no need for resetting it,= telling VM, all is fine %d\n", vf->vf_id); return 0; --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58548C433EF for ; Mon, 20 Jun 2022 13:00:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243630AbiFTNAi (ORCPT ); Mon, 20 Jun 2022 09:00:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244685AbiFTM7s (ORCPT ); Mon, 20 Jun 2022 08:59:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7C37B1A06D; Mon, 20 Jun 2022 05:56:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 17EBF614F0; Mon, 20 Jun 2022 12:56:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AC5EC3411B; Mon, 20 Jun 2022 12:56:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729801; bh=E2c6JwTTTgoenhfa01rg3ytkD9oy+z5TCsPOtlv3pdI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pJnK9P0HrOCJtvc3hG0K2w80ErOVtEdSwUh42vcplttPXkdWZoQb05nwrTrAOicvC XkzEEa3EBhLU7o0Bclfn/9wPdvCC/Ayv2MHZtp3ZQRI56R7hArpJbJXSorkcbJun9G b2KEZ9A7p2jQAWLRaYZcS4c2zki53TkfjZogIUUw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Florian Fainelli , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.18 080/141] net: bgmac: Fix an erroneous kfree() in bgmac_remove() Date: Mon, 20 Jun 2022 14:50:18 +0200 Message-Id: <20220620124731.903001364@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET [ Upstream commit d7dd6eccfbc95ac47a12396f84e7e1b361db654b ] 'bgmac' is part of a managed resource allocated with bgmac_alloc(). It should not be freed explicitly. Remove the erroneous kfree() from the .remove() function. Fixes: 34a5102c3235 ("net: bgmac: allocate struct bgmac just once & don't c= opy it") Signed-off-by: Christophe JAILLET Reviewed-by: Florian Fainelli Link: https://lore.kernel.org/r/a026153108dd21239036a032b95c25b5cece253b.16= 55153616.git.christophe.jaillet@wanadoo.fr Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/net/ethernet/broadcom/bgmac-bcma.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bgmac-bcma.c b/drivers/net/ether= net/broadcom/bgmac-bcma.c index e6f48786949c..02bd3cf9a260 100644 --- a/drivers/net/ethernet/broadcom/bgmac-bcma.c +++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c @@ -332,7 +332,6 @@ static void bgmac_remove(struct bcma_device *core) bcma_mdio_mii_unregister(bgmac->mii_bus); bgmac_enet_remove(bgmac); bcma_set_drvdata(core, NULL); - kfree(bgmac); } =20 static struct bcma_driver bgmac_bcma_driver =3D { --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3183CC433EF for ; Mon, 20 Jun 2022 13:02:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242419AbiFTNCh (ORCPT ); Mon, 20 Jun 2022 09:02:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244742AbiFTM7v (ORCPT ); Mon, 20 Jun 2022 08:59:51 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B12921CB37; Mon, 20 Jun 2022 05:56: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 82E2C614B7; Mon, 20 Jun 2022 12:56:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C3C2C341C5; Mon, 20 Jun 2022 12:56:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729804; bh=e5fvnq1pRHVpnYq9FM6ZBPyfEaarRWoP6+KGXzhvOT8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pfftSXESAP+UZBjUFY+DhkqroUNVm9vAlfSjMr/hzG081j9H2G4umO5nwIw22nen4 /pEpPLjpEYGgWohob1tlzemUukz2k9p/lDLFnRR8Sba87O+I3/nTABIvfWhDx9i+Jp c/Pv8N9Ay9OWPLGp/ET+3ebaSLc+wis86gYWXJSM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Oliver Hartkopp , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 081/141] net: remove noblock parameter from skb_recv_datagram() Date: Mon, 20 Jun 2022 14:50:19 +0200 Message-Id: <20220620124731.932460774@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Oliver Hartkopp [ Upstream commit f4b41f062c424209e3939a81e6da022e049a45f2 ] skb_recv_datagram() has two parameters 'flags' and 'noblock' that are merged inside skb_recv_datagram() by 'flags | (noblock ? MSG_DONTWAIT : 0)' As 'flags' may contain MSG_DONTWAIT as value most callers split the 'flags' into 'flags' and 'noblock' with finally obsolete bit operations like this: skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, flags & MSG_DONTWAIT, &rc); And this is not even done consistently with the 'flags' parameter. This patch removes the obsolete and costly splitting into two parameters and only performs bit operations when really needed on the caller side. One missing conversion thankfully reported by kernel test robot. I missed to enable kunit tests to build the mctp code. Reported-by: kernel test robot Signed-off-by: Oliver Hartkopp Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/isdn/mISDN/socket.c | 2 +- drivers/net/ppp/pppoe.c | 3 +-- include/linux/skbuff.h | 3 +-- net/appletalk/ddp.c | 3 +-- net/atm/common.c | 2 +- net/ax25/af_ax25.c | 3 +-- net/bluetooth/af_bluetooth.c | 3 +-- net/bluetooth/hci_sock.c | 3 +-- net/caif/caif_socket.c | 2 +- net/can/bcm.c | 5 +---- net/can/isotp.c | 4 +--- net/can/j1939/socket.c | 2 +- net/can/raw.c | 6 +----- net/core/datagram.c | 5 ++--- net/ieee802154/socket.c | 6 ++++-- net/ipv4/ping.c | 3 ++- net/ipv4/raw.c | 3 ++- net/ipv6/raw.c | 3 ++- net/iucv/af_iucv.c | 3 +-- net/key/af_key.c | 2 +- net/l2tp/l2tp_ip.c | 3 ++- net/l2tp/l2tp_ip6.c | 3 ++- net/l2tp/l2tp_ppp.c | 3 +-- net/mctp/af_mctp.c | 2 +- net/mctp/test/route-test.c | 8 ++++---- net/netlink/af_netlink.c | 3 +-- net/netrom/af_netrom.c | 3 ++- net/nfc/llcp_sock.c | 3 +-- net/nfc/rawsock.c | 3 +-- net/packet/af_packet.c | 2 +- net/phonet/datagram.c | 3 ++- net/phonet/pep.c | 6 ++++-- net/qrtr/af_qrtr.c | 3 +-- net/rose/af_rose.c | 3 ++- net/unix/af_unix.c | 5 +++-- net/vmw_vsock/vmci_transport.c | 5 +---- net/x25/af_x25.c | 3 +-- 37 files changed, 57 insertions(+), 70 deletions(-) diff --git a/drivers/isdn/mISDN/socket.c b/drivers/isdn/mISDN/socket.c index a6606736d8c5..2776ca5fc33f 100644 --- a/drivers/isdn/mISDN/socket.c +++ b/drivers/isdn/mISDN/socket.c @@ -121,7 +121,7 @@ mISDN_sock_recvmsg(struct socket *sock, struct msghdr *= msg, size_t len, if (sk->sk_state =3D=3D MISDN_CLOSED) return 0; =20 - skb =3D skb_recv_datagram(sk, flags, flags & MSG_DONTWAIT, &err); + skb =3D skb_recv_datagram(sk, flags, &err); if (!skb) return err; =20 diff --git a/drivers/net/ppp/pppoe.c b/drivers/net/ppp/pppoe.c index e172743948ed..ce2cbb5903d7 100644 --- a/drivers/net/ppp/pppoe.c +++ b/drivers/net/ppp/pppoe.c @@ -1012,8 +1012,7 @@ static int pppoe_recvmsg(struct socket *sock, struct = msghdr *m, goto end; } =20 - skb =3D skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, - flags & MSG_DONTWAIT, &error); + skb =3D skb_recv_datagram(sk, flags, &error); if (error < 0) goto end; =20 diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index 3a30cae8b0a5..2394441fa3dd 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -3836,8 +3836,7 @@ struct sk_buff *__skb_try_recv_datagram(struct sock *= sk, struct sk_buff *__skb_recv_datagram(struct sock *sk, struct sk_buff_head *sk_queue, unsigned int flags, int *off, int *err); -struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned flags, int nob= lock, - int *err); +struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned int flags, int= *err); __poll_t datagram_poll(struct file *file, struct socket *sock, struct poll_table_struct *wait); int skb_copy_datagram_iter(const struct sk_buff *from, int offset, diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c index bf5736c1d458..a06f4d4a6f47 100644 --- a/net/appletalk/ddp.c +++ b/net/appletalk/ddp.c @@ -1753,8 +1753,7 @@ static int atalk_recvmsg(struct socket *sock, struct = msghdr *msg, size_t size, int err =3D 0; struct sk_buff *skb; =20 - skb =3D skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, - flags & MSG_DONTWAIT, &err); + skb =3D skb_recv_datagram(sk, flags, &err); lock_sock(sk); =20 if (!skb) diff --git a/net/atm/common.c b/net/atm/common.c index 1cfa9bf1d187..d0c8ab7ff8f6 100644 --- a/net/atm/common.c +++ b/net/atm/common.c @@ -540,7 +540,7 @@ int vcc_recvmsg(struct socket *sock, struct msghdr *msg= , size_t size, !test_bit(ATM_VF_READY, &vcc->flags)) return 0; =20 - skb =3D skb_recv_datagram(sk, flags, flags & MSG_DONTWAIT, &error); + skb =3D skb_recv_datagram(sk, flags, &error); if (!skb) return error; =20 diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index 289f355e1853..95393bb2760b 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c @@ -1676,8 +1676,7 @@ static int ax25_recvmsg(struct socket *sock, struct m= sghdr *msg, size_t size, } =20 /* Now we can treat all alike */ - skb =3D skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, - flags & MSG_DONTWAIT, &err); + skb =3D skb_recv_datagram(sk, flags, &err); if (skb =3D=3D NULL) goto out; =20 diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c index a0cb2e3da8d4..62705734343b 100644 --- a/net/bluetooth/af_bluetooth.c +++ b/net/bluetooth/af_bluetooth.c @@ -251,7 +251,6 @@ EXPORT_SYMBOL(bt_accept_dequeue); int bt_sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, int flags) { - int noblock =3D flags & MSG_DONTWAIT; struct sock *sk =3D sock->sk; struct sk_buff *skb; size_t copied; @@ -263,7 +262,7 @@ int bt_sock_recvmsg(struct socket *sock, struct msghdr = *msg, size_t len, if (flags & MSG_OOB) return -EOPNOTSUPP; =20 - skb =3D skb_recv_datagram(sk, flags, noblock, &err); + skb =3D skb_recv_datagram(sk, flags, &err); if (!skb) { if (sk->sk_shutdown & RCV_SHUTDOWN) return 0; diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index 33b3c0ffc339..189e3115c8c6 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c @@ -1453,7 +1453,6 @@ static void hci_sock_cmsg(struct sock *sk, struct msg= hdr *msg, static int hci_sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, int flags) { - int noblock =3D flags & MSG_DONTWAIT; struct sock *sk =3D sock->sk; struct sk_buff *skb; int copied, err; @@ -1470,7 +1469,7 @@ static int hci_sock_recvmsg(struct socket *sock, stru= ct msghdr *msg, if (sk->sk_state =3D=3D BT_CLOSED) return 0; =20 - skb =3D skb_recv_datagram(sk, flags, noblock, &err); + skb =3D skb_recv_datagram(sk, flags, &err); if (!skb) return err; =20 diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c index 2b8892d502f7..251e666ba9a2 100644 --- a/net/caif/caif_socket.c +++ b/net/caif/caif_socket.c @@ -282,7 +282,7 @@ static int caif_seqpkt_recvmsg(struct socket *sock, str= uct msghdr *m, if (flags & MSG_OOB) goto read_error; =20 - skb =3D skb_recv_datagram(sk, flags, 0 , &ret); + skb =3D skb_recv_datagram(sk, flags, &ret); if (!skb) goto read_error; copylen =3D skb->len; diff --git a/net/can/bcm.c b/net/can/bcm.c index 95d209b52e6a..64c07e650bb4 100644 --- a/net/can/bcm.c +++ b/net/can/bcm.c @@ -1632,12 +1632,9 @@ static int bcm_recvmsg(struct socket *sock, struct m= sghdr *msg, size_t size, struct sock *sk =3D sock->sk; struct sk_buff *skb; int error =3D 0; - int noblock; int err; =20 - noblock =3D flags & MSG_DONTWAIT; - flags &=3D ~MSG_DONTWAIT; - skb =3D skb_recv_datagram(sk, flags, noblock, &error); + skb =3D skb_recv_datagram(sk, flags, &error); if (!skb) return error; =20 diff --git a/net/can/isotp.c b/net/can/isotp.c index 1e7c6a460ef9..35a1ae61744c 100644 --- a/net/can/isotp.c +++ b/net/can/isotp.c @@ -1055,7 +1055,6 @@ static int isotp_recvmsg(struct socket *sock, struct = msghdr *msg, size_t size, struct sock *sk =3D sock->sk; struct sk_buff *skb; struct isotp_sock *so =3D isotp_sk(sk); - int noblock =3D flags & MSG_DONTWAIT; int ret =3D 0; =20 if (flags & ~(MSG_DONTWAIT | MSG_TRUNC | MSG_PEEK)) @@ -1064,8 +1063,7 @@ static int isotp_recvmsg(struct socket *sock, struct = msghdr *msg, size_t size, if (!so->bound) return -EADDRNOTAVAIL; =20 - flags &=3D ~MSG_DONTWAIT; - skb =3D skb_recv_datagram(sk, flags, noblock, &ret); + skb =3D skb_recv_datagram(sk, flags, &ret); if (!skb) return ret; =20 diff --git a/net/can/j1939/socket.c b/net/can/j1939/socket.c index 6dff4510687a..0bb4fd3f6264 100644 --- a/net/can/j1939/socket.c +++ b/net/can/j1939/socket.c @@ -802,7 +802,7 @@ static int j1939_sk_recvmsg(struct socket *sock, struct= msghdr *msg, return sock_recv_errqueue(sock->sk, msg, size, SOL_CAN_J1939, SCM_J1939_ERRQUEUE); =20 - skb =3D skb_recv_datagram(sk, flags, 0, &ret); + skb =3D skb_recv_datagram(sk, flags, &ret); if (!skb) return ret; =20 diff --git a/net/can/raw.c b/net/can/raw.c index 7105fa4824e4..0cf728dcff36 100644 --- a/net/can/raw.c +++ b/net/can/raw.c @@ -846,16 +846,12 @@ static int raw_recvmsg(struct socket *sock, struct ms= ghdr *msg, size_t size, struct sock *sk =3D sock->sk; struct sk_buff *skb; int err =3D 0; - int noblock; - - noblock =3D flags & MSG_DONTWAIT; - flags &=3D ~MSG_DONTWAIT; =20 if (flags & MSG_ERRQUEUE) return sock_recv_errqueue(sk, msg, size, SOL_CAN_RAW, SCM_CAN_RAW_ERRQUEUE); =20 - skb =3D skb_recv_datagram(sk, flags, noblock, &err); + skb =3D skb_recv_datagram(sk, flags, &err); if (!skb) return err; =20 diff --git a/net/core/datagram.c b/net/core/datagram.c index ee290776c661..70126d15ca6e 100644 --- a/net/core/datagram.c +++ b/net/core/datagram.c @@ -310,12 +310,11 @@ struct sk_buff *__skb_recv_datagram(struct sock *sk, EXPORT_SYMBOL(__skb_recv_datagram); =20 struct sk_buff *skb_recv_datagram(struct sock *sk, unsigned int flags, - int noblock, int *err) + int *err) { int off =3D 0; =20 - return __skb_recv_datagram(sk, &sk->sk_receive_queue, - flags | (noblock ? MSG_DONTWAIT : 0), + return __skb_recv_datagram(sk, &sk->sk_receive_queue, flags, &off, err); } EXPORT_SYMBOL(skb_recv_datagram); diff --git a/net/ieee802154/socket.c b/net/ieee802154/socket.c index 3b2366a88c3c..a725dd9bbda8 100644 --- a/net/ieee802154/socket.c +++ b/net/ieee802154/socket.c @@ -314,7 +314,8 @@ static int raw_recvmsg(struct sock *sk, struct msghdr *= msg, size_t len, int err =3D -EOPNOTSUPP; struct sk_buff *skb; =20 - skb =3D skb_recv_datagram(sk, flags, noblock, &err); + flags |=3D (noblock ? MSG_DONTWAIT : 0); + skb =3D skb_recv_datagram(sk, flags, &err); if (!skb) goto out; =20 @@ -703,7 +704,8 @@ static int dgram_recvmsg(struct sock *sk, struct msghdr= *msg, size_t len, struct dgram_sock *ro =3D dgram_sk(sk); DECLARE_SOCKADDR(struct sockaddr_ieee802154 *, saddr, msg->msg_name); =20 - skb =3D skb_recv_datagram(sk, flags, noblock, &err); + flags |=3D (noblock ? MSG_DONTWAIT : 0); + skb =3D skb_recv_datagram(sk, flags, &err); if (!skb) goto out; =20 diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c index aa9a11b20d18..4e5ceca7ff7f 100644 --- a/net/ipv4/ping.c +++ b/net/ipv4/ping.c @@ -871,7 +871,8 @@ int ping_recvmsg(struct sock *sk, struct msghdr *msg, s= ize_t len, int noblock, if (flags & MSG_ERRQUEUE) return inet_recv_error(sk, msg, len, addr_len); =20 - skb =3D skb_recv_datagram(sk, flags, noblock, &err); + flags |=3D (noblock ? MSG_DONTWAIT : 0); + skb =3D skb_recv_datagram(sk, flags, &err); if (!skb) goto out; =20 diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c index 9f97b9cbf7b3..c9dd9603f2e7 100644 --- a/net/ipv4/raw.c +++ b/net/ipv4/raw.c @@ -769,7 +769,8 @@ static int raw_recvmsg(struct sock *sk, struct msghdr *= msg, size_t len, goto out; } =20 - skb =3D skb_recv_datagram(sk, flags, noblock, &err); + flags |=3D (noblock ? MSG_DONTWAIT : 0); + skb =3D skb_recv_datagram(sk, flags, &err); if (!skb) goto out; =20 diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index c51d5ce3711c..8bb41f3b246a 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c @@ -477,7 +477,8 @@ static int rawv6_recvmsg(struct sock *sk, struct msghdr= *msg, size_t len, if (np->rxpmtu && np->rxopt.bits.rxpmtu) return ipv6_recv_rxpmtu(sk, msg, len, addr_len); =20 - skb =3D skb_recv_datagram(sk, flags, noblock, &err); + flags |=3D (noblock ? MSG_DONTWAIT : 0); + skb =3D skb_recv_datagram(sk, flags, &err); if (!skb) goto out; =20 diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c index a1760add5bf1..a0385ddbffcf 100644 --- a/net/iucv/af_iucv.c +++ b/net/iucv/af_iucv.c @@ -1223,7 +1223,6 @@ static void iucv_process_message_q(struct sock *sk) static int iucv_sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, int flags) { - int noblock =3D flags & MSG_DONTWAIT; struct sock *sk =3D sock->sk; struct iucv_sock *iucv =3D iucv_sk(sk); unsigned int copied, rlen; @@ -1242,7 +1241,7 @@ static int iucv_sock_recvmsg(struct socket *sock, str= uct msghdr *msg, =20 /* receive/dequeue next skb: * the function understands MSG_PEEK and, thus, does not dequeue skb */ - skb =3D skb_recv_datagram(sk, flags, noblock, &err); + skb =3D skb_recv_datagram(sk, flags, &err); if (!skb) { if (sk->sk_shutdown & RCV_SHUTDOWN) return 0; diff --git a/net/key/af_key.c b/net/key/af_key.c index d93bde657359..c249b84efbb2 100644 --- a/net/key/af_key.c +++ b/net/key/af_key.c @@ -3700,7 +3700,7 @@ static int pfkey_recvmsg(struct socket *sock, struct = msghdr *msg, size_t len, if (flags & ~(MSG_PEEK|MSG_DONTWAIT|MSG_TRUNC|MSG_CMSG_COMPAT)) goto out; =20 - skb =3D skb_recv_datagram(sk, flags, flags & MSG_DONTWAIT, &err); + skb =3D skb_recv_datagram(sk, flags, &err); if (skb =3D=3D NULL) goto out; =20 diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c index b3edafa5fba4..c6a5cc2d88e7 100644 --- a/net/l2tp/l2tp_ip.c +++ b/net/l2tp/l2tp_ip.c @@ -526,7 +526,8 @@ static int l2tp_ip_recvmsg(struct sock *sk, struct msgh= dr *msg, if (flags & MSG_OOB) goto out; =20 - skb =3D skb_recv_datagram(sk, flags, noblock, &err); + flags |=3D (noblock ? MSG_DONTWAIT : 0); + skb =3D skb_recv_datagram(sk, flags, &err); if (!skb) goto out; =20 diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c index d54dbd01d86f..8f76e647adbb 100644 --- a/net/l2tp/l2tp_ip6.c +++ b/net/l2tp/l2tp_ip6.c @@ -672,7 +672,8 @@ static int l2tp_ip6_recvmsg(struct sock *sk, struct msg= hdr *msg, size_t len, if (flags & MSG_ERRQUEUE) return ipv6_recv_error(sk, msg, len, addr_len); =20 - skb =3D skb_recv_datagram(sk, flags, noblock, &err); + flags |=3D (noblock ? MSG_DONTWAIT : 0); + skb =3D skb_recv_datagram(sk, flags, &err); if (!skb) goto out; =20 diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c index bf35710127dd..8be1fdc68a0b 100644 --- a/net/l2tp/l2tp_ppp.c +++ b/net/l2tp/l2tp_ppp.c @@ -191,8 +191,7 @@ static int pppol2tp_recvmsg(struct socket *sock, struct= msghdr *msg, goto end; =20 err =3D 0; - skb =3D skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, - flags & MSG_DONTWAIT, &err); + skb =3D skb_recv_datagram(sk, flags, &err); if (!skb) goto end; =20 diff --git a/net/mctp/af_mctp.c b/net/mctp/af_mctp.c index e22b0cbb2f35..221863afc4b1 100644 --- a/net/mctp/af_mctp.c +++ b/net/mctp/af_mctp.c @@ -216,7 +216,7 @@ static int mctp_recvmsg(struct socket *sock, struct msg= hdr *msg, size_t len, if (flags & ~(MSG_DONTWAIT | MSG_TRUNC | MSG_PEEK)) return -EOPNOTSUPP; =20 - skb =3D skb_recv_datagram(sk, flags, flags & MSG_DONTWAIT, &rc); + skb =3D skb_recv_datagram(sk, flags, &rc); if (!skb) return rc; =20 diff --git a/net/mctp/test/route-test.c b/net/mctp/test/route-test.c index 61205cf40074..24df29e135ed 100644 --- a/net/mctp/test/route-test.c +++ b/net/mctp/test/route-test.c @@ -352,7 +352,7 @@ static void mctp_test_route_input_sk(struct kunit *test) if (params->deliver) { KUNIT_EXPECT_EQ(test, rc, 0); =20 - skb2 =3D skb_recv_datagram(sock->sk, 0, 1, &rc); + skb2 =3D skb_recv_datagram(sock->sk, MSG_DONTWAIT, &rc); KUNIT_EXPECT_NOT_ERR_OR_NULL(test, skb2); KUNIT_EXPECT_EQ(test, skb->len, 1); =20 @@ -360,7 +360,7 @@ static void mctp_test_route_input_sk(struct kunit *test) =20 } else { KUNIT_EXPECT_NE(test, rc, 0); - skb2 =3D skb_recv_datagram(sock->sk, 0, 1, &rc); + skb2 =3D skb_recv_datagram(sock->sk, MSG_DONTWAIT, &rc); KUNIT_EXPECT_PTR_EQ(test, skb2, NULL); } =20 @@ -423,7 +423,7 @@ static void mctp_test_route_input_sk_reasm(struct kunit= *test) rc =3D mctp_route_input(&rt->rt, skb); } =20 - skb2 =3D skb_recv_datagram(sock->sk, 0, 1, &rc); + skb2 =3D skb_recv_datagram(sock->sk, MSG_DONTWAIT, &rc); =20 if (params->rx_len) { KUNIT_EXPECT_NOT_ERR_OR_NULL(test, skb2); @@ -582,7 +582,7 @@ static void mctp_test_route_input_sk_keys(struct kunit = *test) rc =3D mctp_route_input(&rt->rt, skb); =20 /* (potentially) receive message */ - skb2 =3D skb_recv_datagram(sock->sk, 0, 1, &rc); + skb2 =3D skb_recv_datagram(sock->sk, MSG_DONTWAIT, &rc); =20 if (params->deliver) KUNIT_EXPECT_NOT_ERR_OR_NULL(test, skb2); diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 73e9c0a9c187..0cd91f813a3b 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -1931,7 +1931,6 @@ static int netlink_recvmsg(struct socket *sock, struc= t msghdr *msg, size_t len, struct scm_cookie scm; struct sock *sk =3D sock->sk; struct netlink_sock *nlk =3D nlk_sk(sk); - int noblock =3D flags & MSG_DONTWAIT; size_t copied; struct sk_buff *skb, *data_skb; int err, ret; @@ -1941,7 +1940,7 @@ static int netlink_recvmsg(struct socket *sock, struc= t msghdr *msg, size_t len, =20 copied =3D 0; =20 - skb =3D skb_recv_datagram(sk, flags, noblock, &err); + skb =3D skb_recv_datagram(sk, flags, &err); if (skb =3D=3D NULL) goto out; =20 diff --git a/net/netrom/af_netrom.c b/net/netrom/af_netrom.c index fa9dc2ba3941..6f7f4392cffb 100644 --- a/net/netrom/af_netrom.c +++ b/net/netrom/af_netrom.c @@ -1159,7 +1159,8 @@ static int nr_recvmsg(struct socket *sock, struct msg= hdr *msg, size_t size, } =20 /* Now we can treat all alike */ - if ((skb =3D skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, flags & MSG_DON= TWAIT, &er)) =3D=3D NULL) { + skb =3D skb_recv_datagram(sk, flags, &er); + if (!skb) { release_sock(sk); return er; } diff --git a/net/nfc/llcp_sock.c b/net/nfc/llcp_sock.c index 4ca35791c93b..77642d18a3b4 100644 --- a/net/nfc/llcp_sock.c +++ b/net/nfc/llcp_sock.c @@ -821,7 +821,6 @@ static int llcp_sock_sendmsg(struct socket *sock, struc= t msghdr *msg, static int llcp_sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len, int flags) { - int noblock =3D flags & MSG_DONTWAIT; struct sock *sk =3D sock->sk; unsigned int copied, rlen; struct sk_buff *skb, *cskb; @@ -842,7 +841,7 @@ static int llcp_sock_recvmsg(struct socket *sock, struc= t msghdr *msg, if (flags & (MSG_OOB)) return -EOPNOTSUPP; =20 - skb =3D skb_recv_datagram(sk, flags, noblock, &err); + skb =3D skb_recv_datagram(sk, flags, &err); if (!skb) { pr_err("Recv datagram failed state %d %d %d", sk->sk_state, err, sock_error(sk)); diff --git a/net/nfc/rawsock.c b/net/nfc/rawsock.c index 0ca214ab5aef..8dd569765f96 100644 --- a/net/nfc/rawsock.c +++ b/net/nfc/rawsock.c @@ -238,7 +238,6 @@ static int rawsock_sendmsg(struct socket *sock, struct = msghdr *msg, size_t len) static int rawsock_recvmsg(struct socket *sock, struct msghdr *msg, size_t= len, int flags) { - int noblock =3D flags & MSG_DONTWAIT; struct sock *sk =3D sock->sk; struct sk_buff *skb; int copied; @@ -246,7 +245,7 @@ static int rawsock_recvmsg(struct socket *sock, struct = msghdr *msg, size_t len, =20 pr_debug("sock=3D%p sk=3D%p len=3D%zu flags=3D%d\n", sock, sk, len, flags= ); =20 - skb =3D skb_recv_datagram(sk, flags, noblock, &rc); + skb =3D skb_recv_datagram(sk, flags, &rc); if (!skb) return rc; =20 diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 002d2b9c69dd..243566129784 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -3426,7 +3426,7 @@ static int packet_recvmsg(struct socket *sock, struct= msghdr *msg, size_t len, * but then it will block. */ =20 - skb =3D skb_recv_datagram(sk, flags, flags & MSG_DONTWAIT, &err); + skb =3D skb_recv_datagram(sk, flags, &err); =20 /* * An error occurred so return it. Because skb_recv_datagram() diff --git a/net/phonet/datagram.c b/net/phonet/datagram.c index 393e6aa7a592..3f2e62b63dd4 100644 --- a/net/phonet/datagram.c +++ b/net/phonet/datagram.c @@ -123,7 +123,8 @@ static int pn_recvmsg(struct sock *sk, struct msghdr *m= sg, size_t len, MSG_CMSG_COMPAT)) goto out_nofree; =20 - skb =3D skb_recv_datagram(sk, flags, noblock, &rval); + flags |=3D (noblock ? MSG_DONTWAIT : 0); + skb =3D skb_recv_datagram(sk, flags, &rval); if (skb =3D=3D NULL) goto out_nofree; =20 diff --git a/net/phonet/pep.c b/net/phonet/pep.c index 65d463ad8770..441a26706592 100644 --- a/net/phonet/pep.c +++ b/net/phonet/pep.c @@ -772,7 +772,8 @@ static struct sock *pep_sock_accept(struct sock *sk, in= t flags, int *errp, u8 pipe_handle, enabled, n_sb; u8 aligned =3D 0; =20 - skb =3D skb_recv_datagram(sk, 0, flags & O_NONBLOCK, errp); + skb =3D skb_recv_datagram(sk, (flags & O_NONBLOCK) ? MSG_DONTWAIT : 0, + errp); if (!skb) return NULL; =20 @@ -1267,7 +1268,8 @@ static int pep_recvmsg(struct sock *sk, struct msghdr= *msg, size_t len, return -EINVAL; } =20 - skb =3D skb_recv_datagram(sk, flags, noblock, &err); + flags |=3D (noblock ? MSG_DONTWAIT : 0); + skb =3D skb_recv_datagram(sk, flags, &err); lock_sock(sk); if (skb =3D=3D NULL) { if (err =3D=3D -ENOTCONN && sk->sk_state =3D=3D TCP_CLOSE_WAIT) diff --git a/net/qrtr/af_qrtr.c b/net/qrtr/af_qrtr.c index ec2322529727..5c2fb992803b 100644 --- a/net/qrtr/af_qrtr.c +++ b/net/qrtr/af_qrtr.c @@ -1035,8 +1035,7 @@ static int qrtr_recvmsg(struct socket *sock, struct m= sghdr *msg, return -EADDRNOTAVAIL; } =20 - skb =3D skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, - flags & MSG_DONTWAIT, &rc); + skb =3D skb_recv_datagram(sk, flags, &rc); if (!skb) { release_sock(sk); return rc; diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c index 30a1cf4c16c6..bf2d986a6bc3 100644 --- a/net/rose/af_rose.c +++ b/net/rose/af_rose.c @@ -1230,7 +1230,8 @@ static int rose_recvmsg(struct socket *sock, struct m= sghdr *msg, size_t size, return -ENOTCONN; =20 /* Now we can treat all alike */ - if ((skb =3D skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, flags & MSG_DON= TWAIT, &er)) =3D=3D NULL) + skb =3D skb_recv_datagram(sk, flags, &er); + if (!skb) return er; =20 qbit =3D (skb->data[0] & ROSE_Q_BIT) =3D=3D ROSE_Q_BIT; diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 4aed12e94221..6114d69b8a2d 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c @@ -1643,7 +1643,8 @@ static int unix_accept(struct socket *sock, struct so= cket *newsock, int flags, * so that no locks are necessary. */ =20 - skb =3D skb_recv_datagram(sk, 0, flags&O_NONBLOCK, &err); + skb =3D skb_recv_datagram(sk, (flags & O_NONBLOCK) ? MSG_DONTWAIT : 0, + &err); if (!skb) { /* This means receive shutdown. */ if (err =3D=3D 0) @@ -2500,7 +2501,7 @@ static int unix_read_sock(struct sock *sk, read_descr= iptor_t *desc, int used, err; =20 mutex_lock(&u->iolock); - skb =3D skb_recv_datagram(sk, 0, 1, &err); + skb =3D skb_recv_datagram(sk, MSG_DONTWAIT, &err); mutex_unlock(&u->iolock); if (!skb) return err; diff --git a/net/vmw_vsock/vmci_transport.c b/net/vmw_vsock/vmci_transport.c index b17dc9745188..b14f0ed7427b 100644 --- a/net/vmw_vsock/vmci_transport.c +++ b/net/vmw_vsock/vmci_transport.c @@ -1732,19 +1732,16 @@ static int vmci_transport_dgram_dequeue(struct vsoc= k_sock *vsk, int flags) { int err; - int noblock; struct vmci_datagram *dg; size_t payload_len; struct sk_buff *skb; =20 - noblock =3D flags & MSG_DONTWAIT; - if (flags & MSG_OOB || flags & MSG_ERRQUEUE) return -EOPNOTSUPP; =20 /* Retrieve the head sk_buff from the socket's receive queue. */ err =3D 0; - skb =3D skb_recv_datagram(&vsk->sk, flags, noblock, &err); + skb =3D skb_recv_datagram(&vsk->sk, flags, &err); if (!skb) return err; =20 diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index 3a171828638b..6bc2ac8d8146 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c @@ -1315,8 +1315,7 @@ static int x25_recvmsg(struct socket *sock, struct ms= ghdr *msg, size_t size, } else { /* Now we can treat all alike */ release_sock(sk); - skb =3D skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, - flags & MSG_DONTWAIT, &rc); + skb =3D skb_recv_datagram(sk, flags, &rc); lock_sock(sk); if (!skb) goto out; --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2D10C43334 for ; Mon, 20 Jun 2022 13:06:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244517AbiFTNGf (ORCPT ); Mon, 20 Jun 2022 09:06:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244877AbiFTNEF (ORCPT ); Mon, 20 Jun 2022 09:04:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C94D7186E2; Mon, 20 Jun 2022 05:59:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6719761449; Mon, 20 Jun 2022 12:59:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B15EC3411B; Mon, 20 Jun 2022 12:59:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729944; bh=kl2Jl8pVtdaCtWOSZU8we4FgOpLKBGnuHHnJ27uLujE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JZl0FwvwmpvVSpUlsp2PcRdWDMw236l1urPyz+4fX+UQBj5thvzZEV7+Oz7YxbaN2 yFyIVXb3n5Zal2nWwoLpWzof+RBur+wm1NUxjxWzto5FkKEoIcNACAdtv7sYiHRlhO z9sKlCd6bXw8FA0Qge3eliZHXx+25BQvUOF4SBpM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Osterried , Duoming Zhou , Paolo Abeni , Eric Dumazet , "David S. Miller" , Sasha Levin Subject: [PATCH 5.18 082/141] net: ax25: Fix deadlock caused by skb_recv_datagram in ax25_recvmsg Date: Mon, 20 Jun 2022 14:50:20 +0200 Message-Id: <20220620124731.963247984@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Duoming Zhou [ Upstream commit 219b51a6f040fa5367adadd7d58c4dda0896a01d ] The skb_recv_datagram() in ax25_recvmsg() will hold lock_sock and block until it receives a packet from the remote. If the client doesn`t connect to server and calls read() directly, it will not receive any packets forever. As a result, the deadlock will happen. The fail log caused by deadlock is shown below: [ 369.606973] INFO: task ax25_deadlock:157 blocked for more than 245 secon= ds. [ 369.608919] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables = this message. [ 369.613058] Call Trace: [ 369.613315] [ 369.614072] __schedule+0x2f9/0xb20 [ 369.615029] schedule+0x49/0xb0 [ 369.615734] __lock_sock+0x92/0x100 [ 369.616763] ? destroy_sched_domains_rcu+0x20/0x20 [ 369.617941] lock_sock_nested+0x6e/0x70 [ 369.618809] ax25_bind+0xaa/0x210 [ 369.619736] __sys_bind+0xca/0xf0 [ 369.620039] ? do_futex+0xae/0x1b0 [ 369.620387] ? __x64_sys_futex+0x7c/0x1c0 [ 369.620601] ? fpregs_assert_state_consistent+0x19/0x40 [ 369.620613] __x64_sys_bind+0x11/0x20 [ 369.621791] do_syscall_64+0x3b/0x90 [ 369.622423] entry_SYSCALL_64_after_hwframe+0x46/0xb0 [ 369.623319] RIP: 0033:0x7f43c8aa8af7 [ 369.624301] RSP: 002b:00007f43c8197ef8 EFLAGS: 00000246 ORIG_RAX: 000000= 0000000031 [ 369.625756] RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f43c8a= a8af7 [ 369.626724] RDX: 0000000000000010 RSI: 000055768e2021d0 RDI: 00000000000= 00005 [ 369.628569] RBP: 00007f43c8197f00 R08: 0000000000000011 R09: 00007f43c81= 98700 [ 369.630208] R10: 0000000000000000 R11: 0000000000000246 R12: 00007fff845= e6afe [ 369.632240] R13: 00007fff845e6aff R14: 00007f43c8197fc0 R15: 00007f43c81= 98700 This patch replaces skb_recv_datagram() with an open-coded variant of it releasing the socket lock before the __skb_wait_for_more_packets() call and re-acquiring it after such call in order that other functions that need socket lock could be executed. what's more, the socket lock will be released only when recvmsg() will block and that should produce nicer overall behavior. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Suggested-by: Thomas Osterried Signed-off-by: Duoming Zhou Reported-by: Thomas Habets Acked-by: Paolo Abeni Reviewed-by: Eric Dumazet Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- net/ax25/af_ax25.c | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c index 95393bb2760b..4c7030ed8d33 100644 --- a/net/ax25/af_ax25.c +++ b/net/ax25/af_ax25.c @@ -1661,9 +1661,12 @@ static int ax25_recvmsg(struct socket *sock, struct = msghdr *msg, size_t size, int flags) { struct sock *sk =3D sock->sk; - struct sk_buff *skb; + struct sk_buff *skb, *last; + struct sk_buff_head *sk_queue; int copied; int err =3D 0; + int off =3D 0; + long timeo; =20 lock_sock(sk); /* @@ -1675,10 +1678,29 @@ static int ax25_recvmsg(struct socket *sock, struct= msghdr *msg, size_t size, goto out; } =20 - /* Now we can treat all alike */ - skb =3D skb_recv_datagram(sk, flags, &err); - if (skb =3D=3D NULL) - goto out; + /* We need support for non-blocking reads. */ + sk_queue =3D &sk->sk_receive_queue; + skb =3D __skb_try_recv_datagram(sk, sk_queue, flags, &off, &err, &last); + /* If no packet is available, release_sock(sk) and try again. */ + if (!skb) { + if (err !=3D -EAGAIN) + goto out; + release_sock(sk); + timeo =3D sock_rcvtimeo(sk, flags & MSG_DONTWAIT); + while (timeo && !__skb_wait_for_more_packets(sk, sk_queue, &err, + &timeo, last)) { + skb =3D __skb_try_recv_datagram(sk, sk_queue, flags, &off, + &err, &last); + if (skb) + break; + + if (err !=3D -EAGAIN) + goto done; + } + if (!skb) + goto done; + lock_sock(sk); + } =20 if (!sk_to_ax25(sk)->pidincl) skb_pull(skb, 1); /* Remove PID */ @@ -1725,6 +1747,7 @@ static int ax25_recvmsg(struct socket *sock, struct m= sghdr *msg, size_t size, out: release_sock(sk); =20 +done: return err; } =20 --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D549DC43334 for ; Mon, 20 Jun 2022 13:04:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244161AbiFTNDC (ORCPT ); Mon, 20 Jun 2022 09:03:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243364AbiFTNB1 (ORCPT ); Mon, 20 Jun 2022 09:01:27 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE2401D30E; Mon, 20 Jun 2022 05:57:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 2E4F5B811A3; Mon, 20 Jun 2022 12:57:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D1BBC341C4; Mon, 20 Jun 2022 12:57:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729835; bh=4Rx4HJ/h5ecDSnypmxv1UZjjGFyfEiNCr0kUC9xd7iI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zt5SNroMNGBsh0oEay58dK+wewSYtV9rFZH7Ql2sH0Mo1AjV6kHMKo6xUr/chp/D9 PSBNJ907gEPImkSl3UURCcqvi0QmsYIzDkIAPTmzdpCsazhl1ZQJ3XF4WV2wwy1SH2 4UQSv+OO4Wsrabv6qHat2yChJe9aTm/oRCbpHQXg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Rutland , Ard Biesheuvel , Will Deacon , "Ivan T. Ivanov" , Chengming Zhou , Catalin Marinas , Sasha Levin Subject: [PATCH 5.18 083/141] arm64: ftrace: fix branch range checks Date: Mon, 20 Jun 2022 14:50:21 +0200 Message-Id: <20220620124731.994830188@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mark Rutland [ Upstream commit 3eefdf9d1e406f3da47470b2854347009ffcb6fa ] The branch range checks in ftrace_make_call() and ftrace_make_nop() are incorrect, erroneously permitting a forwards branch of 128M and erroneously rejecting a backwards branch of 128M. This is because both functions calculate the offset backwards, calculating the offset *from* the target *to* the branch, rather than the other way around as the later comparisons expect. If an out-of-range branch were erroeously permitted, this would later be rejected by aarch64_insn_gen_branch_imm() as branch_imm_common() checks the bounds correctly, resulting in warnings and the placement of a BRK instruction. Note that this can only happen for a forwards branch of exactly 128M, and so the caller would need to be exactly 128M bytes below the relevant ftrace trampoline. If an in-range branch were erroeously rejected, then: * For modules when CONFIG_ARM64_MODULE_PLTS=3Dy, this would result in the use of a PLT entry, which is benign. Note that this is the common case, as this is selected by CONFIG_RANDOMIZE_BASE (and therefore RANDOMIZE_MODULE_REGION_FULL), which distributions typically seelct. This is also selected by CONFIG_ARM64_ERRATUM_843419. * For modules when CONFIG_ARM64_MODULE_PLTS=3Dn, this would result in internal ftrace failures. * For core kernel text, this would result in internal ftrace failues. Note that for this to happen, the kernel text would need to be at least 128M bytes in size, and typical configurations are smaller tha this. Fix this by calculating the offset *from* the branch *to* the target in both functions. Fixes: f8af0b364e24 ("arm64: ftrace: don't validate branch via PLT in ftrac= e_make_nop()") Fixes: e71a4e1bebaf ("arm64: ftrace: add support for far branches to dynami= c ftrace") Signed-off-by: Mark Rutland Cc: Ard Biesheuvel Cc: Will Deacon Tested-by: "Ivan T. Ivanov" Reviewed-by: Chengming Zhou Reviewed-by: Ard Biesheuvel Link: https://lore.kernel.org/r/20220614080944.1349146-2-mark.rutland@arm.c= om Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/arm64/kernel/ftrace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c index 4506c4a90ac1..d9e3eda419ec 100644 --- a/arch/arm64/kernel/ftrace.c +++ b/arch/arm64/kernel/ftrace.c @@ -84,7 +84,7 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned lon= g addr) { unsigned long pc =3D rec->ip; u32 old, new; - long offset =3D (long)pc - (long)addr; + long offset =3D (long)addr - (long)pc; =20 if (offset < -SZ_128M || offset >=3D SZ_128M) { struct module *mod; @@ -183,7 +183,7 @@ int ftrace_make_nop(struct module *mod, struct dyn_ftra= ce *rec, unsigned long pc =3D rec->ip; bool validate =3D true; u32 old =3D 0, new; - long offset =3D (long)pc - (long)addr; + long offset =3D (long)addr - (long)pc; =20 if (offset < -SZ_128M || offset >=3D SZ_128M) { u32 replaced; --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 477DAC43334 for ; Mon, 20 Jun 2022 13:04:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242821AbiFTNEx (ORCPT ); Mon, 20 Jun 2022 09:04:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244183AbiFTNDD (ORCPT ); Mon, 20 Jun 2022 09:03:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A728FEAA; Mon, 20 Jun 2022 05:57:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 52B7DB811A0; Mon, 20 Jun 2022 12:57:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A16CC3411B; Mon, 20 Jun 2022 12:57:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729871; bh=ibkZ1UquxqXR4dIKAuTJ37fkd7+EmCqIQqT0dN/jzpE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qlXL5k/ru645FHKR4gkPYqcnIDBM3GJgfEPKhmVcR8BohTcZqAOgoIHkKFdBHbVGI DPQO7b6HDTwm538IO/ohEXhoSr2wGlLtHhWYse0fhZUOlY4sVJyiTlftNMoPWjRRa/ 3In3/QG26VAQx8Y3RNzOONlZBlzzqvxj9AXRhDWk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mark Rutland , Ard Biesheuvel , Will Deacon , "Ivan T. Ivanov" , Chengming Zhou , Catalin Marinas , Sasha Levin Subject: [PATCH 5.18 084/141] arm64: ftrace: consistently handle PLTs. Date: Mon, 20 Jun 2022 14:50:22 +0200 Message-Id: <20220620124732.026035646@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mark Rutland [ Upstream commit a6253579977e4c6f7818eeb05bf2bc65678a7187 ] Sometimes it is necessary to use a PLT entry to call an ftrace trampoline. This is handled by ftrace_make_call() and ftrace_make_nop(), with each having *almost* identical logic, but this is not handled by ftrace_modify_call() since its introduction in commit: 3b23e4991fb66f6d ("arm64: implement ftrace with regs") Due to this, if we ever were to call ftrace_modify_call() for a callsite which requires a PLT entry for a trampoline, then either: a) If the old addr requires a trampoline, ftrace_modify_call() will use an out-of-range address to generate the 'old' branch instruction. This will result in warnings from aarch64_insn_gen_branch_imm() and ftrace_modify_code(), and no instructions will be modified. As ftrace_modify_call() will return an error, this will result in subsequent internal ftrace errors. b) If the old addr does not require a trampoline, but the new addr does, ftrace_modify_call() will use an out-of-range address to generate the 'new' branch instruction. This will result in warnings from aarch64_insn_gen_branch_imm(), and ftrace_modify_code() will replace the 'old' branch with a BRK. This will result in a kernel panic when this BRK is later executed. Practically speaking, case (a) is vastly more likely than case (b), and typically this will result in internal ftrace errors that don't necessarily affect the rest of the system. This can be demonstrated with an out-of-tree test module which triggers ftrace_modify_call(), e.g. | # insmod test_ftrace.ko | test_ftrace: Function test_function raw=3D0xffffb3749399201c, callsite=3D= 0xffffb37493992024 | branch_imm_common: offset out of range | branch_imm_common: offset out of range | ------------[ ftrace bug ]------------ | ftrace failed to modify | [] test_function+0x8/0x38 [test_ftrace] | actual: 1d:00:00:94 | Updating ftrace call site to call a different ftrace function | ftrace record flags: e0000002 | (2) R | expected tramp: ffffb374ae42ed54 | ------------[ cut here ]------------ | WARNING: CPU: 0 PID: 165 at kernel/trace/ftrace.c:2085 ftrace_bug+0x280/0= x2b0 | Modules linked in: test_ftrace(+) | CPU: 0 PID: 165 Comm: insmod Not tainted 5.19.0-rc2-00002-g4d9ead8b45ce #= 13 | Hardware name: linux,dummy-virt (DT) | pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=3D--) | pc : ftrace_bug+0x280/0x2b0 | lr : ftrace_bug+0x280/0x2b0 | sp : ffff80000839ba00 | x29: ffff80000839ba00 x28: 0000000000000000 x27: ffff80000839bcf0 | x26: ffffb37493994180 x25: ffffb374b0991c28 x24: ffffb374b0d70000 | x23: 00000000ffffffea x22: ffffb374afcc33b0 x21: ffffb374b08f9cc8 | x20: ffff572b8462c000 x19: ffffb374b08f9000 x18: ffffffffffffffff | x17: 6c6c6163202c6331 x16: ffffb374ae5ad110 x15: ffffb374b0d51ee4 | x14: 0000000000000000 x13: 3435646532346561 x12: 3437336266666666 | x11: 203a706d61727420 x10: 6465746365707865 x9 : ffffb374ae5149e8 | x8 : 336266666666203a x7 : 706d617274206465 x6 : 00000000fffff167 | x5 : ffff572bffbc4a08 x4 : 00000000fffff167 x3 : 0000000000000000 | x2 : 0000000000000000 x1 : ffff572b84461e00 x0 : 0000000000000022 | Call trace: | ftrace_bug+0x280/0x2b0 | ftrace_replace_code+0x98/0xa0 | ftrace_modify_all_code+0xe0/0x144 | arch_ftrace_update_code+0x14/0x20 | ftrace_startup+0xf8/0x1b0 | register_ftrace_function+0x38/0x90 | test_ftrace_init+0xd0/0x1000 [test_ftrace] | do_one_initcall+0x50/0x2b0 | do_init_module+0x50/0x1f0 | load_module+0x17c8/0x1d64 | __do_sys_finit_module+0xa8/0x100 | __arm64_sys_finit_module+0x2c/0x3c | invoke_syscall+0x50/0x120 | el0_svc_common.constprop.0+0xdc/0x100 | do_el0_svc+0x3c/0xd0 | el0_svc+0x34/0xb0 | el0t_64_sync_handler+0xbc/0x140 | el0t_64_sync+0x18c/0x190 | ---[ end trace 0000000000000000 ]--- We can solve this by consistently determining whether to use a PLT entry for an address. Note that since (the earlier) commit: f1a54ae9af0da4d7 ("arm64: module/ftrace: intialize PLT at load time") ... we can consistently determine the PLT address that a given callsite will use, and therefore ftrace_make_nop() does not need to skip validation when a PLT is in use. This patch factors the existing logic out of ftrace_make_call() and ftrace_make_nop() into a common ftrace_find_callable_addr() helper function, which is used by ftrace_make_call(), ftrace_make_nop(), and ftrace_modify_call(). In ftrace_make_nop() the patching is consistently validated by ftrace_modify_code() as we can always determine what the old instruction should have been. Fixes: 3b23e4991fb6 ("arm64: implement ftrace with regs") Signed-off-by: Mark Rutland Cc: Ard Biesheuvel Cc: Will Deacon Tested-by: "Ivan T. Ivanov" Reviewed-by: Chengming Zhou Reviewed-by: Ard Biesheuvel Link: https://lore.kernel.org/r/20220614080944.1349146-3-mark.rutland@arm.c= om Signed-off-by: Catalin Marinas Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/arm64/kernel/ftrace.c | 137 ++++++++++++++++++------------------- 1 file changed, 66 insertions(+), 71 deletions(-) diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c index d9e3eda419ec..f3184cd81b19 100644 --- a/arch/arm64/kernel/ftrace.c +++ b/arch/arm64/kernel/ftrace.c @@ -78,47 +78,76 @@ static struct plt_entry *get_ftrace_plt(struct module *= mod, unsigned long addr) } =20 /* - * Turn on the call to ftrace_caller() in instrumented function + * Find the address the callsite must branch to in order to reach '*addr'. + * + * Due to the limited range of 'BL' instructions, modules may be placed to= o far + * away to branch directly and must use a PLT. + * + * Returns true when '*addr' contains a reachable target address, or has b= een + * modified to contain a PLT address. Returns false otherwise. */ -int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) +static bool ftrace_find_callable_addr(struct dyn_ftrace *rec, + struct module *mod, + unsigned long *addr) { unsigned long pc =3D rec->ip; - u32 old, new; - long offset =3D (long)addr - (long)pc; + long offset =3D (long)*addr - (long)pc; + struct plt_entry *plt; =20 - if (offset < -SZ_128M || offset >=3D SZ_128M) { - struct module *mod; - struct plt_entry *plt; + /* + * When the target is within range of the 'BL' instruction, use 'addr' + * as-is and branch to that directly. + */ + if (offset >=3D -SZ_128M && offset < SZ_128M) + return true; =20 - if (!IS_ENABLED(CONFIG_ARM64_MODULE_PLTS)) - return -EINVAL; + /* + * When the target is outside of the range of a 'BL' instruction, we + * must use a PLT to reach it. We can only place PLTs for modules, and + * only when module PLT support is built-in. + */ + if (!IS_ENABLED(CONFIG_ARM64_MODULE_PLTS)) + return false; =20 - /* - * On kernels that support module PLTs, the offset between the - * branch instruction and its target may legally exceed the - * range of an ordinary relative 'bl' opcode. In this case, we - * need to branch via a trampoline in the module. - * - * NOTE: __module_text_address() must be called with preemption - * disabled, but we can rely on ftrace_lock to ensure that 'mod' - * retains its validity throughout the remainder of this code. - */ + /* + * 'mod' is only set at module load time, but if we end up + * dealing with an out-of-range condition, we can assume it + * is due to a module being loaded far away from the kernel. + * + * NOTE: __module_text_address() must be called with preemption + * disabled, but we can rely on ftrace_lock to ensure that 'mod' + * retains its validity throughout the remainder of this code. + */ + if (!mod) { preempt_disable(); mod =3D __module_text_address(pc); preempt_enable(); + } =20 - if (WARN_ON(!mod)) - return -EINVAL; + if (WARN_ON(!mod)) + return false; =20 - plt =3D get_ftrace_plt(mod, addr); - if (!plt) { - pr_err("ftrace: no module PLT for %ps\n", (void *)addr); - return -EINVAL; - } - - addr =3D (unsigned long)plt; + plt =3D get_ftrace_plt(mod, *addr); + if (!plt) { + pr_err("ftrace: no module PLT for %ps\n", (void *)*addr); + return false; } =20 + *addr =3D (unsigned long)plt; + return true; +} + +/* + * Turn on the call to ftrace_caller() in instrumented function + */ +int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr) +{ + unsigned long pc =3D rec->ip; + u32 old, new; + + if (!ftrace_find_callable_addr(rec, NULL, &addr)) + return -EINVAL; + old =3D aarch64_insn_gen_nop(); new =3D aarch64_insn_gen_branch_imm(pc, addr, AARCH64_INSN_BRANCH_LINK); =20 @@ -132,6 +161,11 @@ int ftrace_modify_call(struct dyn_ftrace *rec, unsigne= d long old_addr, unsigned long pc =3D rec->ip; u32 old, new; =20 + if (!ftrace_find_callable_addr(rec, NULL, &old_addr)) + return -EINVAL; + if (!ftrace_find_callable_addr(rec, NULL, &addr)) + return -EINVAL; + old =3D aarch64_insn_gen_branch_imm(pc, old_addr, AARCH64_INSN_BRANCH_LINK); new =3D aarch64_insn_gen_branch_imm(pc, addr, AARCH64_INSN_BRANCH_LINK); @@ -181,54 +215,15 @@ int ftrace_make_nop(struct module *mod, struct dyn_ft= race *rec, unsigned long addr) { unsigned long pc =3D rec->ip; - bool validate =3D true; u32 old =3D 0, new; - long offset =3D (long)addr - (long)pc; =20 - if (offset < -SZ_128M || offset >=3D SZ_128M) { - u32 replaced; - - if (!IS_ENABLED(CONFIG_ARM64_MODULE_PLTS)) - return -EINVAL; - - /* - * 'mod' is only set at module load time, but if we end up - * dealing with an out-of-range condition, we can assume it - * is due to a module being loaded far away from the kernel. - */ - if (!mod) { - preempt_disable(); - mod =3D __module_text_address(pc); - preempt_enable(); - - if (WARN_ON(!mod)) - return -EINVAL; - } - - /* - * The instruction we are about to patch may be a branch and - * link instruction that was redirected via a PLT entry. In - * this case, the normal validation will fail, but we can at - * least check that we are dealing with a branch and link - * instruction that points into the right module. - */ - if (aarch64_insn_read((void *)pc, &replaced)) - return -EFAULT; - - if (!aarch64_insn_is_bl(replaced) || - !within_module(pc + aarch64_get_branch_offset(replaced), - mod)) - return -EINVAL; - - validate =3D false; - } else { - old =3D aarch64_insn_gen_branch_imm(pc, addr, - AARCH64_INSN_BRANCH_LINK); - } + if (!ftrace_find_callable_addr(rec, mod, &addr)) + return -EINVAL; =20 + old =3D aarch64_insn_gen_branch_imm(pc, addr, AARCH64_INSN_BRANCH_LINK); new =3D aarch64_insn_gen_nop(); =20 - return ftrace_modify_code(pc, old, new, validate); + return ftrace_modify_code(pc, old, new, true); } =20 void arch_ftrace_update_code(int command) --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6616EC433EF for ; Mon, 20 Jun 2022 13:05:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244577AbiFTNFq (ORCPT ); Mon, 20 Jun 2022 09:05:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244601AbiFTNDr (ORCPT ); Mon, 20 Jun 2022 09:03:47 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 285F51ADAB; Mon, 20 Jun 2022 05:58:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 639CBB81092; Mon, 20 Jun 2022 12:58:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E2C2C3411B; Mon, 20 Jun 2022 12:58:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729905; bh=KRnyYm02/M04mY5xe4aX4sVWRy2Xqe+5jAymsdFwhho=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NJhtPZ6SxJRKd6pwu+NwyiatBXHmc+vnlSP3PFH6ZNx/dfrDRkU2HyoouxQUwUYeT rM+oD4SoWOwYXTKLQtZmuvEGVisOlSCpSIZ0gdG2ht0T/EsdyxBi1OeGgdWWshKJld d2QYaLAPApH+gKch6mSTXqqmfoUwl5Pn8WIJZPW0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masahiro Yamada , Jarkko Sakkinen , =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= , Sasha Levin Subject: [PATCH 5.18 085/141] certs/blacklist_hashes.c: fix const confusion in certs blacklist Date: Mon, 20 Jun 2022 14:50:23 +0200 Message-Id: <20220620124732.058316706@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Masahiro Yamada [ Upstream commit 6a1c3767d82ed8233de1263aa7da81595e176087 ] This file fails to compile as follows: CC certs/blacklist_hashes.o certs/blacklist_hashes.c:4:1: error: ignoring attribute =E2=80=98section ("= .init.data")=E2=80=99 because it conflicts with previous =E2=80=98section (= ".init.rodata")=E2=80=99 [-Werror=3Dattributes] 4 | const char __initdata *const blacklist_hashes[] =3D { | ^~~~~ In file included from certs/blacklist_hashes.c:2: certs/blacklist.h:5:38: note: previous declaration here 5 | extern const char __initconst *const blacklist_hashes[]; | ^~~~~~~~~~~~~~~~ Apply the same fix as commit 2be04df5668d ("certs/blacklist_nohashes.c: fix const confusion in certs blacklist"). Fixes: 734114f8782f ("KEYS: Add a system blacklist keyring") Signed-off-by: Masahiro Yamada Reviewed-by: Jarkko Sakkinen Reviewed-by: Micka=C3=ABl Sala=C3=BCn Signed-off-by: Jarkko Sakkinen Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- certs/blacklist_hashes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/certs/blacklist_hashes.c b/certs/blacklist_hashes.c index 344892337be0..d5961aa3d338 100644 --- a/certs/blacklist_hashes.c +++ b/certs/blacklist_hashes.c @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 #include "blacklist.h" =20 -const char __initdata *const blacklist_hashes[] =3D { +const char __initconst *const blacklist_hashes[] =3D { #include CONFIG_SYSTEM_BLACKLIST_HASH_LIST , NULL }; --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C092C433EF for ; Mon, 20 Jun 2022 13:06:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244962AbiFTNGM (ORCPT ); Mon, 20 Jun 2022 09:06:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244830AbiFTNEC (ORCPT ); Mon, 20 Jun 2022 09:04:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3B78192B6; Mon, 20 Jun 2022 05:58:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6C75561449; Mon, 20 Jun 2022 12:58:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78914C3411B; Mon, 20 Jun 2022 12:58:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729926; bh=sNT+9tqr5huqBOqoeTeyLHCWgjIGaTKgwJ3WrQ79i+E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aayacWws3If5BoCtRoqdFKUhOPGSgUAD+zGyWgjO1Z3D+EnI8K8485REzBgHA401W vnVyw0mGN/6H+lQwsY1iPP9o5F914YTSNzXc4NDDVSz0L9mqOwbXDNjw24ywhwssm2 6OYumFse5OyKHJCR6+94ZXYitMOLDkH/Q0fet7Vw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Jan Kara , Sasha Levin , Suzuki K Poulose , Alexandru Elisei , Guenter Roeck Subject: [PATCH 5.18 086/141] init: Initialize noop_backing_dev_info early Date: Mon, 20 Jun 2022 14:50:24 +0200 Message-Id: <20220620124732.088156973@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jan Kara [ Upstream commit 4bca7e80b6455772b4bf3f536dcbc19aac424d6a ] noop_backing_dev_info is used by superblocks of various pseudofilesystems such as kdevtmpfs. After commit 10e14073107d ("writeback: Fix inode->i_io_list not be protected by inode->i_lock error") this broke because __mark_inode_dirty() started to access more fields from noop_backing_dev_info and this led to crashes inside locked_inode_to_wb_and_lock_list() called from __mark_inode_dirty(). Fix the problem by initializing noop_backing_dev_info before the filesystems get mounted. Fixes: 10e14073107d ("writeback: Fix inode->i_io_list not be protected by i= node->i_lock error") Reported-and-tested-by: Suzuki K Poulose Reported-and-tested-by: Alexandru Elisei Reported-and-tested-by: Guenter Roeck Reviewed-by: Christoph Hellwig Signed-off-by: Jan Kara Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/base/init.c | 2 ++ include/linux/backing-dev.h | 2 ++ mm/backing-dev.c | 11 ++--------- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/base/init.c b/drivers/base/init.c index d8d0fe687111..397eb9880cec 100644 --- a/drivers/base/init.c +++ b/drivers/base/init.c @@ -8,6 +8,7 @@ #include #include #include +#include =20 #include "base.h" =20 @@ -20,6 +21,7 @@ void __init driver_init(void) { /* These are the core pieces */ + bdi_init(&noop_backing_dev_info); devtmpfs_init(); devices_init(); buses_init(); diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index 87ce24d238f3..8c2eed1b69c1 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h @@ -121,6 +121,8 @@ int bdi_set_max_ratio(struct backing_dev_info *bdi, uns= igned int max_ratio); =20 extern struct backing_dev_info noop_backing_dev_info; =20 +int bdi_init(struct backing_dev_info *bdi); + /** * writeback_in_progress - determine whether there is writeback in progress * @wb: bdi_writeback of interest diff --git a/mm/backing-dev.c b/mm/backing-dev.c index 7176af65b103..e262739a0a23 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c @@ -230,20 +230,13 @@ static __init int bdi_class_init(void) } postcore_initcall(bdi_class_init); =20 -static int bdi_init(struct backing_dev_info *bdi); - static int __init default_bdi_init(void) { - int err; - bdi_wq =3D alloc_workqueue("writeback", WQ_MEM_RECLAIM | WQ_UNBOUND | WQ_SYSFS, 0); if (!bdi_wq) return -ENOMEM; - - err =3D bdi_init(&noop_backing_dev_info); - - return err; + return 0; } subsys_initcall(default_bdi_init); =20 @@ -782,7 +775,7 @@ static void cgwb_remove_from_bdi_list(struct bdi_writeb= ack *wb) =20 #endif /* CONFIG_CGROUP_WRITEBACK */ =20 -static int bdi_init(struct backing_dev_info *bdi) +int bdi_init(struct backing_dev_info *bdi) { int ret; =20 --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10E86C433EF for ; Mon, 20 Jun 2022 13:06:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244972AbiFTNGV (ORCPT ); Mon, 20 Jun 2022 09:06:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244839AbiFTNED (ORCPT ); Mon, 20 Jun 2022 09:04:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3936E192BD; Mon, 20 Jun 2022 05: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 EF6CEB811A3; Mon, 20 Jun 2022 12:58:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60E09C3411C; Mon, 20 Jun 2022 12:58:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729929; bh=zF1v78wE+V4e5SLuD5aljk/ixD5fd8h/4NWR5z4xJPQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=x2j74huuUY0aZPS+bESw+2XaSSDrWjOrc9u2iNdsH4o7pxG8iKEOEDhZZ1EF6arc0 0SSTGvJ/E9uUwm3qCnp1Eh65lwJbdAhgSHEWTXyB+Xo+5IoT83BfzCaj1zjF/QDNJB m2JOuCsc8BAmGeSJut5nClKAhpQEounH/BaWqxUw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Ming Lei , Bart Van Assche , Jens Axboe , Sasha Levin Subject: [PATCH 5.18 087/141] block: Fix handling of offline queues in blk_mq_alloc_request_hctx() Date: Mon, 20 Jun 2022 14:50:25 +0200 Message-Id: <20220620124732.116921788@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bart Van Assche [ Upstream commit 14dc7a18abbe4176f5626c13c333670da8e06aa1 ] This patch prevents that test nvme/004 triggers the following: UBSAN: array-index-out-of-bounds in block/blk-mq.h:135:9 index 512 is out of range for type 'long unsigned int [512]' Call Trace: show_stack+0x52/0x58 dump_stack_lvl+0x49/0x5e dump_stack+0x10/0x12 ubsan_epilogue+0x9/0x3b __ubsan_handle_out_of_bounds.cold+0x44/0x49 blk_mq_alloc_request_hctx+0x304/0x310 __nvme_submit_sync_cmd+0x70/0x200 [nvme_core] nvmf_connect_io_queue+0x23e/0x2a0 [nvme_fabrics] nvme_loop_connect_io_queues+0x8d/0xb0 [nvme_loop] nvme_loop_create_ctrl+0x58e/0x7d0 [nvme_loop] nvmf_create_ctrl+0x1d7/0x4d0 [nvme_fabrics] nvmf_dev_write+0xae/0x111 [nvme_fabrics] vfs_write+0x144/0x560 ksys_write+0xb7/0x140 __x64_sys_write+0x42/0x50 do_syscall_64+0x35/0x80 entry_SYSCALL_64_after_hwframe+0x44/0xae Cc: Christoph Hellwig Cc: Ming Lei Fixes: 20e4d8139319 ("blk-mq: simplify queue mapping & schedule with each p= ossisble CPU") Signed-off-by: Bart Van Assche Reviewed-by: Christoph Hellwig Reviewed-by: Ming Lei Link: https://lore.kernel.org/r/20220615210004.1031820-1-bvanassche@acm.org Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- block/blk-mq.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/block/blk-mq.c b/block/blk-mq.c index de7fc6957271..631fb87b4976 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -579,6 +579,8 @@ struct request *blk_mq_alloc_request_hctx(struct reques= t_queue *q, if (!blk_mq_hw_queue_mapped(data.hctx)) goto out_queue_exit; cpu =3D cpumask_first_and(data.hctx->cpumask, cpu_online_mask); + if (cpu >=3D nr_cpu_ids) + goto out_queue_exit; data.ctx =3D __blk_mq_get_ctx(q, cpu); =20 if (!q->elevator) --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 244C2C43334 for ; Mon, 20 Jun 2022 13:06:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244965AbiFTNGT (ORCPT ); Mon, 20 Jun 2022 09:06:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244841AbiFTNED (ORCPT ); Mon, 20 Jun 2022 09:04: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 9DEAE193C0; Mon, 20 Jun 2022 05:58:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3CD3861531; Mon, 20 Jun 2022 12:58:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D445C3411C; Mon, 20 Jun 2022 12:58:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729932; bh=ytZ1+hFyV2RqybENQgs4g/BucLFJXxFLio4+veEmxzc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XRJKcA/DDfNX5NnJL/H08kwpIpNiyL4jh8UWQvLlAjXcDPO8uVul2YWeyI3NNnuYx rvCGxA/I1sVUsp1aRXJW82tuMSD7T8+hEIF9rnyatD7g5uoDqXL6+0JhhfolSqFHv6 ha2OTQppkwdCo1cj1TXwQOBuPA4KxHjG+N/tQidg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peter Zijlstra , Josh Poimboeuf , Sasha Levin Subject: [PATCH 5.18 088/141] faddr2line: Fix overlapping text section failures, the sequel Date: Mon, 20 Jun 2022 14:50:26 +0200 Message-Id: <20220620124732.147178843@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Josh Poimboeuf [ Upstream commit dcea997beed694cbd8705100ca1a6eb0d886de69 ] If a function lives in a section other than .text, but .text also exists in the object, faddr2line may wrongly assume .text. This can result in comically wrong output. For example: $ scripts/faddr2line vmlinux.o enter_from_user_mode+0x1c enter_from_user_mode+0x1c/0x30: find_next_bit at /home/jpoimboe/git/linux/./include/linux/find.h:40 (inlined by) perf_clear_dirty_counters at /home/jpoimboe/git/linux/arch/x= 86/events/core.c:2504 Fix it by passing the section name to addr2line, unless the object file is vmlinux, in which case the symbol table uses absolute addresses. Fixes: 1d1a0e7c5100 ("scripts/faddr2line: Fix overlapping text section fail= ures") Reported-by: Peter Zijlstra Signed-off-by: Josh Poimboeuf Link: https://lore.kernel.org/r/7d25bc1408bd3a750ac26e60d2f2815a5f4a8363.16= 54130536.git.jpoimboe@kernel.org Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- scripts/faddr2line | 45 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/scripts/faddr2line b/scripts/faddr2line index 0e6268d59883..94ed98dd899f 100755 --- a/scripts/faddr2line +++ b/scripts/faddr2line @@ -95,17 +95,25 @@ __faddr2line() { local print_warnings=3D$4 =20 local sym_name=3D${func_addr%+*} - local offset=3D${func_addr#*+} - offset=3D${offset%/*} + local func_offset=3D${func_addr#*+} + func_offset=3D${func_offset%/*} local user_size=3D + local file_type + local is_vmlinux=3D0 [[ $func_addr =3D~ "/" ]] && user_size=3D${func_addr#*/} =20 - if [[ -z $sym_name ]] || [[ -z $offset ]] || [[ $sym_name =3D $func_addr = ]]; then + if [[ -z $sym_name ]] || [[ -z $func_offset ]] || [[ $sym_name =3D $func_= addr ]]; then warn "bad func+offset $func_addr" DONE=3D1 return fi =20 + # vmlinux uses absolute addresses in the section table rather than + # section offsets. + local file_type=3D$(${READELF} --file-header $objfile | + ${AWK} '$1 =3D=3D "Type:" { print $2; exit }') + [[ $file_type =3D "EXEC" ]] && is_vmlinux=3D1 + # Go through each of the object's symbols which match the func name. # In rare cases there might be duplicates, in which case we print all # matches. @@ -114,9 +122,11 @@ __faddr2line() { local sym_addr=3D0x${fields[1]} local sym_elf_size=3D${fields[2]} local sym_sec=3D${fields[6]} + local sec_size + local sec_name =20 # Get the section size: - local sec_size=3D$(${READELF} --section-headers --wide $objfile | + sec_size=3D$(${READELF} --section-headers --wide $objfile | sed 's/\[ /\[/' | ${AWK} -v sec=3D$sym_sec '$1 =3D=3D "[" sec "]" { print "0x" $6; exit }= ') =20 @@ -126,6 +136,17 @@ __faddr2line() { return fi =20 + # Get the section name: + sec_name=3D$(${READELF} --section-headers --wide $objfile | + sed 's/\[ /\[/' | + ${AWK} -v sec=3D$sym_sec '$1 =3D=3D "[" sec "]" { print $2; exit }') + + if [[ -z $sec_name ]]; then + warn "bad section name: section: $sym_sec" + DONE=3D1 + return + fi + # Calculate the symbol size. # # Unfortunately we can't use the ELF size, because kallsyms @@ -174,10 +195,10 @@ __faddr2line() { =20 sym_size=3D0x$(printf %x $sym_size) =20 - # Calculate the section address from user-supplied offset: - local addr=3D$(($sym_addr + $offset)) + # Calculate the address from user-supplied offset: + local addr=3D$(($sym_addr + $func_offset)) if [[ -z $addr ]] || [[ $addr =3D 0 ]]; then - warn "bad address: $sym_addr + $offset" + warn "bad address: $sym_addr + $func_offset" DONE=3D1 return fi @@ -191,9 +212,9 @@ __faddr2line() { fi =20 # Make sure the provided offset is within the symbol's range: - if [[ $offset -gt $sym_size ]]; then + if [[ $func_offset -gt $sym_size ]]; then [[ $print_warnings =3D 1 ]] && - echo "skipping $sym_name address at $addr due to size mismatch ($offse= t > $sym_size)" + echo "skipping $sym_name address at $addr due to size mismatch ($func_= offset > $sym_size)" continue fi =20 @@ -202,11 +223,13 @@ __faddr2line() { [[ $FIRST =3D 0 ]] && echo FIRST=3D0 =20 - echo "$sym_name+$offset/$sym_size:" + echo "$sym_name+$func_offset/$sym_size:" =20 # Pass section address to addr2line and strip absolute paths # from the output: - local output=3D$(${ADDR2LINE} -fpie $objfile $addr | sed "s; $dir_prefix= \(\./\)*; ;") + local args=3D"--functions --pretty-print --inlines --exe=3D$objfile" + [[ $is_vmlinux =3D 0 ]] && args=3D"$args --section=3D$sec_name" + local output=3D$(${ADDR2LINE} $args $addr | sed "s; $dir_prefix\(\./\)*;= ;") [[ -z $output ]] && continue =20 # Default output (non --list): --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1475BC433EF for ; Mon, 20 Jun 2022 13:06:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244989AbiFTNGZ (ORCPT ); Mon, 20 Jun 2022 09:06:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47376 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244855AbiFTNEE (ORCPT ); Mon, 20 Jun 2022 09:04:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 501C71ADB4; Mon, 20 Jun 2022 05:58:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0AD7CB811A6; Mon, 20 Jun 2022 12:58:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2DEAEC3411B; Mon, 20 Jun 2022 12:58:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729935; bh=hoomPFvizVhvLiU8GGXlQ5OeL4zUjz8Sg1399iIawpg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jmsjvorF7akC2HHLoJpKIM3hLtfacVs120xx7ynyWyeNUXxykh/7sk3wkpq4+L4zm Ykk8q1y4nQSpAk/8WxHltgjYb4rS1er+9e3aZwgy3NB/3Dtjf9ues+Evvwpq+KJrtq WEKupau2aQjS3i5GmO1VxLscN4upIWYlA3Lf8brk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, kernel test robot , Josh Poimboeuf , Sasha Levin Subject: [PATCH 5.18 089/141] x86/ftrace: Remove OBJECT_FILES_NON_STANDARD usage Date: Mon, 20 Jun 2022 14:50:27 +0200 Message-Id: <20220620124732.176155347@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Josh Poimboeuf [ Upstream commit 7b6c7a877cc616bc7dc9cd39646fe454acbed48b ] The file-wide OBJECT_FILES_NON_STANDARD annotation is used with CONFIG_FRAME_POINTER to tell objtool to skip the entire file when frame pointers are enabled. However that annotation is now deprecated because it doesn't work with IBT, where objtool runs on vmlinux.o instead of individual translation units. Instead, use more fine-grained function-specific annotations: - The 'save_mcount_regs' macro does funny things with the frame pointer. Use STACK_FRAME_NON_STANDARD_FP to tell objtool to ignore the functions using it. - The return_to_handler() "function" isn't actually a callable function. Instead of being called, it's returned to. The real return address isn't on the stack, so unwinding is already doomed no matter which unwinder is used. So just remove the STT_FUNC annotation, telling objtool to ignore it. That also removes the implicit ANNOTATE_NOENDBR, which now needs to be made explicit. Fixes the following warning: vmlinux.o: warning: objtool: __fentry__+0x16: return with modified stack = frame Fixes: ed53a0d97192 ("x86/alternative: Use .ibt_endbr_seal to seal indirect= calls") Reported-by: kernel test robot Signed-off-by: Josh Poimboeuf Link: https://lore.kernel.org/r/b7a7a42fe306aca37826043dac89e113a1acdbac.16= 54268610.git.jpoimboe@kernel.org Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/x86/kernel/Makefile | 4 ---- arch/x86/kernel/ftrace_64.S | 11 ++++++++--- include/linux/objtool.h | 6 ++++++ tools/include/linux/objtool.h | 6 ++++++ 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index c41ef42adbe8..25828e4c6237 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile @@ -36,10 +36,6 @@ KCSAN_SANITIZE :=3D n =20 OBJECT_FILES_NON_STANDARD_test_nx.o :=3D y =20 -ifdef CONFIG_FRAME_POINTER -OBJECT_FILES_NON_STANDARD_ftrace_$(BITS).o :=3D y -endif - # If instrumentation of this dir is enabled, boot hangs during first secon= d. # Probably could be more selective here, but note that files related to ir= qs, # boot, dumpstack/stacktrace, etc are either non-interesting or can lead to diff --git a/arch/x86/kernel/ftrace_64.S b/arch/x86/kernel/ftrace_64.S index 4ec13608d3c6..dfeb227de561 100644 --- a/arch/x86/kernel/ftrace_64.S +++ b/arch/x86/kernel/ftrace_64.S @@ -175,6 +175,7 @@ SYM_INNER_LABEL(ftrace_caller_end, SYM_L_GLOBAL) =20 jmp ftrace_epilogue SYM_FUNC_END(ftrace_caller); +STACK_FRAME_NON_STANDARD_FP(ftrace_caller) =20 SYM_FUNC_START(ftrace_epilogue) /* @@ -282,6 +283,7 @@ SYM_INNER_LABEL(ftrace_regs_caller_end, SYM_L_GLOBAL) jmp ftrace_epilogue =20 SYM_FUNC_END(ftrace_regs_caller) +STACK_FRAME_NON_STANDARD_FP(ftrace_regs_caller) =20 =20 #else /* ! CONFIG_DYNAMIC_FTRACE */ @@ -311,10 +313,14 @@ trace: jmp ftrace_stub SYM_FUNC_END(__fentry__) EXPORT_SYMBOL(__fentry__) +STACK_FRAME_NON_STANDARD_FP(__fentry__) + #endif /* CONFIG_DYNAMIC_FTRACE */ =20 #ifdef CONFIG_FUNCTION_GRAPH_TRACER -SYM_FUNC_START(return_to_handler) +SYM_CODE_START(return_to_handler) + UNWIND_HINT_EMPTY + ANNOTATE_NOENDBR subq $16, %rsp =20 /* Save the return values */ @@ -339,7 +345,6 @@ SYM_FUNC_START(return_to_handler) int3 .Ldo_rop: mov %rdi, (%rsp) - UNWIND_HINT_FUNC RET -SYM_FUNC_END(return_to_handler) +SYM_CODE_END(return_to_handler) #endif diff --git a/include/linux/objtool.h b/include/linux/objtool.h index 586d35720f13..c81ea2264ad8 100644 --- a/include/linux/objtool.h +++ b/include/linux/objtool.h @@ -141,6 +141,12 @@ struct unwind_hint { .popsection .endm =20 +.macro STACK_FRAME_NON_STANDARD_FP func:req +#ifdef CONFIG_FRAME_POINTER + STACK_FRAME_NON_STANDARD \func +#endif +.endm + .macro ANNOTATE_NOENDBR .Lhere_\@: .pushsection .discard.noendbr diff --git a/tools/include/linux/objtool.h b/tools/include/linux/objtool.h index 586d35720f13..c81ea2264ad8 100644 --- a/tools/include/linux/objtool.h +++ b/tools/include/linux/objtool.h @@ -141,6 +141,12 @@ struct unwind_hint { .popsection .endm =20 +.macro STACK_FRAME_NON_STANDARD_FP func:req +#ifdef CONFIG_FRAME_POINTER + STACK_FRAME_NON_STANDARD \func +#endif +.endm + .macro ANNOTATE_NOENDBR .Lhere_\@: .pushsection .discard.noendbr --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4E50C433EF for ; Mon, 20 Jun 2022 13:06:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245004AbiFTNG2 (ORCPT ); Mon, 20 Jun 2022 09:06:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244867AbiFTNEE (ORCPT ); Mon, 20 Jun 2022 09:04:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81FDD1AF36; Mon, 20 Jun 2022 05:59:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 44BD0B811A6; Mon, 20 Jun 2022 12:59:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9C510C3411B; Mon, 20 Jun 2022 12:58:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729939; bh=lLla91eqTYFB82f0dcvV1Wi9WCwmylWUPtyBbfN63Ak=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KCHqdl9D3fosGf/VqVeGpvvZvwVhGnK6HDJU3+3eypwOLa3v52WjNyoAm8dVpfV4m ZRGzhkOWvv2GkGie1orlW02ZB2gryR3Qg516HCCyp82DMZsxol69NPxfyaWt8NDoV8 2JA411zaP/DhKwUbqjKtQSeT+k1ArzJ4nxOrtX/Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiasheng Jiang , Tali Perry , Wolfram Sang , Sasha Levin Subject: [PATCH 5.18 090/141] i2c: npcm7xx: Add check for platform_driver_register Date: Mon, 20 Jun 2022 14:50:28 +0200 Message-Id: <20220620124732.205494349@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jiasheng Jiang [ Upstream commit 6ba12b56b9b844b83ed54fb7ed59fb0eb41e4045 ] As platform_driver_register() could fail, it should be better to deal with the return value in order to maintain the code consisitency. Fixes: 56a1485b102e ("i2c: npcm7xx: Add Nuvoton NPCM I2C controller driver") Signed-off-by: Jiasheng Jiang Acked-by: Tali Perry Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/i2c/busses/i2c-npcm7xx.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm= 7xx.c index c638f2efb97c..743ac20a405c 100644 --- a/drivers/i2c/busses/i2c-npcm7xx.c +++ b/drivers/i2c/busses/i2c-npcm7xx.c @@ -2369,8 +2369,7 @@ static struct platform_driver npcm_i2c_bus_driver =3D= { static int __init npcm_i2c_init(void) { npcm_i2c_debugfs_dir =3D debugfs_create_dir("npcm_i2c", NULL); - platform_driver_register(&npcm_i2c_bus_driver); - return 0; + return platform_driver_register(&npcm_i2c_bus_driver); } module_init(npcm_i2c_init); =20 --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A235C43334 for ; Mon, 20 Jun 2022 13:06:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244005AbiFTNGk (ORCPT ); Mon, 20 Jun 2022 09:06:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244881AbiFTNEF (ORCPT ); Mon, 20 Jun 2022 09:04:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58A8C193CB; Mon, 20 Jun 2022 05:59:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 17C1EB81092; Mon, 20 Jun 2022 12:59:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DD0AC3411B; Mon, 20 Jun 2022 12:59:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729941; bh=OR3RQNyE27ZIpiYht6F5EFvIBUfv9fN4ckMXp3vcjGk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hXDlL5J1m1xtD7XY5ITderRHnBr3u7LM2YX1fDKqiZBcrJoPj0kBXzHwQfDFJbyCx uexurhJ3LF2SeCADydwQQPheVd0ASDreMolURmT1vMjCrf4U9kep6hCcclYfB3Ps6G KybXdRiWfrS6z4ePpn3v7YejonTKslc22774FgBA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Marc Zyngier , Sasha Levin Subject: [PATCH 5.18 091/141] irqchip/gic/realview: Fix refcount leak in realview_gic_of_init Date: Mon, 20 Jun 2022 14:50:29 +0200 Message-Id: <20220620124732.234984349@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit f4b98e314888cc51486421bcf6d52852452ea48b ] of_find_matching_node_and_match() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: 82b0a434b436 ("irqchip/gic/realview: Support more RealView DCC varia= nts") Signed-off-by: Miaoqian Lin Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20220601080930.31005-2-linmq006@gmail.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/irqchip/irq-gic-realview.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/irqchip/irq-gic-realview.c b/drivers/irqchip/irq-gic-r= ealview.c index b4c1924f0255..38fab02ffe9d 100644 --- a/drivers/irqchip/irq-gic-realview.c +++ b/drivers/irqchip/irq-gic-realview.c @@ -57,6 +57,7 @@ realview_gic_of_init(struct device_node *node, struct dev= ice_node *parent) =20 /* The PB11MPCore GIC needs to be configured in the syscon */ map =3D syscon_node_to_regmap(np); + of_node_put(np); if (!IS_ERR(map)) { /* new irq mode with no DCC */ regmap_write(map, REALVIEW_SYS_LOCK_OFFSET, --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 95802CCA479 for ; Mon, 20 Jun 2022 13:03:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243738AbiFTNDS (ORCPT ); Mon, 20 Jun 2022 09:03:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243622AbiFTNBl (ORCPT ); Mon, 20 Jun 2022 09:01:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 339AB1A805; Mon, 20 Jun 2022 05:57:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 71472B811B3; Mon, 20 Jun 2022 12:57:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A09BEC3411B; Mon, 20 Jun 2022 12:57:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729839; bh=0NiU3q04Yw7ZAx4tls9RQONgYiwgPEBbj0htnP3IXHk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gikJ4s+gkI3NjHhaxKF5kQfolC0UMqPQPtkZRGV9wuJRZw3f0QNercwYD7cHWpHDd 8gyHysfT0W+b69UXfklhHiDGTH7UykzF1T+n9XAj/UgyF0/Rv+nWwUKQou715SiYYy lmvco4ee1qzDP6+LnZvInTTz+G9nEI1KjZD7kMdE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Marc Zyngier , Sasha Levin Subject: [PATCH 5.18 092/141] irqchip/apple-aic: Fix refcount leak in build_fiq_affinity Date: Mon, 20 Jun 2022 14:50:30 +0200 Message-Id: <20220620124732.264561958@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit b1ac803f47cb1615468f35cf1ccb553c52087301 ] of_find_node_by_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: a5e8801202b3 ("irqchip/apple-aic: Parse FIQ affinities from device-t= ree") Signed-off-by: Miaoqian Lin Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20220601080930.31005-3-linmq006@gmail.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/irqchip/irq-apple-aic.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/irqchip/irq-apple-aic.c b/drivers/irqchip/irq-apple-ai= c.c index 12dd48727a15..478d0af16d9f 100644 --- a/drivers/irqchip/irq-apple-aic.c +++ b/drivers/irqchip/irq-apple-aic.c @@ -1035,6 +1035,7 @@ static void build_fiq_affinity(struct aic_irq_chip *i= c, struct device_node *aff) continue; =20 cpu =3D of_cpu_node_to_id(cpu_node); + of_node_put(cpu_node); if (WARN_ON(cpu < 0)) continue; =20 --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6254BCCA47C for ; Mon, 20 Jun 2022 13:04:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244116AbiFTNDX (ORCPT ); Mon, 20 Jun 2022 09:03:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243643AbiFTNBn (ORCPT ); Mon, 20 Jun 2022 09:01:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 524AC1D339; Mon, 20 Jun 2022 05:57:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8841761538; Mon, 20 Jun 2022 12:57:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94E16C3411B; Mon, 20 Jun 2022 12:57:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729842; bh=f4ierFhYKiIg4w0A3habm5TSCOLZQu2deHCWmz73H3I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wu7iSQsBAxdp4yL3p+SzKvbFMCYych3yiNw2zGEwkbrcFpTuK2YNnKcn0kLmFkYbm NQSVDxMzzcRxj6sHSItLWHHWWsWHrko9GPiuHxE8yKFKIgD/br0eHzW9G911mNOjtN i4pXstiS4Nkg/mQXOcNogV8M6aX633tlopj9uNUA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Marc Zyngier , Sasha Levin Subject: [PATCH 5.18 093/141] irqchip/apple-aic: Fix refcount leak in aic_of_ic_init Date: Mon, 20 Jun 2022 14:50:31 +0200 Message-Id: <20220620124732.294192757@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit 3d45670fab3c25a7452721e4588cc95c51cda134 ] of_get_child_by_name() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: a5e8801202b3 ("irqchip/apple-aic: Parse FIQ affinities from device-t= ree") Signed-off-by: Miaoqian Lin Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20220601080930.31005-4-linmq006@gmail.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/irqchip/irq-apple-aic.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/irqchip/irq-apple-aic.c b/drivers/irqchip/irq-apple-ai= c.c index 478d0af16d9f..5ac83185ff47 100644 --- a/drivers/irqchip/irq-apple-aic.c +++ b/drivers/irqchip/irq-apple-aic.c @@ -1144,6 +1144,7 @@ static int __init aic_of_ic_init(struct device_node *= node, struct device_node *p for_each_child_of_node(affs, chld) build_fiq_affinity(irqc, chld); } + of_node_put(affs); =20 set_handle_irq(aic_handle_irq); set_handle_fiq(aic_handle_fiq); --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1745BCCA47C for ; Mon, 20 Jun 2022 13:04:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243757AbiFTNEQ (ORCPT ); Mon, 20 Jun 2022 09:04:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243749AbiFTNCH (ORCPT ); Mon, 20 Jun 2022 09:02:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97C281A81E; Mon, 20 Jun 2022 05:57: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 B649B61530; Mon, 20 Jun 2022 12:57:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B34F3C3411B; Mon, 20 Jun 2022 12:57:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729846; bh=MBDHAZqTXSUeB2c4k4h7JnpVLUY9pLughCQPv6UVC4U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ERyDAwjVu+O2KQoHng2Ynjz2OPswkcCOhJErjYNJUiKuxHJqhmPM36JSqIntNVIol e5N9aJSeMyba3LtBC3sL7n/80Tj5bp2/Dlfj3jJVHKLWBXTDTr2EtBpmN/9DWlnhNq E0e8UnMS0goXXWqH/NlV1heOMuTvWHr9Ac0EH9sU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Marc Zyngier , Sasha Levin Subject: [PATCH 5.18 094/141] irqchip/gic-v3: Fix error handling in gic_populate_ppi_partitions Date: Mon, 20 Jun 2022 14:50:32 +0200 Message-Id: <20220620124732.324002525@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit ec8401a429ffee34ccf38cebf3443f8d5ae6cb0d ] of_get_child_by_name() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. When kcalloc fails, it missing of_node_put() and results in refcount leak. Fix this by goto out_put_node label. Fixes: 52085d3f2028 ("irqchip/gic-v3: Dynamically allocate PPI partition de= scriptors") Signed-off-by: Miaoqian Lin Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20220601080930.31005-5-linmq006@gmail.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/irqchip/irq-gic-v3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index 1af2b50f36f3..7855a2d7499e 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -1922,7 +1922,7 @@ static void __init gic_populate_ppi_partitions(struct= device_node *gic_node) =20 gic_data.ppi_descs =3D kcalloc(gic_data.ppi_nr, sizeof(*gic_data.ppi_desc= s), GFP_KERNEL); if (!gic_data.ppi_descs) - return; + goto out_put_node; =20 nr_parts =3D of_get_child_count(parts_node); =20 --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39FB7C433EF for ; Mon, 20 Jun 2022 13:04:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243844AbiFTNET (ORCPT ); Mon, 20 Jun 2022 09:04:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243762AbiFTNCI (ORCPT ); Mon, 20 Jun 2022 09:02:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 984421DA64; Mon, 20 Jun 2022 05:57:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 22FDD61535; Mon, 20 Jun 2022 12:57:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E0074C3411B; Mon, 20 Jun 2022 12:57:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729849; bh=H8rmEyrVTKLzJ7QSvB+TXXUSK8ndpboB0UP/6+u9+Eo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ed9xWTk2OMqXFoYnP1Ml1UD17yszVLFaQAt43d1/tBdF2Ss1Mlkdfy5LhUSoIpLKG iWTjlnTJBH/PEveZqsKeVyXlZyxxa90gDobeDrYedluc8eWOZrtB7znAuM+0wZL4HK 6ob/ZhiS1oDk387eT31WvR6rv5lkttGWJJsoTm1E= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Marc Zyngier , Sasha Levin Subject: [PATCH 5.18 095/141] irqchip/gic-v3: Fix refcount leak in gic_populate_ppi_partitions Date: Mon, 20 Jun 2022 14:50:33 +0200 Message-Id: <20220620124732.353647343@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit fa1ad9d4cc47ca2470cd904ad4519f05d7e43a2b ] of_find_node_by_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. Fixes: e3825ba1af3a ("irqchip/gic-v3: Add support for partitioned PPIs") Signed-off-by: Miaoqian Lin Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20220601080930.31005-6-linmq006@gmail.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/irqchip/irq-gic-v3.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-gic-v3.c b/drivers/irqchip/irq-gic-v3.c index 7855a2d7499e..d5420f9d6219 100644 --- a/drivers/irqchip/irq-gic-v3.c +++ b/drivers/irqchip/irq-gic-v3.c @@ -1963,12 +1963,15 @@ static void __init gic_populate_ppi_partitions(stru= ct device_node *gic_node) continue; =20 cpu =3D of_cpu_node_to_id(cpu_node); - if (WARN_ON(cpu < 0)) + if (WARN_ON(cpu < 0)) { + of_node_put(cpu_node); continue; + } =20 pr_cont("%pOF[%d] ", cpu_node, cpu); =20 cpumask_set_cpu(cpu, &part->mask); + of_node_put(cpu_node); } =20 pr_cont("}\n"); --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42672C433EF for ; Mon, 20 Jun 2022 13:04:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243922AbiFTNEX (ORCPT ); Mon, 20 Jun 2022 09:04:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243877AbiFTNCN (ORCPT ); Mon, 20 Jun 2022 09:02:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E44EB18343; Mon, 20 Jun 2022 05:57:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0FB4E614EB; Mon, 20 Jun 2022 12:57:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 149D5C3411B; Mon, 20 Jun 2022 12:57:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729852; bh=HR7GqMWbL932M9kWU/TdhBn86PFa6YN1adQ5FdOgz6Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mk9TvBBzPCRuwVSLkvohPobZ5ksiZjXF36wS1EYp4a8/eD6Mu3P2k6uXouqRgoiUr H6BeEwokncE0Cn4sshNcYM6iU6ZegRf+dJwAFyk8BzhGrN+RpKatUV2ujNXwOj5tQe uoYY05nSBEwLxrLPf+2/HH7ixTEF7+PVxpmDtRE8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaoqian Lin , Marc Zyngier , Sasha Levin Subject: [PATCH 5.18 096/141] irqchip/realtek-rtl: Fix refcount leak in map_interrupts Date: Mon, 20 Jun 2022 14:50:34 +0200 Message-Id: <20220620124732.382809166@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin [ Upstream commit eff4780f83d0ae3e5b6c02ff5d999dc4c1c5c8ce ] of_find_node_by_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. This function doesn't call of_node_put() in error path. Call of_node_put() directly after of_property_read_u32() to cover both normal path and error path. Fixes: 9f3a0f34b84a ("irqchip: Add support for Realtek RTL838x/RTL839x inte= rrupt controller") Signed-off-by: Miaoqian Lin Signed-off-by: Marc Zyngier Link: https://lore.kernel.org/r/20220601080930.31005-7-linmq006@gmail.com Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/irqchip/irq-realtek-rtl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/irqchip/irq-realtek-rtl.c b/drivers/irqchip/irq-realte= k-rtl.c index 50a56820c99b..56bf502d9c67 100644 --- a/drivers/irqchip/irq-realtek-rtl.c +++ b/drivers/irqchip/irq-realtek-rtl.c @@ -134,9 +134,9 @@ static int __init map_interrupts(struct device_node *no= de, struct irq_domain *do if (!cpu_ictl) return -EINVAL; ret =3D of_property_read_u32(cpu_ictl, "#interrupt-cells", &tmp); + of_node_put(cpu_ictl); if (ret || tmp !=3D 1) return -EINVAL; - of_node_put(cpu_ictl); =20 cpu_int =3D be32_to_cpup(imap + 2); if (cpu_int > 7 || cpu_int < 2) --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D4C4C43334 for ; Mon, 20 Jun 2022 13:04:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244033AbiFTNEb (ORCPT ); Mon, 20 Jun 2022 09:04:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244023AbiFTNCR (ORCPT ); Mon, 20 Jun 2022 09:02:17 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 511E219008; Mon, 20 Jun 2022 05:57: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 EAE78B811A3; Mon, 20 Jun 2022 12:57:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C3C9C3411B; Mon, 20 Jun 2022 12:57:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729855; bh=fhDHOpT5UB8R05poRAfCYJlJkd3xObPZ2ivB/X4YfXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=haWxKm2WMylIhAmMSH13tBZgbwZ7ULLRVbnJQz3WEMD+rmithK3SoW7jLvH6nWT45 E+XfL5p4oyaIbc4i/26//ApaSbP/ekTFuEbGwuuS1hOCLE0oSSYEZWLAUf+4Fv9oaF MrMEQ3Ckgmk8R/Y53WEOBbLOR5hcDHPbtfozSIXs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jing-Ting Wu , "Peter Zijlstra (Intel)" , Sasha Levin Subject: [PATCH 5.18 097/141] sched: Fix balance_push() vs __sched_setscheduler() Date: Mon, 20 Jun 2022 14:50:35 +0200 Message-Id: <20220620124732.411011417@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peter Zijlstra [ Upstream commit 04193d590b390ec7a0592630f46d559ec6564ba1 ] The purpose of balance_push() is to act as a filter on task selection in the case of CPU hotplug, specifically when taking the CPU out. It does this by (ab)using the balance callback infrastructure, with the express purpose of keeping all the unlikely/odd cases in a single place. In order to serve its purpose, the balance_push_callback needs to be (exclusively) on the callback list at all times (noting that the callback always places itself back on the list the moment it runs, also noting that when the CPU goes down, regular balancing concerns are moot, so ignoring them is fine). And here-in lies the problem, __sched_setscheduler()'s use of splice_balance_callbacks() takes the callbacks off the list across a lock-break, making it possible for, an interleaving, __schedule() to see an empty list and not get filtered. Fixes: ae7927023243 ("sched: Optimize finish_lock_switch()") Reported-by: Jing-Ting Wu Signed-off-by: Peter Zijlstra (Intel) Tested-by: Jing-Ting Wu Link: https://lkml.kernel.org/r/20220519134706.GH2578@worktop.programming.k= icks-ass.net Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- kernel/sched/core.c | 36 +++++++++++++++++++++++++++++++++--- kernel/sched/sched.h | 5 +++++ 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index e58d894df207..dd11daa7a84b 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -4755,25 +4755,55 @@ static void do_balance_callbacks(struct rq *rq, str= uct callback_head *head) =20 static void balance_push(struct rq *rq); =20 +/* + * balance_push_callback is a right abuse of the callback interface and pl= ays + * by significantly different rules. + * + * Where the normal balance_callback's purpose is to be ran in the same co= ntext + * that queued it (only later, when it's safe to drop rq->lock again), + * balance_push_callback is specifically targeted at __schedule(). + * + * This abuse is tolerated because it places all the unlikely/odd cases be= hind + * a single test, namely: rq->balance_callback =3D=3D NULL. + */ struct callback_head balance_push_callback =3D { .next =3D NULL, .func =3D (void (*)(struct callback_head *))balance_push, }; =20 -static inline struct callback_head *splice_balance_callbacks(struct rq *rq) +static inline struct callback_head * +__splice_balance_callbacks(struct rq *rq, bool split) { struct callback_head *head =3D rq->balance_callback; =20 + if (likely(!head)) + return NULL; + lockdep_assert_rq_held(rq); - if (head) + /* + * Must not take balance_push_callback off the list when + * splice_balance_callbacks() and balance_callbacks() are not + * in the same rq->lock section. + * + * In that case it would be possible for __schedule() to interleave + * and observe the list empty. + */ + if (split && head =3D=3D &balance_push_callback) + head =3D NULL; + else rq->balance_callback =3D NULL; =20 return head; } =20 +static inline struct callback_head *splice_balance_callbacks(struct rq *rq) +{ + return __splice_balance_callbacks(rq, true); +} + static void __balance_callbacks(struct rq *rq) { - do_balance_callbacks(rq, splice_balance_callbacks(rq)); + do_balance_callbacks(rq, __splice_balance_callbacks(rq, false)); } =20 static inline void balance_callbacks(struct rq *rq, struct callback_head *= head) diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 0d2b6b758f32..84bba67c92dc 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -1686,6 +1686,11 @@ queue_balance_callback(struct rq *rq, { lockdep_assert_rq_held(rq); =20 + /* + * Don't (re)queue an already queued item; nor queue anything when + * balance_push() is active, see the comment with + * balance_push_callback. + */ if (unlikely(head->next || rq->balance_callback =3D=3D &balance_push_call= back)) return; =20 --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F170CCA47C for ; Mon, 20 Jun 2022 13:04:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242814AbiFTNEN (ORCPT ); Mon, 20 Jun 2022 09:04:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244033AbiFTNCT (ORCPT ); Mon, 20 Jun 2022 09:02:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB3E91902F; Mon, 20 Jun 2022 05:57: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 63819614EB; Mon, 20 Jun 2022 12:57:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59688C3411B; Mon, 20 Jun 2022 12:57:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729858; bh=6Ww8T925plAXP9KXKy5Qsr7chuYGPuqQ/V8sF+0yUnE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u4ilDCj7ddwso7TeA2G79YvI1qsnVXiDhC3i6L10/hPRyNAO54pqUWyIHqdG864dM x4oefS1ekeAs3tUK0QXHbzKrU+nb1GDjTwyuu4HeP1Av1fckH7W/6JyQzV//KfXA0i 0iFNyFmBZHvdT2v4e4AQHOCMwIhzQjYj5W0IlsO0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Semin , Andy Shevchenko , Jarkko Nikula , Wolfram Sang , Sasha Levin Subject: [PATCH 5.18 098/141] i2c: designware: Use standard optional ref clock implementation Date: Mon, 20 Jun 2022 14:50:36 +0200 Message-Id: <20220620124732.441524559@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Serge Semin [ Upstream commit 27071b5cbca59d8e8f8750c199a6cbf8c9799963 ] Even though the DW I2C controller reference clock source is requested by the method devm_clk_get() with non-optional clock requirement the way the clock handler is used afterwards has a pure optional clock semantic (though in some circumstances we can get a warning about the clock missing printed in the system console). There is no point in reimplementing that functionality seeing the kernel clock framework already supports the optional interface from scratch. Thus let's convert the platform driver to using it. Note by providing this commit we get to fix two problems. The first one was introduced in commit c62ebb3d5f0d ("i2c: designware: Add support for an interface clock"). It causes not having the interface clock (pclk) enabled/disabled in case if the reference clock isn't provided. The second problem was first introduced in commit b33af11de236 ("i2c: designware: Do not require clock when SSCN and FFCN are provided"). Since that modification the deferred probe procedure has been unsupported in case if the interface clock isn't ready. Fixes: c62ebb3d5f0d ("i2c: designware: Add support for an interface clock") Fixes: b33af11de236 ("i2c: designware: Do not require clock when SSCN and F= FCN are provided") Signed-off-by: Serge Semin Reviewed-by: Andy Shevchenko Acked-by: Jarkko Nikula Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/i2c/busses/i2c-designware-common.c | 3 --- drivers/i2c/busses/i2c-designware-platdrv.c | 13 +++++++++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-common.c b/drivers/i2c/busse= s/i2c-designware-common.c index 9f8574320eb2..b08e5bc2b64c 100644 --- a/drivers/i2c/busses/i2c-designware-common.c +++ b/drivers/i2c/busses/i2c-designware-common.c @@ -477,9 +477,6 @@ int i2c_dw_prepare_clk(struct dw_i2c_dev *dev, bool pre= pare) { int ret; =20 - if (IS_ERR(dev->clk)) - return PTR_ERR(dev->clk); - if (prepare) { /* Optional interface clock */ ret =3D clk_prepare_enable(dev->pclk); diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/buss= es/i2c-designware-platdrv.c index 70ade5306e45..ba043b547393 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@ -320,8 +320,17 @@ static int dw_i2c_plat_probe(struct platform_device *p= dev) goto exit_reset; } =20 - dev->clk =3D devm_clk_get(&pdev->dev, NULL); - if (!i2c_dw_prepare_clk(dev, true)) { + dev->clk =3D devm_clk_get_optional(&pdev->dev, NULL); + if (IS_ERR(dev->clk)) { + ret =3D PTR_ERR(dev->clk); + goto exit_reset; + } + + ret =3D i2c_dw_prepare_clk(dev, true); + if (ret) + goto exit_reset; + + if (dev->clk) { u64 clk_khz; =20 dev->get_clk_rate_khz =3D i2c_dw_get_clk_rate_khz; --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D6F5C43334 for ; Mon, 20 Jun 2022 13:04:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244118AbiFTNEf (ORCPT ); Mon, 20 Jun 2022 09:04:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243690AbiFTNCV (ORCPT ); Mon, 20 Jun 2022 09:02:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BEF718E26; Mon, 20 Jun 2022 05:57:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AA45861534; Mon, 20 Jun 2022 12:57:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71322C3411C; Mon, 20 Jun 2022 12:57:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729862; bh=2EXsQNU5hkSqQ9HUC7uN4v7vu7aEWBJKHFfKwSsQtMs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R4BpmIm/RdnwcIx0XRmTaKmpjHbiHbVC9axFh4/5bx/j68FVrgDWF4q0QZHx5B1vt A3yjhEelvH4bEVpLWp/Rmvbev8KfToXD9qdGT8WUGOapYa6KsdXCVDBIMEOgQIaqB2 82pflJjcV68bwoCpK5yNVIhuoYn8mIFHrd3LHiy4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , AngeloGioacchino Del Regno , Qii Wang , Wolfram Sang , Sasha Levin Subject: [PATCH 5.18 099/141] i2c: mediatek: Fix an error handling path in mtk_i2c_probe() Date: Mon, 20 Jun 2022 14:50:37 +0200 Message-Id: <20220620124732.471475976@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christophe JAILLET [ Upstream commit de87b603b0919e31578c8fa312a3541f1fb37e1c ] The clsk are prepared, enabled, then disabled. So if an error occurs after the disable step, they are still prepared. Add an error handling path to unprepare the clks in such a case, as already done in the .remove function. Fixes: 8b4fc246c3ff ("i2c: mediatek: Optimize master_xfer() and avoid circu= lar locking") Signed-off-by: Christophe JAILLET Reviewed-by: AngeloGioacchino Del Regno Reviewed-by: Qii Wang Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/i2c/busses/i2c-mt65xx.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65x= x.c index bdecb78bfc26..8e6985354fd5 100644 --- a/drivers/i2c/busses/i2c-mt65xx.c +++ b/drivers/i2c/busses/i2c-mt65xx.c @@ -1420,17 +1420,22 @@ static int mtk_i2c_probe(struct platform_device *pd= ev) if (ret < 0) { dev_err(&pdev->dev, "Request I2C IRQ %d fail\n", irq); - return ret; + goto err_bulk_unprepare; } =20 i2c_set_adapdata(&i2c->adap, i2c); ret =3D i2c_add_adapter(&i2c->adap); if (ret) - return ret; + goto err_bulk_unprepare; =20 platform_set_drvdata(pdev, i2c); =20 return 0; + +err_bulk_unprepare: + clk_bulk_unprepare(I2C_MT65XX_CLK_MAX, i2c->clocks); + + return ret; } =20 static int mtk_i2c_remove(struct platform_device *pdev) --=20 2.35.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87307C43334 for ; Mon, 20 Jun 2022 13:04:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244141AbiFTNEh (ORCPT ); Mon, 20 Jun 2022 09:04:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243866AbiFTNCx (ORCPT ); Mon, 20 Jun 2022 09:02:53 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A93A21A838; Mon, 20 Jun 2022 05:57:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 47E95B811AC; Mon, 20 Jun 2022 12:57:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0A87C3411B; Mon, 20 Jun 2022 12:57:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729865; bh=d+Sd3pkdwyWjKKIEML2KReblaje9FPliZz3Y2tO3UCM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ajggkjv4MaQ2NezJBoz0uYDCMl/6JWCsnIM4HbLAj0prUF7xWiDSns3K98lJfjyiv Fq1+ToR3VxNQszoSS2/KJCdibpgDw2K9nF4D+uWWDz0zYcGzgmo8JPiiABMcKPuvhB aOmH5TLxpQ5YzLdWuxdEn7l6v7fuIG0W6YVyNqkc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Usyskin , Tomas Winkler Subject: [PATCH 5.18 100/141] mei: hbm: drop capability response on early shutdown Date: Mon, 20 Jun 2022 14:50:38 +0200 Message-Id: <20220620124732.501148354@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Usyskin commit 68553650bc9c57c7e530c84e5b2945e9dfe1a560 upstream. Drop HBM responses also in the early shutdown phase where the usual traffic is allowed. Extend the rule that drop HBM responses received during the shutdown phase by also in MEI_DEV_POWERING_DOWN state. This resolves the stall if the driver is stopping in the middle of the link initialization or link reset. Drop the capabilities response on early shutdown. Fixes: 6d7163f2c49f ("mei: hbm: drop hbm responses on early shutdown") Cc: Signed-off-by: Alexander Usyskin Signed-off-by: Tomas Winkler Link: https://lore.kernel.org/r/20220606144225.282375-2-tomas.winkler@intel= .com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/misc/mei/hbm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/misc/mei/hbm.c +++ b/drivers/misc/mei/hbm.c @@ -1351,7 +1351,8 @@ int mei_hbm_dispatch(struct mei_device * =20 if (dev->dev_state !=3D MEI_DEV_INIT_CLIENTS || dev->hbm_state !=3D MEI_HBM_CAP_SETUP) { - if (dev->dev_state =3D=3D MEI_DEV_POWER_DOWN) { + if (dev->dev_state =3D=3D MEI_DEV_POWER_DOWN || + dev->dev_state =3D=3D MEI_DEV_POWERING_DOWN) { dev_dbg(dev->dev, "hbm: capabilities response: on shutdown, ignoring\n= "); return 0; } From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2ED5C433EF for ; Mon, 20 Jun 2022 13:04:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244214AbiFTNEm (ORCPT ); Mon, 20 Jun 2022 09:04:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244123AbiFTNDB (ORCPT ); Mon, 20 Jun 2022 09:03:01 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50414B70; Mon, 20 Jun 2022 05:57:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id B029ACE138A; Mon, 20 Jun 2022 12:57:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A221BC3411B; Mon, 20 Jun 2022 12:57:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729868; bh=orVY5jXm62Jz5UFZUXwbsEjISfrzWWrNVjdLMJi/c1M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dNlorHNZ5X00R9MATbA120V36xxjOXJLLoDppcPVss6Gzc/EjCauWhop1bF1+uWwT egIZNvLYJBT+dg8LaF64w5/Q2MNiPoZ+N95mDdbV88wGauTKqKN/fRKRNpiThO61kE GLEGFTrkEp+7dr+Eze1qpGV3jyTOBqxNLqQoUUH4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alexander Usyskin , Tomas Winkler Subject: [PATCH 5.18 101/141] mei: me: add raptor lake point S DID Date: Mon, 20 Jun 2022 14:50:39 +0200 Message-Id: <20220620124732.530201907@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Alexander Usyskin commit 3ed8c7d39cfef831fe508fc1308f146912fa72e6 upstream. Add Raptor (Point) Lake S device id. Cc: Signed-off-by: Alexander Usyskin Signed-off-by: Tomas Winkler Link: https://lore.kernel.org/r/20220606144225.282375-3-tomas.winkler@intel= .com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/misc/mei/hw-me-regs.h | 2 ++ drivers/misc/mei/pci-me.c | 2 ++ 2 files changed, 4 insertions(+) --- a/drivers/misc/mei/hw-me-regs.h +++ b/drivers/misc/mei/hw-me-regs.h @@ -109,6 +109,8 @@ #define MEI_DEV_ID_ADP_P 0x51E0 /* Alder Lake Point P */ #define MEI_DEV_ID_ADP_N 0x54E0 /* Alder Lake Point N */ =20 +#define MEI_DEV_ID_RPL_S 0x7A68 /* Raptor Lake Point S */ + /* * MEI HW Section */ --- a/drivers/misc/mei/pci-me.c +++ b/drivers/misc/mei/pci-me.c @@ -116,6 +116,8 @@ static const struct pci_device_id mei_me {MEI_PCI_DEVICE(MEI_DEV_ID_ADP_P, MEI_ME_PCH15_CFG)}, {MEI_PCI_DEVICE(MEI_DEV_ID_ADP_N, MEI_ME_PCH15_CFG)}, =20 + {MEI_PCI_DEVICE(MEI_DEV_ID_RPL_S, MEI_ME_PCH15_CFG)}, + /* required last entry */ {0, } }; From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16AE8CCA48B for ; Mon, 20 Jun 2022 13:05:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244828AbiFTNF5 (ORCPT ); Mon, 20 Jun 2022 09:05:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244174AbiFTNDC (ORCPT ); Mon, 20 Jun 2022 09:03:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B54F1638F; Mon, 20 Jun 2022 05:57: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 281E6B811AC; Mon, 20 Jun 2022 12:57:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77971C3411B; Mon, 20 Jun 2022 12:57:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729873; bh=4JFSQuzXKlwBjpQ6WGtJ+U1eZtcTY9mjkDzyax+qtO4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KwqgrjBL37VQHBUNp/BQw7han+ud0eTsgLLTzZVd8A61/ocXy29G6g8TTHR+wGJ5C NGKFh0fHtTv9isbzpx/0ZnL8xm0rJvveb8JSkIulfpyh/R28QswZWM5x3vKArNJtoq 8O6TFvhJQ3y3d/Tej83EMw0mxbxduSFfVs8Xos6U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Johan Hovold , Ian Abbott Subject: [PATCH 5.18 102/141] comedi: vmk80xx: fix expression for tx buffer size Date: Mon, 20 Jun 2022 14:50:40 +0200 Message-Id: <20220620124732.558627125@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ian Abbott commit 242439f7e279d86b3f73b5de724bc67b2f8aeb07 upstream. The expression for setting the size of the allocated bulk TX buffer (`devpriv->usb_tx_buf`) is calling `usb_endpoint_maxp(devpriv->ep_rx)`, which is using the wrong endpoint (should be `devpriv->ep_tx`). Fix it. Fixes: a23461c47482 ("comedi: vmk80xx: fix transfer-buffer overflow") Cc: Johan Hovold Cc: stable@vger.kernel.org # 4.9+ Reviewed-by: Johan Hovold Signed-off-by: Ian Abbott Link: https://lore.kernel.org/r/20220607171819.4121-1-abbotti@mev.co.uk Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/comedi/drivers/vmk80xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/comedi/drivers/vmk80xx.c +++ b/drivers/comedi/drivers/vmk80xx.c @@ -684,7 +684,7 @@ static int vmk80xx_alloc_usb_buffers(str if (!devpriv->usb_rx_buf) return -ENOMEM; =20 - size =3D max(usb_endpoint_maxp(devpriv->ep_rx), MIN_BUF_SIZE); + size =3D max(usb_endpoint_maxp(devpriv->ep_tx), MIN_BUF_SIZE); devpriv->usb_tx_buf =3D kzalloc(size, GFP_KERNEL); if (!devpriv->usb_tx_buf) return -ENOMEM; From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBC75C433EF for ; Mon, 20 Jun 2022 13:04:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244271AbiFTNE4 (ORCPT ); Mon, 20 Jun 2022 09:04:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47300 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244227AbiFTNDI (ORCPT ); Mon, 20 Jun 2022 09:03:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7391EB1F7; Mon, 20 Jun 2022 05:57:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 44A39B811A6; Mon, 20 Jun 2022 12:57:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78F1EC3411B; Mon, 20 Jun 2022 12:57:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729877; bh=tQKn/EbEcY+9a2d60iclDa6J6QSnSRU9KOJuxkUJTDU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RA2Phs03glKAd9w2I1aYQR6VfjZEI2BE8yL/7xir8H0szmuUtVAQDjITUxjnP2tYi B9rtotYCgAa0QY9tD1VcidnODI+ihCzFXxxjiEYjAIzaalC8y2k12esc5q5q8xnfQR glDKUvKuabvA9QLxyP1lk3+K5Cy6AGXeBF0+r900= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheng Bin , Eric Biggers , "Jason A. Donenfeld" , Eric Biggers , Herbert Xu Subject: [PATCH 5.18 103/141] crypto: memneq - move into lib/ Date: Mon, 20 Jun 2022 14:50:41 +0200 Message-Id: <20220620124732.588490132@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jason A. Donenfeld commit abfed87e2a12bd246047d78c01d81eb9529f1d06 upstream. This is used by code that doesn't need CONFIG_CRYPTO, so move this into lib/ with a Kconfig option so that it can be selected by whatever needs it. This fixes a linker error Zheng pointed out when CRYPTO_MANAGER_DISABLE_TESTS!=3Dy and CRYPTO=3Dm: lib/crypto/curve25519-selftest.o: In function `curve25519_selftest': curve25519-selftest.c:(.init.text+0x60): undefined reference to `__crypto= _memneq' curve25519-selftest.c:(.init.text+0xec): undefined reference to `__crypto= _memneq' curve25519-selftest.c:(.init.text+0x114): undefined reference to `__crypt= o_memneq' curve25519-selftest.c:(.init.text+0x154): undefined reference to `__crypt= o_memneq' Reported-by: Zheng Bin Cc: Eric Biggers Cc: stable@vger.kernel.org Fixes: aa127963f1ca ("crypto: lib/curve25519 - re-add selftests") Signed-off-by: Jason A. Donenfeld Reviewed-by: Eric Biggers Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- crypto/Kconfig | 1 + crypto/Makefile | 2 +- lib/Kconfig | 3 +++ lib/Makefile | 1 + lib/crypto/Kconfig | 1 + {crypto =3D> lib}/memneq.c | 0 crypto/Kconfig | 1=20 crypto/Makefile | 2=20 crypto/memneq.c | 176 ------------------------------------------------= ----- lib/Kconfig | 3=20 lib/Makefile | 1=20 lib/crypto/Kconfig | 1=20 lib/memneq.c | 176 ++++++++++++++++++++++++++++++++++++++++++++++++= +++++ 7 files changed, 183 insertions(+), 177 deletions(-) rename {crypto =3D> lib}/memneq.c (100%) --- a/crypto/Kconfig +++ b/crypto/Kconfig @@ -15,6 +15,7 @@ source "crypto/async_tx/Kconfig" # menuconfig CRYPTO tristate "Cryptographic API" + select LIB_MEMNEQ help This option provides the core Cryptographic API. =20 --- a/crypto/Makefile +++ b/crypto/Makefile @@ -4,7 +4,7 @@ # =20 obj-$(CONFIG_CRYPTO) +=3D crypto.o -crypto-y :=3D api.o cipher.o compress.o memneq.o +crypto-y :=3D api.o cipher.o compress.o =20 obj-$(CONFIG_CRYPTO_ENGINE) +=3D crypto_engine.o obj-$(CONFIG_CRYPTO_FIPS) +=3D fips.o --- a/crypto/memneq.c +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Constant-time equality testing of memory regions. - * - * Authors: - * - * James Yonan - * Daniel Borkmann - * - * This file is provided under a dual BSD/GPLv2 license. When using or - * redistributing this file, you may do so under either license. - * - * GPL LICENSE SUMMARY - * - * Copyright(c) 2013 OpenVPN Technologies, Inc. All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 U= SA. - * The full GNU General Public License is included in this distribution - * in the file called LICENSE.GPL. - * - * BSD LICENSE - * - * Copyright(c) 2013 OpenVPN Technologies, Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * * Neither the name of OpenVPN Technologies nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include - -#ifndef __HAVE_ARCH_CRYPTO_MEMNEQ - -/* Generic path for arbitrary size */ -static inline unsigned long -__crypto_memneq_generic(const void *a, const void *b, size_t size) -{ - unsigned long neq =3D 0; - -#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) - while (size >=3D sizeof(unsigned long)) { - neq |=3D get_unaligned((unsigned long *)a) ^ - get_unaligned((unsigned long *)b); - OPTIMIZER_HIDE_VAR(neq); - a +=3D sizeof(unsigned long); - b +=3D sizeof(unsigned long); - size -=3D sizeof(unsigned long); - } -#endif /* CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS */ - while (size > 0) { - neq |=3D *(unsigned char *)a ^ *(unsigned char *)b; - OPTIMIZER_HIDE_VAR(neq); - a +=3D 1; - b +=3D 1; - size -=3D 1; - } - return neq; -} - -/* Loop-free fast-path for frequently used 16-byte size */ -static inline unsigned long __crypto_memneq_16(const void *a, const void *= b) -{ - unsigned long neq =3D 0; - -#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS - if (sizeof(unsigned long) =3D=3D 8) { - neq |=3D get_unaligned((unsigned long *)a) ^ - get_unaligned((unsigned long *)b); - OPTIMIZER_HIDE_VAR(neq); - neq |=3D get_unaligned((unsigned long *)(a + 8)) ^ - get_unaligned((unsigned long *)(b + 8)); - OPTIMIZER_HIDE_VAR(neq); - } else if (sizeof(unsigned int) =3D=3D 4) { - neq |=3D get_unaligned((unsigned int *)a) ^ - get_unaligned((unsigned int *)b); - OPTIMIZER_HIDE_VAR(neq); - neq |=3D get_unaligned((unsigned int *)(a + 4)) ^ - get_unaligned((unsigned int *)(b + 4)); - OPTIMIZER_HIDE_VAR(neq); - neq |=3D get_unaligned((unsigned int *)(a + 8)) ^ - get_unaligned((unsigned int *)(b + 8)); - OPTIMIZER_HIDE_VAR(neq); - neq |=3D get_unaligned((unsigned int *)(a + 12)) ^ - get_unaligned((unsigned int *)(b + 12)); - OPTIMIZER_HIDE_VAR(neq); - } else -#endif /* CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS */ - { - neq |=3D *(unsigned char *)(a) ^ *(unsigned char *)(b); - OPTIMIZER_HIDE_VAR(neq); - neq |=3D *(unsigned char *)(a+1) ^ *(unsigned char *)(b+1); - OPTIMIZER_HIDE_VAR(neq); - neq |=3D *(unsigned char *)(a+2) ^ *(unsigned char *)(b+2); - OPTIMIZER_HIDE_VAR(neq); - neq |=3D *(unsigned char *)(a+3) ^ *(unsigned char *)(b+3); - OPTIMIZER_HIDE_VAR(neq); - neq |=3D *(unsigned char *)(a+4) ^ *(unsigned char *)(b+4); - OPTIMIZER_HIDE_VAR(neq); - neq |=3D *(unsigned char *)(a+5) ^ *(unsigned char *)(b+5); - OPTIMIZER_HIDE_VAR(neq); - neq |=3D *(unsigned char *)(a+6) ^ *(unsigned char *)(b+6); - OPTIMIZER_HIDE_VAR(neq); - neq |=3D *(unsigned char *)(a+7) ^ *(unsigned char *)(b+7); - OPTIMIZER_HIDE_VAR(neq); - neq |=3D *(unsigned char *)(a+8) ^ *(unsigned char *)(b+8); - OPTIMIZER_HIDE_VAR(neq); - neq |=3D *(unsigned char *)(a+9) ^ *(unsigned char *)(b+9); - OPTIMIZER_HIDE_VAR(neq); - neq |=3D *(unsigned char *)(a+10) ^ *(unsigned char *)(b+10); - OPTIMIZER_HIDE_VAR(neq); - neq |=3D *(unsigned char *)(a+11) ^ *(unsigned char *)(b+11); - OPTIMIZER_HIDE_VAR(neq); - neq |=3D *(unsigned char *)(a+12) ^ *(unsigned char *)(b+12); - OPTIMIZER_HIDE_VAR(neq); - neq |=3D *(unsigned char *)(a+13) ^ *(unsigned char *)(b+13); - OPTIMIZER_HIDE_VAR(neq); - neq |=3D *(unsigned char *)(a+14) ^ *(unsigned char *)(b+14); - OPTIMIZER_HIDE_VAR(neq); - neq |=3D *(unsigned char *)(a+15) ^ *(unsigned char *)(b+15); - OPTIMIZER_HIDE_VAR(neq); - } - - return neq; -} - -/* Compare two areas of memory without leaking timing information, - * and with special optimizations for common sizes. Users should - * not call this function directly, but should instead use - * crypto_memneq defined in crypto/algapi.h. - */ -noinline unsigned long __crypto_memneq(const void *a, const void *b, - size_t size) -{ - switch (size) { - case 16: - return __crypto_memneq_16(a, b); - default: - return __crypto_memneq_generic(a, b, size); - } -} -EXPORT_SYMBOL(__crypto_memneq); - -#endif /* __HAVE_ARCH_CRYPTO_MEMNEQ */ --- a/lib/Kconfig +++ b/lib/Kconfig @@ -120,6 +120,9 @@ config INDIRECT_IOMEM_FALLBACK =20 source "lib/crypto/Kconfig" =20 +config LIB_MEMNEQ + bool + config CRC_CCITT tristate "CRC-CCITT functions" help --- a/lib/Makefile +++ b/lib/Makefile @@ -251,6 +251,7 @@ obj-$(CONFIG_DIMLIB) +=3D dim/ obj-$(CONFIG_SIGNATURE) +=3D digsig.o =20 lib-$(CONFIG_CLZ_TAB) +=3D clz_tab.o +lib-$(CONFIG_LIB_MEMNEQ) +=3D memneq.o =20 obj-$(CONFIG_GENERIC_STRNCPY_FROM_USER) +=3D strncpy_from_user.o obj-$(CONFIG_GENERIC_STRNLEN_USER) +=3D strnlen_user.o --- a/lib/crypto/Kconfig +++ b/lib/crypto/Kconfig @@ -71,6 +71,7 @@ config CRYPTO_LIB_CURVE25519 tristate "Curve25519 scalar multiplication library" depends on CRYPTO_ARCH_HAVE_LIB_CURVE25519 || !CRYPTO_ARCH_HAVE_LIB_CURVE= 25519 select CRYPTO_LIB_CURVE25519_GENERIC if CRYPTO_ARCH_HAVE_LIB_CURVE25519= =3Dn + select LIB_MEMNEQ help Enable the Curve25519 library interface. This interface may be fulfilled by either the generic implementation or an arch-specific --- /dev/null +++ b/lib/memneq.c @@ -0,0 +1,176 @@ +/* + * Constant-time equality testing of memory regions. + * + * Authors: + * + * James Yonan + * Daniel Borkmann + * + * This file is provided under a dual BSD/GPLv2 license. When using or + * redistributing this file, you may do so under either license. + * + * GPL LICENSE SUMMARY + * + * Copyright(c) 2013 OpenVPN Technologies, Inc. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of version 2 of the GNU General Public License as + * published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 U= SA. + * The full GNU General Public License is included in this distribution + * in the file called LICENSE.GPL. + * + * BSD LICENSE + * + * Copyright(c) 2013 OpenVPN Technologies, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * * Neither the name of OpenVPN Technologies nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include + +#ifndef __HAVE_ARCH_CRYPTO_MEMNEQ + +/* Generic path for arbitrary size */ +static inline unsigned long +__crypto_memneq_generic(const void *a, const void *b, size_t size) +{ + unsigned long neq =3D 0; + +#if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) + while (size >=3D sizeof(unsigned long)) { + neq |=3D get_unaligned((unsigned long *)a) ^ + get_unaligned((unsigned long *)b); + OPTIMIZER_HIDE_VAR(neq); + a +=3D sizeof(unsigned long); + b +=3D sizeof(unsigned long); + size -=3D sizeof(unsigned long); + } +#endif /* CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS */ + while (size > 0) { + neq |=3D *(unsigned char *)a ^ *(unsigned char *)b; + OPTIMIZER_HIDE_VAR(neq); + a +=3D 1; + b +=3D 1; + size -=3D 1; + } + return neq; +} + +/* Loop-free fast-path for frequently used 16-byte size */ +static inline unsigned long __crypto_memneq_16(const void *a, const void *= b) +{ + unsigned long neq =3D 0; + +#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS + if (sizeof(unsigned long) =3D=3D 8) { + neq |=3D get_unaligned((unsigned long *)a) ^ + get_unaligned((unsigned long *)b); + OPTIMIZER_HIDE_VAR(neq); + neq |=3D get_unaligned((unsigned long *)(a + 8)) ^ + get_unaligned((unsigned long *)(b + 8)); + OPTIMIZER_HIDE_VAR(neq); + } else if (sizeof(unsigned int) =3D=3D 4) { + neq |=3D get_unaligned((unsigned int *)a) ^ + get_unaligned((unsigned int *)b); + OPTIMIZER_HIDE_VAR(neq); + neq |=3D get_unaligned((unsigned int *)(a + 4)) ^ + get_unaligned((unsigned int *)(b + 4)); + OPTIMIZER_HIDE_VAR(neq); + neq |=3D get_unaligned((unsigned int *)(a + 8)) ^ + get_unaligned((unsigned int *)(b + 8)); + OPTIMIZER_HIDE_VAR(neq); + neq |=3D get_unaligned((unsigned int *)(a + 12)) ^ + get_unaligned((unsigned int *)(b + 12)); + OPTIMIZER_HIDE_VAR(neq); + } else +#endif /* CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS */ + { + neq |=3D *(unsigned char *)(a) ^ *(unsigned char *)(b); + OPTIMIZER_HIDE_VAR(neq); + neq |=3D *(unsigned char *)(a+1) ^ *(unsigned char *)(b+1); + OPTIMIZER_HIDE_VAR(neq); + neq |=3D *(unsigned char *)(a+2) ^ *(unsigned char *)(b+2); + OPTIMIZER_HIDE_VAR(neq); + neq |=3D *(unsigned char *)(a+3) ^ *(unsigned char *)(b+3); + OPTIMIZER_HIDE_VAR(neq); + neq |=3D *(unsigned char *)(a+4) ^ *(unsigned char *)(b+4); + OPTIMIZER_HIDE_VAR(neq); + neq |=3D *(unsigned char *)(a+5) ^ *(unsigned char *)(b+5); + OPTIMIZER_HIDE_VAR(neq); + neq |=3D *(unsigned char *)(a+6) ^ *(unsigned char *)(b+6); + OPTIMIZER_HIDE_VAR(neq); + neq |=3D *(unsigned char *)(a+7) ^ *(unsigned char *)(b+7); + OPTIMIZER_HIDE_VAR(neq); + neq |=3D *(unsigned char *)(a+8) ^ *(unsigned char *)(b+8); + OPTIMIZER_HIDE_VAR(neq); + neq |=3D *(unsigned char *)(a+9) ^ *(unsigned char *)(b+9); + OPTIMIZER_HIDE_VAR(neq); + neq |=3D *(unsigned char *)(a+10) ^ *(unsigned char *)(b+10); + OPTIMIZER_HIDE_VAR(neq); + neq |=3D *(unsigned char *)(a+11) ^ *(unsigned char *)(b+11); + OPTIMIZER_HIDE_VAR(neq); + neq |=3D *(unsigned char *)(a+12) ^ *(unsigned char *)(b+12); + OPTIMIZER_HIDE_VAR(neq); + neq |=3D *(unsigned char *)(a+13) ^ *(unsigned char *)(b+13); + OPTIMIZER_HIDE_VAR(neq); + neq |=3D *(unsigned char *)(a+14) ^ *(unsigned char *)(b+14); + OPTIMIZER_HIDE_VAR(neq); + neq |=3D *(unsigned char *)(a+15) ^ *(unsigned char *)(b+15); + OPTIMIZER_HIDE_VAR(neq); + } + + return neq; +} + +/* Compare two areas of memory without leaking timing information, + * and with special optimizations for common sizes. Users should + * not call this function directly, but should instead use + * crypto_memneq defined in crypto/algapi.h. + */ +noinline unsigned long __crypto_memneq(const void *a, const void *b, + size_t size) +{ + switch (size) { + case 16: + return __crypto_memneq_16(a, b); + default: + return __crypto_memneq_generic(a, b, size); + } +} +EXPORT_SYMBOL(__crypto_memneq); + +#endif /* __HAVE_ARCH_CRYPTO_MEMNEQ */ From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6715C433EF for ; Mon, 20 Jun 2022 13:05:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244322AbiFTNFC (ORCPT ); Mon, 20 Jun 2022 09:05:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244318AbiFTNDc (ORCPT ); Mon, 20 Jun 2022 09:03:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 30D4213D39; Mon, 20 Jun 2022 05:58:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3DC7AB811B9; Mon, 20 Jun 2022 12:58:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9914DC3411B; Mon, 20 Jun 2022 12:57:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729880; bh=suxF+OV9SOJgom/P/dRCfVxDLXXQLItXBadyBvTXuKQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WRu8sbff12huunyIbVME0POP+olaK2caeV9egaJqUJ7/i1ceM9B8KeZFxM1gm8PmX EzgoRUI6SrPFTR4h/v9IH91XpvTFeFwq56HzDh+DO+DcxJXy0XnROxGYFC14ntEAlY E+oAbXp1HZ/RBi/Z1xJC5oHIfBzLkdFKaIwhXqVQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Slark Xiao , Johan Hovold Subject: [PATCH 5.18 104/141] USB: serial: option: add support for Cinterion MV31 with new baseline Date: Mon, 20 Jun 2022 14:50:42 +0200 Message-Id: <20220620124732.617443267@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Slark Xiao commit 158f7585bfcea4aae0ad4128d032a80fec550df1 upstream. Adding support for Cinterion device MV31 with Qualcomm new baseline. Use different PIDs to separate it from previous base line products. All interfaces settings keep same as previous. Below is test evidence: T: Bus=3D03 Lev=3D01 Prnt=3D01 Port=3D00 Cnt=3D01 Dev#=3D 6 Spd=3D480 MxC= h=3D 0 D: Ver=3D 2.10 Cls=3Def(misc ) Sub=3D02 Prot=3D01 MxPS=3D64 #Cfgs=3D 1 P: Vendor=3D1e2d ProdID=3D00b8 Rev=3D04.14 S: Manufacturer=3DCinterion S: Product=3DCinterion PID 0x00B8 USB Mobile Broadband S: SerialNumber=3D90418e79 C: #Ifs=3D 6 Cfg#=3D 1 Atr=3Da0 MxPwr=3D500mA I: If#=3D0x0 Alt=3D 0 #EPs=3D 1 Cls=3D02(commc) Sub=3D0e Prot=3D00 Driver= =3Dcdc_mbim I: If#=3D0x1 Alt=3D 1 #EPs=3D 2 Cls=3D0a(data ) Sub=3D00 Prot=3D02 Driver= =3Dcdc_mbim I: If#=3D0x2 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3Dff Prot=3D40 Driver= =3Doption I: If#=3D0x3 Alt=3D 0 #EPs=3D 1 Cls=3Dff(vend.) Sub=3Dff Prot=3Dff Driver= =3D(none) I: If#=3D0x4 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3Dff Prot=3D60 Driver= =3Doption I: If#=3D0x5 Alt=3D 0 #EPs=3D 2 Cls=3Dff(vend.) Sub=3Dff Prot=3D30 Driver= =3Doption T: Bus=3D03 Lev=3D01 Prnt=3D01 Port=3D00 Cnt=3D01 Dev#=3D 7 Spd=3D480 MxC= h=3D 0 D: Ver=3D 2.10 Cls=3Def(misc ) Sub=3D02 Prot=3D01 MxPS=3D64 #Cfgs=3D 1 P: Vendor=3D1e2d ProdID=3D00b9 Rev=3D04.14 S: Manufacturer=3DCinterion S: Product=3DCinterion PID 0x00B9 USB Mobile Broadband S: SerialNumber=3D90418e79 C: #Ifs=3D 4 Cfg#=3D 1 Atr=3Da0 MxPwr=3D500mA I: If#=3D0x0 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3Dff Prot=3D50 Driver= =3Dqmi_wwan I: If#=3D0x1 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3Dff Prot=3D40 Driver= =3Doption I: If#=3D0x2 Alt=3D 0 #EPs=3D 3 Cls=3Dff(vend.) Sub=3Dff Prot=3D60 Driver= =3Doption I: If#=3D0x3 Alt=3D 0 #EPs=3D 2 Cls=3Dff(vend.) Sub=3Dff Prot=3D30 Driver= =3Doption For PID 00b8, interface 3 is GNSS port which don't use serial driver. Signed-off-by: Slark Xiao Link: https://lore.kernel.org/r/20220601034740.5438-1-slark_xiao@163.com [ johan: rename defines using a "2" infix ] Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/usb/serial/option.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c @@ -432,6 +432,8 @@ static void option_instat_callback(struc #define CINTERION_PRODUCT_CLS8 0x00b0 #define CINTERION_PRODUCT_MV31_MBIM 0x00b3 #define CINTERION_PRODUCT_MV31_RMNET 0x00b7 +#define CINTERION_PRODUCT_MV31_2_MBIM 0x00b8 +#define CINTERION_PRODUCT_MV31_2_RMNET 0x00b9 #define CINTERION_PRODUCT_MV32_WA 0x00f1 #define CINTERION_PRODUCT_MV32_WB 0x00f2 =20 @@ -1979,6 +1981,10 @@ static const struct usb_device_id option .driver_info =3D RSVD(3)}, { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV31_= RMNET, 0xff), .driver_info =3D RSVD(0)}, + { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV31_= 2_MBIM, 0xff), + .driver_info =3D RSVD(3)}, + { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV31_= 2_RMNET, 0xff), + .driver_info =3D RSVD(0)}, { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_= WA, 0xff), .driver_info =3D RSVD(3)}, { USB_DEVICE_INTERFACE_CLASS(CINTERION_VENDOR_ID, CINTERION_PRODUCT_MV32_= WB, 0xff), From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 19C11C43334 for ; Mon, 20 Jun 2022 13:05:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244300AbiFTNE6 (ORCPT ); Mon, 20 Jun 2022 09:04:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244327AbiFTNDd (ORCPT ); Mon, 20 Jun 2022 09:03:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B7F21E3C4; Mon, 20 Jun 2022 05:58:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DDAB761530; Mon, 20 Jun 2022 12:58:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AFF4FC3411B; Mon, 20 Jun 2022 12:58:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729883; bh=FQ0+lo00rXa4CTP60ZRh+3Zh+8ZU8gU6od9aO1oWjrU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sPRuhEIRvgfPueQSwDSS/0qLkg1bIm+FY9a9seGc2Sc62lJ6Tmsm/zvLQCvCSZxVj +chy+JSyRKSVqcaqbRlDksgBE4Zb1JQV1iNhUHmUlEiCmz+IuqM1RQQ1rADLonqgl7 cf87ifnCskBHg/L+0ZjX2nzrEXCIIm+2AOm5WvAM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Robert Eckelmann , Johan Hovold Subject: [PATCH 5.18 105/141] USB: serial: io_ti: add Agilent E5805A support Date: Mon, 20 Jun 2022 14:50:43 +0200 Message-Id: <20220620124732.647497743@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Robert Eckelmann commit 908e698f2149c3d6a67d9ae15c75545a3f392559 upstream. Add support for Agilent E5805A (rebranded ION Edgeport/4) to io_ti. Signed-off-by: Robert Eckelmann Link: https://lore.kernel.org/r/20220521230808.30931eca@octoberrain Cc: stable@vger.kernel.org Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/usb/serial/io_ti.c | 2 ++ drivers/usb/serial/io_usbvend.h | 1 + 2 files changed, 3 insertions(+) --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c @@ -166,6 +166,7 @@ static const struct usb_device_id edgepo { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_8S) }, { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_416) }, { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_416B) }, + { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_E5805A) }, { } }; =20 @@ -204,6 +205,7 @@ static const struct usb_device_id id_tab { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_8S) }, { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_416) }, { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_TI_EDGEPORT_416B) }, + { USB_DEVICE(USB_VENDOR_ID_ION, ION_DEVICE_ID_E5805A) }, { } }; =20 --- a/drivers/usb/serial/io_usbvend.h +++ b/drivers/usb/serial/io_usbvend.h @@ -212,6 +212,7 @@ // // Definitions for other product IDs #define ION_DEVICE_ID_MT4X56USB 0x1403 // OEM device +#define ION_DEVICE_ID_E5805A 0x1A01 // OEM device (rebranded Edgeport/4) =20 =20 #define GENERATION_ID_FROM_USB_PRODUCT_ID(ProductId) \ From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A668C433EF for ; Mon, 20 Jun 2022 13:05:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244346AbiFTNFI (ORCPT ); Mon, 20 Jun 2022 09:05:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244350AbiFTNDe (ORCPT ); Mon, 20 Jun 2022 09:03:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A0001E3D2; Mon, 20 Jun 2022 05:58:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 81ED4B811A0; Mon, 20 Jun 2022 12:58:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94840C3411B; Mon, 20 Jun 2022 12:58:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729887; bh=GCtSDrZL6nWMsE7xon+QL1MQ8Yl7NvnYp4rWylqCoIQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sCUJGHDDK37iSZgYKphCmlX/yEf9T9faWSN0y8FjgYFPwPnzXLzx9HiwXThbH6pr1 JgZJu5sDUD6GEYks6ndhKjktxAjoMSEg19ElLllMy62/38UfVZePnwPgGWZaMw+zcj v/CNQG+i/LmYaqn+7x1Gha+AFdkrqbD0TeVj7Xzg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ard Biesheuvel , Christoph Hellwig , Robin Murphy , Russell King , Will Deacon , Catalin Marinas Subject: [PATCH 5.18 106/141] arm64: mm: Dont invalidate FROM_DEVICE buffers at start of DMA transfer Date: Mon, 20 Jun 2022 14:50:44 +0200 Message-Id: <20220620124732.676698576@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Will Deacon commit c50f11c6196f45c92ca48b16a5071615d4ae0572 upstream. Invalidating the buffer memory in arch_sync_dma_for_device() for FROM_DEVICE transfers When using the streaming DMA API to map a buffer prior to inbound non-coherent DMA (i.e. DMA_FROM_DEVICE), we invalidate any dirty CPU cachelines so that they will not be written back during the transfer and corrupt the buffer contents written by the DMA. This, however, poses two potential problems: (1) If the DMA transfer does not write to every byte in the buffer, then the unwritten bytes will contain stale data once the transfer has completed. (2) If the buffer has a virtual alias in userspace, then stale data may be visible via this alias during the period between performing the cache invalidation and the DMA writes landing in memory. Address both of these issues by cleaning (aka writing-back) the dirty lines in arch_sync_dma_for_device(DMA_FROM_DEVICE) instead of discarding them using invalidation. Cc: Ard Biesheuvel Cc: Christoph Hellwig Cc: Robin Murphy Cc: Russell King Cc: Link: https://lore.kernel.org/r/20220606152150.GA31568@willie-the-truck Signed-off-by: Will Deacon Reviewed-by: Ard Biesheuvel Link: https://lore.kernel.org/r/20220610151228.4562-2-will@kernel.org Signed-off-by: Catalin Marinas Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/arm64/mm/cache.S | 2 -- 1 file changed, 2 deletions(-) --- a/arch/arm64/mm/cache.S +++ b/arch/arm64/mm/cache.S @@ -218,8 +218,6 @@ SYM_FUNC_ALIAS(__dma_flush_area, __pi___ */ SYM_FUNC_START(__pi___dma_map_area) add x1, x0, x1 - cmp w2, #DMA_FROM_DEVICE - b.eq __pi_dcache_inval_poc b __pi_dcache_clean_poc SYM_FUNC_END(__pi___dma_map_area) SYM_FUNC_ALIAS(__dma_map_area, __pi___dma_map_area) From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46F8EC433EF for ; Mon, 20 Jun 2022 13:05:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244406AbiFTNFQ (ORCPT ); Mon, 20 Jun 2022 09:05:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244553AbiFTNDn (ORCPT ); Mon, 20 Jun 2022 09:03:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AA041E3DB; Mon, 20 Jun 2022 05:58:11 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B7AB061449; Mon, 20 Jun 2022 12:58:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C508EC341C6; Mon, 20 Jun 2022 12:58:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729890; bh=KJ2SapzxlRMwj2wOaVCg3xVM4XQkTl/+A3xCbWmz0Ww=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zwq3XoJsTtp50Jks7sEpSIi/toPXX7nGAUAiNuyAAsOP3jUp1TSmktnyDZAfRGRFQ gwL5V/eDfCrlfyEZdy5mqNJpj10m5aldQgqlZSqrF4i7EzJ5WtxM0J0jS5LTpkETFt ijYG5DoavehZLo2jZ2SW/ucOxbsY1Tlj3cB7qR5o= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , Minas Harutyunyan , Miaoqian Lin Subject: [PATCH 5.18 107/141] usb: dwc2: Fix memory leak in dwc2_hcd_init Date: Mon, 20 Jun 2022 14:50:45 +0200 Message-Id: <20220620124732.706983940@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin commit 3755278f078460b021cd0384562977bf2039a57a upstream. usb_create_hcd will alloc memory for hcd, and we should call usb_put_hcd to free it when platform_get_resource() fails to prevent memory leak. goto error2 label instead error1 to fix this. Fixes: 856e6e8e0f93 ("usb: dwc2: check return value after calling platform_= get_resource()") Cc: stable Acked-by: Minas Harutyunyan Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220530085413.44068-1-linmq006@gmail.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/usb/dwc2/hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/usb/dwc2/hcd.c +++ b/drivers/usb/dwc2/hcd.c @@ -5190,7 +5190,7 @@ int dwc2_hcd_init(struct dwc2_hsotg *hso res =3D platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { retval =3D -EINVAL; - goto error1; + goto error2; } hcd->rsrc_start =3D res->start; hcd->rsrc_len =3D resource_size(res); From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C24DEC43334 for ; Mon, 20 Jun 2022 13:05:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243997AbiFTNFU (ORCPT ); Mon, 20 Jun 2022 09:05:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244551AbiFTNDn (ORCPT ); Mon, 20 Jun 2022 09:03:43 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B2251E3F4; Mon, 20 Jun 2022 05:58:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A071D61534; Mon, 20 Jun 2022 12:58:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF96CC3411B; Mon, 20 Jun 2022 12:58:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729893; bh=fNMtNd/ZVAeJzffPN0WQglMzH9rYHRFh7UPCRvMC4n4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jarla3o5LBDo53pcoqv2SZGDDccNIc15o0Z8N9KRTxH08FDApYUm3vhhxJmrkWalU Myfpc0z4o6dCKhATXV1dPxVRyV6kEy8TDg9QoPs73BQkOrdZwjLE1Vo6mjGANulXv1 ZvrTVTFVuch01d/Kv9USbd21yFRBjeis6c9Ttyno= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , Pawel Laszczak , Jing Leng Subject: [PATCH 5.18 108/141] usb: cdnsp: Fixed setting last_trb incorrectly Date: Mon, 20 Jun 2022 14:50:46 +0200 Message-Id: <20220620124732.736244371@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jing Leng commit 5c7578c39c3fffe85b7d15ca1cf8cf7ac38ec0c1 upstream. When ZLP occurs in bulk transmission, currently cdnsp will set last_trb for the last two TRBs, it will trigger an error "ERROR Transfer event TRB DMA ptr not part of current TD ...". Fixes: e913aada0683 ("usb: cdnsp: Fixed issue with ZLP") Cc: stable Acked-by: Pawel Laszczak Signed-off-by: Jing Leng Link: https://lore.kernel.org/r/20220609021134.1606-1-3090101217@zju.edu.cn Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/usb/cdns3/cdnsp-ring.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) --- a/drivers/usb/cdns3/cdnsp-ring.c +++ b/drivers/usb/cdns3/cdnsp-ring.c @@ -1941,13 +1941,16 @@ int cdnsp_queue_bulk_tx(struct cdnsp_dev } =20 if (enqd_len + trb_buff_len >=3D full_len) { - if (need_zero_pkt) - zero_len_trb =3D !zero_len_trb; - - field &=3D ~TRB_CHAIN; - field |=3D TRB_IOC; - more_trbs_coming =3D false; - preq->td.last_trb =3D ring->enqueue; + if (need_zero_pkt && !zero_len_trb) { + zero_len_trb =3D true; + } else { + zero_len_trb =3D false; + field &=3D ~TRB_CHAIN; + field |=3D TRB_IOC; + more_trbs_coming =3D false; + need_zero_pkt =3D false; + preq->td.last_trb =3D ring->enqueue; + } } =20 /* Only set interrupt on short packet for OUT endpoints. */ @@ -1962,7 +1965,7 @@ int cdnsp_queue_bulk_tx(struct cdnsp_dev length_field =3D TRB_LEN(trb_buff_len) | TRB_TD_SIZE(remainder) | TRB_INTR_TARGET(0); =20 - cdnsp_queue_trb(pdev, ring, more_trbs_coming | zero_len_trb, + cdnsp_queue_trb(pdev, ring, more_trbs_coming, lower_32_bits(send_addr), upper_32_bits(send_addr), length_field, From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2DF8CCA479 for ; Mon, 20 Jun 2022 13:05:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244371AbiFTNFL (ORCPT ); Mon, 20 Jun 2022 09:05:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244390AbiFTNDg (ORCPT ); Mon, 20 Jun 2022 09:03:36 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E3041EAD8; Mon, 20 Jun 2022 05:58:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 558D8B81092; Mon, 20 Jun 2022 12:58:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B487C3411B; Mon, 20 Jun 2022 12:58:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729896; bh=kBHtgX1eSQCaq73ifIWfL5WvoSXaZOrg4EWMBvIMQKM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TfIl/uu2E7jojt3HVjATIlCW7KlREWgVBR0M2cR4vsCn0b2S1qpv6yyxMlUeBlWcX fZxS3I1eENo7uq3cnCANnX2t6bg8R2pVK2TDaCGgqYzL3ics8CaU0zASWamYJZ5Vuk mY3WAUuOo+LIqvGapBcHZgLYtQ9XnDH2fhuyZRsw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , Wesley Cheng Subject: [PATCH 5.18 109/141] usb: dwc3: gadget: Fix IN endpoint max packet size allocation Date: Mon, 20 Jun 2022 14:50:47 +0200 Message-Id: <20220620124732.765069826@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Wesley Cheng commit 9c1e916960c1192e746bf615e4dae25423473a64 upstream. The current logic to assign the max packet limit for IN endpoints attempts to take the default HW value and apply the optimal endpoint settings based on it. However, if the default value reports a TxFIFO size large enough for only one max packet, it will divide the value and assign a smaller ep max packet limit. For example, if the default TxFIFO size fits 1024B, current logic will assign 1024/3 =3D 341B to ep max packet size. If function drivers attempt = to request for an endpoint with a wMaxPacketSize of 1024B (SS BULK max packet size) then it will fail, as the gadget is unable to find an endpoint which can fit the requested size. Functionally, if the TxFIFO has enough space to fit one max packet, it will be sufficient, at least when initializing the endpoints. Fixes: d94ea5319813 ("usb: dwc3: gadget: Properly set maxpacket limit") Cc: stable Signed-off-by: Wesley Cheng Link: https://lore.kernel.org/r/20220523213948.22142-1-quic_wcheng@quicinc.= com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/usb/dwc3/gadget.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2984,6 +2984,7 @@ static int dwc3_gadget_init_in_endpoint( struct dwc3 *dwc =3D dep->dwc; u32 mdwidth; int size; + int maxpacket; =20 mdwidth =3D dwc3_mdwidth(dwc); =20 @@ -2996,21 +2997,24 @@ static int dwc3_gadget_init_in_endpoint( else size =3D DWC31_GTXFIFOSIZ_TXFDEP(size); =20 - /* FIFO Depth is in MDWDITH bytes. Multiply */ - size *=3D mdwidth; - /* - * To meet performance requirement, a minimum TxFIFO size of 3x - * MaxPacketSize is recommended for endpoints that support burst and a - * minimum TxFIFO size of 2x MaxPacketSize for endpoints that don't - * support burst. Use those numbers and we can calculate the max packet - * limit as below. + * maxpacket size is determined as part of the following, after assuming + * a mult value of one maxpacket: + * DWC3 revision 280A and prior: + * fifo_size =3D mult * (max_packet / mdwidth) + 1; + * maxpacket =3D mdwidth * (fifo_size - 1); + * + * DWC3 revision 290A and onwards: + * fifo_size =3D mult * ((max_packet + mdwidth)/mdwidth + 1) + 1 + * maxpacket =3D mdwidth * ((fifo_size - 1) - 1) - mdwidth; */ - if (dwc->maximum_speed >=3D USB_SPEED_SUPER) - size /=3D 3; + if (DWC3_VER_IS_PRIOR(DWC3, 290A)) + maxpacket =3D mdwidth * (size - 1); else - size /=3D 2; + maxpacket =3D mdwidth * ((size - 1) - 1) - mdwidth; =20 + /* Functionally, space for one max packet is sufficient */ + size =3D min_t(int, maxpacket, 1024); usb_ep_set_maxpacket_limit(&dep->endpoint, size); =20 dep->endpoint.max_streams =3D 16; From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BF13C433EF for ; Mon, 20 Jun 2022 13:05:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244392AbiFTNFO (ORCPT ); Mon, 20 Jun 2022 09:05:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244481AbiFTNDk (ORCPT ); Mon, 20 Jun 2022 09:03:40 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 788331EAE1; Mon, 20 Jun 2022 05:58:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8D16661543; Mon, 20 Jun 2022 12:58:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9984DC3411C; Mon, 20 Jun 2022 12:58:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729899; bh=9CXotcOEN4LmqbhAxjjPOPUo1jo6/xqjSYmfQc5Ijsw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TU8MGXy5KSDhNWdC2eaJok8xWA9ji7Q977kT2ttvjhXy4coRT/f9kQxU5jBt2r6IQ H3b9TADl3ylTw1tw3Eaz+8yKlNjpvQFHanU0n+1M77kRH1jOd8x5EutvVeCpYNTVhP gUxg5zfOVJIQSKQuYj1IRKPy6thlCMTEnjwRgNCk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stephan Gerhold Subject: [PATCH 5.18 110/141] usb: dwc3: pci: Restore line lost in merge conflict resolution Date: Mon, 20 Jun 2022 14:50:48 +0200 Message-Id: <20220620124732.793486825@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Stephan Gerhold commit 7ddda2614d62ef7fdef7fd85f5151cdf665b22d8 upstream. Commit 582ab24e096f ("usb: dwc3: pci: Set "linux,phy_charger_detect" property on some Bay Trail boards") added a new swnode similar to the existing ones for boards where the PHY handles charger detection. Unfortunately, the "linux,sysdev_is_parent" property got lost in the merge conflict resolution of commit ca9400ef7f67 ("Merge 5.17-rc6 into usb-next"). Now dwc3_pci_intel_phy_charger_detect_properties is the only swnode in dwc3-pci that is missing "linux,sysdev_is_parent". It does not seem to cause any obvious functional issues, but it's certainly unintended so restore the line to make the properties consistent again. Fixes: ca9400ef7f67 ("Merge 5.17-rc6 into usb-next") Cc: stable@vger.kernel.org Signed-off-by: Stephan Gerhold Link: https://lore.kernel.org/r/20220528170913.9240-1-stephan@gerhold.net Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/usb/dwc3/dwc3-pci.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/usb/dwc3/dwc3-pci.c +++ b/drivers/usb/dwc3/dwc3-pci.c @@ -127,6 +127,7 @@ static const struct property_entry dwc3_ PROPERTY_ENTRY_STRING("dr_mode", "peripheral"), PROPERTY_ENTRY_BOOL("snps,dis_u2_susphy_quirk"), PROPERTY_ENTRY_BOOL("linux,phy_charger_detect"), + PROPERTY_ENTRY_BOOL("linux,sysdev_is_parent"), {} }; From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41FABC433EF for ; Mon, 20 Jun 2022 13:05:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244464AbiFTNFW (ORCPT ); Mon, 20 Jun 2022 09:05:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244564AbiFTNDo (ORCPT ); Mon, 20 Jun 2022 09:03:44 -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 9A9D413E2C; Mon, 20 Jun 2022 05:58:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9FEC061530; Mon, 20 Jun 2022 12:58:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 920CFC341C4; Mon, 20 Jun 2022 12:58:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729902; bh=yGU+yhI3hMhandy34fwrekFo0NESvCC121hxj6+oOhs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NBIx9Nfp2T42m08O7JfsRHypudu1+uqBXm+RrK2S14sCLbEiFNFT+0ickjuB3j5Mt X/w7cBMhC1N8ABcB08cnppi0O3a8DDzandypxGLemf/ixz8c9hDwVQ8f3lUat04QL/ LJj8tlhriICQxFHxrMOf6vQHAzExq+w54agXTGX0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marian Postevca Subject: [PATCH 5.18 111/141] usb: gadget: u_ether: fix regression in setting fixed MAC address Date: Mon, 20 Jun 2022 14:50:49 +0200 Message-Id: <20220620124732.822998965@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marian Postevca commit b337af3a4d6147000b7ca6b3438bf5c820849b37 upstream. In systemd systems setting a fixed MAC address through the "dev_addr" module argument fails systematically. When checking the MAC address after the interface is created it always has the same but different MAC address to the one supplied as argument. This is partially caused by systemd which by default will set an internally generated permanent MAC address for interfaces that are marked as having a randomly generated address. Commit 890d5b40908bfd1a ("usb: gadget: u_ether: fix race in setting MAC address in setup phase") didn't take into account the fact that the interface must be marked as having a set MAC address when it's set as module argument. Fixed by marking the interface with NET_ADDR_SET when the "dev_addr" module argument is supplied. Fixes: 890d5b40908bfd1a ("usb: gadget: u_ether: fix race in setting MAC add= ress in setup phase") Cc: stable@vger.kernel.org Signed-off-by: Marian Postevca Link: https://lore.kernel.org/r/20220603153459.32722-1-posteuca@mutex.one Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/usb/gadget/function/u_ether.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) --- a/drivers/usb/gadget/function/u_ether.c +++ b/drivers/usb/gadget/function/u_ether.c @@ -775,9 +775,13 @@ struct eth_dev *gether_setup_name(struct dev->qmult =3D qmult; snprintf(net->name, sizeof(net->name), "%s%%d", netname); =20 - if (get_ether_addr(dev_addr, addr)) + if (get_ether_addr(dev_addr, addr)) { + net->addr_assign_type =3D NET_ADDR_RANDOM; dev_warn(&g->dev, "using random %s ethernet address\n", "self"); + } else { + net->addr_assign_type =3D NET_ADDR_SET; + } eth_hw_addr_set(net, addr); if (get_ether_addr(host_addr, dev->host_mac)) dev_warn(&g->dev, @@ -844,6 +848,10 @@ struct net_device *gether_setup_name_def =20 eth_random_addr(dev->dev_mac); pr_warn("using random %s ethernet address\n", "self"); + + /* by default we always have a random MAC address */ + net->addr_assign_type =3D NET_ADDR_RANDOM; + eth_random_addr(dev->host_mac); pr_warn("using random %s ethernet address\n", "host"); =20 @@ -871,7 +879,6 @@ int gether_register_netdev(struct net_de dev =3D netdev_priv(net); g =3D dev->gadget; =20 - net->addr_assign_type =3D NET_ADDR_RANDOM; eth_hw_addr_set(net, dev->dev_mac); =20 status =3D register_netdev(net); @@ -912,6 +919,7 @@ int gether_set_dev_addr(struct net_devic if (get_ether_addr(dev_addr, new_addr)) return -EINVAL; memcpy(dev->dev_mac, new_addr, ETH_ALEN); + net->addr_assign_type =3D NET_ADDR_SET; return 0; } EXPORT_SYMBOL_GPL(gether_set_dev_addr); From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C685C433EF for ; Mon, 20 Jun 2022 13:05:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244505AbiFTNFl (ORCPT ); Mon, 20 Jun 2022 09:05:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244613AbiFTNDs (ORCPT ); Mon, 20 Jun 2022 09:03:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3832B1ADAE; Mon, 20 Jun 2022 05:58: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 C001261539; Mon, 20 Jun 2022 12:58:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BA495C3411B; Mon, 20 Jun 2022 12:58:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729908; bh=SPQd5Lsdt7SqMwWbRPh9kjVSXWoy8cExBwIjF7PcVVM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0Cf2HrHYRfYWwuJA103TC+R8AWCE86yfNmC6+5ZLhJ4bSOBH6sVNCdsu4QyE0FeVe oOuKIOri6Jn+ot6YiD7pUC4hGbVxcSv5TTv71t6fDV9iD4KzfN+Y4H65MukHxKhDVA IH3YK5pqY3DCZD65L24t7FmGNm/uNipmcbjCecEk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , Miaoqian Lin Subject: [PATCH 5.18 112/141] usb: gadget: lpc32xx_udc: Fix refcount leak in lpc32xx_udc_probe Date: Mon, 20 Jun 2022 14:50:50 +0200 Message-Id: <20220620124732.853364128@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Miaoqian Lin commit 4757c9ade34178b351580133771f510b5ffcf9c8 upstream. of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak. of_node_put() will check NULL pointer. Fixes: 24a28e428351 ("USB: gadget driver for LPC32xx") Cc: stable Signed-off-by: Miaoqian Lin Link: https://lore.kernel.org/r/20220603140246.64529-1-linmq006@gmail.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/usb/gadget/udc/lpc32xx_udc.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/usb/gadget/udc/lpc32xx_udc.c +++ b/drivers/usb/gadget/udc/lpc32xx_udc.c @@ -3016,6 +3016,7 @@ static int lpc32xx_udc_probe(struct plat } =20 udc->isp1301_i2c_client =3D isp1301_get_client(isp1301_node); + of_node_put(isp1301_node); if (!udc->isp1301_i2c_client) { return -EPROBE_DEFER; } From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A4DAC43334 for ; Mon, 20 Jun 2022 13:05:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244660AbiFTNFs (ORCPT ); Mon, 20 Jun 2022 09:05:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244706AbiFTND4 (ORCPT ); Mon, 20 Jun 2022 09:03:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EDD21AF0E; Mon, 20 Jun 2022 05:58:32 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E5FA561531; Mon, 20 Jun 2022 12:58:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E033AC3411B; Mon, 20 Jun 2022 12:58:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729911; bh=KSTBBIw5SEmWnx7td8ycDPE2VFjcDDTcRH8moZ/RsiY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WiD5CkGImPcynkrKlSmdpKd9YYqGv173fv2h8ueHGkjGT81EQVTG9p533IiAIlMlk a7ZSMyJ19a+ypDUl9n3zldL4pC8j/cPUlL8Ckt++yBTMP2+c030B0zjJPKzZy/eQ+q rZ0cMrPmwuFEJLmtCbT2Pmsk3Sw3OLquLi823/MI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Wu , John Keeping , Linyu Yuan Subject: [PATCH 5.18 113/141] usb: gadget: f_fs: change ep->status safe in ffs_epfile_io() Date: Mon, 20 Jun 2022 14:50:51 +0200 Message-Id: <20220620124732.883603343@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Linyu Yuan commit fb1f16d74e263baa4ad11e31e28b68f144aa55ed upstream. If a task read/write data in blocking mode, it will wait the completion in ffs_epfile_io(), if function unbind occurs, ffs_func_unbind() will kfree ffs ep, once the task wake up, it still dereference the ffs ep to obtain the request status. Fix it by moving the request status to io_data which is stack-safe. Cc: # 5.15 Reported-by: Michael Wu Tested-by: Michael Wu Reviewed-by: John Keeping Signed-off-by: Linyu Yuan Link: https://lore.kernel.org/r/1654863478-26228-2-git-send-email-quic_liny= yuan@quicinc.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/usb/gadget/function/f_fs.c | 34 +++++++++++++++++++-------------= -- 1 file changed, 19 insertions(+), 15 deletions(-) --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c @@ -122,8 +122,6 @@ struct ffs_ep { struct usb_endpoint_descriptor *descs[3]; =20 u8 num; - - int status; /* P: epfile->mutex */ }; =20 struct ffs_epfile { @@ -227,6 +225,9 @@ struct ffs_io_data { bool use_sg; =20 struct ffs_data *ffs; + + int status; + struct completion done; }; =20 struct ffs_desc_helper { @@ -707,12 +708,15 @@ static const struct file_operations ffs_ =20 static void ffs_epfile_io_complete(struct usb_ep *_ep, struct usb_request = *req) { + struct ffs_io_data *io_data =3D req->context; + ENTER(); - if (req->context) { - struct ffs_ep *ep =3D _ep->driver_data; - ep->status =3D req->status ? req->status : req->actual; - complete(req->context); - } + if (req->status) + io_data->status =3D req->status; + else + io_data->status =3D req->actual; + + complete(&io_data->done); } =20 static ssize_t ffs_copy_to_iter(void *data, int data_len, struct iov_iter = *iter) @@ -1050,7 +1054,6 @@ static ssize_t ffs_epfile_io(struct file WARN(1, "%s: data_len =3D=3D -EINVAL\n", __func__); ret =3D -EINVAL; } else if (!io_data->aio) { - DECLARE_COMPLETION_ONSTACK(done); bool interrupted =3D false; =20 req =3D ep->req; @@ -1066,7 +1069,8 @@ static ssize_t ffs_epfile_io(struct file =20 io_data->buf =3D data; =20 - req->context =3D &done; + init_completion(&io_data->done); + req->context =3D io_data; req->complete =3D ffs_epfile_io_complete; =20 ret =3D usb_ep_queue(ep->ep, req, GFP_ATOMIC); @@ -1075,7 +1079,7 @@ static ssize_t ffs_epfile_io(struct file =20 spin_unlock_irq(&epfile->ffs->eps_lock); =20 - if (wait_for_completion_interruptible(&done)) { + if (wait_for_completion_interruptible(&io_data->done)) { /* * To avoid race condition with ffs_epfile_io_complete, * dequeue the request first then check @@ -1083,17 +1087,17 @@ static ssize_t ffs_epfile_io(struct file * condition with req->complete callback. */ usb_ep_dequeue(ep->ep, req); - wait_for_completion(&done); - interrupted =3D ep->status < 0; + wait_for_completion(&io_data->done); + interrupted =3D io_data->status < 0; } =20 if (interrupted) ret =3D -EINTR; - else if (io_data->read && ep->status > 0) - ret =3D __ffs_epfile_read_data(epfile, data, ep->status, + else if (io_data->read && io_data->status > 0) + ret =3D __ffs_epfile_read_data(epfile, data, io_data->status, &io_data->data); else - ret =3D ep->status; + ret =3D io_data->status; goto error_mutex; } else if (!(req =3D usb_ep_alloc_request(ep->ep, GFP_ATOMIC))) { ret =3D -ENOMEM; From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8F37DCCA480 for ; Mon, 20 Jun 2022 13:05:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244750AbiFTNFx (ORCPT ); Mon, 20 Jun 2022 09:05:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244788AbiFTNEB (ORCPT ); Mon, 20 Jun 2022 09:04: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 0E9651AF31; Mon, 20 Jun 2022 05:58:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BD0D4B81092; Mon, 20 Jun 2022 12:58:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11908C3411B; Mon, 20 Jun 2022 12:58:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729914; bh=//3TnK2oF9ccyJllNvDqoAXV3vpMCnk8UFstdNYtRLs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q5xhHEBbhWU5OTH3SI4j7tui4aoHDEOtKPgkPCf1dbl9srvyOOhIXku5vAAaBhMbt gOuNIZarN4GvPgdV0NKJqJwou7gD5844fgUyiSJTuBkBNB6D3cZTauiqo1BvmAVnQ/ KLv2vJmeHdMKg52vcC5Ez+fJKc5N38ZuOG6DFQ8A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Wu , John Keeping , Linyu Yuan Subject: [PATCH 5.18 114/141] usb: gadget: f_fs: change ep->ep safe in ffs_epfile_io() Date: Mon, 20 Jun 2022 14:50:52 +0200 Message-Id: <20220620124732.915311387@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Linyu Yuan commit 0698f0209d8032e8869525aeb68f65ee7fde12ad upstream. In ffs_epfile_io(), when read/write data in blocking mode, it will wait the completion in interruptible mode, if task receive a signal, it will terminate the wait, at same time, if function unbind occurs, ffs_func_unbind() will kfree all eps, ffs_epfile_io() still try to dequeue request by dereferencing ep which may become invalid. Fix it by add ep spinlock and will not dereference ep if it is not valid. Cc: # 5.15 Reported-by: Michael Wu Tested-by: Michael Wu Reviewed-by: John Keeping Signed-off-by: Linyu Yuan Link: https://lore.kernel.org/r/1654863478-26228-3-git-send-email-quic_liny= yuan@quicinc.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/usb/gadget/function/f_fs.c | 6 ++++++ 1 file changed, 6 insertions(+) --- a/drivers/usb/gadget/function/f_fs.c +++ b/drivers/usb/gadget/function/f_fs.c @@ -1080,6 +1080,11 @@ static ssize_t ffs_epfile_io(struct file spin_unlock_irq(&epfile->ffs->eps_lock); =20 if (wait_for_completion_interruptible(&io_data->done)) { + spin_lock_irq(&epfile->ffs->eps_lock); + if (epfile->ep !=3D ep) { + ret =3D -ESHUTDOWN; + goto error_lock; + } /* * To avoid race condition with ffs_epfile_io_complete, * dequeue the request first then check @@ -1087,6 +1092,7 @@ static ssize_t ffs_epfile_io(struct file * condition with req->complete callback. */ usb_ep_dequeue(ep->ep, req); + spin_unlock_irq(&epfile->ffs->eps_lock); wait_for_completion(&io_data->done); interrupted =3D io_data->status < 0; } From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD3E4CCA48F for ; Mon, 20 Jun 2022 13:06:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244928AbiFTNF7 (ORCPT ); Mon, 20 Jun 2022 09:05:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244815AbiFTNEC (ORCPT ); Mon, 20 Jun 2022 09:04:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3802F1929F; Mon, 20 Jun 2022 05:58: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 E1AE0B811A0; Mon, 20 Jun 2022 12:58:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40453C3411B; Mon, 20 Jun 2022 12:58:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729917; bh=sHsXTox6zXc52iWCMVLZETrIvLTuw2UPYLMvDA+1G08=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GdONSvaEIES9dhW740bQYLaXRHhebA1ocJmL8xRgCGwTndChE8UvgTqNKiAJIEyXq IeAOYcE5Fw4NpRt2IEbl0+a0fsSUSWni5nTvpx7TXdC3GUPgvPGyVZTKpvsKbY3Oyo 88rKv7s4mDZdGbwd5ep8+KRsdsiCpzhn9kqT4hgE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , Dan Carpenter , Gregory CLEMENT , Tony Lindgren Subject: [PATCH 5.18 115/141] tty: n_gsm: Debug output allocation must use GFP_ATOMIC Date: Mon, 20 Jun 2022 14:50:53 +0200 Message-Id: <20220620124732.946064778@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Tony Lindgren commit e74024b2eccbb784824a0f9feaeaaa3b47514b79 upstream. Dan Carpenter reported the following Smatch warning: drivers/tty/n_gsm.c:720 gsm_data_kick() warn: sleeping in atomic context This is because gsm_control_message() is holding a spin lock so gsm_hex_dump_bytes() needs to use GFP_ATOMIC instead of GFP_KERNEL. Fixes: 925ea0fa5277 ("tty: n_gsm: Fix packet data hex dump output") Cc: stable Reported-by: Dan Carpenter Reviewed-by: Gregory CLEMENT Signed-off-by: Tony Lindgren Link: https://lore.kernel.org/r/20220523155052.57129-1-tony@atomide.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/tty/n_gsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/tty/n_gsm.c +++ b/drivers/tty/n_gsm.c @@ -455,7 +455,7 @@ static void gsm_hex_dump_bytes(const cha return; } =20 - prefix =3D kasprintf(GFP_KERNEL, "%s: ", fname); + prefix =3D kasprintf(GFP_ATOMIC, "%s: ", fname); if (!prefix) return; print_hex_dump(KERN_INFO, prefix, DUMP_PREFIX_OFFSET, 16, 1, data, len, From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30974CCA486 for ; Mon, 20 Jun 2022 13:06:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244930AbiFTNGC (ORCPT ); Mon, 20 Jun 2022 09:06:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244817AbiFTNEC (ORCPT ); Mon, 20 Jun 2022 09:04:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0D99192A7; Mon, 20 Jun 2022 05:58:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7B83761531; Mon, 20 Jun 2022 12:58:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B4DAC3411B; Mon, 20 Jun 2022 12:58:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729920; bh=cwYVA5ku9iWbOLnzjHvadjXVOQ6ppJC4qboEjze0bsQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cFl+04RpznFMm/njSLBa1k6B4cUOrKfI6+iuAepcmjZdLlYb0LCx4h7XDTMCBg1Fr lL4esw62h8iAHVCCfgZIdjaExj3icXwAPzs7OIBlcxp3HhbrnM5AlFlgVqZU/Xeu+z aHMUf1ZF5dHQGYgEkvW49l69ThxQ6BoqhxwWqnf4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 5.18 116/141] serial: 8250: Store to lsr_save_flags after lsr read Date: Mon, 20 Jun 2022 14:50:54 +0200 Message-Id: <20220620124732.976352182@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ilpo J=C3=A4rvinen commit be03b0651ffd8bab69dfd574c6818b446c0753ce upstream. Not all LSR register flags are preserved across reads. Therefore, LSR readers must store the non-preserved bits into lsr_save_flags. This fix was initially mixed into feature commit f6f586102add ("serial: 8250: Handle UART without interrupt on TEMT using em485"). However, that feature change had a flaw and it was reverted to make room for simpler approach providing the same feature. The embedded fix got reverted with the feature change. Re-add the lsr_save_flags fix and properly mark it's a fix. Link: https://lore.kernel.org/all/1d6c31d-d194-9e6a-ddf9-5f29af829f3@linux.= intel.com/T/#m1737eef986bd20cf19593e344cebd7b0244945fc Fixes: e490c9144cfa ("tty: Add software emulated RS485 support for 8250") Cc: stable Acked-by: Uwe Kleine-K=C3=B6nig Signed-off-by: Uwe Kleine-K=C3=B6nig Signed-off-by: Ilpo J=C3=A4rvinen Link: https://lore.kernel.org/r/f4d774be-1437-a550-8334-19d8722ab98c@linux.= intel.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/tty/serial/8250/8250_port.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/tty/serial/8250/8250_port.c +++ b/drivers/tty/serial/8250/8250_port.c @@ -1535,6 +1535,8 @@ static inline void __stop_tx(struct uart =20 if (em485) { unsigned char lsr =3D serial_in(p, UART_LSR); + p->lsr_saved_flags |=3D lsr & LSR_SAVE_FLAGS; + /* * To provide required timeing and allow FIFO transfer, * __stop_tx_rs485() must be called only when both FIFO and From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94C55CCA479 for ; Mon, 20 Jun 2022 13:06:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244950AbiFTNGI (ORCPT ); Mon, 20 Jun 2022 09:06:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244819AbiFTNEC (ORCPT ); Mon, 20 Jun 2022 09:04:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15542192B2; Mon, 20 Jun 2022 05:58: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 A6AE361449; Mon, 20 Jun 2022 12:58:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 95FA8C341C4; Mon, 20 Jun 2022 12:58:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729924; bh=7HXLfzXZPKUoSFxq2zbCBvTU5X7bq2SjOdG0EnWubOU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YSi8t9i0qB8tkZHs+DZh0eZtPwNv6myZX0RB7cLb9qmNWVMBoUDDtVjRVuGQNODB6 W3/MExqo50blkL3NVIucNkvLERFTqhuejptvlJudb772Qj0DrmvEC/b/h5ki0RTmDF EdT+LzisWx4u5HgsWEeHePfZ+k1e5B9q0SLQAQ/Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Shinichiro Kawasaki Subject: [PATCH 5.18 117/141] bus: fsl-mc-bus: fix KASAN use-after-free in fsl_mc_bus_remove() Date: Mon, 20 Jun 2022 14:50:55 +0200 Message-Id: <20220620124733.007864957@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Shin'ichiro Kawasaki commit 928ea98252ad75118950941683893cf904541da9 upstream. In fsl_mc_bus_remove(), mc->root_mc_bus_dev->mc_io is passed to fsl_destroy_mc_io(). However, mc->root_mc_bus_dev is already freed in fsl_mc_device_remove(). Then reference to mc->root_mc_bus_dev->mc_io triggers KASAN use-after-free. To avoid the use-after-free, keep the reference to mc->root_mc_bus_dev->mc_io in a local variable and pass to fsl_destroy_mc_io(). This patch needs rework to apply to kernels older than v5.15. Fixes: f93627146f0e ("staging: fsl-mc: fix asymmetry in destroy of mc_io") Cc: stable@vger.kernel.org # v5.15+ Signed-off-by: Shin'ichiro Kawasaki Link: https://lore.kernel.org/r/20220601105159.87752-1-shinichiro.kawasaki@= wdc.com Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/bus/fsl-mc/fsl-mc-bus.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/bus/fsl-mc/fsl-mc-bus.c +++ b/drivers/bus/fsl-mc/fsl-mc-bus.c @@ -1236,14 +1236,14 @@ error_cleanup_mc_io: static int fsl_mc_bus_remove(struct platform_device *pdev) { struct fsl_mc *mc =3D platform_get_drvdata(pdev); + struct fsl_mc_io *mc_io; =20 if (!fsl_mc_is_root_dprc(&mc->root_mc_bus_dev->dev)) return -EINVAL; =20 + mc_io =3D mc->root_mc_bus_dev->mc_io; fsl_mc_device_remove(mc->root_mc_bus_dev); - - fsl_destroy_mc_io(mc->root_mc_bus_dev->mc_io); - mc->root_mc_bus_dev->mc_io =3D NULL; + fsl_destroy_mc_io(mc_io); =20 bus_unregister_notifier(&fsl_mc_bus_type, &fsl_mc_nb); From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CECCC43334 for ; Mon, 20 Jun 2022 13:10:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244345AbiFTNKm (ORCPT ); Mon, 20 Jun 2022 09:10:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231754AbiFTNF4 (ORCPT ); Mon, 20 Jun 2022 09:05:56 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B800E1A044; Mon, 20 Jun 2022 06:00:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7C2A9B811B9; Mon, 20 Jun 2022 13:00:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D9AD1C3411B; Mon, 20 Jun 2022 13:00:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655730021; bh=jEjmNSh47oqp7uebHlYwyx7toZeZXvjP9kh3xiYrcNo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YQR+yTBsFekN7oF6VPVg0bBgArZYU4yGbiyHtb2zxXJf6tyNeI6wlkVjaTPUakrGE 6aLtKsc3cZJIZRt/2uTdIr4V0vGs/71VmfQdu9E0WB9xhAI3uuYCCHY2syaW2l8qtO XGNFsp1PrkCcGOrEnN/VoPz12C8/JXTW8ZenuD5I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Logan Gunthorpe , Christoph Hellwig , Song Liu Subject: [PATCH 5.18 118/141] md/raid5-ppl: Fix argument order in bio_alloc_bioset() Date: Mon, 20 Jun 2022 14:50:56 +0200 Message-Id: <20220620124733.039144373@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Logan Gunthorpe commit f34fdcd4a0e7a0b92340ad7e48e7bcff9393fab5 upstream. bio_alloc_bioset() takes a block device, number of vectors, the OP flags, the GFP mask and the bio set. However when the prototype was changed, the callisite in ppl_do_flush() had the OP flags and the GFP flags reversed. This introduced some sparse error: drivers/md/raid5-ppl.c:632:57: warning: incorrect type in argument 3 (different base types) drivers/md/raid5-ppl.c:632:57: expected unsigned int opf drivers/md/raid5-ppl.c:632:57: got restricted gfp_t [usertype] drivers/md/raid5-ppl.c:633:61: warning: incorrect type in argument 4 (different base types) drivers/md/raid5-ppl.c:633:61: expected restricted gfp_t [usertype] gfp_mask drivers/md/raid5-ppl.c:633:61: got unsigned long long The sparse error introduction may not have been reported correctly by 0day due to other work that was cleaning up other sparse errors in this area. Fixes: 609be1066731 ("block: pass a block_device and opf to bio_alloc_biose= t") Cc: stable@vger.kernel.org # 5.18+ Signed-off-by: Logan Gunthorpe Reviewed-by: Christoph Hellwig Signed-off-by: Song Liu Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/md/raid5-ppl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/md/raid5-ppl.c +++ b/drivers/md/raid5-ppl.c @@ -629,9 +629,9 @@ static void ppl_do_flush(struct ppl_io_u if (bdev) { struct bio *bio; =20 - bio =3D bio_alloc_bioset(bdev, 0, GFP_NOIO, + bio =3D bio_alloc_bioset(bdev, 0, REQ_OP_WRITE | REQ_PREFLUSH, - &ppl_conf->flush_bs); + GFP_NOIO, &ppl_conf->flush_bs); bio->bi_private =3D io; bio->bi_end_io =3D ppl_flush_endio; From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65808C43334 for ; Mon, 20 Jun 2022 13:06:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244279AbiFTNGz (ORCPT ); Mon, 20 Jun 2022 09:06:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244888AbiFTNEH (ORCPT ); Mon, 20 Jun 2022 09:04:07 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 664EE1704A; Mon, 20 Jun 2022 05:59:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 256FEB811B9; Mon, 20 Jun 2022 12:59:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69B1AC341C4; Mon, 20 Jun 2022 12:59:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729947; bh=6lvvz833Vj6N548GKBS9vgnbN0iGWG1CACzGXTabowE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VKAmi3j7tEbQ4BXgE+o6SpKJc8JGCaocE0ICmBkRHeybjH5n2GNKQF1oxkRcknCVp BBOawt/eOjzTEUdn0stLVc273mcoWgikssMDBPyg1YhIg2NXVC/ryLmKZ9GBqS2uB8 z746kTos56oQ2XoMuYCgbyxVESEqp/MIFC7KcPKY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benjamin Marzinski , Mike Snitzer Subject: [PATCH 5.18 119/141] dm: fix race in dm_start_io_acct Date: Mon, 20 Jun 2022 14:50:57 +0200 Message-Id: <20220620124733.068967731@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Benjamin Marzinski commit 10eb3a0d517fcc83eeea4242c149461205675eb4 upstream. After commit 82f6cdcc3676c ("dm: switch dm_io booleans over to proper flags") dm_start_io_acct stopped atomically checking and setting was_accounted, which turned into the DM_IO_ACCOUNTED flag. This opened the possibility for a race where IO accounting is started twice for duplicate bios. To remove the race, check the flag while holding the io->lock. Fixes: 82f6cdcc3676c ("dm: switch dm_io booleans over to proper flags") Cc: stable@vger.kernel.org Signed-off-by: Benjamin Marzinski Signed-off-by: Mike Snitzer Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/md/dm.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -551,6 +551,10 @@ static void dm_start_io_acct(struct dm_i return; /* Can afford locking given DM_TIO_IS_DUPLICATE_BIO */ spin_lock_irqsave(&io->lock, flags); + if (dm_io_flagged(io, DM_IO_ACCOUNTED)) { + spin_unlock_irqrestore(&io->lock, flags); + return; + } dm_io_set_flag(io, DM_IO_ACCOUNTED); spin_unlock_irqrestore(&io->lock, flags); } From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3B816C433EF for ; Mon, 20 Jun 2022 13:07:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244777AbiFTNHq (ORCPT ); Mon, 20 Jun 2022 09:07:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244023AbiFTNEd (ORCPT ); Mon, 20 Jun 2022 09:04:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FF05193DF; Mon, 20 Jun 2022 05:59: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 3B02461535; Mon, 20 Jun 2022 12:59:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39599C3411B; Mon, 20 Jun 2022 12:59:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729984; bh=QWVOvaoQcs9rJFN9ZErPqPmZV92C+J1OsaNkwQKcuwg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yWwrCNMheFllQcwOVMHZ6q2dET4Wxbc1PtU+7cyhX/Ck+W8DnFv+HH7XK3jOcdEP8 3qcZUaipp2HBDokaZGJm+U2mkK/XPQNAlqyX6H7VV528WF88I8Z0aDNOXMjO00Um1d NlhOckT1blSXbHMPE92VXTyZq4kVKDc7gvJwWVyE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mikulas Patocka , Mike Snitzer Subject: [PATCH 5.18 120/141] dm mirror log: round up region bitmap size to BITS_PER_LONG Date: Mon, 20 Jun 2022 14:50:58 +0200 Message-Id: <20220620124733.098180033@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mikulas Patocka commit 85e123c27d5cbc22cfdc01de1e2ca1d9003a02d0 upstream. The code in dm-log rounds up bitset_size to 32 bits. It then uses find_next_zero_bit_le on the allocated region. find_next_zero_bit_le accesses the bitmap using unsigned long pointers. So, on 64-bit architectures, it may access 4 bytes beyond the allocated size. Fix this bug by rounding up bitset_size to BITS_PER_LONG. This bug was found by running the lvm2 testsuite with kasan. Fixes: 29121bd0b00e ("[PATCH] dm mirror log: bitset_size fix") Cc: stable@vger.kernel.org Signed-off-by: Mikulas Patocka Signed-off-by: Mike Snitzer Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/md/dm-log.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/md/dm-log.c +++ b/drivers/md/dm-log.c @@ -415,8 +415,7 @@ static int create_log_context(struct dm_ /* * Work out how many "unsigned long"s we need to hold the bitset. */ - bitset_size =3D dm_round_up(region_count, - sizeof(*lc->clean_bits) << BYTE_SHIFT); + bitset_size =3D dm_round_up(region_count, BITS_PER_LONG); bitset_size >>=3D BYTE_SHIFT; =20 lc->bitset_uint32_count =3D bitset_size / sizeof(*lc->clean_bits); From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AD464C43334 for ; Mon, 20 Jun 2022 13:08:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244459AbiFTNIH (ORCPT ); Mon, 20 Jun 2022 09:08:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244102AbiFTNEe (ORCPT ); Mon, 20 Jun 2022 09:04:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23DC3193EE; Mon, 20 Jun 2022 06:00:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D0C72B811A0; Mon, 20 Jun 2022 13:00:00 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 462EBC3411C; Mon, 20 Jun 2022 12:59:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729999; bh=4eEArlpWSzPV0yFPHRd+8RXA4uz8/VX0gZoxA2wJTCg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y3J6mQqj3InNeqMkvCLmHNGmHr7/i/2s5AQZ98NO41xF5UHM6yFCKSGOC3cl6e217 RVI62tB622prTtm519xJivHDH5FJuPjwPKd4lYLtA7+a2oPGxqYf+E2WISFzOxgxMP 5WMU6yG59FCyQM7Fz+3kK4XPVEA679g40WOBy9CU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Martin Roukala , Mike Lothian , =?UTF-8?q?Christian=20K=C3=B6nig?= , =?UTF-8?q?Michel=20D=C3=A4nzer?= , Alex Deucher Subject: [PATCH 5.18 121/141] drm/amdgpu: Fix GTT size reporting in amdgpu_ioctl Date: Mon, 20 Jun 2022 14:50:59 +0200 Message-Id: <20220620124733.127207927@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michel D=C3=A4nzer commit c904e3acbab3fd97649cd4ab1ff7f1521ad3a255 upstream. The commit below changed the TTM manager size unit from pages to bytes, but failed to adjust the corresponding calculations in amdgpu_ioctl. Fixes: dfa714b88eb0 ("drm/amdgpu: remove GTT accounting v2") Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1930 Bug: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6642 Tested-by: Martin Roukala Tested-by: Mike Lothian Reviewed-by: Christian K=C3=B6nig Signed-off-by: Michel D=C3=A4nzer Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org # 5.18.x Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 2 -- 1 file changed, 2 deletions(-) --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c @@ -634,7 +634,6 @@ int amdgpu_info_ioctl(struct drm_device atomic64_read(&adev->visible_pin_size), vram_gtt.vram_size); vram_gtt.gtt_size =3D ttm_manager_type(&adev->mman.bdev, TTM_PL_TT)->siz= e; - vram_gtt.gtt_size *=3D PAGE_SIZE; vram_gtt.gtt_size -=3D atomic64_read(&adev->gart_pin_size); return copy_to_user(out, &vram_gtt, min((size_t)size, sizeof(vram_gtt))) ? -EFAULT : 0; @@ -667,7 +666,6 @@ int amdgpu_info_ioctl(struct drm_device mem.cpu_accessible_vram.usable_heap_size * 3 / 4; =20 mem.gtt.total_heap_size =3D gtt_man->size; - mem.gtt.total_heap_size *=3D PAGE_SIZE; mem.gtt.usable_heap_size =3D mem.gtt.total_heap_size - atomic64_read(&adev->gart_pin_size); mem.gtt.heap_usage =3D ttm_resource_manager_usage(gtt_man); From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65516C433EF for ; Mon, 20 Jun 2022 13:08:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245025AbiFTNIL (ORCPT ); Mon, 20 Jun 2022 09:08:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244166AbiFTNEk (ORCPT ); Mon, 20 Jun 2022 09:04: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 7CC35193F0; Mon, 20 Jun 2022 06:00:03 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1A05A61541; Mon, 20 Jun 2022 13:00:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 21664C3411B; Mon, 20 Jun 2022 13:00:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655730002; bh=KnvmfHGYjEmIeJj0HwTROEOQWU54zeoo8U8eu5ebRCw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p/t5gkOZ97NTRtOD9yDznNmGc7R9PZq9Vd8bfyGGUGVX+LsqMnyzKHVrBNP8fdLKZ O2EwQcb40DTtR37rAugPHuI2oYgSFMVo1RoP/buaJsz3q6VvmhGM3cincrI6R0lQoD 2EpIQiu2jlN037BeDwnRGWvaZ7wxiKbUoRhckVsI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rodrigo Siqueira , Hamza Mahfooz , Roman Li , Daniel Wheeler , Alex Deucher Subject: [PATCH 5.18 122/141] drm/amd/display: Cap OLED brightness per max frame-average luminance Date: Mon, 20 Jun 2022 14:51:00 +0200 Message-Id: <20220620124733.158396954@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Roman Li commit 4fd17f2ac0aa4e48823ac2ede5b050fb70300bf4 upstream. [Why] For OLED eDP the Display Manager uses max_cll value as a limit for brightness control. max_cll defines the content light luminance for individual pixel. Whereas max_fall defines frame-average level luminance. The user may not observe the difference in brightness in between max_fall and max_cll. That negatively impacts the user experience. [How] Use max_fall value instead of max_cll as a limit for brightness control. Reviewed-by: Rodrigo Siqueira Acked-by: Hamza Mahfooz Signed-off-by: Roman Li Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -2835,7 +2835,7 @@ static struct drm_mode_config_helper_fun =20 static void update_connector_ext_caps(struct amdgpu_dm_connector *aconnect= or) { - u32 max_cll, min_cll, max, min, q, r; + u32 max_avg, min_cll, max, min, q, r; struct amdgpu_dm_backlight_caps *caps; struct amdgpu_display_manager *dm; struct drm_connector *conn_base; @@ -2865,7 +2865,7 @@ static void update_connector_ext_caps(st caps =3D &dm->backlight_caps[i]; caps->ext_caps =3D &aconnector->dc_link->dpcd_sink_ext_caps; caps->aux_support =3D false; - max_cll =3D conn_base->hdr_sink_metadata.hdmi_type1.max_cll; + max_avg =3D conn_base->hdr_sink_metadata.hdmi_type1.max_fall; min_cll =3D conn_base->hdr_sink_metadata.hdmi_type1.min_cll; =20 if (caps->ext_caps->bits.oled =3D=3D 1 /*|| @@ -2893,8 +2893,8 @@ static void update_connector_ext_caps(st * The results of the above expressions can be verified at * pre_computed_values. */ - q =3D max_cll >> 5; - r =3D max_cll % 32; + q =3D max_avg >> 5; + r =3D max_avg % 32; max =3D (1 << q) * pre_computed_values[r]; =20 // min luminance: maxLum * (CV/255)^2 / 100 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0570EC433EF for ; Mon, 20 Jun 2022 13:08:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244456AbiFTNIO (ORCPT ); Mon, 20 Jun 2022 09:08:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244194AbiFTNEm (ORCPT ); Mon, 20 Jun 2022 09:04:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACDB1193F4; Mon, 20 Jun 2022 06:00:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4A1516153E; Mon, 20 Jun 2022 13:00:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5067FC3411C; Mon, 20 Jun 2022 13:00:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655730005; bh=pSRUrrJVSkmqn3e99bE13Jtw6ybKL9gmtfLgF359Uqg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yBjg27uku6aTBxmhfz3UkgfyfwxYcjCqEM3ODMona/WDj2ASTs1rekzLsVKJW8hqB l+12x3B+Ce9xZuO07nZFvkT/ZBmsWn36zXCG8011ppeRF/eduBTF1Tm5v2Kh+M1h5F L0QRatGImbJXKvBnyQkU9fSFHdJzXS5svKKku9pM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Christian=20G=C3=B6ttsche?= , Paul Moore Subject: [PATCH 5.18 123/141] audit: free module name Date: Mon, 20 Jun 2022 14:51:01 +0200 Message-Id: <20220620124733.188036063@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christian G=C3=B6ttsche commit ef79c396c664be99d0c5660dc75fe863c1e20315 upstream. Reset the type of the record last as the helper `audit_free_module()` depends on it. unreferenced object 0xffff888153b707f0 (size 16): comm "modprobe", pid 1319, jiffies 4295110033 (age 1083.016s) hex dump (first 16 bytes): 62 69 6e 66 6d 74 5f 6d 69 73 63 00 6b 6b 6b a5 binfmt_misc.kkk. backtrace: [] kstrdup+0x2b/0x50 [] __audit_log_kern_module+0x4d/0xf0 [] load_module+0x9d4/0x2e10 [] __do_sys_finit_module+0x114/0x1b0 [] do_syscall_64+0x34/0x80 [] entry_SYSCALL_64_after_hwframe+0x46/0xb0 Cc: stable@vger.kernel.org Fixes: 12c5e81d3fd0 ("audit: prepare audit_context for use in calling conte= xts beyond syscalls") Signed-off-by: Christian G=C3=B6ttsche Signed-off-by: Paul Moore Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- kernel/auditsc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/kernel/auditsc.c +++ b/kernel/auditsc.c @@ -1014,10 +1014,10 @@ static void audit_reset_context(struct a ctx->target_comm[0] =3D '\0'; unroll_tree_refs(ctx, NULL, 0); WARN_ON(!list_empty(&ctx->killed_trees)); - ctx->type =3D 0; audit_free_module(ctx); ctx->fds[0] =3D -1; audit_proctitle_free(ctx); + ctx->type =3D 0; /* reset last for audit_free_*() */ } =20 static inline struct audit_context *audit_alloc_context(enum audit_state s= tate) From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65844C43334 for ; Mon, 20 Jun 2022 13:08:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244880AbiFTNIB (ORCPT ); Mon, 20 Jun 2022 09:08:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244226AbiFTNEo (ORCPT ); Mon, 20 Jun 2022 09:04:44 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DF8519C03; Mon, 20 Jun 2022 06:00:09 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2A95561542; Mon, 20 Jun 2022 13:00:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 20E19C3411C; Mon, 20 Jun 2022 13:00:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655730008; bh=uGrc4TFtsDDheb0tYM3honumC3oheP7ORB0HHwlNEes=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X4lT8BOCexjpEkHtFjQSF9cCVFb+MzlPDcm5E9cN7uIsLw3aIXky5ZqmvBLTsoUhs HDX4JCuMV58xoakMuyHhHeFmfTTjCg3eHJcjaQ0j1H0VNamWxSDiK9pI673kekIC4l 3WSpVl56hU9i333TvhvqOv85VsakeKASxxXI30+0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sami Tolvanen , Kees Cook Subject: [PATCH 5.18 124/141] cfi: Fix __cfi_slowpath_diag RCU usage with cpuidle Date: Mon, 20 Jun 2022 14:51:02 +0200 Message-Id: <20220620124733.217761642@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Sami Tolvanen commit 57cd6d157eb479f0a8e820fd36b7240845c8a937 upstream. RCU_NONIDLE usage during __cfi_slowpath_diag can result in an invalid RCU state in the cpuidle code path: WARNING: CPU: 1 PID: 0 at kernel/rcu/tree.c:613 rcu_eqs_enter+0xe4/0x138 ... Call trace: rcu_eqs_enter+0xe4/0x138 rcu_idle_enter+0xa8/0x100 cpuidle_enter_state+0x154/0x3a8 cpuidle_enter+0x3c/0x58 do_idle.llvm.6590768638138871020+0x1f4/0x2ec cpu_startup_entry+0x28/0x2c secondary_start_kernel+0x1b8/0x220 __secondary_switched+0x94/0x98 Instead, call rcu_irq_enter/exit to wake up RCU only when needed and disable interrupts for the entire CFI shadow/module check when we do. Signed-off-by: Sami Tolvanen Link: https://lore.kernel.org/r/20220531175910.890307-1-samitolvanen@google= .com Fixes: cf68fffb66d6 ("add support for Clang CFI") Cc: stable@vger.kernel.org Signed-off-by: Kees Cook Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- kernel/cfi.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) --- a/kernel/cfi.c +++ b/kernel/cfi.c @@ -281,6 +281,8 @@ static inline cfi_check_fn find_module_c static inline cfi_check_fn find_check_fn(unsigned long ptr) { cfi_check_fn fn =3D NULL; + unsigned long flags; + bool rcu_idle; =20 if (is_kernel_text(ptr)) return __cfi_check; @@ -290,13 +292,21 @@ static inline cfi_check_fn find_check_fn * the shadow and __module_address use RCU, so we need to wake it * up if necessary. */ - RCU_NONIDLE({ - if (IS_ENABLED(CONFIG_CFI_CLANG_SHADOW)) - fn =3D find_shadow_check_fn(ptr); + rcu_idle =3D !rcu_is_watching(); + if (rcu_idle) { + local_irq_save(flags); + rcu_irq_enter(); + } =20 - if (!fn) - fn =3D find_module_check_fn(ptr); - }); + if (IS_ENABLED(CONFIG_CFI_CLANG_SHADOW)) + fn =3D find_shadow_check_fn(ptr); + if (!fn) + fn =3D find_module_check_fn(ptr); + + if (rcu_idle) { + rcu_irq_exit(); + local_irq_restore(flags); + } =20 return fn; } From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 858DCC433EF for ; Mon, 20 Jun 2022 13:10:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245081AbiFTNI1 (ORCPT ); Mon, 20 Jun 2022 09:08:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244450AbiFTNFW (ORCPT ); Mon, 20 Jun 2022 09:05:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9ABB519C24; Mon, 20 Jun 2022 06:00:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 10DD4B811A6; Mon, 20 Jun 2022 13:00:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29CE9C3411B; Mon, 20 Jun 2022 13:00:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655730011; bh=WaG1nHyRp9gM42Yl11WvQkmWsXZ9kxeW+GdjIh4gZQ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=neck4NhXlgyFTZVyO1V8lKwrP4EVn6Zu3igtZNX+fkO38djIZIRYvK42qYL8yGZmV 02leBcLKj0NW6UAVyLQSNm+mAFDx3Lke8+kDGHhprnFminAPl16XUL53JU0MphfHC1 ynrG+MU9PtXMthTV7JfMwHtusnhmojboK4IQ1gqY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Seth Forshee , Christoph Hellwig , Aleksa Sarai , Al Viro , linux-fsdevel@vger.kernel.org, "Christian Brauner (Microsoft)" Subject: [PATCH 5.18 125/141] fs: account for group membership Date: Mon, 20 Jun 2022 14:51:03 +0200 Message-Id: <20220620124733.247984907@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christian Brauner commit 168f912893407a5acb798a4a58613b5f1f98c717 upstream. When calling setattr_prepare() to determine the validity of the attributes the ia_{g,u}id fields contain the value that will be written to inode->i_{g,u}id. This is exactly the same for idmapped and non-idmapped mounts and allows callers to pass in the values they want to see written to inode->i_{g,u}id. When group ownership is changed a caller whose fsuid owns the inode can change the group of the inode to any group they are a member of. When searching through the caller's groups we need to use the gid mapped according to the idmapped mount otherwise we will fail to change ownership for unprivileged users. Consider a caller running with fsuid and fsgid 1000 using an idmapped mount that maps id 65534 to 1000 and 65535 to 1001. Consequently, a file owned by 65534:65535 in the filesystem will be owned by 1000:1001 in the idmapped mount. The caller now requests the gid of the file to be changed to 1000 going through the idmapped mount. In the vfs we will immediately map the requested gid to the value that will need to be written to inode->i_gid and place it in attr->ia_gid. Since this idmapped mount maps 65534 to 1000 we place 65534 in attr->ia_gid. When we check whether the caller is allowed to change group ownership we first validate that their fsuid matches the inode's uid. The inode->i_uid is 65534 which is mapped to uid 1000 in the idmapped mount. Since the caller's fsuid is 1000 we pass the check. We now check whether the caller is allowed to change inode->i_gid to the requested gid by calling in_group_p(). This will compare the passed in gid to the caller's fsgid and search the caller's additional groups. Since we're dealing with an idmapped mount we need to pass in the gid mapped according to the idmapped mount. This is akin to checking whether a caller is privileged over the future group the inode is owned by. And that needs to take the idmapped mount into account. Note, all helpers are nops without idmapped mounts. New regression test sent to xfstests. Link: https://github.com/lxc/lxd/issues/10537 Link: https://lore.kernel.org/r/20220613111517.2186646-1-brauner@kernel.org Fixes: 2f221d6f7b88 ("attr: handle idmapped mounts") Cc: Seth Forshee Cc: Christoph Hellwig Cc: Aleksa Sarai Cc: Al Viro Cc: stable@vger.kernel.org # 5.15+ CC: linux-fsdevel@vger.kernel.org Reviewed-by: Seth Forshee Signed-off-by: Christian Brauner (Microsoft) Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- fs/attr.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) --- a/fs/attr.c +++ b/fs/attr.c @@ -61,9 +61,15 @@ static bool chgrp_ok(struct user_namespa const struct inode *inode, kgid_t gid) { kgid_t kgid =3D i_gid_into_mnt(mnt_userns, inode); - if (uid_eq(current_fsuid(), i_uid_into_mnt(mnt_userns, inode)) && - (in_group_p(gid) || gid_eq(gid, inode->i_gid))) - return true; + if (uid_eq(current_fsuid(), i_uid_into_mnt(mnt_userns, inode))) { + kgid_t mapped_gid; + + if (gid_eq(gid, inode->i_gid)) + return true; + mapped_gid =3D mapped_kgid_fs(mnt_userns, i_user_ns(inode), gid); + if (in_group_p(mapped_gid)) + return true; + } if (capable_wrt_inode_uidgid(mnt_userns, inode, CAP_CHOWN)) return true; if (gid_eq(kgid, INVALID_GID) && @@ -123,12 +129,20 @@ int setattr_prepare(struct user_namespac =20 /* Make sure a caller can chmod. */ if (ia_valid & ATTR_MODE) { + kgid_t mapped_gid; + if (!inode_owner_or_capable(mnt_userns, inode)) return -EPERM; + + if (ia_valid & ATTR_GID) + mapped_gid =3D mapped_kgid_fs(mnt_userns, + i_user_ns(inode), attr->ia_gid); + else + mapped_gid =3D i_gid_into_mnt(mnt_userns, inode); + /* Also check the setgid bit! */ - if (!in_group_p((ia_valid & ATTR_GID) ? attr->ia_gid : - i_gid_into_mnt(mnt_userns, inode)) && - !capable_wrt_inode_uidgid(mnt_userns, inode, CAP_FSETI= D)) + if (!in_group_p(mapped_gid) && + !capable_wrt_inode_uidgid(mnt_userns, inode, CAP_FSETID)) attr->ia_mode &=3D ~S_ISGID; } From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1F707CCA480 for ; Mon, 20 Jun 2022 13:10:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244594AbiFTNKh (ORCPT ); Mon, 20 Jun 2022 09:10:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244550AbiFTNFo (ORCPT ); Mon, 20 Jun 2022 09:05:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88C7C19F8B; Mon, 20 Jun 2022 06:00: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 38E7AB811C1; Mon, 20 Jun 2022 13:00:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69A68C3411B; Mon, 20 Jun 2022 13:00:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655730014; bh=EeDfFiTCi71k1MEHOyK+pfp0jw6HhaaTBU2SKACSyXU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KJPI9aJHzC1EbIQpsLaaRgST6L5QbxkuQJOz8Y4/QsgZWF9yTBfQqLOAHkxxdBxZT VwZMhDNZ+jS/ipOtNZjXKB3lHxMtFR/KdVrXRTXitwqSNRcaY3VkncKW1LseC0Ucg1 ULLExxFPmn2Ou4Cea3WepOv+3exNYniYtyoO/iUg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Christian=20G=C3=B6ttsche?= , Paul Moore Subject: [PATCH 5.18 126/141] selinux: free contexts previously transferred in selinux_add_opt() Date: Mon, 20 Jun 2022 14:51:04 +0200 Message-Id: <20220620124733.278609889@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christian G=C3=B6ttsche commit cad140d00899e7a9cb6fe93b282051df589e671c upstream. `selinux_add_opt()` stopped taking ownership of the passed context since commit 70f4169ab421 ("selinux: parse contexts for mount options early"). unreferenced object 0xffff888114dfd140 (size 64): comm "mount", pid 15182, jiffies 4295687028 (age 796.340s) hex dump (first 32 bytes): 73 79 73 74 65 6d 5f 75 3a 6f 62 6a 65 63 74 5f system_u:object_ 72 3a 74 65 73 74 5f 66 69 6c 65 73 79 73 74 65 r:test_filesyste backtrace: [] kmemdup_nul+0x24/0x80 [] selinux_sb_eat_lsm_opts+0x293/0x560 [] security_sb_eat_lsm_opts+0x58/0x80 [] generic_parse_monolithic+0x82/0x180 [] do_new_mount+0x1f5/0x550 [] path_mount+0x2ab/0x1570 [] __x64_sys_mount+0x20e/0x280 [] do_syscall_64+0x34/0x80 [] entry_SYSCALL_64_after_hwframe+0x46/0xb0 unreferenced object 0xffff888108e71640 (size 64): comm "fsmount", pid 7607, jiffies 4295044974 (age 1601.016s) hex dump (first 32 bytes): 73 79 73 74 65 6d 5f 75 3a 6f 62 6a 65 63 74 5f system_u:object_ 72 3a 74 65 73 74 5f 66 69 6c 65 73 79 73 74 65 r:test_filesyste backtrace: [] memdup_user+0x21/0x90 [] strndup_user+0x47/0xa0 [] __do_sys_fsconfig+0x485/0x9f0 [] do_syscall_64+0x34/0x80 [] entry_SYSCALL_64_after_hwframe+0x46/0xb0 Cc: stable@vger.kernel.org Fixes: 70f4169ab421 ("selinux: parse contexts for mount options early") Signed-off-by: Christian G=C3=B6ttsche Signed-off-by: Paul Moore Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- security/selinux/hooks.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c @@ -2600,8 +2600,9 @@ static int selinux_sb_eat_lsm_opts(char } } rc =3D selinux_add_opt(token, arg, mnt_opts); + kfree(arg); + arg =3D NULL; if (unlikely(rc)) { - kfree(arg); goto free_opt; } } else { @@ -2792,17 +2793,13 @@ static int selinux_fs_context_parse_para struct fs_parameter *param) { struct fs_parse_result result; - int opt, rc; + int opt; =20 opt =3D fs_parse(fc, selinux_fs_parameters, param, &result); if (opt < 0) return opt; =20 - rc =3D selinux_add_opt(opt, param->string, &fc->security); - if (!rc) - param->string =3D NULL; - - return rc; + return selinux_add_opt(opt, param->string, &fc->security); } =20 /* inode security operations */ From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE14FC43334 for ; Mon, 20 Jun 2022 13:10:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244908AbiFTNKk (ORCPT ); Mon, 20 Jun 2022 09:10:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244590AbiFTNFq (ORCPT ); Mon, 20 Jun 2022 09:05:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C5F1193F9; Mon, 20 Jun 2022 06:00: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 D900561535; Mon, 20 Jun 2022 13:00:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C90E6C341C4; Mon, 20 Jun 2022 13:00:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655730018; bh=FNIdFJvrZZ+HBipVpv9LH7IBT5OABlgIFVbnLZpbZIs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dqPqt226lOoqPWgyLLGD9EahzWhDcy1U1ZUlYgj3daZazCukmjv5jWzClRTf2FDDs IOLEhQ+wtObS4LLDr7GloI2fETClYg1a28wkN2dlSQWUEBqtJJTYmBR38atOWoE2xb ijep3YTZuYcIUM71A9Sv+yCM/7jFheccjxnTgi9w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ye Bin , stable@kernel.org, Jan Kara , Ritesh Harjani , Theodore Tso Subject: [PATCH 5.18 127/141] ext4: fix super block checksum incorrect after mount Date: Mon, 20 Jun 2022 14:51:05 +0200 Message-Id: <20220620124733.308680165@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ye Bin commit 9b6641dd95a0c441b277dd72ba22fed8d61f76ad upstream. We got issue as follows: [home]# mount /dev/sda test EXT4-fs (sda): warning: mounting fs with errors, running e2fsck is recommen= ded [home]# dmesg EXT4-fs (sda): warning: mounting fs with errors, running e2fsck is recommen= ded EXT4-fs (sda): Errors on filesystem, clearing orphan list. EXT4-fs (sda): recovery complete EXT4-fs (sda): mounted filesystem with ordered data mode. Quota mode: none. [home]# debugfs /dev/sda debugfs 1.46.5 (30-Dec-2021) Checksum errors in superblock! Retrying... Reason is ext4_orphan_cleanup will reset =E2=80=98s_last_orphan=E2=80=99 bu= t not update super block checksum. To solve above issue, defer update super block checksum after ext4_orphan_cleanup. Signed-off-by: Ye Bin Cc: stable@kernel.org Reviewed-by: Jan Kara Reviewed-by: Ritesh Harjani Link: https://lore.kernel.org/r/20220525012904.1604737-1-yebin10@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- fs/ext4/super.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -5422,14 +5422,6 @@ no_journal: err =3D percpu_counter_init(&sbi->s_freeinodes_counter, freei, GFP_KERNEL); } - /* - * Update the checksum after updating free space/inode - * counters. Otherwise the superblock can have an incorrect - * checksum in the buffer cache until it is written out and - * e2fsprogs programs trying to open a file system immediately - * after it is mounted can fail. - */ - ext4_superblock_csum_set(sb); if (!err) err =3D percpu_counter_init(&sbi->s_dirs_counter, ext4_count_dirs(sb), GFP_KERNEL); @@ -5487,6 +5479,14 @@ no_journal: EXT4_SB(sb)->s_mount_state |=3D EXT4_ORPHAN_FS; ext4_orphan_cleanup(sb, es); EXT4_SB(sb)->s_mount_state &=3D ~EXT4_ORPHAN_FS; + /* + * Update the checksum after updating free space/inode counters and + * ext4_orphan_cleanup. Otherwise the superblock can have an incorrect + * checksum in the buffer cache until it is written out and + * e2fsprogs programs trying to open a file system immediately + * after it is mounted can fail. + */ + ext4_superblock_csum_set(sb); if (needs_recovery) { ext4_msg(sb, KERN_INFO, "recovery complete"); err =3D ext4_mark_recovery_complete(sb, es); From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7B39C433EF for ; Mon, 20 Jun 2022 13:06:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242542AbiFTNGn (ORCPT ); Mon, 20 Jun 2022 09:06:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244894AbiFTNEI (ORCPT ); Mon, 20 Jun 2022 09:04:08 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74C66192B1; Mon, 20 Jun 2022 05:59:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 28878B811AC; Mon, 20 Jun 2022 12:59:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 601B4C3411B; Mon, 20 Jun 2022 12:59:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729950; bh=z6DvcFSfhI8fGkphsVPijT7Xyjg7/hGwsXJMof4MzYI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nM5fJVPp/GdhAfRNlZPzcQSJQ950gxIa43QONLE7SNFneNCXDi3OuzmfJ5yr58QLm a18WL6ZVneXlQXgCYGSvVTIca4l+G0k8W5YexyDuZL5/iP4VOMDOsWqFsOtd0pSdJL Bz1ID+oo76I1qok+0zaBB8z8T0EoKlWlLYEMX2Vg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Hulk Robot , Baokun Li , Ritesh Harjani , Theodore Tso Subject: [PATCH 5.18 128/141] ext4: fix bug_on ext4_mb_use_inode_pa Date: Mon, 20 Jun 2022 14:51:06 +0200 Message-Id: <20220620124733.338556842@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Baokun Li commit a08f789d2ab5242c07e716baf9a835725046be89 upstream. Hulk Robot reported a BUG_ON: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D kernel BUG at fs/ext4/mballoc.c:3211! [...] RIP: 0010:ext4_mb_mark_diskspace_used.cold+0x85/0x136f [...] Call Trace: ext4_mb_new_blocks+0x9df/0x5d30 ext4_ext_map_blocks+0x1803/0x4d80 ext4_map_blocks+0x3a4/0x1a10 ext4_writepages+0x126d/0x2c30 do_writepages+0x7f/0x1b0 __filemap_fdatawrite_range+0x285/0x3b0 file_write_and_wait_range+0xb1/0x140 ext4_sync_file+0x1aa/0xca0 vfs_fsync_range+0xfb/0x260 do_fsync+0x48/0xa0 [...] =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Above issue may happen as follows: Reported-by: Hulk Robot Reviewed-by: Ritesh Harjani Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz ------------------------------------- do_fsync vfs_fsync_range ext4_sync_file file_write_and_wait_range __filemap_fdatawrite_range do_writepages ext4_writepages mpage_map_and_submit_extent mpage_map_one_extent ext4_map_blocks ext4_mb_new_blocks ext4_mb_normalize_request >>> start + size <=3D ac->ac_o_ex.fe_logical ext4_mb_regular_allocator ext4_mb_simple_scan_group ext4_mb_use_best_found ext4_mb_new_preallocation ext4_mb_new_inode_pa ext4_mb_use_inode_pa >>> set ac->ac_b_ex.fe_len <=3D 0 ext4_mb_mark_diskspace_used >>> BUG_ON(ac->ac_b_ex.fe_len <=3D 0); we can easily reproduce this problem with the following commands: `fallocate -l100M disk` `mkfs.ext4 -b 1024 -g 256 disk` `mount disk /mnt` `fsstress -d /mnt -l 0 -n 1000 -p 1` The size must be smaller than or equal to EXT4_BLOCKS_PER_GROUP. Therefore, "start + size <=3D ac->ac_o_ex.fe_logical" may occur when the size is truncated. So start should be the start position of the group where ac_o_ex.fe_logical is located after alignment. In addition, when the value of fe_logical or EXT4_BLOCKS_PER_GROUP is very large, the value calculated by start_off is more accurate. Cc: stable@kernel.org Fixes: cd648b8a8fd5 ("ext4: trim allocation requests to group size") Reported-by: Hulk Robot Signed-off-by: Baokun Li Reviewed-by: Ritesh Harjani Link: https://lore.kernel.org/r/20220528110017.354175-2-libaokun1@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/ext4/mballoc.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -4107,6 +4107,15 @@ ext4_mb_normalize_request(struct ext4_al size =3D size >> bsbits; start =3D start_off >> bsbits; =20 + /* + * For tiny groups (smaller than 8MB) the chosen allocation + * alignment may be larger than group size. Make sure the + * alignment does not move allocation to a different group which + * makes mballoc fail assertions later. + */ + start =3D max(start, rounddown(ac->ac_o_ex.fe_logical, + (ext4_lblk_t)EXT4_BLOCKS_PER_GROUP(ac->ac_sb))); + /* don't cover already allocated blocks in selected range */ if (ar->pleft && start <=3D ar->lleft) { size -=3D ar->lleft + 1 - start; From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 615E1C43334 for ; Mon, 20 Jun 2022 13:07:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244479AbiFTNHF (ORCPT ); Mon, 20 Jun 2022 09:07:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244922AbiFTNEJ (ORCPT ); Mon, 20 Jun 2022 09:04:09 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4D4D193CC; Mon, 20 Jun 2022 05:59:14 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 71D9F61530; Mon, 20 Jun 2022 12:59:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7D997C3411C; Mon, 20 Jun 2022 12:59:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729953; bh=FRIHHuVh15uysefwcHw6kzr8sXWetG0k9h7RAVWZX90=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UsRoBfzfciZ1PJ6zJFXkJvPp5P2gOHVMVJyoXS3Ka0DGi3QyH3E/BEjTdFhqPlYCL Nl89GwS6sDiC1wF9UwxzNJUa+P7176np+dZeIT59e972x+bPVXz5nxLkjyVzyGeAAw OdZG7otTr9MYkaj9x2kfKVGlfcYIzVKNbPhquCOg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Ding Xiang , Theodore Tso Subject: [PATCH 5.18 129/141] ext4: make variable "count" signed Date: Mon, 20 Jun 2022 14:51:07 +0200 Message-Id: <20220620124733.369503971@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Ding Xiang commit bc75a6eb856cb1507fa907bf6c1eda91b3fef52f upstream. Since dx_make_map() may return -EFSCORRUPTED now, so change "count" to be a signed integer so we can correctly check for an error code returned by dx_make_map(). Fixes: 46c116b920eb ("ext4: verify dir block before splitting it") Cc: stable@kernel.org Signed-off-by: Ding Xiang Link: https://lore.kernel.org/r/20220530100047.537598-1-dingxiang@cmss.chin= amobile.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- fs/ext4/namei.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -1929,7 +1929,8 @@ static struct ext4_dir_entry_2 *do_split struct dx_hash_info *hinfo) { unsigned blocksize =3D dir->i_sb->s_blocksize; - unsigned count, continued; + unsigned continued; + int count; struct buffer_head *bh2; ext4_lblk_t newblock; u32 hash2; From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA60EC433EF for ; Mon, 20 Jun 2022 13:07:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244232AbiFTNHC (ORCPT ); Mon, 20 Jun 2022 09:07:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244915AbiFTNEJ (ORCPT ); Mon, 20 Jun 2022 09:04:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 61976186E1; Mon, 20 Jun 2022 05:59:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1931BB811A5; Mon, 20 Jun 2022 12:59:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7654AC3411B; Mon, 20 Jun 2022 12:59:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729956; bh=uff/LSoDCFORTp4ktTMN5owM8qbjZKsdjHY4n5fumQY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fyCyhiZbQEty+8KMZGDrawEnievsCHV6zNxGeUCZ7/oLAhsVbnyMBOqH0hfNLMoJ2 ve7HhbEh+ZL61gphdAiUuAwkcPkypCyrTdYb581kP7+C9/5GivRHUwmcgsJlQS53Vp a+0lg+GZHq7PIwBmyu9ndzi8USklW/VwE+Iyu28w= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Zhang Yi , Ritesh Harjani , Jan Kara , Theodore Tso Subject: [PATCH 5.18 130/141] ext4: add reserved GDT blocks check Date: Mon, 20 Jun 2022 14:51:08 +0200 Message-Id: <20220620124733.399180590@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Zhang Yi commit b55c3cd102a6f48b90e61c44f7f3dda8c290c694 upstream. We capture a NULL pointer issue when resizing a corrupt ext4 image which is freshly clear resize_inode feature (not run e2fsck). It could be simply reproduced by following steps. The problem is because of the resize_inode feature was cleared, and it will convert the filesystem to meta_bg mode in ext4_resize_fs(), but the es->s_reserved_gdt_blocks was not reduced to zero, so could we mistakenly call reserve_backup_gdb() and passing an uninitialized resize_inode to it when adding new group descriptors. mkfs.ext4 /dev/sda 3G tune2fs -O ^resize_inode /dev/sda #forget to run requested e2fsck mount /dev/sda /mnt resize2fs /dev/sda 8G =3D=3D=3D=3D=3D=3D=3D=3D BUG: kernel NULL pointer dereference, address: 0000000000000028 CPU: 19 PID: 3243 Comm: resize2fs Not tainted 5.18.0-rc7-00001-gfde086c5eb= fd #748 ... RIP: 0010:ext4_flex_group_add+0xe08/0x2570 ... Call Trace: ext4_resize_fs+0xbec/0x1660 __ext4_ioctl+0x1749/0x24e0 ext4_ioctl+0x12/0x20 __x64_sys_ioctl+0xa6/0x110 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x7f2dd739617b =3D=3D=3D=3D=3D=3D=3D=3D The fix is simple, add a check in ext4_resize_begin() to make sure that the es->s_reserved_gdt_blocks is zero when the resize_inode feature is disabled. Cc: stable@kernel.org Signed-off-by: Zhang Yi Reviewed-by: Ritesh Harjani Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220601092717.763694-1-yi.zhang@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- fs/ext4/resize.c | 10 ++++++++++ 1 file changed, 10 insertions(+) --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c @@ -54,6 +54,16 @@ int ext4_resize_begin(struct super_block return -EPERM; =20 /* + * If the reserved GDT blocks is non-zero, the resize_inode feature + * should always be set. + */ + if (EXT4_SB(sb)->s_es->s_reserved_gdt_blocks && + !ext4_has_feature_resize_inode(sb)) { + ext4_error(sb, "resize_inode disabled but reserved GDT blocks non-zero"); + return -EFSCORRUPTED; + } + + /* * If we are not using the primary superblock/GDT copy don't resize, * because the user tools have no way of handling this. Probably a * bad time to do it anyways. From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 60EE1C43334 for ; Mon, 20 Jun 2022 13:07:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244513AbiFTNHK (ORCPT ); Mon, 20 Jun 2022 09:07:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244923AbiFTNEJ (ORCPT ); Mon, 20 Jun 2022 09:04:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3698186FE; Mon, 20 Jun 2022 05:59:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8BC82B811B9; Mon, 20 Jun 2022 12:59:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2628C3411C; Mon, 20 Jun 2022 12:59:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729960; bh=V0hnx/OqzswVYqIqJ7kc+Fe522IaypFMS8wlfWSPkHI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=roJIL/2SRH52DPl0lVBlGRAJAa7j+W9STncuOYTZnu8nu7vZ9DkJQYQi1X1W3VNRC PXrYxwYlpWh15XA6uY04OH2leH4PHVtsfVTG8ZVzaUX+eZ/zDAtU0OTo0Zt/DmUyT2 I/GvDp1eIgbidgSkQUB9HdBW3buJnngoOQAk7mrU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marc Zyngier , Mark Brown Subject: [PATCH 5.18 131/141] KVM: arm64: Always start with clearing SVE flag on load Date: Mon, 20 Jun 2022 14:51:09 +0200 Message-Id: <20220620124733.428882608@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marc Zyngier commit d52d165d67c5aa26c8c89909003c94a66492d23d upstream. On each vcpu load, we set the KVM_ARM64_HOST_SVE_ENABLED flag if SVE is enabled for EL0 on the host. This is used to restore the correct state on vpcu put. However, it appears that nothing ever clears this flag. Once set, it will stick until the vcpu is destroyed, which has the potential to spuriously enable SVE for userspace. We probably never saw the issue because no VMM uses SVE, but that's still pretty bad. Unconditionally clearing the flag on vcpu load addresses the issue. Fixes: 8383741ab2e7 ("KVM: arm64: Get rid of host SVE tracking/saving") Signed-off-by: Marc Zyngier Cc: stable@vger.kernel.org Reviewed-by: Mark Brown Link: https://lore.kernel.org/r/20220528113829.1043361-2-maz@kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/arm64/kvm/fpsimd.c | 1 + 1 file changed, 1 insertion(+) --- a/arch/arm64/kvm/fpsimd.c +++ b/arch/arm64/kvm/fpsimd.c @@ -80,6 +80,7 @@ void kvm_arch_vcpu_load_fp(struct kvm_vc vcpu->arch.flags &=3D ~KVM_ARM64_FP_ENABLED; vcpu->arch.flags |=3D KVM_ARM64_FP_HOST; =20 + vcpu->arch.flags &=3D ~KVM_ARM64_HOST_SVE_ENABLED; if (read_sysreg(cpacr_el1) & CPACR_EL1_ZEN_EL0EN) vcpu->arch.flags |=3D KVM_ARM64_HOST_SVE_ENABLED; } From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65C77C43334 for ; Mon, 20 Jun 2022 13:07:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244047AbiFTNHg (ORCPT ); Mon, 20 Jun 2022 09:07:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244927AbiFTNEJ (ORCPT ); Mon, 20 Jun 2022 09:04: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 7B93D193D3; Mon, 20 Jun 2022 05:59:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 19F636153E; Mon, 20 Jun 2022 12:59:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D6B47C3411C; Mon, 20 Jun 2022 12:59:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729963; bh=udKYPvsT06cU8qjZ5wf0OQiIZyQGn9ezzGJ2iwG8vDQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p94pYMxqcvWaVAzcjPBjP9sQBuI7/zlGVynt3fbPKw5M3/+qPH0nAr3PUIP4gqu8I ykXNU0+otEwM+R0hBVTJOhJ5/Cd7a28wE79dGQwYv02dRyFqjCgYpbBApBO1s/eamc KfCTq2H4VTbgu8hAk7Lpkwv5iXT4ypa9fsaQ0KPQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Auger , Marc Zyngier Subject: [PATCH 5.18 132/141] KVM: arm64: Dont read a HW interrupt pending state in user context Date: Mon, 20 Jun 2022 14:51:10 +0200 Message-Id: <20220620124733.459739098@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Marc Zyngier commit 2cdea19a34c2340b3aa69508804efe4e3750fcec upstream. Since 5bfa685e62e9 ("KVM: arm64: vgic: Read HW interrupt pending state from the HW"), we're able to source the pending bit for an interrupt that is stored either on the physical distributor or on a device. However, this state is only available when the vcpu is loaded, and is not intended to be accessed from userspace. Unfortunately, the GICv2 emulation doesn't provide specific userspace accessors, and we fallback with the ones that are intended for the guest, with fatal consequences. Add a new vgic_uaccess_read_pending() accessor for userspace to use, build on top of the existing vgic_mmio_read_pending(). Reported-by: Eric Auger Reviewed-by: Eric Auger Tested-by: Eric Auger Signed-off-by: Marc Zyngier Fixes: 5bfa685e62e9 ("KVM: arm64: vgic: Read HW interrupt pending state fro= m the HW") Link: https://lore.kernel.org/r/20220607131427.1164881-2-maz@kernel.org Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/arm64/kvm/vgic/vgic-mmio-v2.c | 4 ++-- arch/arm64/kvm/vgic/vgic-mmio.c | 19 ++++++++++++++++--- arch/arm64/kvm/vgic/vgic-mmio.h | 3 +++ 3 files changed, 21 insertions(+), 5 deletions(-) --- a/arch/arm64/kvm/vgic/vgic-mmio-v2.c +++ b/arch/arm64/kvm/vgic/vgic-mmio-v2.c @@ -417,11 +417,11 @@ static const struct vgic_register_region VGIC_ACCESS_32bit), REGISTER_DESC_WITH_BITS_PER_IRQ(GIC_DIST_PENDING_SET, vgic_mmio_read_pending, vgic_mmio_write_spending, - NULL, vgic_uaccess_write_spending, 1, + vgic_uaccess_read_pending, vgic_uaccess_write_spending, 1, VGIC_ACCESS_32bit), REGISTER_DESC_WITH_BITS_PER_IRQ(GIC_DIST_PENDING_CLEAR, vgic_mmio_read_pending, vgic_mmio_write_cpending, - NULL, vgic_uaccess_write_cpending, 1, + vgic_uaccess_read_pending, vgic_uaccess_write_cpending, 1, VGIC_ACCESS_32bit), REGISTER_DESC_WITH_BITS_PER_IRQ(GIC_DIST_ACTIVE_SET, vgic_mmio_read_active, vgic_mmio_write_sactive, --- a/arch/arm64/kvm/vgic/vgic-mmio.c +++ b/arch/arm64/kvm/vgic/vgic-mmio.c @@ -226,8 +226,9 @@ int vgic_uaccess_write_cenable(struct kv return 0; } =20 -unsigned long vgic_mmio_read_pending(struct kvm_vcpu *vcpu, - gpa_t addr, unsigned int len) +static unsigned long __read_pending(struct kvm_vcpu *vcpu, + gpa_t addr, unsigned int len, + bool is_user) { u32 intid =3D VGIC_ADDR_TO_INTID(addr, 1); u32 value =3D 0; @@ -248,7 +249,7 @@ unsigned long vgic_mmio_read_pending(str IRQCHIP_STATE_PENDING, &val); WARN_RATELIMIT(err, "IRQ %d", irq->host_irq); - } else if (vgic_irq_is_mapped_level(irq)) { + } else if (!is_user && vgic_irq_is_mapped_level(irq)) { val =3D vgic_get_phys_line_level(irq); } else { val =3D irq_is_pending(irq); @@ -263,6 +264,18 @@ unsigned long vgic_mmio_read_pending(str return value; } =20 +unsigned long vgic_mmio_read_pending(struct kvm_vcpu *vcpu, + gpa_t addr, unsigned int len) +{ + return __read_pending(vcpu, addr, len, false); +} + +unsigned long vgic_uaccess_read_pending(struct kvm_vcpu *vcpu, + gpa_t addr, unsigned int len) +{ + return __read_pending(vcpu, addr, len, true); +} + static bool is_vgic_v2_sgi(struct kvm_vcpu *vcpu, struct vgic_irq *irq) { return (vgic_irq_is_sgi(irq->intid) && --- a/arch/arm64/kvm/vgic/vgic-mmio.h +++ b/arch/arm64/kvm/vgic/vgic-mmio.h @@ -149,6 +149,9 @@ int vgic_uaccess_write_cenable(struct kv unsigned long vgic_mmio_read_pending(struct kvm_vcpu *vcpu, gpa_t addr, unsigned int len); =20 +unsigned long vgic_uaccess_read_pending(struct kvm_vcpu *vcpu, + gpa_t addr, unsigned int len); + void vgic_mmio_write_spending(struct kvm_vcpu *vcpu, gpa_t addr, unsigned int len, unsigned long val); From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE1BFC43334 for ; Mon, 20 Jun 2022 13:07:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244659AbiFTNH0 (ORCPT ); Mon, 20 Jun 2022 09:07:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239006AbiFTNEK (ORCPT ); Mon, 20 Jun 2022 09:04:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7BD7D17053; Mon, 20 Jun 2022 05:59: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 1736F61535; Mon, 20 Jun 2022 12:59:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E1E5C3411B; Mon, 20 Jun 2022 12:59:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729966; bh=SjXAoznO5JPsYpcWKUijlKX7Px6pqsQqLLa1A/Kne20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cLAyI4ZROC+Wk5pXpeY6CVul6BieYdWKCLtWKe/agY2j1S5wNt08nweOsk0KIHlyZ mN/jfTZhyDF3cMmYYNxeqfobF923QCmtKd6f4wvuXEmM3wuSBuDvAgbRY/AXI/6sDY XtACUQavjdO3JExDoM1l8cXPZvarOQ8sUfDix85Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Murilo Opsfelder Araujo , "Michael S. Tsirkin" , Christophe de Dinechin , Sudip Mukherjee Subject: [PATCH 5.18 133/141] virtio-pci: Remove wrong address verification in vp_del_vqs() Date: Mon, 20 Jun 2022 14:51:11 +0200 Message-Id: <20220620124733.488734442@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Murilo Opsfelder Araujo commit 7e415282b41bf0d15c6e0fe268f822d9b083f2f7 upstream. GCC 12 enhanced -Waddress when comparing array address to null [0], which warns: drivers/virtio/virtio_pci_common.c: In function =E2=80=98vp_del_vqs=E2= =80=99: drivers/virtio/virtio_pci_common.c:257:29: warning: the comparison will= always evaluate as =E2=80=98true=E2=80=99 for the pointer operand in =E2= =80=98vp_dev->msix_affinity_masks + (sizetype)((long unsigned int)i * 256)= =E2=80=99 must not be NULL [-Waddress] 257 | if (vp_dev->msix_affinity_masks[i]) | ^~~~~~ In fact, the verification is comparing the result of a pointer arithmetic, the address "msix_affinity_masks + i", which will always evaluate to true. Under the hood, free_cpumask_var() calls kfree(), which is safe to pass NULL, not requiring non-null verification. So remove the verification to make compiler happy (happy compiler, happy life). [0] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102103 Signed-off-by: Murilo Opsfelder Araujo Message-Id: <20220415023002.49805-1-muriloo@linux.ibm.com> Signed-off-by: Michael S. Tsirkin Acked-by: Christophe de Dinechin Cc: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/virtio/virtio_pci_common.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/virtio/virtio_pci_common.c +++ b/drivers/virtio/virtio_pci_common.c @@ -254,8 +254,7 @@ void vp_del_vqs(struct virtio_device *vd =20 if (vp_dev->msix_affinity_masks) { for (i =3D 0; i < vp_dev->msix_vectors; i++) - if (vp_dev->msix_affinity_masks[i]) - free_cpumask_var(vp_dev->msix_affinity_masks[i]); + free_cpumask_var(vp_dev->msix_affinity_masks[i]); } =20 if (vp_dev->msix_enabled) { From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2B3ACCA479 for ; Mon, 20 Jun 2022 13:07:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244604AbiFTNHX (ORCPT ); Mon, 20 Jun 2022 09:07:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243870AbiFTNEV (ORCPT ); Mon, 20 Jun 2022 09:04:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A03118B06; Mon, 20 Jun 2022 05:59:35 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 862EFB811B1; Mon, 20 Jun 2022 12:59:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E1F8C3411B; Mon, 20 Jun 2022 12:59:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729972; bh=sNR0QRlY5EWZHYV0VihLUTAWZOOnXns5wmYoCycRnyM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MjCGvkcZLOUMvK7THfQ8fd3Yj8Kp9ruHB7GgQ8od2G5u3NbvdBWYF0vYI1Wdsasnu toPHZsZO/XOlXHoaFB9wZIxTpP6qROvxnT0SOJRNCPS7t+sDO+X7cV2tJMBG+ijbeC W5OzTVaCa2oJ7WF59KNZ8yp4hlVedCYMvQZV7a74= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeff Layton , David Howells , Kees Cook , Xiubo Li , Jonathan Corbet , Eric Van Hensbergen , Latchesar Ionkov , Dominique Martinet , Christian Schoenebeck , Marc Dionne , Ilya Dryomov , Steve French , William Kucharski , "Matthew Wilcox (Oracle)" , Dave Chinner , linux-doc@vger.kernel.org, v9fs-developer@lists.sourceforge.net, linux-afs@lists.infradead.org, ceph-devel@vger.kernel.org, linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-fsdevel@vger.kernel.org, linux-hardening@vger.kernel.org, Linus Torvalds Subject: [PATCH 5.18 134/141] netfs: Fix gcc-12 warning by embedding vfs inode in netfs_i_context Date: Mon, 20 Jun 2022 14:51:12 +0200 Message-Id: <20220620124733.518737098@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: David Howells commit 874c8ca1e60b2c564a48f7e7acc40d328d5c8733 upstream. While randstruct was satisfied with using an open-coded "void *" offset cast for the netfs_i_context <-> inode casting, __builtin_object_size() as used by FORTIFY_SOURCE was not as easily fooled. This was causing the following complaint[1] from gcc v12: In file included from include/linux/string.h:253, from include/linux/ceph/ceph_debug.h:7, from fs/ceph/inode.c:2: In function 'fortify_memset_chk', inlined from 'netfs_i_context_init' at include/linux/netfs.h:326:2, inlined from 'ceph_alloc_inode' at fs/ceph/inode.c:463:2: include/linux/fortify-string.h:242:25: warning: call to '__write_overflow= _field' declared with attribute warning: detected write beyond size of fiel= d (1st parameter); maybe use struct_group()? [-Wattribute-warning] 242 | __write_overflow_field(p_size_field, size= ); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fix this by embedding a struct inode into struct netfs_i_context (which should perhaps be renamed to struct netfs_inode). The struct inode vfs_inode fields are then removed from the 9p, afs, ceph and cifs inode structs and vfs_inode is then simply changed to "netfs.inode" in those filesystems. Further, rename netfs_i_context to netfs_inode, get rid of the netfs_inode() function that converted a netfs_i_context pointer to an inode pointer (that can now be done with &ctx->inode) and rename the netfs_i_context() function to netfs_inode() (which is now a wrapper around container_of()). Most of the changes were done with: perl -p -i -e 's/vfs_inode/netfs.inode/'g \ `git grep -l 'vfs_inode' -- fs/{9p,afs,ceph,cifs}/*.[ch]` Kees suggested doing it with a pair structure[2] and a special declarator to insert that into the network filesystem's inode wrapper[3], but I think it's cleaner to embed it - and then it doesn't matter if struct randomisation reorders things. Dave Chinner suggested using a filesystem-specific VFS_I() function in each filesystem to convert that filesystem's own inode wrapper struct into the VFS inode struct[4]. Version #2: - Fix a couple of missed name changes due to a disabled cifs option. - Rename nfs_i_context to nfs_inode - Use "netfs" instead of "nic" as the member name in per-fs inode wrapper structs. [ This also undoes commit 507160f46c55 ("netfs: gcc-12: temporarily disable '-Wattribute-warning' for now") that is no longer needed ] Fixes: bc899ee1c898 ("netfs: Add a netfs inode context") Reported-by: Jeff Layton Signed-off-by: David Howells Reviewed-by: Jeff Layton Reviewed-by: Kees Cook Reviewed-by: Xiubo Li cc: Jonathan Corbet cc: Eric Van Hensbergen cc: Latchesar Ionkov cc: Dominique Martinet cc: Christian Schoenebeck cc: Marc Dionne cc: Ilya Dryomov cc: Steve French cc: William Kucharski cc: "Matthew Wilcox (Oracle)" cc: Dave Chinner cc: linux-doc@vger.kernel.org cc: v9fs-developer@lists.sourceforge.net cc: linux-afs@lists.infradead.org cc: ceph-devel@vger.kernel.org cc: linux-cifs@vger.kernel.org cc: samba-technical@lists.samba.org cc: linux-fsdevel@vger.kernel.org cc: linux-hardening@vger.kernel.org Link: https://lore.kernel.org/r/d2ad3a3d7bdd794c6efb562d2f2b655fb67756b9.ca= mel@kernel.org/ [1] Link: https://lore.kernel.org/r/20220517210230.864239-1-keescook@chromium.o= rg/ [2] Link: https://lore.kernel.org/r/20220518202212.2322058-1-keescook@chromium.= org/ [3] Link: https://lore.kernel.org/r/20220524101205.GI2306852@dread.disaster.are= a/ [4] Link: https://lore.kernel.org/r/165296786831.3591209.12111293034669289733.s= tgit@warthog.procyon.org.uk/ # v1 Link: https://lore.kernel.org/r/165305805651.4094995.7763502506786714216.st= git@warthog.procyon.org.uk # v2 Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- Documentation/filesystems/netfs_library.rst | 37 ++++----- fs/9p/cache.c | 4 - fs/9p/v9fs.c | 2=20 fs/9p/v9fs.h | 10 -- fs/9p/vfs_addr.c | 2=20 fs/9p/vfs_inode.c | 4 - fs/afs/callback.c | 2=20 fs/afs/dir.c | 32 ++++---- fs/afs/dir_edit.c | 10 +- fs/afs/dir_silly.c | 4 - fs/afs/dynroot.c | 2=20 fs/afs/file.c | 4 - fs/afs/fs_operation.c | 6 - fs/afs/inode.c | 41 +++++------ fs/afs/internal.h | 23 ++---- fs/afs/super.c | 6 - fs/afs/write.c | 21 ++--- fs/ceph/addr.c | 4 - fs/ceph/cache.c | 4 - fs/ceph/cache.h | 2=20 fs/ceph/caps.c | 104 ++++++++++++++---------= ----- fs/ceph/file.c | 2=20 fs/ceph/inode.c | 13 +-- fs/ceph/mds_client.c | 4 - fs/ceph/snap.c | 8 +- fs/ceph/super.c | 2=20 fs/ceph/super.h | 10 -- fs/ceph/xattr.c | 14 +-- fs/cifs/cifsfs.c | 8 +- fs/cifs/cifsglob.h | 12 +-- fs/cifs/file.c | 8 +- fs/cifs/fscache.c | 8 +- fs/cifs/fscache.h | 8 +- fs/cifs/inode.c | 4 - fs/cifs/misc.c | 4 - fs/cifs/smb2ops.c | 8 +- fs/netfs/buffered_read.c | 6 - fs/netfs/internal.h | 2=20 fs/netfs/objects.c | 2=20 include/linux/netfs.h | 41 ++++------- 40 files changed, 227 insertions(+), 261 deletions(-) --- a/Documentation/filesystems/netfs_library.rst +++ b/Documentation/filesystems/netfs_library.rst @@ -37,30 +37,31 @@ The network filesystem helper library ne its use on each netfs inode it is helping to manage. To this end, a conte= xt structure is defined:: =20 - struct netfs_i_context { + struct netfs_inode { + struct inode inode; const struct netfs_request_ops *ops; - struct fscache_cookie *cache; + struct fscache_cookie *cache; }; =20 -A network filesystem that wants to use netfs lib must place one of these -directly after the VFS ``struct inode`` it allocates, usually as part of i= ts -own struct. This can be done in a way similar to the following:: +A network filesystem that wants to use netfs lib must place one of these i= n its +inode wrapper struct instead of the VFS ``struct inode``. This can be don= e in +a way similar to the following:: =20 struct my_inode { - struct { - /* These must be contiguous */ - struct inode vfs_inode; - struct netfs_i_context netfs_ctx; - }; + struct netfs_inode netfs; /* Netfslib context and vfs inode */ ... }; =20 -This allows netfslib to find its state by simple offset from the inode poi= nter, -thereby allowing the netfslib helper functions to be pointed to directly b= y the -VFS/VM operation tables. +This allows netfslib to find its state by using ``container_of()`` from the +inode pointer, thereby allowing the netfslib helper functions to be pointe= d to +directly by the VFS/VM operation tables. =20 The structure contains the following fields: =20 + * ``inode`` + + The VFS inode structure. + * ``ops`` =20 The set of operations provided by the network filesystem to netfslib. @@ -78,14 +79,12 @@ To help deal with the per-inode context, provided. Firstly, a function to perform basic initialisation on a contex= t and set the operations table pointer:: =20 - void netfs_i_context_init(struct inode *inode, - const struct netfs_request_ops *ops); + void netfs_inode_init(struct inode *inode, + const struct netfs_request_ops *ops); =20 -then two functions to cast between the VFS inode structure and the netfs -context:: +then a function to cast from the VFS inode structure to the netfs context:: =20 - struct netfs_i_context *netfs_i_context(struct inode *inode); - struct inode *netfs_inode(struct netfs_i_context *ctx); + struct netfs_inode *netfs_node(struct inode *inode); =20 and finally, a function to get the cache cookie pointer from the context attached to an inode (or NULL if fscache is disabled):: --- a/fs/9p/cache.c +++ b/fs/9p/cache.c @@ -62,12 +62,12 @@ void v9fs_cache_inode_get_cookie(struct version =3D cpu_to_le32(v9inode->qid.version); path =3D cpu_to_le64(v9inode->qid.path); v9ses =3D v9fs_inode2v9ses(inode); - v9inode->netfs_ctx.cache =3D + v9inode->netfs.cache =3D fscache_acquire_cookie(v9fs_session_cache(v9ses), 0, &path, sizeof(path), &version, sizeof(version), - i_size_read(&v9inode->vfs_inode)); + i_size_read(&v9inode->netfs.inode)); =20 p9_debug(P9_DEBUG_FSC, "inode %p get cookie %p\n", inode, v9fs_inode_cookie(v9inode)); --- a/fs/9p/v9fs.c +++ b/fs/9p/v9fs.c @@ -625,7 +625,7 @@ static void v9fs_inode_init_once(void *f struct v9fs_inode *v9inode =3D (struct v9fs_inode *)foo; =20 memset(&v9inode->qid, 0, sizeof(v9inode->qid)); - inode_init_once(&v9inode->vfs_inode); + inode_init_once(&v9inode->netfs.inode); } =20 /** --- a/fs/9p/v9fs.h +++ b/fs/9p/v9fs.h @@ -109,11 +109,7 @@ struct v9fs_session_info { #define V9FS_INO_INVALID_ATTR 0x01 =20 struct v9fs_inode { - struct { - /* These must be contiguous */ - struct inode vfs_inode; /* the VFS's inode record */ - struct netfs_i_context netfs_ctx; /* Netfslib context */ - }; + struct netfs_inode netfs; /* Netfslib context and vfs inode */ struct p9_qid qid; unsigned int cache_validity; struct p9_fid *writeback_fid; @@ -122,13 +118,13 @@ struct v9fs_inode { =20 static inline struct v9fs_inode *V9FS_I(const struct inode *inode) { - return container_of(inode, struct v9fs_inode, vfs_inode); + return container_of(inode, struct v9fs_inode, netfs.inode); } =20 static inline struct fscache_cookie *v9fs_inode_cookie(struct v9fs_inode *= v9inode) { #ifdef CONFIG_9P_FSCACHE - return netfs_i_cookie(&v9inode->vfs_inode); + return netfs_i_cookie(&v9inode->netfs.inode); #else return NULL; #endif --- a/fs/9p/vfs_addr.c +++ b/fs/9p/vfs_addr.c @@ -141,7 +141,7 @@ static void v9fs_write_to_cache_done(voi transferred_or_error !=3D -ENOBUFS) { version =3D cpu_to_le32(v9inode->qid.version); fscache_invalidate(v9fs_inode_cookie(v9inode), &version, - i_size_read(&v9inode->vfs_inode), 0); + i_size_read(&v9inode->netfs.inode), 0); } } =20 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c @@ -234,7 +234,7 @@ struct inode *v9fs_alloc_inode(struct su v9inode->writeback_fid =3D NULL; v9inode->cache_validity =3D 0; mutex_init(&v9inode->v_mutex); - return &v9inode->vfs_inode; + return &v9inode->netfs.inode; } =20 /** @@ -252,7 +252,7 @@ void v9fs_free_inode(struct inode *inode */ static void v9fs_set_netfs_context(struct inode *inode) { - netfs_i_context_init(inode, &v9fs_req_ops); + netfs_inode_init(inode, &v9fs_req_ops); } =20 int v9fs_init_inode(struct v9fs_session_info *v9ses, --- a/fs/afs/callback.c +++ b/fs/afs/callback.c @@ -30,7 +30,7 @@ void afs_invalidate_mmap_work(struct wor { struct afs_vnode *vnode =3D container_of(work, struct afs_vnode, cb_work); =20 - unmap_mapping_pages(vnode->vfs_inode.i_mapping, 0, 0, false); + unmap_mapping_pages(vnode->netfs.inode.i_mapping, 0, 0, false); } =20 void afs_server_init_callback_work(struct work_struct *work) --- a/fs/afs/dir.c +++ b/fs/afs/dir.c @@ -109,7 +109,7 @@ struct afs_lookup_cookie { */ static void afs_dir_read_cleanup(struct afs_read *req) { - struct address_space *mapping =3D req->vnode->vfs_inode.i_mapping; + struct address_space *mapping =3D req->vnode->netfs.inode.i_mapping; struct folio *folio; pgoff_t last =3D req->nr_pages - 1; =20 @@ -153,7 +153,7 @@ static bool afs_dir_check_folio(struct a block =3D kmap_local_folio(folio, offset); if (block->hdr.magic !=3D AFS_DIR_MAGIC) { printk("kAFS: %s(%lx): [%llx] bad magic %zx/%zx is %04hx\n", - __func__, dvnode->vfs_inode.i_ino, + __func__, dvnode->netfs.inode.i_ino, pos, offset, size, ntohs(block->hdr.magic)); trace_afs_dir_check_failed(dvnode, pos + offset, i_size); kunmap_local(block); @@ -183,7 +183,7 @@ error: static void afs_dir_dump(struct afs_vnode *dvnode, struct afs_read *req) { union afs_xdr_dir_block *block; - struct address_space *mapping =3D dvnode->vfs_inode.i_mapping; + struct address_space *mapping =3D dvnode->netfs.inode.i_mapping; struct folio *folio; pgoff_t last =3D req->nr_pages - 1; size_t offset, size; @@ -217,7 +217,7 @@ static void afs_dir_dump(struct afs_vnod */ static int afs_dir_check(struct afs_vnode *dvnode, struct afs_read *req) { - struct address_space *mapping =3D dvnode->vfs_inode.i_mapping; + struct address_space *mapping =3D dvnode->netfs.inode.i_mapping; struct folio *folio; pgoff_t last =3D req->nr_pages - 1; int ret =3D 0; @@ -269,7 +269,7 @@ static int afs_dir_open(struct inode *in static struct afs_read *afs_read_dir(struct afs_vnode *dvnode, struct key = *key) __acquires(&dvnode->validate_lock) { - struct address_space *mapping =3D dvnode->vfs_inode.i_mapping; + struct address_space *mapping =3D dvnode->netfs.inode.i_mapping; struct afs_read *req; loff_t i_size; int nr_pages, i; @@ -287,7 +287,7 @@ static struct afs_read *afs_read_dir(str req->cleanup =3D afs_dir_read_cleanup; =20 expand: - i_size =3D i_size_read(&dvnode->vfs_inode); + i_size =3D i_size_read(&dvnode->netfs.inode); if (i_size < 2048) { ret =3D afs_bad(dvnode, afs_file_error_dir_small); goto error; @@ -305,7 +305,7 @@ expand: req->actual_len =3D i_size; /* May change */ req->len =3D nr_pages * PAGE_SIZE; /* We can ask for more than there is */ req->data_version =3D dvnode->status.data_version; /* May change */ - iov_iter_xarray(&req->def_iter, READ, &dvnode->vfs_inode.i_mapping->i_pag= es, + iov_iter_xarray(&req->def_iter, READ, &dvnode->netfs.inode.i_mapping->i_p= ages, 0, i_size); req->iter =3D &req->def_iter; =20 @@ -897,7 +897,7 @@ static struct inode *afs_do_lookup(struc =20 out_op: if (op->error =3D=3D 0) { - inode =3D &op->file[1].vnode->vfs_inode; + inode =3D &op->file[1].vnode->netfs.inode; op->file[1].vnode =3D NULL; } =20 @@ -1139,7 +1139,7 @@ static int afs_d_revalidate(struct dentr afs_stat_v(dir, n_reval); =20 /* search the directory for this vnode */ - ret =3D afs_do_lookup_one(&dir->vfs_inode, dentry, &fid, key, &dir_versio= n); + ret =3D afs_do_lookup_one(&dir->netfs.inode, dentry, &fid, key, &dir_vers= ion); switch (ret) { case 0: /* the filename maps to something */ @@ -1170,7 +1170,7 @@ static int afs_d_revalidate(struct dentr _debug("%pd: file deleted (uq %u -> %u I:%u)", dentry, fid.unique, vnode->fid.unique, - vnode->vfs_inode.i_generation); + vnode->netfs.inode.i_generation); goto not_found; } goto out_valid; @@ -1368,7 +1368,7 @@ static void afs_dir_remove_subdir(struct if (d_really_is_positive(dentry)) { struct afs_vnode *vnode =3D AFS_FS_I(d_inode(dentry)); =20 - clear_nlink(&vnode->vfs_inode); + clear_nlink(&vnode->netfs.inode); set_bit(AFS_VNODE_DELETED, &vnode->flags); clear_bit(AFS_VNODE_CB_PROMISED, &vnode->flags); clear_bit(AFS_VNODE_DIR_VALID, &vnode->flags); @@ -1487,8 +1487,8 @@ static void afs_dir_remove_link(struct a /* Already done */ } else if (test_bit(AFS_VNODE_DIR_VALID, &dvnode->flags)) { write_seqlock(&vnode->cb_lock); - drop_nlink(&vnode->vfs_inode); - if (vnode->vfs_inode.i_nlink =3D=3D 0) { + drop_nlink(&vnode->netfs.inode); + if (vnode->netfs.inode.i_nlink =3D=3D 0) { set_bit(AFS_VNODE_DELETED, &vnode->flags); __afs_break_callback(vnode, afs_cb_break_for_unlink); } @@ -1504,7 +1504,7 @@ static void afs_dir_remove_link(struct a op->error =3D ret; } =20 - _debug("nlink %d [val %d]", vnode->vfs_inode.i_nlink, op->error); + _debug("nlink %d [val %d]", vnode->netfs.inode.i_nlink, op->error); } =20 static void afs_unlink_success(struct afs_operation *op) @@ -1680,8 +1680,8 @@ static void afs_link_success(struct afs_ afs_update_dentry_version(op, dvp, op->dentry); if (op->dentry_2->d_parent =3D=3D op->dentry->d_parent) afs_update_dentry_version(op, dvp, op->dentry_2); - ihold(&vp->vnode->vfs_inode); - d_instantiate(op->dentry, &vp->vnode->vfs_inode); + ihold(&vp->vnode->netfs.inode); + d_instantiate(op->dentry, &vp->vnode->netfs.inode); } =20 static void afs_link_put(struct afs_operation *op) --- a/fs/afs/dir_edit.c +++ b/fs/afs/dir_edit.c @@ -109,7 +109,7 @@ static void afs_clear_contig_bits(union */ static struct folio *afs_dir_get_folio(struct afs_vnode *vnode, pgoff_t in= dex) { - struct address_space *mapping =3D vnode->vfs_inode.i_mapping; + struct address_space *mapping =3D vnode->netfs.inode.i_mapping; struct folio *folio; =20 folio =3D __filemap_get_folio(mapping, index, @@ -216,7 +216,7 @@ void afs_edit_dir_add(struct afs_vnode * =20 _enter(",,{%d,%s},", name->len, name->name); =20 - i_size =3D i_size_read(&vnode->vfs_inode); + i_size =3D i_size_read(&vnode->netfs.inode); if (i_size > AFS_DIR_BLOCK_SIZE * AFS_DIR_MAX_BLOCKS || (i_size & (AFS_DIR_BLOCK_SIZE - 1))) { clear_bit(AFS_VNODE_DIR_VALID, &vnode->flags); @@ -336,7 +336,7 @@ found_space: if (b < AFS_DIR_BLOCKS_WITH_CTR) meta->meta.alloc_ctrs[b] -=3D need_slots; =20 - inode_inc_iversion_raw(&vnode->vfs_inode); + inode_inc_iversion_raw(&vnode->netfs.inode); afs_stat_v(vnode, n_dir_cr); _debug("Insert %s in %u[%u]", name->name, b, slot); =20 @@ -383,7 +383,7 @@ void afs_edit_dir_remove(struct afs_vnod =20 _enter(",,{%d,%s},", name->len, name->name); =20 - i_size =3D i_size_read(&vnode->vfs_inode); + i_size =3D i_size_read(&vnode->netfs.inode); if (i_size < AFS_DIR_BLOCK_SIZE || i_size > AFS_DIR_BLOCK_SIZE * AFS_DIR_MAX_BLOCKS || (i_size & (AFS_DIR_BLOCK_SIZE - 1))) { @@ -463,7 +463,7 @@ found_dirent: if (b < AFS_DIR_BLOCKS_WITH_CTR) meta->meta.alloc_ctrs[b] +=3D need_slots; =20 - inode_set_iversion_raw(&vnode->vfs_inode, vnode->status.data_version); + inode_set_iversion_raw(&vnode->netfs.inode, vnode->status.data_version); afs_stat_v(vnode, n_dir_rm); _debug("Remove %s from %u[%u]", name->name, b, slot); =20 --- a/fs/afs/dir_silly.c +++ b/fs/afs/dir_silly.c @@ -131,7 +131,7 @@ int afs_sillyrename(struct afs_vnode *dv goto out; } while (!d_is_negative(sdentry)); =20 - ihold(&vnode->vfs_inode); + ihold(&vnode->netfs.inode); =20 ret =3D afs_do_silly_rename(dvnode, vnode, dentry, sdentry, key); switch (ret) { @@ -148,7 +148,7 @@ int afs_sillyrename(struct afs_vnode *dv d_drop(sdentry); } =20 - iput(&vnode->vfs_inode); + iput(&vnode->netfs.inode); dput(sdentry); out: _leave(" =3D %d", ret); --- a/fs/afs/dynroot.c +++ b/fs/afs/dynroot.c @@ -76,7 +76,7 @@ struct inode *afs_iget_pseudo_dir(struct /* there shouldn't be an existing inode */ BUG_ON(!(inode->i_state & I_NEW)); =20 - netfs_i_context_init(inode, NULL); + netfs_inode_init(inode, NULL); inode->i_size =3D 0; inode->i_mode =3D S_IFDIR | S_IRUGO | S_IXUGO; if (root) { --- a/fs/afs/file.c +++ b/fs/afs/file.c @@ -194,7 +194,7 @@ int afs_release(struct inode *inode, str afs_put_wb_key(af->wb); =20 if ((file->f_mode & FMODE_WRITE)) { - i_size =3D i_size_read(&vnode->vfs_inode); + i_size =3D i_size_read(&vnode->netfs.inode); afs_set_cache_aux(vnode, &aux); fscache_unuse_cookie(afs_vnode_cache(vnode), &aux, &i_size); } else { @@ -325,7 +325,7 @@ static void afs_issue_read(struct netfs_ fsreq->iter =3D &fsreq->def_iter; =20 iov_iter_xarray(&fsreq->def_iter, READ, - &fsreq->vnode->vfs_inode.i_mapping->i_pages, + &fsreq->vnode->netfs.inode.i_mapping->i_pages, fsreq->pos, fsreq->len); =20 afs_fetch_data(fsreq->vnode, fsreq); --- a/fs/afs/fs_operation.c +++ b/fs/afs/fs_operation.c @@ -232,14 +232,14 @@ int afs_put_operation(struct afs_operati if (op->file[1].modification && op->file[1].vnode !=3D op->file[0].vnode) clear_bit(AFS_VNODE_MODIFYING, &op->file[1].vnode->flags); if (op->file[0].put_vnode) - iput(&op->file[0].vnode->vfs_inode); + iput(&op->file[0].vnode->netfs.inode); if (op->file[1].put_vnode) - iput(&op->file[1].vnode->vfs_inode); + iput(&op->file[1].vnode->netfs.inode); =20 if (op->more_files) { for (i =3D 0; i < op->nr_files - 2; i++) if (op->more_files[i].put_vnode) - iput(&op->more_files[i].vnode->vfs_inode); + iput(&op->more_files[i].vnode->netfs.inode); kfree(op->more_files); } =20 --- a/fs/afs/inode.c +++ b/fs/afs/inode.c @@ -25,9 +25,6 @@ #include "internal.h" #include "afs_fs.h" =20 -// Temporary: netfs does disgusting things with inode pointers -#pragma GCC diagnostic ignored "-Wattribute-warning" - static const struct inode_operations afs_symlink_inode_operations =3D { .get_link =3D page_get_link, }; @@ -61,7 +58,7 @@ static noinline void dump_vnode(struct a */ static void afs_set_netfs_context(struct afs_vnode *vnode) { - netfs_i_context_init(&vnode->vfs_inode, &afs_req_ops); + netfs_inode_init(&vnode->netfs.inode, &afs_req_ops); } =20 /* @@ -99,7 +96,7 @@ static int afs_inode_init_from_status(st inode->i_flags |=3D S_NOATIME; inode->i_uid =3D make_kuid(&init_user_ns, status->owner); inode->i_gid =3D make_kgid(&init_user_ns, status->group); - set_nlink(&vnode->vfs_inode, status->nlink); + set_nlink(&vnode->netfs.inode, status->nlink); =20 switch (status->type) { case AFS_FTYPE_FILE: @@ -142,7 +139,7 @@ static int afs_inode_init_from_status(st afs_set_netfs_context(vnode); =20 vnode->invalid_before =3D status->data_version; - inode_set_iversion_raw(&vnode->vfs_inode, status->data_version); + inode_set_iversion_raw(&vnode->netfs.inode, status->data_version); =20 if (!vp->scb.have_cb) { /* it's a symlink we just created (the fileserver @@ -166,7 +163,7 @@ static void afs_apply_status(struct afs_ { struct afs_file_status *status =3D &vp->scb.status; struct afs_vnode *vnode =3D vp->vnode; - struct inode *inode =3D &vnode->vfs_inode; + struct inode *inode =3D &vnode->netfs.inode; struct timespec64 t; umode_t mode; bool data_changed =3D false; @@ -249,7 +246,7 @@ static void afs_apply_status(struct afs_ * idea of what the size should be that's not the same as * what's on the server. */ - vnode->netfs_ctx.remote_i_size =3D status->size; + vnode->netfs.remote_i_size =3D status->size; if (change_size) { afs_set_i_size(vnode, status->size); inode->i_ctime =3D t; @@ -292,7 +289,7 @@ void afs_vnode_commit_status(struct afs_ */ if (vp->scb.status.abort_code =3D=3D VNOVNODE) { set_bit(AFS_VNODE_DELETED, &vnode->flags); - clear_nlink(&vnode->vfs_inode); + clear_nlink(&vnode->netfs.inode); __afs_break_callback(vnode, afs_cb_break_for_deleted); op->flags &=3D ~AFS_OPERATION_DIR_CONFLICT; } @@ -309,8 +306,8 @@ void afs_vnode_commit_status(struct afs_ if (vp->scb.have_cb) afs_apply_callback(op, vp); } else if (vp->op_unlinked && !(op->flags & AFS_OPERATION_DIR_CONFLICT)) { - drop_nlink(&vnode->vfs_inode); - if (vnode->vfs_inode.i_nlink =3D=3D 0) { + drop_nlink(&vnode->netfs.inode); + if (vnode->netfs.inode.i_nlink =3D=3D 0) { set_bit(AFS_VNODE_DELETED, &vnode->flags); __afs_break_callback(vnode, afs_cb_break_for_deleted); } @@ -329,7 +326,7 @@ static void afs_fetch_status_success(str struct afs_vnode *vnode =3D vp->vnode; int ret; =20 - if (vnode->vfs_inode.i_state & I_NEW) { + if (vnode->netfs.inode.i_state & I_NEW) { ret =3D afs_inode_init_from_status(op, vp, vnode); op->error =3D ret; if (ret =3D=3D 0) @@ -433,7 +430,7 @@ static void afs_get_inode_cache(struct a struct afs_vnode_cache_aux aux; =20 if (vnode->status.type !=3D AFS_FTYPE_FILE) { - vnode->netfs_ctx.cache =3D NULL; + vnode->netfs.cache =3D NULL; return; } =20 @@ -460,7 +457,7 @@ static void afs_get_inode_cache(struct a struct inode *afs_iget(struct afs_operation *op, struct afs_vnode_param *v= p) { struct afs_vnode_param *dvp =3D &op->file[0]; - struct super_block *sb =3D dvp->vnode->vfs_inode.i_sb; + struct super_block *sb =3D dvp->vnode->netfs.inode.i_sb; struct afs_vnode *vnode; struct inode *inode; int ret; @@ -585,10 +582,10 @@ static void afs_zap_data(struct afs_vnod /* nuke all the non-dirty pages that aren't locked, mapped or being * written back in a regular file and completely discard the pages in a * directory or symlink */ - if (S_ISREG(vnode->vfs_inode.i_mode)) - invalidate_remote_inode(&vnode->vfs_inode); + if (S_ISREG(vnode->netfs.inode.i_mode)) + invalidate_remote_inode(&vnode->netfs.inode); else - invalidate_inode_pages2(vnode->vfs_inode.i_mapping); + invalidate_inode_pages2(vnode->netfs.inode.i_mapping); } =20 /* @@ -686,8 +683,8 @@ int afs_validate(struct afs_vnode *vnode key_serial(key)); =20 if (unlikely(test_bit(AFS_VNODE_DELETED, &vnode->flags))) { - if (vnode->vfs_inode.i_nlink) - clear_nlink(&vnode->vfs_inode); + if (vnode->netfs.inode.i_nlink) + clear_nlink(&vnode->netfs.inode); goto valid; } =20 @@ -829,7 +826,7 @@ void afs_evict_inode(struct inode *inode static void afs_setattr_success(struct afs_operation *op) { struct afs_vnode_param *vp =3D &op->file[0]; - struct inode *inode =3D &vp->vnode->vfs_inode; + struct inode *inode =3D &vp->vnode->netfs.inode; loff_t old_i_size =3D i_size_read(inode); =20 op->setattr.old_i_size =3D old_i_size; @@ -846,7 +843,7 @@ static void afs_setattr_success(struct a static void afs_setattr_edit_file(struct afs_operation *op) { struct afs_vnode_param *vp =3D &op->file[0]; - struct inode *inode =3D &vp->vnode->vfs_inode; + struct inode *inode =3D &vp->vnode->netfs.inode; =20 if (op->setattr.attr->ia_valid & ATTR_SIZE) { loff_t size =3D op->setattr.attr->ia_size; @@ -878,7 +875,7 @@ int afs_setattr(struct user_namespace *m ATTR_MTIME | ATTR_MTIME_SET | ATTR_TIMES_SET | ATTR_TOUCH; struct afs_operation *op; struct afs_vnode *vnode =3D AFS_FS_I(d_inode(dentry)); - struct inode *inode =3D &vnode->vfs_inode; + struct inode *inode =3D &vnode->netfs.inode; loff_t i_size; int ret; =20 --- a/fs/afs/internal.h +++ b/fs/afs/internal.h @@ -619,12 +619,7 @@ enum afs_lock_state { * leak from one inode to another. */ struct afs_vnode { - struct { - /* These must be contiguous */ - struct inode vfs_inode; /* the VFS's inode record */ - struct netfs_i_context netfs_ctx; /* Netfslib context */ - }; - + struct netfs_inode netfs; /* Netfslib context and vfs inode */ struct afs_volume *volume; /* volume on which vnode resides */ struct afs_fid fid; /* the file identifier for this inode */ struct afs_file_status status; /* AFS status info for this file */ @@ -675,7 +670,7 @@ struct afs_vnode { static inline struct fscache_cookie *afs_vnode_cache(struct afs_vnode *vno= de) { #ifdef CONFIG_AFS_FSCACHE - return netfs_i_cookie(&vnode->vfs_inode); + return netfs_i_cookie(&vnode->netfs.inode); #else return NULL; #endif @@ -685,7 +680,7 @@ static inline void afs_vnode_set_cache(s struct fscache_cookie *cookie) { #ifdef CONFIG_AFS_FSCACHE - vnode->netfs_ctx.cache =3D cookie; + vnode->netfs.cache =3D cookie; #endif } =20 @@ -892,7 +887,7 @@ static inline void afs_invalidate_cache( =20 afs_set_cache_aux(vnode, &aux); fscache_invalidate(afs_vnode_cache(vnode), &aux, - i_size_read(&vnode->vfs_inode), flags); + i_size_read(&vnode->netfs.inode), flags); } =20 /* @@ -1217,7 +1212,7 @@ static inline struct afs_net *afs_i2net( =20 static inline struct afs_net *afs_v2net(struct afs_vnode *vnode) { - return afs_i2net(&vnode->vfs_inode); + return afs_i2net(&vnode->netfs.inode); } =20 static inline struct afs_net *afs_sock2net(struct sock *sk) @@ -1593,12 +1588,12 @@ extern void yfs_fs_store_opaque_acl2(str */ static inline struct afs_vnode *AFS_FS_I(struct inode *inode) { - return container_of(inode, struct afs_vnode, vfs_inode); + return container_of(inode, struct afs_vnode, netfs.inode); } =20 static inline struct inode *AFS_VNODE_TO_I(struct afs_vnode *vnode) { - return &vnode->vfs_inode; + return &vnode->netfs.inode; } =20 /* @@ -1621,8 +1616,8 @@ static inline void afs_update_dentry_ver */ static inline void afs_set_i_size(struct afs_vnode *vnode, u64 size) { - i_size_write(&vnode->vfs_inode, size); - vnode->vfs_inode.i_blocks =3D ((size + 1023) >> 10) << 1; + i_size_write(&vnode->netfs.inode, size); + vnode->netfs.inode.i_blocks =3D ((size + 1023) >> 10) << 1; } =20 /* --- a/fs/afs/super.c +++ b/fs/afs/super.c @@ -659,7 +659,7 @@ static void afs_i_init_once(void *_vnode struct afs_vnode *vnode =3D _vnode; =20 memset(vnode, 0, sizeof(*vnode)); - inode_init_once(&vnode->vfs_inode); + inode_init_once(&vnode->netfs.inode); mutex_init(&vnode->io_lock); init_rwsem(&vnode->validate_lock); spin_lock_init(&vnode->wb_lock); @@ -700,8 +700,8 @@ static struct inode *afs_alloc_inode(str init_rwsem(&vnode->rmdir_lock); INIT_WORK(&vnode->cb_work, afs_invalidate_mmap_work); =20 - _leave(" =3D %p", &vnode->vfs_inode); - return &vnode->vfs_inode; + _leave(" =3D %p", &vnode->netfs.inode); + return &vnode->netfs.inode; } =20 static void afs_free_inode(struct inode *inode) --- a/fs/afs/write.c +++ b/fs/afs/write.c @@ -146,10 +146,10 @@ int afs_write_end(struct file *file, str =20 write_end_pos =3D pos + copied; =20 - i_size =3D i_size_read(&vnode->vfs_inode); + i_size =3D i_size_read(&vnode->netfs.inode); if (write_end_pos > i_size) { write_seqlock(&vnode->cb_lock); - i_size =3D i_size_read(&vnode->vfs_inode); + i_size =3D i_size_read(&vnode->netfs.inode); if (write_end_pos > i_size) afs_set_i_size(vnode, write_end_pos); write_sequnlock(&vnode->cb_lock); @@ -257,7 +257,7 @@ static void afs_redirty_pages(struct wri */ static void afs_pages_written_back(struct afs_vnode *vnode, loff_t start, = unsigned int len) { - struct address_space *mapping =3D vnode->vfs_inode.i_mapping; + struct address_space *mapping =3D vnode->netfs.inode.i_mapping; struct folio *folio; pgoff_t end; =20 @@ -354,7 +354,6 @@ static const struct afs_operation_ops af static int afs_store_data(struct afs_vnode *vnode, struct iov_iter *iter, = loff_t pos, bool laundering) { - struct netfs_i_context *ictx =3D &vnode->netfs_ctx; struct afs_operation *op; struct afs_wb_key *wbk =3D NULL; loff_t size =3D iov_iter_count(iter); @@ -385,9 +384,9 @@ static int afs_store_data(struct afs_vno op->store.write_iter =3D iter; op->store.pos =3D pos; op->store.size =3D size; - op->store.i_size =3D max(pos + size, ictx->remote_i_size); + op->store.i_size =3D max(pos + size, vnode->netfs.remote_i_size); op->store.laundering =3D laundering; - op->mtime =3D vnode->vfs_inode.i_mtime; + op->mtime =3D vnode->netfs.inode.i_mtime; op->flags |=3D AFS_OPERATION_UNINTR; op->ops =3D &afs_store_data_operation; =20 @@ -554,7 +553,7 @@ static ssize_t afs_write_back_from_locke struct iov_iter iter; unsigned long priv; unsigned int offset, to, len, max_len; - loff_t i_size =3D i_size_read(&vnode->vfs_inode); + loff_t i_size =3D i_size_read(&vnode->netfs.inode); bool new_content =3D test_bit(AFS_VNODE_NEW_CONTENT, &vnode->flags); bool caching =3D fscache_cookie_enabled(afs_vnode_cache(vnode)); long count =3D wbc->nr_to_write; @@ -845,7 +844,7 @@ ssize_t afs_file_write(struct kiocb *ioc _enter("{%llx:%llu},{%zu},", vnode->fid.vid, vnode->fid.vnode, count); =20 - if (IS_SWAPFILE(&vnode->vfs_inode)) { + if (IS_SWAPFILE(&vnode->netfs.inode)) { printk(KERN_INFO "AFS: Attempt to write to active swap file!\n"); return -EBUSY; @@ -958,8 +957,8 @@ void afs_prune_wb_keys(struct afs_vnode /* Discard unused keys */ spin_lock(&vnode->wb_lock); =20 - if (!mapping_tagged(&vnode->vfs_inode.i_data, PAGECACHE_TAG_WRITEBACK) && - !mapping_tagged(&vnode->vfs_inode.i_data, PAGECACHE_TAG_DIRTY)) { + if (!mapping_tagged(&vnode->netfs.inode.i_data, PAGECACHE_TAG_WRITEBACK) = && + !mapping_tagged(&vnode->netfs.inode.i_data, PAGECACHE_TAG_DIRTY)) { list_for_each_entry_safe(wbk, tmp, &vnode->wb_keys, vnode_link) { if (refcount_read(&wbk->usage) =3D=3D 1) list_move(&wbk->vnode_link, &graveyard); @@ -1034,6 +1033,6 @@ static void afs_write_to_cache(struct af bool caching) { fscache_write_to_cache(afs_vnode_cache(vnode), - vnode->vfs_inode.i_mapping, start, len, i_size, + vnode->netfs.inode.i_mapping, start, len, i_size, afs_write_to_cache_done, vnode, caching); } --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c @@ -1795,7 +1795,7 @@ enum { static int __ceph_pool_perm_get(struct ceph_inode_info *ci, s64 pool, struct ceph_string *pool_ns) { - struct ceph_fs_client *fsc =3D ceph_inode_to_client(&ci->vfs_inode); + struct ceph_fs_client *fsc =3D ceph_inode_to_client(&ci->netfs.inode); struct ceph_mds_client *mdsc =3D fsc->mdsc; struct ceph_osd_request *rd_req =3D NULL, *wr_req =3D NULL; struct rb_node **p, *parent; @@ -1910,7 +1910,7 @@ static int __ceph_pool_perm_get(struct c 0, false, true); err =3D ceph_osdc_start_request(&fsc->client->osdc, rd_req, false); =20 - wr_req->r_mtime =3D ci->vfs_inode.i_mtime; + wr_req->r_mtime =3D ci->netfs.inode.i_mtime; err2 =3D ceph_osdc_start_request(&fsc->client->osdc, wr_req, false); =20 if (!err) --- a/fs/ceph/cache.c +++ b/fs/ceph/cache.c @@ -29,9 +29,9 @@ void ceph_fscache_register_inode_cookie( if (!(inode->i_state & I_NEW)) return; =20 - WARN_ON_ONCE(ci->netfs_ctx.cache); + WARN_ON_ONCE(ci->netfs.cache); =20 - ci->netfs_ctx.cache =3D + ci->netfs.cache =3D fscache_acquire_cookie(fsc->fscache, 0, &ci->i_vino, sizeof(ci->i_vino), &ci->i_version, sizeof(ci->i_version), --- a/fs/ceph/cache.h +++ b/fs/ceph/cache.h @@ -28,7 +28,7 @@ void ceph_fscache_invalidate(struct inod =20 static inline struct fscache_cookie *ceph_fscache_cookie(struct ceph_inode= _info *ci) { - return netfs_i_cookie(&ci->vfs_inode); + return netfs_i_cookie(&ci->netfs.inode); } =20 static inline void ceph_fscache_resize(struct inode *inode, loff_t to) --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c @@ -492,7 +492,7 @@ static void __cap_set_timeouts(struct ce struct ceph_mount_options *opt =3D mdsc->fsc->mount_options; ci->i_hold_caps_max =3D round_jiffies(jiffies + opt->caps_wanted_delay_max * HZ); - dout("__cap_set_timeouts %p %lu\n", &ci->vfs_inode, + dout("__cap_set_timeouts %p %lu\n", &ci->netfs.inode, ci->i_hold_caps_max - jiffies); } =20 @@ -507,7 +507,7 @@ static void __cap_set_timeouts(struct ce static void __cap_delay_requeue(struct ceph_mds_client *mdsc, struct ceph_inode_info *ci) { - dout("__cap_delay_requeue %p flags 0x%lx at %lu\n", &ci->vfs_inode, + dout("__cap_delay_requeue %p flags 0x%lx at %lu\n", &ci->netfs.inode, ci->i_ceph_flags, ci->i_hold_caps_max); if (!mdsc->stopping) { spin_lock(&mdsc->cap_delay_lock); @@ -531,7 +531,7 @@ no_change: static void __cap_delay_requeue_front(struct ceph_mds_client *mdsc, struct ceph_inode_info *ci) { - dout("__cap_delay_requeue_front %p\n", &ci->vfs_inode); + dout("__cap_delay_requeue_front %p\n", &ci->netfs.inode); spin_lock(&mdsc->cap_delay_lock); ci->i_ceph_flags |=3D CEPH_I_FLUSH; if (!list_empty(&ci->i_cap_delay_list)) @@ -548,7 +548,7 @@ static void __cap_delay_requeue_front(st static void __cap_delay_cancel(struct ceph_mds_client *mdsc, struct ceph_inode_info *ci) { - dout("__cap_delay_cancel %p\n", &ci->vfs_inode); + dout("__cap_delay_cancel %p\n", &ci->netfs.inode); if (list_empty(&ci->i_cap_delay_list)) return; spin_lock(&mdsc->cap_delay_lock); @@ -568,7 +568,7 @@ static void __check_cap_issue(struct cep * Each time we receive FILE_CACHE anew, we increment * i_rdcache_gen. */ - if (S_ISREG(ci->vfs_inode.i_mode) && + if (S_ISREG(ci->netfs.inode.i_mode) && (issued & (CEPH_CAP_FILE_CACHE|CEPH_CAP_FILE_LAZYIO)) && (had & (CEPH_CAP_FILE_CACHE|CEPH_CAP_FILE_LAZYIO)) =3D=3D 0) { ci->i_rdcache_gen++; @@ -583,14 +583,14 @@ static void __check_cap_issue(struct cep if ((issued & CEPH_CAP_FILE_SHARED) !=3D (had & CEPH_CAP_FILE_SHARED)) { if (issued & CEPH_CAP_FILE_SHARED) atomic_inc(&ci->i_shared_gen); - if (S_ISDIR(ci->vfs_inode.i_mode)) { - dout(" marking %p NOT complete\n", &ci->vfs_inode); + if (S_ISDIR(ci->netfs.inode.i_mode)) { + dout(" marking %p NOT complete\n", &ci->netfs.inode); __ceph_dir_clear_complete(ci); } } =20 /* Wipe saved layout if we're losing DIR_CREATE caps */ - if (S_ISDIR(ci->vfs_inode.i_mode) && (had & CEPH_CAP_DIR_CREATE) && + if (S_ISDIR(ci->netfs.inode.i_mode) && (had & CEPH_CAP_DIR_CREATE) && !(issued & CEPH_CAP_DIR_CREATE)) { ceph_put_string(rcu_dereference_raw(ci->i_cached_layout.pool_ns)); memset(&ci->i_cached_layout, 0, sizeof(ci->i_cached_layout)); @@ -771,7 +771,7 @@ static int __cap_is_valid(struct ceph_ca =20 if (cap->cap_gen < gen || time_after_eq(jiffies, ttl)) { dout("__cap_is_valid %p cap %p issued %s " - "but STALE (gen %u vs %u)\n", &cap->ci->vfs_inode, + "but STALE (gen %u vs %u)\n", &cap->ci->netfs.inode, cap, ceph_cap_string(cap->issued), cap->cap_gen, gen); return 0; } @@ -797,7 +797,7 @@ int __ceph_caps_issued(struct ceph_inode if (!__cap_is_valid(cap)) continue; dout("__ceph_caps_issued %p cap %p issued %s\n", - &ci->vfs_inode, cap, ceph_cap_string(cap->issued)); + &ci->netfs.inode, cap, ceph_cap_string(cap->issued)); have |=3D cap->issued; if (implemented) *implemented |=3D cap->implemented; @@ -844,12 +844,12 @@ static void __touch_cap(struct ceph_cap =20 spin_lock(&s->s_cap_lock); if (!s->s_cap_iterator) { - dout("__touch_cap %p cap %p mds%d\n", &cap->ci->vfs_inode, cap, + dout("__touch_cap %p cap %p mds%d\n", &cap->ci->netfs.inode, cap, s->s_mds); list_move_tail(&cap->session_caps, &s->s_caps); } else { dout("__touch_cap %p cap %p mds%d NOP, iterating over caps\n", - &cap->ci->vfs_inode, cap, s->s_mds); + &cap->ci->netfs.inode, cap, s->s_mds); } spin_unlock(&s->s_cap_lock); } @@ -867,7 +867,7 @@ int __ceph_caps_issued_mask(struct ceph_ =20 if ((have & mask) =3D=3D mask) { dout("__ceph_caps_issued_mask ino 0x%llx snap issued %s" - " (mask %s)\n", ceph_ino(&ci->vfs_inode), + " (mask %s)\n", ceph_ino(&ci->netfs.inode), ceph_cap_string(have), ceph_cap_string(mask)); return 1; @@ -879,7 +879,7 @@ int __ceph_caps_issued_mask(struct ceph_ continue; if ((cap->issued & mask) =3D=3D mask) { dout("__ceph_caps_issued_mask ino 0x%llx cap %p issued %s" - " (mask %s)\n", ceph_ino(&ci->vfs_inode), cap, + " (mask %s)\n", ceph_ino(&ci->netfs.inode), cap, ceph_cap_string(cap->issued), ceph_cap_string(mask)); if (touch) @@ -891,7 +891,7 @@ int __ceph_caps_issued_mask(struct ceph_ have |=3D cap->issued; if ((have & mask) =3D=3D mask) { dout("__ceph_caps_issued_mask ino 0x%llx combo issued %s" - " (mask %s)\n", ceph_ino(&ci->vfs_inode), + " (mask %s)\n", ceph_ino(&ci->netfs.inode), ceph_cap_string(cap->issued), ceph_cap_string(mask)); if (touch) { @@ -919,7 +919,7 @@ int __ceph_caps_issued_mask(struct ceph_ int __ceph_caps_issued_mask_metric(struct ceph_inode_info *ci, int mask, int touch) { - struct ceph_fs_client *fsc =3D ceph_sb_to_client(ci->vfs_inode.i_sb); + struct ceph_fs_client *fsc =3D ceph_sb_to_client(ci->netfs.inode.i_sb); int r; =20 r =3D __ceph_caps_issued_mask(ci, mask, touch); @@ -950,7 +950,7 @@ int __ceph_caps_revoking_other(struct ce =20 int ceph_caps_revoking(struct ceph_inode_info *ci, int mask) { - struct inode *inode =3D &ci->vfs_inode; + struct inode *inode =3D &ci->netfs.inode; int ret; =20 spin_lock(&ci->i_ceph_lock); @@ -969,8 +969,8 @@ int __ceph_caps_used(struct ceph_inode_i if (ci->i_rd_ref) used |=3D CEPH_CAP_FILE_RD; if (ci->i_rdcache_ref || - (S_ISREG(ci->vfs_inode.i_mode) && - ci->vfs_inode.i_data.nrpages)) + (S_ISREG(ci->netfs.inode.i_mode) && + ci->netfs.inode.i_data.nrpages)) used |=3D CEPH_CAP_FILE_CACHE; if (ci->i_wr_ref) used |=3D CEPH_CAP_FILE_WR; @@ -993,11 +993,11 @@ int __ceph_caps_file_wanted(struct ceph_ const int WR_SHIFT =3D ffs(CEPH_FILE_MODE_WR); const int LAZY_SHIFT =3D ffs(CEPH_FILE_MODE_LAZY); struct ceph_mount_options *opt =3D - ceph_inode_to_client(&ci->vfs_inode)->mount_options; + ceph_inode_to_client(&ci->netfs.inode)->mount_options; unsigned long used_cutoff =3D jiffies - opt->caps_wanted_delay_max * HZ; unsigned long idle_cutoff =3D jiffies - opt->caps_wanted_delay_min * HZ; =20 - if (S_ISDIR(ci->vfs_inode.i_mode)) { + if (S_ISDIR(ci->netfs.inode.i_mode)) { int want =3D 0; =20 /* use used_cutoff here, to keep dir's wanted caps longer */ @@ -1050,7 +1050,7 @@ int __ceph_caps_file_wanted(struct ceph_ int __ceph_caps_wanted(struct ceph_inode_info *ci) { int w =3D __ceph_caps_file_wanted(ci) | __ceph_caps_used(ci); - if (S_ISDIR(ci->vfs_inode.i_mode)) { + if (S_ISDIR(ci->netfs.inode.i_mode)) { /* we want EXCL if holding caps of dir ops */ if (w & CEPH_CAP_ANY_DIR_OPS) w |=3D CEPH_CAP_FILE_EXCL; @@ -1116,9 +1116,9 @@ void __ceph_remove_cap(struct ceph_cap * =20 lockdep_assert_held(&ci->i_ceph_lock); =20 - dout("__ceph_remove_cap %p from %p\n", cap, &ci->vfs_inode); + dout("__ceph_remove_cap %p from %p\n", cap, &ci->netfs.inode); =20 - mdsc =3D ceph_inode_to_client(&ci->vfs_inode)->mdsc; + mdsc =3D ceph_inode_to_client(&ci->netfs.inode)->mdsc; =20 /* remove from inode's cap rbtree, and clear auth cap */ rb_erase(&cap->ci_node, &ci->i_caps); @@ -1169,7 +1169,7 @@ void __ceph_remove_cap(struct ceph_cap * * keep i_snap_realm. */ if (ci->i_wr_ref =3D=3D 0 && ci->i_snap_realm) - ceph_change_snap_realm(&ci->vfs_inode, NULL); + ceph_change_snap_realm(&ci->netfs.inode, NULL); =20 __cap_delay_cancel(mdsc, ci); } @@ -1188,11 +1188,11 @@ void ceph_remove_cap(struct ceph_cap *ca =20 lockdep_assert_held(&ci->i_ceph_lock); =20 - fsc =3D ceph_inode_to_client(&ci->vfs_inode); + fsc =3D ceph_inode_to_client(&ci->netfs.inode); WARN_ON_ONCE(ci->i_auth_cap =3D=3D cap && !list_empty(&ci->i_dirty_item) && !fsc->blocklisted && - !ceph_inode_is_shutdown(&ci->vfs_inode)); + !ceph_inode_is_shutdown(&ci->netfs.inode)); =20 __ceph_remove_cap(cap, queue_release); } @@ -1343,7 +1343,7 @@ static void __prep_cap(struct cap_msg_ar int flushing, u64 flush_tid, u64 oldest_flush_tid) { struct ceph_inode_info *ci =3D cap->ci; - struct inode *inode =3D &ci->vfs_inode; + struct inode *inode =3D &ci->netfs.inode; int held, revoking; =20 lockdep_assert_held(&ci->i_ceph_lock); @@ -1440,7 +1440,7 @@ static void __prep_cap(struct cap_msg_ar static void __send_cap(struct cap_msg_args *arg, struct ceph_inode_info *c= i) { struct ceph_msg *msg; - struct inode *inode =3D &ci->vfs_inode; + struct inode *inode =3D &ci->netfs.inode; =20 msg =3D ceph_msg_new(CEPH_MSG_CLIENT_CAPS, CAP_MSG_SIZE, GFP_NOFS, false); if (!msg) { @@ -1528,7 +1528,7 @@ static void __ceph_flush_snaps(struct ce __releases(ci->i_ceph_lock) __acquires(ci->i_ceph_lock) { - struct inode *inode =3D &ci->vfs_inode; + struct inode *inode =3D &ci->netfs.inode; struct ceph_mds_client *mdsc =3D session->s_mdsc; struct ceph_cap_snap *capsnap; u64 oldest_flush_tid =3D 0; @@ -1621,7 +1621,7 @@ static void __ceph_flush_snaps(struct ce void ceph_flush_snaps(struct ceph_inode_info *ci, struct ceph_mds_session **psession) { - struct inode *inode =3D &ci->vfs_inode; + struct inode *inode =3D &ci->netfs.inode; struct ceph_mds_client *mdsc =3D ceph_inode_to_client(inode)->mdsc; struct ceph_mds_session *session =3D NULL; int mds; @@ -1681,8 +1681,8 @@ int __ceph_mark_dirty_caps(struct ceph_i struct ceph_cap_flush **pcf) { struct ceph_mds_client *mdsc =3D - ceph_sb_to_client(ci->vfs_inode.i_sb)->mdsc; - struct inode *inode =3D &ci->vfs_inode; + ceph_sb_to_client(ci->netfs.inode.i_sb)->mdsc; + struct inode *inode =3D &ci->netfs.inode; int was =3D ci->i_dirty_caps; int dirty =3D 0; =20 @@ -1695,7 +1695,7 @@ int __ceph_mark_dirty_caps(struct ceph_i return 0; } =20 - dout("__mark_dirty_caps %p %s dirty %s -> %s\n", &ci->vfs_inode, + dout("__mark_dirty_caps %p %s dirty %s -> %s\n", &ci->netfs.inode, ceph_cap_string(mask), ceph_cap_string(was), ceph_cap_string(was | mask)); ci->i_dirty_caps |=3D mask; @@ -1711,7 +1711,7 @@ int __ceph_mark_dirty_caps(struct ceph_i ci->i_snap_realm->cached_context); } dout(" inode %p now dirty snapc %p auth cap %p\n", - &ci->vfs_inode, ci->i_head_snapc, ci->i_auth_cap); + &ci->netfs.inode, ci->i_head_snapc, ci->i_auth_cap); BUG_ON(!list_empty(&ci->i_dirty_item)); spin_lock(&mdsc->cap_dirty_lock); list_add(&ci->i_dirty_item, &session->s_cap_dirty); @@ -1874,7 +1874,7 @@ static int try_nonblocking_invalidate(st =20 bool __ceph_should_report_size(struct ceph_inode_info *ci) { - loff_t size =3D i_size_read(&ci->vfs_inode); + loff_t size =3D i_size_read(&ci->netfs.inode); /* mds will adjust max size according to the reported size */ if (ci->i_flushing_caps & CEPH_CAP_FILE_WR) return false; @@ -1899,7 +1899,7 @@ bool __ceph_should_report_size(struct ce void ceph_check_caps(struct ceph_inode_info *ci, int flags, struct ceph_mds_session *session) { - struct inode *inode =3D &ci->vfs_inode; + struct inode *inode =3D &ci->netfs.inode; struct ceph_mds_client *mdsc =3D ceph_sb_to_mdsc(inode->i_sb); struct ceph_cap *cap; u64 flush_tid, oldest_flush_tid; @@ -2446,7 +2446,7 @@ static void __kick_flushing_caps(struct __releases(ci->i_ceph_lock) __acquires(ci->i_ceph_lock) { - struct inode *inode =3D &ci->vfs_inode; + struct inode *inode =3D &ci->netfs.inode; struct ceph_cap *cap; struct ceph_cap_flush *cf; int ret; @@ -2539,7 +2539,7 @@ void ceph_early_kick_flushing_caps(struc cap =3D ci->i_auth_cap; if (!(cap && cap->session =3D=3D session)) { pr_err("%p auth cap %p not mds%d ???\n", - &ci->vfs_inode, cap, session->s_mds); + &ci->netfs.inode, cap, session->s_mds); spin_unlock(&ci->i_ceph_lock); continue; } @@ -2589,7 +2589,7 @@ void ceph_kick_flushing_caps(struct ceph cap =3D ci->i_auth_cap; if (!(cap && cap->session =3D=3D session)) { pr_err("%p auth cap %p not mds%d ???\n", - &ci->vfs_inode, cap, session->s_mds); + &ci->netfs.inode, cap, session->s_mds); spin_unlock(&ci->i_ceph_lock); continue; } @@ -2609,7 +2609,7 @@ void ceph_kick_flushing_inode_caps(struc =20 lockdep_assert_held(&ci->i_ceph_lock); =20 - dout("%s %p flushing %s\n", __func__, &ci->vfs_inode, + dout("%s %p flushing %s\n", __func__, &ci->netfs.inode, ceph_cap_string(ci->i_flushing_caps)); =20 if (!list_empty(&ci->i_cap_flush_list)) { @@ -2652,10 +2652,10 @@ void ceph_take_cap_refs(struct ceph_inod } if (got & CEPH_CAP_FILE_BUFFER) { if (ci->i_wb_ref =3D=3D 0) - ihold(&ci->vfs_inode); + ihold(&ci->netfs.inode); ci->i_wb_ref++; dout("%s %p wb %d -> %d (?)\n", __func__, - &ci->vfs_inode, ci->i_wb_ref-1, ci->i_wb_ref); + &ci->netfs.inode, ci->i_wb_ref-1, ci->i_wb_ref); } } =20 @@ -2983,7 +2983,7 @@ int ceph_get_caps(struct file *filp, int return ret; } =20 - if (S_ISREG(ci->vfs_inode.i_mode) && + if (S_ISREG(ci->netfs.inode.i_mode) && ci->i_inline_version !=3D CEPH_INLINE_NONE && (_got & (CEPH_CAP_FILE_CACHE|CEPH_CAP_FILE_LAZYIO)) && i_size_read(inode) > 0) { @@ -3073,7 +3073,7 @@ enum put_cap_refs_mode { static void __ceph_put_cap_refs(struct ceph_inode_info *ci, int had, enum put_cap_refs_mode mode) { - struct inode *inode =3D &ci->vfs_inode; + struct inode *inode =3D &ci->netfs.inode; int last =3D 0, put =3D 0, flushsnaps =3D 0, wake =3D 0; bool check_flushsnaps =3D false; =20 @@ -3181,7 +3181,7 @@ void ceph_put_cap_refs_no_check_caps(str void ceph_put_wrbuffer_cap_refs(struct ceph_inode_info *ci, int nr, struct ceph_snap_context *snapc) { - struct inode *inode =3D &ci->vfs_inode; + struct inode *inode =3D &ci->netfs.inode; struct ceph_cap_snap *capsnap =3D NULL; int put =3D 0; bool last =3D false; @@ -3678,7 +3678,7 @@ static void handle_cap_flush_ack(struct session->s_mds, &list_first_entry(&session->s_cap_flushing, struct ceph_inode_info, - i_flushing_item)->vfs_inode); + i_flushing_item)->netfs.inode); } } mdsc->num_cap_flushing--; @@ -4326,7 +4326,7 @@ unsigned long ceph_check_delayed_caps(st break; list_del_init(&ci->i_cap_delay_list); =20 - inode =3D igrab(&ci->vfs_inode); + inode =3D igrab(&ci->netfs.inode); if (inode) { spin_unlock(&mdsc->cap_delay_lock); dout("check_delayed_caps on %p\n", inode); @@ -4354,7 +4354,7 @@ static void flush_dirty_session_caps(str while (!list_empty(&s->s_cap_dirty)) { ci =3D list_first_entry(&s->s_cap_dirty, struct ceph_inode_info, i_dirty_item); - inode =3D &ci->vfs_inode; + inode =3D &ci->netfs.inode; ihold(inode); dout("flush_dirty_caps %llx.%llx\n", ceph_vinop(inode)); spin_unlock(&mdsc->cap_dirty_lock); @@ -4388,7 +4388,7 @@ void __ceph_touch_fmode(struct ceph_inod =20 void ceph_get_fmode(struct ceph_inode_info *ci, int fmode, int count) { - struct ceph_mds_client *mdsc =3D ceph_sb_to_mdsc(ci->vfs_inode.i_sb); + struct ceph_mds_client *mdsc =3D ceph_sb_to_mdsc(ci->netfs.inode.i_sb); int bits =3D (fmode << 1) | 1; bool already_opened =3D false; int i; @@ -4422,7 +4422,7 @@ void ceph_get_fmode(struct ceph_inode_in */ void ceph_put_fmode(struct ceph_inode_info *ci, int fmode, int count) { - struct ceph_mds_client *mdsc =3D ceph_sb_to_mdsc(ci->vfs_inode.i_sb); + struct ceph_mds_client *mdsc =3D ceph_sb_to_mdsc(ci->netfs.inode.i_sb); int bits =3D (fmode << 1) | 1; bool is_closed =3D true; int i; @@ -4637,7 +4637,7 @@ int ceph_purge_inode_cap(struct inode *i lockdep_assert_held(&ci->i_ceph_lock); =20 dout("removing cap %p, ci is %p, inode is %p\n", - cap, ci, &ci->vfs_inode); + cap, ci, &ci->netfs.inode); =20 is_auth =3D (cap =3D=3D ci->i_auth_cap); __ceph_remove_cap(cap, false); --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -205,7 +205,7 @@ static int ceph_init_file_info(struct in { struct ceph_inode_info *ci =3D ceph_inode(inode); struct ceph_mount_options *opt =3D - ceph_inode_to_client(&ci->vfs_inode)->mount_options; + ceph_inode_to_client(&ci->netfs.inode)->mount_options; struct ceph_file_info *fi; int ret; =20 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -20,9 +20,6 @@ #include "cache.h" #include =20 -// Temporary: netfs does disgusting things with inode pointers -#pragma GCC diagnostic ignored "-Wattribute-warning" - /* * Ceph inode operations * @@ -179,7 +176,7 @@ static struct ceph_inode_frag *__get_or_ rb_insert_color(&frag->node, &ci->i_fragtree); =20 dout("get_or_create_frag added %llx.%llx frag %x\n", - ceph_vinop(&ci->vfs_inode), f); + ceph_vinop(&ci->netfs.inode), f); return frag; } =20 @@ -460,10 +457,10 @@ struct inode *ceph_alloc_inode(struct su if (!ci) return NULL; =20 - dout("alloc_inode %p\n", &ci->vfs_inode); + dout("alloc_inode %p\n", &ci->netfs.inode); =20 /* Set parameters for the netfs library */ - netfs_i_context_init(&ci->vfs_inode, &ceph_netfs_ops); + netfs_inode_init(&ci->netfs.inode, &ceph_netfs_ops); =20 spin_lock_init(&ci->i_ceph_lock); =20 @@ -550,7 +547,7 @@ struct inode *ceph_alloc_inode(struct su INIT_WORK(&ci->i_work, ceph_inode_work); ci->i_work_mask =3D 0; memset(&ci->i_btime, '\0', sizeof(ci->i_btime)); - return &ci->vfs_inode; + return &ci->netfs.inode; } =20 void ceph_free_inode(struct inode *inode) @@ -1980,7 +1977,7 @@ static void ceph_inode_work(struct work_ { struct ceph_inode_info *ci =3D container_of(work, struct ceph_inode_info, i_work); - struct inode *inode =3D &ci->vfs_inode; + struct inode *inode =3D &ci->netfs.inode; =20 if (test_and_clear_bit(CEPH_I_WORK_WRITEBACK, &ci->i_work_mask)) { dout("writeback %p\n", inode); --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -1564,7 +1564,7 @@ int ceph_iterate_session_caps(struct cep p =3D session->s_caps.next; while (p !=3D &session->s_caps) { cap =3D list_entry(p, struct ceph_cap, session_caps); - inode =3D igrab(&cap->ci->vfs_inode); + inode =3D igrab(&cap->ci->netfs.inode); if (!inode) { p =3D p->next; continue; @@ -1622,7 +1622,7 @@ static int remove_session_caps_cb(struct int iputs; =20 dout("removing cap %p, ci is %p, inode is %p\n", - cap, ci, &ci->vfs_inode); + cap, ci, &ci->netfs.inode); spin_lock(&ci->i_ceph_lock); iputs =3D ceph_purge_inode_cap(inode, cap, &invalidate); spin_unlock(&ci->i_ceph_lock); --- a/fs/ceph/snap.c +++ b/fs/ceph/snap.c @@ -521,7 +521,7 @@ static bool has_new_snaps(struct ceph_sn static void ceph_queue_cap_snap(struct ceph_inode_info *ci, struct ceph_cap_snap **pcapsnap) { - struct inode *inode =3D &ci->vfs_inode; + struct inode *inode =3D &ci->netfs.inode; struct ceph_snap_context *old_snapc, *new_snapc; struct ceph_cap_snap *capsnap =3D *pcapsnap; struct ceph_buffer *old_blob =3D NULL; @@ -652,7 +652,7 @@ update_snapc: int __ceph_finish_cap_snap(struct ceph_inode_info *ci, struct ceph_cap_snap *capsnap) { - struct inode *inode =3D &ci->vfs_inode; + struct inode *inode =3D &ci->netfs.inode; struct ceph_mds_client *mdsc =3D ceph_sb_to_mdsc(inode->i_sb); =20 BUG_ON(capsnap->writing); @@ -712,7 +712,7 @@ static void queue_realm_cap_snaps(struct =20 spin_lock(&realm->inodes_with_caps_lock); list_for_each_entry(ci, &realm->inodes_with_caps, i_snap_realm_item) { - struct inode *inode =3D igrab(&ci->vfs_inode); + struct inode *inode =3D igrab(&ci->netfs.inode); if (!inode) continue; spin_unlock(&realm->inodes_with_caps_lock); @@ -904,7 +904,7 @@ static void flush_snaps(struct ceph_mds_ while (!list_empty(&mdsc->snap_flush_list)) { ci =3D list_first_entry(&mdsc->snap_flush_list, struct ceph_inode_info, i_snap_flush_item); - inode =3D &ci->vfs_inode; + inode =3D &ci->netfs.inode; ihold(inode); spin_unlock(&mdsc->snap_flush_lock); ceph_flush_snaps(ci, &session); --- a/fs/ceph/super.c +++ b/fs/ceph/super.c @@ -876,7 +876,7 @@ mempool_t *ceph_wb_pagevec_pool; static void ceph_inode_init_once(void *foo) { struct ceph_inode_info *ci =3D foo; - inode_init_once(&ci->vfs_inode); + inode_init_once(&ci->netfs.inode); } =20 static int __init init_caches(void) --- a/fs/ceph/super.h +++ b/fs/ceph/super.h @@ -316,11 +316,7 @@ struct ceph_inode_xattrs_info { * Ceph inode. */ struct ceph_inode_info { - struct { - /* These must be contiguous */ - struct inode vfs_inode; - struct netfs_i_context netfs_ctx; /* Netfslib context */ - }; + struct netfs_inode netfs; /* Netfslib context and vfs inode */ struct ceph_vino i_vino; /* ceph ino + snap */ =20 spinlock_t i_ceph_lock; @@ -436,7 +432,7 @@ struct ceph_inode_info { static inline struct ceph_inode_info * ceph_inode(const struct inode *inode) { - return container_of(inode, struct ceph_inode_info, vfs_inode); + return container_of(inode, struct ceph_inode_info, netfs.inode); } =20 static inline struct ceph_fs_client * @@ -1295,7 +1291,7 @@ static inline void __ceph_update_quota(s has_quota =3D __ceph_has_any_quota(ci); =20 if (had_quota !=3D has_quota) - ceph_adjust_quota_realms_count(&ci->vfs_inode, has_quota); + ceph_adjust_quota_realms_count(&ci->netfs.inode, has_quota); } =20 extern void ceph_handle_quota(struct ceph_mds_client *mdsc, --- a/fs/ceph/xattr.c +++ b/fs/ceph/xattr.c @@ -57,7 +57,7 @@ static bool ceph_vxattrcb_layout_exists( static ssize_t ceph_vxattrcb_layout(struct ceph_inode_info *ci, char *val, size_t size) { - struct ceph_fs_client *fsc =3D ceph_sb_to_client(ci->vfs_inode.i_sb); + struct ceph_fs_client *fsc =3D ceph_sb_to_client(ci->netfs.inode.i_sb); struct ceph_osd_client *osdc =3D &fsc->client->osdc; struct ceph_string *pool_ns; s64 pool =3D ci->i_layout.pool_id; @@ -69,7 +69,7 @@ static ssize_t ceph_vxattrcb_layout(stru =20 pool_ns =3D ceph_try_get_string(ci->i_layout.pool_ns); =20 - dout("ceph_vxattrcb_layout %p\n", &ci->vfs_inode); + dout("ceph_vxattrcb_layout %p\n", &ci->netfs.inode); down_read(&osdc->lock); pool_name =3D ceph_pg_pool_name_by_id(osdc->osdmap, pool); if (pool_name) { @@ -161,7 +161,7 @@ static ssize_t ceph_vxattrcb_layout_pool char *val, size_t size) { ssize_t ret; - struct ceph_fs_client *fsc =3D ceph_sb_to_client(ci->vfs_inode.i_sb); + struct ceph_fs_client *fsc =3D ceph_sb_to_client(ci->netfs.inode.i_sb); struct ceph_osd_client *osdc =3D &fsc->client->osdc; s64 pool =3D ci->i_layout.pool_id; const char *pool_name; @@ -313,7 +313,7 @@ static ssize_t ceph_vxattrcb_snap_btime( static ssize_t ceph_vxattrcb_cluster_fsid(struct ceph_inode_info *ci, char *val, size_t size) { - struct ceph_fs_client *fsc =3D ceph_sb_to_client(ci->vfs_inode.i_sb); + struct ceph_fs_client *fsc =3D ceph_sb_to_client(ci->netfs.inode.i_sb); =20 return ceph_fmt_xattr(val, size, "%pU", &fsc->client->fsid); } @@ -321,7 +321,7 @@ static ssize_t ceph_vxattrcb_cluster_fsi static ssize_t ceph_vxattrcb_client_id(struct ceph_inode_info *ci, char *val, size_t size) { - struct ceph_fs_client *fsc =3D ceph_sb_to_client(ci->vfs_inode.i_sb); + struct ceph_fs_client *fsc =3D ceph_sb_to_client(ci->netfs.inode.i_sb); =20 return ceph_fmt_xattr(val, size, "client%lld", ceph_client_gid(fsc->client)); @@ -629,7 +629,7 @@ static int __set_xattr(struct ceph_inode } =20 dout("__set_xattr_val added %llx.%llx xattr %p %.*s=3D%.*s\n", - ceph_vinop(&ci->vfs_inode), xattr, name_len, name, val_len, val); + ceph_vinop(&ci->netfs.inode), xattr, name_len, name, val_len, val); =20 return 0; } @@ -871,7 +871,7 @@ struct ceph_buffer *__ceph_build_xattrs_ struct ceph_buffer *old_blob =3D NULL; void *dest; =20 - dout("__build_xattrs_blob %p\n", &ci->vfs_inode); + dout("__build_xattrs_blob %p\n", &ci->netfs.inode); if (ci->i_xattrs.dirty) { int need =3D __get_required_blob_size(ci, 0, 0); =20 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -377,7 +377,7 @@ cifs_alloc_inode(struct super_block *sb) cifs_inode->flags =3D 0; spin_lock_init(&cifs_inode->writers_lock); cifs_inode->writers =3D 0; - cifs_inode->vfs_inode.i_blkbits =3D 14; /* 2**14 =3D CIFS_MAX_MSGSIZE */ + cifs_inode->netfs.inode.i_blkbits =3D 14; /* 2**14 =3D CIFS_MAX_MSGSIZE = */ cifs_inode->server_eof =3D 0; cifs_inode->uniqueid =3D 0; cifs_inode->createtime =3D 0; @@ -389,12 +389,12 @@ cifs_alloc_inode(struct super_block *sb) * Can not set i_flags here - they get immediately overwritten to zero * by the VFS. */ - /* cifs_inode->vfs_inode.i_flags =3D S_NOATIME | S_NOCMTIME; */ + /* cifs_inode->netfs.inode.i_flags =3D S_NOATIME | S_NOCMTIME; */ INIT_LIST_HEAD(&cifs_inode->openFileList); INIT_LIST_HEAD(&cifs_inode->llist); INIT_LIST_HEAD(&cifs_inode->deferred_closes); spin_lock_init(&cifs_inode->deferred_lock); - return &cifs_inode->vfs_inode; + return &cifs_inode->netfs.inode; } =20 static void @@ -1416,7 +1416,7 @@ cifs_init_once(void *inode) { struct cifsInodeInfo *cifsi =3D inode; =20 - inode_init_once(&cifsi->vfs_inode); + inode_init_once(&cifsi->netfs.inode); init_rwsem(&cifsi->lock_sem); } =20 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -1414,20 +1414,16 @@ void cifsFileInfo_put(struct cifsFileInf #define CIFS_CACHE_RW_FLG (CIFS_CACHE_READ_FLG | CIFS_CACHE_WRITE_FLG) #define CIFS_CACHE_RHW_FLG (CIFS_CACHE_RW_FLG | CIFS_CACHE_HANDLE_FLG) =20 -#define CIFS_CACHE_READ(cinode) ((cinode->oplock & CIFS_CACHE_READ_FLG) ||= (CIFS_SB(cinode->vfs_inode.i_sb)->mnt_cifs_flags & CIFS_MOUNT_RO_CACHE)) +#define CIFS_CACHE_READ(cinode) ((cinode->oplock & CIFS_CACHE_READ_FLG) ||= (CIFS_SB(cinode->netfs.inode.i_sb)->mnt_cifs_flags & CIFS_MOUNT_RO_CACHE)) #define CIFS_CACHE_HANDLE(cinode) (cinode->oplock & CIFS_CACHE_HANDLE_FLG) -#define CIFS_CACHE_WRITE(cinode) ((cinode->oplock & CIFS_CACHE_WRITE_FLG) = || (CIFS_SB(cinode->vfs_inode.i_sb)->mnt_cifs_flags & CIFS_MOUNT_RW_CACHE)) +#define CIFS_CACHE_WRITE(cinode) ((cinode->oplock & CIFS_CACHE_WRITE_FLG) = || (CIFS_SB(cinode->netfs.inode.i_sb)->mnt_cifs_flags & CIFS_MOUNT_RW_CACHE= )) =20 /* * One of these for each file inode */ =20 struct cifsInodeInfo { - struct { - /* These must be contiguous */ - struct inode vfs_inode; /* the VFS's inode record */ - struct netfs_i_context netfs_ctx; /* Netfslib context */ - }; + struct netfs_inode netfs; /* Netfslib context and vfs inode */ bool can_cache_brlcks; struct list_head llist; /* locks helb by this inode */ /* @@ -1466,7 +1462,7 @@ struct cifsInodeInfo { static inline struct cifsInodeInfo * CIFS_I(struct inode *inode) { - return container_of(inode, struct cifsInodeInfo, vfs_inode); + return container_of(inode, struct cifsInodeInfo, netfs.inode); } =20 static inline struct cifs_sb_info * --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -2004,7 +2004,7 @@ struct cifsFileInfo *find_readable_file( bool fsuid_only) { struct cifsFileInfo *open_file =3D NULL; - struct cifs_sb_info *cifs_sb =3D CIFS_SB(cifs_inode->vfs_inode.i_sb); + struct cifs_sb_info *cifs_sb =3D CIFS_SB(cifs_inode->netfs.inode.i_sb); =20 /* only filter by fsuid on multiuser mounts */ if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MULTIUSER)) @@ -2060,7 +2060,7 @@ cifs_get_writable_file(struct cifsInodeI return rc; } =20 - cifs_sb =3D CIFS_SB(cifs_inode->vfs_inode.i_sb); + cifs_sb =3D CIFS_SB(cifs_inode->netfs.inode.i_sb); =20 /* only filter by fsuid on multiuser mounts */ if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MULTIUSER)) @@ -4665,14 +4665,14 @@ bool is_size_safe_to_change(struct cifsI /* This inode is open for write at least once */ struct cifs_sb_info *cifs_sb; =20 - cifs_sb =3D CIFS_SB(cifsInode->vfs_inode.i_sb); + cifs_sb =3D CIFS_SB(cifsInode->netfs.inode.i_sb); if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) { /* since no page cache to corrupt on directio we can change size safely */ return true; } =20 - if (i_size_read(&cifsInode->vfs_inode) < end_of_file) + if (i_size_read(&cifsInode->netfs.inode) < end_of_file) return true; =20 return false; --- a/fs/cifs/fscache.c +++ b/fs/cifs/fscache.c @@ -101,13 +101,13 @@ void cifs_fscache_get_inode_cookie(struc struct cifs_sb_info *cifs_sb =3D CIFS_SB(inode->i_sb); struct cifs_tcon *tcon =3D cifs_sb_master_tcon(cifs_sb); =20 - cifs_fscache_fill_coherency(&cifsi->vfs_inode, &cd); + cifs_fscache_fill_coherency(&cifsi->netfs.inode, &cd); =20 - cifsi->netfs_ctx.cache =3D + cifsi->netfs.cache =3D fscache_acquire_cookie(tcon->fscache, 0, &cifsi->uniqueid, sizeof(cifsi->uniqueid), &cd, sizeof(cd), - i_size_read(&cifsi->vfs_inode)); + i_size_read(&cifsi->netfs.inode)); } =20 void cifs_fscache_unuse_inode_cookie(struct inode *inode, bool update) @@ -131,7 +131,7 @@ void cifs_fscache_release_inode_cookie(s if (cookie) { cifs_dbg(FYI, "%s: (0x%p)\n", __func__, cookie); fscache_relinquish_cookie(cookie, false); - cifsi->netfs_ctx.cache =3D NULL; + cifsi->netfs.cache =3D NULL; } } =20 --- a/fs/cifs/fscache.h +++ b/fs/cifs/fscache.h @@ -52,10 +52,10 @@ void cifs_fscache_fill_coherency(struct struct cifsInodeInfo *cifsi =3D CIFS_I(inode); =20 memset(cd, 0, sizeof(*cd)); - cd->last_write_time_sec =3D cpu_to_le64(cifsi->vfs_inode.i_mtime.tv_sec= ); - cd->last_write_time_nsec =3D cpu_to_le32(cifsi->vfs_inode.i_mtime.tv_nse= c); - cd->last_change_time_sec =3D cpu_to_le64(cifsi->vfs_inode.i_ctime.tv_sec= ); - cd->last_change_time_nsec =3D cpu_to_le32(cifsi->vfs_inode.i_ctime.tv_nse= c); + cd->last_write_time_sec =3D cpu_to_le64(cifsi->netfs.inode.i_mtime.tv_s= ec); + cd->last_write_time_nsec =3D cpu_to_le32(cifsi->netfs.inode.i_mtime.tv_n= sec); + cd->last_change_time_sec =3D cpu_to_le64(cifsi->netfs.inode.i_ctime.tv_s= ec); + cd->last_change_time_nsec =3D cpu_to_le32(cifsi->netfs.inode.i_ctime.tv_n= sec); } =20 =20 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -115,7 +115,7 @@ cifs_revalidate_cache(struct inode *inod __func__, cifs_i->uniqueid); set_bit(CIFS_INO_INVALID_MAPPING, &cifs_i->flags); /* Invalidate fscache cookie */ - cifs_fscache_fill_coherency(&cifs_i->vfs_inode, &cd); + cifs_fscache_fill_coherency(&cifs_i->netfs.inode, &cd); fscache_invalidate(cifs_inode_cookie(inode), &cd, i_size_read(inode), 0); } =20 @@ -2499,7 +2499,7 @@ int cifs_fiemap(struct inode *inode, str u64 len) { struct cifsInodeInfo *cifs_i =3D CIFS_I(inode); - struct cifs_sb_info *cifs_sb =3D CIFS_SB(cifs_i->vfs_inode.i_sb); + struct cifs_sb_info *cifs_sb =3D CIFS_SB(cifs_i->netfs.inode.i_sb); struct cifs_tcon *tcon =3D cifs_sb_master_tcon(cifs_sb); struct TCP_Server_Info *server =3D tcon->ses->server; struct cifsFileInfo *cfile; --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c @@ -535,11 +535,11 @@ void cifs_set_oplock_level(struct cifsIn if (oplock =3D=3D OPLOCK_EXCLUSIVE) { cinode->oplock =3D CIFS_CACHE_WRITE_FLG | CIFS_CACHE_READ_FLG; cifs_dbg(FYI, "Exclusive Oplock granted on inode %p\n", - &cinode->vfs_inode); + &cinode->netfs.inode); } else if (oplock =3D=3D OPLOCK_READ) { cinode->oplock =3D CIFS_CACHE_READ_FLG; cifs_dbg(FYI, "Level II Oplock granted on inode %p\n", - &cinode->vfs_inode); + &cinode->netfs.inode); } else cinode->oplock =3D 0; } --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -4241,15 +4241,15 @@ smb2_set_oplock_level(struct cifsInodeIn if (oplock =3D=3D SMB2_OPLOCK_LEVEL_BATCH) { cinode->oplock =3D CIFS_CACHE_RHW_FLG; cifs_dbg(FYI, "Batch Oplock granted on inode %p\n", - &cinode->vfs_inode); + &cinode->netfs.inode); } else if (oplock =3D=3D SMB2_OPLOCK_LEVEL_EXCLUSIVE) { cinode->oplock =3D CIFS_CACHE_RW_FLG; cifs_dbg(FYI, "Exclusive Oplock granted on inode %p\n", - &cinode->vfs_inode); + &cinode->netfs.inode); } else if (oplock =3D=3D SMB2_OPLOCK_LEVEL_II) { cinode->oplock =3D CIFS_CACHE_READ_FLG; cifs_dbg(FYI, "Level II Oplock granted on inode %p\n", - &cinode->vfs_inode); + &cinode->netfs.inode); } else cinode->oplock =3D 0; } @@ -4288,7 +4288,7 @@ smb21_set_oplock_level(struct cifsInodeI =20 cinode->oplock =3D new_oplock; cifs_dbg(FYI, "%s Lease granted on inode %p\n", message, - &cinode->vfs_inode); + &cinode->netfs.inode); } =20 static void --- a/fs/netfs/buffered_read.c +++ b/fs/netfs/buffered_read.c @@ -155,7 +155,7 @@ static void netfs_rreq_expand(struct net void netfs_readahead(struct readahead_control *ractl) { struct netfs_io_request *rreq; - struct netfs_i_context *ctx =3D netfs_i_context(ractl->mapping->host); + struct netfs_inode *ctx =3D netfs_inode(ractl->mapping->host); int ret; =20 _enter("%lx,%x", readahead_index(ractl), readahead_count(ractl)); @@ -216,7 +216,7 @@ int netfs_readpage(struct file *file, st struct folio *folio =3D page_folio(subpage); struct address_space *mapping =3D folio_file_mapping(folio); struct netfs_io_request *rreq; - struct netfs_i_context *ctx =3D netfs_i_context(mapping->host); + struct netfs_inode *ctx =3D netfs_inode(mapping->host); int ret; =20 _enter("%lx", folio_index(folio)); @@ -333,7 +333,7 @@ int netfs_write_begin(struct file *file, struct folio **_folio, void **_fsdata) { struct netfs_io_request *rreq; - struct netfs_i_context *ctx =3D netfs_i_context(file_inode(file )); + struct netfs_inode *ctx =3D netfs_inode(file_inode(file )); struct folio *folio; unsigned int fgp_flags; pgoff_t index =3D pos >> PAGE_SHIFT; --- a/fs/netfs/internal.h +++ b/fs/netfs/internal.h @@ -91,7 +91,7 @@ static inline void netfs_stat_d(atomic_t /* * Miscellaneous functions. */ -static inline bool netfs_is_cache_enabled(struct netfs_i_context *ctx) +static inline bool netfs_is_cache_enabled(struct netfs_inode *ctx) { #if IS_ENABLED(CONFIG_FSCACHE) struct fscache_cookie *cookie =3D ctx->cache; --- a/fs/netfs/objects.c +++ b/fs/netfs/objects.c @@ -18,7 +18,7 @@ struct netfs_io_request *netfs_alloc_req { static atomic_t debug_ids; struct inode *inode =3D file ? file_inode(file) : mapping->host; - struct netfs_i_context *ctx =3D netfs_i_context(inode); + struct netfs_inode *ctx =3D netfs_inode(inode); struct netfs_io_request *rreq; int ret; =20 --- a/include/linux/netfs.h +++ b/include/linux/netfs.h @@ -119,9 +119,10 @@ typedef void (*netfs_io_terminated_t)(vo bool was_async); =20 /* - * Per-inode description. This must be directly after the inode struct. + * Per-inode context. This wraps the VFS inode. */ -struct netfs_i_context { +struct netfs_inode { + struct inode inode; /* The VFS inode */ const struct netfs_request_ops *ops; #if IS_ENABLED(CONFIG_FSCACHE) struct fscache_cookie *cache; @@ -255,7 +256,7 @@ struct netfs_cache_ops { * boundary as appropriate. */ enum netfs_io_source (*prepare_read)(struct netfs_io_subrequest *subreq, - loff_t i_size); + loff_t i_size); =20 /* Prepare a write operation, working out what part of the write we can * actually do. @@ -287,45 +288,35 @@ extern void netfs_put_subrequest(struct extern void netfs_stats_show(struct seq_file *); =20 /** - * netfs_i_context - Get the netfs inode context from the inode + * netfs_inode - Get the netfs inode context from the inode * @inode: The inode to query * * Get the netfs lib inode context from the network filesystem's inode. T= he * context struct is expected to directly follow on from the VFS inode str= uct. */ -static inline struct netfs_i_context *netfs_i_context(struct inode *inode) +static inline struct netfs_inode *netfs_inode(struct inode *inode) { - return (struct netfs_i_context *)(inode + 1); + return container_of(inode, struct netfs_inode, inode); } =20 /** - * netfs_inode - Get the netfs inode from the inode context - * @ctx: The context to query - * - * Get the netfs inode from the netfs library's inode context. The VFS in= ode - * is expected to directly precede the context struct. - */ -static inline struct inode *netfs_inode(struct netfs_i_context *ctx) -{ - return ((struct inode *)ctx) - 1; -} - -/** - * netfs_i_context_init - Initialise a netfs lib context + * netfs_inode_init - Initialise a netfslib inode context * @inode: The inode with which the context is associated * @ops: The netfs's operations list * * Initialise the netfs library context struct. This is expected to follo= w on * directly from the VFS inode struct. */ -static inline void netfs_i_context_init(struct inode *inode, - const struct netfs_request_ops *ops) +static inline void netfs_inode_init(struct inode *inode, + const struct netfs_request_ops *ops) { - struct netfs_i_context *ctx =3D netfs_i_context(inode); + struct netfs_inode *ctx =3D netfs_inode(inode); =20 - memset(ctx, 0, sizeof(*ctx)); ctx->ops =3D ops; ctx->remote_i_size =3D i_size_read(inode); +#if IS_ENABLED(CONFIG_FSCACHE) + ctx->cache =3D NULL; +#endif } =20 /** @@ -337,7 +328,7 @@ static inline void netfs_i_context_init( */ static inline void netfs_resize_file(struct inode *inode, loff_t new_i_siz= e) { - struct netfs_i_context *ctx =3D netfs_i_context(inode); + struct netfs_inode *ctx =3D netfs_inode(inode); =20 ctx->remote_i_size =3D new_i_size; } @@ -351,7 +342,7 @@ static inline void netfs_resize_file(str static inline struct fscache_cookie *netfs_i_cookie(struct inode *inode) { #if IS_ENABLED(CONFIG_FSCACHE) - struct netfs_i_context *ctx =3D netfs_i_context(inode); + struct netfs_inode *ctx =3D netfs_inode(inode); return ctx->cache; #else return NULL; From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B24EC43334 for ; Mon, 20 Jun 2022 13:07:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244567AbiFTNHR (ORCPT ); Mon, 20 Jun 2022 09:07:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244021AbiFTNEa (ORCPT ); Mon, 20 Jun 2022 09:04:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C09118B0C; Mon, 20 Jun 2022 05:59:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id BD09D61535; Mon, 20 Jun 2022 12:59:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0D97C341C5; Mon, 20 Jun 2022 12:59:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729975; bh=sfDb3mHACG0mx6O4ZAXXUVk6gPwkIftBcHm8i0J20x8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O/orYQj1qBtm44wt40PN62CT0fEbD4ADUlWwCDZjYzglEInrCskaOWEk6ik95LsMm dbQzxYoouGRcgRmSR5cqKbviE40MwHjrbZhwUklJ7J6KN9AEp850v++zErQPudoDZz 30O+glG2iQLSw5QpYrWsGtIUd7d2/EElc7AYFnjg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, John Harrison , Lucas De Marchi , Daniele Ceraolo Spurio , Jani Nikula , Tvrtko Ursulin Subject: [PATCH 5.18 135/141] drm/i915/uc: remove accidental static from a local variable Date: Mon, 20 Jun 2022 14:51:13 +0200 Message-Id: <20220620124733.550621581@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Jani Nikula commit 2636e008112465ca54559ac4898da5a2515e118a upstream. The arrays are static const, but the pointer shouldn't be static. Fixes: 3d832f370d16 ("drm/i915/uc: Allow platforms to have GuC but not HuC") Cc: John Harrison Cc: Lucas De Marchi Cc: Daniele Ceraolo Spurio Signed-off-by: Jani Nikula Reviewed-by: Tvrtko Ursulin Link: https://patchwork.freedesktop.org/patch/msgid/20220511094619.27889-1-= jani.nikula@intel.com (cherry picked from commit 5821a0bbb4c39960975d29d6b58ae290088db0ed) Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c +++ b/drivers/gpu/drm/i915/gt/uc/intel_uc_fw.c @@ -154,7 +154,7 @@ __uc_fw_auto_select(struct drm_i915_priv [INTEL_UC_FW_TYPE_GUC] =3D { blobs_guc, ARRAY_SIZE(blobs_guc) }, [INTEL_UC_FW_TYPE_HUC] =3D { blobs_huc, ARRAY_SIZE(blobs_huc) }, }; - static const struct uc_fw_platform_requirement *fw_blobs; + const struct uc_fw_platform_requirement *fw_blobs; enum intel_platform p =3D INTEL_INFO(i915)->platform; u32 fw_count; u8 rev =3D INTEL_REVID(i915); From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5CC6C43334 for ; Mon, 20 Jun 2022 13:07:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244555AbiFTNHP (ORCPT ); Mon, 20 Jun 2022 09:07:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244038AbiFTNEc (ORCPT ); Mon, 20 Jun 2022 09:04:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9287E186E4; Mon, 20 Jun 2022 05:59: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 51755B811BE; Mon, 20 Jun 2022 12:59:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9990C3411B; Mon, 20 Jun 2022 12:59:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729978; bh=R1/XwB4xM2LGN1vbIhBm7hfqiiYghXeGUIAqoxloBZ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tTkUtg/5UnIxt8Rq6kXOwzsIlRB9bh5+zCmU3EkicGYf3ltBKMUC0a3pvEyhwEvl6 KW53B1WN1TNTd3uB2GSBjUhcRjF8ynjkZxOYfaNN624Qh6IJklHHSmIfajySSxfmlB MqIcREOBMPKJZ9QCUSRMCkyaFZu3eNDUWIQ6mcfo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Andrii Nakryiko , Alexei Starovoitov Subject: [PATCH 5.18 136/141] bpf: Use safer kvmalloc_array() where possible Date: Mon, 20 Jun 2022 14:51:14 +0200 Message-Id: <20220620124733.580621777@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Dan Carpenter commit fd58f7df2415ef747782e01f94880fefad1247cf upstream. The kvmalloc_array() function is safer because it has a check for integer overflows. These sizes come from the user and I was not able to see any bounds checking so an integer overflow seems like a realistic concern. Fixes: 0dcac2725406 ("bpf: Add multi kprobe link") Signed-off-by: Dan Carpenter Signed-off-by: Andrii Nakryiko Link: https://lore.kernel.org/bpf/Yo9VRVMeHbALyjUH@kili Signed-off-by: Alexei Starovoitov Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- kernel/trace/bpf_trace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/kernel/trace/bpf_trace.c +++ b/kernel/trace/bpf_trace.c @@ -2433,7 +2433,7 @@ int bpf_kprobe_multi_link_attach(const u return -EINVAL; =20 size =3D cnt * sizeof(*addrs); - addrs =3D kvmalloc(size, GFP_KERNEL); + addrs =3D kvmalloc_array(cnt, sizeof(*addrs), GFP_KERNEL); if (!addrs) return -ENOMEM; =20 @@ -2450,7 +2450,7 @@ int bpf_kprobe_multi_link_attach(const u =20 ucookies =3D u64_to_user_ptr(attr->link_create.kprobe_multi.cookies); if (ucookies) { - cookies =3D kvmalloc(size, GFP_KERNEL); + cookies =3D kvmalloc_array(cnt, sizeof(*addrs), GFP_KERNEL); if (!cookies) { err =3D -ENOMEM; goto error; From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83628C43334 for ; Mon, 20 Jun 2022 13:07:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244738AbiFTNHm (ORCPT ); Mon, 20 Jun 2022 09:07:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244051AbiFTNEd (ORCPT ); Mon, 20 Jun 2022 09:04:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88F49193DA; Mon, 20 Jun 2022 05:59:42 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 25B5561535; Mon, 20 Jun 2022 12:59:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1C56C3411B; Mon, 20 Jun 2022 12:59:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729981; bh=1X9QZlKy3N/ytBJj/DbB5zz0kkGXy5zj9pdAlAhiWf4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RKh5KYl0CPQdbsa0AF6tCi6vdZktNY+p/UIAHZKeC5dbEhSTaHulR3ME9Nx7VZE5F z0pvjjomf3qU2h1fDDfBN/yOwDWvLYg9g+E6cJEHHx6vJk2Sc6r/XFTyO7mKulFGuB WOD7NqywzMb84LpQ4l6zUkxkIjXR3gp+Pf3IbP0Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Masahiro Yamada , Scott Wood , Michael Ellerman Subject: [PATCH 5.18 137/141] powerpc/book3e: get rid of #include Date: Mon, 20 Jun 2022 14:51:15 +0200 Message-Id: <20220620124733.608911236@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Masahiro Yamada commit 7ad4bd887d27c6b6ffbef216f19c19f8fe2b8f52 upstream. You cannot include here because it is generated in init/Makefile but there is no guarantee that it happens before arch/powerpc/mm/nohash/kaslr_booke.c is compiled for parallel builds. The places where you can reliably include are: - init/ (because init/Makefile can specify the dependency) - arch/*/boot/ (because it is compiled after vmlinux) Commit f231e4333312 ("hexagon: get rid of #include ") fixed the last breakage at that time, but powerpc re-added this. was unneeded because 'build_str' is almost the same as 'linux_banner' defined in init/version.c Let's copy the solution from MIPS. (get_random_boot() in arch/mips/kernel/relocate.c) Fixes: 6a38ea1d7b94 ("powerpc/fsl_booke/32: randomize the kernel image offs= et") Signed-off-by: Masahiro Yamada Acked-by: Scott Wood Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20220604085050.4078927-1-masahiroy@kernel.o= rg Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- arch/powerpc/mm/nohash/kaslr_booke.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) --- a/arch/powerpc/mm/nohash/kaslr_booke.c +++ b/arch/powerpc/mm/nohash/kaslr_booke.c @@ -18,7 +18,6 @@ #include #include #include -#include #include =20 struct regions { @@ -36,10 +35,6 @@ struct regions { int reserved_mem_size_cells; }; =20 -/* Simplified build-specific string for starting entropy. */ -static const char build_str[] =3D UTS_RELEASE " (" LINUX_COMPILE_BY "@" - LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION; - struct regions __initdata regions; =20 static __init void kaslr_get_cmdline(void *fdt) @@ -70,7 +65,8 @@ static unsigned long __init get_boot_see { unsigned long hash =3D 0; =20 - hash =3D rotate_xor(hash, build_str, sizeof(build_str)); + /* build-specific string for starting entropy. */ + hash =3D rotate_xor(hash, linux_banner, strlen(linux_banner)); hash =3D rotate_xor(hash, fdt, fdt_totalsize(fdt)); =20 return hash; From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80F60C43334 for ; Mon, 20 Jun 2022 13:07:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244789AbiFTNHt (ORCPT ); Mon, 20 Jun 2022 09:07:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244054AbiFTNEd (ORCPT ); Mon, 20 Jun 2022 09:04:33 -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 9C4EC18B14; Mon, 20 Jun 2022 05:59:48 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3832061541; Mon, 20 Jun 2022 12:59:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 333A7C341C4; Mon, 20 Jun 2022 12:59:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729987; bh=qndDqOAs9+3WFGICbDRUpXG2O5z0sRvlr66TBVrcpZU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GygTjxk4MuPa9voJGXgNJ3p7jjKc3HLxxePuKalL4tyVSR+QGp2oOHL7z33rLrCsA KvhCEmRZF3CnhHLBBiNW7zsain2tKo0fpYAt3+yJowWEC+ihVqfVHlbPF3gdHUVlq+ fmW3a8H+dJKC7524xzhrsgu/w0Y8AlLK6ioXITjw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mauro Carvalho Chehab , Rob Herring Subject: [PATCH 5.18 138/141] dt-bindings: mfd: bd9571mwv: update rohm,bd9571mwv.yaml reference Date: Mon, 20 Jun 2022 14:51:16 +0200 Message-Id: <20220620124733.638428436@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mauro Carvalho Chehab commit e0b5c5984d4810733b7c24a3d16c904fffc086d2 upstream. Changeset 983b62975e90 ("dt-bindings: mfd: bd9571mwv: Convert to json-schem= a") renamed: Documentation/devicetree/bindings/mfd/bd9571mwv.txt to: Documentation/devicetree/bindings/mfd/rohm,bd9571mwv.yaml. Update its cross-reference accordingly. Fixes: 983b62975e90 ("dt-bindings: mfd: bd9571mwv: Convert to json-schema") Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Rob Herring Link: https://lore.kernel.org/r/1906a4d935eab57c10ce09358eae02175ce4abb7.16= 54529011.git.mchehab@kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- Documentation/ABI/testing/sysfs-driver-bd9571mwv-regulator | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/ABI/testing/sysfs-driver-bd9571mwv-regulator b/D= ocumentation/ABI/testing/sysfs-driver-bd9571mwv-regulator index 42214b4ff14a..90596d8bb51c 100644 --- a/Documentation/ABI/testing/sysfs-driver-bd9571mwv-regulator +++ b/Documentation/ABI/testing/sysfs-driver-bd9571mwv-regulator @@ -26,6 +26,6 @@ Description: Read/write the current state of DDR Backup M= ode, which controls DDR Backup Mode must be explicitly enabled by the user, to invoke step 1. =20 - See also Documentation/devicetree/bindings/mfd/bd9571mwv.txt. + See also Documentation/devicetree/bindings/mfd/rohm,bd9571mwv.yaml. Users: User space applications for embedded boards equipped with a BD9571MWV PMIC. --=20 2.36.1 From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3EC3C43334 for ; Mon, 20 Jun 2022 13:07:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244826AbiFTNH4 (ORCPT ); Mon, 20 Jun 2022 09:07:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244090AbiFTNEe (ORCPT ); Mon, 20 Jun 2022 09:04:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 575AA193E1; Mon, 20 Jun 2022 05:59:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3873E6153E; Mon, 20 Jun 2022 12:59:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4388DC3411C; Mon, 20 Jun 2022 12:59:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729990; bh=aSD1zz0+mNqeznv6haUaGQ071TTWhczN1/kvaqFFRsI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uyxZxVS95C9+kvGt/Jk6ry3g1DxDZLSlZIJOy1F3tiVtHlUTd8vwRO+K2++S0pUIB Uc8tC9+KhJpMNkzBO33xI5SdhSkisJH8SIKEJzgkRWiZtrJde2RS0BmmzHe9q9wt0B Iwj5WoYO6u+CSJLg0Gg0uOm6iAubNvfrK+HLT3TM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mauro Carvalho Chehab , Rob Herring Subject: [PATCH 5.18 139/141] dt-bindings: interrupt-controller: update brcm,l2-intc.yaml reference Date: Mon, 20 Jun 2022 14:51:17 +0200 Message-Id: <20220620124733.667779397@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Mauro Carvalho Chehab commit 7e40381d8a33e41e347cea5bdd000091653000c6 upstream. Changeset 539d25b21fe8 ("dt-bindings: interrupt-controller: Convert Broadco= m STB L2 to YAML") renamed: Documentation/devicetree/bindings/interrupt-controller/brcm,l2-int= c.txt to: Documentation/devicetree/bindings/interrupt-controller/brcm,l2-intc.yam= l. Update its cross-reference accordingly. Fixes: 539d25b21fe8 ("dt-bindings: interrupt-controller: Convert Broadcom S= TB L2 to YAML") Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Rob Herring Link: https://lore.kernel.org/r/a40c02a7aaea91ea7b6ce24b6bc574ae5bcf4cf6.16= 54529011.git.mchehab@kernel.org Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- Documentation/devicetree/bindings/cpufreq/brcm,stb-avs-cpu-freq.txt | 2= +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/Documentation/devicetree/bindings/cpufreq/brcm,stb-avs-cpu-freq.txt +++ b/Documentation/devicetree/bindings/cpufreq/brcm,stb-avs-cpu-freq.txt @@ -16,7 +16,7 @@ has been processed. See [2] for more inf firmware. On some SoCs, this firmware supports DFS and DVFS in addition to Adaptive Voltage Scaling. =20 -[2] Documentation/devicetree/bindings/interrupt-controller/brcm,l2-intc.txt +[2] Documentation/devicetree/bindings/interrupt-controller/brcm,l2-intc.ya= ml =20 =20 Node brcm,avs-cpu-data-mem From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AFE67C433EF for ; Mon, 20 Jun 2022 13:08:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245059AbiFTNIX (ORCPT ); Mon, 20 Jun 2022 09:08:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244094AbiFTNEe (ORCPT ); Mon, 20 Jun 2022 09:04:34 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 057DE13CCB; Mon, 20 Jun 2022 05:59:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 542AFCE1386; Mon, 20 Jun 2022 12:59:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3292FC3411C; Mon, 20 Jun 2022 12:59:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729993; bh=zKDGnQNZ3Lcx01ngixrSGF90RNivdIWvffi8qbGBins=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BvJdd455yw7tMD0HR4B++j6+3USh9lXBTtaIrQGj+XgeQ1QdxOM1HKWn9UzDu6Tl4 dQcUtE4sU/GaDGPIizRQd6A4JoBjRu78s9mYqQkhjZxTXUyA0eeFkJIJ3a0l/31PSE dylJ58GPLoruubDKcmtzZO/Q/JYOzz/LoxCOITZ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Mike Snitzer Subject: [PATCH 5.18 140/141] dm: fix bio_set allocation Date: Mon, 20 Jun 2022 14:51:18 +0200 Message-Id: <20220620124733.697765253@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Christoph Hellwig commit 29dec90a0f1d961b93f34f910e9319d8cb23edbd upstream. The use of bioset_init_from_src mean that the pre-allocated pools weren't used for anything except parameter passing, and the integrity pool creation got completely lost for the actual live mapped_device. Fix that by assigning the actual preallocated dm_md_mempools to the mapped_device and using that for I/O instead of creating new mempools. Fixes: 2a2a4c510b76 ("dm: use bioset_init_from_src() to copy bio_set") Signed-off-by: Christoph Hellwig Signed-off-by: Mike Snitzer Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/md/dm-core.h | 11 +++++- drivers/md/dm-rq.c | 2 - drivers/md/dm-table.c | 11 ------ drivers/md/dm.c | 83 ++++++++++++++-------------------------------= ----- drivers/md/dm.h | 2 - 5 files changed, 34 insertions(+), 75 deletions(-) --- a/drivers/md/dm-core.h +++ b/drivers/md/dm-core.h @@ -32,6 +32,14 @@ struct dm_kobject_holder { * access their members! */ =20 +/* + * For mempools pre-allocation at the table loading time. + */ +struct dm_md_mempools { + struct bio_set bs; + struct bio_set io_bs; +}; + struct mapped_device { struct mutex suspend_lock; =20 @@ -109,8 +117,7 @@ struct mapped_device { /* * io objects are allocated from here. */ - struct bio_set io_bs; - struct bio_set bs; + struct dm_md_mempools *mempools; =20 /* kobject and completion */ struct dm_kobject_holder kobj_holder; --- a/drivers/md/dm-rq.c +++ b/drivers/md/dm-rq.c @@ -319,7 +319,7 @@ static int setup_clone(struct request *c { int r; =20 - r =3D blk_rq_prep_clone(clone, rq, &tio->md->bs, gfp_mask, + r =3D blk_rq_prep_clone(clone, rq, &tio->md->mempools->bs, gfp_mask, dm_rq_bio_constructor, tio); if (r) return r; --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c @@ -1030,17 +1030,6 @@ static int dm_table_alloc_md_mempools(st return 0; } =20 -void dm_table_free_md_mempools(struct dm_table *t) -{ - dm_free_md_mempools(t->mempools); - t->mempools =3D NULL; -} - -struct dm_md_mempools *dm_table_get_md_mempools(struct dm_table *t) -{ - return t->mempools; -} - static int setup_indexes(struct dm_table *t) { int i; --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -131,14 +131,6 @@ static int get_swap_bios(void) return latch; } =20 -/* - * For mempools pre-allocation at the table loading time. - */ -struct dm_md_mempools { - struct bio_set bs; - struct bio_set io_bs; -}; - struct table_device { struct list_head list; refcount_t count; @@ -573,7 +565,7 @@ static struct dm_io *alloc_io(struct map struct dm_target_io *tio; struct bio *clone; =20 - clone =3D bio_alloc_clone(bio->bi_bdev, bio, GFP_NOIO, &md->io_bs); + clone =3D bio_alloc_clone(bio->bi_bdev, bio, GFP_NOIO, &md->mempools->io_= bs); =20 tio =3D clone_to_tio(clone); tio->flags =3D 0; @@ -615,7 +607,7 @@ static struct bio *alloc_tio(struct clon clone =3D &tio->clone; } else { clone =3D bio_alloc_clone(ci->bio->bi_bdev, ci->bio, - gfp_mask, &ci->io->md->bs); + gfp_mask, &ci->io->md->mempools->bs); if (!clone) return NULL; =20 @@ -1775,8 +1767,7 @@ static void cleanup_mapped_device(struct { if (md->wq) destroy_workqueue(md->wq); - bioset_exit(&md->bs); - bioset_exit(&md->io_bs); + dm_free_md_mempools(md->mempools); =20 if (md->dax_dev) { dax_remove_host(md->disk); @@ -1948,48 +1939,6 @@ static void free_dev(struct mapped_devic kvfree(md); } =20 -static int __bind_mempools(struct mapped_device *md, struct dm_table *t) -{ - struct dm_md_mempools *p =3D dm_table_get_md_mempools(t); - int ret =3D 0; - - if (dm_table_bio_based(t)) { - /* - * The md may already have mempools that need changing. - * If so, reload bioset because front_pad may have changed - * because a different table was loaded. - */ - bioset_exit(&md->bs); - bioset_exit(&md->io_bs); - - } else if (bioset_initialized(&md->bs)) { - /* - * There's no need to reload with request-based dm - * because the size of front_pad doesn't change. - * Note for future: If you are to reload bioset, - * prep-ed requests in the queue may refer - * to bio from the old bioset, so you must walk - * through the queue to unprep. - */ - goto out; - } - - BUG_ON(!p || - bioset_initialized(&md->bs) || - bioset_initialized(&md->io_bs)); - - ret =3D bioset_init_from_src(&md->bs, &p->bs); - if (ret) - goto out; - ret =3D bioset_init_from_src(&md->io_bs, &p->io_bs); - if (ret) - bioset_exit(&md->bs); -out: - /* mempool bind completed, no longer need any mempools in the table */ - dm_table_free_md_mempools(t); - return ret; -} - /* * Bind a table to the device. */ @@ -2043,12 +1992,28 @@ static struct dm_table *__bind(struct ma * immutable singletons - used to optimize dm_mq_queue_rq. */ md->immutable_target =3D dm_table_get_immutable_target(t); - } =20 - ret =3D __bind_mempools(md, t); - if (ret) { - old_map =3D ERR_PTR(ret); - goto out; + /* + * There is no need to reload with request-based dm because the + * size of front_pad doesn't change. + * + * Note for future: If you are to reload bioset, prep-ed + * requests in the queue may refer to bio from the old bioset, + * so you must walk through the queue to unprep. + */ + if (!md->mempools) { + md->mempools =3D t->mempools; + t->mempools =3D NULL; + } + } else { + /* + * The md may already have mempools that need changing. + * If so, reload bioset because front_pad may have changed + * because a different table was loaded. + */ + dm_free_md_mempools(md->mempools); + md->mempools =3D t->mempools; + t->mempools =3D NULL; } =20 ret =3D dm_table_set_restrictions(t, md->queue, limits); --- a/drivers/md/dm.h +++ b/drivers/md/dm.h @@ -71,8 +71,6 @@ struct dm_target *dm_table_get_immutable struct dm_target *dm_table_get_wildcard_target(struct dm_table *t); bool dm_table_bio_based(struct dm_table *t); bool dm_table_request_based(struct dm_table *t); -void dm_table_free_md_mempools(struct dm_table *t); -struct dm_md_mempools *dm_table_get_md_mempools(struct dm_table *t); =20 void dm_lock_md_type(struct mapped_device *md); void dm_unlock_md_type(struct mapped_device *md); From nobody Sun Apr 26 08:12:01 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B64F0C43334 for ; Mon, 20 Jun 2022 13:08:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245047AbiFTNIT (ORCPT ); Mon, 20 Jun 2022 09:08:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244088AbiFTNEe (ORCPT ); Mon, 20 Jun 2022 09:04:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDEAB18B19; Mon, 20 Jun 2022 05:59:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5935761535; Mon, 20 Jun 2022 12:59:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DEEAC3411C; Mon, 20 Jun 2022 12:59:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729996; bh=PsuOK2C3uBGTYKptXUHyYaVSHfOkcCwrXcBW4kjkI2w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fS+lE5XzoFMRysFFZ0sJ1JgxapY+B4VeZgPhvgtf7GeofSKovjXBh4RciU3nbsU2Z 0UQ56J81M8OjhIMINA8gABMu4octCkd4ZgPzbWaj7woQjU/NdAcw9SpRO3MzdgnXGN +11WNEwJCCwTizz+iGfD4F/2UKGW+XrvKJQD445s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Peng Fan , Abel Vesa Subject: [PATCH 5.18 141/141] clk: imx8mp: fix usb_root_clk parent Date: Mon, 20 Jun 2022 14:51:19 +0200 Message-Id: <20220620124733.726338011@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Peng Fan commit cf7f3f4fa9e57b8e9f594823e77e6cbb0ce2b254 upstream. According to reference mannual CCGR77(usb) sources from hsio_axi, fix it. Fixes: 9c140d9926761 ("clk: imx: Add support for i.MX8MP clock driver") Signed-off-by: Peng Fan Reviewed-by: Abel Vesa Link: https://lore.kernel.org/r/20220507125430.793287-1-peng.fan@oss.nxp.com Signed-off-by: Abel Vesa Signed-off-by: Greg Kroah-Hartman Tested-by: Bagas Sanjaya Tested-by: Florian Fainelli Tested-by: Fox Chen Tested-by: Guenter Roeck Tested-by: Justin M. Forbes Tested-by: Linux Kernel Functional Testing Tested-by: Ron Economos Tested-by: Rudi Heitbaum Tested-by: Shuah Khan Tested-by: Sudip Mukherjee Tested-by: Zan Aziz --- drivers/clk/imx/clk-imx8mp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/clk/imx/clk-imx8mp.c +++ b/drivers/clk/imx/clk-imx8mp.c @@ -659,7 +659,7 @@ static int imx8mp_clocks_probe(struct pl hws[IMX8MP_CLK_UART2_ROOT] =3D imx_clk_hw_gate4("uart2_root_clk", "uart2"= , ccm_base + 0x44a0, 0); hws[IMX8MP_CLK_UART3_ROOT] =3D imx_clk_hw_gate4("uart3_root_clk", "uart3"= , ccm_base + 0x44b0, 0); hws[IMX8MP_CLK_UART4_ROOT] =3D imx_clk_hw_gate4("uart4_root_clk", "uart4"= , ccm_base + 0x44c0, 0); - hws[IMX8MP_CLK_USB_ROOT] =3D imx_clk_hw_gate4("usb_root_clk", "osc_32k", = ccm_base + 0x44d0, 0); + hws[IMX8MP_CLK_USB_ROOT] =3D imx_clk_hw_gate4("usb_root_clk", "hsio_axi",= ccm_base + 0x44d0, 0); hws[IMX8MP_CLK_USB_PHY_ROOT] =3D imx_clk_hw_gate4("usb_phy_root_clk", "us= b_phy_ref", ccm_base + 0x44f0, 0); hws[IMX8MP_CLK_USDHC1_ROOT] =3D imx_clk_hw_gate4("usdhc1_root_clk", "usdh= c1", ccm_base + 0x4510, 0); hws[IMX8MP_CLK_USDHC2_ROOT] =3D imx_clk_hw_gate4("usdhc2_root_clk", "usdh= c2", ccm_base + 0x4520, 0);